From 04893043ae9ea8aa82b712491ed25ba6c4ffbca3 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 25 May 2011 12:24:48 -0300 Subject: [media] DocBook: Add rules to auto-generate some media docbook Auto-generate the videodev2.h.xml,frontend.h.xml and the indexes. Some logic at the Makefile helps us to identify when a symbol is missing, like for example: Error: no ID for constraint linkend: V4L2-PIX-FMT-JPGL. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/Makefile | 279 ++++- Documentation/DocBook/dvb/frontend.h.xml | 428 ------- Documentation/DocBook/media-indices.tmpl | 89 -- Documentation/DocBook/v4l/videodev2.h.xml | 1946 ----------------------------- 4 files changed, 258 insertions(+), 2484 deletions(-) delete mode 100644 Documentation/DocBook/dvb/frontend.h.xml delete mode 100644 Documentation/DocBook/media-indices.tmpl delete mode 100644 Documentation/DocBook/v4l/videodev2.h.xml diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index 3cebfa0d1611..595bdd3acb6d 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile @@ -6,6 +6,8 @@ # To add a new book the only step required is to add the book to the # list of DOCBOOKS. +TMPMEDIA=.tmpmedia + DOCBOOKS := z8530book.xml mcabook.xml device-drivers.xml \ kernel-hacking.xml kernel-locking.xml deviceiobook.xml \ writing_usb_driver.xml networking.xml \ @@ -14,7 +16,7 @@ DOCBOOKS := z8530book.xml mcabook.xml device-drivers.xml \ genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml \ 80211.xml debugobjects.xml sh.xml regulator.xml \ alsa-driver-api.xml writing-an-alsa-driver.xml \ - tracepoint.xml media.xml drm.xml + tracepoint.xml $(TMPMEDIA)/media.xml drm.xml ### # The build process is as follows (targets): @@ -32,7 +34,7 @@ PS_METHOD = $(prefer-db2x) ### # The targets that may be used. -PHONY += xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs cleandocs xmldoclinks +PHONY += xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs cleandocs mediaprep BOOKS := $(addprefix $(obj)/,$(DOCBOOKS)) xmldocs: $(BOOKS) @@ -45,27 +47,13 @@ PDF := $(patsubst %.xml, %.pdf, $(BOOKS)) pdfdocs: $(PDF) HTML := $(sort $(patsubst %.xml, %.html, $(BOOKS))) -htmldocs: $(HTML) xmldoclinks +htmldocs: $(HTML) $(call build_main_index) $(call build_images) MAN := $(patsubst %.xml, %.9, $(BOOKS)) mandocs: $(MAN) -build_images = mkdir -p $(objtree)/Documentation/DocBook/media/ && \ - cp $(srctree)/Documentation/DocBook/dvb/*.png \ - $(srctree)/Documentation/DocBook/v4l/*.gif \ - $(objtree)/Documentation/DocBook/media/ - -xmldoclinks: -ifneq ($(objtree),$(srctree)) - for dep in dvb media-entities.tmpl media-indices.tmpl v4l; do \ - rm -f $(objtree)/Documentation/DocBook/$$dep \ - && ln -s $(srctree)/Documentation/DocBook/$$dep $(objtree)/Documentation/DocBook/ \ - || exit; \ - done -endif - installmandocs: mandocs mkdir -p /usr/local/man/man9/ install Documentation/DocBook/man/*.9.gz /usr/local/man/man9/ @@ -97,11 +85,11 @@ define rule_docproc ) > $(dir $@).$(notdir $@).cmd endef -%.xml: %.tmpl xmldoclinks FORCE +%.xml: %.tmpl FORCE $(call if_changed_rule,docproc) ### -#Read in all saved dependency files +#Read in all saved dependency files cmd_files := $(wildcard $(foreach f,$(BOOKS),$(dir $(f)).$(notdir $(f)).cmd)) ifneq ($(cmd_files),) @@ -150,7 +138,7 @@ quiet_cmd_db2pdf = PDF $@ index = index.html main_idx = Documentation/DocBook/$(index) -build_main_index = rm -rf $(main_idx) && \ +build_main_index = rm -rf $(main_idx); \ echo '

Linux Kernel HTML Documentation

' >> $(main_idx) && \ echo '

Kernel Version: $(KERNELVERSION)

' >> $(main_idx) && \ cat $(HTML) >> $(main_idx) @@ -240,7 +228,7 @@ clean-files := $(DOCBOOKS) \ $(patsubst %.xml, %.9, $(DOCBOOKS)) \ $(index) -clean-dirs := $(patsubst %.xml,%,$(DOCBOOKS)) man +clean-dirs := $(patsubst %.xml,%,$(DOCBOOKS)) man $(MEDIA_DIR) cleandocs: $(Q)rm -f $(call objectify, $(clean-files)) @@ -250,3 +238,252 @@ cleandocs: # information in a variable se we can use it in if_changed and friends. .PHONY: $(PHONY) + + +# +# Media build rules - Auto-generates media contents/indexes and *.h xml's +# + +SHELL=/bin/bash + +MEDIA_DIR=$(objtree)/Documentation/DocBook/$(TMPMEDIA) + +V4L_SGMLS = \ + $(shell ls $(srctree)/Documentation/DocBook/v4l/*.xml|perl -ne 'print "$$1 " if (m,.*/(.*)\n,)') \ + capture.c.xml \ + keytable.c.xml \ + v4l2grab.c.xml + +DVB_SGMLS = \ + $(shell ls $(srctree)/Documentation/DocBook/dvb/*.xml|perl -ne 'print "$$1 " if (m,.*/(.*)\n,)') + +MEDIA_TEMP = media-entities.tmpl \ + media-indices.tmpl \ + videodev2.h.xml \ + frontend.h.xml + +MEDIA_SGMLS = $(addprefix ./,$(V4L_SGMLS)) $(addprefix ./,$(DVB_SGMLS)) $(addprefix ./,$(MEDIA_TEMP)) + +MEDIA_TEMP_OBJ := $(addprefix $(MEDIA_DIR)/,$(MEDIA_TEMP)) + +FUNCS = \ + close \ + ioctl \ + mmap \ + munmap \ + open \ + poll \ + read \ + select \ + write \ + +IOCTLS = \ + $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/videodev2.h) \ + $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/media.h) \ + $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/v4l2-subdev.h) \ + VIDIOC_SUBDEV_G_FRAME_INTERVAL \ + VIDIOC_SUBDEV_S_FRAME_INTERVAL \ + VIDIOC_SUBDEV_ENUM_MBUS_CODE \ + VIDIOC_SUBDEV_ENUM_FRAME_SIZE \ + VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL \ + +TYPES = \ + $(shell perl -ne 'print "$$1 " if /^typedef\s+[^\s]+\s+([^\s]+)\;/' $(srctree)/include/linux/videodev2.h) + +ENUMS = \ + $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/videodev2.h) \ + $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/media.h) \ + $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-mediabus.h) \ + $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-subdev.h) + +STRUCTS = \ + $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/videodev2.h) \ + $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/media.h) \ + $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-subdev.h) \ + $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-mediabus.h) + +ERRORS = \ + EACCES \ + EAGAIN \ + EBADF \ + EBUSY \ + EFAULT \ + EIO \ + EINTR \ + EINVAL \ + ENFILE \ + ENOMEM \ + ENOSPC \ + ENOTTY \ + ENXIO \ + EMFILE \ + EPERM \ + ERANGE \ + EPIPE \ + +ESCAPE = \ + -e "s/&/\\&/g" \ + -e "s//\\>/g" + +FILENAME = \ + -e s,"^[^\/]*/",, \ + -e s/"\\.xml"// \ + -e s/"\\.tmpl"// \ + -e s/\\\./-/g \ + -e s/"^func-"// \ + -e s/"^pixfmt-"// \ + -e s/"^vidioc-"// + +# Generate references to these structs in videodev2.h.xml. +DOCUMENTED = \ + -e "s/\(enum *\)v4l2_mpeg_cx2341x_video_\([a-z]*_spatial_filter_type\)/\1v4l2_mpeg_cx2341x_video_\2<\/link>/g" \ + -e "s/\(\(enum\|struct\) *\)\(v4l2_[a-zA-Z0-9_]*\)/\1\3<\/link>/g" \ + -e "s/\(V4L2_PIX_FMT_[A-Z0-9_]\+\) /\1<\/link> /g" \ + -e ":a;s/\(linkend=\".*\)_\(.*\">\)/\1-\2/;ta" \ + -e "s/v4l2\-mpeg\-vbi\-ITV0/v4l2-mpeg-vbi-itv0-1/g" + +DVB_DOCUMENTED = \ + -e "s,\(define \)\([A-Z0-9_]\+\)\(\s\+_IO\),\1\\2\<\/link\>\3,g" \ + -e "s/\(linkend\=\"\)FE_SET_PROPERTY/\1FE_GET_PROPERTY/g" + + +# +# Media targets and dependencies +# + +$(obj)/$(TMPMEDIA)/media.xml: $(obj)/media.tmpl $(MEDIA_TEMP_OBJ) FORCE + $(call if_changed_rule,docproc) + +$(MEDIA_DIR)/v4l2.xml: + @$($(quiet)gen_xml) + @(mkdir -p $(MEDIA_DIR)) + @(cp $(srctree)/Documentation/DocBook/dvb/*.png $(srctree)/Documentation/DocBook/v4l/*.gif $(MEDIA_DIR)/) + @(ln -sf $(srctree)/Documentation/DocBook/v4l/*xml $(MEDIA_DIR)/) + @(ln -sf $(srctree)/Documentation/DocBook/dvb/*xml $(MEDIA_DIR)/) + +$(MEDIA_DIR)/videodev2.h.xml: $(srctree)/include/linux/videodev2.h $(MEDIA_DIR)/v4l2.xml + @$($(quiet)gen_xml) + @( \ + echo "") > $@ + @( \ + expand --tabs=8 < $< | \ + sed $(ESCAPE) $(DOCUMENTED) | \ + sed 's/i\.e\./&ie;/') >> $@ + @( \ + echo "") >> $@ + +$(MEDIA_DIR)/frontend.h.xml: $(srctree)/include/linux/dvb/frontend.h $(MEDIA_DIR)/v4l2.xml + @$($(quiet)gen_xml) + @( \ + echo "") > $@ + @( \ + expand --tabs=8 < $< | \ + sed $(ESCAPE) $(DVB_DOCUMENTED) | \ + sed 's/i\.e\./&ie;/') >> $@ + @( \ + echo "") >> $@ + +$(MEDIA_DIR)/media-entities.tmpl: $(MEDIA_DIR)/v4l2.xml + @$($(quiet)gen_xml) + @( \ + echo "") >$@ + @( \ + echo -e "\n") >>$@ + @( \ + for ident in $(FUNCS) ; do \ + entity=`echo $$ident | tr _ -` ; \ + echo "$$ident()\">" \ + >>$@ ; \ + done) + @( \ + echo -e "\n") >>$@ + @( \ + for ident in $(IOCTLS) ; do \ + entity=`echo $$ident | tr _ -` ; \ + id=`grep "$$ident" $(MEDIA_DIR)/vidioc-*.xml | sed -r s,"^.*/(.*).xml.*","\1",` ; \ + echo "$$ident\">" \ + >>$@ ; \ + done) + @( \ + echo -e "\n") >>$@ + @( \ + for ident in $(TYPES) ; do \ + entity=`echo $$ident | tr _ -` ; \ + echo "$$ident\">" >>$@ ; \ + done) + @( \ + echo -e "\n") >>$@ + @( \ + for ident in $(ENUMS) ; do \ + entity=`echo $$ident | sed -e "s/v4l2_mpeg_cx2341x_video_\([a-z]*_spatial_filter_type\)/\1/" | tr _ -` ; \ + echo "$$ident\">" >>$@ ; \ + done) + @( \ + echo -e "\n") >>$@ + @( \ + for ident in $(STRUCTS) ; do \ + entity=`echo $$ident | tr _ - | sed s/v4l2-mpeg-vbi-ITV0/v4l2-mpeg-vbi-itv0-1/g` ; \ + echo "$$ident\">" >>$@ ; \ + done) + @( \ + echo -e "\n") >>$@ + @( \ + for ident in $(ERRORS) ; do \ + echo "$$ident" \ + "error code\">" >>$@ ; \ + done) + @( \ + echo -e "\n") >>$@ + @( \ + for file in $(MEDIA_SGMLS) ; do \ + entity=`echo "$$file" | sed $(FILENAME) -e s/"^([^-]*)"/sub\1/` ; \ + if ! echo "$$file" | \ + grep -q -E -e '^(func|vidioc|pixfmt)-' ; then \ + echo "" >>$@ ; \ + fi ; \ + done) + @( \ + echo -e "\n") >>$@ + @( \ + for file in $(MEDIA_SGMLS) ; do \ + if echo "$$file" | \ + grep -q -E -e '(func|vidioc|pixfmt)-' ; then \ + entity=`echo "$$file" |sed $(FILENAME)` ; \ + echo "" >>$@ ; \ + fi ; \ + done) + +# Jade can auto-generate a list-of-tables, which includes all structs, +# but we only want data types, all types, and sorted please. +$(MEDIA_DIR)/media-indices.tmpl: $(MEDIA_DIR)/v4l2.xml + @$($(quiet)gen_xml) + @( \ + echo "") >$@ + @( \ + echo -e "\nList of Types") >>$@ + @( \ + for ident in $(TYPES) ; do \ + id=`echo $$ident | tr _ -` ; \ + echo "$$ident" >>$@ ; \ + done) + @( \ + for ident in $(ENUMS) ; do \ + id=`echo $$ident | sed -e "s/v4l2_mpeg_cx2341x_video_\([a-z]*_spatial_filter_type\)/\1/" | tr _ -`; \ + echo "enum $$ident" >>$@ ; \ + done) + @( \ + for ident in $(STRUCTS) ; do \ + id=`echo $$ident | tr _ - | sed s/v4l2-mpeg-vbi-ITV0/v4l2-mpeg-vbi-itv0-1/g` ; \ + echo "struct $$ident" >>$@ ; \ + done) + @( \ + echo "") >>$@ diff --git a/Documentation/DocBook/dvb/frontend.h.xml b/Documentation/DocBook/dvb/frontend.h.xml deleted file mode 100644 index d792f789ad3b..000000000000 --- a/Documentation/DocBook/dvb/frontend.h.xml +++ /dev/null @@ -1,428 +0,0 @@ - -/* - * frontend.h - * - * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de> - * Ralph Metzler <ralph@convergence.de> - * Holger Waechtler <holger@convergence.de> - * Andre Draszik <ad@convergence.de> - * for convergence integrated media GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * 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 _DVBFRONTEND_H_ -#define _DVBFRONTEND_H_ - -#include <linux/types.h> - -typedef enum fe_type { - FE_QPSK, - FE_QAM, - FE_OFDM, - FE_ATSC -} fe_type_t; - - -typedef enum fe_caps { - FE_IS_STUPID = 0, - FE_CAN_INVERSION_AUTO = 0x1, - FE_CAN_FEC_1_2 = 0x2, - FE_CAN_FEC_2_3 = 0x4, - FE_CAN_FEC_3_4 = 0x8, - FE_CAN_FEC_4_5 = 0x10, - FE_CAN_FEC_5_6 = 0x20, - FE_CAN_FEC_6_7 = 0x40, - FE_CAN_FEC_7_8 = 0x80, - FE_CAN_FEC_8_9 = 0x100, - FE_CAN_FEC_AUTO = 0x200, - FE_CAN_QPSK = 0x400, - FE_CAN_QAM_16 = 0x800, - FE_CAN_QAM_32 = 0x1000, - FE_CAN_QAM_64 = 0x2000, - FE_CAN_QAM_128 = 0x4000, - FE_CAN_QAM_256 = 0x8000, - FE_CAN_QAM_AUTO = 0x10000, - FE_CAN_TRANSMISSION_MODE_AUTO = 0x20000, - FE_CAN_BANDWIDTH_AUTO = 0x40000, - FE_CAN_GUARD_INTERVAL_AUTO = 0x80000, - FE_CAN_HIERARCHY_AUTO = 0x100000, - FE_CAN_8VSB = 0x200000, - FE_CAN_16VSB = 0x400000, - FE_HAS_EXTENDED_CAPS = 0x800000, /* We need more bitspace for newer APIs, indicate this. */ - FE_CAN_TURBO_FEC = 0x8000000, /* frontend supports "turbo fec modulation" */ - FE_CAN_2G_MODULATION = 0x10000000, /* frontend supports "2nd generation modulation" (DVB-S2) */ - FE_NEEDS_BENDING = 0x20000000, /* not supported anymore, don't use (frontend requires frequency bending) */ - FE_CAN_RECOVER = 0x40000000, /* frontend can recover from a cable unplug automatically */ - FE_CAN_MUTE_TS = 0x80000000 /* frontend can stop spurious TS data output */ -} fe_caps_t; - - -struct dvb_frontend_info { - char name[128]; - fe_type_t type; - __u32 frequency_min; - __u32 frequency_max; - __u32 frequency_stepsize; - __u32 frequency_tolerance; - __u32 symbol_rate_min; - __u32 symbol_rate_max; - __u32 symbol_rate_tolerance; /* ppm */ - __u32 notifier_delay; /* DEPRECATED */ - fe_caps_t caps; -}; - - -/** - * Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for - * the meaning of this struct... - */ -struct dvb_diseqc_master_cmd { - __u8 msg [6]; /* { framing, address, command, data [3] } */ - __u8 msg_len; /* valid values are 3...6 */ -}; - - -struct dvb_diseqc_slave_reply { - __u8 msg [4]; /* { framing, data [3] } */ - __u8 msg_len; /* valid values are 0...4, 0 means no msg */ - int timeout; /* return from ioctl after timeout ms with */ -}; /* errorcode when no message was received */ - - -typedef enum fe_sec_voltage { - SEC_VOLTAGE_13, - SEC_VOLTAGE_18, - SEC_VOLTAGE_OFF -} fe_sec_voltage_t; - - -typedef enum fe_sec_tone_mode { - SEC_TONE_ON, - SEC_TONE_OFF -} fe_sec_tone_mode_t; - - -typedef enum fe_sec_mini_cmd { - SEC_MINI_A, - SEC_MINI_B -} fe_sec_mini_cmd_t; - - -typedef enum fe_status { - FE_HAS_SIGNAL = 0x01, /* found something above the noise level */ - FE_HAS_CARRIER = 0x02, /* found a DVB signal */ - FE_HAS_VITERBI = 0x04, /* FEC is stable */ - FE_HAS_SYNC = 0x08, /* found sync bytes */ - FE_HAS_LOCK = 0x10, /* everything's working... */ - FE_TIMEDOUT = 0x20, /* no lock within the last ~2 seconds */ - FE_REINIT = 0x40 /* frontend was reinitialized, */ -} fe_status_t; /* application is recommended to reset */ - /* DiSEqC, tone and parameters */ - -typedef enum fe_spectral_inversion { - INVERSION_OFF, - INVERSION_ON, - INVERSION_AUTO -} fe_spectral_inversion_t; - - -typedef enum fe_code_rate { - FEC_NONE = 0, - FEC_1_2, - FEC_2_3, - FEC_3_4, - FEC_4_5, - FEC_5_6, - FEC_6_7, - FEC_7_8, - FEC_8_9, - FEC_AUTO, - FEC_3_5, - FEC_9_10, -} fe_code_rate_t; - - -typedef enum fe_modulation { - QPSK, - QAM_16, - QAM_32, - QAM_64, - QAM_128, - QAM_256, - QAM_AUTO, - VSB_8, - VSB_16, - PSK_8, - APSK_16, - APSK_32, - DQPSK, -} fe_modulation_t; - -typedef enum fe_transmit_mode { - TRANSMISSION_MODE_2K, - TRANSMISSION_MODE_8K, - TRANSMISSION_MODE_AUTO, - TRANSMISSION_MODE_4K, - TRANSMISSION_MODE_1K, - TRANSMISSION_MODE_16K, - TRANSMISSION_MODE_32K, -} fe_transmit_mode_t; - -typedef enum fe_bandwidth { - BANDWIDTH_8_MHZ, - BANDWIDTH_7_MHZ, - BANDWIDTH_6_MHZ, - BANDWIDTH_AUTO, - BANDWIDTH_5_MHZ, - BANDWIDTH_10_MHZ, - BANDWIDTH_1_712_MHZ, -} fe_bandwidth_t; - - -typedef enum fe_guard_interval { - GUARD_INTERVAL_1_32, - GUARD_INTERVAL_1_16, - GUARD_INTERVAL_1_8, - GUARD_INTERVAL_1_4, - GUARD_INTERVAL_AUTO, - GUARD_INTERVAL_1_128, - GUARD_INTERVAL_19_128, - GUARD_INTERVAL_19_256, -} fe_guard_interval_t; - - -typedef enum fe_hierarchy { - HIERARCHY_NONE, - HIERARCHY_1, - HIERARCHY_2, - HIERARCHY_4, - HIERARCHY_AUTO -} fe_hierarchy_t; - - -struct dvb_qpsk_parameters { - __u32 symbol_rate; /* symbol rate in Symbols per second */ - fe_code_rate_t fec_inner; /* forward error correction (see above) */ -}; - -struct dvb_qam_parameters { - __u32 symbol_rate; /* symbol rate in Symbols per second */ - fe_code_rate_t fec_inner; /* forward error correction (see above) */ - fe_modulation_t modulation; /* modulation type (see above) */ -}; - -struct dvb_vsb_parameters { - fe_modulation_t modulation; /* modulation type (see above) */ -}; - -struct dvb_ofdm_parameters { - fe_bandwidth_t bandwidth; - fe_code_rate_t code_rate_HP; /* high priority stream code rate */ - fe_code_rate_t code_rate_LP; /* low priority stream code rate */ - fe_modulation_t constellation; /* modulation type (see above) */ - fe_transmit_mode_t transmission_mode; - fe_guard_interval_t guard_interval; - fe_hierarchy_t hierarchy_information; -}; - - -struct dvb_frontend_parameters { - __u32 frequency; /* (absolute) frequency in Hz for QAM/OFDM/ATSC */ - /* intermediate frequency in kHz for QPSK */ - fe_spectral_inversion_t inversion; - union { - struct dvb_qpsk_parameters qpsk; - struct dvb_qam_parameters qam; - struct dvb_ofdm_parameters ofdm; - struct dvb_vsb_parameters vsb; - } u; -}; - - -struct dvb_frontend_event { - fe_status_t status; - struct dvb_frontend_parameters parameters; -}; - -/* S2API Commands */ -#define DTV_UNDEFINED 0 -#define DTV_TUNE 1 -#define DTV_CLEAR 2 -#define DTV_FREQUENCY 3 -#define DTV_MODULATION 4 -#define DTV_BANDWIDTH_HZ 5 -#define DTV_INVERSION 6 -#define DTV_DISEQC_MASTER 7 -#define DTV_SYMBOL_RATE 8 -#define DTV_INNER_FEC 9 -#define DTV_VOLTAGE 10 -#define DTV_TONE 11 -#define DTV_PILOT 12 -#define DTV_ROLLOFF 13 -#define DTV_DISEQC_SLAVE_REPLY 14 - -/* Basic enumeration set for querying unlimited capabilities */ -#define DTV_FE_CAPABILITY_COUNT 15 -#define DTV_FE_CAPABILITY 16 -#define DTV_DELIVERY_SYSTEM 17 - -/* ISDB-T and ISDB-Tsb */ -#define DTV_ISDBT_PARTIAL_RECEPTION 18 -#define DTV_ISDBT_SOUND_BROADCASTING 19 - -#define DTV_ISDBT_SB_SUBCHANNEL_ID 20 -#define DTV_ISDBT_SB_SEGMENT_IDX 21 -#define DTV_ISDBT_SB_SEGMENT_COUNT 22 - -#define DTV_ISDBT_LAYERA_FEC 23 -#define DTV_ISDBT_LAYERA_MODULATION 24 -#define DTV_ISDBT_LAYERA_SEGMENT_COUNT 25 -#define DTV_ISDBT_LAYERA_TIME_INTERLEAVING 26 - -#define DTV_ISDBT_LAYERB_FEC 27 -#define DTV_ISDBT_LAYERB_MODULATION 28 -#define DTV_ISDBT_LAYERB_SEGMENT_COUNT 29 -#define DTV_ISDBT_LAYERB_TIME_INTERLEAVING 30 - -#define DTV_ISDBT_LAYERC_FEC 31 -#define DTV_ISDBT_LAYERC_MODULATION 32 -#define DTV_ISDBT_LAYERC_SEGMENT_COUNT 33 -#define DTV_ISDBT_LAYERC_TIME_INTERLEAVING 34 - -#define DTV_API_VERSION 35 - -#define DTV_CODE_RATE_HP 36 -#define DTV_CODE_RATE_LP 37 -#define DTV_GUARD_INTERVAL 38 -#define DTV_TRANSMISSION_MODE 39 -#define DTV_HIERARCHY 40 - -#define DTV_ISDBT_LAYER_ENABLED 41 - -#define DTV_ISDBS_TS_ID 42 - -#define DTV_DVBT2_PLP_ID 43 - -#define DTV_MAX_COMMAND DTV_DVBT2_PLP_ID - -typedef enum fe_pilot { - PILOT_ON, - PILOT_OFF, - PILOT_AUTO, -} fe_pilot_t; - -typedef enum fe_rolloff { - ROLLOFF_35, /* Implied value in DVB-S, default for DVB-S2 */ - ROLLOFF_20, - ROLLOFF_25, - ROLLOFF_AUTO, -} fe_rolloff_t; - -typedef enum fe_delivery_system { - SYS_UNDEFINED, - SYS_DVBC_ANNEX_AC, - SYS_DVBC_ANNEX_B, - SYS_DVBT, - SYS_DSS, - SYS_DVBS, - SYS_DVBS2, - SYS_DVBH, - SYS_ISDBT, - SYS_ISDBS, - SYS_ISDBC, - SYS_ATSC, - SYS_ATSCMH, - SYS_DMBTH, - SYS_CMMB, - SYS_DAB, - SYS_DVBT2, -} fe_delivery_system_t; - -struct dtv_cmds_h { - char *name; /* A display name for debugging purposes */ - - __u32 cmd; /* A unique ID */ - - /* Flags */ - __u32 set:1; /* Either a set or get property */ - __u32 buffer:1; /* Does this property use the buffer? */ - __u32 reserved:30; /* Align */ -}; - -struct dtv_property { - __u32 cmd; - __u32 reserved[3]; - union { - __u32 data; - struct { - __u8 data[32]; - __u32 len; - __u32 reserved1[3]; - void *reserved2; - } buffer; - } u; - int result; -} __attribute__ ((packed)); - -/* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */ -#define DTV_IOCTL_MAX_MSGS 64 - -struct dtv_properties { - __u32 num; - struct dtv_property *props; -}; - -#define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties) -#define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties) - - -/** - * When set, this flag will disable any zigzagging or other "normal" tuning - * behaviour. Additionally, there will be no automatic monitoring of the lock - * status, and hence no frontend events will be generated. If a frontend device - * is closed, this flag will be automatically turned off when the device is - * reopened read-write. - */ -#define FE_TUNE_MODE_ONESHOT 0x01 - - -#define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info) - -#define FE_DISEQC_RESET_OVERLOAD _IO('o', 62) -#define FE_DISEQC_SEND_MASTER_CMD _IOW('o', 63, struct dvb_diseqc_master_cmd) -#define FE_DISEQC_RECV_SLAVE_REPLY _IOR('o', 64, struct dvb_diseqc_slave_reply) -#define FE_DISEQC_SEND_BURST _IO('o', 65) /* fe_sec_mini_cmd_t */ - -#define FE_SET_TONE _IO('o', 66) /* fe_sec_tone_mode_t */ -#define FE_SET_VOLTAGE _IO('o', 67) /* fe_sec_voltage_t */ -#define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68) /* int */ - -#define FE_READ_STATUS _IOR('o', 69, fe_status_t) -#define FE_READ_BER _IOR('o', 70, __u32) -#define FE_READ_SIGNAL_STRENGTH _IOR('o', 71, __u16) -#define FE_READ_SNR _IOR('o', 72, __u16) -#define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32) - -#define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters) -#define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters) -#define FE_SET_FRONTEND_TUNE_MODE _IO('o', 81) /* unsigned int */ -#define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event) - -#define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */ - -#endif /*_DVBFRONTEND_H_*/ - diff --git a/Documentation/DocBook/media-indices.tmpl b/Documentation/DocBook/media-indices.tmpl deleted file mode 100644 index 78d6031de001..000000000000 --- a/Documentation/DocBook/media-indices.tmpl +++ /dev/null @@ -1,89 +0,0 @@ - - -List of Types -v4l2_std_id -enum v4l2_buf_type -enum v4l2_colorspace -enum v4l2_ctrl_type -enum v4l2_exposure_auto_type -enum v4l2_field -enum v4l2_frmivaltypes -enum v4l2_frmsizetypes -enum v4l2_memory -enum v4l2_mpeg_audio_ac3_bitrate -enum v4l2_mpeg_audio_crc -enum v4l2_mpeg_audio_emphasis -enum v4l2_mpeg_audio_encoding -enum v4l2_mpeg_audio_l1_bitrate -enum v4l2_mpeg_audio_l2_bitrate -enum v4l2_mpeg_audio_l3_bitrate -enum v4l2_mpeg_audio_mode -enum v4l2_mpeg_audio_mode_extension -enum v4l2_mpeg_audio_sampling_freq -enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type -enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type -enum v4l2_mpeg_cx2341x_video_median_filter_type -enum v4l2_mpeg_cx2341x_video_spatial_filter_mode -enum v4l2_mpeg_cx2341x_video_temporal_filter_mode -enum v4l2_mpeg_stream_type -enum v4l2_mpeg_stream_vbi_fmt -enum v4l2_mpeg_video_aspect -enum v4l2_mpeg_video_bitrate_mode -enum v4l2_mpeg_video_encoding -enum v4l2_power_line_frequency -enum v4l2_priority -enum v4l2_tuner_type -enum v4l2_preemphasis -struct v4l2_audio -struct v4l2_audioout -struct v4l2_bt_timings -struct v4l2_buffer -struct v4l2_capability -struct v4l2_captureparm -struct v4l2_clip -struct v4l2_control -struct v4l2_crop -struct v4l2_cropcap -struct v4l2_dbg_chip_ident -struct v4l2_dbg_match -struct v4l2_dbg_register -struct v4l2_dv_enum_preset -struct v4l2_dv_preset -struct v4l2_dv_timings -struct v4l2_enc_idx -struct v4l2_enc_idx_entry -struct v4l2_encoder_cmd -struct v4l2_ext_control -struct v4l2_ext_controls -struct v4l2_fmtdesc -struct v4l2_format -struct v4l2_fract -struct v4l2_framebuffer -struct v4l2_frequency -struct v4l2_frmival_stepwise -struct v4l2_frmivalenum -struct v4l2_frmsize_discrete -struct v4l2_frmsize_stepwise -struct v4l2_frmsizeenum -struct v4l2_hw_freq_seek -struct v4l2_input -struct v4l2_jpegcompression -struct v4l2_modulator -struct v4l2_mpeg_vbi_fmt_ivtv -struct v4l2_output -struct v4l2_outputparm -struct v4l2_pix_format -struct v4l2_queryctrl -struct v4l2_querymenu -struct v4l2_rect -struct v4l2_requestbuffers -struct v4l2_sliced_vbi_cap -struct v4l2_sliced_vbi_data -struct v4l2_sliced_vbi_format -struct v4l2_standard -struct v4l2_streamparm -struct v4l2_timecode -struct v4l2_tuner -struct v4l2_vbi_format -struct v4l2_window - diff --git a/Documentation/DocBook/v4l/videodev2.h.xml b/Documentation/DocBook/v4l/videodev2.h.xml deleted file mode 100644 index c50536a4f596..000000000000 --- a/Documentation/DocBook/v4l/videodev2.h.xml +++ /dev/null @@ -1,1946 +0,0 @@ - -/* - * Video for Linux Two header file - * - * Copyright (C) 1999-2007 the contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * 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. - * - * Alternatively you can redistribute this file under the terms of the - * BSD license as stated below: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. The names of its contributors may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Header file for v4l or V4L2 drivers and applications - * with public API. - * All kernel-specific stuff were moved to media/v4l2-dev.h, so - * no #if __KERNEL tests are allowed here - * - * See http://linuxtv.org for more info - * - * Author: Bill Dirks <bill@thedirks.org> - * Justin Schoeman - * Hans Verkuil <hverkuil@xs4all.nl> - * et al. - */ -#ifndef __LINUX_VIDEODEV2_H -#define __LINUX_VIDEODEV2_H - -#ifdef __KERNEL__ -#include <linux/time.h> /* need struct timeval */ -#else -#include <sys/time.h> -#endif -#include <linux/compiler.h> -#include <linux/ioctl.h> -#include <linux/types.h> - -/* - * Common stuff for both V4L1 and V4L2 - * Moved from videodev.h - */ -#define VIDEO_MAX_FRAME 32 -#define VIDEO_MAX_PLANES 8 - -#ifndef __KERNEL__ - -/* These defines are V4L1 specific and should not be used with the V4L2 API! - They will be removed from this header in the future. */ - -#define VID_TYPE_CAPTURE 1 /* Can capture */ -#define VID_TYPE_TUNER 2 /* Can tune */ -#define VID_TYPE_TELETEXT 4 /* Does teletext */ -#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */ -#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */ -#define VID_TYPE_CLIPPING 32 /* Can clip */ -#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */ -#define VID_TYPE_SCALES 128 /* Scalable */ -#define VID_TYPE_MONOCHROME 256 /* Monochrome only */ -#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */ -#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */ -#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ -#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ -#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ -#endif - -/* - * M I S C E L L A N E O U S - */ - -/* Four-character-code (FOURCC) */ -#define v4l2_fourcc(a, b, c, d)\ - ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24)) - -/* - * E N U M S - */ -enum v4l2_field { - V4L2_FIELD_ANY = 0, /* driver can choose from none, - top, bottom, interlaced - depending on whatever it thinks - is approximate ... */ - V4L2_FIELD_NONE = 1, /* this device has no fields ... */ - V4L2_FIELD_TOP = 2, /* top field only */ - V4L2_FIELD_BOTTOM = 3, /* bottom field only */ - V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */ - V4L2_FIELD_SEQ_TB = 5, /* both fields sequential into one - buffer, top-bottom order */ - V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */ - V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into - separate buffers */ - V4L2_FIELD_INTERLACED_TB = 8, /* both fields interlaced, top field - first and the top field is - transmitted first */ - V4L2_FIELD_INTERLACED_BT = 9, /* both fields interlaced, top field - first and the bottom field is - transmitted first */ -}; -#define V4L2_FIELD_HAS_TOP(field) \ - ((field) == V4L2_FIELD_TOP ||\ - (field) == V4L2_FIELD_INTERLACED ||\ - (field) == V4L2_FIELD_INTERLACED_TB ||\ - (field) == V4L2_FIELD_INTERLACED_BT ||\ - (field) == V4L2_FIELD_SEQ_TB ||\ - (field) == V4L2_FIELD_SEQ_BT) -#define V4L2_FIELD_HAS_BOTTOM(field) \ - ((field) == V4L2_FIELD_BOTTOM ||\ - (field) == V4L2_FIELD_INTERLACED ||\ - (field) == V4L2_FIELD_INTERLACED_TB ||\ - (field) == V4L2_FIELD_INTERLACED_BT ||\ - (field) == V4L2_FIELD_SEQ_TB ||\ - (field) == V4L2_FIELD_SEQ_BT) -#define V4L2_FIELD_HAS_BOTH(field) \ - ((field) == V4L2_FIELD_INTERLACED ||\ - (field) == V4L2_FIELD_INTERLACED_TB ||\ - (field) == V4L2_FIELD_INTERLACED_BT ||\ - (field) == V4L2_FIELD_SEQ_TB ||\ - (field) == V4L2_FIELD_SEQ_BT) - -enum v4l2_buf_type { - V4L2_BUF_TYPE_VIDEO_CAPTURE = 1, - V4L2_BUF_TYPE_VIDEO_OUTPUT = 2, - V4L2_BUF_TYPE_VIDEO_OVERLAY = 3, - V4L2_BUF_TYPE_VBI_CAPTURE = 4, - V4L2_BUF_TYPE_VBI_OUTPUT = 5, - V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6, - V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7, -#if 1 - /* Experimental */ - V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8, -#endif - V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9, - V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE = 10, - V4L2_BUF_TYPE_PRIVATE = 0x80, -}; - -#define V4L2_TYPE_IS_MULTIPLANAR(type) \ - ((type) == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE \ - || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) - -#define V4L2_TYPE_IS_OUTPUT(type) \ - ((type) == V4L2_BUF_TYPE_VIDEO_OUTPUT \ - || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE \ - || (type) == V4L2_BUF_TYPE_VIDEO_OVERLAY \ - || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY \ - || (type) == V4L2_BUF_TYPE_VBI_OUTPUT \ - || (type) == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT) - -enum v4l2_tuner_type { - V4L2_TUNER_RADIO = 1, - V4L2_TUNER_ANALOG_TV = 2, - V4L2_TUNER_DIGITAL_TV = 3, -}; - -enum v4l2_memory { - V4L2_MEMORY_MMAP = 1, - V4L2_MEMORY_USERPTR = 2, - V4L2_MEMORY_OVERLAY = 3, -}; - -/* see also http://vektor.theorem.ca/graphics/ycbcr/ */ -enum v4l2_colorspace { - /* ITU-R 601 -- broadcast NTSC/PAL */ - V4L2_COLORSPACE_SMPTE170M = 1, - - /* 1125-Line (US) HDTV */ - V4L2_COLORSPACE_SMPTE240M = 2, - - /* HD and modern captures. */ - V4L2_COLORSPACE_REC709 = 3, - - /* broken BT878 extents (601, luma range 16-253 instead of 16-235) */ - V4L2_COLORSPACE_BT878 = 4, - - /* These should be useful. Assume 601 extents. */ - V4L2_COLORSPACE_470_SYSTEM_M = 5, - V4L2_COLORSPACE_470_SYSTEM_BG = 6, - - /* I know there will be cameras that send this. So, this is - * unspecified chromaticities and full 0-255 on each of the - * Y'CbCr components - */ - V4L2_COLORSPACE_JPEG = 7, - - /* For RGB colourspaces, this is probably a good start. */ - V4L2_COLORSPACE_SRGB = 8, -}; - -enum v4l2_priority { - V4L2_PRIORITY_UNSET = 0, /* not initialized */ - V4L2_PRIORITY_BACKGROUND = 1, - V4L2_PRIORITY_INTERACTIVE = 2, - V4L2_PRIORITY_RECORD = 3, - V4L2_PRIORITY_DEFAULT = V4L2_PRIORITY_INTERACTIVE, -}; - -struct v4l2_rect { - __s32 left; - __s32 top; - __s32 width; - __s32 height; -}; - -struct v4l2_fract { - __u32 numerator; - __u32 denominator; -}; - -/* - * D R I V E R C A P A B I L I T I E S - */ -struct v4l2_capability { - __u8 driver[16]; /* i.e.ie; "bttv" */ - __u8 card[32]; /* i.e.ie; "Hauppauge WinTV" */ - __u8 bus_info[32]; /* "PCI:" + pci_name(pci_dev) */ - __u32 version; /* should use KERNEL_VERSION() */ - __u32 capabilities; /* Device capabilities */ - __u32 reserved[4]; -}; - -/* Values for 'capabilities' field */ -#define V4L2_CAP_VIDEO_CAPTURE 0x00000001 /* Is a video capture device */ -#define V4L2_CAP_VIDEO_OUTPUT 0x00000002 /* Is a video output device */ -#define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */ -#define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */ -#define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */ -#define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */ -#define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ -#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ -#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 /* Can do video output overlay */ -#define V4L2_CAP_HW_FREQ_SEEK 0x00000400 /* Can do hardware frequency seek */ -#define V4L2_CAP_RDS_OUTPUT 0x00000800 /* Is an RDS encoder */ - -/* Is a video capture device that supports multiplanar formats */ -#define V4L2_CAP_VIDEO_CAPTURE_MPLANE 0x00001000 -/* Is a video output device that supports multiplanar formats */ -#define V4L2_CAP_VIDEO_OUTPUT_MPLANE 0x00002000 - -#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ -#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ -#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */ -#define V4L2_CAP_MODULATOR 0x00080000 /* has a modulator */ - -#define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */ -#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ -#define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ - -/* - * V I D E O I M A G E F O R M A T - */ -struct v4l2_pix_format { - __u32 width; - __u32 height; - __u32 pixelformat; - enum v4l2_field field; - __u32 bytesperline; /* for padding, zero if unused */ - __u32 sizeimage; - enum v4l2_colorspace colorspace; - __u32 priv; /* private data, depends on pixelformat */ -}; - -/* Pixel format FOURCC depth Description */ - -/* RGB formats */ -#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') /* 8 RGB-3-3-2 */ -#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4') /* 16 xxxxrrrr ggggbbbb */ -#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') /* 16 RGB-5-5-5 */ -#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */ -#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */ -#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */ -#define V4L2_PIX_FMT_BGR666 v4l2_fourcc('B', 'G', 'R', 'H') /* 18 BGR-6-6-6 */ -#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */ -#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */ -#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */ -#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */ - -/* Grey formats */ -#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ -#define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */ -#define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */ -#define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */ -#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ - -/* Grey bit-packed formats */ -#define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B') /* 10 Greyscale bit-packed */ - -/* Palette formats */ -#define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */ - -/* Luminance+Chrominance formats */ -#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') /* 9 YVU 4:1:0 */ -#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */ -#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */ -#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16 YUV 4:2:2 */ -#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */ -#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */ -#define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y') /* 16 YUV 4:2:2 */ -#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */ -#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P') /* 16 YVU411 planar */ -#define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y', '4', '1', 'P') /* 12 YUV 4:1:1 */ -#define V4L2_PIX_FMT_YUV444 v4l2_fourcc('Y', '4', '4', '4') /* 16 xxxxyyyy uuuuvvvv */ -#define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y', 'U', 'V', 'O') /* 16 YUV-5-5-5 */ -#define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y', 'U', 'V', 'P') /* 16 YUV-5-6-5 */ -#define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y', 'U', 'V', '4') /* 32 YUV-8-8-8-8 */ -#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */ -#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') /* 12 YUV 4:2:0 */ -#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* 8 8-bit color */ -#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2') /* 8 YUV 4:2:0 16x16 macroblocks */ -#define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0') /* 12 YUV 4:2:0 2 lines y, 1 line uv interleaved */ - -/* two planes -- one Y, one Cr + Cb interleaved */ -#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */ -#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */ -#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */ -#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */ - -/* two non contiguous planes - one Y, one Cr + Cb interleaved */ -#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */ -#define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */ - -/* three non contiguous planes - Y, Cb, Cr */ -#define V4L2_PIX_FMT_YUV420M v4l2_fourcc('Y', 'M', '1', '2') /* 12 YUV420 planar */ - -/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */ -#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ -#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ -#define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */ -#define V4L2_PIX_FMT_SRGGB8 v4l2_fourcc('R', 'G', 'G', 'B') /* 8 RGRG.. GBGB.. */ -#define V4L2_PIX_FMT_SBGGR10 v4l2_fourcc('B', 'G', '1', '0') /* 10 BGBG.. GRGR.. */ -#define V4L2_PIX_FMT_SGBRG10 v4l2_fourcc('G', 'B', '1', '0') /* 10 GBGB.. RGRG.. */ -#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10 GRGR.. BGBG.. */ -#define V4L2_PIX_FMT_SRGGB10 v4l2_fourcc('R', 'G', '1', '0') /* 10 RGRG.. GBGB.. */ - /* 10bit raw bayer DPCM compressed to 8 bits */ -#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0') - /* - * 10bit raw bayer, expanded to 16 bits - * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb... - */ -#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */ - -/* compressed formats */ -#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG */ -#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */ -#define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */ -#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 */ - -/* Vendor-specific formats */ -#define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */ -#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */ -#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */ -#define V4L2_PIX_FMT_SN9C20X_I420 v4l2_fourcc('S', '9', '2', '0') /* SN9C20x YUV 4:2:0 */ -#define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P', 'W', 'C', '1') /* pwc older webcam */ -#define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P', 'W', 'C', '2') /* pwc newer webcam */ -#define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E', '6', '2', '5') /* ET61X251 compression */ -#define V4L2_PIX_FMT_SPCA501 v4l2_fourcc('S', '5', '0', '1') /* YUYV per line */ -#define V4L2_PIX_FMT_SPCA505 v4l2_fourcc('S', '5', '0', '5') /* YYUV per line */ -#define V4L2_PIX_FMT_SPCA508 v4l2_fourcc('S', '5', '0', '8') /* YUVY per line */ -#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */ -#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */ -#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */ -#define V4L2_PIX_FMT_SN9C2028 v4l2_fourcc('S', 'O', 'N', 'X') /* compressed GBRG bayer */ -#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */ -#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ -#define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */ -#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */ -#define V4L2_PIX_FMT_STV0680 v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */ -#define V4L2_PIX_FMT_TM6000 v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 */ -#define V4L2_PIX_FMT_CIT_YYVYUY v4l2_fourcc('C', 'I', 'T', 'V') /* one line of Y then 1 line of VYUY */ -#define V4L2_PIX_FMT_KONICA420 v4l2_fourcc('K', 'O', 'N', 'I') /* YUV420 planar in blocks of 256 pixels */ - -/* - * F O R M A T E N U M E R A T I O N - */ -struct v4l2_fmtdesc { - __u32 index; /* Format number */ - enum v4l2_buf_type type; /* buffer type */ - __u32 flags; - __u8 description[32]; /* Description string */ - __u32 pixelformat; /* Format fourcc */ - __u32 reserved[4]; -}; - -#define V4L2_FMT_FLAG_COMPRESSED 0x0001 -#define V4L2_FMT_FLAG_EMULATED 0x0002 - -#if 1 - /* Experimental Frame Size and frame rate enumeration */ -/* - * F R A M E S I Z E E N U M E R A T I O N - */ -enum v4l2_frmsizetypes { - V4L2_FRMSIZE_TYPE_DISCRETE = 1, - V4L2_FRMSIZE_TYPE_CONTINUOUS = 2, - V4L2_FRMSIZE_TYPE_STEPWISE = 3, -}; - -struct v4l2_frmsize_discrete { - __u32 width; /* Frame width [pixel] */ - __u32 height; /* Frame height [pixel] */ -}; - -struct v4l2_frmsize_stepwise { - __u32 min_width; /* Minimum frame width [pixel] */ - __u32 max_width; /* Maximum frame width [pixel] */ - __u32 step_width; /* Frame width step size [pixel] */ - __u32 min_height; /* Minimum frame height [pixel] */ - __u32 max_height; /* Maximum frame height [pixel] */ - __u32 step_height; /* Frame height step size [pixel] */ -}; - -struct v4l2_frmsizeenum { - __u32 index; /* Frame size number */ - __u32 pixel_format; /* Pixel format */ - __u32 type; /* Frame size type the device supports. */ - - union { /* Frame size */ - struct v4l2_frmsize_discrete discrete; - struct v4l2_frmsize_stepwise stepwise; - }; - - __u32 reserved[2]; /* Reserved space for future use */ -}; - -/* - * F R A M E R A T E E N U M E R A T I O N - */ -enum v4l2_frmivaltypes { - V4L2_FRMIVAL_TYPE_DISCRETE = 1, - V4L2_FRMIVAL_TYPE_CONTINUOUS = 2, - V4L2_FRMIVAL_TYPE_STEPWISE = 3, -}; - -struct v4l2_frmival_stepwise { - struct v4l2_fract min; /* Minimum frame interval [s] */ - struct v4l2_fract max; /* Maximum frame interval [s] */ - struct v4l2_fract step; /* Frame interval step size [s] */ -}; - -struct v4l2_frmivalenum { - __u32 index; /* Frame format index */ - __u32 pixel_format; /* Pixel format */ - __u32 width; /* Frame width */ - __u32 height; /* Frame height */ - __u32 type; /* Frame interval type the device supports. */ - - union { /* Frame interval */ - struct v4l2_fract discrete; - struct v4l2_frmival_stepwise stepwise; - }; - - __u32 reserved[2]; /* Reserved space for future use */ -}; -#endif - -/* - * T I M E C O D E - */ -struct v4l2_timecode { - __u32 type; - __u32 flags; - __u8 frames; - __u8 seconds; - __u8 minutes; - __u8 hours; - __u8 userbits[4]; -}; - -/* Type */ -#define V4L2_TC_TYPE_24FPS 1 -#define V4L2_TC_TYPE_25FPS 2 -#define V4L2_TC_TYPE_30FPS 3 -#define V4L2_TC_TYPE_50FPS 4 -#define V4L2_TC_TYPE_60FPS 5 - -/* Flags */ -#define V4L2_TC_FLAG_DROPFRAME 0x0001 /* "drop-frame" mode */ -#define V4L2_TC_FLAG_COLORFRAME 0x0002 -#define V4L2_TC_USERBITS_field 0x000C -#define V4L2_TC_USERBITS_USERDEFINED 0x0000 -#define V4L2_TC_USERBITS_8BITCHARS 0x0008 -/* The above is based on SMPTE timecodes */ - -struct v4l2_jpegcompression { - int quality; - - int APPn; /* Number of APP segment to be written, - * must be 0..15 */ - int APP_len; /* Length of data in JPEG APPn segment */ - char APP_data[60]; /* Data in the JPEG APPn segment. */ - - int COM_len; /* Length of data in JPEG COM segment */ - char COM_data[60]; /* Data in JPEG COM segment */ - - __u32 jpeg_markers; /* Which markers should go into the JPEG - * output. Unless you exactly know what - * you do, leave them untouched. - * Inluding less markers will make the - * resulting code smaller, but there will - * be fewer applications which can read it. - * The presence of the APP and COM marker - * is influenced by APP_len and COM_len - * ONLY, not by this property! */ - -#define V4L2_JPEG_MARKER_DHT (1<<3) /* Define Huffman Tables */ -#define V4L2_JPEG_MARKER_DQT (1<<4) /* Define Quantization Tables */ -#define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */ -#define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */ -#define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will - * allways use APP0 */ -}; - -/* - * M E M O R Y - M A P P I N G B U F F E R S - */ -struct v4l2_requestbuffers { - __u32 count; - enum v4l2_buf_type type; - enum v4l2_memory memory; - __u32 reserved[2]; -}; - -/** - * struct v4l2_plane - plane info for multi-planar buffers - * @bytesused: number of bytes occupied by data in the plane (payload) - * @length: size of this plane (NOT the payload) in bytes - * @mem_offset: when memory in the associated struct v4l2_buffer is - * V4L2_MEMORY_MMAP, equals the offset from the start of - * the device memory for this plane (or is a "cookie" that - * should be passed to mmap() called on the video node) - * @userptr: when memory is V4L2_MEMORY_USERPTR, a userspace pointer - * pointing to this plane - * @data_offset: offset in the plane to the start of data; usually 0, - * unless there is a header in front of the data - * - * Multi-planar buffers consist of one or more planes, e.g. an YCbCr buffer - * with two planes can have one plane for Y, and another for interleaved CbCr - * components. Each plane can reside in a separate memory buffer, or even in - * a completely separate memory node (e.g. in embedded devices). - */ -struct v4l2_plane { - __u32 bytesused; - __u32 length; - union { - __u32 mem_offset; - unsigned long userptr; - } m; - __u32 data_offset; - __u32 reserved[11]; -}; - -/** - * struct v4l2_buffer - video buffer info - * @index: id number of the buffer - * @type: buffer type (type == *_MPLANE for multiplanar buffers) - * @bytesused: number of bytes occupied by data in the buffer (payload); - * unused (set to 0) for multiplanar buffers - * @flags: buffer informational flags - * @field: field order of the image in the buffer - * @timestamp: frame timestamp - * @timecode: frame timecode - * @sequence: sequence count of this frame - * @memory: the method, in which the actual video data is passed - * @offset: for non-multiplanar buffers with memory == V4L2_MEMORY_MMAP; - * offset from the start of the device memory for this plane, - * (or a "cookie" that should be passed to mmap() as offset) - * @userptr: for non-multiplanar buffers with memory == V4L2_MEMORY_USERPTR; - * a userspace pointer pointing to this buffer - * @planes: for multiplanar buffers; userspace pointer to the array of plane - * info structs for this buffer - * @length: size in bytes of the buffer (NOT its payload) for single-plane - * buffers (when type != *_MPLANE); number of elements in the - * planes array for multi-plane buffers - * @input: input number from which the video data has has been captured - * - * Contains data exchanged by application and driver using one of the Streaming - * I/O methods. - */ -struct v4l2_buffer { - __u32 index; - enum v4l2_buf_type type; - __u32 bytesused; - __u32 flags; - enum v4l2_field field; - struct timeval timestamp; - struct v4l2_timecode timecode; - __u32 sequence; - - /* memory location */ - enum v4l2_memory memory; - union { - __u32 offset; - unsigned long userptr; - struct v4l2_plane *planes; - } m; - __u32 length; - __u32 input; - __u32 reserved; -}; - -/* Flags for 'flags' field */ -#define V4L2_BUF_FLAG_MAPPED 0x0001 /* Buffer is mapped (flag) */ -#define V4L2_BUF_FLAG_QUEUED 0x0002 /* Buffer is queued for processing */ -#define V4L2_BUF_FLAG_DONE 0x0004 /* Buffer is ready */ -#define V4L2_BUF_FLAG_KEYFRAME 0x0008 /* Image is a keyframe (I-frame) */ -#define V4L2_BUF_FLAG_PFRAME 0x0010 /* Image is a P-frame */ -#define V4L2_BUF_FLAG_BFRAME 0x0020 /* Image is a B-frame */ -/* Buffer is ready, but the data contained within is corrupted. */ -#define V4L2_BUF_FLAG_ERROR 0x0040 -#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */ -#define V4L2_BUF_FLAG_INPUT 0x0200 /* input field is valid */ - -/* - * O V E R L A Y P R E V I E W - */ -struct v4l2_framebuffer { - __u32 capability; - __u32 flags; -/* FIXME: in theory we should pass something like PCI device + memory - * region + offset instead of some physical address */ - void *base; - struct v4l2_pix_format fmt; -}; -/* Flags for the 'capability' field. Read only */ -#define V4L2_FBUF_CAP_EXTERNOVERLAY 0x0001 -#define V4L2_FBUF_CAP_CHROMAKEY 0x0002 -#define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004 -#define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008 -#define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010 -#define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020 -#define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040 -#define V4L2_FBUF_CAP_SRC_CHROMAKEY 0x0080 -/* Flags for the 'flags' field. */ -#define V4L2_FBUF_FLAG_PRIMARY 0x0001 -#define V4L2_FBUF_FLAG_OVERLAY 0x0002 -#define V4L2_FBUF_FLAG_CHROMAKEY 0x0004 -#define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008 -#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010 -#define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020 -#define V4L2_FBUF_FLAG_SRC_CHROMAKEY 0x0040 - -struct v4l2_clip { - struct v4l2_rect c; - struct v4l2_clip __user *next; -}; - -struct v4l2_window { - struct v4l2_rect w; - enum v4l2_field field; - __u32 chromakey; - struct v4l2_clip __user *clips; - __u32 clipcount; - void __user *bitmap; - __u8 global_alpha; -}; - -/* - * C A P T U R E P A R A M E T E R S - */ -struct v4l2_captureparm { - __u32 capability; /* Supported modes */ - __u32 capturemode; /* Current mode */ - struct v4l2_fract timeperframe; /* Time per frame in .1us units */ - __u32 extendedmode; /* Driver-specific extensions */ - __u32 readbuffers; /* # of buffers for read */ - __u32 reserved[4]; -}; - -/* Flags for 'capability' and 'capturemode' fields */ -#define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */ -#define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */ - -struct v4l2_outputparm { - __u32 capability; /* Supported modes */ - __u32 outputmode; /* Current mode */ - struct v4l2_fract timeperframe; /* Time per frame in seconds */ - __u32 extendedmode; /* Driver-specific extensions */ - __u32 writebuffers; /* # of buffers for write */ - __u32 reserved[4]; -}; - -/* - * I N P U T I M A G E C R O P P I N G - */ -struct v4l2_cropcap { - enum v4l2_buf_type type; - struct v4l2_rect bounds; - struct v4l2_rect defrect; - struct v4l2_fract pixelaspect; -}; - -struct v4l2_crop { - enum v4l2_buf_type type; - struct v4l2_rect c; -}; - -/* - * A N A L O G V I D E O S T A N D A R D - */ - -typedef __u64 v4l2_std_id; - -/* one bit for each */ -#define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001) -#define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002) -#define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004) -#define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008) -#define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010) -#define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020) -#define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040) -#define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080) - -#define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100) -#define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200) -#define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400) -#define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800) - -#define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) -#define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) -#define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000) -#define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000) - -#define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000) -#define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000) -#define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000) -#define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000) -#define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000) -#define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000) -#define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000) -#define V4L2_STD_SECAM_LC ((v4l2_std_id)0x00800000) - -/* ATSC/HDTV */ -#define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000) -#define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000) - -/* FIXME: - Although std_id is 64 bits, there is an issue on PPC32 architecture that - makes switch(__u64) to break. So, there's a hack on v4l2-common.c rounding - this value to 32 bits. - As, currently, the max value is for V4L2_STD_ATSC_16_VSB (30 bits wide), - it should work fine. However, if needed to add more than two standards, - v4l2-common.c should be fixed. - */ - -/* some merged standards */ -#define V4L2_STD_MN (V4L2_STD_PAL_M|V4L2_STD_PAL_N|V4L2_STD_PAL_Nc|V4L2_STD_NTSC) -#define V4L2_STD_B (V4L2_STD_PAL_B|V4L2_STD_PAL_B1|V4L2_STD_SECAM_B) -#define V4L2_STD_GH (V4L2_STD_PAL_G|V4L2_STD_PAL_H|V4L2_STD_SECAM_G|V4L2_STD_SECAM_H) -#define V4L2_STD_DK (V4L2_STD_PAL_DK|V4L2_STD_SECAM_DK) - -/* some common needed stuff */ -#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\ - V4L2_STD_PAL_B1 |\ - V4L2_STD_PAL_G) -#define V4L2_STD_PAL_DK (V4L2_STD_PAL_D |\ - V4L2_STD_PAL_D1 |\ - V4L2_STD_PAL_K) -#define V4L2_STD_PAL (V4L2_STD_PAL_BG |\ - V4L2_STD_PAL_DK |\ - V4L2_STD_PAL_H |\ - V4L2_STD_PAL_I) -#define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\ - V4L2_STD_NTSC_M_JP |\ - V4L2_STD_NTSC_M_KR) -#define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\ - V4L2_STD_SECAM_K |\ - V4L2_STD_SECAM_K1) -#define V4L2_STD_SECAM (V4L2_STD_SECAM_B |\ - V4L2_STD_SECAM_G |\ - V4L2_STD_SECAM_H |\ - V4L2_STD_SECAM_DK |\ - V4L2_STD_SECAM_L |\ - V4L2_STD_SECAM_LC) - -#define V4L2_STD_525_60 (V4L2_STD_PAL_M |\ - V4L2_STD_PAL_60 |\ - V4L2_STD_NTSC |\ - V4L2_STD_NTSC_443) -#define V4L2_STD_625_50 (V4L2_STD_PAL |\ - V4L2_STD_PAL_N |\ - V4L2_STD_PAL_Nc |\ - V4L2_STD_SECAM) -#define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\ - V4L2_STD_ATSC_16_VSB) - -#define V4L2_STD_UNKNOWN 0 -#define V4L2_STD_ALL (V4L2_STD_525_60 |\ - V4L2_STD_625_50) - -struct v4l2_standard { - __u32 index; - v4l2_std_id id; - __u8 name[24]; - struct v4l2_fract frameperiod; /* Frames, not fields */ - __u32 framelines; - __u32 reserved[4]; -}; - -/* - * V I D E O T I M I N G S D V P R E S E T - */ -struct v4l2_dv_preset { - __u32 preset; - __u32 reserved[4]; -}; - -/* - * D V P R E S E T S E N U M E R A T I O N - */ -struct v4l2_dv_enum_preset { - __u32 index; - __u32 preset; - __u8 name[32]; /* Name of the preset timing */ - __u32 width; - __u32 height; - __u32 reserved[4]; -}; - -/* - * D V P R E S E T V A L U E S - */ -#define V4L2_DV_INVALID 0 -#define V4L2_DV_480P59_94 1 /* BT.1362 */ -#define V4L2_DV_576P50 2 /* BT.1362 */ -#define V4L2_DV_720P24 3 /* SMPTE 296M */ -#define V4L2_DV_720P25 4 /* SMPTE 296M */ -#define V4L2_DV_720P30 5 /* SMPTE 296M */ -#define V4L2_DV_720P50 6 /* SMPTE 296M */ -#define V4L2_DV_720P59_94 7 /* SMPTE 274M */ -#define V4L2_DV_720P60 8 /* SMPTE 274M/296M */ -#define V4L2_DV_1080I29_97 9 /* BT.1120/ SMPTE 274M */ -#define V4L2_DV_1080I30 10 /* BT.1120/ SMPTE 274M */ -#define V4L2_DV_1080I25 11 /* BT.1120 */ -#define V4L2_DV_1080I50 12 /* SMPTE 296M */ -#define V4L2_DV_1080I60 13 /* SMPTE 296M */ -#define V4L2_DV_1080P24 14 /* SMPTE 296M */ -#define V4L2_DV_1080P25 15 /* SMPTE 296M */ -#define V4L2_DV_1080P30 16 /* SMPTE 296M */ -#define V4L2_DV_1080P50 17 /* BT.1120 */ -#define V4L2_DV_1080P60 18 /* BT.1120 */ - -/* - * D V B T T I M I N G S - */ - -/* BT.656/BT.1120 timing data */ -struct v4l2_bt_timings { - __u32 width; /* width in pixels */ - __u32 height; /* height in lines */ - __u32 interlaced; /* Interlaced or progressive */ - __u32 polarities; /* Positive or negative polarity */ - __u64 pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->74250000 */ - __u32 hfrontporch; /* Horizpontal front porch in pixels */ - __u32 hsync; /* Horizontal Sync length in pixels */ - __u32 hbackporch; /* Horizontal back porch in pixels */ - __u32 vfrontporch; /* Vertical front porch in pixels */ - __u32 vsync; /* Vertical Sync length in lines */ - __u32 vbackporch; /* Vertical back porch in lines */ - __u32 il_vfrontporch; /* Vertical front porch for bottom field of - * interlaced field formats - */ - __u32 il_vsync; /* Vertical sync length for bottom field of - * interlaced field formats - */ - __u32 il_vbackporch; /* Vertical back porch for bottom field of - * interlaced field formats - */ - __u32 reserved[16]; -} __attribute__ ((packed)); - -/* Interlaced or progressive format */ -#define V4L2_DV_PROGRESSIVE 0 -#define V4L2_DV_INTERLACED 1 - -/* Polarities. If bit is not set, it is assumed to be negative polarity */ -#define V4L2_DV_VSYNC_POS_POL 0x00000001 -#define V4L2_DV_HSYNC_POS_POL 0x00000002 - - -/* DV timings */ -struct v4l2_dv_timings { - __u32 type; - union { - struct v4l2_bt_timings bt; - __u32 reserved[32]; - }; -} __attribute__ ((packed)); - -/* Values for the type field */ -#define V4L2_DV_BT_656_1120 0 /* BT.656/1120 timing type */ - -/* - * V I D E O I N P U T S - */ -struct v4l2_input { - __u32 index; /* Which input */ - __u8 name[32]; /* Label */ - __u32 type; /* Type of input */ - __u32 audioset; /* Associated audios (bitfield) */ - __u32 tuner; /* Associated tuner */ - v4l2_std_id std; - __u32 status; - __u32 capabilities; - __u32 reserved[3]; -}; - -/* Values for the 'type' field */ -#define V4L2_INPUT_TYPE_TUNER 1 -#define V4L2_INPUT_TYPE_CAMERA 2 - -/* field 'status' - general */ -#define V4L2_IN_ST_NO_POWER 0x00000001 /* Attached device is off */ -#define V4L2_IN_ST_NO_SIGNAL 0x00000002 -#define V4L2_IN_ST_NO_COLOR 0x00000004 - -/* field 'status' - sensor orientation */ -/* If sensor is mounted upside down set both bits */ -#define V4L2_IN_ST_HFLIP 0x00000010 /* Frames are flipped horizontally */ -#define V4L2_IN_ST_VFLIP 0x00000020 /* Frames are flipped vertically */ - -/* field 'status' - analog */ -#define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */ -#define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */ - -/* field 'status' - digital */ -#define V4L2_IN_ST_NO_SYNC 0x00010000 /* No synchronization lock */ -#define V4L2_IN_ST_NO_EQU 0x00020000 /* No equalizer lock */ -#define V4L2_IN_ST_NO_CARRIER 0x00040000 /* Carrier recovery failed */ - -/* field 'status' - VCR and set-top box */ -#define V4L2_IN_ST_MACROVISION 0x01000000 /* Macrovision detected */ -#define V4L2_IN_ST_NO_ACCESS 0x02000000 /* Conditional access denied */ -#define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */ - -/* capabilities flags */ -#define V4L2_IN_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */ -#define V4L2_IN_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */ -#define V4L2_IN_CAP_STD 0x00000004 /* Supports S_STD */ - -/* - * V I D E O O U T P U T S - */ -struct v4l2_output { - __u32 index; /* Which output */ - __u8 name[32]; /* Label */ - __u32 type; /* Type of output */ - __u32 audioset; /* Associated audios (bitfield) */ - __u32 modulator; /* Associated modulator */ - v4l2_std_id std; - __u32 capabilities; - __u32 reserved[3]; -}; -/* Values for the 'type' field */ -#define V4L2_OUTPUT_TYPE_MODULATOR 1 -#define V4L2_OUTPUT_TYPE_ANALOG 2 -#define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3 - -/* capabilities flags */ -#define V4L2_OUT_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */ -#define V4L2_OUT_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */ -#define V4L2_OUT_CAP_STD 0x00000004 /* Supports S_STD */ - -/* - * C O N T R O L S - */ -struct v4l2_control { - __u32 id; - __s32 value; -}; - -struct v4l2_ext_control { - __u32 id; - __u32 size; - __u32 reserved2[1]; - union { - __s32 value; - __s64 value64; - char *string; - }; -} __attribute__ ((packed)); - -struct v4l2_ext_controls { - __u32 ctrl_class; - __u32 count; - __u32 error_idx; - __u32 reserved[2]; - struct v4l2_ext_control *controls; -}; - -/* Values for ctrl_class field */ -#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */ -#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */ -#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */ -#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */ - -#define V4L2_CTRL_ID_MASK (0x0fffffff) -#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) -#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000) - -enum v4l2_ctrl_type { - V4L2_CTRL_TYPE_INTEGER = 1, - V4L2_CTRL_TYPE_BOOLEAN = 2, - V4L2_CTRL_TYPE_MENU = 3, - V4L2_CTRL_TYPE_BUTTON = 4, - V4L2_CTRL_TYPE_INTEGER64 = 5, - V4L2_CTRL_TYPE_CTRL_CLASS = 6, - V4L2_CTRL_TYPE_STRING = 7, -}; - -/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ -struct v4l2_queryctrl { - __u32 id; - enum v4l2_ctrl_type type; - __u8 name[32]; /* Whatever */ - __s32 minimum; /* Note signedness */ - __s32 maximum; - __s32 step; - __s32 default_value; - __u32 flags; - __u32 reserved[2]; -}; - -/* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */ -struct v4l2_querymenu { - __u32 id; - __u32 index; - __u8 name[32]; /* Whatever */ - __u32 reserved; -}; - -/* Control flags */ -#define V4L2_CTRL_FLAG_DISABLED 0x0001 -#define V4L2_CTRL_FLAG_GRABBED 0x0002 -#define V4L2_CTRL_FLAG_READ_ONLY 0x0004 -#define V4L2_CTRL_FLAG_UPDATE 0x0008 -#define V4L2_CTRL_FLAG_INACTIVE 0x0010 -#define V4L2_CTRL_FLAG_SLIDER 0x0020 -#define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040 - -/* Query flag, to be ORed with the control ID */ -#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000 - -/* User-class control IDs defined by V4L2 */ -#define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900) -#define V4L2_CID_USER_BASE V4L2_CID_BASE -/* IDs reserved for driver specific controls */ -#define V4L2_CID_PRIVATE_BASE 0x08000000 - -#define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1) -#define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0) -#define V4L2_CID_CONTRAST (V4L2_CID_BASE+1) -#define V4L2_CID_SATURATION (V4L2_CID_BASE+2) -#define V4L2_CID_HUE (V4L2_CID_BASE+3) -#define V4L2_CID_AUDIO_VOLUME (V4L2_CID_BASE+5) -#define V4L2_CID_AUDIO_BALANCE (V4L2_CID_BASE+6) -#define V4L2_CID_AUDIO_BASS (V4L2_CID_BASE+7) -#define V4L2_CID_AUDIO_TREBLE (V4L2_CID_BASE+8) -#define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE+9) -#define V4L2_CID_AUDIO_LOUDNESS (V4L2_CID_BASE+10) -#define V4L2_CID_BLACK_LEVEL (V4L2_CID_BASE+11) /* Deprecated */ -#define V4L2_CID_AUTO_WHITE_BALANCE (V4L2_CID_BASE+12) -#define V4L2_CID_DO_WHITE_BALANCE (V4L2_CID_BASE+13) -#define V4L2_CID_RED_BALANCE (V4L2_CID_BASE+14) -#define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE+15) -#define V4L2_CID_GAMMA (V4L2_CID_BASE+16) -#define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) /* Deprecated */ -#define V4L2_CID_EXPOSURE (V4L2_CID_BASE+17) -#define V4L2_CID_AUTOGAIN (V4L2_CID_BASE+18) -#define V4L2_CID_GAIN (V4L2_CID_BASE+19) -#define V4L2_CID_HFLIP (V4L2_CID_BASE+20) -#define V4L2_CID_VFLIP (V4L2_CID_BASE+21) - -/* Deprecated; use V4L2_CID_PAN_RESET and V4L2_CID_TILT_RESET */ -#define V4L2_CID_HCENTER (V4L2_CID_BASE+22) -#define V4L2_CID_VCENTER (V4L2_CID_BASE+23) - -#define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24) -enum v4l2_power_line_frequency { - V4L2_CID_POWER_LINE_FREQUENCY_DISABLED = 0, - V4L2_CID_POWER_LINE_FREQUENCY_50HZ = 1, - V4L2_CID_POWER_LINE_FREQUENCY_60HZ = 2, -}; -#define V4L2_CID_HUE_AUTO (V4L2_CID_BASE+25) -#define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE+26) -#define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27) -#define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28) -#define V4L2_CID_CHROMA_AGC (V4L2_CID_BASE+29) -#define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30) -#define V4L2_CID_COLORFX (V4L2_CID_BASE+31) -enum v4l2_colorfx { - V4L2_COLORFX_NONE = 0, - V4L2_COLORFX_BW = 1, - V4L2_COLORFX_SEPIA = 2, - V4L2_COLORFX_NEGATIVE = 3, - V4L2_COLORFX_EMBOSS = 4, - V4L2_COLORFX_SKETCH = 5, - V4L2_COLORFX_SKY_BLUE = 6, - V4L2_COLORFX_GRASS_GREEN = 7, - V4L2_COLORFX_SKIN_WHITEN = 8, - V4L2_COLORFX_VIVID = 9, -}; -#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32) -#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33) - -#define V4L2_CID_ROTATE (V4L2_CID_BASE+34) -#define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35) - -#define V4L2_CID_CHROMA_GAIN (V4L2_CID_BASE+36) - -#define V4L2_CID_ILLUMINATORS_1 (V4L2_CID_BASE+37) -#define V4L2_CID_ILLUMINATORS_2 (V4L2_CID_BASE+38) - -/* last CID + 1 */ -#define V4L2_CID_LASTP1 (V4L2_CID_BASE+39) - -/* MPEG-class control IDs defined by V4L2 */ -#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) -#define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1) - -/* MPEG streams */ -#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0) -enum v4l2_mpeg_stream_type { - V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0, /* MPEG-2 program stream */ - V4L2_MPEG_STREAM_TYPE_MPEG2_TS = 1, /* MPEG-2 transport stream */ - V4L2_MPEG_STREAM_TYPE_MPEG1_SS = 2, /* MPEG-1 system stream */ - V4L2_MPEG_STREAM_TYPE_MPEG2_DVD = 3, /* MPEG-2 DVD-compatible stream */ - V4L2_MPEG_STREAM_TYPE_MPEG1_VCD = 4, /* MPEG-1 VCD-compatible stream */ - V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5, /* MPEG-2 SVCD-compatible stream */ -}; -#define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_MPEG_BASE+1) -#define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_MPEG_BASE+2) -#define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_MPEG_BASE+3) -#define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4) -#define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5) -#define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6) -#define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE+7) -enum v4l2_mpeg_stream_vbi_fmt { - V4L2_MPEG_STREAM_VBI_FMT_NONE = 0, /* No VBI in the MPEG stream */ - V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, /* VBI in private packets, IVTV format */ -}; - -/* MPEG audio */ -#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100) -enum v4l2_mpeg_audio_sampling_freq { - V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0, - V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000 = 1, - V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000 = 2, -}; -#define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_MPEG_BASE+101) -enum v4l2_mpeg_audio_encoding { - V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0, - V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1, - V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2, - V4L2_MPEG_AUDIO_ENCODING_AAC = 3, - V4L2_MPEG_AUDIO_ENCODING_AC3 = 4, -}; -#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102) -enum v4l2_mpeg_audio_l1_bitrate { - V4L2_MPEG_AUDIO_L1_BITRATE_32K = 0, - V4L2_MPEG_AUDIO_L1_BITRATE_64K = 1, - V4L2_MPEG_AUDIO_L1_BITRATE_96K = 2, - V4L2_MPEG_AUDIO_L1_BITRATE_128K = 3, - V4L2_MPEG_AUDIO_L1_BITRATE_160K = 4, - V4L2_MPEG_AUDIO_L1_BITRATE_192K = 5, - V4L2_MPEG_AUDIO_L1_BITRATE_224K = 6, - V4L2_MPEG_AUDIO_L1_BITRATE_256K = 7, - V4L2_MPEG_AUDIO_L1_BITRATE_288K = 8, - V4L2_MPEG_AUDIO_L1_BITRATE_320K = 9, - V4L2_MPEG_AUDIO_L1_BITRATE_352K = 10, - V4L2_MPEG_AUDIO_L1_BITRATE_384K = 11, - V4L2_MPEG_AUDIO_L1_BITRATE_416K = 12, - V4L2_MPEG_AUDIO_L1_BITRATE_448K = 13, -}; -#define V4L2_CID_MPEG_AUDIO_L2_BITRATE (V4L2_CID_MPEG_BASE+103) -enum v4l2_mpeg_audio_l2_bitrate { - V4L2_MPEG_AUDIO_L2_BITRATE_32K = 0, - V4L2_MPEG_AUDIO_L2_BITRATE_48K = 1, - V4L2_MPEG_AUDIO_L2_BITRATE_56K = 2, - V4L2_MPEG_AUDIO_L2_BITRATE_64K = 3, - V4L2_MPEG_AUDIO_L2_BITRATE_80K = 4, - V4L2_MPEG_AUDIO_L2_BITRATE_96K = 5, - V4L2_MPEG_AUDIO_L2_BITRATE_112K = 6, - V4L2_MPEG_AUDIO_L2_BITRATE_128K = 7, - V4L2_MPEG_AUDIO_L2_BITRATE_160K = 8, - V4L2_MPEG_AUDIO_L2_BITRATE_192K = 9, - V4L2_MPEG_AUDIO_L2_BITRATE_224K = 10, - V4L2_MPEG_AUDIO_L2_BITRATE_256K = 11, - V4L2_MPEG_AUDIO_L2_BITRATE_320K = 12, - V4L2_MPEG_AUDIO_L2_BITRATE_384K = 13, -}; -#define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_MPEG_BASE+104) -enum v4l2_mpeg_audio_l3_bitrate { - V4L2_MPEG_AUDIO_L3_BITRATE_32K = 0, - V4L2_MPEG_AUDIO_L3_BITRATE_40K = 1, - V4L2_MPEG_AUDIO_L3_BITRATE_48K = 2, - V4L2_MPEG_AUDIO_L3_BITRATE_56K = 3, - V4L2_MPEG_AUDIO_L3_BITRATE_64K = 4, - V4L2_MPEG_AUDIO_L3_BITRATE_80K = 5, - V4L2_MPEG_AUDIO_L3_BITRATE_96K = 6, - V4L2_MPEG_AUDIO_L3_BITRATE_112K = 7, - V4L2_MPEG_AUDIO_L3_BITRATE_128K = 8, - V4L2_MPEG_AUDIO_L3_BITRATE_160K = 9, - V4L2_MPEG_AUDIO_L3_BITRATE_192K = 10, - V4L2_MPEG_AUDIO_L3_BITRATE_224K = 11, - V4L2_MPEG_AUDIO_L3_BITRATE_256K = 12, - V4L2_MPEG_AUDIO_L3_BITRATE_320K = 13, -}; -#define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_MPEG_BASE+105) -enum v4l2_mpeg_audio_mode { - V4L2_MPEG_AUDIO_MODE_STEREO = 0, - V4L2_MPEG_AUDIO_MODE_JOINT_STEREO = 1, - V4L2_MPEG_AUDIO_MODE_DUAL = 2, - V4L2_MPEG_AUDIO_MODE_MONO = 3, -}; -#define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_MPEG_BASE+106) -enum v4l2_mpeg_audio_mode_extension { - V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4 = 0, - V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8 = 1, - V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12 = 2, - V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16 = 3, -}; -#define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_MPEG_BASE+107) -enum v4l2_mpeg_audio_emphasis { - V4L2_MPEG_AUDIO_EMPHASIS_NONE = 0, - V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS = 1, - V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17 = 2, -}; -#define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_MPEG_BASE+108) -enum v4l2_mpeg_audio_crc { - V4L2_MPEG_AUDIO_CRC_NONE = 0, - V4L2_MPEG_AUDIO_CRC_CRC16 = 1, -}; -#define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109) -#define V4L2_CID_MPEG_AUDIO_AAC_BITRATE (V4L2_CID_MPEG_BASE+110) -#define V4L2_CID_MPEG_AUDIO_AC3_BITRATE (V4L2_CID_MPEG_BASE+111) -enum v4l2_mpeg_audio_ac3_bitrate { - V4L2_MPEG_AUDIO_AC3_BITRATE_32K = 0, - V4L2_MPEG_AUDIO_AC3_BITRATE_40K = 1, - V4L2_MPEG_AUDIO_AC3_BITRATE_48K = 2, - V4L2_MPEG_AUDIO_AC3_BITRATE_56K = 3, - V4L2_MPEG_AUDIO_AC3_BITRATE_64K = 4, - V4L2_MPEG_AUDIO_AC3_BITRATE_80K = 5, - V4L2_MPEG_AUDIO_AC3_BITRATE_96K = 6, - V4L2_MPEG_AUDIO_AC3_BITRATE_112K = 7, - V4L2_MPEG_AUDIO_AC3_BITRATE_128K = 8, - V4L2_MPEG_AUDIO_AC3_BITRATE_160K = 9, - V4L2_MPEG_AUDIO_AC3_BITRATE_192K = 10, - V4L2_MPEG_AUDIO_AC3_BITRATE_224K = 11, - V4L2_MPEG_AUDIO_AC3_BITRATE_256K = 12, - V4L2_MPEG_AUDIO_AC3_BITRATE_320K = 13, - V4L2_MPEG_AUDIO_AC3_BITRATE_384K = 14, - V4L2_MPEG_AUDIO_AC3_BITRATE_448K = 15, - V4L2_MPEG_AUDIO_AC3_BITRATE_512K = 16, - V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17, - V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18, -}; - -/* MPEG video */ -#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) -enum v4l2_mpeg_video_encoding { - V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0, - V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1, - V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC = 2, -}; -#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201) -enum v4l2_mpeg_video_aspect { - V4L2_MPEG_VIDEO_ASPECT_1x1 = 0, - V4L2_MPEG_VIDEO_ASPECT_4x3 = 1, - V4L2_MPEG_VIDEO_ASPECT_16x9 = 2, - V4L2_MPEG_VIDEO_ASPECT_221x100 = 3, -}; -#define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_MPEG_BASE+202) -#define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_MPEG_BASE+203) -#define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_MPEG_BASE+204) -#define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_MPEG_BASE+205) -#define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_MPEG_BASE+206) -enum v4l2_mpeg_video_bitrate_mode { - V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0, - V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1, -}; -#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207) -#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208) -#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209) -#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210) -#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211) - -/* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */ -#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000) -#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0) -enum v4l2_mpeg_cx2341x_video_spatial_filter_mode { - V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL = 0, - V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO = 1, -}; -#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+1) -#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+2) -enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type { - V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF = 0, - V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR = 1, - V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT = 2, - V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE = 3, - V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE = 4, -}; -#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+3) -enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type { - V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF = 0, - V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR = 1, -}; -#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+4) -enum v4l2_mpeg_cx2341x_video_temporal_filter_mode { - V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL = 0, - V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO = 1, -}; -#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+5) -#define V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+6) -enum v4l2_mpeg_cx2341x_video_median_filter_type { - V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF = 0, - V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR = 1, - V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT = 2, - V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT = 3, - V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG = 4, -}; -#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+7) -#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8) -#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9) -#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10) -#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11) - -/* Camera class control IDs */ -#define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900) -#define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1) - -#define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE+1) -enum v4l2_exposure_auto_type { - V4L2_EXPOSURE_AUTO = 0, - V4L2_EXPOSURE_MANUAL = 1, - V4L2_EXPOSURE_SHUTTER_PRIORITY = 2, - V4L2_EXPOSURE_APERTURE_PRIORITY = 3 -}; -#define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+2) -#define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_CAMERA_CLASS_BASE+3) - -#define V4L2_CID_PAN_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+4) -#define V4L2_CID_TILT_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+5) -#define V4L2_CID_PAN_RESET (V4L2_CID_CAMERA_CLASS_BASE+6) -#define V4L2_CID_TILT_RESET (V4L2_CID_CAMERA_CLASS_BASE+7) - -#define V4L2_CID_PAN_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+8) -#define V4L2_CID_TILT_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+9) - -#define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+10) -#define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11) -#define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12) - -#define V4L2_CID_ZOOM_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+13) -#define V4L2_CID_ZOOM_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+14) -#define V4L2_CID_ZOOM_CONTINUOUS (V4L2_CID_CAMERA_CLASS_BASE+15) - -#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16) - -#define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17) -#define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18) - -/* FM Modulator class control IDs */ -#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) -#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1) - -#define V4L2_CID_RDS_TX_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 1) -#define V4L2_CID_RDS_TX_PI (V4L2_CID_FM_TX_CLASS_BASE + 2) -#define V4L2_CID_RDS_TX_PTY (V4L2_CID_FM_TX_CLASS_BASE + 3) -#define V4L2_CID_RDS_TX_PS_NAME (V4L2_CID_FM_TX_CLASS_BASE + 5) -#define V4L2_CID_RDS_TX_RADIO_TEXT (V4L2_CID_FM_TX_CLASS_BASE + 6) - -#define V4L2_CID_AUDIO_LIMITER_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 64) -#define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 65) -#define V4L2_CID_AUDIO_LIMITER_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 66) - -#define V4L2_CID_AUDIO_COMPRESSION_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 80) -#define V4L2_CID_AUDIO_COMPRESSION_GAIN (V4L2_CID_FM_TX_CLASS_BASE + 81) -#define V4L2_CID_AUDIO_COMPRESSION_THRESHOLD (V4L2_CID_FM_TX_CLASS_BASE + 82) -#define V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME (V4L2_CID_FM_TX_CLASS_BASE + 83) -#define V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 84) - -#define V4L2_CID_PILOT_TONE_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 96) -#define V4L2_CID_PILOT_TONE_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 97) -#define V4L2_CID_PILOT_TONE_FREQUENCY (V4L2_CID_FM_TX_CLASS_BASE + 98) - -#define V4L2_CID_TUNE_PREEMPHASIS (V4L2_CID_FM_TX_CLASS_BASE + 112) -enum v4l2_preemphasis { - V4L2_PREEMPHASIS_DISABLED = 0, - V4L2_PREEMPHASIS_50_uS = 1, - V4L2_PREEMPHASIS_75_uS = 2, -}; -#define V4L2_CID_TUNE_POWER_LEVEL (V4L2_CID_FM_TX_CLASS_BASE + 113) -#define V4L2_CID_TUNE_ANTENNA_CAPACITOR (V4L2_CID_FM_TX_CLASS_BASE + 114) - -/* - * T U N I N G - */ -struct v4l2_tuner { - __u32 index; - __u8 name[32]; - enum v4l2_tuner_type type; - __u32 capability; - __u32 rangelow; - __u32 rangehigh; - __u32 rxsubchans; - __u32 audmode; - __s32 signal; - __s32 afc; - __u32 reserved[4]; -}; - -struct v4l2_modulator { - __u32 index; - __u8 name[32]; - __u32 capability; - __u32 rangelow; - __u32 rangehigh; - __u32 txsubchans; - __u32 reserved[4]; -}; - -/* Flags for the 'capability' field */ -#define V4L2_TUNER_CAP_LOW 0x0001 -#define V4L2_TUNER_CAP_NORM 0x0002 -#define V4L2_TUNER_CAP_STEREO 0x0010 -#define V4L2_TUNER_CAP_LANG2 0x0020 -#define V4L2_TUNER_CAP_SAP 0x0020 -#define V4L2_TUNER_CAP_LANG1 0x0040 -#define V4L2_TUNER_CAP_RDS 0x0080 -#define V4L2_TUNER_CAP_RDS_BLOCK_IO 0x0100 -#define V4L2_TUNER_CAP_RDS_CONTROLS 0x0200 - -/* Flags for the 'rxsubchans' field */ -#define V4L2_TUNER_SUB_MONO 0x0001 -#define V4L2_TUNER_SUB_STEREO 0x0002 -#define V4L2_TUNER_SUB_LANG2 0x0004 -#define V4L2_TUNER_SUB_SAP 0x0004 -#define V4L2_TUNER_SUB_LANG1 0x0008 -#define V4L2_TUNER_SUB_RDS 0x0010 - -/* Values for the 'audmode' field */ -#define V4L2_TUNER_MODE_MONO 0x0000 -#define V4L2_TUNER_MODE_STEREO 0x0001 -#define V4L2_TUNER_MODE_LANG2 0x0002 -#define V4L2_TUNER_MODE_SAP 0x0002 -#define V4L2_TUNER_MODE_LANG1 0x0003 -#define V4L2_TUNER_MODE_LANG1_LANG2 0x0004 - -struct v4l2_frequency { - __u32 tuner; - enum v4l2_tuner_type type; - __u32 frequency; - __u32 reserved[8]; -}; - -struct v4l2_hw_freq_seek { - __u32 tuner; - enum v4l2_tuner_type type; - __u32 seek_upward; - __u32 wrap_around; - __u32 spacing; - __u32 reserved[7]; -}; - -/* - * R D S - */ - -struct v4l2_rds_data { - __u8 lsb; - __u8 msb; - __u8 block; -} __attribute__ ((packed)); - -#define V4L2_RDS_BLOCK_MSK 0x7 -#define V4L2_RDS_BLOCK_A 0 -#define V4L2_RDS_BLOCK_B 1 -#define V4L2_RDS_BLOCK_C 2 -#define V4L2_RDS_BLOCK_D 3 -#define V4L2_RDS_BLOCK_C_ALT 4 -#define V4L2_RDS_BLOCK_INVALID 7 - -#define V4L2_RDS_BLOCK_CORRECTED 0x40 -#define V4L2_RDS_BLOCK_ERROR 0x80 - -/* - * A U D I O - */ -struct v4l2_audio { - __u32 index; - __u8 name[32]; - __u32 capability; - __u32 mode; - __u32 reserved[2]; -}; - -/* Flags for the 'capability' field */ -#define V4L2_AUDCAP_STEREO 0x00001 -#define V4L2_AUDCAP_AVL 0x00002 - -/* Flags for the 'mode' field */ -#define V4L2_AUDMODE_AVL 0x00001 - -struct v4l2_audioout { - __u32 index; - __u8 name[32]; - __u32 capability; - __u32 mode; - __u32 reserved[2]; -}; - -/* - * M P E G S E R V I C E S - * - * NOTE: EXPERIMENTAL API - */ -#if 1 -#define V4L2_ENC_IDX_FRAME_I (0) -#define V4L2_ENC_IDX_FRAME_P (1) -#define V4L2_ENC_IDX_FRAME_B (2) -#define V4L2_ENC_IDX_FRAME_MASK (0xf) - -struct v4l2_enc_idx_entry { - __u64 offset; - __u64 pts; - __u32 length; - __u32 flags; - __u32 reserved[2]; -}; - -#define V4L2_ENC_IDX_ENTRIES (64) -struct v4l2_enc_idx { - __u32 entries; - __u32 entries_cap; - __u32 reserved[4]; - struct v4l2_enc_idx_entry entry[V4L2_ENC_IDX_ENTRIES]; -}; - - -#define V4L2_ENC_CMD_START (0) -#define V4L2_ENC_CMD_STOP (1) -#define V4L2_ENC_CMD_PAUSE (2) -#define V4L2_ENC_CMD_RESUME (3) - -/* Flags for V4L2_ENC_CMD_STOP */ -#define V4L2_ENC_CMD_STOP_AT_GOP_END (1 << 0) - -struct v4l2_encoder_cmd { - __u32 cmd; - __u32 flags; - union { - struct { - __u32 data[8]; - } raw; - }; -}; - -#endif - - -/* - * D A T A S E R V I C E S ( V B I ) - * - * Data services API by Michael Schimek - */ - -/* Raw VBI */ -struct v4l2_vbi_format { - __u32 sampling_rate; /* in 1 Hz */ - __u32 offset; - __u32 samples_per_line; - __u32 sample_format; /* V4L2_PIX_FMT_* */ - __s32 start[2]; - __u32 count[2]; - __u32 flags; /* V4L2_VBI_* */ - __u32 reserved[2]; /* must be zero */ -}; - -/* VBI flags */ -#define V4L2_VBI_UNSYNC (1 << 0) -#define V4L2_VBI_INTERLACED (1 << 1) - -/* Sliced VBI - * - * This implements is a proposal V4L2 API to allow SLICED VBI - * required for some hardware encoders. It should change without - * notice in the definitive implementation. - */ - -struct v4l2_sliced_vbi_format { - __u16 service_set; - /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field - service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field - (equals frame lines 313-336 for 625 line video - standards, 263-286 for 525 line standards) */ - __u16 service_lines[2][24]; - __u32 io_size; - __u32 reserved[2]; /* must be zero */ -}; - -/* Teletext World System Teletext - (WST), defined on ITU-R BT.653-2 */ -#define V4L2_SLICED_TELETEXT_B (0x0001) -/* Video Program System, defined on ETS 300 231*/ -#define V4L2_SLICED_VPS (0x0400) -/* Closed Caption, defined on EIA-608 */ -#define V4L2_SLICED_CAPTION_525 (0x1000) -/* Wide Screen System, defined on ITU-R BT1119.1 */ -#define V4L2_SLICED_WSS_625 (0x4000) - -#define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525) -#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625) - -struct v4l2_sliced_vbi_cap { - __u16 service_set; - /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field - service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field - (equals frame lines 313-336 for 625 line video - standards, 263-286 for 525 line standards) */ - __u16 service_lines[2][24]; - enum v4l2_buf_type type; - __u32 reserved[3]; /* must be 0 */ -}; - -struct v4l2_sliced_vbi_data { - __u32 id; - __u32 field; /* 0: first field, 1: second field */ - __u32 line; /* 1-23 */ - __u32 reserved; /* must be 0 */ - __u8 data[48]; -}; - -/* - * Sliced VBI data inserted into MPEG Streams - */ - -/* - * V4L2_MPEG_STREAM_VBI_FMT_IVTV: - * - * Structure of payload contained in an MPEG 2 Private Stream 1 PES Packet in an - * MPEG-2 Program Pack that contains V4L2_MPEG_STREAM_VBI_FMT_IVTV Sliced VBI - * data - * - * Note, the MPEG-2 Program Pack and Private Stream 1 PES packet header - * definitions are not included here. See the MPEG-2 specifications for details - * on these headers. - */ - -/* Line type IDs */ -#define V4L2_MPEG_VBI_IVTV_TELETEXT_B (1) -#define V4L2_MPEG_VBI_IVTV_CAPTION_525 (4) -#define V4L2_MPEG_VBI_IVTV_WSS_625 (5) -#define V4L2_MPEG_VBI_IVTV_VPS (7) - -struct v4l2_mpeg_vbi_itv0_line { - __u8 id; /* One of V4L2_MPEG_VBI_IVTV_* above */ - __u8 data[42]; /* Sliced VBI data for the line */ -} __attribute__ ((packed)); - -struct v4l2_mpeg_vbi_itv0 { - __le32 linemask[2]; /* Bitmasks of VBI service lines present */ - struct v4l2_mpeg_vbi_itv0_line line[35]; -} __attribute__ ((packed)); - -struct v4l2_mpeg_vbi_ITV0 { - struct v4l2_mpeg_vbi_itv0_line line[36]; -} __attribute__ ((packed)); - -#define V4L2_MPEG_VBI_IVTV_MAGIC0 "itv0" -#define V4L2_MPEG_VBI_IVTV_MAGIC1 "ITV0" - -struct v4l2_mpeg_vbi_fmt_ivtv { - __u8 magic[4]; - union { - struct v4l2_mpeg_vbi_itv0 itv0; - struct v4l2_mpeg_vbi_ITV0 ITV0; - }; -} __attribute__ ((packed)); - -/* - * A G G R E G A T E S T R U C T U R E S - */ - -/** - * struct v4l2_plane_pix_format - additional, per-plane format definition - * @sizeimage: maximum size in bytes required for data, for which - * this plane will be used - * @bytesperline: distance in bytes between the leftmost pixels in two - * adjacent lines - */ -struct v4l2_plane_pix_format { - __u32 sizeimage; - __u16 bytesperline; - __u16 reserved[7]; -} __attribute__ ((packed)); - -/** - * struct v4l2_pix_format_mplane - multiplanar format definition - * @width: image width in pixels - * @height: image height in pixels - * @pixelformat: little endian four character code (fourcc) - * @field: field order (for interlaced video) - * @colorspace: supplemental to pixelformat - * @plane_fmt: per-plane information - * @num_planes: number of planes for this format - */ -struct v4l2_pix_format_mplane { - __u32 width; - __u32 height; - __u32 pixelformat; - enum v4l2_field field; - enum v4l2_colorspace colorspace; - - struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES]; - __u8 num_planes; - __u8 reserved[11]; -} __attribute__ ((packed)); - -/** - * struct v4l2_format - stream data format - * @type: type of the data stream - * @pix: definition of an image format - * @pix_mp: definition of a multiplanar image format - * @win: definition of an overlaid image - * @vbi: raw VBI capture or output parameters - * @sliced: sliced VBI capture or output parameters - * @raw_data: placeholder for future extensions and custom formats - */ -struct v4l2_format { - enum v4l2_buf_type type; - union { - struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */ - struct v4l2_pix_format_mplane pix_mp; /* V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE */ - struct v4l2_window win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */ - struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */ - struct v4l2_sliced_vbi_format sliced; /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */ - __u8 raw_data[200]; /* user-defined */ - } fmt; -}; - -/* Stream type-dependent parameters - */ -struct v4l2_streamparm { - enum v4l2_buf_type type; - union { - struct v4l2_captureparm capture; - struct v4l2_outputparm output; - __u8 raw_data[200]; /* user-defined */ - } parm; -}; - -/* - * E V E N T S - */ - -#define V4L2_EVENT_ALL 0 -#define V4L2_EVENT_VSYNC 1 -#define V4L2_EVENT_EOS 2 -#define V4L2_EVENT_PRIVATE_START 0x08000000 - -/* Payload for V4L2_EVENT_VSYNC */ -struct v4l2_event_vsync { - /* Can be V4L2_FIELD_ANY, _NONE, _TOP or _BOTTOM */ - __u8 field; -} __attribute__ ((packed)); - -struct v4l2_event { - __u32 type; - union { - struct v4l2_event_vsync vsync; - __u8 data[64]; - } u; - __u32 pending; - __u32 sequence; - struct timespec timestamp; - __u32 reserved[9]; -}; - -struct v4l2_event_subscription { - __u32 type; - __u32 reserved[7]; -}; - -/* - * A D V A N C E D D E B U G G I N G - * - * NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS! - * FOR DEBUGGING, TESTING AND INTERNAL USE ONLY! - */ - -/* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */ - -#define V4L2_CHIP_MATCH_HOST 0 /* Match against chip ID on host (0 for the host) */ -#define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver name */ -#define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */ -#define V4L2_CHIP_MATCH_AC97 3 /* Match against anciliary AC97 chip */ - -struct v4l2_dbg_match { - __u32 type; /* Match type */ - union { /* Match this chip, meaning determined by type */ - __u32 addr; - char name[32]; - }; -} __attribute__ ((packed)); - -struct v4l2_dbg_register { - struct v4l2_dbg_match match; - __u32 size; /* register size in bytes */ - __u64 reg; - __u64 val; -} __attribute__ ((packed)); - -/* VIDIOC_DBG_G_CHIP_IDENT */ -struct v4l2_dbg_chip_ident { - struct v4l2_dbg_match match; - __u32 ident; /* chip identifier as specified in <media/v4l2-chip-ident.h> */ - __u32 revision; /* chip revision, chip specific */ -} __attribute__ ((packed)); - -/* - * I O C T L C O D E S F O R V I D E O D E V I C E S - * - */ -#define VIDIOC_QUERYCAP _IOR('V', 0, struct v4l2_capability) -#define VIDIOC_RESERVED _IO('V', 1) -#define VIDIOC_ENUM_FMT _IOWR('V', 2, struct v4l2_fmtdesc) -#define VIDIOC_G_FMT _IOWR('V', 4, struct v4l2_format) -#define VIDIOC_S_FMT _IOWR('V', 5, struct v4l2_format) -#define VIDIOC_REQBUFS _IOWR('V', 8, struct v4l2_requestbuffers) -#define VIDIOC_QUERYBUF _IOWR('V', 9, struct v4l2_buffer) -#define VIDIOC_G_FBUF _IOR('V', 10, struct v4l2_framebuffer) -#define VIDIOC_S_FBUF _IOW('V', 11, struct v4l2_framebuffer) -#define VIDIOC_OVERLAY _IOW('V', 14, int) -#define VIDIOC_QBUF _IOWR('V', 15, struct v4l2_buffer) -#define VIDIOC_DQBUF _IOWR('V', 17, struct v4l2_buffer) -#define VIDIOC_STREAMON _IOW('V', 18, int) -#define VIDIOC_STREAMOFF _IOW('V', 19, int) -#define VIDIOC_G_PARM _IOWR('V', 21, struct v4l2_streamparm) -#define VIDIOC_S_PARM _IOWR('V', 22, struct v4l2_streamparm) -#define VIDIOC_G_STD _IOR('V', 23, v4l2_std_id) -#define VIDIOC_S_STD _IOW('V', 24, v4l2_std_id) -#define VIDIOC_ENUMSTD _IOWR('V', 25, struct v4l2_standard) -#define VIDIOC_ENUMINPUT _IOWR('V', 26, struct v4l2_input) -#define VIDIOC_G_CTRL _IOWR('V', 27, struct v4l2_control) -#define VIDIOC_S_CTRL _IOWR('V', 28, struct v4l2_control) -#define VIDIOC_G_TUNER _IOWR('V', 29, struct v4l2_tuner) -#define VIDIOC_S_TUNER _IOW('V', 30, struct v4l2_tuner) -#define VIDIOC_G_AUDIO _IOR('V', 33, struct v4l2_audio) -#define VIDIOC_S_AUDIO _IOW('V', 34, struct v4l2_audio) -#define VIDIOC_QUERYCTRL _IOWR('V', 36, struct v4l2_queryctrl) -#define VIDIOC_QUERYMENU _IOWR('V', 37, struct v4l2_querymenu) -#define VIDIOC_G_INPUT _IOR('V', 38, int) -#define VIDIOC_S_INPUT _IOWR('V', 39, int) -#define VIDIOC_G_OUTPUT _IOR('V', 46, int) -#define VIDIOC_S_OUTPUT _IOWR('V', 47, int) -#define VIDIOC_ENUMOUTPUT _IOWR('V', 48, struct v4l2_output) -#define VIDIOC_G_AUDOUT _IOR('V', 49, struct v4l2_audioout) -#define VIDIOC_S_AUDOUT _IOW('V', 50, struct v4l2_audioout) -#define VIDIOC_G_MODULATOR _IOWR('V', 54, struct v4l2_modulator) -#define VIDIOC_S_MODULATOR _IOW('V', 55, struct v4l2_modulator) -#define VIDIOC_G_FREQUENCY _IOWR('V', 56, struct v4l2_frequency) -#define VIDIOC_S_FREQUENCY _IOW('V', 57, struct v4l2_frequency) -#define VIDIOC_CROPCAP _IOWR('V', 58, struct v4l2_cropcap) -#define VIDIOC_G_CROP _IOWR('V', 59, struct v4l2_crop) -#define VIDIOC_S_CROP _IOW('V', 60, struct v4l2_crop) -#define VIDIOC_G_JPEGCOMP _IOR('V', 61, struct v4l2_jpegcompression) -#define VIDIOC_S_JPEGCOMP _IOW('V', 62, struct v4l2_jpegcompression) -#define VIDIOC_QUERYSTD _IOR('V', 63, v4l2_std_id) -#define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format) -#define VIDIOC_ENUMAUDIO _IOWR('V', 65, struct v4l2_audio) -#define VIDIOC_ENUMAUDOUT _IOWR('V', 66, struct v4l2_audioout) -#define VIDIOC_G_PRIORITY _IOR('V', 67, enum v4l2_priority) -#define VIDIOC_S_PRIORITY _IOW('V', 68, enum v4l2_priority) -#define VIDIOC_G_SLICED_VBI_CAP _IOWR('V', 69, struct v4l2_sliced_vbi_cap) -#define VIDIOC_LOG_STATUS _IO('V', 70) -#define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls) -#define VIDIOC_S_EXT_CTRLS _IOWR('V', 72, struct v4l2_ext_controls) -#define VIDIOC_TRY_EXT_CTRLS _IOWR('V', 73, struct v4l2_ext_controls) -#if 1 -#define VIDIOC_ENUM_FRAMESIZES _IOWR('V', 74, struct v4l2_frmsizeenum) -#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR('V', 75, struct v4l2_frmivalenum) -#define VIDIOC_G_ENC_INDEX _IOR('V', 76, struct v4l2_enc_idx) -#define VIDIOC_ENCODER_CMD _IOWR('V', 77, struct v4l2_encoder_cmd) -#define VIDIOC_TRY_ENCODER_CMD _IOWR('V', 78, struct v4l2_encoder_cmd) -#endif - -#if 1 -/* Experimental, meant for debugging, testing and internal use. - Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined. - You must be root to use these ioctls. Never use these in applications! */ -#define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_dbg_register) -#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register) - -/* Experimental, meant for debugging, testing and internal use. - Never use this ioctl in applications! */ -#define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident) -#endif - -#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) -#define VIDIOC_ENUM_DV_PRESETS _IOWR('V', 83, struct v4l2_dv_enum_preset) -#define VIDIOC_S_DV_PRESET _IOWR('V', 84, struct v4l2_dv_preset) -#define VIDIOC_G_DV_PRESET _IOWR('V', 85, struct v4l2_dv_preset) -#define VIDIOC_QUERY_DV_PRESET _IOR('V', 86, struct v4l2_dv_preset) -#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings) -#define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings) -#define VIDIOC_DQEVENT _IOR('V', 89, struct v4l2_event) -#define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription) -#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription) - -/* Reminder: when adding new ioctls please add support for them to - drivers/media/video/v4l2-compat-ioctl32.c as well! */ - -#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */ - -#endif /* __LINUX_VIDEODEV2_H */ - -- cgit v1.2.3 From 4266129964b8238526936d723de65b419d8069c6 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 31 May 2011 16:27:44 -0300 Subject: [media] DocBook: Move all media docbook stuff into its own directory This patch addresses several issues pointed by Randy Dunlap at changeset ece722c: - In the generated index.html file, "media" is listed first, but it should be listed in alphabetical order, not first. - The generated files are (hidden) in .tmpmedia/ - The link from the top-level index.html file to "media" is to media/index.html, but the file is actually in .tmpmedia/media/index.html - Please build docs with and without using "O=builddir" and test that. - Would it be possible for media to have its own Makefile instead of merging into this one? Due to the way cleandocs target works, I had to rename the media DocBook to media_api, otherwise cleandocs would remove the /media directory. Thanks-to: Randy Dunlap Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/.gitignore | 11 +- Documentation/DocBook/Makefile | 261 +- Documentation/DocBook/dvb/.gitignore | 1 - Documentation/DocBook/dvb/audio.xml | 1473 ----------- Documentation/DocBook/dvb/ca.xml | 221 -- Documentation/DocBook/dvb/demux.xml | 973 -------- Documentation/DocBook/dvb/dvbapi.xml | 121 - Documentation/DocBook/dvb/dvbproperty.xml | 590 ----- Documentation/DocBook/dvb/dvbstb.pdf | Bin 1881 -> 0 bytes Documentation/DocBook/dvb/dvbstb.png | Bin 22655 -> 0 bytes Documentation/DocBook/dvb/examples.xml | 365 --- Documentation/DocBook/dvb/frontend.xml | 1851 -------------- Documentation/DocBook/dvb/intro.xml | 191 -- Documentation/DocBook/dvb/kdapi.xml | 2309 ------------------ Documentation/DocBook/dvb/net.xml | 12 - Documentation/DocBook/dvb/video.xml | 1971 --------------- Documentation/DocBook/media-entities.tmpl | 464 ---- Documentation/DocBook/media.tmpl | 115 - Documentation/DocBook/media/Makefile | 259 ++ Documentation/DocBook/media/dvb/.gitignore | 1 + Documentation/DocBook/media/dvb/audio.xml | 1473 +++++++++++ Documentation/DocBook/media/dvb/ca.xml | 221 ++ Documentation/DocBook/media/dvb/demux.xml | 973 ++++++++ Documentation/DocBook/media/dvb/dvbapi.xml | 121 + Documentation/DocBook/media/dvb/dvbproperty.xml | 590 +++++ Documentation/DocBook/media/dvb/dvbstb.pdf | Bin 0 -> 1881 bytes Documentation/DocBook/media/dvb/dvbstb.png | Bin 0 -> 22655 bytes Documentation/DocBook/media/dvb/examples.xml | 365 +++ Documentation/DocBook/media/dvb/frontend.xml | 1851 ++++++++++++++ Documentation/DocBook/media/dvb/intro.xml | 191 ++ Documentation/DocBook/media/dvb/kdapi.xml | 2309 ++++++++++++++++++ Documentation/DocBook/media/dvb/net.xml | 12 + Documentation/DocBook/media/dvb/video.xml | 1971 +++++++++++++++ Documentation/DocBook/media/v4l/.gitignore | 1 + Documentation/DocBook/media/v4l/bayer.pdf | Bin 0 -> 12116 bytes Documentation/DocBook/media/v4l/bayer.png | Bin 0 -> 9725 bytes Documentation/DocBook/media/v4l/biblio.xml | 188 ++ Documentation/DocBook/media/v4l/capture.c.xml | 659 +++++ Documentation/DocBook/media/v4l/common.xml | 1197 +++++++++ Documentation/DocBook/media/v4l/compat.xml | 2500 +++++++++++++++++++ Documentation/DocBook/media/v4l/controls.xml | 2103 ++++++++++++++++ Documentation/DocBook/media/v4l/crop.gif | Bin 0 -> 5967 bytes Documentation/DocBook/media/v4l/crop.pdf | Bin 0 -> 5846 bytes Documentation/DocBook/media/v4l/dev-capture.xml | 118 + Documentation/DocBook/media/v4l/dev-codec.xml | 26 + Documentation/DocBook/media/v4l/dev-effect.xml | 25 + Documentation/DocBook/media/v4l/dev-event.xml | 31 + Documentation/DocBook/media/v4l/dev-osd.xml | 164 ++ Documentation/DocBook/media/v4l/dev-output.xml | 114 + Documentation/DocBook/media/v4l/dev-overlay.xml | 379 +++ Documentation/DocBook/media/v4l/dev-radio.xml | 57 + Documentation/DocBook/media/v4l/dev-raw-vbi.xml | 347 +++ Documentation/DocBook/media/v4l/dev-rds.xml | 204 ++ Documentation/DocBook/media/v4l/dev-sliced-vbi.xml | 708 ++++++ Documentation/DocBook/media/v4l/dev-subdev.xml | 313 +++ Documentation/DocBook/media/v4l/dev-teletext.xml | 37 + Documentation/DocBook/media/v4l/driver.xml | 208 ++ Documentation/DocBook/media/v4l/fdl-appendix.xml | 671 +++++ Documentation/DocBook/media/v4l/fieldseq_bt.gif | Bin 0 -> 25430 bytes Documentation/DocBook/media/v4l/fieldseq_bt.pdf | Bin 0 -> 9185 bytes Documentation/DocBook/media/v4l/fieldseq_tb.gif | Bin 0 -> 25323 bytes Documentation/DocBook/media/v4l/fieldseq_tb.pdf | Bin 0 -> 9173 bytes Documentation/DocBook/media/v4l/func-close.xml | 70 + Documentation/DocBook/media/v4l/func-ioctl.xml | 145 ++ Documentation/DocBook/media/v4l/func-mmap.xml | 191 ++ Documentation/DocBook/media/v4l/func-munmap.xml | 84 + Documentation/DocBook/media/v4l/func-open.xml | 121 + Documentation/DocBook/media/v4l/func-poll.xml | 127 + Documentation/DocBook/media/v4l/func-read.xml | 189 ++ Documentation/DocBook/media/v4l/func-select.xml | 138 ++ Documentation/DocBook/media/v4l/func-write.xml | 136 ++ Documentation/DocBook/media/v4l/io.xml | 1265 ++++++++++ Documentation/DocBook/media/v4l/keytable.c.xml | 172 ++ Documentation/DocBook/media/v4l/libv4l.xml | 167 ++ .../DocBook/media/v4l/lirc_device_interface.xml | 251 ++ .../DocBook/media/v4l/media-controller.xml | 89 + .../DocBook/media/v4l/media-func-close.xml | 59 + .../DocBook/media/v4l/media-func-ioctl.xml | 116 + .../DocBook/media/v4l/media-func-open.xml | 94 + .../DocBook/media/v4l/media-ioc-device-info.xml | 133 + .../DocBook/media/v4l/media-ioc-enum-entities.xml | 308 +++ .../DocBook/media/v4l/media-ioc-enum-links.xml | 207 ++ .../DocBook/media/v4l/media-ioc-setup-link.xml | 93 + Documentation/DocBook/media/v4l/nv12mt.gif | Bin 0 -> 2108 bytes Documentation/DocBook/media/v4l/nv12mt_example.gif | Bin 0 -> 6858 bytes Documentation/DocBook/media/v4l/pipeline.pdf | Bin 0 -> 20276 bytes Documentation/DocBook/media/v4l/pipeline.png | Bin 0 -> 12130 bytes Documentation/DocBook/media/v4l/pixfmt-grey.xml | 70 + Documentation/DocBook/media/v4l/pixfmt-m420.xml | 147 ++ Documentation/DocBook/media/v4l/pixfmt-nv12.xml | 151 ++ Documentation/DocBook/media/v4l/pixfmt-nv12m.xml | 154 ++ Documentation/DocBook/media/v4l/pixfmt-nv12mt.xml | 74 + Documentation/DocBook/media/v4l/pixfmt-nv16.xml | 174 ++ .../DocBook/media/v4l/pixfmt-packed-rgb.xml | 940 +++++++ .../DocBook/media/v4l/pixfmt-packed-yuv.xml | 244 ++ Documentation/DocBook/media/v4l/pixfmt-sbggr16.xml | 91 + Documentation/DocBook/media/v4l/pixfmt-sbggr8.xml | 75 + Documentation/DocBook/media/v4l/pixfmt-sgbrg8.xml | 75 + Documentation/DocBook/media/v4l/pixfmt-sgrbg8.xml | 75 + Documentation/DocBook/media/v4l/pixfmt-srggb10.xml | 90 + Documentation/DocBook/media/v4l/pixfmt-srggb12.xml | 90 + Documentation/DocBook/media/v4l/pixfmt-srggb8.xml | 67 + Documentation/DocBook/media/v4l/pixfmt-uyvy.xml | 128 + Documentation/DocBook/media/v4l/pixfmt-vyuy.xml | 128 + Documentation/DocBook/media/v4l/pixfmt-y10.xml | 79 + Documentation/DocBook/media/v4l/pixfmt-y10b.xml | 43 + Documentation/DocBook/media/v4l/pixfmt-y12.xml | 79 + Documentation/DocBook/media/v4l/pixfmt-y16.xml | 89 + Documentation/DocBook/media/v4l/pixfmt-y41p.xml | 157 ++ Documentation/DocBook/media/v4l/pixfmt-yuv410.xml | 141 ++ Documentation/DocBook/media/v4l/pixfmt-yuv411p.xml | 155 ++ Documentation/DocBook/media/v4l/pixfmt-yuv420.xml | 157 ++ Documentation/DocBook/media/v4l/pixfmt-yuv420m.xml | 162 ++ Documentation/DocBook/media/v4l/pixfmt-yuv422p.xml | 161 ++ Documentation/DocBook/media/v4l/pixfmt-yuyv.xml | 128 + Documentation/DocBook/media/v4l/pixfmt-yvyu.xml | 128 + Documentation/DocBook/media/v4l/pixfmt.xml | 951 ++++++++ Documentation/DocBook/media/v4l/planar-apis.xml | 62 + .../DocBook/media/v4l/remote_controllers.xml | 177 ++ Documentation/DocBook/media/v4l/subdev-formats.xml | 2572 ++++++++++++++++++++ Documentation/DocBook/media/v4l/v4l2.xml | 539 ++++ Documentation/DocBook/media/v4l/v4l2grab.c.xml | 164 ++ Documentation/DocBook/media/v4l/vbi_525.gif | Bin 0 -> 4741 bytes Documentation/DocBook/media/v4l/vbi_525.pdf | Bin 0 -> 3395 bytes Documentation/DocBook/media/v4l/vbi_625.gif | Bin 0 -> 5095 bytes Documentation/DocBook/media/v4l/vbi_625.pdf | Bin 0 -> 3683 bytes Documentation/DocBook/media/v4l/vbi_hsync.gif | Bin 0 -> 2400 bytes Documentation/DocBook/media/v4l/vbi_hsync.pdf | Bin 0 -> 7405 bytes Documentation/DocBook/media/v4l/vidioc-cropcap.xml | 174 ++ .../DocBook/media/v4l/vidioc-dbg-g-chip-ident.xml | 275 +++ .../DocBook/media/v4l/vidioc-dbg-g-register.xml | 275 +++ Documentation/DocBook/media/v4l/vidioc-dqevent.xml | 131 + .../DocBook/media/v4l/vidioc-encoder-cmd.xml | 204 ++ .../DocBook/media/v4l/vidioc-enum-dv-presets.xml | 238 ++ .../DocBook/media/v4l/vidioc-enum-fmt.xml | 166 ++ .../media/v4l/vidioc-enum-frameintervals.xml | 270 ++ .../DocBook/media/v4l/vidioc-enum-framesizes.xml | 282 +++ .../DocBook/media/v4l/vidioc-enumaudio.xml | 86 + .../DocBook/media/v4l/vidioc-enumaudioout.xml | 89 + .../DocBook/media/v4l/vidioc-enuminput.xml | 321 +++ .../DocBook/media/v4l/vidioc-enumoutput.xml | 206 ++ Documentation/DocBook/media/v4l/vidioc-enumstd.xml | 391 +++ Documentation/DocBook/media/v4l/vidioc-g-audio.xml | 188 ++ .../DocBook/media/v4l/vidioc-g-audioout.xml | 154 ++ Documentation/DocBook/media/v4l/vidioc-g-crop.xml | 143 ++ Documentation/DocBook/media/v4l/vidioc-g-ctrl.xml | 130 + .../DocBook/media/v4l/vidioc-g-dv-preset.xml | 110 + .../DocBook/media/v4l/vidioc-g-dv-timings.xml | 223 ++ .../DocBook/media/v4l/vidioc-g-enc-index.xml | 213 ++ .../DocBook/media/v4l/vidioc-g-ext-ctrls.xml | 307 +++ Documentation/DocBook/media/v4l/vidioc-g-fbuf.xml | 473 ++++ Documentation/DocBook/media/v4l/vidioc-g-fmt.xml | 212 ++ .../DocBook/media/v4l/vidioc-g-frequency.xml | 145 ++ Documentation/DocBook/media/v4l/vidioc-g-input.xml | 100 + .../DocBook/media/v4l/vidioc-g-jpegcomp.xml | 180 ++ .../DocBook/media/v4l/vidioc-g-modulator.xml | 246 ++ .../DocBook/media/v4l/vidioc-g-output.xml | 100 + Documentation/DocBook/media/v4l/vidioc-g-parm.xml | 332 +++ .../DocBook/media/v4l/vidioc-g-priority.xml | 144 ++ .../DocBook/media/v4l/vidioc-g-sliced-vbi-cap.xml | 264 ++ Documentation/DocBook/media/v4l/vidioc-g-std.xml | 105 + Documentation/DocBook/media/v4l/vidioc-g-tuner.xml | 535 ++++ .../DocBook/media/v4l/vidioc-log-status.xml | 58 + Documentation/DocBook/media/v4l/vidioc-overlay.xml | 83 + Documentation/DocBook/media/v4l/vidioc-qbuf.xml | 194 ++ .../DocBook/media/v4l/vidioc-query-dv-preset.xml | 87 + .../DocBook/media/v4l/vidioc-querybuf.xml | 110 + .../DocBook/media/v4l/vidioc-querycap.xml | 303 +++ .../DocBook/media/v4l/vidioc-queryctrl.xml | 434 ++++ .../DocBook/media/v4l/vidioc-querystd.xml | 89 + Documentation/DocBook/media/v4l/vidioc-reqbufs.xml | 150 ++ .../DocBook/media/v4l/vidioc-s-hw-freq-seek.xml | 135 + .../DocBook/media/v4l/vidioc-streamon.xml | 115 + .../v4l/vidioc-subdev-enum-frame-interval.xml | 152 ++ .../media/v4l/vidioc-subdev-enum-frame-size.xml | 154 ++ .../media/v4l/vidioc-subdev-enum-mbus-code.xml | 119 + .../DocBook/media/v4l/vidioc-subdev-g-crop.xml | 155 ++ .../DocBook/media/v4l/vidioc-subdev-g-fmt.xml | 180 ++ .../media/v4l/vidioc-subdev-g-frame-interval.xml | 141 ++ .../DocBook/media/v4l/vidioc-subscribe-event.xml | 133 + Documentation/DocBook/media_api.tmpl | 115 + Documentation/DocBook/v4l/.gitignore | 1 - Documentation/DocBook/v4l/bayer.pdf | Bin 12116 -> 0 bytes Documentation/DocBook/v4l/bayer.png | Bin 9725 -> 0 bytes Documentation/DocBook/v4l/biblio.xml | 188 -- Documentation/DocBook/v4l/capture.c.xml | 659 ----- Documentation/DocBook/v4l/common.xml | 1197 --------- Documentation/DocBook/v4l/compat.xml | 2500 ------------------- Documentation/DocBook/v4l/controls.xml | 2103 ---------------- Documentation/DocBook/v4l/crop.gif | Bin 5967 -> 0 bytes Documentation/DocBook/v4l/crop.pdf | Bin 5846 -> 0 bytes Documentation/DocBook/v4l/dev-capture.xml | 118 - Documentation/DocBook/v4l/dev-codec.xml | 26 - Documentation/DocBook/v4l/dev-effect.xml | 25 - Documentation/DocBook/v4l/dev-event.xml | 31 - Documentation/DocBook/v4l/dev-osd.xml | 164 -- Documentation/DocBook/v4l/dev-output.xml | 114 - Documentation/DocBook/v4l/dev-overlay.xml | 379 --- Documentation/DocBook/v4l/dev-radio.xml | 57 - Documentation/DocBook/v4l/dev-raw-vbi.xml | 347 --- Documentation/DocBook/v4l/dev-rds.xml | 204 -- Documentation/DocBook/v4l/dev-sliced-vbi.xml | 708 ------ Documentation/DocBook/v4l/dev-subdev.xml | 313 --- Documentation/DocBook/v4l/dev-teletext.xml | 37 - Documentation/DocBook/v4l/driver.xml | 208 -- Documentation/DocBook/v4l/fdl-appendix.xml | 671 ----- Documentation/DocBook/v4l/fieldseq_bt.gif | Bin 25430 -> 0 bytes Documentation/DocBook/v4l/fieldseq_bt.pdf | Bin 9185 -> 0 bytes Documentation/DocBook/v4l/fieldseq_tb.gif | Bin 25323 -> 0 bytes Documentation/DocBook/v4l/fieldseq_tb.pdf | Bin 9173 -> 0 bytes Documentation/DocBook/v4l/func-close.xml | 70 - Documentation/DocBook/v4l/func-ioctl.xml | 145 -- Documentation/DocBook/v4l/func-mmap.xml | 191 -- Documentation/DocBook/v4l/func-munmap.xml | 84 - Documentation/DocBook/v4l/func-open.xml | 121 - Documentation/DocBook/v4l/func-poll.xml | 127 - Documentation/DocBook/v4l/func-read.xml | 189 -- Documentation/DocBook/v4l/func-select.xml | 138 -- Documentation/DocBook/v4l/func-write.xml | 136 -- Documentation/DocBook/v4l/io.xml | 1265 ---------- Documentation/DocBook/v4l/keytable.c.xml | 172 -- Documentation/DocBook/v4l/libv4l.xml | 167 -- .../DocBook/v4l/lirc_device_interface.xml | 251 -- Documentation/DocBook/v4l/media-controller.xml | 89 - Documentation/DocBook/v4l/media-func-close.xml | 59 - Documentation/DocBook/v4l/media-func-ioctl.xml | 116 - Documentation/DocBook/v4l/media-func-open.xml | 94 - .../DocBook/v4l/media-ioc-device-info.xml | 133 - .../DocBook/v4l/media-ioc-enum-entities.xml | 308 --- Documentation/DocBook/v4l/media-ioc-enum-links.xml | 207 -- Documentation/DocBook/v4l/media-ioc-setup-link.xml | 93 - Documentation/DocBook/v4l/nv12mt.gif | Bin 2108 -> 0 bytes Documentation/DocBook/v4l/nv12mt_example.gif | Bin 6858 -> 0 bytes Documentation/DocBook/v4l/pipeline.pdf | Bin 20276 -> 0 bytes Documentation/DocBook/v4l/pipeline.png | Bin 12130 -> 0 bytes Documentation/DocBook/v4l/pixfmt-grey.xml | 70 - Documentation/DocBook/v4l/pixfmt-m420.xml | 147 -- Documentation/DocBook/v4l/pixfmt-nv12.xml | 151 -- Documentation/DocBook/v4l/pixfmt-nv12m.xml | 154 -- Documentation/DocBook/v4l/pixfmt-nv12mt.xml | 74 - Documentation/DocBook/v4l/pixfmt-nv16.xml | 174 -- Documentation/DocBook/v4l/pixfmt-packed-rgb.xml | 940 ------- Documentation/DocBook/v4l/pixfmt-packed-yuv.xml | 244 -- Documentation/DocBook/v4l/pixfmt-sbggr16.xml | 91 - Documentation/DocBook/v4l/pixfmt-sbggr8.xml | 75 - Documentation/DocBook/v4l/pixfmt-sgbrg8.xml | 75 - Documentation/DocBook/v4l/pixfmt-sgrbg8.xml | 75 - Documentation/DocBook/v4l/pixfmt-srggb10.xml | 90 - Documentation/DocBook/v4l/pixfmt-srggb12.xml | 90 - Documentation/DocBook/v4l/pixfmt-srggb8.xml | 67 - Documentation/DocBook/v4l/pixfmt-uyvy.xml | 128 - Documentation/DocBook/v4l/pixfmt-vyuy.xml | 128 - Documentation/DocBook/v4l/pixfmt-y10.xml | 79 - Documentation/DocBook/v4l/pixfmt-y10b.xml | 43 - Documentation/DocBook/v4l/pixfmt-y12.xml | 79 - Documentation/DocBook/v4l/pixfmt-y16.xml | 89 - Documentation/DocBook/v4l/pixfmt-y41p.xml | 157 -- Documentation/DocBook/v4l/pixfmt-yuv410.xml | 141 -- Documentation/DocBook/v4l/pixfmt-yuv411p.xml | 155 -- Documentation/DocBook/v4l/pixfmt-yuv420.xml | 157 -- Documentation/DocBook/v4l/pixfmt-yuv420m.xml | 162 -- Documentation/DocBook/v4l/pixfmt-yuv422p.xml | 161 -- Documentation/DocBook/v4l/pixfmt-yuyv.xml | 128 - Documentation/DocBook/v4l/pixfmt-yvyu.xml | 128 - Documentation/DocBook/v4l/pixfmt.xml | 951 -------- Documentation/DocBook/v4l/planar-apis.xml | 62 - Documentation/DocBook/v4l/remote_controllers.xml | 177 -- Documentation/DocBook/v4l/subdev-formats.xml | 2572 -------------------- Documentation/DocBook/v4l/v4l2.xml | 539 ---- Documentation/DocBook/v4l/v4l2grab.c.xml | 164 -- Documentation/DocBook/v4l/vbi_525.gif | Bin 4741 -> 0 bytes Documentation/DocBook/v4l/vbi_525.pdf | Bin 3395 -> 0 bytes Documentation/DocBook/v4l/vbi_625.gif | Bin 5095 -> 0 bytes Documentation/DocBook/v4l/vbi_625.pdf | Bin 3683 -> 0 bytes Documentation/DocBook/v4l/vbi_hsync.gif | Bin 2400 -> 0 bytes Documentation/DocBook/v4l/vbi_hsync.pdf | Bin 7405 -> 0 bytes Documentation/DocBook/v4l/vidioc-cropcap.xml | 174 -- .../DocBook/v4l/vidioc-dbg-g-chip-ident.xml | 275 --- .../DocBook/v4l/vidioc-dbg-g-register.xml | 275 --- Documentation/DocBook/v4l/vidioc-dqevent.xml | 131 - Documentation/DocBook/v4l/vidioc-encoder-cmd.xml | 204 -- .../DocBook/v4l/vidioc-enum-dv-presets.xml | 238 -- Documentation/DocBook/v4l/vidioc-enum-fmt.xml | 166 -- .../DocBook/v4l/vidioc-enum-frameintervals.xml | 270 -- .../DocBook/v4l/vidioc-enum-framesizes.xml | 282 --- Documentation/DocBook/v4l/vidioc-enumaudio.xml | 86 - Documentation/DocBook/v4l/vidioc-enumaudioout.xml | 89 - Documentation/DocBook/v4l/vidioc-enuminput.xml | 321 --- Documentation/DocBook/v4l/vidioc-enumoutput.xml | 206 -- Documentation/DocBook/v4l/vidioc-enumstd.xml | 391 --- Documentation/DocBook/v4l/vidioc-g-audio.xml | 188 -- Documentation/DocBook/v4l/vidioc-g-audioout.xml | 154 -- Documentation/DocBook/v4l/vidioc-g-crop.xml | 143 -- Documentation/DocBook/v4l/vidioc-g-ctrl.xml | 130 - Documentation/DocBook/v4l/vidioc-g-dv-preset.xml | 110 - Documentation/DocBook/v4l/vidioc-g-dv-timings.xml | 223 -- Documentation/DocBook/v4l/vidioc-g-enc-index.xml | 213 -- Documentation/DocBook/v4l/vidioc-g-ext-ctrls.xml | 307 --- Documentation/DocBook/v4l/vidioc-g-fbuf.xml | 473 ---- Documentation/DocBook/v4l/vidioc-g-fmt.xml | 212 -- Documentation/DocBook/v4l/vidioc-g-frequency.xml | 145 -- Documentation/DocBook/v4l/vidioc-g-input.xml | 100 - Documentation/DocBook/v4l/vidioc-g-jpegcomp.xml | 180 -- Documentation/DocBook/v4l/vidioc-g-modulator.xml | 246 -- Documentation/DocBook/v4l/vidioc-g-output.xml | 100 - Documentation/DocBook/v4l/vidioc-g-parm.xml | 332 --- Documentation/DocBook/v4l/vidioc-g-priority.xml | 144 -- .../DocBook/v4l/vidioc-g-sliced-vbi-cap.xml | 264 -- Documentation/DocBook/v4l/vidioc-g-std.xml | 105 - Documentation/DocBook/v4l/vidioc-g-tuner.xml | 535 ---- Documentation/DocBook/v4l/vidioc-log-status.xml | 58 - Documentation/DocBook/v4l/vidioc-overlay.xml | 83 - Documentation/DocBook/v4l/vidioc-qbuf.xml | 194 -- .../DocBook/v4l/vidioc-query-dv-preset.xml | 87 - Documentation/DocBook/v4l/vidioc-querybuf.xml | 110 - Documentation/DocBook/v4l/vidioc-querycap.xml | 303 --- Documentation/DocBook/v4l/vidioc-queryctrl.xml | 434 ---- Documentation/DocBook/v4l/vidioc-querystd.xml | 89 - Documentation/DocBook/v4l/vidioc-reqbufs.xml | 150 -- .../DocBook/v4l/vidioc-s-hw-freq-seek.xml | 135 - Documentation/DocBook/v4l/vidioc-streamon.xml | 115 - .../v4l/vidioc-subdev-enum-frame-interval.xml | 152 -- .../DocBook/v4l/vidioc-subdev-enum-frame-size.xml | 154 -- .../DocBook/v4l/vidioc-subdev-enum-mbus-code.xml | 119 - Documentation/DocBook/v4l/vidioc-subdev-g-crop.xml | 155 -- Documentation/DocBook/v4l/vidioc-subdev-g-fmt.xml | 180 -- .../DocBook/v4l/vidioc-subdev-g-frame-interval.xml | 141 -- .../DocBook/v4l/vidioc-subscribe-event.xml | 133 - 328 files changed, 43594 insertions(+), 44039 deletions(-) delete mode 100644 Documentation/DocBook/dvb/.gitignore delete mode 100644 Documentation/DocBook/dvb/audio.xml delete mode 100644 Documentation/DocBook/dvb/ca.xml delete mode 100644 Documentation/DocBook/dvb/demux.xml delete mode 100644 Documentation/DocBook/dvb/dvbapi.xml delete mode 100644 Documentation/DocBook/dvb/dvbproperty.xml delete mode 100644 Documentation/DocBook/dvb/dvbstb.pdf delete mode 100644 Documentation/DocBook/dvb/dvbstb.png delete mode 100644 Documentation/DocBook/dvb/examples.xml delete mode 100644 Documentation/DocBook/dvb/frontend.xml delete mode 100644 Documentation/DocBook/dvb/intro.xml delete mode 100644 Documentation/DocBook/dvb/kdapi.xml delete mode 100644 Documentation/DocBook/dvb/net.xml delete mode 100644 Documentation/DocBook/dvb/video.xml delete mode 100644 Documentation/DocBook/media-entities.tmpl delete mode 100644 Documentation/DocBook/media.tmpl create mode 100644 Documentation/DocBook/media/Makefile create mode 100644 Documentation/DocBook/media/dvb/.gitignore create mode 100644 Documentation/DocBook/media/dvb/audio.xml create mode 100644 Documentation/DocBook/media/dvb/ca.xml create mode 100644 Documentation/DocBook/media/dvb/demux.xml create mode 100644 Documentation/DocBook/media/dvb/dvbapi.xml create mode 100644 Documentation/DocBook/media/dvb/dvbproperty.xml create mode 100644 Documentation/DocBook/media/dvb/dvbstb.pdf create mode 100644 Documentation/DocBook/media/dvb/dvbstb.png create mode 100644 Documentation/DocBook/media/dvb/examples.xml create mode 100644 Documentation/DocBook/media/dvb/frontend.xml create mode 100644 Documentation/DocBook/media/dvb/intro.xml create mode 100644 Documentation/DocBook/media/dvb/kdapi.xml create mode 100644 Documentation/DocBook/media/dvb/net.xml create mode 100644 Documentation/DocBook/media/dvb/video.xml create mode 100644 Documentation/DocBook/media/v4l/.gitignore create mode 100644 Documentation/DocBook/media/v4l/bayer.pdf create mode 100644 Documentation/DocBook/media/v4l/bayer.png create mode 100644 Documentation/DocBook/media/v4l/biblio.xml create mode 100644 Documentation/DocBook/media/v4l/capture.c.xml create mode 100644 Documentation/DocBook/media/v4l/common.xml create mode 100644 Documentation/DocBook/media/v4l/compat.xml create mode 100644 Documentation/DocBook/media/v4l/controls.xml create mode 100644 Documentation/DocBook/media/v4l/crop.gif create mode 100644 Documentation/DocBook/media/v4l/crop.pdf create mode 100644 Documentation/DocBook/media/v4l/dev-capture.xml create mode 100644 Documentation/DocBook/media/v4l/dev-codec.xml create mode 100644 Documentation/DocBook/media/v4l/dev-effect.xml create mode 100644 Documentation/DocBook/media/v4l/dev-event.xml create mode 100644 Documentation/DocBook/media/v4l/dev-osd.xml create mode 100644 Documentation/DocBook/media/v4l/dev-output.xml create mode 100644 Documentation/DocBook/media/v4l/dev-overlay.xml create mode 100644 Documentation/DocBook/media/v4l/dev-radio.xml create mode 100644 Documentation/DocBook/media/v4l/dev-raw-vbi.xml create mode 100644 Documentation/DocBook/media/v4l/dev-rds.xml create mode 100644 Documentation/DocBook/media/v4l/dev-sliced-vbi.xml create mode 100644 Documentation/DocBook/media/v4l/dev-subdev.xml create mode 100644 Documentation/DocBook/media/v4l/dev-teletext.xml create mode 100644 Documentation/DocBook/media/v4l/driver.xml create mode 100644 Documentation/DocBook/media/v4l/fdl-appendix.xml create mode 100644 Documentation/DocBook/media/v4l/fieldseq_bt.gif create mode 100644 Documentation/DocBook/media/v4l/fieldseq_bt.pdf create mode 100644 Documentation/DocBook/media/v4l/fieldseq_tb.gif create mode 100644 Documentation/DocBook/media/v4l/fieldseq_tb.pdf create mode 100644 Documentation/DocBook/media/v4l/func-close.xml create mode 100644 Documentation/DocBook/media/v4l/func-ioctl.xml create mode 100644 Documentation/DocBook/media/v4l/func-mmap.xml create mode 100644 Documentation/DocBook/media/v4l/func-munmap.xml create mode 100644 Documentation/DocBook/media/v4l/func-open.xml create mode 100644 Documentation/DocBook/media/v4l/func-poll.xml create mode 100644 Documentation/DocBook/media/v4l/func-read.xml create mode 100644 Documentation/DocBook/media/v4l/func-select.xml create mode 100644 Documentation/DocBook/media/v4l/func-write.xml create mode 100644 Documentation/DocBook/media/v4l/io.xml create mode 100644 Documentation/DocBook/media/v4l/keytable.c.xml create mode 100644 Documentation/DocBook/media/v4l/libv4l.xml create mode 100644 Documentation/DocBook/media/v4l/lirc_device_interface.xml create mode 100644 Documentation/DocBook/media/v4l/media-controller.xml create mode 100644 Documentation/DocBook/media/v4l/media-func-close.xml create mode 100644 Documentation/DocBook/media/v4l/media-func-ioctl.xml create mode 100644 Documentation/DocBook/media/v4l/media-func-open.xml create mode 100644 Documentation/DocBook/media/v4l/media-ioc-device-info.xml create mode 100644 Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml create mode 100644 Documentation/DocBook/media/v4l/media-ioc-enum-links.xml create mode 100644 Documentation/DocBook/media/v4l/media-ioc-setup-link.xml create mode 100644 Documentation/DocBook/media/v4l/nv12mt.gif create mode 100644 Documentation/DocBook/media/v4l/nv12mt_example.gif create mode 100644 Documentation/DocBook/media/v4l/pipeline.pdf create mode 100644 Documentation/DocBook/media/v4l/pipeline.png create mode 100644 Documentation/DocBook/media/v4l/pixfmt-grey.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-m420.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-nv12.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-nv12m.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-nv12mt.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-nv16.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-packed-rgb.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-packed-yuv.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-sbggr16.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-sbggr8.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-sgbrg8.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-sgrbg8.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-srggb10.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-srggb12.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-srggb8.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-uyvy.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-vyuy.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-y10.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-y10b.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-y12.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-y16.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-y41p.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-yuv410.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-yuv411p.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-yuv420.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-yuv420m.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-yuv422p.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-yuyv.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-yvyu.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt.xml create mode 100644 Documentation/DocBook/media/v4l/planar-apis.xml create mode 100644 Documentation/DocBook/media/v4l/remote_controllers.xml create mode 100644 Documentation/DocBook/media/v4l/subdev-formats.xml create mode 100644 Documentation/DocBook/media/v4l/v4l2.xml create mode 100644 Documentation/DocBook/media/v4l/v4l2grab.c.xml create mode 100644 Documentation/DocBook/media/v4l/vbi_525.gif create mode 100644 Documentation/DocBook/media/v4l/vbi_525.pdf create mode 100644 Documentation/DocBook/media/v4l/vbi_625.gif create mode 100644 Documentation/DocBook/media/v4l/vbi_625.pdf create mode 100644 Documentation/DocBook/media/v4l/vbi_hsync.gif create mode 100644 Documentation/DocBook/media/v4l/vbi_hsync.pdf create mode 100644 Documentation/DocBook/media/v4l/vidioc-cropcap.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-dbg-g-chip-ident.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-dbg-g-register.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-dqevent.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-enum-dv-presets.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-enum-frameintervals.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-enum-framesizes.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-enumaudio.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-enumaudioout.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-enuminput.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-enumoutput.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-enumstd.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-audio.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-audioout.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-crop.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-ctrl.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-dv-preset.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-enc-index.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-fbuf.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-fmt.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-frequency.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-input.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-jpegcomp.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-modulator.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-output.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-parm.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-priority.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-sliced-vbi-cap.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-std.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-tuner.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-log-status.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-overlay.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-qbuf.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-query-dv-preset.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-querybuf.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-querycap.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-queryctrl.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-querystd.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-reqbufs.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-streamon.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-subdev-enum-frame-interval.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-subdev-enum-frame-size.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-subdev-enum-mbus-code.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-subdev-g-crop.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-subdev-g-fmt.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-subdev-g-frame-interval.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml create mode 100644 Documentation/DocBook/media_api.tmpl delete mode 100644 Documentation/DocBook/v4l/.gitignore delete mode 100644 Documentation/DocBook/v4l/bayer.pdf delete mode 100644 Documentation/DocBook/v4l/bayer.png delete mode 100644 Documentation/DocBook/v4l/biblio.xml delete mode 100644 Documentation/DocBook/v4l/capture.c.xml delete mode 100644 Documentation/DocBook/v4l/common.xml delete mode 100644 Documentation/DocBook/v4l/compat.xml delete mode 100644 Documentation/DocBook/v4l/controls.xml delete mode 100644 Documentation/DocBook/v4l/crop.gif delete mode 100644 Documentation/DocBook/v4l/crop.pdf delete mode 100644 Documentation/DocBook/v4l/dev-capture.xml delete mode 100644 Documentation/DocBook/v4l/dev-codec.xml delete mode 100644 Documentation/DocBook/v4l/dev-effect.xml delete mode 100644 Documentation/DocBook/v4l/dev-event.xml delete mode 100644 Documentation/DocBook/v4l/dev-osd.xml delete mode 100644 Documentation/DocBook/v4l/dev-output.xml delete mode 100644 Documentation/DocBook/v4l/dev-overlay.xml delete mode 100644 Documentation/DocBook/v4l/dev-radio.xml delete mode 100644 Documentation/DocBook/v4l/dev-raw-vbi.xml delete mode 100644 Documentation/DocBook/v4l/dev-rds.xml delete mode 100644 Documentation/DocBook/v4l/dev-sliced-vbi.xml delete mode 100644 Documentation/DocBook/v4l/dev-subdev.xml delete mode 100644 Documentation/DocBook/v4l/dev-teletext.xml delete mode 100644 Documentation/DocBook/v4l/driver.xml delete mode 100644 Documentation/DocBook/v4l/fdl-appendix.xml delete mode 100644 Documentation/DocBook/v4l/fieldseq_bt.gif delete mode 100644 Documentation/DocBook/v4l/fieldseq_bt.pdf delete mode 100644 Documentation/DocBook/v4l/fieldseq_tb.gif delete mode 100644 Documentation/DocBook/v4l/fieldseq_tb.pdf delete mode 100644 Documentation/DocBook/v4l/func-close.xml delete mode 100644 Documentation/DocBook/v4l/func-ioctl.xml delete mode 100644 Documentation/DocBook/v4l/func-mmap.xml delete mode 100644 Documentation/DocBook/v4l/func-munmap.xml delete mode 100644 Documentation/DocBook/v4l/func-open.xml delete mode 100644 Documentation/DocBook/v4l/func-poll.xml delete mode 100644 Documentation/DocBook/v4l/func-read.xml delete mode 100644 Documentation/DocBook/v4l/func-select.xml delete mode 100644 Documentation/DocBook/v4l/func-write.xml delete mode 100644 Documentation/DocBook/v4l/io.xml delete mode 100644 Documentation/DocBook/v4l/keytable.c.xml delete mode 100644 Documentation/DocBook/v4l/libv4l.xml delete mode 100644 Documentation/DocBook/v4l/lirc_device_interface.xml delete mode 100644 Documentation/DocBook/v4l/media-controller.xml delete mode 100644 Documentation/DocBook/v4l/media-func-close.xml delete mode 100644 Documentation/DocBook/v4l/media-func-ioctl.xml delete mode 100644 Documentation/DocBook/v4l/media-func-open.xml delete mode 100644 Documentation/DocBook/v4l/media-ioc-device-info.xml delete mode 100644 Documentation/DocBook/v4l/media-ioc-enum-entities.xml delete mode 100644 Documentation/DocBook/v4l/media-ioc-enum-links.xml delete mode 100644 Documentation/DocBook/v4l/media-ioc-setup-link.xml delete mode 100644 Documentation/DocBook/v4l/nv12mt.gif delete mode 100644 Documentation/DocBook/v4l/nv12mt_example.gif delete mode 100644 Documentation/DocBook/v4l/pipeline.pdf delete mode 100644 Documentation/DocBook/v4l/pipeline.png delete mode 100644 Documentation/DocBook/v4l/pixfmt-grey.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-m420.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-nv12.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-nv12m.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-nv12mt.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-nv16.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-packed-rgb.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-packed-yuv.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-sbggr16.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-sbggr8.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-sgbrg8.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-sgrbg8.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-srggb10.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-srggb12.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-srggb8.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-uyvy.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-vyuy.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-y10.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-y10b.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-y12.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-y16.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-y41p.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-yuv410.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-yuv411p.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-yuv420.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-yuv420m.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-yuv422p.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-yuyv.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt-yvyu.xml delete mode 100644 Documentation/DocBook/v4l/pixfmt.xml delete mode 100644 Documentation/DocBook/v4l/planar-apis.xml delete mode 100644 Documentation/DocBook/v4l/remote_controllers.xml delete mode 100644 Documentation/DocBook/v4l/subdev-formats.xml delete mode 100644 Documentation/DocBook/v4l/v4l2.xml delete mode 100644 Documentation/DocBook/v4l/v4l2grab.c.xml delete mode 100644 Documentation/DocBook/v4l/vbi_525.gif delete mode 100644 Documentation/DocBook/v4l/vbi_525.pdf delete mode 100644 Documentation/DocBook/v4l/vbi_625.gif delete mode 100644 Documentation/DocBook/v4l/vbi_625.pdf delete mode 100644 Documentation/DocBook/v4l/vbi_hsync.gif delete mode 100644 Documentation/DocBook/v4l/vbi_hsync.pdf delete mode 100644 Documentation/DocBook/v4l/vidioc-cropcap.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-dbg-g-chip-ident.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-dbg-g-register.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-dqevent.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-encoder-cmd.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-enum-dv-presets.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-enum-fmt.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-enum-frameintervals.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-enum-framesizes.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-enumaudio.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-enumaudioout.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-enuminput.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-enumoutput.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-enumstd.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-g-audio.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-g-audioout.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-g-crop.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-g-ctrl.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-g-dv-preset.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-g-dv-timings.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-g-enc-index.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-g-ext-ctrls.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-g-fbuf.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-g-fmt.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-g-frequency.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-g-input.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-g-jpegcomp.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-g-modulator.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-g-output.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-g-parm.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-g-priority.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-g-sliced-vbi-cap.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-g-std.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-g-tuner.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-log-status.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-overlay.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-qbuf.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-query-dv-preset.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-querybuf.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-querycap.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-queryctrl.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-querystd.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-reqbufs.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-s-hw-freq-seek.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-streamon.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-subdev-enum-frame-interval.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-subdev-enum-frame-size.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-subdev-enum-mbus-code.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-subdev-g-crop.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-subdev-g-fmt.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-subdev-g-frame-interval.xml delete mode 100644 Documentation/DocBook/v4l/vidioc-subscribe-event.xml diff --git a/Documentation/DocBook/.gitignore b/Documentation/DocBook/.gitignore index 679034cbd686..2c8c882038bf 100644 --- a/Documentation/DocBook/.gitignore +++ b/Documentation/DocBook/.gitignore @@ -8,4 +8,13 @@ *.dvi *.log *.out -media/ +crop.gif +dvbstb.png +fieldseq_bt.gif +fieldseq_tb.gif +media-indices.tmpl +nv12mt.gif +nv12mt_example.gif +vbi_525.gif +vbi_625.gif +vbi_hsync.gif diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index 595bdd3acb6d..5125277bd6a4 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile @@ -6,8 +6,6 @@ # To add a new book the only step required is to add the book to the # list of DOCBOOKS. -TMPMEDIA=.tmpmedia - DOCBOOKS := z8530book.xml mcabook.xml device-drivers.xml \ kernel-hacking.xml kernel-locking.xml deviceiobook.xml \ writing_usb_driver.xml networking.xml \ @@ -16,7 +14,9 @@ DOCBOOKS := z8530book.xml mcabook.xml device-drivers.xml \ genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml \ 80211.xml debugobjects.xml sh.xml regulator.xml \ alsa-driver-api.xml writing-an-alsa-driver.xml \ - tracepoint.xml $(TMPMEDIA)/media.xml drm.xml + tracepoint.xml drm.xml media_api.xml + +include $(srctree)/Documentation/DocBook/media/Makefile ### # The build process is as follows (targets): @@ -34,7 +34,7 @@ PS_METHOD = $(prefer-db2x) ### # The targets that may be used. -PHONY += xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs cleandocs mediaprep +PHONY += xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs cleandocs BOOKS := $(addprefix $(obj)/,$(DOCBOOKS)) xmldocs: $(BOOKS) @@ -228,9 +228,9 @@ clean-files := $(DOCBOOKS) \ $(patsubst %.xml, %.9, $(DOCBOOKS)) \ $(index) -clean-dirs := $(patsubst %.xml,%,$(DOCBOOKS)) man $(MEDIA_DIR) +clean-dirs := $(patsubst %.xml,%,$(DOCBOOKS)) man -cleandocs: +cleandocs: cleanmediadocs $(Q)rm -f $(call objectify, $(clean-files)) $(Q)rm -rf $(call objectify, $(clean-dirs)) @@ -238,252 +238,3 @@ cleandocs: # information in a variable se we can use it in if_changed and friends. .PHONY: $(PHONY) - - -# -# Media build rules - Auto-generates media contents/indexes and *.h xml's -# - -SHELL=/bin/bash - -MEDIA_DIR=$(objtree)/Documentation/DocBook/$(TMPMEDIA) - -V4L_SGMLS = \ - $(shell ls $(srctree)/Documentation/DocBook/v4l/*.xml|perl -ne 'print "$$1 " if (m,.*/(.*)\n,)') \ - capture.c.xml \ - keytable.c.xml \ - v4l2grab.c.xml - -DVB_SGMLS = \ - $(shell ls $(srctree)/Documentation/DocBook/dvb/*.xml|perl -ne 'print "$$1 " if (m,.*/(.*)\n,)') - -MEDIA_TEMP = media-entities.tmpl \ - media-indices.tmpl \ - videodev2.h.xml \ - frontend.h.xml - -MEDIA_SGMLS = $(addprefix ./,$(V4L_SGMLS)) $(addprefix ./,$(DVB_SGMLS)) $(addprefix ./,$(MEDIA_TEMP)) - -MEDIA_TEMP_OBJ := $(addprefix $(MEDIA_DIR)/,$(MEDIA_TEMP)) - -FUNCS = \ - close \ - ioctl \ - mmap \ - munmap \ - open \ - poll \ - read \ - select \ - write \ - -IOCTLS = \ - $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/videodev2.h) \ - $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/media.h) \ - $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/v4l2-subdev.h) \ - VIDIOC_SUBDEV_G_FRAME_INTERVAL \ - VIDIOC_SUBDEV_S_FRAME_INTERVAL \ - VIDIOC_SUBDEV_ENUM_MBUS_CODE \ - VIDIOC_SUBDEV_ENUM_FRAME_SIZE \ - VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL \ - -TYPES = \ - $(shell perl -ne 'print "$$1 " if /^typedef\s+[^\s]+\s+([^\s]+)\;/' $(srctree)/include/linux/videodev2.h) - -ENUMS = \ - $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/videodev2.h) \ - $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/media.h) \ - $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-mediabus.h) \ - $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-subdev.h) - -STRUCTS = \ - $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/videodev2.h) \ - $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/media.h) \ - $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-subdev.h) \ - $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-mediabus.h) - -ERRORS = \ - EACCES \ - EAGAIN \ - EBADF \ - EBUSY \ - EFAULT \ - EIO \ - EINTR \ - EINVAL \ - ENFILE \ - ENOMEM \ - ENOSPC \ - ENOTTY \ - ENXIO \ - EMFILE \ - EPERM \ - ERANGE \ - EPIPE \ - -ESCAPE = \ - -e "s/&/\\&/g" \ - -e "s//\\>/g" - -FILENAME = \ - -e s,"^[^\/]*/",, \ - -e s/"\\.xml"// \ - -e s/"\\.tmpl"// \ - -e s/\\\./-/g \ - -e s/"^func-"// \ - -e s/"^pixfmt-"// \ - -e s/"^vidioc-"// - -# Generate references to these structs in videodev2.h.xml. -DOCUMENTED = \ - -e "s/\(enum *\)v4l2_mpeg_cx2341x_video_\([a-z]*_spatial_filter_type\)/\1v4l2_mpeg_cx2341x_video_\2<\/link>/g" \ - -e "s/\(\(enum\|struct\) *\)\(v4l2_[a-zA-Z0-9_]*\)/\1\3<\/link>/g" \ - -e "s/\(V4L2_PIX_FMT_[A-Z0-9_]\+\) /\1<\/link> /g" \ - -e ":a;s/\(linkend=\".*\)_\(.*\">\)/\1-\2/;ta" \ - -e "s/v4l2\-mpeg\-vbi\-ITV0/v4l2-mpeg-vbi-itv0-1/g" - -DVB_DOCUMENTED = \ - -e "s,\(define \)\([A-Z0-9_]\+\)\(\s\+_IO\),\1\\2\<\/link\>\3,g" \ - -e "s/\(linkend\=\"\)FE_SET_PROPERTY/\1FE_GET_PROPERTY/g" - - -# -# Media targets and dependencies -# - -$(obj)/$(TMPMEDIA)/media.xml: $(obj)/media.tmpl $(MEDIA_TEMP_OBJ) FORCE - $(call if_changed_rule,docproc) - -$(MEDIA_DIR)/v4l2.xml: - @$($(quiet)gen_xml) - @(mkdir -p $(MEDIA_DIR)) - @(cp $(srctree)/Documentation/DocBook/dvb/*.png $(srctree)/Documentation/DocBook/v4l/*.gif $(MEDIA_DIR)/) - @(ln -sf $(srctree)/Documentation/DocBook/v4l/*xml $(MEDIA_DIR)/) - @(ln -sf $(srctree)/Documentation/DocBook/dvb/*xml $(MEDIA_DIR)/) - -$(MEDIA_DIR)/videodev2.h.xml: $(srctree)/include/linux/videodev2.h $(MEDIA_DIR)/v4l2.xml - @$($(quiet)gen_xml) - @( \ - echo "") > $@ - @( \ - expand --tabs=8 < $< | \ - sed $(ESCAPE) $(DOCUMENTED) | \ - sed 's/i\.e\./&ie;/') >> $@ - @( \ - echo "") >> $@ - -$(MEDIA_DIR)/frontend.h.xml: $(srctree)/include/linux/dvb/frontend.h $(MEDIA_DIR)/v4l2.xml - @$($(quiet)gen_xml) - @( \ - echo "") > $@ - @( \ - expand --tabs=8 < $< | \ - sed $(ESCAPE) $(DVB_DOCUMENTED) | \ - sed 's/i\.e\./&ie;/') >> $@ - @( \ - echo "") >> $@ - -$(MEDIA_DIR)/media-entities.tmpl: $(MEDIA_DIR)/v4l2.xml - @$($(quiet)gen_xml) - @( \ - echo "") >$@ - @( \ - echo -e "\n") >>$@ - @( \ - for ident in $(FUNCS) ; do \ - entity=`echo $$ident | tr _ -` ; \ - echo "$$ident()\">" \ - >>$@ ; \ - done) - @( \ - echo -e "\n") >>$@ - @( \ - for ident in $(IOCTLS) ; do \ - entity=`echo $$ident | tr _ -` ; \ - id=`grep "$$ident" $(MEDIA_DIR)/vidioc-*.xml | sed -r s,"^.*/(.*).xml.*","\1",` ; \ - echo "$$ident\">" \ - >>$@ ; \ - done) - @( \ - echo -e "\n") >>$@ - @( \ - for ident in $(TYPES) ; do \ - entity=`echo $$ident | tr _ -` ; \ - echo "$$ident\">" >>$@ ; \ - done) - @( \ - echo -e "\n") >>$@ - @( \ - for ident in $(ENUMS) ; do \ - entity=`echo $$ident | sed -e "s/v4l2_mpeg_cx2341x_video_\([a-z]*_spatial_filter_type\)/\1/" | tr _ -` ; \ - echo "$$ident\">" >>$@ ; \ - done) - @( \ - echo -e "\n") >>$@ - @( \ - for ident in $(STRUCTS) ; do \ - entity=`echo $$ident | tr _ - | sed s/v4l2-mpeg-vbi-ITV0/v4l2-mpeg-vbi-itv0-1/g` ; \ - echo "$$ident\">" >>$@ ; \ - done) - @( \ - echo -e "\n") >>$@ - @( \ - for ident in $(ERRORS) ; do \ - echo "$$ident" \ - "error code\">" >>$@ ; \ - done) - @( \ - echo -e "\n") >>$@ - @( \ - for file in $(MEDIA_SGMLS) ; do \ - entity=`echo "$$file" | sed $(FILENAME) -e s/"^([^-]*)"/sub\1/` ; \ - if ! echo "$$file" | \ - grep -q -E -e '^(func|vidioc|pixfmt)-' ; then \ - echo "" >>$@ ; \ - fi ; \ - done) - @( \ - echo -e "\n") >>$@ - @( \ - for file in $(MEDIA_SGMLS) ; do \ - if echo "$$file" | \ - grep -q -E -e '(func|vidioc|pixfmt)-' ; then \ - entity=`echo "$$file" |sed $(FILENAME)` ; \ - echo "" >>$@ ; \ - fi ; \ - done) - -# Jade can auto-generate a list-of-tables, which includes all structs, -# but we only want data types, all types, and sorted please. -$(MEDIA_DIR)/media-indices.tmpl: $(MEDIA_DIR)/v4l2.xml - @$($(quiet)gen_xml) - @( \ - echo "") >$@ - @( \ - echo -e "\nList of Types") >>$@ - @( \ - for ident in $(TYPES) ; do \ - id=`echo $$ident | tr _ -` ; \ - echo "$$ident" >>$@ ; \ - done) - @( \ - for ident in $(ENUMS) ; do \ - id=`echo $$ident | sed -e "s/v4l2_mpeg_cx2341x_video_\([a-z]*_spatial_filter_type\)/\1/" | tr _ -`; \ - echo "enum $$ident" >>$@ ; \ - done) - @( \ - for ident in $(STRUCTS) ; do \ - id=`echo $$ident | tr _ - | sed s/v4l2-mpeg-vbi-ITV0/v4l2-mpeg-vbi-itv0-1/g` ; \ - echo "struct $$ident" >>$@ ; \ - done) - @( \ - echo "") >>$@ diff --git a/Documentation/DocBook/dvb/.gitignore b/Documentation/DocBook/dvb/.gitignore deleted file mode 100644 index d7ec32eafac9..000000000000 --- a/Documentation/DocBook/dvb/.gitignore +++ /dev/null @@ -1 +0,0 @@ -!*.xml diff --git a/Documentation/DocBook/dvb/audio.xml b/Documentation/DocBook/dvb/audio.xml deleted file mode 100644 index eeb96b8a0864..000000000000 --- a/Documentation/DocBook/dvb/audio.xml +++ /dev/null @@ -1,1473 +0,0 @@ -DVB Audio Device -The DVB audio device controls the MPEG2 audio decoder of the DVB hardware. It -can be accessed through /dev/dvb/adapter0/audio0. Data types and and -ioctl definitions can be accessed by including linux/dvb/video.h in your -application. - -Please note that some DVB cards don’t have their own MPEG decoder, which results in -the omission of the audio and video device. - - -
-Audio Data Types -This section describes the structures, data types and defines used when talking to the -audio device. - - -
-audio_stream_source_t -The audio stream source is set through the AUDIO_SELECT_SOURCE call and can take -the following values, depending on whether we are replaying from an internal (demux) or -external (user write) source. - - - typedef enum { - AUDIO_SOURCE_DEMUX, - AUDIO_SOURCE_MEMORY - } audio_stream_source_t; - -AUDIO_SOURCE_DEMUX selects the demultiplexer (fed either by the frontend or the -DVR device) as the source of the video stream. If AUDIO_SOURCE_MEMORY -is selected the stream comes from the application through the write() system -call. - - -
-
-audio_play_state_t -The following values can be returned by the AUDIO_GET_STATUS call representing the -state of audio playback. - - - typedef enum { - AUDIO_STOPPED, - AUDIO_PLAYING, - AUDIO_PAUSED - } audio_play_state_t; - - -
-
-audio_channel_select_t -The audio channel selected via AUDIO_CHANNEL_SELECT is determined by the -following values. - - - typedef enum { - AUDIO_STEREO, - AUDIO_MONO_LEFT, - AUDIO_MONO_RIGHT, - } audio_channel_select_t; - - -
-
-struct audio_status -The AUDIO_GET_STATUS call returns the following structure informing about various -states of the playback operation. - - - typedef struct audio_status { - boolean AV_sync_state; - boolean mute_state; - audio_play_state_t play_state; - audio_stream_source_t stream_source; - audio_channel_select_t channel_select; - boolean bypass_mode; - } audio_status_t; - - -
-
-struct audio_mixer -The following structure is used by the AUDIO_SET_MIXER call to set the audio -volume. - - - typedef struct audio_mixer { - unsigned int volume_left; - unsigned int volume_right; - } audio_mixer_t; - - -
-
-audio encodings -A call to AUDIO_GET_CAPABILITIES returns an unsigned integer with the following -bits set according to the hardwares capabilities. - - - #define AUDIO_CAP_DTS 1 - #define AUDIO_CAP_LPCM 2 - #define AUDIO_CAP_MP1 4 - #define AUDIO_CAP_MP2 8 - #define AUDIO_CAP_MP3 16 - #define AUDIO_CAP_AAC 32 - #define AUDIO_CAP_OGG 64 - #define AUDIO_CAP_SDDS 128 - #define AUDIO_CAP_AC3 256 - - -
-
-struct audio_karaoke -The ioctl AUDIO_SET_KARAOKE uses the following format: - - - typedef - struct audio_karaoke{ - int vocal1; - int vocal2; - int melody; - } audio_karaoke_t; - -If Vocal1 or Vocal2 are non-zero, they get mixed into left and right t at 70% each. If both, -Vocal1 and Vocal2 are non-zero, Vocal1 gets mixed into the left channel and Vocal2 into the -right channel at 100% each. Ff Melody is non-zero, the melody channel gets mixed into left -and right. - - -
-
-audio attributes -The following attributes can be set by a call to AUDIO_SET_ATTRIBUTES: - - - typedef uint16_t audio_attributes_t; - /⋆ bits: descr. ⋆/ - /⋆ 15-13 audio coding mode (0=ac3, 2=mpeg1, 3=mpeg2ext, 4=LPCM, 6=DTS, ⋆/ - /⋆ 12 multichannel extension ⋆/ - /⋆ 11-10 audio type (0=not spec, 1=language included) ⋆/ - /⋆ 9- 8 audio application mode (0=not spec, 1=karaoke, 2=surround) ⋆/ - /⋆ 7- 6 Quantization / DRC (mpeg audio: 1=DRC exists)(lpcm: 0=16bit, ⋆/ - /⋆ 5- 4 Sample frequency fs (0=48kHz, 1=96kHz) ⋆/ - /⋆ 2- 0 number of audio channels (n+1 channels) ⋆/ - -
-
-Audio Function Calls - - -
-open() -DESCRIPTION - - -This system call opens a named audio device (e.g. /dev/dvb/adapter0/audio0) - for subsequent use. When an open() call has succeeded, the device will be ready - for use. The significance of blocking or non-blocking mode is described in the - documentation for functions where there is a difference. It does not affect the - semantics of the open() call itself. A device opened in blocking mode can later - be put into non-blocking mode (and vice versa) using the F_SETFL command - of the fcntl system call. This is a standard system call, documented in the Linux - manual page for fcntl. Only one user can open the Audio Device in O_RDWR - mode. All other attempts to open the device in this mode will fail, and an error - code will be returned. If the Audio Device is opened in O_RDONLY mode, the - only ioctl call that can be used is AUDIO_GET_STATUS. All other call will - return with an error code. - - -SYNOPSIS - - -int open(const char ⋆deviceName, int flags); - - -PARAMETERS - - -const char - *deviceName - -Name of specific audio device. - - -int flags - -A bit-wise OR of the following flags: - - - -O_RDONLY read-only access - - - -O_RDWR read/write access - - - -O_NONBLOCK open in non-blocking mode - - - -(blocking mode is the default) - - -ERRORS - - -ENODEV - -Device driver not loaded/available. - - -EINTERNAL - -Internal error. - - -EBUSY - -Device or resource busy. - - -EINVAL - -Invalid argument. - - - -
-
-close() -DESCRIPTION - - -This system call closes a previously opened audio device. - - -SYNOPSIS - - -int close(int fd); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - - -
-
-write() -DESCRIPTION - - -This system call can only be used if AUDIO_SOURCE_MEMORY is selected - in the ioctl call AUDIO_SELECT_SOURCE. The data provided shall be in - PES format. If O_NONBLOCK is not specified the function will block until - buffer space is available. The amount of data to be transferred is implied by - count. - - -SYNOPSIS - - -size_t write(int fd, const void ⋆buf, size_t count); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -void *buf - -Pointer to the buffer containing the PES data. - - -size_t count - -Size of buf. - - -ERRORS - - -EPERM - -Mode AUDIO_SOURCE_MEMORY not selected. - - -ENOMEM - -Attempted to write more data than the internal buffer can - hold. - - -EBADF - -fd is not a valid open file descriptor. - - - -
AUDIO_STOP -DESCRIPTION - - -This ioctl call asks the Audio Device to stop playing the current stream. - - -SYNOPSIS - - -int ioctl(int fd, int request = AUDIO_STOP); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals AUDIO_STOP for this command. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error. - - - -
AUDIO_PLAY -DESCRIPTION - - -This ioctl call asks the Audio Device to start playing an audio stream from the - selected source. - - -SYNOPSIS - - -int ioctl(int fd, int request = AUDIO_PLAY); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals AUDIO_PLAY for this command. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error. - - - -
AUDIO_PAUSE -DESCRIPTION - - -This ioctl call suspends the audio stream being played. Decoding and playing - are paused. It is then possible to restart again decoding and playing process of - the audio stream using AUDIO_CONTINUE command. - - -If AUDIO_SOURCE_MEMORY is selected in the ioctl call - AUDIO_SELECT_SOURCE, the DVB-subsystem will not decode (consume) - any more data until the ioctl call AUDIO_CONTINUE or AUDIO_PLAY is - performed. - - -SYNOPSIS - - -int ioctl(int fd, int request = AUDIO_PAUSE); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals AUDIO_PAUSE for this command. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - -EINTERNAL - -Internal error. - - - -
AUDIO_SELECT_SOURCE -DESCRIPTION - - -This ioctl call informs the audio device which source shall be used - for the input data. The possible sources are demux or memory. If - AUDIO_SOURCE_MEMORY is selected, the data is fed to the Audio Device - through the write command. - - -SYNOPSIS - - -int ioctl(int fd, int request = AUDIO_SELECT_SOURCE, - audio_stream_source_t source); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals AUDIO_SELECT_SOURCE for this command. - - -audio_stream_source_t - source - -Indicates the source that shall be used for the Audio - stream. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - -EINTERNAL - -Internal error. - - -EINVAL - -Illegal input parameter. - - - -
AUDIO_SET_MUTE -DESCRIPTION - - -This ioctl call asks the audio device to mute the stream that is currently being - played. - - -SYNOPSIS - - -int ioctl(int fd, int request = AUDIO_SET_MUTE, - boolean state); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals AUDIO_SET_MUTE for this command. - - -boolean state - -Indicates if audio device shall mute or not. - - - -TRUE Audio Mute - - - -FALSE Audio Un-mute - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - -EINTERNAL - -Internal error. - - -EINVAL - -Illegal input parameter. - - - -
AUDIO_SET_AV_SYNC -DESCRIPTION - - -This ioctl call asks the Audio Device to turn ON or OFF A/V synchronization. - - -SYNOPSIS - - -int ioctl(int fd, int request = AUDIO_SET_AV_SYNC, - boolean state); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals AUDIO_AV_SYNC for this command. - - -boolean state - -Tells the DVB subsystem if A/V synchronization shall be - ON or OFF. - - - -TRUE AV-sync ON - - - -FALSE AV-sync OFF - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - -EINTERNAL - -Internal error. - - -EINVAL - -Illegal input parameter. - - - -
AUDIO_SET_BYPASS_MODE -DESCRIPTION - - -This ioctl call asks the Audio Device to bypass the Audio decoder and forward - the stream without decoding. This mode shall be used if streams that can’t be - handled by the DVB system shall be decoded. Dolby DigitalTM streams are - automatically forwarded by the DVB subsystem if the hardware can handle it. - - -SYNOPSIS - - -int ioctl(int fd, int request = - AUDIO_SET_BYPASS_MODE, boolean mode); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals AUDIO_SET_BYPASS_MODE for this - command. - - -boolean mode - -Enables or disables the decoding of the current Audio - stream in the DVB subsystem. - - - -TRUE Bypass is disabled - - - -FALSE Bypass is enabled - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - -EINTERNAL - -Internal error. - - -EINVAL - -Illegal input parameter. - - - -
AUDIO_CHANNEL_SELECT -DESCRIPTION - - -This ioctl call asks the Audio Device to select the requested channel if possible. - - -SYNOPSIS - - -int ioctl(int fd, int request = - AUDIO_CHANNEL_SELECT, audio_channel_select_t); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals AUDIO_CHANNEL_SELECT for this - command. - - -audio_channel_select_t - ch - -Select the output format of the audio (mono left/right, - stereo). - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - -EINTERNAL - -Internal error. - - -EINVAL - -Illegal input parameter ch. - - - -
AUDIO_GET_STATUS -DESCRIPTION - - -This ioctl call asks the Audio Device to return the current state of the Audio - Device. - - -SYNOPSIS - - -int ioctl(int fd, int request = AUDIO_GET_STATUS, - struct audio_status ⋆status); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals AUDIO_GET_STATUS for this command. - - -struct audio_status - *status - -Returns the current state of Audio Device. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - -EINTERNAL - -Internal error. - - -EFAULT - -status points to invalid address. - - - -
AUDIO_GET_CAPABILITIES -DESCRIPTION - - -This ioctl call asks the Audio Device to tell us about the decoding capabilities - of the audio hardware. - - -SYNOPSIS - - -int ioctl(int fd, int request = - AUDIO_GET_CAPABILITIES, unsigned int ⋆cap); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals AUDIO_GET_CAPABILITIES for this - command. - - -unsigned int *cap - -Returns a bit array of supported sound formats. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - -EINTERNAL - -Internal error. - - -EFAULT - -cap points to an invalid address. - - - -
AUDIO_CLEAR_BUFFER -DESCRIPTION - - -This ioctl call asks the Audio Device to clear all software and hardware buffers - of the audio decoder device. - - -SYNOPSIS - - -int ioctl(int fd, int request = AUDIO_CLEAR_BUFFER); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals AUDIO_CLEAR_BUFFER for this command. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - -EINTERNAL - -Internal error. - - - -
AUDIO_SET_ID -DESCRIPTION - - -This ioctl selects which sub-stream is to be decoded if a program or system - stream is sent to the video device. If no audio stream type is set the id has to be - in [0xC0,0xDF] for MPEG sound, in [0x80,0x87] for AC3 and in [0xA0,0xA7] - for LPCM. More specifications may follow for other stream types. If the stream - type is set the id just specifies the substream id of the audio stream and only - the first 5 bits are recognized. - - -SYNOPSIS - - -int ioctl(int fd, int request = AUDIO_SET_ID, int - id); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals AUDIO_SET_ID for this command. - - -int id - -audio sub-stream id - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - -EINTERNAL - -Internal error. - - -EINVAL - -Invalid sub-stream id. - - - -
AUDIO_SET_MIXER -DESCRIPTION - - -This ioctl lets you adjust the mixer settings of the audio decoder. - - -SYNOPSIS - - -int ioctl(int fd, int request = AUDIO_SET_MIXER, - audio_mixer_t ⋆mix); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals AUDIO_SET_ID for this command. - - -audio_mixer_t *mix - -mixer settings. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - -EINTERNAL - -Internal error. - - -EFAULT - -mix points to an invalid address. - - - -
AUDIO_SET_STREAMTYPE -DESCRIPTION - - -This ioctl tells the driver which kind of audio stream to expect. This is useful - if the stream offers several audio sub-streams like LPCM and AC3. - - -SYNOPSIS - - -int ioctl(fd, int request = AUDIO_SET_STREAMTYPE, - int type); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals AUDIO_SET_STREAMTYPE for this - command. - - -int type - -stream type - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EINVAL - -type is not a valid or supported stream type. - - - -
AUDIO_SET_EXT_ID -DESCRIPTION - - -This ioctl can be used to set the extension id for MPEG streams in DVD - playback. Only the first 3 bits are recognized. - - -SYNOPSIS - - -int ioctl(fd, int request = AUDIO_SET_EXT_ID, int - id); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals AUDIO_SET_EXT_ID for this command. - - -int id - -audio sub_stream_id - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EINVAL - -id is not a valid id. - - - -
AUDIO_SET_ATTRIBUTES -DESCRIPTION - - -This ioctl is intended for DVD playback and allows you to set certain - information about the audio stream. - - -SYNOPSIS - - -int ioctl(fd, int request = AUDIO_SET_ATTRIBUTES, - audio_attributes_t attr ); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals AUDIO_SET_ATTRIBUTES for this command. - - -audio_attributes_t - attr - -audio attributes according to section ?? - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EINVAL - -attr is not a valid or supported attribute setting. - - - -
AUDIO_SET_KARAOKE -DESCRIPTION - - -This ioctl allows one to set the mixer settings for a karaoke DVD. - - -SYNOPSIS - - -int ioctl(fd, int request = AUDIO_SET_STREAMTYPE, - audio_karaoke_t ⋆karaoke); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals AUDIO_SET_STREAMTYPE for this - command. - - -audio_karaoke_t - *karaoke - -karaoke settings according to section ??. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EINVAL - -karaoke is not a valid or supported karaoke setting. - - -
-
diff --git a/Documentation/DocBook/dvb/ca.xml b/Documentation/DocBook/dvb/ca.xml deleted file mode 100644 index b1f1d2fad654..000000000000 --- a/Documentation/DocBook/dvb/ca.xml +++ /dev/null @@ -1,221 +0,0 @@ -DVB CA Device -The DVB CA device controls the conditional access hardware. It can be accessed through -/dev/dvb/adapter0/ca0. Data types and and ioctl definitions can be accessed by -including linux/dvb/ca.h in your application. - - -
-CA Data Types - - -
-ca_slot_info_t - - /⋆ slot interface types and info ⋆/ - - typedef struct ca_slot_info_s { - int num; /⋆ slot number ⋆/ - - int type; /⋆ CA interface this slot supports ⋆/ - #define CA_CI 1 /⋆ CI high level interface ⋆/ - #define CA_CI_LINK 2 /⋆ CI link layer level interface ⋆/ - #define CA_CI_PHYS 4 /⋆ CI physical layer level interface ⋆/ - #define CA_SC 128 /⋆ simple smart card interface ⋆/ - - unsigned int flags; - #define CA_CI_MODULE_PRESENT 1 /⋆ module (or card) inserted ⋆/ - #define CA_CI_MODULE_READY 2 - } ca_slot_info_t; - - -
-
-ca_descr_info_t - - typedef struct ca_descr_info_s { - unsigned int num; /⋆ number of available descramblers (keys) ⋆/ - unsigned int type; /⋆ type of supported scrambling system ⋆/ - #define CA_ECD 1 - #define CA_NDS 2 - #define CA_DSS 4 - } ca_descr_info_t; - - -
-
-ca_cap_t - - typedef struct ca_cap_s { - unsigned int slot_num; /⋆ total number of CA card and module slots ⋆/ - unsigned int slot_type; /⋆ OR of all supported types ⋆/ - unsigned int descr_num; /⋆ total number of descrambler slots (keys) ⋆/ - unsigned int descr_type;/⋆ OR of all supported types ⋆/ - } ca_cap_t; - - -
-
-ca_msg_t - - /⋆ a message to/from a CI-CAM ⋆/ - typedef struct ca_msg_s { - unsigned int index; - unsigned int type; - unsigned int length; - unsigned char msg[256]; - } ca_msg_t; - - -
-
-ca_descr_t - - typedef struct ca_descr_s { - unsigned int index; - unsigned int parity; - unsigned char cw[8]; - } ca_descr_t; - -
-
-CA Function Calls - - -
-open() -DESCRIPTION - - -This system call opens a named ca device (e.g. /dev/ost/ca) for subsequent use. -When an open() call has succeeded, the device will be ready for use. - The significance of blocking or non-blocking mode is described in the - documentation for functions where there is a difference. It does not affect the - semantics of the open() call itself. A device opened in blocking mode can later - be put into non-blocking mode (and vice versa) using the F_SETFL command - of the fcntl system call. This is a standard system call, documented in the Linux - manual page for fcntl. Only one user can open the CA Device in O_RDWR - mode. All other attempts to open the device in this mode will fail, and an error - code will be returned. - - -SYNOPSIS - - -int open(const char ⋆deviceName, int flags); - - -PARAMETERS - - -const char - *deviceName - -Name of specific video device. - - -int flags - -A bit-wise OR of the following flags: - - - -O_RDONLY read-only access - - - -O_RDWR read/write access - - - -O_NONBLOCK open in non-blocking mode - - - -(blocking mode is the default) - - -ERRORS - - -ENODEV - -Device driver not loaded/available. - - -EINTERNAL - -Internal error. - - -EBUSY - -Device or resource busy. - - -EINVAL - -Invalid argument. - - - -
-
-close() -DESCRIPTION - - -This system call closes a previously opened audio device. - - -SYNOPSIS - - -int close(int fd); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - -
-
diff --git a/Documentation/DocBook/dvb/demux.xml b/Documentation/DocBook/dvb/demux.xml deleted file mode 100644 index 1b8c4e9835b9..000000000000 --- a/Documentation/DocBook/dvb/demux.xml +++ /dev/null @@ -1,973 +0,0 @@ -DVB Demux Device - -The DVB demux device controls the filters of the DVB hardware/software. It can be -accessed through /dev/adapter0/demux0. Data types and and ioctl definitions can be -accessed by including linux/dvb/dmx.h in your application. - -
-Demux Data Types - -
-dmx_output_t - - typedef enum - { - DMX_OUT_DECODER, - DMX_OUT_TAP, - DMX_OUT_TS_TAP - } dmx_output_t; - -DMX_OUT_TAP delivers the stream output to the demux device on which the ioctl is -called. - -DMX_OUT_TS_TAP routes output to the logical DVR device /dev/dvb/adapter0/dvr0, -which delivers a TS multiplexed from all filters for which DMX_OUT_TS_TAP was -specified. - -
- -
-dmx_input_t - - typedef enum - { - DMX_IN_FRONTEND, - DMX_IN_DVR - } dmx_input_t; - -
- -
-dmx_pes_type_t - - typedef enum - { - DMX_PES_AUDIO, - DMX_PES_VIDEO, - DMX_PES_TELETEXT, - DMX_PES_SUBTITLE, - DMX_PES_PCR, - DMX_PES_OTHER - } dmx_pes_type_t; - -
- -
-dmx_event_t - - typedef enum - { - DMX_SCRAMBLING_EV, - DMX_FRONTEND_EV - } dmx_event_t; - -
- -
-dmx_scrambling_status_t - - typedef enum - { - DMX_SCRAMBLING_OFF, - DMX_SCRAMBLING_ON - } dmx_scrambling_status_t; - -
- -
-struct dmx_filter - - typedef struct dmx_filter - { - uint8_t filter[DMX_FILTER_SIZE]; - uint8_t mask[DMX_FILTER_SIZE]; - } dmx_filter_t; - -
- -
-struct dmx_sct_filter_params - - struct dmx_sct_filter_params - { - uint16_t pid; - dmx_filter_t filter; - uint32_t timeout; - uint32_t flags; - #define DMX_CHECK_CRC 1 - #define DMX_ONESHOT 2 - #define DMX_IMMEDIATE_START 4 - }; - -
- -
-struct dmx_pes_filter_params - - struct dmx_pes_filter_params - { - uint16_t pid; - dmx_input_t input; - dmx_output_t output; - dmx_pes_type_t pes_type; - uint32_t flags; - }; - -
- -
-struct dmx_event - - struct dmx_event - { - dmx_event_t event; - time_t timeStamp; - union - { - dmx_scrambling_status_t scrambling; - } u; - }; - -
- -
-struct dmx_stc - - struct dmx_stc { - unsigned int num; /⋆ input : which STC? 0..N ⋆/ - unsigned int base; /⋆ output: divisor for stc to get 90 kHz clock ⋆/ - uint64_t stc; /⋆ output: stc in 'base'⋆90 kHz units ⋆/ - }; - -
- -
- -
-Demux Function Calls - -
-open() -DESCRIPTION - - -This system call, used with a device name of /dev/dvb/adapter0/demux0, - allocates a new filter and returns a handle which can be used for subsequent - control of that filter. This call has to be made for each filter to be used, i.e. every - returned file descriptor is a reference to a single filter. /dev/dvb/adapter0/dvr0 - is a logical device to be used for retrieving Transport Streams for digital - video recording. When reading from this device a transport stream containing - the packets from all PES filters set in the corresponding demux device - (/dev/dvb/adapter0/demux0) having the output set to DMX_OUT_TS_TAP. A - recorded Transport Stream is replayed by writing to this device. -The significance of blocking or non-blocking mode is described in the - documentation for functions where there is a difference. It does not affect the - semantics of the open() call itself. A device opened in blocking mode can later - be put into non-blocking mode (and vice versa) using the F_SETFL command - of the fcntl system call. - - -SYNOPSIS - - -int open(const char ⋆deviceName, int flags); - - -PARAMETERS - - -const char - *deviceName - -Name of demux device. - - -int flags - -A bit-wise OR of the following flags: - - - -O_RDWR read/write access - - - -O_NONBLOCK open in non-blocking mode - - - -(blocking mode is the default) - - -ERRORS - - -ENODEV - -Device driver not loaded/available. - - -EINVAL - -Invalid argument. - - -EMFILE - -“Too many open files”, i.e. no more filters available. - - -ENOMEM - -The driver failed to allocate enough memory. - - -
- -
-close() -DESCRIPTION - - -This system call deactivates and deallocates a filter that was previously - allocated via the open() call. - - -SYNOPSIS - - -int close(int fd); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - -
- -
-read() -DESCRIPTION - - -This system call returns filtered data, which might be section or PES data. The - filtered data is transferred from the driver’s internal circular buffer to buf. The - maximum amount of data to be transferred is implied by count. - - -When returning section data the driver always tries to return a complete single - section (even though buf would provide buffer space for more data). If the size - of the buffer is smaller than the section as much as possible will be returned, - and the remaining data will be provided in subsequent calls. - - -The size of the internal buffer is 2 * 4096 bytes (the size of two maximum - sized sections) by default. The size of this buffer may be changed by using the - DMX_SET_BUFFER_SIZE function. If the buffer is not large enough, or if - the read operations are not performed fast enough, this may result in a buffer - overflow error. In this case EOVERFLOW will be returned, and the circular - buffer will be emptied. This call is blocking if there is no data to return, i.e. the - process will be put to sleep waiting for data, unless the O_NONBLOCK flag - is specified. - - -Note that in order to be able to read, the filtering process has to be started - by defining either a section or a PES filter by means of the ioctl functions, - and then starting the filtering process via the DMX_START ioctl function - or by setting the DMX_IMMEDIATE_START flag. If the reading is done - from a logical DVR demux device, the data will constitute a Transport Stream - including the packets from all PES filters in the corresponding demux device - /dev/dvb/adapter0/demux0 having the output set to DMX_OUT_TS_TAP. - - -SYNOPSIS - - -size_t read(int fd, void ⋆buf, size_t count); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -void *buf - -Pointer to the buffer to be used for returned filtered data. - - -size_t count - -Size of buf. - - -ERRORS - - -EWOULDBLOCK - -No data to return and O_NONBLOCK was specified. - - -EBADF - -fd is not a valid open file descriptor. - - -ECRC - -Last section had a CRC error - no data returned. The - buffer is flushed. - - -EOVERFLOW - - - - -The filtered data was not read from the buffer in due - time, resulting in non-read data being lost. The buffer is - flushed. - - -ETIMEDOUT - -The section was not loaded within the stated timeout - period. See ioctl DMX_SET_FILTER for how to set a - timeout. - - -EFAULT - -The driver failed to write to the callers buffer due to an - invalid *buf pointer. - - -
- -
-write() -DESCRIPTION - - -This system call is only provided by the logical device /dev/dvb/adapter0/dvr0, - associated with the physical demux device that provides the actual DVR - functionality. It is used for replay of a digitally recorded Transport Stream. - Matching filters have to be defined in the corresponding physical demux - device, /dev/dvb/adapter0/demux0. The amount of data to be transferred is - implied by count. - - -SYNOPSIS - - -ssize_t write(int fd, const void ⋆buf, size_t - count); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -void *buf - -Pointer to the buffer containing the Transport Stream. - - -size_t count - -Size of buf. - - -ERRORS - - -EWOULDBLOCK - -No data was written. This - might happen if O_NONBLOCK was specified and there - is no more buffer space available (if O_NONBLOCK is - not specified the function will block until buffer space is - available). - - -EBUSY - -This error code indicates that there are conflicting - requests. The corresponding demux device is setup to - receive data from the front- end. Make sure that these - filters are stopped and that the filters with input set to - DMX_IN_DVR are started. - - -EBADF - -fd is not a valid open file descriptor. - - -
- -
-DMX_START -DESCRIPTION - - -This ioctl call is used to start the actual filtering operation defined via the ioctl - calls DMX_SET_FILTER or DMX_SET_PES_FILTER. - - -SYNOPSIS - - -int ioctl( int fd, int request = DMX_START); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals DMX_START for this command. - - -ERRORS - - -EBADF - -fd is not a valid file descriptor. - - -EINVAL - -Invalid argument, i.e. no filtering parameters provided via - the DMX_SET_FILTER or DMX_SET_PES_FILTER - functions. - - -EBUSY - -This error code indicates that there are conflicting - requests. There are active filters filtering data from - another input source. Make sure that these filters are - stopped before starting this filter. - - -
- -
-DMX_STOP -DESCRIPTION - - -This ioctl call is used to stop the actual filtering operation defined via the - ioctl calls DMX_SET_FILTER or DMX_SET_PES_FILTER and started via - the DMX_START command. - - -SYNOPSIS - - -int ioctl( int fd, int request = DMX_STOP); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals DMX_STOP for this command. - - -ERRORS - - -EBADF - -fd is not a valid file descriptor. - - -
- -
-DMX_SET_FILTER -DESCRIPTION - - -This ioctl call sets up a filter according to the filter and mask parameters - provided. A timeout may be defined stating number of seconds to wait for a - section to be loaded. A value of 0 means that no timeout should be applied. - Finally there is a flag field where it is possible to state whether a section should - be CRC-checked, whether the filter should be a ”one-shot” filter, i.e. if the - filtering operation should be stopped after the first section is received, and - whether the filtering operation should be started immediately (without waiting - for a DMX_START ioctl call). If a filter was previously set-up, this filter will - be canceled, and the receive buffer will be flushed. - - -SYNOPSIS - - -int ioctl( int fd, int request = DMX_SET_FILTER, - struct dmx_sct_filter_params ⋆params); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals DMX_SET_FILTER for this command. - - -struct - dmx_sct_filter_params - *params - -Pointer to structure containing filter parameters. - - -ERRORS - - -EBADF - -fd is not a valid file descriptor. - - -EINVAL - -Invalid argument. - - -
- -
-DMX_SET_PES_FILTER -DESCRIPTION - - -This ioctl call sets up a PES filter according to the parameters provided. By a - PES filter is meant a filter that is based just on the packet identifier (PID), i.e. - no PES header or payload filtering capability is supported. - - -The transport stream destination for the filtered output may be set. Also the - PES type may be stated in order to be able to e.g. direct a video stream directly - to the video decoder. Finally there is a flag field where it is possible to state - whether the filtering operation should be started immediately (without waiting - for a DMX_START ioctl call). If a filter was previously set-up, this filter will - be cancelled, and the receive buffer will be flushed. - - -SYNOPSIS - - -int ioctl( int fd, int request = DMX_SET_PES_FILTER, - struct dmx_pes_filter_params ⋆params); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals DMX_SET_PES_FILTER for this command. - - -struct - dmx_pes_filter_params - *params - -Pointer to structure containing filter parameters. - - -ERRORS - - -EBADF - -fd is not a valid file descriptor. - - -EINVAL - -Invalid argument. - - -EBUSY - -This error code indicates that there are conflicting - requests. There are active filters filtering data from - another input source. Make sure that these filters are - stopped before starting this filter. - - -
- -
-DMX_SET_BUFFER_SIZE -DESCRIPTION - - -This ioctl call is used to set the size of the circular buffer used for filtered data. - The default size is two maximum sized sections, i.e. if this function is not called - a buffer size of 2 * 4096 bytes will be used. - - -SYNOPSIS - - -int ioctl( int fd, int request = - DMX_SET_BUFFER_SIZE, unsigned long size); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals DMX_SET_BUFFER_SIZE for this command. - - -unsigned long size - -Size of circular buffer. - - -ERRORS - - -EBADF - -fd is not a valid file descriptor. - - -ENOMEM - -The driver was not able to allocate a buffer of the - requested size. - - -
- -
-DMX_GET_EVENT -DESCRIPTION - - -This ioctl call returns an event if available. If an event is not available, - the behavior depends on whether the device is in blocking or non-blocking - mode. In the latter case, the call fails immediately with errno set to - EWOULDBLOCK. In the former case, the call blocks until an event becomes - available. - - -The standard Linux poll() and/or select() system calls can be used with the - device file descriptor to watch for new events. For select(), the file descriptor - should be included in the exceptfds argument, and for poll(), POLLPRI should - be specified as the wake-up condition. Only the latest event for each filter is - saved. - - -SYNOPSIS - - -int ioctl( int fd, int request = DMX_GET_EVENT, - struct dmx_event ⋆ev); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals DMX_GET_EVENT for this command. - - -struct dmx_event *ev - -Pointer to the location where the event is to be stored. - - -ERRORS - - -EBADF - -fd is not a valid file descriptor. - - -EFAULT - -ev points to an invalid address. - - -EWOULDBLOCK - -There is no event pending, and the device is in - non-blocking mode. - - -
- -
-DMX_GET_STC -DESCRIPTION - - -This ioctl call returns the current value of the system time counter (which is driven - by a PES filter of type DMX_PES_PCR). Some hardware supports more than one - STC, so you must specify which one by setting the num field of stc before the ioctl - (range 0...n). The result is returned in form of a ratio with a 64 bit numerator - and a 32 bit denominator, so the real 90kHz STC value is stc->stc / - stc->base - . - - -SYNOPSIS - - -int ioctl( int fd, int request = DMX_GET_STC, struct - dmx_stc ⋆stc); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals DMX_GET_STC for this command. - - -struct dmx_stc *stc - -Pointer to the location where the stc is to be stored. - - -ERRORS - - -EBADF - -fd is not a valid file descriptor. - - -EFAULT - -stc points to an invalid address. - - -EINVAL - -Invalid stc number. - - -
diff --git a/Documentation/DocBook/dvb/dvbapi.xml b/Documentation/DocBook/dvb/dvbapi.xml deleted file mode 100644 index 9fad86ce7f5e..000000000000 --- a/Documentation/DocBook/dvb/dvbapi.xml +++ /dev/null @@ -1,121 +0,0 @@ - - - -Ralph -Metzler -J. K. -
rjkm@metzlerbros.de
-
- -Marcus -Metzler -O. C. -
rjkm@metzlerbros.de
-
-
- - -Mauro -Carvalho -Chehab -
mchehab@redhat.com
-Ported document to Docbook XML. -
-
- - 2002 - 2003 - Convergence GmbH - - - 2009-2011 - Mauro Carvalho Chehab - - - - - - 2.0.4 - 2011-05-06 - mcc - - Add more information about DVB APIv5, better describing the frontend GET/SET props ioctl's. - - - - 2.0.3 - 2010-07-03 - mcc - - Add some frontend capabilities flags, present on kernel, but missing at the specs. - - - - 2.0.2 - 2009-10-25 - mcc - - documents FE_SET_FRONTEND_TUNE_MODE and FE_DISHETWORK_SEND_LEGACY_CMD ioctls. - - - -2.0.1 -2009-09-16 -mcc - -Added ISDB-T test originally written by Patrick Boettcher - - - -2.0.0 -2009-09-06 -mcc -Conversion from LaTex to DocBook XML. The - contents is the same as the original LaTex version. - - -1.0.0 -2003-07-24 -rjkm -Initial revision on LaTEX. - - -
- - -LINUX DVB API -Version 5.2 - - - &sub-intro; - - - &sub-frontend; - - - &sub-demux; - - - &sub-video; - - - &sub-audio; - - - &sub-ca; - - - &sub-net; - - - &sub-kdapi; - - - &sub-examples; - - - - DVB Frontend Header File - &sub-frontend-h; - - diff --git a/Documentation/DocBook/dvb/dvbproperty.xml b/Documentation/DocBook/dvb/dvbproperty.xml deleted file mode 100644 index b5365f61d69b..000000000000 --- a/Documentation/DocBook/dvb/dvbproperty.xml +++ /dev/null @@ -1,590 +0,0 @@ -
-FE_GET_PROPERTY/FE_SET_PROPERTY - - -/* Reserved fields should be set to 0 */ -struct dtv_property { - __u32 cmd; - union { - __u32 data; - struct { - __u8 data[32]; - __u32 len; - __u32 reserved1[3]; - void *reserved2; - } buffer; - } u; - int result; -} __attribute__ ((packed)); - -/* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */ -#define DTV_IOCTL_MAX_MSGS 64 - -struct dtv_properties { - __u32 num; - struct dtv_property *props; -}; - - -
-FE_GET_PROPERTY -DESCRIPTION - - -This ioctl call returns one or more frontend properties. This call only - requires read-only access to the device. - - -SYNOPSIS - - -int ioctl(int fd, int request = FE_GET_PROPERTY, - dtv_properties ⋆props); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int num - -Equals FE_GET_PROPERTY for this command. - - -struct dtv_property *props - -Points to the location where the front-end property commands are stored. - - -ERRORS - - EINVAL - Invalid parameter(s) received or number of parameters out of the range. - - ENOMEM - Out of memory. - - EFAULT - Failure while copying data from/to userspace. - - EOPNOTSUPP - Property type not supported. - -
- -
-FE_SET_PROPERTY -DESCRIPTION - - -This ioctl call sets one or more frontend properties. This call only - requires read-only access to the device. - - -SYNOPSIS - - -int ioctl(int fd, int request = FE_SET_PROPERTY, - dtv_properties ⋆props); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int num - -Equals FE_SET_PROPERTY for this command. - - -struct dtv_property *props - -Points to the location where the front-end property commands are stored. - - -ERRORS - - - EINVAL - Invalid parameter(s) received or number of parameters out of the range. - - ENOMEM - Out of memory. - - EFAULT - Failure while copying data from/to userspace. - - EOPNOTSUPP - Property type not supported. - -
- -
- Property types - -On FE_GET_PROPERTY/FE_SET_PROPERTY, -the actual action is determined by the dtv_property cmd/data pairs. With one single ioctl, is possible to -get/set up to 64 properties. The actual meaning of each property is described on the next sections. - - -The available frontend property types are: - -#define DTV_UNDEFINED 0 -#define DTV_TUNE 1 -#define DTV_CLEAR 2 -#define DTV_FREQUENCY 3 -#define DTV_MODULATION 4 -#define DTV_BANDWIDTH_HZ 5 -#define DTV_INVERSION 6 -#define DTV_DISEQC_MASTER 7 -#define DTV_SYMBOL_RATE 8 -#define DTV_INNER_FEC 9 -#define DTV_VOLTAGE 10 -#define DTV_TONE 11 -#define DTV_PILOT 12 -#define DTV_ROLLOFF 13 -#define DTV_DISEQC_SLAVE_REPLY 14 -#define DTV_FE_CAPABILITY_COUNT 15 -#define DTV_FE_CAPABILITY 16 -#define DTV_DELIVERY_SYSTEM 17 -#define DTV_ISDBT_PARTIAL_RECEPTION 18 -#define DTV_ISDBT_SOUND_BROADCASTING 19 -#define DTV_ISDBT_SB_SUBCHANNEL_ID 20 -#define DTV_ISDBT_SB_SEGMENT_IDX 21 -#define DTV_ISDBT_SB_SEGMENT_COUNT 22 -#define DTV_ISDBT_LAYERA_FEC 23 -#define DTV_ISDBT_LAYERA_MODULATION 24 -#define DTV_ISDBT_LAYERA_SEGMENT_COUNT 25 -#define DTV_ISDBT_LAYERA_TIME_INTERLEAVING 26 -#define DTV_ISDBT_LAYERB_FEC 27 -#define DTV_ISDBT_LAYERB_MODULATION 28 -#define DTV_ISDBT_LAYERB_SEGMENT_COUNT 29 -#define DTV_ISDBT_LAYERB_TIME_INTERLEAVING 30 -#define DTV_ISDBT_LAYERC_FEC 31 -#define DTV_ISDBT_LAYERC_MODULATION 32 -#define DTV_ISDBT_LAYERC_SEGMENT_COUNT 33 -#define DTV_ISDBT_LAYERC_TIME_INTERLEAVING 34 -#define DTV_API_VERSION 35 -#define DTV_CODE_RATE_HP 36 -#define DTV_CODE_RATE_LP 37 -#define DTV_GUARD_INTERVAL 38 -#define DTV_TRANSMISSION_MODE 39 -#define DTV_HIERARCHY 40 -#define DTV_ISDBT_LAYER_ENABLED 41 -#define DTV_ISDBS_TS_ID 42 - -
- -
- Parameters that are common to all Digital TV standards -
- <constant>DTV_FREQUENCY</constant> - - Central frequency of the channel, in HZ. - - Notes: - 1)For ISDB-T, the channels are usually transmitted with an offset of 143kHz. - E.g. a valid frequncy could be 474143 kHz. The stepping is bound to the bandwidth of - the channel which is 6MHz. - - 2)As in ISDB-Tsb the channel consists of only one or three segments the - frequency step is 429kHz, 3*429 respectively. As for ISDB-T the - central frequency of the channel is expected. -
- -
- <constant>DTV_BANDWIDTH_HZ</constant> - - Bandwidth for the channel, in HZ. - - Possible values: - 1712000, - 5000000, - 6000000, - 7000000, - 8000000, - 10000000. - - - Notes: - - 1) For ISDB-T it should be always 6000000Hz (6MHz) - 2) For ISDB-Tsb it can vary depending on the number of connected segments - 3) Bandwidth doesn't apply for DVB-C transmissions, as the bandwidth - for DVB-C depends on the symbol rate - 4) Bandwidth in ISDB-T is fixed (6MHz) or can be easily derived from - other parameters (DTV_ISDBT_SB_SEGMENT_IDX, - DTV_ISDBT_SB_SEGMENT_COUNT). - 5) DVB-T supports 6, 7 and 8MHz. - 6) In addition, DVB-T2 supports 1.172, 5 and 10MHz. -
- -
- <constant>DTV_DELIVERY_SYSTEM</constant> - - Specifies the type of Delivery system - - Possible values: - -typedef enum fe_delivery_system { - SYS_UNDEFINED, - SYS_DVBC_ANNEX_AC, - SYS_DVBC_ANNEX_B, - SYS_DVBT, - SYS_DSS, - SYS_DVBS, - SYS_DVBS2, - SYS_DVBH, - SYS_ISDBT, - SYS_ISDBS, - SYS_ISDBC, - SYS_ATSC, - SYS_ATSCMH, - SYS_DMBTH, - SYS_CMMB, - SYS_DAB, - SYS_DVBT2, -} fe_delivery_system_t; - - -
- -
- <constant>DTV_TRANSMISSION_MODE</constant> - - Specifies the number of carriers used by the standard - - Possible values are: - -typedef enum fe_transmit_mode { - TRANSMISSION_MODE_2K, - TRANSMISSION_MODE_8K, - TRANSMISSION_MODE_AUTO, - TRANSMISSION_MODE_4K, - TRANSMISSION_MODE_1K, - TRANSMISSION_MODE_16K, - TRANSMISSION_MODE_32K, -} fe_transmit_mode_t; - - - Notes: - 1) ISDB-T supports three carrier/symbol-size: 8K, 4K, 2K. It is called - 'mode' in the standard: Mode 1 is 2K, mode 2 is 4K, mode 3 is 8K - - 2) If DTV_TRANSMISSION_MODE is set the TRANSMISSION_MODE_AUTO the - hardware will try to find the correct FFT-size (if capable) and will - use TMCC to fill in the missing parameters. - 3) DVB-T specifies 2K and 8K as valid sizes. - 4) DVB-T2 specifies 1K, 2K, 4K, 8K, 16K and 32K. -
- -
- <constant>DTV_GUARD_INTERVAL</constant> - - Possible values are: - -typedef enum fe_guard_interval { - GUARD_INTERVAL_1_32, - GUARD_INTERVAL_1_16, - GUARD_INTERVAL_1_8, - GUARD_INTERVAL_1_4, - GUARD_INTERVAL_AUTO, - GUARD_INTERVAL_1_128, - GUARD_INTERVAL_19_128, - GUARD_INTERVAL_19_256, -} fe_guard_interval_t; - - - Notes: - 1) If DTV_GUARD_INTERVAL is set the GUARD_INTERVAL_AUTO the hardware will - try to find the correct guard interval (if capable) and will use TMCC to fill - in the missing parameters. - 2) Intervals 1/128, 19/128 and 19/256 are used only for DVB-T2 at present -
-
- -
- ISDB-T frontend - This section describes shortly what are the possible parameters in the Linux - DVB-API called "S2API" and now DVB API 5 in order to tune an ISDB-T/ISDB-Tsb - demodulator: - - This ISDB-T/ISDB-Tsb API extension should reflect all information - needed to tune any ISDB-T/ISDB-Tsb hardware. Of course it is possible - that some very sophisticated devices won't need certain parameters to - tune. - - The information given here should help application writers to know how - to handle ISDB-T and ISDB-Tsb hardware using the Linux DVB-API. - - The details given here about ISDB-T and ISDB-Tsb are just enough to - basically show the dependencies between the needed parameter values, - but surely some information is left out. For more detailed information - see the following documents: - - ARIB STD-B31 - "Transmission System for Digital Terrestrial - Television Broadcasting" and - ARIB TR-B14 - "Operational Guidelines for Digital Terrestrial - Television Broadcasting". - - In order to read this document one has to have some knowledge the - channel structure in ISDB-T and ISDB-Tsb. I.e. it has to be known to - the reader that an ISDB-T channel consists of 13 segments, that it can - have up to 3 layer sharing those segments, and things like that. - - Parameters used by ISDB-T and ISDB-Tsb. - -
- ISDB-T only parameters - -
- <constant>DTV_ISDBT_PARTIAL_RECEPTION</constant> - - If DTV_ISDBT_SOUND_BROADCASTING is '0' this bit-field represents whether - the channel is in partial reception mode or not. - - If '1' DTV_ISDBT_LAYERA_* values are assigned to the center segment and - DTV_ISDBT_LAYERA_SEGMENT_COUNT has to be '1'. - - If in addition DTV_ISDBT_SOUND_BROADCASTING is '1' - DTV_ISDBT_PARTIAL_RECEPTION represents whether this ISDB-Tsb channel - is consisting of one segment and layer or three segments and two layers. - - Possible values: 0, 1, -1 (AUTO) -
- -
- <constant>DTV_ISDBT_SOUND_BROADCASTING</constant> - - This field represents whether the other DTV_ISDBT_*-parameters are - referring to an ISDB-T and an ISDB-Tsb channel. (See also - DTV_ISDBT_PARTIAL_RECEPTION). - - Possible values: 0, 1, -1 (AUTO) -
- -
- <constant>DTV_ISDBT_SB_SUBCHANNEL_ID</constant> - - This field only applies if DTV_ISDBT_SOUND_BROADCASTING is '1'. - - (Note of the author: This might not be the correct description of the - SUBCHANNEL-ID in all details, but it is my understanding of the technical - background needed to program a device) - - An ISDB-Tsb channel (1 or 3 segments) can be broadcasted alone or in a - set of connected ISDB-Tsb channels. In this set of channels every - channel can be received independently. The number of connected - ISDB-Tsb segment can vary, e.g. depending on the frequency spectrum - bandwidth available. - - Example: Assume 8 ISDB-Tsb connected segments are broadcasted. The - broadcaster has several possibilities to put those channels in the - air: Assuming a normal 13-segment ISDB-T spectrum he can align the 8 - segments from position 1-8 to 5-13 or anything in between. - - The underlying layer of segments are subchannels: each segment is - consisting of several subchannels with a predefined IDs. A sub-channel - is used to help the demodulator to synchronize on the channel. - - An ISDB-T channel is always centered over all sub-channels. As for - the example above, in ISDB-Tsb it is no longer as simple as that. - - The DTV_ISDBT_SB_SUBCHANNEL_ID parameter is used to give the - sub-channel ID of the segment to be demodulated. - - Possible values: 0 .. 41, -1 (AUTO) -
- -
- - <constant>DTV_ISDBT_SB_SEGMENT_IDX</constant> - - This field only applies if DTV_ISDBT_SOUND_BROADCASTING is '1'. - - DTV_ISDBT_SB_SEGMENT_IDX gives the index of the segment to be - demodulated for an ISDB-Tsb channel where several of them are - transmitted in the connected manner. - - Possible values: 0 .. DTV_ISDBT_SB_SEGMENT_COUNT - 1 - - Note: This value cannot be determined by an automatic channel search. -
- -
- <constant>DTV_ISDBT_SB_SEGMENT_COUNT</constant> - - This field only applies if DTV_ISDBT_SOUND_BROADCASTING is '1'. - - DTV_ISDBT_SB_SEGMENT_COUNT gives the total count of connected ISDB-Tsb - channels. - - Possible values: 1 .. 13 - - Note: This value cannot be determined by an automatic channel search. -
- -
- Hierarchical layers - - ISDB-T channels can be coded hierarchically. As opposed to DVB-T in - ISDB-T hierarchical layers can be decoded simultaneously. For that - reason a ISDB-T demodulator has 3 viterbi and 3 reed-solomon-decoders. - - ISDB-T has 3 hierarchical layers which each can use a part of the - available segments. The total number of segments over all layers has - to 13 in ISDB-T. - -
- <constant>DTV_ISDBT_LAYER_ENABLED</constant> - - Hierarchical reception in ISDB-T is achieved by enabling or disabling - layers in the decoding process. Setting all bits of - DTV_ISDBT_LAYER_ENABLED to '1' forces all layers (if applicable) to be - demodulated. This is the default. - - If the channel is in the partial reception mode - (DTV_ISDBT_PARTIAL_RECEPTION = 1) the central segment can be decoded - independently of the other 12 segments. In that mode layer A has to - have a SEGMENT_COUNT of 1. - - In ISDB-Tsb only layer A is used, it can be 1 or 3 in ISDB-Tsb - according to DTV_ISDBT_PARTIAL_RECEPTION. SEGMENT_COUNT must be filled - accordingly. - - Possible values: 0x1, 0x2, 0x4 (|-able) - - DTV_ISDBT_LAYER_ENABLED[0:0] - layer A - DTV_ISDBT_LAYER_ENABLED[1:1] - layer B - DTV_ISDBT_LAYER_ENABLED[2:2] - layer C - DTV_ISDBT_LAYER_ENABLED[31:3] unused -
- -
- <constant>DTV_ISDBT_LAYER*_FEC</constant> - - Possible values: FEC_AUTO, FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_7_8 -
- -
- <constant>DTV_ISDBT_LAYER*_MODULATION</constant> - - Possible values: QAM_AUTO, QPSK, QAM_16, QAM_64, DQPSK - - Note: If layer C is DQPSK layer B has to be DQPSK. If layer B is DQPSK - and DTV_ISDBT_PARTIAL_RECEPTION=0 layer has to be DQPSK. -
- -
- <constant>DTV_ISDBT_LAYER*_SEGMENT_COUNT</constant> - - Possible values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, -1 (AUTO) - - Note: Truth table for DTV_ISDBT_SOUND_BROADCASTING and - DTV_ISDBT_PARTIAL_RECEPTION and LAYER*_SEGMENT_COUNT - - - - - - - PR - SB - Layer A width - Layer B width - Layer C width - total width - - - - 0 - 0 - 1 .. 13 - 1 .. 13 - 1 .. 13 - 13 - - - - 1 - 0 - 1 - 1 .. 13 - 1 .. 13 - 13 - - - - 0 - 1 - 1 - 0 - 0 - 1 - - - - 1 - 1 - 1 - 2 - 0 - 13 - - - - - - -
- -
- <constant>DTV_ISDBT_LAYER*_TIME_INTERLEAVING</constant> - - Possible values: 0, 1, 2, 3, -1 (AUTO) - - Note: The real inter-leaver depth-names depend on the mode (fft-size); the values - here are referring to what can be found in the TMCC-structure - - independent of the mode. -
-
-
-
- DVB-T2 parameters - - This section covers parameters that apply only to the DVB-T2 delivery method. DVB-T2 - support is currently in the early stages development so expect this section to grow - and become more detailed with time. - -
- <constant>DTV_DVBT2_PLP_ID</constant> - - DVB-T2 supports Physical Layer Pipes (PLP) to allow transmission of - many data types via a single multiplex. The API will soon support this - at which point this section will be expanded. -
-
-
-
diff --git a/Documentation/DocBook/dvb/dvbstb.pdf b/Documentation/DocBook/dvb/dvbstb.pdf deleted file mode 100644 index 0fa75d90c3eb..000000000000 Binary files a/Documentation/DocBook/dvb/dvbstb.pdf and /dev/null differ diff --git a/Documentation/DocBook/dvb/dvbstb.png b/Documentation/DocBook/dvb/dvbstb.png deleted file mode 100644 index 9b8f372e7afd..000000000000 Binary files a/Documentation/DocBook/dvb/dvbstb.png and /dev/null differ diff --git a/Documentation/DocBook/dvb/examples.xml b/Documentation/DocBook/dvb/examples.xml deleted file mode 100644 index f037e568eb6e..000000000000 --- a/Documentation/DocBook/dvb/examples.xml +++ /dev/null @@ -1,365 +0,0 @@ -Examples -In this section we would like to present some examples for using the DVB API. - -Maintainer note: This section is out of date. Please refer to the sample programs packaged -with the driver distribution from . - - -
-Tuning -We will start with a generic tuning subroutine that uses the frontend and SEC, as well as -the demux devices. The example is given for QPSK tuners, but can easily be adjusted for -QAM. - - - #include <sys/ioctl.h> - #include <stdio.h> - #include <stdint.h> - #include <sys/types.h> - #include <sys/stat.h> - #include <fcntl.h> - #include <time.h> - #include <unistd.h> - - #include <linux/dvb/dmx.h> - #include <linux/dvb/frontend.h> - #include <linux/dvb/sec.h> - #include <sys/poll.h> - - #define DMX "/dev/dvb/adapter0/demux1" - #define FRONT "/dev/dvb/adapter0/frontend1" - #define SEC "/dev/dvb/adapter0/sec1" - - /⋆ routine for checking if we have a signal and other status information⋆/ - int FEReadStatus(int fd, fe_status_t ⋆stat) - { - int ans; - - if ( (ans = ioctl(fd,FE_READ_STATUS,stat) < 0)){ - perror("FE READ STATUS: "); - return -1; - } - - if (⋆stat & FE_HAS_POWER) - printf("FE HAS POWER\n"); - - if (⋆stat & FE_HAS_SIGNAL) - printf("FE HAS SIGNAL\n"); - - if (⋆stat & FE_SPECTRUM_INV) - printf("SPEKTRUM INV\n"); - - return 0; - } - - - /⋆ tune qpsk ⋆/ - /⋆ freq: frequency of transponder ⋆/ - /⋆ vpid, apid, tpid: PIDs of video, audio and teletext TS packets ⋆/ - /⋆ diseqc: DiSEqC address of the used LNB ⋆/ - /⋆ pol: Polarisation ⋆/ - /⋆ srate: Symbol Rate ⋆/ - /⋆ fec. FEC ⋆/ - /⋆ lnb_lof1: local frequency of lower LNB band ⋆/ - /⋆ lnb_lof2: local frequency of upper LNB band ⋆/ - /⋆ lnb_slof: switch frequency of LNB ⋆/ - - int set_qpsk_channel(int freq, int vpid, int apid, int tpid, - int diseqc, int pol, int srate, int fec, int lnb_lof1, - int lnb_lof2, int lnb_slof) - { - struct secCommand scmd; - struct secCmdSequence scmds; - struct dmx_pes_filter_params pesFilterParams; - FrontendParameters frp; - struct pollfd pfd[1]; - FrontendEvent event; - int demux1, demux2, demux3, front; - - frequency = (uint32_t) freq; - symbolrate = (uint32_t) srate; - - if((front = open(FRONT,O_RDWR)) < 0){ - perror("FRONTEND DEVICE: "); - return -1; - } - - if((sec = open(SEC,O_RDWR)) < 0){ - perror("SEC DEVICE: "); - return -1; - } - - if (demux1 < 0){ - if ((demux1=open(DMX, O_RDWR|O_NONBLOCK)) - < 0){ - perror("DEMUX DEVICE: "); - return -1; - } - } - - if (demux2 < 0){ - if ((demux2=open(DMX, O_RDWR|O_NONBLOCK)) - < 0){ - perror("DEMUX DEVICE: "); - return -1; - } - } - - if (demux3 < 0){ - if ((demux3=open(DMX, O_RDWR|O_NONBLOCK)) - < 0){ - perror("DEMUX DEVICE: "); - return -1; - } - } - - if (freq < lnb_slof) { - frp.Frequency = (freq - lnb_lof1); - scmds.continuousTone = SEC_TONE_OFF; - } else { - frp.Frequency = (freq - lnb_lof2); - scmds.continuousTone = SEC_TONE_ON; - } - frp.Inversion = INVERSION_AUTO; - if (pol) scmds.voltage = SEC_VOLTAGE_18; - else scmds.voltage = SEC_VOLTAGE_13; - - scmd.type=0; - scmd.u.diseqc.addr=0x10; - scmd.u.diseqc.cmd=0x38; - scmd.u.diseqc.numParams=1; - scmd.u.diseqc.params[0] = 0xF0 | ((diseqc ⋆ 4) & 0x0F) | - (scmds.continuousTone == SEC_TONE_ON ? 1 : 0) | - (scmds.voltage==SEC_VOLTAGE_18 ? 2 : 0); - - scmds.miniCommand=SEC_MINI_NONE; - scmds.numCommands=1; - scmds.commands=&scmd; - if (ioctl(sec, SEC_SEND_SEQUENCE, &scmds) < 0){ - perror("SEC SEND: "); - return -1; - } - - if (ioctl(sec, SEC_SEND_SEQUENCE, &scmds) < 0){ - perror("SEC SEND: "); - return -1; - } - - frp.u.qpsk.SymbolRate = srate; - frp.u.qpsk.FEC_inner = fec; - - if (ioctl(front, FE_SET_FRONTEND, &frp) < 0){ - perror("QPSK TUNE: "); - return -1; - } - - pfd[0].fd = front; - pfd[0].events = POLLIN; - - if (poll(pfd,1,3000)){ - if (pfd[0].revents & POLLIN){ - printf("Getting QPSK event\n"); - if ( ioctl(front, FE_GET_EVENT, &event) - - == -EOVERFLOW){ - perror("qpsk get event"); - return -1; - } - printf("Received "); - switch(event.type){ - case FE_UNEXPECTED_EV: - printf("unexpected event\n"); - return -1; - case FE_FAILURE_EV: - printf("failure event\n"); - return -1; - - case FE_COMPLETION_EV: - printf("completion event\n"); - } - } - } - - - pesFilterParams.pid = vpid; - pesFilterParams.input = DMX_IN_FRONTEND; - pesFilterParams.output = DMX_OUT_DECODER; - pesFilterParams.pes_type = DMX_PES_VIDEO; - pesFilterParams.flags = DMX_IMMEDIATE_START; - if (ioctl(demux1, DMX_SET_PES_FILTER, &pesFilterParams) < 0){ - perror("set_vpid"); - return -1; - } - - pesFilterParams.pid = apid; - pesFilterParams.input = DMX_IN_FRONTEND; - pesFilterParams.output = DMX_OUT_DECODER; - pesFilterParams.pes_type = DMX_PES_AUDIO; - pesFilterParams.flags = DMX_IMMEDIATE_START; - if (ioctl(demux2, DMX_SET_PES_FILTER, &pesFilterParams) < 0){ - perror("set_apid"); - return -1; - } - - pesFilterParams.pid = tpid; - pesFilterParams.input = DMX_IN_FRONTEND; - pesFilterParams.output = DMX_OUT_DECODER; - pesFilterParams.pes_type = DMX_PES_TELETEXT; - pesFilterParams.flags = DMX_IMMEDIATE_START; - if (ioctl(demux3, DMX_SET_PES_FILTER, &pesFilterParams) < 0){ - perror("set_tpid"); - return -1; - } - - return has_signal(fds); - } - - -The program assumes that you are using a universal LNB and a standard DiSEqC -switch with up to 4 addresses. Of course, you could build in some more checking if -tuning was successful and maybe try to repeat the tuning process. Depending on the -external hardware, i.e. LNB and DiSEqC switch, and weather conditions this may be -necessary. - -
- -
-The DVR device -The following program code shows how to use the DVR device for recording. - - - #include <sys/ioctl.h> - #include <stdio.h> - #include <stdint.h> - #include <sys/types.h> - #include <sys/stat.h> - #include <fcntl.h> - #include <time.h> - #include <unistd.h> - - #include <linux/dvb/dmx.h> - #include <linux/dvb/video.h> - #include <sys/poll.h> - #define DVR "/dev/dvb/adapter0/dvr1" - #define AUDIO "/dev/dvb/adapter0/audio1" - #define VIDEO "/dev/dvb/adapter0/video1" - - #define BUFFY (188⋆20) - #define MAX_LENGTH (1024⋆1024⋆5) /⋆ record 5MB ⋆/ - - - /⋆ switch the demuxes to recording, assuming the transponder is tuned ⋆/ - - /⋆ demux1, demux2: file descriptor of video and audio filters ⋆/ - /⋆ vpid, apid: PIDs of video and audio channels ⋆/ - - int switch_to_record(int demux1, int demux2, uint16_t vpid, uint16_t apid) - { - struct dmx_pes_filter_params pesFilterParams; - - if (demux1 < 0){ - if ((demux1=open(DMX, O_RDWR|O_NONBLOCK)) - < 0){ - perror("DEMUX DEVICE: "); - return -1; - } - } - - if (demux2 < 0){ - if ((demux2=open(DMX, O_RDWR|O_NONBLOCK)) - < 0){ - perror("DEMUX DEVICE: "); - return -1; - } - } - - pesFilterParams.pid = vpid; - pesFilterParams.input = DMX_IN_FRONTEND; - pesFilterParams.output = DMX_OUT_TS_TAP; - pesFilterParams.pes_type = DMX_PES_VIDEO; - pesFilterParams.flags = DMX_IMMEDIATE_START; - if (ioctl(demux1, DMX_SET_PES_FILTER, &pesFilterParams) < 0){ - perror("DEMUX DEVICE"); - return -1; - } - pesFilterParams.pid = apid; - pesFilterParams.input = DMX_IN_FRONTEND; - pesFilterParams.output = DMX_OUT_TS_TAP; - pesFilterParams.pes_type = DMX_PES_AUDIO; - pesFilterParams.flags = DMX_IMMEDIATE_START; - if (ioctl(demux2, DMX_SET_PES_FILTER, &pesFilterParams) < 0){ - perror("DEMUX DEVICE"); - return -1; - } - return 0; - } - - /⋆ start recording MAX_LENGTH , assuming the transponder is tuned ⋆/ - - /⋆ demux1, demux2: file descriptor of video and audio filters ⋆/ - /⋆ vpid, apid: PIDs of video and audio channels ⋆/ - int record_dvr(int demux1, int demux2, uint16_t vpid, uint16_t apid) - { - int i; - int len; - int written; - uint8_t buf[BUFFY]; - uint64_t length; - struct pollfd pfd[1]; - int dvr, dvr_out; - - /⋆ open dvr device ⋆/ - if ((dvr = open(DVR, O_RDONLY|O_NONBLOCK)) < 0){ - perror("DVR DEVICE"); - return -1; - } - - /⋆ switch video and audio demuxes to dvr ⋆/ - printf ("Switching dvr on\n"); - i = switch_to_record(demux1, demux2, vpid, apid); - printf("finished: "); - - printf("Recording %2.0f MB of test file in TS format\n", - MAX_LENGTH/(1024.0⋆1024.0)); - length = 0; - - /⋆ open output file ⋆/ - if ((dvr_out = open(DVR_FILE,O_WRONLY|O_CREAT - |O_TRUNC, S_IRUSR|S_IWUSR - |S_IRGRP|S_IWGRP|S_IROTH| - S_IWOTH)) < 0){ - perror("Can't open file for dvr test"); - return -1; - } - - pfd[0].fd = dvr; - pfd[0].events = POLLIN; - - /⋆ poll for dvr data and write to file ⋆/ - while (length < MAX_LENGTH ) { - if (poll(pfd,1,1)){ - if (pfd[0].revents & POLLIN){ - len = read(dvr, buf, BUFFY); - if (len < 0){ - perror("recording"); - return -1; - } - if (len > 0){ - written = 0; - while (written < len) - written += - write (dvr_out, - buf, len); - length += len; - printf("written %2.0f MB\r", - length/1024./1024.); - } - } - } - } - return 0; - } - - - -
diff --git a/Documentation/DocBook/dvb/frontend.xml b/Documentation/DocBook/dvb/frontend.xml deleted file mode 100644 index 60c6976fb311..000000000000 --- a/Documentation/DocBook/dvb/frontend.xml +++ /dev/null @@ -1,1851 +0,0 @@ -DVB Frontend API - -The DVB frontend device controls the tuner and DVB demodulator -hardware. It can be accessed through /dev/dvb/adapter0/frontend0. Data types and and -ioctl definitions can be accessed by including linux/dvb/frontend.h in your application. - -DVB frontends come in three varieties: DVB-S (satellite), DVB-C -(cable) and DVB-T (terrestrial). Transmission via the internet (DVB-IP) -is not yet handled by this API but a future extension is possible. For -DVB-S the frontend device also supports satellite equipment control -(SEC) via DiSEqC and V-SEC protocols. The DiSEqC (digital SEC) -specification is available from -Eutelsat. - -Note that the DVB API may also be used for MPEG decoder-only PCI -cards, in which case there exists no frontend device. - -
-Frontend Data Types - -
-frontend type - -For historical reasons frontend types are named after the type of modulation used in -transmission. - - typedef enum fe_type { - FE_QPSK, /⋆ DVB-S ⋆/ - FE_QAM, /⋆ DVB-C ⋆/ - FE_OFDM /⋆ DVB-T ⋆/ - } fe_type_t; - - -
- -
-frontend capabilities - -Capabilities describe what a frontend can do. Some capabilities can only be supported for -a specific frontend type. - - typedef enum fe_caps { - FE_IS_STUPID = 0, - FE_CAN_INVERSION_AUTO = 0x1, - FE_CAN_FEC_1_2 = 0x2, - FE_CAN_FEC_2_3 = 0x4, - FE_CAN_FEC_3_4 = 0x8, - FE_CAN_FEC_4_5 = 0x10, - FE_CAN_FEC_5_6 = 0x20, - FE_CAN_FEC_6_7 = 0x40, - FE_CAN_FEC_7_8 = 0x80, - FE_CAN_FEC_8_9 = 0x100, - FE_CAN_FEC_AUTO = 0x200, - FE_CAN_QPSK = 0x400, - FE_CAN_QAM_16 = 0x800, - FE_CAN_QAM_32 = 0x1000, - FE_CAN_QAM_64 = 0x2000, - FE_CAN_QAM_128 = 0x4000, - FE_CAN_QAM_256 = 0x8000, - FE_CAN_QAM_AUTO = 0x10000, - FE_CAN_TRANSMISSION_MODE_AUTO = 0x20000, - FE_CAN_BANDWIDTH_AUTO = 0x40000, - FE_CAN_GUARD_INTERVAL_AUTO = 0x80000, - FE_CAN_HIERARCHY_AUTO = 0x100000, - FE_CAN_8VSB = 0x200000, - FE_CAN_16VSB = 0x400000, - FE_HAS_EXTENDED_CAPS = 0x800000, - FE_CAN_TURBO_FEC = 0x8000000, - FE_CAN_2G_MODULATION = 0x10000000, - FE_NEEDS_BENDING = 0x20000000, - FE_CAN_RECOVER = 0x40000000, - FE_CAN_MUTE_TS = 0x80000000 - } fe_caps_t; - -
- -
-frontend information - -Information about the frontend ca be queried with - FE_GET_INFO. - - - struct dvb_frontend_info { - char name[128]; - fe_type_t type; - uint32_t frequency_min; - uint32_t frequency_max; - uint32_t frequency_stepsize; - uint32_t frequency_tolerance; - uint32_t symbol_rate_min; - uint32_t symbol_rate_max; - uint32_t symbol_rate_tolerance; /⋆ ppm ⋆/ - uint32_t notifier_delay; /⋆ ms ⋆/ - fe_caps_t caps; - }; - -
- -
-diseqc master command - -A message sent from the frontend to DiSEqC capable equipment. - - struct dvb_diseqc_master_cmd { - uint8_t msg [6]; /⋆ { framing, address, command, data[3] } ⋆/ - uint8_t msg_len; /⋆ valid values are 3...6 ⋆/ - }; - -
-
-diseqc slave reply - -A reply to the frontend from DiSEqC 2.0 capable equipment. - - struct dvb_diseqc_slave_reply { - uint8_t msg [4]; /⋆ { framing, data [3] } ⋆/ - uint8_t msg_len; /⋆ valid values are 0...4, 0 means no msg ⋆/ - int timeout; /⋆ return from ioctl after timeout ms with ⋆/ - }; /⋆ errorcode when no message was received ⋆/ - -
- -
-diseqc slave reply -The voltage is usually used with non-DiSEqC capable LNBs to switch the polarzation -(horizontal/vertical). When using DiSEqC epuipment this voltage has to be switched -consistently to the DiSEqC commands as described in the DiSEqC spec. - - typedef enum fe_sec_voltage { - SEC_VOLTAGE_13, - SEC_VOLTAGE_18 - } fe_sec_voltage_t; - -
- -
-SEC continuous tone - -The continuous 22KHz tone is usually used with non-DiSEqC capable LNBs to switch the -high/low band of a dual-band LNB. When using DiSEqC epuipment this voltage has to -be switched consistently to the DiSEqC commands as described in the DiSEqC -spec. - - typedef enum fe_sec_tone_mode { - SEC_TONE_ON, - SEC_TONE_OFF - } fe_sec_tone_mode_t; - -
- -
-SEC tone burst - -The 22KHz tone burst is usually used with non-DiSEqC capable switches to select -between two connected LNBs/satellites. When using DiSEqC epuipment this voltage has to -be switched consistently to the DiSEqC commands as described in the DiSEqC -spec. - - typedef enum fe_sec_mini_cmd { - SEC_MINI_A, - SEC_MINI_B - } fe_sec_mini_cmd_t; - - - -
- -
-frontend status -Several functions of the frontend device use the fe_status data type defined -by - - typedef enum fe_status { - FE_HAS_SIGNAL = 0x01, /⋆ found something above the noise level ⋆/ - FE_HAS_CARRIER = 0x02, /⋆ found a DVB signal ⋆/ - FE_HAS_VITERBI = 0x04, /⋆ FEC is stable ⋆/ - FE_HAS_SYNC = 0x08, /⋆ found sync bytes ⋆/ - FE_HAS_LOCK = 0x10, /⋆ everything's working... ⋆/ - FE_TIMEDOUT = 0x20, /⋆ no lock within the last ~2 seconds ⋆/ - FE_REINIT = 0x40 /⋆ frontend was reinitialized, ⋆/ - } fe_status_t; /⋆ application is recommned to reset ⋆/ - -to indicate the current state and/or state changes of the frontend hardware. - - -
- -
-frontend parameters -The kind of parameters passed to the frontend device for tuning depend on -the kind of hardware you are using. All kinds of parameters are combined as an -union in the FrontendParameters structure: - - struct dvb_frontend_parameters { - uint32_t frequency; /⋆ (absolute) frequency in Hz for QAM/OFDM ⋆/ - /⋆ intermediate frequency in kHz for QPSK ⋆/ - fe_spectral_inversion_t inversion; - union { - struct dvb_qpsk_parameters qpsk; - struct dvb_qam_parameters qam; - struct dvb_ofdm_parameters ofdm; - } u; - }; - -For satellite QPSK frontends you have to use the QPSKParameters member defined by - - struct dvb_qpsk_parameters { - uint32_t symbol_rate; /⋆ symbol rate in Symbols per second ⋆/ - fe_code_rate_t fec_inner; /⋆ forward error correction (see above) ⋆/ - }; - -for cable QAM frontend you use the QAMParameters structure - - struct dvb_qam_parameters { - uint32_t symbol_rate; /⋆ symbol rate in Symbols per second ⋆/ - fe_code_rate_t fec_inner; /⋆ forward error correction (see above) ⋆/ - fe_modulation_t modulation; /⋆ modulation type (see above) ⋆/ - }; - -DVB-T frontends are supported by the OFDMParamters structure - - - struct dvb_ofdm_parameters { - fe_bandwidth_t bandwidth; - fe_code_rate_t code_rate_HP; /⋆ high priority stream code rate ⋆/ - fe_code_rate_t code_rate_LP; /⋆ low priority stream code rate ⋆/ - fe_modulation_t constellation; /⋆ modulation type (see above) ⋆/ - fe_transmit_mode_t transmission_mode; - fe_guard_interval_t guard_interval; - fe_hierarchy_t hierarchy_information; - }; - -In the case of QPSK frontends the Frequency field specifies the intermediate -frequency, i.e. the offset which is effectively added to the local oscillator frequency (LOF) of -the LNB. The intermediate frequency has to be specified in units of kHz. For QAM and -OFDM frontends the Frequency specifies the absolute frequency and is given in -Hz. - -The Inversion field can take one of these values: - - - typedef enum fe_spectral_inversion { - INVERSION_OFF, - INVERSION_ON, - INVERSION_AUTO - } fe_spectral_inversion_t; - -It indicates if spectral inversion should be presumed or not. In the automatic setting -(INVERSION_AUTO) the hardware will try to figure out the correct setting by -itself. - -The possible values for the FEC_inner field are - - - typedef enum fe_code_rate { - FEC_NONE = 0, - FEC_1_2, - FEC_2_3, - FEC_3_4, - FEC_4_5, - FEC_5_6, - FEC_6_7, - FEC_7_8, - FEC_8_9, - FEC_AUTO - } fe_code_rate_t; - -which correspond to error correction rates of 1/2, 2/3, etc., no error correction or auto -detection. - -For cable and terrestrial frontends (QAM and OFDM) one also has to specify the quadrature -modulation mode which can be one of the following: - - - typedef enum fe_modulation { - QPSK, - QAM_16, - QAM_32, - QAM_64, - QAM_128, - QAM_256, - QAM_AUTO - } fe_modulation_t; - -Finally, there are several more parameters for OFDM: - - - typedef enum fe_transmit_mode { - TRANSMISSION_MODE_2K, - TRANSMISSION_MODE_8K, - TRANSMISSION_MODE_AUTO - } fe_transmit_mode_t; - - - typedef enum fe_bandwidth { - BANDWIDTH_8_MHZ, - BANDWIDTH_7_MHZ, - BANDWIDTH_6_MHZ, - BANDWIDTH_AUTO - } fe_bandwidth_t; - - - typedef enum fe_guard_interval { - GUARD_INTERVAL_1_32, - GUARD_INTERVAL_1_16, - GUARD_INTERVAL_1_8, - GUARD_INTERVAL_1_4, - GUARD_INTERVAL_AUTO - } fe_guard_interval_t; - - - typedef enum fe_hierarchy { - HIERARCHY_NONE, - HIERARCHY_1, - HIERARCHY_2, - HIERARCHY_4, - HIERARCHY_AUTO - } fe_hierarchy_t; - - -
- -
-frontend events - - struct dvb_frontend_event { - fe_status_t status; - struct dvb_frontend_parameters parameters; - }; - -
-
- - -
-Frontend Function Calls - -
-open() -DESCRIPTION - - -This system call opens a named frontend device (/dev/dvb/adapter0/frontend0) - for subsequent use. Usually the first thing to do after a successful open is to - find out the frontend type with FE_GET_INFO. -The device can be opened in read-only mode, which only allows monitoring of - device status and statistics, or read/write mode, which allows any kind of use - (e.g. performing tuning operations.) - -In a system with multiple front-ends, it is usually the case that multiple devices - cannot be open in read/write mode simultaneously. As long as a front-end - device is opened in read/write mode, other open() calls in read/write mode will - either fail or block, depending on whether non-blocking or blocking mode was - specified. A front-end device opened in blocking mode can later be put into - non-blocking mode (and vice versa) using the F_SETFL command of the fcntl - system call. This is a standard system call, documented in the Linux manual - page for fcntl. When an open() call has succeeded, the device will be ready - for use in the specified mode. This implies that the corresponding hardware is - powered up, and that other front-ends may have been powered down to make - that possible. - - - -SYNOPSIS - -int open(const char ⋆deviceName, int flags); - - -PARAMETERS - - -const char - *deviceName - -Name of specific video device. - - -int flags - -A bit-wise OR of the following flags: - - - -O_RDONLY read-only access - - - -O_RDWR read/write access - - - -O_NONBLOCK open in non-blocking mode - - - -(blocking mode is the default) - - -ERRORS - - -ENODEV - -Device driver not loaded/available. - - -EINTERNAL - -Internal error. - - -EBUSY - -Device or resource busy. - - -EINVAL - -Invalid argument. - - -
- -
-close() -DESCRIPTION - - -This system call closes a previously opened front-end device. After closing - a front-end device, its corresponding hardware might be powered down - automatically. - - -SYNOPSIS - - -int close(int fd); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - -
- -
-FE_READ_STATUS -DESCRIPTION - - -This ioctl call returns status information about the front-end. This call only - requires read-only access to the device. - - -SYNOPSIS - - -int ioctl(int fd, int request = FE_READ_STATUS, - fe_status_t ⋆status); - - -PARAMETERS - - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals FE_READ_STATUS for this command. - - -struct fe_status_t - *status - -Points to the location where the front-end status word is - to be stored. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - -EFAULT - -status points to invalid address. - - -
- -
-FE_READ_BER -DESCRIPTION - - -This ioctl call returns the bit error rate for the signal currently - received/demodulated by the front-end. For this command, read-only access to - the device is sufficient. - - -SYNOPSIS - - -int ioctl(int fd, int request = FE_READ_BER, - uint32_t ⋆ber); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals FE_READ_BER for this command. - - -uint32_t *ber - -The bit error rate is stored into *ber. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - -EFAULT - -ber points to invalid address. - - -ENOSIGNAL - -There is no signal, thus no meaningful bit error rate. Also - returned if the front-end is not turned on. - - -ENOSYS - -Function not available for this device. - - -
- -
-FE_READ_SNR - -DESCRIPTION - - -This ioctl call returns the signal-to-noise ratio for the signal currently received - by the front-end. For this command, read-only access to the device is sufficient. - - -SYNOPSIS - - -int ioctl(int fd, int request = FE_READ_SNR, int16_t - ⋆snr); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals FE_READ_SNR for this command. - - -int16_t *snr - -The signal-to-noise ratio is stored into *snr. - - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - -EFAULT - -snr points to invalid address. - - -ENOSIGNAL - -There is no signal, thus no meaningful signal strength - value. Also returned if front-end is not turned on. - - -ENOSYS - -Function not available for this device. - - -
- -
-FE_READ_SIGNAL_STRENGTH -DESCRIPTION - - -This ioctl call returns the signal strength value for the signal currently received - by the front-end. For this command, read-only access to the device is sufficient. - - -SYNOPSIS - - -int ioctl( int fd, int request = - FE_READ_SIGNAL_STRENGTH, int16_t ⋆strength); - - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals FE_READ_SIGNAL_STRENGTH for this - command. - - -int16_t *strength - -The signal strength value is stored into *strength. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - -EFAULT - -status points to invalid address. - - -ENOSIGNAL - -There is no signal, thus no meaningful signal strength - value. Also returned if front-end is not turned on. - - -ENOSYS - -Function not available for this device. - - -
- -
-FE_READ_UNCORRECTED_BLOCKS -DESCRIPTION - - -This ioctl call returns the number of uncorrected blocks detected by the device - driver during its lifetime. For meaningful measurements, the increment in block - count during a specific time interval should be calculated. For this command, - read-only access to the device is sufficient. - - -Note that the counter will wrap to zero after its maximum count has been - reached. - - -SYNOPSIS - - -int ioctl( int fd, int request = - FE_READ_UNCORRECTED_BLOCKS, uint32_t ⋆ublocks); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals FE_READ_UNCORRECTED_BLOCKS for this - command. - - -uint32_t *ublocks - -The total number of uncorrected blocks seen by the driver - so far. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - -EFAULT - -ublocks points to invalid address. - - -ENOSYS - -Function not available for this device. - - -
- -
-FE_SET_FRONTEND -DESCRIPTION - - -This ioctl call starts a tuning operation using specified parameters. The result - of this call will be successful if the parameters were valid and the tuning could - be initiated. The result of the tuning operation in itself, however, will arrive - asynchronously as an event (see documentation for FE_GET_EVENT and - FrontendEvent.) If a new FE_SET_FRONTEND operation is initiated before - the previous one was completed, the previous operation will be aborted in favor - of the new one. This command requires read/write access to the device. - - - -SYNOPSIS - - -int ioctl(int fd, int request = FE_SET_FRONTEND, - struct dvb_frontend_parameters ⋆p); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals FE_SET_FRONTEND for this command. - - -struct - dvb_frontend_parameters - *p - -Points to parameters for tuning operation. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - -EFAULT - -p points to invalid address. - - -EINVAL - -Maximum supported symbol rate reached. - - -
- -
-FE_GET_FRONTEND -DESCRIPTION - - -This ioctl call queries the currently effective frontend parameters. For this - command, read-only access to the device is sufficient. - - - -SYNOPSIS - - -int ioctl(int fd, int request = FE_GET_FRONTEND, - struct dvb_frontend_parameters ⋆p); - - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals FE_SET_FRONTEND for this command. - - -struct - dvb_frontend_parameters - *p - -Points to parameters for tuning operation. - - - -ERRORS - - - -EBADF - -fd is not a valid open file descriptor. - - -EFAULT - -p points to invalid address. - - -EINVAL - -Maximum supported symbol rate reached. - - - -
- -
-FE_GET_EVENT -DESCRIPTION - - -This ioctl call returns a frontend event if available. If an event is not - available, the behavior depends on whether the device is in blocking or - non-blocking mode. In the latter case, the call fails immediately with errno - set to EWOULDBLOCK. In the former case, the call blocks until an event - becomes available. - - -The standard Linux poll() and/or select() system calls can be used with the - device file descriptor to watch for new events. For select(), the file descriptor - should be included in the exceptfds argument, and for poll(), POLLPRI should - be specified as the wake-up condition. Since the event queue allocated is - rather small (room for 8 events), the queue must be serviced regularly to avoid - overflow. If an overflow happens, the oldest event is discarded from the queue, - and an error (EOVERFLOW) occurs the next time the queue is read. After - reporting the error condition in this fashion, subsequent - FE_GET_EVENT - calls will return events from the queue as usual. - - -For the sake of implementation simplicity, this command requires read/write - access to the device. - - - -SYNOPSIS - - -int ioctl(int fd, int request = QPSK_GET_EVENT, - struct dvb_frontend_event ⋆ev); - - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals FE_GET_EVENT for this command. - - -struct - dvb_frontend_event - *ev - -Points to the location where the event, - - - -if any, is to be stored. - - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - -EFAULT - -ev points to invalid address. - - -EWOULDBLOCK - -There is no event pending, and the device is in - non-blocking mode. - - -EOVERFLOW - - - - -Overflow in event queue - one or more events were lost. - - -
- -
-FE_GET_INFO -DESCRIPTION - - -This ioctl call returns information about the front-end. This call only requires - read-only access to the device. - - -SYNOPSIS - - - - int ioctl(int fd, int request = FE_GET_INFO, struct - dvb_frontend_info ⋆info); - - -PARAMETERS - - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals FE_GET_INFO for this command. - - -struct - dvb_frontend_info - *info - -Points to the location where the front-end information is - to be stored. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - -EFAULT - -info points to invalid address. - - -
- -
-FE_DISEQC_RESET_OVERLOAD -DESCRIPTION - - -If the bus has been automatically powered off due to power overload, this ioctl - call restores the power to the bus. The call requires read/write access to the - device. This call has no effect if the device is manually powered off. Not all - DVB adapters support this ioctl. - - - -SYNOPSIS - - -int ioctl(int fd, int request = - FE_DISEQC_RESET_OVERLOAD); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals FE_DISEQC_RESET_OVERLOAD for this - command. - - - -ERRORS - - -EBADF - -fd is not a valid file descriptor. - - -EPERM - -Permission denied (needs read/write access). - - -EINTERNAL - -Internal error in the device driver. - - -
- -
-FE_DISEQC_SEND_MASTER_CMD -DESCRIPTION - - -This ioctl call is used to send a a DiSEqC command. - - -SYNOPSIS - - -int ioctl(int fd, int request = - FE_DISEQC_SEND_MASTER_CMD, struct - dvb_diseqc_master_cmd ⋆cmd); - - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals FE_DISEQC_SEND_MASTER_CMD for this - command. - - -struct - dvb_diseqc_master_cmd - *cmd - -Pointer to the command to be transmitted. - - - -ERRORS - - -EBADF - -fd is not a valid file descriptor. - - -EFAULT - -Seq points to an invalid address. - - -EINVAL - -The data structure referred to by seq is invalid in some - way. - - -EPERM - -Permission denied (needs read/write access). - - -EINTERNAL - -Internal error in the device driver. - - -
- -
-FE_DISEQC_RECV_SLAVE_REPLY -DESCRIPTION - - -This ioctl call is used to receive reply to a DiSEqC 2.0 command. - - - -SYNOPSIS - - -int ioctl(int fd, int request = - FE_DISEQC_RECV_SLAVE_REPLY, struct - dvb_diseqc_slave_reply ⋆reply); - - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals FE_DISEQC_RECV_SLAVE_REPLY for this - command. - - -struct - dvb_diseqc_slave_reply - *reply - -Pointer to the command to be received. - - -ERRORS - - -EBADF - -fd is not a valid file descriptor. - - -EFAULT - -Seq points to an invalid address. - - -EINVAL - -The data structure referred to by seq is invalid in some - way. - - -EPERM - -Permission denied (needs read/write access). - - -EINTERNAL - -Internal error in the device driver. - - -
- -
-FE_DISEQC_SEND_BURST -DESCRIPTION - - -This ioctl call is used to send a 22KHz tone burst. - - - -SYNOPSIS - - -int ioctl(int fd, int request = - FE_DISEQC_SEND_BURST, fe_sec_mini_cmd_t burst); - - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals FE_DISEQC_SEND_BURST for this command. - - -fe_sec_mini_cmd_t - burst - -burst A or B. - - - -ERRORS - - -EBADF - -fd is not a valid file descriptor. - - -EFAULT - -Seq points to an invalid address. - - -EINVAL - -The data structure referred to by seq is invalid in some - way. - - -EPERM - -Permission denied (needs read/write access). - - -EINTERNAL - -Internal error in the device driver. - - -
- -
-FE_SET_TONE -DESCRIPTION - - -This call is used to set the generation of the continuous 22kHz tone. This call - requires read/write permissions. - - -SYNOPSIS - - -int ioctl(int fd, int request = FE_SET_TONE, - fe_sec_tone_mode_t tone); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals FE_SET_TONE for this command. - - -fe_sec_tone_mode_t - tone - -The requested tone generation mode (on/off). - - -ERRORS - - -ENODEV - -Device driver not loaded/available. - - -EBUSY - -Device or resource busy. - - -EINVAL - -Invalid argument. - - -EPERM - -File not opened with read permissions. - - -EINTERNAL - -Internal error in the device driver. - - -
- -
-FE_SET_VOLTAGE -DESCRIPTION - - -This call is used to set the bus voltage. This call requires read/write - permissions. - - -SYNOPSIS - - -int ioctl(int fd, int request = FE_SET_VOLTAGE, - fe_sec_voltage_t voltage); - - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals FE_SET_VOLTAGE for this command. - - -fe_sec_voltage_t - voltage - -The requested bus voltage. - - - -ERRORS - - -ENODEV - -Device driver not loaded/available. - - -EBUSY - -Device or resource busy. - - -EINVAL - -Invalid argument. - - -EPERM - -File not opened with read permissions. - - -EINTERNAL - -Internal error in the device driver. - - -
- -
-FE_ENABLE_HIGH_LNB_VOLTAGE -DESCRIPTION - - -If high != 0 enables slightly higher voltages instead of 13/18V (to compensate - for long cables). This call requires read/write permissions. Not all DVB - adapters support this ioctl. - - - -SYNOPSIS - - -int ioctl(int fd, int request = - FE_ENABLE_HIGH_LNB_VOLTAGE, int high); - - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals FE_SET_VOLTAGE for this command. - - -int high - -The requested bus voltage. - - - -ERRORS - - -ENODEV - -Device driver not loaded/available. - - -EBUSY - -Device or resource busy. - - -EINVAL - -Invalid argument. - - -EPERM - -File not opened with read permissions. - - -EINTERNAL - -Internal error in the device driver. - - -
- -
-FE_SET_FRONTEND_TUNE_MODE -DESCRIPTION - - -Allow setting tuner mode flags to the frontend. - - - -SYNOPSIS - - -int ioctl(int fd, int request = -FE_SET_FRONTEND_TUNE_MODE, unsigned int flags); - - - -PARAMETERS - - - unsigned int flags - - - -FE_TUNE_MODE_ONESHOT When set, this flag will disable any zigzagging or other "normal" tuning behaviour. Additionally, there will be no automatic monitoring of the lock status, and hence no frontend events will be generated. If a frontend device is closed, this flag will be automatically turned off when the device is reopened read-write. - - - - -ERRORS - -EINVAL -Invalid argument. - -
- -
- FE_DISHNETWORK_SEND_LEGACY_CMD -DESCRIPTION - - -WARNING: This is a very obscure legacy command, used only at stv0299 driver. Should not be used on newer drivers. -It provides a non-standard method for selecting Diseqc voltage on the frontend, for Dish Network legacy switches. -As support for this ioctl were added in 2004, this means that such dishes were already legacy in 2004. - - - -SYNOPSIS - - -int ioctl(int fd, int request = - FE_DISHNETWORK_SEND_LEGACY_CMD, unsigned long cmd); - - - -PARAMETERS - - - unsigned long cmd - - - -sends the specified raw cmd to the dish via DISEqC. - - - - -ERRORS - - - There are no errors in use for this call - - -
- -
- -&sub-dvbproperty; diff --git a/Documentation/DocBook/dvb/intro.xml b/Documentation/DocBook/dvb/intro.xml deleted file mode 100644 index 0dc83f672ea2..000000000000 --- a/Documentation/DocBook/dvb/intro.xml +++ /dev/null @@ -1,191 +0,0 @@ -Introduction - -
-What you need to know - -The reader of this document is required to have some knowledge in -the area of digital video broadcasting (DVB) and should be familiar with -part I of the MPEG2 specification ISO/IEC 13818 (aka ITU-T H.222), i.e -you should know what a program/transport stream (PS/TS) is and what is -meant by a packetized elementary stream (PES) or an I-frame. - -Various DVB standards documents are available from - and/or -. - -It is also necessary to know how to access unix/linux devices and -how to use ioctl calls. This also includes the knowledge of C or C++. - -
- -
-History - -The first API for DVB cards we used at Convergence in late 1999 -was an extension of the Video4Linux API which was primarily developed -for frame grabber cards. As such it was not really well suited to be -used for DVB cards and their new features like recording MPEG streams -and filtering several section and PES data streams at the same time. - - -In early 2000, we were approached by Nokia with a proposal for a -new standard Linux DVB API. As a commitment to the development of -terminals based on open standards, Nokia and Convergence made it -available to all Linux developers and published it on - in September 2000. -Convergence is the maintainer of the Linux DVB API. Together with the -LinuxTV community (i.e. you, the reader of this document), the Linux DVB -API will be constantly reviewed and improved. With the Linux driver for -the Siemens/Hauppauge DVB PCI card Convergence provides a first -implementation of the Linux DVB API. -
- -
-Overview - -
-Components of a DVB card/STB - - - - - - - - -
- -A DVB PCI card or DVB set-top-box (STB) usually consists of the -following main hardware components: - - - - -Frontend consisting of tuner and DVB demodulator - -Here the raw signal reaches the DVB hardware from a satellite dish -or antenna or directly from cable. The frontend down-converts and -demodulates this signal into an MPEG transport stream (TS). In case of a -satellite frontend, this includes a facility for satellite equipment -control (SEC), which allows control of LNB polarization, multi feed -switches or dish rotors. - - - - -Conditional Access (CA) hardware like CI adapters and smartcard slots - - -The complete TS is passed through the CA hardware. Programs to -which the user has access (controlled by the smart card) are decoded in -real time and re-inserted into the TS. - - - - Demultiplexer which filters the incoming DVB stream - -The demultiplexer splits the TS into its components like audio and -video streams. Besides usually several of such audio and video streams -it also contains data streams with information about the programs -offered in this or other streams of the same provider. - - - - -MPEG2 audio and video decoder - -The main targets of the demultiplexer are the MPEG2 audio and -video decoders. After decoding they pass on the uncompressed audio and -video to the computer screen or (through a PAL/NTSC encoder) to a TV -set. - - - - - - shows a crude schematic of the control and data flow -between those components. - -On a DVB PCI card not all of these have to be present since some -functionality can be provided by the main CPU of the PC (e.g. MPEG -picture and sound decoding) or is not needed (e.g. for data-only uses -like “internet over satellite”). Also not every card or STB -provides conditional access hardware. - -
- -
-Linux DVB Devices - -The Linux DVB API lets you control these hardware components -through currently six Unix-style character devices for video, audio, -frontend, demux, CA and IP-over-DVB networking. The video and audio -devices control the MPEG2 decoder hardware, the frontend device the -tuner and the DVB demodulator. The demux device gives you control over -the PES and section filters of the hardware. If the hardware does not -support filtering these filters can be implemented in software. Finally, -the CA device controls all the conditional access capabilities of the -hardware. It can depend on the individual security requirements of the -platform, if and how many of the CA functions are made available to the -application through this device. - -All devices can be found in the /dev -tree under /dev/dvb. The individual devices -are called: - - - - -/dev/dvb/adapterN/audioM, - - -/dev/dvb/adapterN/videoM, - - -/dev/dvb/adapterN/frontendM, - - - -/dev/dvb/adapterN/netM, - - - -/dev/dvb/adapterN/demuxM, - - - -/dev/dvb/adapterN/caM, - -where N enumerates the DVB PCI cards in a system starting -from 0, and M enumerates the devices of each type within each -adapter, starting from 0, too. We will omit the “/dev/dvb/adapterN/” in the further dicussion -of these devices. The naming scheme for the devices is the same wheter -devfs is used or not. - -More details about the data structures and function calls of all -the devices are described in the following chapters. - -
- -
-API include files - -For each of the DVB devices a corresponding include file exists. -The DVB API include files should be included in application sources with -a partial path like: - - - - #include <linux/dvb/frontend.h> - - -To enable applications to support different API version, an -additional include file linux/dvb/version.h exists, which defines the -constant DVB_API_VERSION. This document -describes DVB_API_VERSION 3. - - -
- diff --git a/Documentation/DocBook/dvb/kdapi.xml b/Documentation/DocBook/dvb/kdapi.xml deleted file mode 100644 index 6c67481eaa4b..000000000000 --- a/Documentation/DocBook/dvb/kdapi.xml +++ /dev/null @@ -1,2309 +0,0 @@ -Kernel Demux API -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 demux.h and located in -drivers/media/dvb/dvb-core. - -Maintainer note: This section must be reviewed. It is probably out of date. - - -
-Kernel Demux Data Types - - -
-dmx_success_t - - typedef enum { - 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 ⋆/ - } dmx_success_t; - - -
-
-TS filter types - - /⋆--------------------------------------------------------------------------⋆/ - /⋆ TS packet reception ⋆/ - /⋆--------------------------------------------------------------------------⋆/ - - /⋆ TS filter type for set_type() ⋆/ - - #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) ⋆/ - - -
-
-dmx_ts_pes_t -The structure - - - typedef enum - { - DMX_TS_PES_AUDIO, /⋆ also send packets to audio decoder (if it exists) ⋆/ - DMX_TS_PES_VIDEO, /⋆ ... ⋆/ - DMX_TS_PES_TELETEXT, - DMX_TS_PES_SUBTITLE, - DMX_TS_PES_PCR, - DMX_TS_PES_OTHER, - } dmx_ts_pes_t; - -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. - - - struct dmx_ts_feed_s { - int is_filtering; /⋆ Set to non-zero when filtering in progress ⋆/ - struct dmx_demux_s⋆ parent; /⋆ Back-pointer ⋆/ - void⋆ priv; /⋆ Pointer to private data of the API client ⋆/ - int (⋆set) (struct dmx_ts_feed_s⋆ feed, - __u16 pid, - size_t callback_length, - size_t circular_buffer_size, - int descramble, - struct timespec timeout); - int (⋆start_filtering) (struct dmx_ts_feed_s⋆ feed); - int (⋆stop_filtering) (struct dmx_ts_feed_s⋆ feed); - int (⋆set_type) (struct dmx_ts_feed_s⋆ feed, - int type, - dmx_ts_pes_t pes_type); - }; - - typedef struct dmx_ts_feed_s dmx_ts_feed_t; - - - /⋆--------------------------------------------------------------------------⋆/ - /⋆ PES packet reception (not supported yet) ⋆/ - /⋆--------------------------------------------------------------------------⋆/ - - typedef struct dmx_pes_filter_s { - struct dmx_pes_s⋆ parent; /⋆ Back-pointer ⋆/ - void⋆ priv; /⋆ Pointer to private data of the API client ⋆/ - } dmx_pes_filter_t; - - - typedef struct dmx_pes_feed_s { - int is_filtering; /⋆ Set to non-zero when filtering in progress ⋆/ - struct dmx_demux_s⋆ parent; /⋆ Back-pointer ⋆/ - void⋆ priv; /⋆ Pointer to private data of the API client ⋆/ - int (⋆set) (struct dmx_pes_feed_s⋆ feed, - __u16 pid, - size_t circular_buffer_size, - int descramble, - struct timespec timeout); - int (⋆start_filtering) (struct dmx_pes_feed_s⋆ feed); - int (⋆stop_filtering) (struct dmx_pes_feed_s⋆ feed); - int (⋆allocate_filter) (struct dmx_pes_feed_s⋆ feed, - dmx_pes_filter_t⋆⋆ filter); - int (⋆release_filter) (struct dmx_pes_feed_s⋆ feed, - dmx_pes_filter_t⋆ filter); - } dmx_pes_feed_t; - - - typedef struct { - __u8 filter_value [DMX_MAX_FILTER_SIZE]; - __u8 filter_mask [DMX_MAX_FILTER_SIZE]; - struct dmx_section_feed_s⋆ parent; /⋆ Back-pointer ⋆/ - void⋆ priv; /⋆ Pointer to private data of the API client ⋆/ - } dmx_section_filter_t; - - - struct dmx_section_feed_s { - int is_filtering; /⋆ Set to non-zero when filtering in progress ⋆/ - struct dmx_demux_s⋆ parent; /⋆ Back-pointer ⋆/ - void⋆ priv; /⋆ Pointer to private data of the API client ⋆/ - int (⋆set) (struct dmx_section_feed_s⋆ feed, - __u16 pid, - size_t circular_buffer_size, - int descramble, - int check_crc); - int (⋆allocate_filter) (struct dmx_section_feed_s⋆ feed, - dmx_section_filter_t⋆⋆ filter); - int (⋆release_filter) (struct dmx_section_feed_s⋆ feed, - dmx_section_filter_t⋆ filter); - int (⋆start_filtering) (struct dmx_section_feed_s⋆ feed); - int (⋆stop_filtering) (struct dmx_section_feed_s⋆ feed); - }; - typedef struct dmx_section_feed_s dmx_section_feed_t; - - /⋆--------------------------------------------------------------------------⋆/ - /⋆ Callback functions ⋆/ - /⋆--------------------------------------------------------------------------⋆/ - - typedef int (⋆dmx_ts_cb) ( __u8 ⋆ buffer1, - size_t buffer1_length, - __u8 ⋆ buffer2, - size_t buffer2_length, - dmx_ts_feed_t⋆ source, - dmx_success_t success); - - typedef int (⋆dmx_section_cb) ( __u8 ⋆ buffer1, - size_t buffer1_len, - __u8 ⋆ buffer2, - size_t buffer2_len, - dmx_section_filter_t ⋆ source, - dmx_success_t success); - - typedef int (⋆dmx_pes_cb) ( __u8 ⋆ buffer1, - size_t buffer1_len, - __u8 ⋆ buffer2, - size_t buffer2_len, - dmx_pes_filter_t⋆ source, - dmx_success_t success); - - /⋆--------------------------------------------------------------------------⋆/ - /⋆ DVB Front-End ⋆/ - /⋆--------------------------------------------------------------------------⋆/ - - typedef enum { - DMX_OTHER_FE = 0, - DMX_SATELLITE_FE, - DMX_CABLE_FE, - DMX_TERRESTRIAL_FE, - DMX_LVDS_FE, - DMX_ASI_FE, /⋆ DVB-ASI interface ⋆/ - DMX_MEMORY_FE - } dmx_frontend_source_t; - - typedef struct { - /⋆ The following char⋆ fields point to NULL terminated strings ⋆/ - char⋆ id; /⋆ Unique front-end identifier ⋆/ - char⋆ vendor; /⋆ Name of the front-end vendor ⋆/ - char⋆ model; /⋆ Name of the front-end model ⋆/ - struct list_head connectivity_list; /⋆ List of front-ends that can - be connected to a particular - demux ⋆/ - void⋆ priv; /⋆ Pointer to private data of the API client ⋆/ - dmx_frontend_source_t source; - } dmx_frontend_t; - - /⋆--------------------------------------------------------------------------⋆/ - /⋆ MPEG-2 TS Demux ⋆/ - /⋆--------------------------------------------------------------------------⋆/ - - /⋆ - ⋆ Flags OR'ed in the capabilites field of struct dmx_demux_s. - ⋆/ - - #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 - #define DMX_SECTION_PAYLOAD_DESCRAMBLING 64 - #define DMX_MAC_ADDRESS_DESCRAMBLING 128 - - -
-
-demux_demux_t - - /⋆ - ⋆ DMX_FE_ENTRY(): Casts elements in the list of registered - ⋆ front-ends from the generic type struct list_head - ⋆ to the type ⋆ dmx_frontend_t - ⋆. - ⋆/ - - #define DMX_FE_ENTRY(list) list_entry(list, dmx_frontend_t, connectivity_list) - - struct dmx_demux_s { - /⋆ The following char⋆ fields point to NULL terminated strings ⋆/ - char⋆ id; /⋆ Unique demux identifier ⋆/ - char⋆ vendor; /⋆ Name of the demux vendor ⋆/ - char⋆ model; /⋆ Name of the demux model ⋆/ - __u32 capabilities; /⋆ Bitfield of capability flags ⋆/ - dmx_frontend_t⋆ frontend; /⋆ Front-end connected to the demux ⋆/ - struct list_head reg_list; /⋆ List of registered demuxes ⋆/ - void⋆ priv; /⋆ Pointer to private data of the API client ⋆/ - int users; /⋆ Number of users ⋆/ - int (⋆open) (struct dmx_demux_s⋆ demux); - int (⋆close) (struct dmx_demux_s⋆ demux); - int (⋆write) (struct dmx_demux_s⋆ demux, const char⋆ buf, size_t count); - int (⋆allocate_ts_feed) (struct dmx_demux_s⋆ demux, - dmx_ts_feed_t⋆⋆ feed, - dmx_ts_cb callback); - int (⋆release_ts_feed) (struct dmx_demux_s⋆ demux, - dmx_ts_feed_t⋆ feed); - int (⋆allocate_pes_feed) (struct dmx_demux_s⋆ demux, - dmx_pes_feed_t⋆⋆ feed, - dmx_pes_cb callback); - int (⋆release_pes_feed) (struct dmx_demux_s⋆ demux, - dmx_pes_feed_t⋆ feed); - int (⋆allocate_section_feed) (struct dmx_demux_s⋆ demux, - dmx_section_feed_t⋆⋆ feed, - dmx_section_cb callback); - int (⋆release_section_feed) (struct dmx_demux_s⋆ demux, - dmx_section_feed_t⋆ feed); - int (⋆descramble_mac_address) (struct dmx_demux_s⋆ demux, - __u8⋆ buffer1, - size_t buffer1_length, - __u8⋆ buffer2, - size_t buffer2_length, - __u16 pid); - int (⋆descramble_section_payload) (struct dmx_demux_s⋆ demux, - __u8⋆ buffer1, - size_t buffer1_length, - __u8⋆ buffer2, size_t buffer2_length, - __u16 pid); - int (⋆add_frontend) (struct dmx_demux_s⋆ demux, - dmx_frontend_t⋆ frontend); - int (⋆remove_frontend) (struct dmx_demux_s⋆ demux, - dmx_frontend_t⋆ frontend); - struct list_head⋆ (⋆get_frontends) (struct dmx_demux_s⋆ demux); - int (⋆connect_frontend) (struct dmx_demux_s⋆ demux, - dmx_frontend_t⋆ frontend); - int (⋆disconnect_frontend) (struct dmx_demux_s⋆ demux); - - - /⋆ added because js cannot keep track of these himself ⋆/ - int (⋆get_pes_pids) (struct dmx_demux_s⋆ demux, __u16 ⋆pids); - }; - typedef struct dmx_demux_s dmx_demux_t; - - -
-
-Demux directory - - /⋆ - ⋆ DMX_DIR_ENTRY(): Casts elements in the list of registered - ⋆ demuxes from the generic type struct list_head⋆ to the type dmx_demux_t - ⋆. - ⋆/ - - #define DMX_DIR_ENTRY(list) list_entry(list, dmx_demux_t, reg_list) - - int dmx_register_demux (dmx_demux_t⋆ demux); - int dmx_unregister_demux (dmx_demux_t⋆ demux); - struct list_head⋆ dmx_get_demuxes (void); - -
-
-Demux Directory API -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. - -All demux drivers in the directory implement the abstract interface dmx_demux_t. - - -
dmx_register_demux() -DESCRIPTION - - -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(), - - -SYNOPSIS - - -int dmx_register_demux ( dmx_demux_t ⋆demux ) - - -PARAMETERS - - -dmx_demux_t* - demux - -Pointer to the demux structure. - - -RETURNS - - -0 - -The function was completed without errors. - - --EEXIST - -A demux with the same value of the id field already stored - in the directory. - - --ENOSPC - -No space left in the directory. - - - -
dmx_unregister_demux() -DESCRIPTION - - -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. - - -SYNOPSIS - - -int dmx_unregister_demux ( dmx_demux_t ⋆demux ) - - -PARAMETERS - - -dmx_demux_t* - demux - -Pointer to the demux structure which is to be - unregistered. - - -RETURNS - - -0 - -The function was completed without errors. - - -ENODEV - -The specified demux is not registered in the demux - directory. - - -EBUSY - -The specified demux is currently in use. - - - -
dmx_get_demuxes() -DESCRIPTION - - -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. - - -SYNOPSIS - - -struct list_head ⋆dmx_get_demuxes () - - -PARAMETERS - - -none - - -RETURNS - - -struct list_head * - -A list of demux interfaces, or NULL in the case of an - empty list. - - -
-
-Demux API -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. - -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. - -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 -“function not available”. - -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. - -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. - - - -
-open() -DESCRIPTION - - -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. - - -SYNOPSIS - - -int open ( demux_t⋆ demux ); - - -PARAMETERS - - -demux_t* demux - -Pointer to the demux API and instance data. - - -RETURNS - - -0 - -The function was completed without errors. - - --EUSERS - -Maximum usage count reached. - - --EINVAL - -Bad parameter. - - - -
-
-close() -DESCRIPTION - - -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. - - -SYNOPSIS - - -int close(demux_t⋆ demux); - - -PARAMETERS - - -demux_t* demux - -Pointer to the demux API and instance data. - - -RETURNS - - -0 - -The function was completed without errors. - - --ENODEV - -The demux was not in use. - - --EINVAL - -Bad parameter. - - - -
-
-write() -DESCRIPTION - - -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. - - -SYNOPSIS - - -int write(demux_t⋆ demux, const char⋆ buf, size_t - count); - - -PARAMETERS - - -demux_t* demux - -Pointer to the demux API and instance data. - - -const char* buf - -Pointer to the TS data in kernel-space memory. - - -size_t length - -Length of the TS data. - - -RETURNS - - -0 - -The function was completed without errors. - - --ENOSYS - -The command is not implemented. - - --EINVAL - -Bad parameter. - - - -
allocate_ts_feed() -DESCRIPTION - - -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. - - -SYNOPSIS - - -int allocate_ts_feed(dmx_demux_t⋆ demux, - dmx_ts_feed_t⋆⋆ feed, dmx_ts_cb callback); - - -PARAMETERS - - -demux_t* demux - -Pointer to the demux API and instance data. - - -dmx_ts_feed_t** - feed - -Pointer to the TS feed API and instance data. - - -dmx_ts_cb callback - -Pointer to the callback function for passing received TS - packet - - -RETURNS - - -0 - -The function was completed without errors. - - --EBUSY - -No more TS feeds available. - - --ENOSYS - -The command is not implemented. - - --EINVAL - -Bad parameter. - - - -
release_ts_feed() -DESCRIPTION - - -Releases the resources allocated with allocate_ts_feed(). Any filtering in - progress on the TS feed should be stopped before calling this function. - - -SYNOPSIS - - -int release_ts_feed(dmx_demux_t⋆ demux, - dmx_ts_feed_t⋆ feed); - - -PARAMETERS - - -demux_t* demux - -Pointer to the demux API and instance data. - - -dmx_ts_feed_t* feed - -Pointer to the TS feed API and instance data. - - -RETURNS - - -0 - -The function was completed without errors. - - --EINVAL - -Bad parameter. - - - -
allocate_section_feed() -DESCRIPTION - - -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. - - -SYNOPSIS - - -int allocate_section_feed(dmx_demux_t⋆ demux, - dmx_section_feed_t ⋆⋆feed, dmx_section_cb callback); - - -PARAMETERS - - -demux_t *demux - -Pointer to the demux API and instance data. - - -dmx_section_feed_t - **feed - -Pointer to the section feed API and instance data. - - -dmx_section_cb - callback - -Pointer to the callback function for passing received - sections. - - -RETURNS - - -0 - -The function was completed without errors. - - --EBUSY - -No more section feeds available. - - --ENOSYS - -The command is not implemented. - - --EINVAL - -Bad parameter. - - - -
release_section_feed() -DESCRIPTION - - -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. - - -SYNOPSIS - - -int release_section_feed(dmx_demux_t⋆ demux, - dmx_section_feed_t ⋆feed); - - -PARAMETERS - - -demux_t *demux - -Pointer to the demux API and instance data. - - -dmx_section_feed_t - *feed - -Pointer to the section feed API and instance data. - - -RETURNS - - -0 - -The function was completed without errors. - - --EINVAL - -Bad parameter. - - - -
descramble_mac_address() -DESCRIPTION - - -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. - - -SYNOPSIS - - -int descramble_mac_address(dmx_demux_t⋆ demux, __u8 - ⋆buffer1, size_t buffer1_length, __u8 ⋆buffer2, - size_t buffer2_length, __u16 pid); - - -PARAMETERS - - -dmx_demux_t - *demux - -Pointer to the demux API and instance data. - - -__u8 *buffer1 - -Pointer to the first byte of the section. - - -size_t buffer1_length - -Length of the section data, including headers and CRC, - in buffer1. - - -__u8* buffer2 - -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. - - -size_t buffer2_length - -Length of the section data, including headers and CRC, - in buffer2. - - -__u16 pid - -The PID on which the section was received. Useful - for obtaining the descrambling key, e.g. from a DVB - Common Access facility. - - -RETURNS - - -0 - -The function was completed without errors. - - --ENOSYS - -No descrambling facility available. - - --EINVAL - -Bad parameter. - - - -
descramble_section_payload() -DESCRIPTION - - -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 “plug-in” descrambling facility to a demux driver. - - -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. - - -SYNOPSIS - - -int descramble_section_payload(dmx_demux_t⋆ demux, - __u8 ⋆buffer1, size_t buffer1_length, __u8 ⋆buffer2, - size_t buffer2_length, __u16 pid); - - -PARAMETERS - - -dmx_demux_t - *demux - -Pointer to the demux API and instance data. - - -__u8 *buffer1 - -Pointer to the first byte of the section. - - -size_t buffer1_length - -Length of the section data, including headers and CRC, - in buffer1. - - -__u8 *buffer2 - -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. - - -size_t buffer2_length - -Length of the section data, including headers and CRC, - in buffer2. - - -__u16 pid - -The PID on which the section was received. Useful - for obtaining the descrambling key, e.g. from a DVB - Common Access facility. - - -RETURNS - - -0 - -The function was completed without errors. - - --ENOSYS - -No descrambling facility available. - - --EINVAL - -Bad parameter. - - - -
add_frontend() -DESCRIPTION - - -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(). - - -SYNOPSIS - - -int add_frontend(dmx_demux_t ⋆demux, dmx_frontend_t - ⋆frontend); - - -PARAMETERS - - -dmx_demux_t* - demux - -Pointer to the demux API and instance data. - - -dmx_frontend_t* - frontend - -Pointer to the front-end instance data. - - -RETURNS - - -0 - -The function was completed without errors. - - --EEXIST - -A front-end with the same value of the id field already - registered. - - --EINUSE - -The demux is in use. - - --ENOMEM - -No more front-ends can be added. - - --EINVAL - -Bad parameter. - - - -
remove_frontend() -DESCRIPTION - - -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. - - -SYNOPSIS - - -int remove_frontend(dmx_demux_t⋆ demux, - dmx_frontend_t⋆ frontend); - - -PARAMETERS - - -dmx_demux_t* - demux - -Pointer to the demux API and instance data. - - -dmx_frontend_t* - frontend - -Pointer to the front-end instance data. - - -RETURNS - - -0 - -The function was completed without errors. - - --EINVAL - -Bad parameter. - - --EBUSY - -The front-end is in use, i.e. a call to connect_frontend() - has not been followed by a call to disconnect_frontend(). - - - -
get_frontends() -DESCRIPTION - - -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 - dmx_frontend_t*. The caller must not free the memory of any of the elements - obtained via this function call. - - -SYNOPSIS - - -struct list_head⋆ get_frontends(dmx_demux_t⋆ demux); - - -PARAMETERS - - -dmx_demux_t* - demux - -Pointer to the demux API and instance data. - - -RETURNS - - -dmx_demux_t* - -A list of front-end interfaces, or NULL in the case of an - empty list. - - - -
connect_frontend() -DESCRIPTION - - -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(). - - -SYNOPSIS - - -int connect_frontend(dmx_demux_t⋆ demux, - dmx_frontend_t⋆ frontend); - - -PARAMETERS - - -dmx_demux_t* - demux - -Pointer to the demux API and instance data. - - -dmx_frontend_t* - frontend - -Pointer to the front-end instance data. - - -RETURNS - - -0 - -The function was completed without errors. - - --EINVAL - -Bad parameter. - - --EBUSY - -The front-end is in use. - - - -
disconnect_frontend() -DESCRIPTION - - -Disconnects the demux and a front-end previously connected by a - connect_frontend() call. - - -SYNOPSIS - - -int disconnect_frontend(dmx_demux_t⋆ demux); - - -PARAMETERS - - -dmx_demux_t* - demux - -Pointer to the demux API and instance data. - - -RETURNS - - -0 - -The function was completed without errors. - - --EINVAL - -Bad parameter. - - -
-
-Demux Callback API -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. - -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. - -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 “bottom half” mechanism or start a tasklet instead of making the callback -function call directly from a hardware interrupt. - - -
dmx_ts_cb() -DESCRIPTION - - -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. - - -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. - - -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. The error should be indicated to the - client on the next callback by setting the success parameter to the value of - DMX_OVERRUN_ERROR. - - -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—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. - - -SYNOPSIS - - -int dmx_ts_cb(__u8⋆ buffer1, size_t buffer1_length, - __u8⋆ buffer2, size_t buffer2_length, dmx_ts_feed_t⋆ - source, dmx_success_t success); - - -PARAMETERS - - -__u8* buffer1 - -Pointer to the start of the filtered TS packets. - - -size_t buffer1_length - -Length of the TS data in buffer1. - - -__u8* buffer2 - -Pointer to the tail of the filtered TS packets, or NULL. - - -size_t buffer2_length - -Length of the TS data in buffer2. - - -dmx_ts_feed_t* - source - -Indicates which TS feed is the source of the callback. - - -dmx_success_t - success - -Indicates if there was an error in TS reception. - - -RETURNS - - -0 - -Continue filtering. - - --1 - -Stop filtering - has the same effect as a call to - stop_filtering() on the TS Feed API. - - - -
dmx_section_cb() -DESCRIPTION - - -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. - - -SYNOPSIS - - -int dmx_section_cb(__u8⋆ buffer1, size_t - buffer1_length, __u8⋆ buffer2, size_t - buffer2_length, dmx_section_filter_t⋆ source, - dmx_success_t success); - - -PARAMETERS - - -__u8* buffer1 - -Pointer to the start of the filtered section, e.g. within the - circular buffer of the demux driver. - - -size_t buffer1_length - -Length of the filtered section data in buffer1, including - headers and CRC. - - -__u8* buffer2 - -Pointer to the tail of the filtered section data, or NULL. - Useful to handle the wrapping of a circular buffer. - - -size_t buffer2_length - -Length of the filtered section data in buffer2, including - headers and CRC. - - -dmx_section_filter_t* - filter - -Indicates the filter that triggered the callback. - - -dmx_success_t - success - -Indicates if there was an error in section reception. - - -RETURNS - - -0 - -Continue filtering. - - --1 - -Stop filtering - has the same effect as a call to - stop_filtering() on the Section Feed API. - - -
-
-TS Feed API -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. - -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. - - -
set() -DESCRIPTION - - -This function sets the parameters of a TS feed. Any filtering in progress on the - TS feed must be stopped before calling this function. - - -SYNOPSIS - - -int set ( dmx_ts_feed_t⋆ feed, __u16 pid, size_t - callback_length, size_t circular_buffer_size, int - descramble, struct timespec timeout); - - -PARAMETERS - - -dmx_ts_feed_t* feed - -Pointer to the TS feed API and instance data. - - -__u16 pid - -PID value to filter. Only the TS packets carrying the - specified PID will be passed to the API client. - - -size_t - callback_length - -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. - - -size_t - circular_buffer_size - -Size of the circular buffer for the filtered TS packets. - - -int descramble - -If non-zero, descramble the filtered TS packets. - - -struct timespec - timeout - -Maximum time to wait before delivering received TS - packets to the client. - - -RETURNS - - -0 - -The function was completed without errors. - - --ENOMEM - -Not enough memory for the requested buffer size. - - --ENOSYS - -No descrambling facility available for TS. - - --EINVAL - -Bad parameter. - - - -
start_filtering() -DESCRIPTION - - -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(). - - -SYNOPSIS - - -int start_filtering(dmx_ts_feed_t⋆ feed); - - -PARAMETERS - - -dmx_ts_feed_t* feed - -Pointer to the TS feed API and instance data. - - -RETURNS - - -0 - -The function was completed without errors. - - --EINVAL - -Bad parameter. - - - -
stop_filtering() -DESCRIPTION - - -Stops filtering TS packets on this TS feed. - - -SYNOPSIS - - -int stop_filtering(dmx_ts_feed_t⋆ feed); - - -PARAMETERS - - -dmx_ts_feed_t* feed - -Pointer to the TS feed API and instance data. - - -RETURNS - - -0 - -The function was completed without errors. - - --EINVAL - -Bad parameter. - - -
-
-Section Feed API -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. - -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. - - -
-
-set() -DESCRIPTION - - -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. - - -SYNOPSIS - - -int set(dmx_section_feed_t⋆ feed, __u16 pid, size_t - circular_buffer_size, int descramble, int - check_crc); - - -PARAMETERS - - -dmx_section_feed_t* - feed - -Pointer to the section feed API and instance data. - - -__u16 pid - -PID value to filter; only the TS packets carrying the - specified PID will be accepted. - - -size_t - circular_buffer_size - -Size of the circular buffer for filtered sections. - - -int descramble - -If non-zero, descramble any sections that are scrambled. - - -int check_crc - -If non-zero, check the CRC values of filtered sections. - - -RETURNS - - -0 - -The function was completed without errors. - - --ENOMEM - -Not enough memory for the requested buffer size. - - --ENOSYS - -No descrambling facility available for sections. - - --EINVAL - -Bad parameters. - - - -
allocate_filter() -DESCRIPTION - - -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. - - -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. - - -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 – thus this field is ignored, even though it is included in filter_value and - filter_mask fields. - - -SYNOPSIS - - -int allocate_filter(dmx_section_feed_t⋆ feed, - dmx_section_filter_t⋆⋆ filter); - - -PARAMETERS - - -dmx_section_feed_t* - feed - -Pointer to the section feed API and instance data. - - -dmx_section_filter_t** - filter - -Pointer to the allocated filter. - - -RETURNS - - -0 - -The function was completed without errors. - - --ENOSPC - -No filters of given type and length available. - - --EINVAL - -Bad parameters. - - - -
release_filter() -DESCRIPTION - - -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. - - -SYNOPSIS - - -int release_filter ( dmx_section_feed_t⋆ feed, - dmx_section_filter_t⋆ filter); - - -PARAMETERS - - -dmx_section_feed_t* - feed - -Pointer to the section feed API and instance data. - - -dmx_section_filter_t* - filter - -I/O Pointer to the instance data of a section filter. - - -RETURNS - - -0 - -The function was completed without errors. - - --ENODEV - -No such filter allocated. - - --EINVAL - -Bad parameter. - - - -
start_filtering() -DESCRIPTION - - -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(). - - -SYNOPSIS - - -int start_filtering ( dmx_section_feed_t⋆ feed ); - - -PARAMETERS - - -dmx_section_feed_t* - feed - -Pointer to the section feed API and instance data. - - -RETURNS - - -0 - -The function was completed without errors. - - --EINVAL - -Bad parameter. - - - -
stop_filtering() -DESCRIPTION - - -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. - - -SYNOPSIS - - -int stop_filtering ( dmx_section_feed_t⋆ feed ); - - -PARAMETERS - - -dmx_section_feed_t* - feed - -Pointer to the section feed API and instance data. - - -RETURNS - - -0 - -The function was completed without errors. - - --EINVAL - -Bad parameter. - - - -
diff --git a/Documentation/DocBook/dvb/net.xml b/Documentation/DocBook/dvb/net.xml deleted file mode 100644 index 94e388d94c0d..000000000000 --- a/Documentation/DocBook/dvb/net.xml +++ /dev/null @@ -1,12 +0,0 @@ -DVB Network API -The DVB net device enables feeding of MPE (multi protocol encapsulation) packets -received via DVB into the Linux network protocol stack, e.g. for internet via satellite -applications. It can be accessed through /dev/dvb/adapter0/net0. Data types and -and ioctl definitions can be accessed by including linux/dvb/net.h in your -application. - -
-DVB Net Data Types -To be written… - -
diff --git a/Documentation/DocBook/dvb/video.xml b/Documentation/DocBook/dvb/video.xml deleted file mode 100644 index 7bb287e67c8e..000000000000 --- a/Documentation/DocBook/dvb/video.xml +++ /dev/null @@ -1,1971 +0,0 @@ -DVB Video Device -The DVB video device controls the MPEG2 video decoder of the DVB hardware. It -can be accessed through /dev/dvb/adapter0/video0. Data types and and -ioctl definitions can be accessed by including linux/dvb/video.h in your -application. - -Note that the DVB video device only controls decoding of the MPEG video stream, not -its presentation on the TV or computer screen. On PCs this is typically handled by an -associated video4linux device, e.g. /dev/video, which allows scaling and defining output -windows. - -Some DVB cards don’t have their own MPEG decoder, which results in the omission of -the audio and video device as well as the video4linux device. - -The ioctls that deal with SPUs (sub picture units) and navigation packets are only -supported on some MPEG decoders made for DVD playback. - -
-Video Data Types - -
-video_format_t -The video_format_t data type defined by - - - typedef enum { - VIDEO_FORMAT_4_3, - VIDEO_FORMAT_16_9 - } video_format_t; - -is used in the VIDEO_SET_FORMAT function (??) to tell the driver which aspect ratio -the output hardware (e.g. TV) has. It is also used in the data structures video_status -(??) returned by VIDEO_GET_STATUS (??) and video_event (??) returned by -VIDEO_GET_EVENT (??) which report about the display format of the current video -stream. - -
- -
-video_display_format_t -In case the display format of the video stream and of the display hardware differ the -application has to specify how to handle the cropping of the picture. This can be done using -the VIDEO_SET_DISPLAY_FORMAT call (??) which accepts - - - typedef enum { - VIDEO_PAN_SCAN, - VIDEO_LETTER_BOX, - VIDEO_CENTER_CUT_OUT - } video_display_format_t; - -as argument. - -
- -
-video stream source -The video stream source is set through the VIDEO_SELECT_SOURCE call and can take -the following values, depending on whether we are replaying from an internal (demuxer) or -external (user write) source. - - - typedef enum { - VIDEO_SOURCE_DEMUX, - VIDEO_SOURCE_MEMORY - } video_stream_source_t; - -VIDEO_SOURCE_DEMUX selects the demultiplexer (fed either by the frontend or the -DVR device) as the source of the video stream. If VIDEO_SOURCE_MEMORY -is selected the stream comes from the application through the write() system -call. - -
- -
-video play state -The following values can be returned by the VIDEO_GET_STATUS call representing the -state of video playback. - - - typedef enum { - VIDEO_STOPPED, - VIDEO_PLAYING, - VIDEO_FREEZED - } video_play_state_t; - -
- -
-struct video_event -The following is the structure of a video event as it is returned by the VIDEO_GET_EVENT -call. - - - struct video_event { - int32_t type; - time_t timestamp; - union { - video_format_t video_format; - } u; - }; - -
- -
-struct video_status -The VIDEO_GET_STATUS call returns the following structure informing about various -states of the playback operation. - - - struct video_status { - boolean video_blank; - video_play_state_t play_state; - video_stream_source_t stream_source; - video_format_t video_format; - video_displayformat_t display_format; - }; - -If video_blank is set video will be blanked out if the channel is changed or if playback is -stopped. Otherwise, the last picture will be displayed. play_state indicates if the video is -currently frozen, stopped, or being played back. The stream_source corresponds to the seleted -source for the video stream. It can come either from the demultiplexer or from memory. -The video_format indicates the aspect ratio (one of 4:3 or 16:9) of the currently -played video stream. Finally, display_format corresponds to the selected cropping -mode in case the source video format is not the same as the format of the output -device. - -
- -
-struct video_still_picture -An I-frame displayed via the VIDEO_STILLPICTURE call is passed on within the -following structure. - - - /⋆ pointer to and size of a single iframe in memory ⋆/ - struct video_still_picture { - char ⋆iFrame; - int32_t size; - }; - -
- -
-video capabilities -A call to VIDEO_GET_CAPABILITIES returns an unsigned integer with the following -bits set according to the hardwares capabilities. - - - /⋆ bit definitions for capabilities: ⋆/ - /⋆ can the hardware decode MPEG1 and/or MPEG2? ⋆/ - #define VIDEO_CAP_MPEG1 1 - #define VIDEO_CAP_MPEG2 2 - /⋆ can you send a system and/or program stream to video device? - (you still have to open the video and the audio device but only - send the stream to the video device) ⋆/ - #define VIDEO_CAP_SYS 4 - #define VIDEO_CAP_PROG 8 - /⋆ can the driver also handle SPU, NAVI and CSS encoded data? - (CSS API is not present yet) ⋆/ - #define VIDEO_CAP_SPU 16 - #define VIDEO_CAP_NAVI 32 - #define VIDEO_CAP_CSS 64 - -
- -
-video system -A call to VIDEO_SET_SYSTEM sets the desired video system for TV output. The -following system types can be set: - - - typedef enum { - VIDEO_SYSTEM_PAL, - VIDEO_SYSTEM_NTSC, - VIDEO_SYSTEM_PALN, - VIDEO_SYSTEM_PALNc, - VIDEO_SYSTEM_PALM, - VIDEO_SYSTEM_NTSC60, - VIDEO_SYSTEM_PAL60, - VIDEO_SYSTEM_PALM60 - } video_system_t; - -
- -
-struct video_highlight -Calling the ioctl VIDEO_SET_HIGHLIGHTS posts the SPU highlight information. The -call expects the following format for that information: - - - typedef - struct video_highlight { - boolean active; /⋆ 1=show highlight, 0=hide highlight ⋆/ - uint8_t contrast1; /⋆ 7- 4 Pattern pixel contrast ⋆/ - /⋆ 3- 0 Background pixel contrast ⋆/ - uint8_t contrast2; /⋆ 7- 4 Emphasis pixel-2 contrast ⋆/ - /⋆ 3- 0 Emphasis pixel-1 contrast ⋆/ - uint8_t color1; /⋆ 7- 4 Pattern pixel color ⋆/ - /⋆ 3- 0 Background pixel color ⋆/ - uint8_t color2; /⋆ 7- 4 Emphasis pixel-2 color ⋆/ - /⋆ 3- 0 Emphasis pixel-1 color ⋆/ - uint32_t ypos; /⋆ 23-22 auto action mode ⋆/ - /⋆ 21-12 start y ⋆/ - /⋆ 9- 0 end y ⋆/ - uint32_t xpos; /⋆ 23-22 button color number ⋆/ - /⋆ 21-12 start x ⋆/ - /⋆ 9- 0 end x ⋆/ - } video_highlight_t; - - -
-
-video SPU -Calling VIDEO_SET_SPU deactivates or activates SPU decoding, according to the -following format: - - - typedef - struct video_spu { - boolean active; - int stream_id; - } video_spu_t; - - -
-
-video SPU palette -The following structure is used to set the SPU palette by calling VIDEO_SPU_PALETTE: - - - typedef - struct video_spu_palette{ - int length; - uint8_t ⋆palette; - } video_spu_palette_t; - - -
-
-video NAVI pack -In order to get the navigational data the following structure has to be passed to the ioctl -VIDEO_GET_NAVI: - - - typedef - struct video_navi_pack{ - int length; /⋆ 0 ... 1024 ⋆/ - uint8_t data[1024]; - } video_navi_pack_t; - -
- - -
-video attributes -The following attributes can be set by a call to VIDEO_SET_ATTRIBUTES: - - - typedef uint16_t video_attributes_t; - /⋆ bits: descr. ⋆/ - /⋆ 15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) ⋆/ - /⋆ 13-12 TV system (0=525/60, 1=625/50) ⋆/ - /⋆ 11-10 Aspect ratio (0=4:3, 3=16:9) ⋆/ - /⋆ 9- 8 permitted display mode on 4:3 monitor (0=both, 1=only pan-sca ⋆/ - /⋆ 7 line 21-1 data present in GOP (1=yes, 0=no) ⋆/ - /⋆ 6 line 21-2 data present in GOP (1=yes, 0=no) ⋆/ - /⋆ 5- 3 source resolution (0=720x480/576, 1=704x480/576, 2=352x480/57 ⋆/ - /⋆ 2 source letterboxed (1=yes, 0=no) ⋆/ - /⋆ 0 film/camera mode (0=camera, 1=film (625/50 only)) ⋆/ - -
- - -
-Video Function Calls - - -
-open() -DESCRIPTION - - -This system call opens a named video device (e.g. /dev/dvb/adapter0/video0) - for subsequent use. -When an open() call has succeeded, the device will be ready for use. - The significance of blocking or non-blocking mode is described in the - documentation for functions where there is a difference. It does not affect the - semantics of the open() call itself. A device opened in blocking mode can later - be put into non-blocking mode (and vice versa) using the F_SETFL command - of the fcntl system call. This is a standard system call, documented in the Linux - manual page for fcntl. Only one user can open the Video Device in O_RDWR - mode. All other attempts to open the device in this mode will fail, and an - error-code will be returned. If the Video Device is opened in O_RDONLY - mode, the only ioctl call that can be used is VIDEO_GET_STATUS. All other - call will return an error code. - - - -SYNOPSIS - - -int open(const char ⋆deviceName, int flags); - - -PARAMETERS - - -const char - *deviceName - -Name of specific video device. - - -int flags - -A bit-wise OR of the following flags: - - - -O_RDONLY read-only access - - - -O_RDWR read/write access - - - -O_NONBLOCK open in non-blocking mode - - - -(blocking mode is the default) - - -ERRORS - - -ENODEV - -Device driver not loaded/available. - - -EINTERNAL - -Internal error. - - -EBUSY - -Device or resource busy. - - -EINVAL - -Invalid argument. - - - -
-
-close() -DESCRIPTION - - -This system call closes a previously opened video device. - - -SYNOPSIS - - -int close(int fd); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - - -
-
-write() -DESCRIPTION - - -This system call can only be used if VIDEO_SOURCE_MEMORY is selected - in the ioctl call VIDEO_SELECT_SOURCE. The data provided shall be in - PES format, unless the capability allows other formats. If O_NONBLOCK is - not specified the function will block until buffer space is available. The amount - of data to be transferred is implied by count. - - -SYNOPSIS - - -size_t write(int fd, const void ⋆buf, size_t count); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -void *buf - -Pointer to the buffer containing the PES data. - - -size_t count - -Size of buf. - - -ERRORS - - -EPERM - -Mode VIDEO_SOURCE_MEMORY not selected. - - -ENOMEM - -Attempted to write more data than the internal buffer can - hold. - - -EBADF - -fd is not a valid open file descriptor. - - - -
VIDEO_STOP -DESCRIPTION - - -This ioctl call asks the Video Device to stop playing the current stream. - Depending on the input parameter, the screen can be blanked out or displaying - the last decoded frame. - - -SYNOPSIS - - -int ioctl(fd, int request = VIDEO_STOP, boolean - mode); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals VIDEO_STOP for this command. - - -Boolean mode - -Indicates how the screen shall be handled. - - - -TRUE: Blank screen when stop. - - - -FALSE: Show last decoded frame. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error, possibly in the communication with the - DVB subsystem. - - - -
VIDEO_PLAY -DESCRIPTION - - -This ioctl call asks the Video Device to start playing a video stream from the - selected source. - - -SYNOPSIS - - -int ioctl(fd, int request = VIDEO_PLAY); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals VIDEO_PLAY for this command. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error, possibly in the communication with the - DVB subsystem. - - - -
VIDEO_FREEZE -DESCRIPTION - - -This ioctl call suspends the live video stream being played. Decoding - and playing are frozen. It is then possible to restart the decoding - and playing process of the video stream using the VIDEO_CONTINUE - command. If VIDEO_SOURCE_MEMORY is selected in the ioctl call - VIDEO_SELECT_SOURCE, the DVB subsystem will not decode any more - data until the ioctl call VIDEO_CONTINUE or VIDEO_PLAY is performed. - - -SYNOPSIS - - -int ioctl(fd, int request = VIDEO_FREEZE); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals VIDEO_FREEZE for this command. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error, possibly in the communication with the - DVB subsystem. - - - -
VIDEO_CONTINUE -DESCRIPTION - - -This ioctl call restarts decoding and playing processes of the video stream - which was played before a call to VIDEO_FREEZE was made. - - -SYNOPSIS - - -int ioctl(fd, int request = VIDEO_CONTINUE); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals VIDEO_CONTINUE for this command. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error, possibly in the communication with the - DVB subsystem. - - - -
VIDEO_SELECT_SOURCE -DESCRIPTION - - -This ioctl call informs the video device which source shall be used for the input - data. The possible sources are demux or memory. If memory is selected, the - data is fed to the video device through the write command. - - -SYNOPSIS - - -int ioctl(fd, int request = VIDEO_SELECT_SOURCE, - video_stream_source_t source); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals VIDEO_SELECT_SOURCE for this command. - - -video_stream_source_t - source - -Indicates which source shall be used for the Video stream. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error, possibly in the communication with the - DVB subsystem. - - - -
VIDEO_SET_BLANK -DESCRIPTION - - -This ioctl call asks the Video Device to blank out the picture. - - -SYNOPSIS - - -int ioctl(fd, int request = VIDEO_SET_BLANK, boolean - mode); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals VIDEO_SET_BLANK for this command. - - -boolean mode - -TRUE: Blank screen when stop. - - - -FALSE: Show last decoded frame. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error, possibly in the communication with the - DVB subsystem. - - -EINVAL - -Illegal input parameter - - - -
VIDEO_GET_STATUS -DESCRIPTION - - -This ioctl call asks the Video Device to return the current status of the device. - - -SYNOPSIS - - - int ioctl(fd, int request = VIDEO_GET_STATUS, struct - video_status ⋆status); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals VIDEO_GET_STATUS for this command. - - -struct video_status - *status - -Returns the current status of the Video Device. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error, possibly in the communication with the - DVB subsystem. - - -EFAULT - -status points to invalid address - - - -
VIDEO_GET_EVENT -DESCRIPTION - - -This ioctl call returns an event of type video_event if available. If an event is - not available, the behavior depends on whether the device is in blocking or - non-blocking mode. In the latter case, the call fails immediately with errno - set to EWOULDBLOCK. In the former case, the call blocks until an event - becomes available. The standard Linux poll() and/or select() system calls can - be used with the device file descriptor to watch for new events. For select(), - the file descriptor should be included in the exceptfds argument, and for - poll(), POLLPRI should be specified as the wake-up condition. Read-only - permissions are sufficient for this ioctl call. - - -SYNOPSIS - - - int ioctl(fd, int request = VIDEO_GET_EVENT, struct - video_event ⋆ev); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals VIDEO_GET_EVENT for this command. - - -struct video_event - *ev - -Points to the location where the event, if any, is to be - stored. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EFAULT - -ev points to invalid address - - -EWOULDBLOCK - -There is no event pending, and the device is in - non-blocking mode. - - -EOVERFLOW - - - - -Overflow in event queue - one or more events were lost. - - - -
VIDEO_SET_DISPLAY_FORMAT -DESCRIPTION - - -This ioctl call asks the Video Device to select the video format to be applied - by the MPEG chip on the video. - - -SYNOPSIS - - - int ioctl(fd, int request = - VIDEO_SET_DISPLAY_FORMAT, video_display_format_t - format); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals VIDEO_SET_DISPLAY_FORMAT for this - command. - - -video_display_format_t - format - -Selects the video format to be used. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error. - - -EINVAL - -Illegal parameter format. - - - -
VIDEO_STILLPICTURE -DESCRIPTION - - -This ioctl call asks the Video Device to display a still picture (I-frame). The - input data shall contain an I-frame. If the pointer is NULL, then the current - displayed still picture is blanked. - - -SYNOPSIS - - -int ioctl(fd, int request = VIDEO_STILLPICTURE, - struct video_still_picture ⋆sp); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals VIDEO_STILLPICTURE for this command. - - -struct - video_still_picture - *sp - -Pointer to a location where an I-frame and size is stored. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error. - - -EFAULT - -sp points to an invalid iframe. - - - -
VIDEO_FAST_FORWARD -DESCRIPTION - - -This ioctl call asks the Video Device to skip decoding of N number of I-frames. - This call can only be used if VIDEO_SOURCE_MEMORY is selected. - - -SYNOPSIS - - -int ioctl(fd, int request = VIDEO_FAST_FORWARD, int - nFrames); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals VIDEO_FAST_FORWARD for this command. - - -int nFrames - -The number of frames to skip. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error. - - -EPERM - -Mode VIDEO_SOURCE_MEMORY not selected. - - -EINVAL - -Illegal parameter format. - - - -
VIDEO_SLOWMOTION -DESCRIPTION - - -This ioctl call asks the video device to repeat decoding frames N number of - times. This call can only be used if VIDEO_SOURCE_MEMORY is selected. - - -SYNOPSIS - - -int ioctl(fd, int request = VIDEO_SLOWMOTION, int - nFrames); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals VIDEO_SLOWMOTION for this command. - - -int nFrames - -The number of times to repeat each frame. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error. - - -EPERM - -Mode VIDEO_SOURCE_MEMORY not selected. - - -EINVAL - -Illegal parameter format. - - - -
VIDEO_GET_CAPABILITIES -DESCRIPTION - - -This ioctl call asks the video device about its decoding capabilities. On success - it returns and integer which has bits set according to the defines in section ??. - - -SYNOPSIS - - -int ioctl(fd, int request = VIDEO_GET_CAPABILITIES, - unsigned int ⋆cap); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals VIDEO_GET_CAPABILITIES for this - command. - - -unsigned int *cap - -Pointer to a location where to store the capability - information. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EFAULT - -cap points to an invalid iframe. - - - -
VIDEO_SET_ID -DESCRIPTION - - -This ioctl selects which sub-stream is to be decoded if a program or system - stream is sent to the video device. - - -SYNOPSIS - - -int ioctl(int fd, int request = VIDEO_SET_ID, int - id); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals VIDEO_SET_ID for this command. - - -int id - -video sub-stream id - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - -EINTERNAL - -Internal error. - - -EINVAL - -Invalid sub-stream id. - - - -
VIDEO_CLEAR_BUFFER -DESCRIPTION - - -This ioctl call clears all video buffers in the driver and in the decoder hardware. - - -SYNOPSIS - - -int ioctl(fd, int request = VIDEO_CLEAR_BUFFER); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals VIDEO_CLEAR_BUFFER for this command. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - - -
VIDEO_SET_STREAMTYPE -DESCRIPTION - - -This ioctl tells the driver which kind of stream to expect being written to it. If - this call is not used the default of video PES is used. Some drivers might not - support this call and always expect PES. - - -SYNOPSIS - - -int ioctl(fd, int request = VIDEO_SET_STREAMTYPE, - int type); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals VIDEO_SET_STREAMTYPE for this command. - - -int type - -stream type - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EINVAL - -type is not a valid or supported stream type. - - - -
VIDEO_SET_FORMAT -DESCRIPTION - - -This ioctl sets the screen format (aspect ratio) of the connected output device - (TV) so that the output of the decoder can be adjusted accordingly. - - -SYNOPSIS - - - int ioctl(fd, int request = VIDEO_SET_FORMAT, - video_format_t format); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals VIDEO_SET_FORMAT for this command. - - -video_format_t - format - -video format of TV as defined in section ??. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EINVAL - -format is not a valid video format. - - - -
VIDEO_SET_SYSTEM -DESCRIPTION - - -This ioctl sets the television output format. The format (see section ??) may - vary from the color format of the displayed MPEG stream. If the hardware is - not able to display the requested format the call will return an error. - - -SYNOPSIS - - - int ioctl(fd, int request = VIDEO_SET_SYSTEM , - video_system_t system); - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals VIDEO_SET_FORMAT for this command. - - -video_system_t - system - -video system of TV output. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EINVAL - -system is not a valid or supported video system. - - - -
VIDEO_SET_HIGHLIGHT -DESCRIPTION - - -This ioctl sets the SPU highlight information for the menu access of a DVD. - - -SYNOPSIS - - - int ioctl(fd, int request = VIDEO_SET_HIGHLIGHT - ,video_highlight_t ⋆vhilite) - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals VIDEO_SET_HIGHLIGHT for this command. - - -video_highlight_t - *vhilite - -SPU Highlight information according to section ??. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor. - - -EINVAL - -input is not a valid highlight setting. - - - -
VIDEO_SET_SPU -DESCRIPTION - - -This ioctl activates or deactivates SPU decoding in a DVD input stream. It can - only be used, if the driver is able to handle a DVD stream. - - -SYNOPSIS - - - int ioctl(fd, int request = VIDEO_SET_SPU , - video_spu_t ⋆spu) - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals VIDEO_SET_SPU for this command. - - -video_spu_t *spu - -SPU decoding (de)activation and subid setting according - to section ??. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EINVAL - -input is not a valid spu setting or driver cannot handle - SPU. - - - -
VIDEO_SET_SPU_PALETTE -DESCRIPTION - - -This ioctl sets the SPU color palette. - - -SYNOPSIS - - - int ioctl(fd, int request = VIDEO_SET_SPU_PALETTE - ,video_spu_palette_t ⋆palette ) - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals VIDEO_SET_SPU_PALETTE for this command. - - -video_spu_palette_t - *palette - -SPU palette according to section ??. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EINVAL - -input is not a valid palette or driver doesn’t handle SPU. - - - -
VIDEO_GET_NAVI -DESCRIPTION - - -This ioctl returns navigational information from the DVD stream. This is - especially needed if an encoded stream has to be decoded by the hardware. - - -SYNOPSIS - - - int ioctl(fd, int request = VIDEO_GET_NAVI , - video_navi_pack_t ⋆navipack) - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals VIDEO_GET_NAVI for this command. - - -video_navi_pack_t - *navipack - -PCI or DSI pack (private stream 2) according to section - ??. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EFAULT - -driver is not able to return navigational information - - - -
VIDEO_SET_ATTRIBUTES -DESCRIPTION - - -This ioctl is intended for DVD playback and allows you to set certain - information about the stream. Some hardware may not need this information, - but the call also tells the hardware to prepare for DVD playback. - - -SYNOPSIS - - - int ioctl(fd, int request = VIDEO_SET_ATTRIBUTE - ,video_attributes_t vattr) - - -PARAMETERS - - -int fd - -File descriptor returned by a previous call to open(). - - -int request - -Equals VIDEO_SET_ATTRIBUTE for this command. - - -video_attributes_t - vattr - -video attributes according to section ??. - - -ERRORS - - -EBADF - -fd is not a valid open file descriptor - - -EINVAL - -input is not a valid attribute setting. - - -
diff --git a/Documentation/DocBook/media-entities.tmpl b/Documentation/DocBook/media-entities.tmpl deleted file mode 100644 index e5fe09430fd9..000000000000 --- a/Documentation/DocBook/media-entities.tmpl +++ /dev/null @@ -1,464 +0,0 @@ - - - -close()"> -ioctl()"> -mmap()"> -munmap()"> -open()"> -poll()"> -read()"> -select()"> -write()"> - -close()"> -ioctl()"> -open()"> - - -VIDIOC_CROPCAP"> -VIDIOC_DBG_G_CHIP_IDENT"> -VIDIOC_DBG_G_REGISTER"> -VIDIOC_DBG_S_REGISTER"> -VIDIOC_DQBUF"> -VIDIOC_DQEVENT"> -VIDIOC_ENCODER_CMD"> -VIDIOC_ENUMAUDIO"> -VIDIOC_ENUMAUDOUT"> -VIDIOC_ENUMINPUT"> -VIDIOC_ENUMOUTPUT"> -VIDIOC_ENUMSTD"> -VIDIOC_ENUM_DV_PRESETS"> -VIDIOC_ENUM_FMT"> -VIDIOC_ENUM_FRAMEINTERVALS"> -VIDIOC_ENUM_FRAMESIZES"> -VIDIOC_G_AUDIO"> -VIDIOC_G_AUDOUT"> -VIDIOC_G_CROP"> -VIDIOC_G_CTRL"> -VIDIOC_G_DV_PRESET"> -VIDIOC_G_DV_TIMINGS"> -VIDIOC_G_ENC_INDEX"> -VIDIOC_G_EXT_CTRLS"> -VIDIOC_G_FBUF"> -VIDIOC_G_FMT"> -VIDIOC_G_FREQUENCY"> -VIDIOC_G_INPUT"> -VIDIOC_G_JPEGCOMP"> -VIDIOC_G_MPEGCOMP"> -VIDIOC_G_MODULATOR"> -VIDIOC_G_OUTPUT"> -VIDIOC_G_PARM"> -VIDIOC_G_PRIORITY"> -VIDIOC_G_SLICED_VBI_CAP"> -VIDIOC_G_STD"> -VIDIOC_G_TUNER"> -VIDIOC_LOG_STATUS"> -VIDIOC_OVERLAY"> -VIDIOC_QBUF"> -VIDIOC_QUERYBUF"> -VIDIOC_QUERYCAP"> -VIDIOC_QUERYCTRL"> -VIDIOC_QUERYMENU"> -VIDIOC_QUERYSTD"> -VIDIOC_QUERY_DV_PRESET"> -VIDIOC_REQBUFS"> -VIDIOC_STREAMOFF"> -VIDIOC_STREAMON"> -VIDIOC_SUBSCRIBE_EVENT"> -VIDIOC_S_AUDIO"> -VIDIOC_S_AUDOUT"> -VIDIOC_S_CROP"> -VIDIOC_S_CTRL"> -VIDIOC_S_DV_PRESET"> -VIDIOC_S_DV_TIMINGS"> -VIDIOC_S_EXT_CTRLS"> -VIDIOC_S_FBUF"> -VIDIOC_S_FMT"> -VIDIOC_S_FREQUENCY"> -VIDIOC_S_HW_FREQ_SEEK"> -VIDIOC_S_INPUT"> -VIDIOC_S_JPEGCOMP"> -VIDIOC_S_MPEGCOMP"> -VIDIOC_S_MODULATOR"> -VIDIOC_S_OUTPUT"> -VIDIOC_S_PARM"> -VIDIOC_S_PRIORITY"> -VIDIOC_S_STD"> -VIDIOC_S_TUNER"> -VIDIOC_SUBDEV_ENUM_FRAME_SIZE"> -VIDIOC_SUBDEV_ENUM_MBUS_CODE"> -VIDIOC_SUBDEV_G_CROP"> -VIDIOC_SUBDEV_G_FMT"> -VIDIOC_SUBDEV_G_FRAME_INTERVAL"> -VIDIOC_SUBDEV_S_CROP"> -VIDIOC_SUBDEV_S_FMT"> -VIDIOC_SUBDEV_S_FRAME_INTERVAL"> -VIDIOC_TRY_ENCODER_CMD"> -VIDIOC_TRY_EXT_CTRLS"> -VIDIOC_TRY_FMT"> -VIDIOC_UNSUBSCRIBE_EVENT"> - -MEDIA_IOC_DEVICE_INFO"> -MEDIA_IOC_ENUM_ENTITIES"> -MEDIA_IOC_ENUM_LINKS"> -MEDIA_IOC_SETUP_LINK"> - - -v4l2_std_id"> - - -v4l2_buf_type"> -v4l2_colorspace"> -v4l2_ctrl_type"> -v4l2_exposure_auto_type"> -v4l2_field"> -v4l2_frmivaltypes"> -v4l2_frmsizetypes"> -v4l2_mbus_pixelcode"> -v4l2_memory"> -v4l2_mpeg_audio_ac3_bitrate"> -v4l2_mpeg_audio_crc"> -v4l2_mpeg_audio_emphasis"> -v4l2_mpeg_audio_encoding"> -v4l2_mpeg_audio_l1_bitrate"> -v4l2_mpeg_audio_l2_bitrate"> -v4l2_mpeg_audio_l3_bitrate"> -v4l2_mpeg_audio_mode"> -v4l2_mpeg_audio_mode_extension"> -v4l2_mpeg_audio_sampling_freq"> -v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type"> -v4l2_mpeg_cx2341x_video_luma_spatial_filter_type"> -v4l2_mpeg_cx2341x_video_median_filter_type"> -v4l2_mpeg_cx2341x_video_spatial_filter_mode"> -v4l2_mpeg_cx2341x_video_temporal_filter_mode"> -v4l2_mpeg_stream_type"> -v4l2_mpeg_stream_vbi_fmt"> -v4l2_mpeg_video_aspect"> -v4l2_mpeg_video_bitrate_mode"> -v4l2_mpeg_video_encoding"> -v4l2_power_line_frequency"> -v4l2_priority"> -v4l2_subdev_format_whence"> -v4l2_tuner_type"> -v4l2_preemphasis"> - - -v4l2_audio"> -v4l2_audioout"> -v4l2_bt_timings"> -v4l2_buffer"> -v4l2_plane"> -v4l2_capability"> -v4l2_captureparm"> -v4l2_clip"> -v4l2_control"> -v4l2_crop"> -v4l2_cropcap"> -v4l2_dbg_chip_ident"> -v4l2_dbg_match"> -v4l2_dbg_register"> -v4l2_dv_enum_preset"> -v4l2_dv_preset"> -v4l2_dv_timings"> -v4l2_enc_idx"> -v4l2_enc_idx_entry"> -v4l2_encoder_cmd"> -v4l2_event"> -v4l2_event_subscription"> -v4l2_event_vsync"> -v4l2_ext_control"> -v4l2_ext_controls"> -v4l2_fmtdesc"> -v4l2_format"> -v4l2_fract"> -v4l2_framebuffer"> -v4l2_frequency"> -v4l2_frmival_stepwise"> -v4l2_frmivalenum"> -v4l2_frmsize_discrete"> -v4l2_frmsize_stepwise"> -v4l2_frmsizeenum"> -v4l2_hw_freq_seek"> -v4l2_input"> -v4l2_jpegcompression"> -v4l2_mbus_framefmt"> -v4l2_modulator"> -v4l2_mpeg_vbi_fmt_ivtv"> -v4l2_output"> -v4l2_outputparm"> -v4l2_pix_format"> -v4l2_pix_format_mplane"> -v4l2_plane_pix_format"> -v4l2_queryctrl"> -v4l2_querymenu"> -v4l2_rect"> -v4l2_requestbuffers"> -v4l2_sliced_vbi_cap"> -v4l2_sliced_vbi_data"> -v4l2_sliced_vbi_format"> -v4l2_subdev_frame_interval"> -v4l2_subdev_frame_interval_enum"> -v4l2_subdev_frame_size_enum"> -v4l2_subdev_crop"> -v4l2_subdev_format"> -v4l2_subdev_mbus_code_enum"> -v4l2_standard"> -v4l2_streamparm"> -v4l2_timecode"> -v4l2_tuner"> -v4l2_vbi_format"> -v4l2_window"> - -media_device_info"> -media_entity_desc"> -media_links_enum"> -media_pad_desc"> -media_link_desc"> - - -EACCES error code"> -EAGAIN error code"> -EBADF error code"> -EBUSY error code"> -EFAULT error code"> -EIO error code"> -EINTR error code"> -EINVAL error code"> -ENFILE error code"> -ENOMEM error code"> -ENOSPC error code"> -ENOTTY error code"> -ENXIO error code"> -EMFILE error code"> -EPERM error code"> -EPIPE error code"> -ERANGE error code"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Documentation/DocBook/media.tmpl b/Documentation/DocBook/media.tmpl deleted file mode 100644 index 88f2cc680cc2..000000000000 --- a/Documentation/DocBook/media.tmpl +++ /dev/null @@ -1,115 +0,0 @@ - - %media-entities; - - - - -open()."> -2C"> -Return ValueOn success 0 is returned, on error -1 and the errno variable is set appropriately:"> -2"> - - -"> -"> -"> - - -http://www.linuxtv.org/lists.php"> - - -http://linuxtv.org/repo/"> -]> - - - -LINUX MEDIA INFRASTRUCTURE API - - - 2009-2011 - LinuxTV Developers - - - - -Permission is granted to copy, distribute and/or modify -this document under the terms of the GNU Free Documentation License, -Version 1.1 or any later version published by the Free Software -Foundation. A copy of the license is included in the chapter entitled -"GNU Free Documentation License" - - - - - - - - Introduction - - This document covers the Linux Kernel to Userspace API's used by - video and radio straming devices, including video cameras, - analog and digital TV receiver cards, AM/FM receiver cards, - streaming capture devices. - It is divided into three parts. - The first part covers radio, capture, - cameras and analog TV devices. - The second part covers the - API used for digital TV and Internet reception via one of the - several digital tv standards. While it is called as DVB API, - in fact it covers several different video standards including - DVB-T, DVB-S, DVB-C and ATSC. The API is currently being updated - to documment support also for DVB-S2, ISDB-T and ISDB-S. - The third part covers Remote Controller API - For additional information and for the latest development code, - see: http://linuxtv.org. - For discussing improvements, reporting troubles, sending new drivers, etc, please mail to: Linux Media Mailing List (LMML).. - - - - -&sub-v4l2; - - -&sub-dvbapi; - - - - - -Mauro -Chehab -Carvalho -
mchehab@redhat.com
-Initial version. -
-
- - 2009-2011 - Mauro Carvalho Chehab - - - - - -1.0.0 -2009-09-06 -mcc -Initial revision - - -
- -Remote Controller API - -&sub-remote_controllers; - -
- -&sub-media-controller; - - -&sub-fdl-appendix; - -
diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile new file mode 100644 index 000000000000..baeea174fdc6 --- /dev/null +++ b/Documentation/DocBook/media/Makefile @@ -0,0 +1,259 @@ +### +# Media build rules - Auto-generates media contents/indexes and *.h xml's +# + +SHELL=/bin/bash + +MEDIA_OBJ_DIR=$(objtree)/Documentation/DocBook/ +MEDIA_SRC_DIR=$(srctree)/Documentation/DocBook/media + +MEDIA_TEMP = media-entities.tmpl \ + media-indices.tmpl \ + videodev2.h.xml \ + v4l2.xml \ + frontend.h.xml + +IMGFILES := $(addprefix $(MEDIA_OBJ_DIR)/media/, $(notdir $(shell ls $(MEDIA_SRC_DIR)/*/*.gif $(MEDIA_SRC_DIR)/*/*.png))) +GENFILES := $(addprefix $(MEDIA_OBJ_DIR)/, $(MEDIA_TEMP)) + +PHONY += cleanmediadocs mediaindexdocs + +cleanmediadocs: + -@rm `find $(MEDIA_OBJ_DIR) -type l` $(GENFILES) $(IMGFILES) + +$(obj)/media_api.xml: $(GENFILES) FORCE + +#$(MEDIA_OBJ_DIR)/media_api.html: $(MEDIA_OBJ_DIR)/media_api.xml +#$(MEDIA_OBJ_DIR)/media_api.pdf: $(MEDIA_OBJ_DIR)/media_api.xml +#$(MEDIA_OBJ_DIR)/media_api.ps: $(MEDIA_OBJ_DIR)/media_api.xml + +V4L_SGMLS = \ + $(shell ls $(MEDIA_SRC_DIR)/v4l/*.xml|perl -ne 'print "$$1 " if (m,.*/(.*)\n,)') \ + capture.c.xml \ + keytable.c.xml \ + v4l2grab.c.xml + +DVB_SGMLS = \ + $(shell ls $(MEDIA_SRC_DIR)/dvb/*.xml|perl -ne 'print "$$1 " if (m,.*/(.*)\n,)') + +MEDIA_SGMLS = $(addprefix ./,$(V4L_SGMLS)) $(addprefix ./,$(DVB_SGMLS)) $(addprefix ./,$(MEDIA_TEMP)) + +FUNCS = \ + close \ + ioctl \ + mmap \ + munmap \ + open \ + poll \ + read \ + select \ + write \ + +IOCTLS = \ + $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/videodev2.h) \ + $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/media.h) \ + $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/v4l2-subdev.h) \ + VIDIOC_SUBDEV_G_FRAME_INTERVAL \ + VIDIOC_SUBDEV_S_FRAME_INTERVAL \ + VIDIOC_SUBDEV_ENUM_MBUS_CODE \ + VIDIOC_SUBDEV_ENUM_FRAME_SIZE \ + VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL \ + +TYPES = \ + $(shell perl -ne 'print "$$1 " if /^typedef\s+[^\s]+\s+([^\s]+)\;/' $(srctree)/include/linux/videodev2.h) + +ENUMS = \ + $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/videodev2.h) \ + $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/media.h) \ + $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-mediabus.h) \ + $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-subdev.h) + +STRUCTS = \ + $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/videodev2.h) \ + $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/media.h) \ + $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-subdev.h) \ + $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-mediabus.h) + +ERRORS = \ + EACCES \ + EAGAIN \ + EBADF \ + EBUSY \ + EFAULT \ + EIO \ + EINTR \ + EINVAL \ + ENFILE \ + ENOMEM \ + ENOSPC \ + ENOTTY \ + ENXIO \ + EMFILE \ + EPERM \ + ERANGE \ + EPIPE \ + +ESCAPE = \ + -e "s/&/\\&/g" \ + -e "s//\\>/g" + +FILENAME = \ + -e s,"^[^\/]*/",, \ + -e s/"\\.xml"// \ + -e s/"\\.tmpl"// \ + -e s/\\\./-/g \ + -e s/"^func-"// \ + -e s/"^pixfmt-"// \ + -e s/"^vidioc-"// + +# Generate references to these structs in videodev2.h.xml. +DOCUMENTED = \ + -e "s/\(enum *\)v4l2_mpeg_cx2341x_video_\([a-z]*_spatial_filter_type\)/\1v4l2_mpeg_cx2341x_video_\2<\/link>/g" \ + -e "s/\(\(enum\|struct\) *\)\(v4l2_[a-zA-Z0-9_]*\)/\1\3<\/link>/g" \ + -e "s/\(V4L2_PIX_FMT_[A-Z0-9_]\+\) /\1<\/link> /g" \ + -e ":a;s/\(linkend=\".*\)_\(.*\">\)/\1-\2/;ta" \ + -e "s/v4l2\-mpeg\-vbi\-ITV0/v4l2-mpeg-vbi-itv0-1/g" + +DVB_DOCUMENTED = \ + -e "s,\(define \)\([A-Z0-9_]\+\)\(\s\+_IO\),\1\\2\<\/link\>\3,g" \ + -e "s/\(linkend\=\"\)FE_SET_PROPERTY/\1FE_GET_PROPERTY/g" + + +# +# Media targets and dependencies +# + +$(MEDIA_OBJ_DIR)/v4l2.xml: + @$($(quiet)gen_xml) + @(mkdir -p $(MEDIA_OBJ_DIR)/media) + @(cp $(MEDIA_SRC_DIR)/dvb/*.png $(MEDIA_SRC_DIR)/v4l/*.gif $(MEDIA_OBJ_DIR)/media/) + @(ln -sf $(MEDIA_SRC_DIR)/v4l/*xml $(MEDIA_OBJ_DIR)/) + @(ln -sf $(MEDIA_SRC_DIR)/dvb/*xml $(MEDIA_OBJ_DIR)/) + +$(MEDIA_OBJ_DIR)/videodev2.h.xml: $(srctree)/include/linux/videodev2.h $(MEDIA_OBJ_DIR)/v4l2.xml + @$($(quiet)gen_xml) + @( \ + echo "") > $@ + @( \ + expand --tabs=8 < $< | \ + sed $(ESCAPE) $(DOCUMENTED) | \ + sed 's/i\.e\./&ie;/') >> $@ + @( \ + echo "") >> $@ + +$(MEDIA_OBJ_DIR)/frontend.h.xml: $(srctree)/include/linux/dvb/frontend.h $(MEDIA_OBJ_DIR)/v4l2.xml + @$($(quiet)gen_xml) + @( \ + echo "") > $@ + @( \ + expand --tabs=8 < $< | \ + sed $(ESCAPE) $(DVB_DOCUMENTED) | \ + sed 's/i\.e\./&ie;/') >> $@ + @( \ + echo "") >> $@ + +$(MEDIA_OBJ_DIR)/media-entities.tmpl: $(MEDIA_OBJ_DIR)/v4l2.xml + @$($(quiet)gen_xml) + @( \ + echo "") >$@ + @( \ + echo -e "\n") >>$@ + @( \ + for ident in $(FUNCS) ; do \ + entity=`echo $$ident | tr _ -` ; \ + echo "$$ident()\">" \ + >>$@ ; \ + done) + @( \ + echo -e "\n") >>$@ + @( \ + for ident in $(IOCTLS) ; do \ + entity=`echo $$ident | tr _ -` ; \ + id=`grep "$$ident" $(MEDIA_OBJ_DIR)/vidioc-*.xml | sed -r s,"^.*/(.*).xml.*","\1",` ; \ + echo "$$ident\">" \ + >>$@ ; \ + done) + @( \ + echo -e "\n") >>$@ + @( \ + for ident in $(TYPES) ; do \ + entity=`echo $$ident | tr _ -` ; \ + echo "$$ident\">" >>$@ ; \ + done) + @( \ + echo -e "\n") >>$@ + @( \ + for ident in $(ENUMS) ; do \ + entity=`echo $$ident | sed -e "s/v4l2_mpeg_cx2341x_video_\([a-z]*_spatial_filter_type\)/\1/" | tr _ -` ; \ + echo "$$ident\">" >>$@ ; \ + done) + @( \ + echo -e "\n") >>$@ + @( \ + for ident in $(STRUCTS) ; do \ + entity=`echo $$ident | tr _ - | sed s/v4l2-mpeg-vbi-ITV0/v4l2-mpeg-vbi-itv0-1/g` ; \ + echo "$$ident\">" >>$@ ; \ + done) + @( \ + echo -e "\n") >>$@ + @( \ + for ident in $(ERRORS) ; do \ + echo "$$ident" \ + "error code\">" >>$@ ; \ + done) + @( \ + echo -e "\n") >>$@ + @( \ + for file in $(MEDIA_SGMLS) ; do \ + entity=`echo "$$file" | sed $(FILENAME) -e s/"^([^-]*)"/sub\1/` ; \ + if ! echo "$$file" | \ + grep -q -E -e '^(func|vidioc|pixfmt)-' ; then \ + echo "" >>$@ ; \ + fi ; \ + done) + @( \ + echo -e "\n") >>$@ + @( \ + for file in $(MEDIA_SGMLS) ; do \ + if echo "$$file" | \ + grep -q -E -e '(func|vidioc|pixfmt)-' ; then \ + entity=`echo "$$file" |sed $(FILENAME)` ; \ + echo "" >>$@ ; \ + fi ; \ + done) + +# Jade can auto-generate a list-of-tables, which includes all structs, +# but we only want data types, all types, and sorted please. +$(MEDIA_OBJ_DIR)/media-indices.tmpl: $(MEDIA_OBJ_DIR)/v4l2.xml + @$($(quiet)gen_xml) + @( \ + echo "") >$@ + @( \ + echo -e "\nList of Types") >>$@ + @( \ + for ident in $(TYPES) ; do \ + id=`echo $$ident | tr _ -` ; \ + echo "$$ident" >>$@ ; \ + done) + @( \ + for ident in $(ENUMS) ; do \ + id=`echo $$ident | sed -e "s/v4l2_mpeg_cx2341x_video_\([a-z]*_spatial_filter_type\)/\1/" | tr _ -`; \ + echo "enum $$ident" >>$@ ; \ + done) + @( \ + for ident in $(STRUCTS) ; do \ + id=`echo $$ident | tr _ - | sed s/v4l2-mpeg-vbi-ITV0/v4l2-mpeg-vbi-itv0-1/g` ; \ + echo "struct $$ident" >>$@ ; \ + done) + @( \ + echo "") >>$@ + diff --git a/Documentation/DocBook/media/dvb/.gitignore b/Documentation/DocBook/media/dvb/.gitignore new file mode 100644 index 000000000000..d7ec32eafac9 --- /dev/null +++ b/Documentation/DocBook/media/dvb/.gitignore @@ -0,0 +1 @@ +!*.xml diff --git a/Documentation/DocBook/media/dvb/audio.xml b/Documentation/DocBook/media/dvb/audio.xml new file mode 100644 index 000000000000..eeb96b8a0864 --- /dev/null +++ b/Documentation/DocBook/media/dvb/audio.xml @@ -0,0 +1,1473 @@ +DVB Audio Device +The DVB audio device controls the MPEG2 audio decoder of the DVB hardware. It +can be accessed through /dev/dvb/adapter0/audio0. Data types and and +ioctl definitions can be accessed by including linux/dvb/video.h in your +application. + +Please note that some DVB cards don’t have their own MPEG decoder, which results in +the omission of the audio and video device. + + +
+Audio Data Types +This section describes the structures, data types and defines used when talking to the +audio device. + + +
+audio_stream_source_t +The audio stream source is set through the AUDIO_SELECT_SOURCE call and can take +the following values, depending on whether we are replaying from an internal (demux) or +external (user write) source. + + + typedef enum { + AUDIO_SOURCE_DEMUX, + AUDIO_SOURCE_MEMORY + } audio_stream_source_t; + +AUDIO_SOURCE_DEMUX selects the demultiplexer (fed either by the frontend or the +DVR device) as the source of the video stream. If AUDIO_SOURCE_MEMORY +is selected the stream comes from the application through the write() system +call. + + +
+
+audio_play_state_t +The following values can be returned by the AUDIO_GET_STATUS call representing the +state of audio playback. + + + typedef enum { + AUDIO_STOPPED, + AUDIO_PLAYING, + AUDIO_PAUSED + } audio_play_state_t; + + +
+
+audio_channel_select_t +The audio channel selected via AUDIO_CHANNEL_SELECT is determined by the +following values. + + + typedef enum { + AUDIO_STEREO, + AUDIO_MONO_LEFT, + AUDIO_MONO_RIGHT, + } audio_channel_select_t; + + +
+
+struct audio_status +The AUDIO_GET_STATUS call returns the following structure informing about various +states of the playback operation. + + + typedef struct audio_status { + boolean AV_sync_state; + boolean mute_state; + audio_play_state_t play_state; + audio_stream_source_t stream_source; + audio_channel_select_t channel_select; + boolean bypass_mode; + } audio_status_t; + + +
+
+struct audio_mixer +The following structure is used by the AUDIO_SET_MIXER call to set the audio +volume. + + + typedef struct audio_mixer { + unsigned int volume_left; + unsigned int volume_right; + } audio_mixer_t; + + +
+
+audio encodings +A call to AUDIO_GET_CAPABILITIES returns an unsigned integer with the following +bits set according to the hardwares capabilities. + + + #define AUDIO_CAP_DTS 1 + #define AUDIO_CAP_LPCM 2 + #define AUDIO_CAP_MP1 4 + #define AUDIO_CAP_MP2 8 + #define AUDIO_CAP_MP3 16 + #define AUDIO_CAP_AAC 32 + #define AUDIO_CAP_OGG 64 + #define AUDIO_CAP_SDDS 128 + #define AUDIO_CAP_AC3 256 + + +
+
+struct audio_karaoke +The ioctl AUDIO_SET_KARAOKE uses the following format: + + + typedef + struct audio_karaoke{ + int vocal1; + int vocal2; + int melody; + } audio_karaoke_t; + +If Vocal1 or Vocal2 are non-zero, they get mixed into left and right t at 70% each. If both, +Vocal1 and Vocal2 are non-zero, Vocal1 gets mixed into the left channel and Vocal2 into the +right channel at 100% each. Ff Melody is non-zero, the melody channel gets mixed into left +and right. + + +
+
+audio attributes +The following attributes can be set by a call to AUDIO_SET_ATTRIBUTES: + + + typedef uint16_t audio_attributes_t; + /⋆ bits: descr. ⋆/ + /⋆ 15-13 audio coding mode (0=ac3, 2=mpeg1, 3=mpeg2ext, 4=LPCM, 6=DTS, ⋆/ + /⋆ 12 multichannel extension ⋆/ + /⋆ 11-10 audio type (0=not spec, 1=language included) ⋆/ + /⋆ 9- 8 audio application mode (0=not spec, 1=karaoke, 2=surround) ⋆/ + /⋆ 7- 6 Quantization / DRC (mpeg audio: 1=DRC exists)(lpcm: 0=16bit, ⋆/ + /⋆ 5- 4 Sample frequency fs (0=48kHz, 1=96kHz) ⋆/ + /⋆ 2- 0 number of audio channels (n+1 channels) ⋆/ + +
+
+Audio Function Calls + + +
+open() +DESCRIPTION + + +This system call opens a named audio device (e.g. /dev/dvb/adapter0/audio0) + for subsequent use. When an open() call has succeeded, the device will be ready + for use. The significance of blocking or non-blocking mode is described in the + documentation for functions where there is a difference. It does not affect the + semantics of the open() call itself. A device opened in blocking mode can later + be put into non-blocking mode (and vice versa) using the F_SETFL command + of the fcntl system call. This is a standard system call, documented in the Linux + manual page for fcntl. Only one user can open the Audio Device in O_RDWR + mode. All other attempts to open the device in this mode will fail, and an error + code will be returned. If the Audio Device is opened in O_RDONLY mode, the + only ioctl call that can be used is AUDIO_GET_STATUS. All other call will + return with an error code. + + +SYNOPSIS + + +int open(const char ⋆deviceName, int flags); + + +PARAMETERS + + +const char + *deviceName + +Name of specific audio device. + + +int flags + +A bit-wise OR of the following flags: + + + +O_RDONLY read-only access + + + +O_RDWR read/write access + + + +O_NONBLOCK open in non-blocking mode + + + +(blocking mode is the default) + + +ERRORS + + +ENODEV + +Device driver not loaded/available. + + +EINTERNAL + +Internal error. + + +EBUSY + +Device or resource busy. + + +EINVAL + +Invalid argument. + + + +
+
+close() +DESCRIPTION + + +This system call closes a previously opened audio device. + + +SYNOPSIS + + +int close(int fd); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + + +
+
+write() +DESCRIPTION + + +This system call can only be used if AUDIO_SOURCE_MEMORY is selected + in the ioctl call AUDIO_SELECT_SOURCE. The data provided shall be in + PES format. If O_NONBLOCK is not specified the function will block until + buffer space is available. The amount of data to be transferred is implied by + count. + + +SYNOPSIS + + +size_t write(int fd, const void ⋆buf, size_t count); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +void *buf + +Pointer to the buffer containing the PES data. + + +size_t count + +Size of buf. + + +ERRORS + + +EPERM + +Mode AUDIO_SOURCE_MEMORY not selected. + + +ENOMEM + +Attempted to write more data than the internal buffer can + hold. + + +EBADF + +fd is not a valid open file descriptor. + + + +
AUDIO_STOP +DESCRIPTION + + +This ioctl call asks the Audio Device to stop playing the current stream. + + +SYNOPSIS + + +int ioctl(int fd, int request = AUDIO_STOP); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals AUDIO_STOP for this command. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EINTERNAL + +Internal error. + + + +
AUDIO_PLAY +DESCRIPTION + + +This ioctl call asks the Audio Device to start playing an audio stream from the + selected source. + + +SYNOPSIS + + +int ioctl(int fd, int request = AUDIO_PLAY); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals AUDIO_PLAY for this command. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EINTERNAL + +Internal error. + + + +
AUDIO_PAUSE +DESCRIPTION + + +This ioctl call suspends the audio stream being played. Decoding and playing + are paused. It is then possible to restart again decoding and playing process of + the audio stream using AUDIO_CONTINUE command. + + +If AUDIO_SOURCE_MEMORY is selected in the ioctl call + AUDIO_SELECT_SOURCE, the DVB-subsystem will not decode (consume) + any more data until the ioctl call AUDIO_CONTINUE or AUDIO_PLAY is + performed. + + +SYNOPSIS + + +int ioctl(int fd, int request = AUDIO_PAUSE); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals AUDIO_PAUSE for this command. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + +EINTERNAL + +Internal error. + + + +
AUDIO_SELECT_SOURCE +DESCRIPTION + + +This ioctl call informs the audio device which source shall be used + for the input data. The possible sources are demux or memory. If + AUDIO_SOURCE_MEMORY is selected, the data is fed to the Audio Device + through the write command. + + +SYNOPSIS + + +int ioctl(int fd, int request = AUDIO_SELECT_SOURCE, + audio_stream_source_t source); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals AUDIO_SELECT_SOURCE for this command. + + +audio_stream_source_t + source + +Indicates the source that shall be used for the Audio + stream. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + +EINTERNAL + +Internal error. + + +EINVAL + +Illegal input parameter. + + + +
AUDIO_SET_MUTE +DESCRIPTION + + +This ioctl call asks the audio device to mute the stream that is currently being + played. + + +SYNOPSIS + + +int ioctl(int fd, int request = AUDIO_SET_MUTE, + boolean state); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals AUDIO_SET_MUTE for this command. + + +boolean state + +Indicates if audio device shall mute or not. + + + +TRUE Audio Mute + + + +FALSE Audio Un-mute + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + +EINTERNAL + +Internal error. + + +EINVAL + +Illegal input parameter. + + + +
AUDIO_SET_AV_SYNC +DESCRIPTION + + +This ioctl call asks the Audio Device to turn ON or OFF A/V synchronization. + + +SYNOPSIS + + +int ioctl(int fd, int request = AUDIO_SET_AV_SYNC, + boolean state); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals AUDIO_AV_SYNC for this command. + + +boolean state + +Tells the DVB subsystem if A/V synchronization shall be + ON or OFF. + + + +TRUE AV-sync ON + + + +FALSE AV-sync OFF + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + +EINTERNAL + +Internal error. + + +EINVAL + +Illegal input parameter. + + + +
AUDIO_SET_BYPASS_MODE +DESCRIPTION + + +This ioctl call asks the Audio Device to bypass the Audio decoder and forward + the stream without decoding. This mode shall be used if streams that can’t be + handled by the DVB system shall be decoded. Dolby DigitalTM streams are + automatically forwarded by the DVB subsystem if the hardware can handle it. + + +SYNOPSIS + + +int ioctl(int fd, int request = + AUDIO_SET_BYPASS_MODE, boolean mode); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals AUDIO_SET_BYPASS_MODE for this + command. + + +boolean mode + +Enables or disables the decoding of the current Audio + stream in the DVB subsystem. + + + +TRUE Bypass is disabled + + + +FALSE Bypass is enabled + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + +EINTERNAL + +Internal error. + + +EINVAL + +Illegal input parameter. + + + +
AUDIO_CHANNEL_SELECT +DESCRIPTION + + +This ioctl call asks the Audio Device to select the requested channel if possible. + + +SYNOPSIS + + +int ioctl(int fd, int request = + AUDIO_CHANNEL_SELECT, audio_channel_select_t); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals AUDIO_CHANNEL_SELECT for this + command. + + +audio_channel_select_t + ch + +Select the output format of the audio (mono left/right, + stereo). + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + +EINTERNAL + +Internal error. + + +EINVAL + +Illegal input parameter ch. + + + +
AUDIO_GET_STATUS +DESCRIPTION + + +This ioctl call asks the Audio Device to return the current state of the Audio + Device. + + +SYNOPSIS + + +int ioctl(int fd, int request = AUDIO_GET_STATUS, + struct audio_status ⋆status); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals AUDIO_GET_STATUS for this command. + + +struct audio_status + *status + +Returns the current state of Audio Device. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + +EINTERNAL + +Internal error. + + +EFAULT + +status points to invalid address. + + + +
AUDIO_GET_CAPABILITIES +DESCRIPTION + + +This ioctl call asks the Audio Device to tell us about the decoding capabilities + of the audio hardware. + + +SYNOPSIS + + +int ioctl(int fd, int request = + AUDIO_GET_CAPABILITIES, unsigned int ⋆cap); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals AUDIO_GET_CAPABILITIES for this + command. + + +unsigned int *cap + +Returns a bit array of supported sound formats. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + +EINTERNAL + +Internal error. + + +EFAULT + +cap points to an invalid address. + + + +
AUDIO_CLEAR_BUFFER +DESCRIPTION + + +This ioctl call asks the Audio Device to clear all software and hardware buffers + of the audio decoder device. + + +SYNOPSIS + + +int ioctl(int fd, int request = AUDIO_CLEAR_BUFFER); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals AUDIO_CLEAR_BUFFER for this command. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + +EINTERNAL + +Internal error. + + + +
AUDIO_SET_ID +DESCRIPTION + + +This ioctl selects which sub-stream is to be decoded if a program or system + stream is sent to the video device. If no audio stream type is set the id has to be + in [0xC0,0xDF] for MPEG sound, in [0x80,0x87] for AC3 and in [0xA0,0xA7] + for LPCM. More specifications may follow for other stream types. If the stream + type is set the id just specifies the substream id of the audio stream and only + the first 5 bits are recognized. + + +SYNOPSIS + + +int ioctl(int fd, int request = AUDIO_SET_ID, int + id); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals AUDIO_SET_ID for this command. + + +int id + +audio sub-stream id + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + +EINTERNAL + +Internal error. + + +EINVAL + +Invalid sub-stream id. + + + +
AUDIO_SET_MIXER +DESCRIPTION + + +This ioctl lets you adjust the mixer settings of the audio decoder. + + +SYNOPSIS + + +int ioctl(int fd, int request = AUDIO_SET_MIXER, + audio_mixer_t ⋆mix); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals AUDIO_SET_ID for this command. + + +audio_mixer_t *mix + +mixer settings. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + +EINTERNAL + +Internal error. + + +EFAULT + +mix points to an invalid address. + + + +
AUDIO_SET_STREAMTYPE +DESCRIPTION + + +This ioctl tells the driver which kind of audio stream to expect. This is useful + if the stream offers several audio sub-streams like LPCM and AC3. + + +SYNOPSIS + + +int ioctl(fd, int request = AUDIO_SET_STREAMTYPE, + int type); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals AUDIO_SET_STREAMTYPE for this + command. + + +int type + +stream type + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EINVAL + +type is not a valid or supported stream type. + + + +
AUDIO_SET_EXT_ID +DESCRIPTION + + +This ioctl can be used to set the extension id for MPEG streams in DVD + playback. Only the first 3 bits are recognized. + + +SYNOPSIS + + +int ioctl(fd, int request = AUDIO_SET_EXT_ID, int + id); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals AUDIO_SET_EXT_ID for this command. + + +int id + +audio sub_stream_id + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EINVAL + +id is not a valid id. + + + +
AUDIO_SET_ATTRIBUTES +DESCRIPTION + + +This ioctl is intended for DVD playback and allows you to set certain + information about the audio stream. + + +SYNOPSIS + + +int ioctl(fd, int request = AUDIO_SET_ATTRIBUTES, + audio_attributes_t attr ); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals AUDIO_SET_ATTRIBUTES for this command. + + +audio_attributes_t + attr + +audio attributes according to section ?? + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EINVAL + +attr is not a valid or supported attribute setting. + + + +
AUDIO_SET_KARAOKE +DESCRIPTION + + +This ioctl allows one to set the mixer settings for a karaoke DVD. + + +SYNOPSIS + + +int ioctl(fd, int request = AUDIO_SET_STREAMTYPE, + audio_karaoke_t ⋆karaoke); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals AUDIO_SET_STREAMTYPE for this + command. + + +audio_karaoke_t + *karaoke + +karaoke settings according to section ??. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EINVAL + +karaoke is not a valid or supported karaoke setting. + + +
+
diff --git a/Documentation/DocBook/media/dvb/ca.xml b/Documentation/DocBook/media/dvb/ca.xml new file mode 100644 index 000000000000..b1f1d2fad654 --- /dev/null +++ b/Documentation/DocBook/media/dvb/ca.xml @@ -0,0 +1,221 @@ +DVB CA Device +The DVB CA device controls the conditional access hardware. It can be accessed through +/dev/dvb/adapter0/ca0. Data types and and ioctl definitions can be accessed by +including linux/dvb/ca.h in your application. + + +
+CA Data Types + + +
+ca_slot_info_t + + /⋆ slot interface types and info ⋆/ + + typedef struct ca_slot_info_s { + int num; /⋆ slot number ⋆/ + + int type; /⋆ CA interface this slot supports ⋆/ + #define CA_CI 1 /⋆ CI high level interface ⋆/ + #define CA_CI_LINK 2 /⋆ CI link layer level interface ⋆/ + #define CA_CI_PHYS 4 /⋆ CI physical layer level interface ⋆/ + #define CA_SC 128 /⋆ simple smart card interface ⋆/ + + unsigned int flags; + #define CA_CI_MODULE_PRESENT 1 /⋆ module (or card) inserted ⋆/ + #define CA_CI_MODULE_READY 2 + } ca_slot_info_t; + + +
+
+ca_descr_info_t + + typedef struct ca_descr_info_s { + unsigned int num; /⋆ number of available descramblers (keys) ⋆/ + unsigned int type; /⋆ type of supported scrambling system ⋆/ + #define CA_ECD 1 + #define CA_NDS 2 + #define CA_DSS 4 + } ca_descr_info_t; + + +
+
+ca_cap_t + + typedef struct ca_cap_s { + unsigned int slot_num; /⋆ total number of CA card and module slots ⋆/ + unsigned int slot_type; /⋆ OR of all supported types ⋆/ + unsigned int descr_num; /⋆ total number of descrambler slots (keys) ⋆/ + unsigned int descr_type;/⋆ OR of all supported types ⋆/ + } ca_cap_t; + + +
+
+ca_msg_t + + /⋆ a message to/from a CI-CAM ⋆/ + typedef struct ca_msg_s { + unsigned int index; + unsigned int type; + unsigned int length; + unsigned char msg[256]; + } ca_msg_t; + + +
+
+ca_descr_t + + typedef struct ca_descr_s { + unsigned int index; + unsigned int parity; + unsigned char cw[8]; + } ca_descr_t; + +
+
+CA Function Calls + + +
+open() +DESCRIPTION + + +This system call opens a named ca device (e.g. /dev/ost/ca) for subsequent use. +When an open() call has succeeded, the device will be ready for use. + The significance of blocking or non-blocking mode is described in the + documentation for functions where there is a difference. It does not affect the + semantics of the open() call itself. A device opened in blocking mode can later + be put into non-blocking mode (and vice versa) using the F_SETFL command + of the fcntl system call. This is a standard system call, documented in the Linux + manual page for fcntl. Only one user can open the CA Device in O_RDWR + mode. All other attempts to open the device in this mode will fail, and an error + code will be returned. + + +SYNOPSIS + + +int open(const char ⋆deviceName, int flags); + + +PARAMETERS + + +const char + *deviceName + +Name of specific video device. + + +int flags + +A bit-wise OR of the following flags: + + + +O_RDONLY read-only access + + + +O_RDWR read/write access + + + +O_NONBLOCK open in non-blocking mode + + + +(blocking mode is the default) + + +ERRORS + + +ENODEV + +Device driver not loaded/available. + + +EINTERNAL + +Internal error. + + +EBUSY + +Device or resource busy. + + +EINVAL + +Invalid argument. + + + +
+
+close() +DESCRIPTION + + +This system call closes a previously opened audio device. + + +SYNOPSIS + + +int close(int fd); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + +
+
diff --git a/Documentation/DocBook/media/dvb/demux.xml b/Documentation/DocBook/media/dvb/demux.xml new file mode 100644 index 000000000000..1b8c4e9835b9 --- /dev/null +++ b/Documentation/DocBook/media/dvb/demux.xml @@ -0,0 +1,973 @@ +DVB Demux Device + +The DVB demux device controls the filters of the DVB hardware/software. It can be +accessed through /dev/adapter0/demux0. Data types and and ioctl definitions can be +accessed by including linux/dvb/dmx.h in your application. + +
+Demux Data Types + +
+dmx_output_t + + typedef enum + { + DMX_OUT_DECODER, + DMX_OUT_TAP, + DMX_OUT_TS_TAP + } dmx_output_t; + +DMX_OUT_TAP delivers the stream output to the demux device on which the ioctl is +called. + +DMX_OUT_TS_TAP routes output to the logical DVR device /dev/dvb/adapter0/dvr0, +which delivers a TS multiplexed from all filters for which DMX_OUT_TS_TAP was +specified. + +
+ +
+dmx_input_t + + typedef enum + { + DMX_IN_FRONTEND, + DMX_IN_DVR + } dmx_input_t; + +
+ +
+dmx_pes_type_t + + typedef enum + { + DMX_PES_AUDIO, + DMX_PES_VIDEO, + DMX_PES_TELETEXT, + DMX_PES_SUBTITLE, + DMX_PES_PCR, + DMX_PES_OTHER + } dmx_pes_type_t; + +
+ +
+dmx_event_t + + typedef enum + { + DMX_SCRAMBLING_EV, + DMX_FRONTEND_EV + } dmx_event_t; + +
+ +
+dmx_scrambling_status_t + + typedef enum + { + DMX_SCRAMBLING_OFF, + DMX_SCRAMBLING_ON + } dmx_scrambling_status_t; + +
+ +
+struct dmx_filter + + typedef struct dmx_filter + { + uint8_t filter[DMX_FILTER_SIZE]; + uint8_t mask[DMX_FILTER_SIZE]; + } dmx_filter_t; + +
+ +
+struct dmx_sct_filter_params + + struct dmx_sct_filter_params + { + uint16_t pid; + dmx_filter_t filter; + uint32_t timeout; + uint32_t flags; + #define DMX_CHECK_CRC 1 + #define DMX_ONESHOT 2 + #define DMX_IMMEDIATE_START 4 + }; + +
+ +
+struct dmx_pes_filter_params + + struct dmx_pes_filter_params + { + uint16_t pid; + dmx_input_t input; + dmx_output_t output; + dmx_pes_type_t pes_type; + uint32_t flags; + }; + +
+ +
+struct dmx_event + + struct dmx_event + { + dmx_event_t event; + time_t timeStamp; + union + { + dmx_scrambling_status_t scrambling; + } u; + }; + +
+ +
+struct dmx_stc + + struct dmx_stc { + unsigned int num; /⋆ input : which STC? 0..N ⋆/ + unsigned int base; /⋆ output: divisor for stc to get 90 kHz clock ⋆/ + uint64_t stc; /⋆ output: stc in 'base'⋆90 kHz units ⋆/ + }; + +
+ +
+ +
+Demux Function Calls + +
+open() +DESCRIPTION + + +This system call, used with a device name of /dev/dvb/adapter0/demux0, + allocates a new filter and returns a handle which can be used for subsequent + control of that filter. This call has to be made for each filter to be used, i.e. every + returned file descriptor is a reference to a single filter. /dev/dvb/adapter0/dvr0 + is a logical device to be used for retrieving Transport Streams for digital + video recording. When reading from this device a transport stream containing + the packets from all PES filters set in the corresponding demux device + (/dev/dvb/adapter0/demux0) having the output set to DMX_OUT_TS_TAP. A + recorded Transport Stream is replayed by writing to this device. +The significance of blocking or non-blocking mode is described in the + documentation for functions where there is a difference. It does not affect the + semantics of the open() call itself. A device opened in blocking mode can later + be put into non-blocking mode (and vice versa) using the F_SETFL command + of the fcntl system call. + + +SYNOPSIS + + +int open(const char ⋆deviceName, int flags); + + +PARAMETERS + + +const char + *deviceName + +Name of demux device. + + +int flags + +A bit-wise OR of the following flags: + + + +O_RDWR read/write access + + + +O_NONBLOCK open in non-blocking mode + + + +(blocking mode is the default) + + +ERRORS + + +ENODEV + +Device driver not loaded/available. + + +EINVAL + +Invalid argument. + + +EMFILE + +“Too many open files”, i.e. no more filters available. + + +ENOMEM + +The driver failed to allocate enough memory. + + +
+ +
+close() +DESCRIPTION + + +This system call deactivates and deallocates a filter that was previously + allocated via the open() call. + + +SYNOPSIS + + +int close(int fd); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + +
+ +
+read() +DESCRIPTION + + +This system call returns filtered data, which might be section or PES data. The + filtered data is transferred from the driver’s internal circular buffer to buf. The + maximum amount of data to be transferred is implied by count. + + +When returning section data the driver always tries to return a complete single + section (even though buf would provide buffer space for more data). If the size + of the buffer is smaller than the section as much as possible will be returned, + and the remaining data will be provided in subsequent calls. + + +The size of the internal buffer is 2 * 4096 bytes (the size of two maximum + sized sections) by default. The size of this buffer may be changed by using the + DMX_SET_BUFFER_SIZE function. If the buffer is not large enough, or if + the read operations are not performed fast enough, this may result in a buffer + overflow error. In this case EOVERFLOW will be returned, and the circular + buffer will be emptied. This call is blocking if there is no data to return, i.e. the + process will be put to sleep waiting for data, unless the O_NONBLOCK flag + is specified. + + +Note that in order to be able to read, the filtering process has to be started + by defining either a section or a PES filter by means of the ioctl functions, + and then starting the filtering process via the DMX_START ioctl function + or by setting the DMX_IMMEDIATE_START flag. If the reading is done + from a logical DVR demux device, the data will constitute a Transport Stream + including the packets from all PES filters in the corresponding demux device + /dev/dvb/adapter0/demux0 having the output set to DMX_OUT_TS_TAP. + + +SYNOPSIS + + +size_t read(int fd, void ⋆buf, size_t count); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +void *buf + +Pointer to the buffer to be used for returned filtered data. + + +size_t count + +Size of buf. + + +ERRORS + + +EWOULDBLOCK + +No data to return and O_NONBLOCK was specified. + + +EBADF + +fd is not a valid open file descriptor. + + +ECRC + +Last section had a CRC error - no data returned. The + buffer is flushed. + + +EOVERFLOW + + + + +The filtered data was not read from the buffer in due + time, resulting in non-read data being lost. The buffer is + flushed. + + +ETIMEDOUT + +The section was not loaded within the stated timeout + period. See ioctl DMX_SET_FILTER for how to set a + timeout. + + +EFAULT + +The driver failed to write to the callers buffer due to an + invalid *buf pointer. + + +
+ +
+write() +DESCRIPTION + + +This system call is only provided by the logical device /dev/dvb/adapter0/dvr0, + associated with the physical demux device that provides the actual DVR + functionality. It is used for replay of a digitally recorded Transport Stream. + Matching filters have to be defined in the corresponding physical demux + device, /dev/dvb/adapter0/demux0. The amount of data to be transferred is + implied by count. + + +SYNOPSIS + + +ssize_t write(int fd, const void ⋆buf, size_t + count); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +void *buf + +Pointer to the buffer containing the Transport Stream. + + +size_t count + +Size of buf. + + +ERRORS + + +EWOULDBLOCK + +No data was written. This + might happen if O_NONBLOCK was specified and there + is no more buffer space available (if O_NONBLOCK is + not specified the function will block until buffer space is + available). + + +EBUSY + +This error code indicates that there are conflicting + requests. The corresponding demux device is setup to + receive data from the front- end. Make sure that these + filters are stopped and that the filters with input set to + DMX_IN_DVR are started. + + +EBADF + +fd is not a valid open file descriptor. + + +
+ +
+DMX_START +DESCRIPTION + + +This ioctl call is used to start the actual filtering operation defined via the ioctl + calls DMX_SET_FILTER or DMX_SET_PES_FILTER. + + +SYNOPSIS + + +int ioctl( int fd, int request = DMX_START); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals DMX_START for this command. + + +ERRORS + + +EBADF + +fd is not a valid file descriptor. + + +EINVAL + +Invalid argument, i.e. no filtering parameters provided via + the DMX_SET_FILTER or DMX_SET_PES_FILTER + functions. + + +EBUSY + +This error code indicates that there are conflicting + requests. There are active filters filtering data from + another input source. Make sure that these filters are + stopped before starting this filter. + + +
+ +
+DMX_STOP +DESCRIPTION + + +This ioctl call is used to stop the actual filtering operation defined via the + ioctl calls DMX_SET_FILTER or DMX_SET_PES_FILTER and started via + the DMX_START command. + + +SYNOPSIS + + +int ioctl( int fd, int request = DMX_STOP); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals DMX_STOP for this command. + + +ERRORS + + +EBADF + +fd is not a valid file descriptor. + + +
+ +
+DMX_SET_FILTER +DESCRIPTION + + +This ioctl call sets up a filter according to the filter and mask parameters + provided. A timeout may be defined stating number of seconds to wait for a + section to be loaded. A value of 0 means that no timeout should be applied. + Finally there is a flag field where it is possible to state whether a section should + be CRC-checked, whether the filter should be a ”one-shot” filter, i.e. if the + filtering operation should be stopped after the first section is received, and + whether the filtering operation should be started immediately (without waiting + for a DMX_START ioctl call). If a filter was previously set-up, this filter will + be canceled, and the receive buffer will be flushed. + + +SYNOPSIS + + +int ioctl( int fd, int request = DMX_SET_FILTER, + struct dmx_sct_filter_params ⋆params); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals DMX_SET_FILTER for this command. + + +struct + dmx_sct_filter_params + *params + +Pointer to structure containing filter parameters. + + +ERRORS + + +EBADF + +fd is not a valid file descriptor. + + +EINVAL + +Invalid argument. + + +
+ +
+DMX_SET_PES_FILTER +DESCRIPTION + + +This ioctl call sets up a PES filter according to the parameters provided. By a + PES filter is meant a filter that is based just on the packet identifier (PID), i.e. + no PES header or payload filtering capability is supported. + + +The transport stream destination for the filtered output may be set. Also the + PES type may be stated in order to be able to e.g. direct a video stream directly + to the video decoder. Finally there is a flag field where it is possible to state + whether the filtering operation should be started immediately (without waiting + for a DMX_START ioctl call). If a filter was previously set-up, this filter will + be cancelled, and the receive buffer will be flushed. + + +SYNOPSIS + + +int ioctl( int fd, int request = DMX_SET_PES_FILTER, + struct dmx_pes_filter_params ⋆params); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals DMX_SET_PES_FILTER for this command. + + +struct + dmx_pes_filter_params + *params + +Pointer to structure containing filter parameters. + + +ERRORS + + +EBADF + +fd is not a valid file descriptor. + + +EINVAL + +Invalid argument. + + +EBUSY + +This error code indicates that there are conflicting + requests. There are active filters filtering data from + another input source. Make sure that these filters are + stopped before starting this filter. + + +
+ +
+DMX_SET_BUFFER_SIZE +DESCRIPTION + + +This ioctl call is used to set the size of the circular buffer used for filtered data. + The default size is two maximum sized sections, i.e. if this function is not called + a buffer size of 2 * 4096 bytes will be used. + + +SYNOPSIS + + +int ioctl( int fd, int request = + DMX_SET_BUFFER_SIZE, unsigned long size); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals DMX_SET_BUFFER_SIZE for this command. + + +unsigned long size + +Size of circular buffer. + + +ERRORS + + +EBADF + +fd is not a valid file descriptor. + + +ENOMEM + +The driver was not able to allocate a buffer of the + requested size. + + +
+ +
+DMX_GET_EVENT +DESCRIPTION + + +This ioctl call returns an event if available. If an event is not available, + the behavior depends on whether the device is in blocking or non-blocking + mode. In the latter case, the call fails immediately with errno set to + EWOULDBLOCK. In the former case, the call blocks until an event becomes + available. + + +The standard Linux poll() and/or select() system calls can be used with the + device file descriptor to watch for new events. For select(), the file descriptor + should be included in the exceptfds argument, and for poll(), POLLPRI should + be specified as the wake-up condition. Only the latest event for each filter is + saved. + + +SYNOPSIS + + +int ioctl( int fd, int request = DMX_GET_EVENT, + struct dmx_event ⋆ev); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals DMX_GET_EVENT for this command. + + +struct dmx_event *ev + +Pointer to the location where the event is to be stored. + + +ERRORS + + +EBADF + +fd is not a valid file descriptor. + + +EFAULT + +ev points to an invalid address. + + +EWOULDBLOCK + +There is no event pending, and the device is in + non-blocking mode. + + +
+ +
+DMX_GET_STC +DESCRIPTION + + +This ioctl call returns the current value of the system time counter (which is driven + by a PES filter of type DMX_PES_PCR). Some hardware supports more than one + STC, so you must specify which one by setting the num field of stc before the ioctl + (range 0...n). The result is returned in form of a ratio with a 64 bit numerator + and a 32 bit denominator, so the real 90kHz STC value is stc->stc / + stc->base + . + + +SYNOPSIS + + +int ioctl( int fd, int request = DMX_GET_STC, struct + dmx_stc ⋆stc); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals DMX_GET_STC for this command. + + +struct dmx_stc *stc + +Pointer to the location where the stc is to be stored. + + +ERRORS + + +EBADF + +fd is not a valid file descriptor. + + +EFAULT + +stc points to an invalid address. + + +EINVAL + +Invalid stc number. + + +
diff --git a/Documentation/DocBook/media/dvb/dvbapi.xml b/Documentation/DocBook/media/dvb/dvbapi.xml new file mode 100644 index 000000000000..9fad86ce7f5e --- /dev/null +++ b/Documentation/DocBook/media/dvb/dvbapi.xml @@ -0,0 +1,121 @@ + + + +Ralph +Metzler +J. K. +
rjkm@metzlerbros.de
+
+ +Marcus +Metzler +O. C. +
rjkm@metzlerbros.de
+
+
+ + +Mauro +Carvalho +Chehab +
mchehab@redhat.com
+Ported document to Docbook XML. +
+
+ + 2002 + 2003 + Convergence GmbH + + + 2009-2011 + Mauro Carvalho Chehab + + + + + + 2.0.4 + 2011-05-06 + mcc + + Add more information about DVB APIv5, better describing the frontend GET/SET props ioctl's. + + + + 2.0.3 + 2010-07-03 + mcc + + Add some frontend capabilities flags, present on kernel, but missing at the specs. + + + + 2.0.2 + 2009-10-25 + mcc + + documents FE_SET_FRONTEND_TUNE_MODE and FE_DISHETWORK_SEND_LEGACY_CMD ioctls. + + + +2.0.1 +2009-09-16 +mcc + +Added ISDB-T test originally written by Patrick Boettcher + + + +2.0.0 +2009-09-06 +mcc +Conversion from LaTex to DocBook XML. The + contents is the same as the original LaTex version. + + +1.0.0 +2003-07-24 +rjkm +Initial revision on LaTEX. + + +
+ + +LINUX DVB API +Version 5.2 + + + &sub-intro; + + + &sub-frontend; + + + &sub-demux; + + + &sub-video; + + + &sub-audio; + + + &sub-ca; + + + &sub-net; + + + &sub-kdapi; + + + &sub-examples; + + + + DVB Frontend Header File + &sub-frontend-h; + + diff --git a/Documentation/DocBook/media/dvb/dvbproperty.xml b/Documentation/DocBook/media/dvb/dvbproperty.xml new file mode 100644 index 000000000000..b5365f61d69b --- /dev/null +++ b/Documentation/DocBook/media/dvb/dvbproperty.xml @@ -0,0 +1,590 @@ +
+FE_GET_PROPERTY/FE_SET_PROPERTY + + +/* Reserved fields should be set to 0 */ +struct dtv_property { + __u32 cmd; + union { + __u32 data; + struct { + __u8 data[32]; + __u32 len; + __u32 reserved1[3]; + void *reserved2; + } buffer; + } u; + int result; +} __attribute__ ((packed)); + +/* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */ +#define DTV_IOCTL_MAX_MSGS 64 + +struct dtv_properties { + __u32 num; + struct dtv_property *props; +}; + + +
+FE_GET_PROPERTY +DESCRIPTION + + +This ioctl call returns one or more frontend properties. This call only + requires read-only access to the device. + + +SYNOPSIS + + +int ioctl(int fd, int request = FE_GET_PROPERTY, + dtv_properties ⋆props); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int num + +Equals FE_GET_PROPERTY for this command. + + +struct dtv_property *props + +Points to the location where the front-end property commands are stored. + + +ERRORS + + EINVAL + Invalid parameter(s) received or number of parameters out of the range. + + ENOMEM + Out of memory. + + EFAULT + Failure while copying data from/to userspace. + + EOPNOTSUPP + Property type not supported. + +
+ +
+FE_SET_PROPERTY +DESCRIPTION + + +This ioctl call sets one or more frontend properties. This call only + requires read-only access to the device. + + +SYNOPSIS + + +int ioctl(int fd, int request = FE_SET_PROPERTY, + dtv_properties ⋆props); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int num + +Equals FE_SET_PROPERTY for this command. + + +struct dtv_property *props + +Points to the location where the front-end property commands are stored. + + +ERRORS + + + EINVAL + Invalid parameter(s) received or number of parameters out of the range. + + ENOMEM + Out of memory. + + EFAULT + Failure while copying data from/to userspace. + + EOPNOTSUPP + Property type not supported. + +
+ +
+ Property types + +On FE_GET_PROPERTY/FE_SET_PROPERTY, +the actual action is determined by the dtv_property cmd/data pairs. With one single ioctl, is possible to +get/set up to 64 properties. The actual meaning of each property is described on the next sections. + + +The available frontend property types are: + +#define DTV_UNDEFINED 0 +#define DTV_TUNE 1 +#define DTV_CLEAR 2 +#define DTV_FREQUENCY 3 +#define DTV_MODULATION 4 +#define DTV_BANDWIDTH_HZ 5 +#define DTV_INVERSION 6 +#define DTV_DISEQC_MASTER 7 +#define DTV_SYMBOL_RATE 8 +#define DTV_INNER_FEC 9 +#define DTV_VOLTAGE 10 +#define DTV_TONE 11 +#define DTV_PILOT 12 +#define DTV_ROLLOFF 13 +#define DTV_DISEQC_SLAVE_REPLY 14 +#define DTV_FE_CAPABILITY_COUNT 15 +#define DTV_FE_CAPABILITY 16 +#define DTV_DELIVERY_SYSTEM 17 +#define DTV_ISDBT_PARTIAL_RECEPTION 18 +#define DTV_ISDBT_SOUND_BROADCASTING 19 +#define DTV_ISDBT_SB_SUBCHANNEL_ID 20 +#define DTV_ISDBT_SB_SEGMENT_IDX 21 +#define DTV_ISDBT_SB_SEGMENT_COUNT 22 +#define DTV_ISDBT_LAYERA_FEC 23 +#define DTV_ISDBT_LAYERA_MODULATION 24 +#define DTV_ISDBT_LAYERA_SEGMENT_COUNT 25 +#define DTV_ISDBT_LAYERA_TIME_INTERLEAVING 26 +#define DTV_ISDBT_LAYERB_FEC 27 +#define DTV_ISDBT_LAYERB_MODULATION 28 +#define DTV_ISDBT_LAYERB_SEGMENT_COUNT 29 +#define DTV_ISDBT_LAYERB_TIME_INTERLEAVING 30 +#define DTV_ISDBT_LAYERC_FEC 31 +#define DTV_ISDBT_LAYERC_MODULATION 32 +#define DTV_ISDBT_LAYERC_SEGMENT_COUNT 33 +#define DTV_ISDBT_LAYERC_TIME_INTERLEAVING 34 +#define DTV_API_VERSION 35 +#define DTV_CODE_RATE_HP 36 +#define DTV_CODE_RATE_LP 37 +#define DTV_GUARD_INTERVAL 38 +#define DTV_TRANSMISSION_MODE 39 +#define DTV_HIERARCHY 40 +#define DTV_ISDBT_LAYER_ENABLED 41 +#define DTV_ISDBS_TS_ID 42 + +
+ +
+ Parameters that are common to all Digital TV standards +
+ <constant>DTV_FREQUENCY</constant> + + Central frequency of the channel, in HZ. + + Notes: + 1)For ISDB-T, the channels are usually transmitted with an offset of 143kHz. + E.g. a valid frequncy could be 474143 kHz. The stepping is bound to the bandwidth of + the channel which is 6MHz. + + 2)As in ISDB-Tsb the channel consists of only one or three segments the + frequency step is 429kHz, 3*429 respectively. As for ISDB-T the + central frequency of the channel is expected. +
+ +
+ <constant>DTV_BANDWIDTH_HZ</constant> + + Bandwidth for the channel, in HZ. + + Possible values: + 1712000, + 5000000, + 6000000, + 7000000, + 8000000, + 10000000. + + + Notes: + + 1) For ISDB-T it should be always 6000000Hz (6MHz) + 2) For ISDB-Tsb it can vary depending on the number of connected segments + 3) Bandwidth doesn't apply for DVB-C transmissions, as the bandwidth + for DVB-C depends on the symbol rate + 4) Bandwidth in ISDB-T is fixed (6MHz) or can be easily derived from + other parameters (DTV_ISDBT_SB_SEGMENT_IDX, + DTV_ISDBT_SB_SEGMENT_COUNT). + 5) DVB-T supports 6, 7 and 8MHz. + 6) In addition, DVB-T2 supports 1.172, 5 and 10MHz. +
+ +
+ <constant>DTV_DELIVERY_SYSTEM</constant> + + Specifies the type of Delivery system + + Possible values: + +typedef enum fe_delivery_system { + SYS_UNDEFINED, + SYS_DVBC_ANNEX_AC, + SYS_DVBC_ANNEX_B, + SYS_DVBT, + SYS_DSS, + SYS_DVBS, + SYS_DVBS2, + SYS_DVBH, + SYS_ISDBT, + SYS_ISDBS, + SYS_ISDBC, + SYS_ATSC, + SYS_ATSCMH, + SYS_DMBTH, + SYS_CMMB, + SYS_DAB, + SYS_DVBT2, +} fe_delivery_system_t; + + +
+ +
+ <constant>DTV_TRANSMISSION_MODE</constant> + + Specifies the number of carriers used by the standard + + Possible values are: + +typedef enum fe_transmit_mode { + TRANSMISSION_MODE_2K, + TRANSMISSION_MODE_8K, + TRANSMISSION_MODE_AUTO, + TRANSMISSION_MODE_4K, + TRANSMISSION_MODE_1K, + TRANSMISSION_MODE_16K, + TRANSMISSION_MODE_32K, +} fe_transmit_mode_t; + + + Notes: + 1) ISDB-T supports three carrier/symbol-size: 8K, 4K, 2K. It is called + 'mode' in the standard: Mode 1 is 2K, mode 2 is 4K, mode 3 is 8K + + 2) If DTV_TRANSMISSION_MODE is set the TRANSMISSION_MODE_AUTO the + hardware will try to find the correct FFT-size (if capable) and will + use TMCC to fill in the missing parameters. + 3) DVB-T specifies 2K and 8K as valid sizes. + 4) DVB-T2 specifies 1K, 2K, 4K, 8K, 16K and 32K. +
+ +
+ <constant>DTV_GUARD_INTERVAL</constant> + + Possible values are: + +typedef enum fe_guard_interval { + GUARD_INTERVAL_1_32, + GUARD_INTERVAL_1_16, + GUARD_INTERVAL_1_8, + GUARD_INTERVAL_1_4, + GUARD_INTERVAL_AUTO, + GUARD_INTERVAL_1_128, + GUARD_INTERVAL_19_128, + GUARD_INTERVAL_19_256, +} fe_guard_interval_t; + + + Notes: + 1) If DTV_GUARD_INTERVAL is set the GUARD_INTERVAL_AUTO the hardware will + try to find the correct guard interval (if capable) and will use TMCC to fill + in the missing parameters. + 2) Intervals 1/128, 19/128 and 19/256 are used only for DVB-T2 at present +
+
+ +
+ ISDB-T frontend + This section describes shortly what are the possible parameters in the Linux + DVB-API called "S2API" and now DVB API 5 in order to tune an ISDB-T/ISDB-Tsb + demodulator: + + This ISDB-T/ISDB-Tsb API extension should reflect all information + needed to tune any ISDB-T/ISDB-Tsb hardware. Of course it is possible + that some very sophisticated devices won't need certain parameters to + tune. + + The information given here should help application writers to know how + to handle ISDB-T and ISDB-Tsb hardware using the Linux DVB-API. + + The details given here about ISDB-T and ISDB-Tsb are just enough to + basically show the dependencies between the needed parameter values, + but surely some information is left out. For more detailed information + see the following documents: + + ARIB STD-B31 - "Transmission System for Digital Terrestrial + Television Broadcasting" and + ARIB TR-B14 - "Operational Guidelines for Digital Terrestrial + Television Broadcasting". + + In order to read this document one has to have some knowledge the + channel structure in ISDB-T and ISDB-Tsb. I.e. it has to be known to + the reader that an ISDB-T channel consists of 13 segments, that it can + have up to 3 layer sharing those segments, and things like that. + + Parameters used by ISDB-T and ISDB-Tsb. + +
+ ISDB-T only parameters + +
+ <constant>DTV_ISDBT_PARTIAL_RECEPTION</constant> + + If DTV_ISDBT_SOUND_BROADCASTING is '0' this bit-field represents whether + the channel is in partial reception mode or not. + + If '1' DTV_ISDBT_LAYERA_* values are assigned to the center segment and + DTV_ISDBT_LAYERA_SEGMENT_COUNT has to be '1'. + + If in addition DTV_ISDBT_SOUND_BROADCASTING is '1' + DTV_ISDBT_PARTIAL_RECEPTION represents whether this ISDB-Tsb channel + is consisting of one segment and layer or three segments and two layers. + + Possible values: 0, 1, -1 (AUTO) +
+ +
+ <constant>DTV_ISDBT_SOUND_BROADCASTING</constant> + + This field represents whether the other DTV_ISDBT_*-parameters are + referring to an ISDB-T and an ISDB-Tsb channel. (See also + DTV_ISDBT_PARTIAL_RECEPTION). + + Possible values: 0, 1, -1 (AUTO) +
+ +
+ <constant>DTV_ISDBT_SB_SUBCHANNEL_ID</constant> + + This field only applies if DTV_ISDBT_SOUND_BROADCASTING is '1'. + + (Note of the author: This might not be the correct description of the + SUBCHANNEL-ID in all details, but it is my understanding of the technical + background needed to program a device) + + An ISDB-Tsb channel (1 or 3 segments) can be broadcasted alone or in a + set of connected ISDB-Tsb channels. In this set of channels every + channel can be received independently. The number of connected + ISDB-Tsb segment can vary, e.g. depending on the frequency spectrum + bandwidth available. + + Example: Assume 8 ISDB-Tsb connected segments are broadcasted. The + broadcaster has several possibilities to put those channels in the + air: Assuming a normal 13-segment ISDB-T spectrum he can align the 8 + segments from position 1-8 to 5-13 or anything in between. + + The underlying layer of segments are subchannels: each segment is + consisting of several subchannels with a predefined IDs. A sub-channel + is used to help the demodulator to synchronize on the channel. + + An ISDB-T channel is always centered over all sub-channels. As for + the example above, in ISDB-Tsb it is no longer as simple as that. + + The DTV_ISDBT_SB_SUBCHANNEL_ID parameter is used to give the + sub-channel ID of the segment to be demodulated. + + Possible values: 0 .. 41, -1 (AUTO) +
+ +
+ + <constant>DTV_ISDBT_SB_SEGMENT_IDX</constant> + + This field only applies if DTV_ISDBT_SOUND_BROADCASTING is '1'. + + DTV_ISDBT_SB_SEGMENT_IDX gives the index of the segment to be + demodulated for an ISDB-Tsb channel where several of them are + transmitted in the connected manner. + + Possible values: 0 .. DTV_ISDBT_SB_SEGMENT_COUNT - 1 + + Note: This value cannot be determined by an automatic channel search. +
+ +
+ <constant>DTV_ISDBT_SB_SEGMENT_COUNT</constant> + + This field only applies if DTV_ISDBT_SOUND_BROADCASTING is '1'. + + DTV_ISDBT_SB_SEGMENT_COUNT gives the total count of connected ISDB-Tsb + channels. + + Possible values: 1 .. 13 + + Note: This value cannot be determined by an automatic channel search. +
+ +
+ Hierarchical layers + + ISDB-T channels can be coded hierarchically. As opposed to DVB-T in + ISDB-T hierarchical layers can be decoded simultaneously. For that + reason a ISDB-T demodulator has 3 viterbi and 3 reed-solomon-decoders. + + ISDB-T has 3 hierarchical layers which each can use a part of the + available segments. The total number of segments over all layers has + to 13 in ISDB-T. + +
+ <constant>DTV_ISDBT_LAYER_ENABLED</constant> + + Hierarchical reception in ISDB-T is achieved by enabling or disabling + layers in the decoding process. Setting all bits of + DTV_ISDBT_LAYER_ENABLED to '1' forces all layers (if applicable) to be + demodulated. This is the default. + + If the channel is in the partial reception mode + (DTV_ISDBT_PARTIAL_RECEPTION = 1) the central segment can be decoded + independently of the other 12 segments. In that mode layer A has to + have a SEGMENT_COUNT of 1. + + In ISDB-Tsb only layer A is used, it can be 1 or 3 in ISDB-Tsb + according to DTV_ISDBT_PARTIAL_RECEPTION. SEGMENT_COUNT must be filled + accordingly. + + Possible values: 0x1, 0x2, 0x4 (|-able) + + DTV_ISDBT_LAYER_ENABLED[0:0] - layer A + DTV_ISDBT_LAYER_ENABLED[1:1] - layer B + DTV_ISDBT_LAYER_ENABLED[2:2] - layer C + DTV_ISDBT_LAYER_ENABLED[31:3] unused +
+ +
+ <constant>DTV_ISDBT_LAYER*_FEC</constant> + + Possible values: FEC_AUTO, FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_7_8 +
+ +
+ <constant>DTV_ISDBT_LAYER*_MODULATION</constant> + + Possible values: QAM_AUTO, QPSK, QAM_16, QAM_64, DQPSK + + Note: If layer C is DQPSK layer B has to be DQPSK. If layer B is DQPSK + and DTV_ISDBT_PARTIAL_RECEPTION=0 layer has to be DQPSK. +
+ +
+ <constant>DTV_ISDBT_LAYER*_SEGMENT_COUNT</constant> + + Possible values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, -1 (AUTO) + + Note: Truth table for DTV_ISDBT_SOUND_BROADCASTING and + DTV_ISDBT_PARTIAL_RECEPTION and LAYER*_SEGMENT_COUNT + + + + + + + PR + SB + Layer A width + Layer B width + Layer C width + total width + + + + 0 + 0 + 1 .. 13 + 1 .. 13 + 1 .. 13 + 13 + + + + 1 + 0 + 1 + 1 .. 13 + 1 .. 13 + 13 + + + + 0 + 1 + 1 + 0 + 0 + 1 + + + + 1 + 1 + 1 + 2 + 0 + 13 + + + + + + +
+ +
+ <constant>DTV_ISDBT_LAYER*_TIME_INTERLEAVING</constant> + + Possible values: 0, 1, 2, 3, -1 (AUTO) + + Note: The real inter-leaver depth-names depend on the mode (fft-size); the values + here are referring to what can be found in the TMCC-structure - + independent of the mode. +
+
+
+
+ DVB-T2 parameters + + This section covers parameters that apply only to the DVB-T2 delivery method. DVB-T2 + support is currently in the early stages development so expect this section to grow + and become more detailed with time. + +
+ <constant>DTV_DVBT2_PLP_ID</constant> + + DVB-T2 supports Physical Layer Pipes (PLP) to allow transmission of + many data types via a single multiplex. The API will soon support this + at which point this section will be expanded. +
+
+
+
diff --git a/Documentation/DocBook/media/dvb/dvbstb.pdf b/Documentation/DocBook/media/dvb/dvbstb.pdf new file mode 100644 index 000000000000..0fa75d90c3eb Binary files /dev/null and b/Documentation/DocBook/media/dvb/dvbstb.pdf differ diff --git a/Documentation/DocBook/media/dvb/dvbstb.png b/Documentation/DocBook/media/dvb/dvbstb.png new file mode 100644 index 000000000000..9b8f372e7afd Binary files /dev/null and b/Documentation/DocBook/media/dvb/dvbstb.png differ diff --git a/Documentation/DocBook/media/dvb/examples.xml b/Documentation/DocBook/media/dvb/examples.xml new file mode 100644 index 000000000000..f037e568eb6e --- /dev/null +++ b/Documentation/DocBook/media/dvb/examples.xml @@ -0,0 +1,365 @@ +Examples +In this section we would like to present some examples for using the DVB API. + +Maintainer note: This section is out of date. Please refer to the sample programs packaged +with the driver distribution from . + + +
+Tuning +We will start with a generic tuning subroutine that uses the frontend and SEC, as well as +the demux devices. The example is given for QPSK tuners, but can easily be adjusted for +QAM. + + + #include <sys/ioctl.h> + #include <stdio.h> + #include <stdint.h> + #include <sys/types.h> + #include <sys/stat.h> + #include <fcntl.h> + #include <time.h> + #include <unistd.h> + + #include <linux/dvb/dmx.h> + #include <linux/dvb/frontend.h> + #include <linux/dvb/sec.h> + #include <sys/poll.h> + + #define DMX "/dev/dvb/adapter0/demux1" + #define FRONT "/dev/dvb/adapter0/frontend1" + #define SEC "/dev/dvb/adapter0/sec1" + + /⋆ routine for checking if we have a signal and other status information⋆/ + int FEReadStatus(int fd, fe_status_t ⋆stat) + { + int ans; + + if ( (ans = ioctl(fd,FE_READ_STATUS,stat) < 0)){ + perror("FE READ STATUS: "); + return -1; + } + + if (⋆stat & FE_HAS_POWER) + printf("FE HAS POWER\n"); + + if (⋆stat & FE_HAS_SIGNAL) + printf("FE HAS SIGNAL\n"); + + if (⋆stat & FE_SPECTRUM_INV) + printf("SPEKTRUM INV\n"); + + return 0; + } + + + /⋆ tune qpsk ⋆/ + /⋆ freq: frequency of transponder ⋆/ + /⋆ vpid, apid, tpid: PIDs of video, audio and teletext TS packets ⋆/ + /⋆ diseqc: DiSEqC address of the used LNB ⋆/ + /⋆ pol: Polarisation ⋆/ + /⋆ srate: Symbol Rate ⋆/ + /⋆ fec. FEC ⋆/ + /⋆ lnb_lof1: local frequency of lower LNB band ⋆/ + /⋆ lnb_lof2: local frequency of upper LNB band ⋆/ + /⋆ lnb_slof: switch frequency of LNB ⋆/ + + int set_qpsk_channel(int freq, int vpid, int apid, int tpid, + int diseqc, int pol, int srate, int fec, int lnb_lof1, + int lnb_lof2, int lnb_slof) + { + struct secCommand scmd; + struct secCmdSequence scmds; + struct dmx_pes_filter_params pesFilterParams; + FrontendParameters frp; + struct pollfd pfd[1]; + FrontendEvent event; + int demux1, demux2, demux3, front; + + frequency = (uint32_t) freq; + symbolrate = (uint32_t) srate; + + if((front = open(FRONT,O_RDWR)) < 0){ + perror("FRONTEND DEVICE: "); + return -1; + } + + if((sec = open(SEC,O_RDWR)) < 0){ + perror("SEC DEVICE: "); + return -1; + } + + if (demux1 < 0){ + if ((demux1=open(DMX, O_RDWR|O_NONBLOCK)) + < 0){ + perror("DEMUX DEVICE: "); + return -1; + } + } + + if (demux2 < 0){ + if ((demux2=open(DMX, O_RDWR|O_NONBLOCK)) + < 0){ + perror("DEMUX DEVICE: "); + return -1; + } + } + + if (demux3 < 0){ + if ((demux3=open(DMX, O_RDWR|O_NONBLOCK)) + < 0){ + perror("DEMUX DEVICE: "); + return -1; + } + } + + if (freq < lnb_slof) { + frp.Frequency = (freq - lnb_lof1); + scmds.continuousTone = SEC_TONE_OFF; + } else { + frp.Frequency = (freq - lnb_lof2); + scmds.continuousTone = SEC_TONE_ON; + } + frp.Inversion = INVERSION_AUTO; + if (pol) scmds.voltage = SEC_VOLTAGE_18; + else scmds.voltage = SEC_VOLTAGE_13; + + scmd.type=0; + scmd.u.diseqc.addr=0x10; + scmd.u.diseqc.cmd=0x38; + scmd.u.diseqc.numParams=1; + scmd.u.diseqc.params[0] = 0xF0 | ((diseqc ⋆ 4) & 0x0F) | + (scmds.continuousTone == SEC_TONE_ON ? 1 : 0) | + (scmds.voltage==SEC_VOLTAGE_18 ? 2 : 0); + + scmds.miniCommand=SEC_MINI_NONE; + scmds.numCommands=1; + scmds.commands=&scmd; + if (ioctl(sec, SEC_SEND_SEQUENCE, &scmds) < 0){ + perror("SEC SEND: "); + return -1; + } + + if (ioctl(sec, SEC_SEND_SEQUENCE, &scmds) < 0){ + perror("SEC SEND: "); + return -1; + } + + frp.u.qpsk.SymbolRate = srate; + frp.u.qpsk.FEC_inner = fec; + + if (ioctl(front, FE_SET_FRONTEND, &frp) < 0){ + perror("QPSK TUNE: "); + return -1; + } + + pfd[0].fd = front; + pfd[0].events = POLLIN; + + if (poll(pfd,1,3000)){ + if (pfd[0].revents & POLLIN){ + printf("Getting QPSK event\n"); + if ( ioctl(front, FE_GET_EVENT, &event) + + == -EOVERFLOW){ + perror("qpsk get event"); + return -1; + } + printf("Received "); + switch(event.type){ + case FE_UNEXPECTED_EV: + printf("unexpected event\n"); + return -1; + case FE_FAILURE_EV: + printf("failure event\n"); + return -1; + + case FE_COMPLETION_EV: + printf("completion event\n"); + } + } + } + + + pesFilterParams.pid = vpid; + pesFilterParams.input = DMX_IN_FRONTEND; + pesFilterParams.output = DMX_OUT_DECODER; + pesFilterParams.pes_type = DMX_PES_VIDEO; + pesFilterParams.flags = DMX_IMMEDIATE_START; + if (ioctl(demux1, DMX_SET_PES_FILTER, &pesFilterParams) < 0){ + perror("set_vpid"); + return -1; + } + + pesFilterParams.pid = apid; + pesFilterParams.input = DMX_IN_FRONTEND; + pesFilterParams.output = DMX_OUT_DECODER; + pesFilterParams.pes_type = DMX_PES_AUDIO; + pesFilterParams.flags = DMX_IMMEDIATE_START; + if (ioctl(demux2, DMX_SET_PES_FILTER, &pesFilterParams) < 0){ + perror("set_apid"); + return -1; + } + + pesFilterParams.pid = tpid; + pesFilterParams.input = DMX_IN_FRONTEND; + pesFilterParams.output = DMX_OUT_DECODER; + pesFilterParams.pes_type = DMX_PES_TELETEXT; + pesFilterParams.flags = DMX_IMMEDIATE_START; + if (ioctl(demux3, DMX_SET_PES_FILTER, &pesFilterParams) < 0){ + perror("set_tpid"); + return -1; + } + + return has_signal(fds); + } + + +The program assumes that you are using a universal LNB and a standard DiSEqC +switch with up to 4 addresses. Of course, you could build in some more checking if +tuning was successful and maybe try to repeat the tuning process. Depending on the +external hardware, i.e. LNB and DiSEqC switch, and weather conditions this may be +necessary. + +
+ +
+The DVR device +The following program code shows how to use the DVR device for recording. + + + #include <sys/ioctl.h> + #include <stdio.h> + #include <stdint.h> + #include <sys/types.h> + #include <sys/stat.h> + #include <fcntl.h> + #include <time.h> + #include <unistd.h> + + #include <linux/dvb/dmx.h> + #include <linux/dvb/video.h> + #include <sys/poll.h> + #define DVR "/dev/dvb/adapter0/dvr1" + #define AUDIO "/dev/dvb/adapter0/audio1" + #define VIDEO "/dev/dvb/adapter0/video1" + + #define BUFFY (188⋆20) + #define MAX_LENGTH (1024⋆1024⋆5) /⋆ record 5MB ⋆/ + + + /⋆ switch the demuxes to recording, assuming the transponder is tuned ⋆/ + + /⋆ demux1, demux2: file descriptor of video and audio filters ⋆/ + /⋆ vpid, apid: PIDs of video and audio channels ⋆/ + + int switch_to_record(int demux1, int demux2, uint16_t vpid, uint16_t apid) + { + struct dmx_pes_filter_params pesFilterParams; + + if (demux1 < 0){ + if ((demux1=open(DMX, O_RDWR|O_NONBLOCK)) + < 0){ + perror("DEMUX DEVICE: "); + return -1; + } + } + + if (demux2 < 0){ + if ((demux2=open(DMX, O_RDWR|O_NONBLOCK)) + < 0){ + perror("DEMUX DEVICE: "); + return -1; + } + } + + pesFilterParams.pid = vpid; + pesFilterParams.input = DMX_IN_FRONTEND; + pesFilterParams.output = DMX_OUT_TS_TAP; + pesFilterParams.pes_type = DMX_PES_VIDEO; + pesFilterParams.flags = DMX_IMMEDIATE_START; + if (ioctl(demux1, DMX_SET_PES_FILTER, &pesFilterParams) < 0){ + perror("DEMUX DEVICE"); + return -1; + } + pesFilterParams.pid = apid; + pesFilterParams.input = DMX_IN_FRONTEND; + pesFilterParams.output = DMX_OUT_TS_TAP; + pesFilterParams.pes_type = DMX_PES_AUDIO; + pesFilterParams.flags = DMX_IMMEDIATE_START; + if (ioctl(demux2, DMX_SET_PES_FILTER, &pesFilterParams) < 0){ + perror("DEMUX DEVICE"); + return -1; + } + return 0; + } + + /⋆ start recording MAX_LENGTH , assuming the transponder is tuned ⋆/ + + /⋆ demux1, demux2: file descriptor of video and audio filters ⋆/ + /⋆ vpid, apid: PIDs of video and audio channels ⋆/ + int record_dvr(int demux1, int demux2, uint16_t vpid, uint16_t apid) + { + int i; + int len; + int written; + uint8_t buf[BUFFY]; + uint64_t length; + struct pollfd pfd[1]; + int dvr, dvr_out; + + /⋆ open dvr device ⋆/ + if ((dvr = open(DVR, O_RDONLY|O_NONBLOCK)) < 0){ + perror("DVR DEVICE"); + return -1; + } + + /⋆ switch video and audio demuxes to dvr ⋆/ + printf ("Switching dvr on\n"); + i = switch_to_record(demux1, demux2, vpid, apid); + printf("finished: "); + + printf("Recording %2.0f MB of test file in TS format\n", + MAX_LENGTH/(1024.0⋆1024.0)); + length = 0; + + /⋆ open output file ⋆/ + if ((dvr_out = open(DVR_FILE,O_WRONLY|O_CREAT + |O_TRUNC, S_IRUSR|S_IWUSR + |S_IRGRP|S_IWGRP|S_IROTH| + S_IWOTH)) < 0){ + perror("Can't open file for dvr test"); + return -1; + } + + pfd[0].fd = dvr; + pfd[0].events = POLLIN; + + /⋆ poll for dvr data and write to file ⋆/ + while (length < MAX_LENGTH ) { + if (poll(pfd,1,1)){ + if (pfd[0].revents & POLLIN){ + len = read(dvr, buf, BUFFY); + if (len < 0){ + perror("recording"); + return -1; + } + if (len > 0){ + written = 0; + while (written < len) + written += + write (dvr_out, + buf, len); + length += len; + printf("written %2.0f MB\r", + length/1024./1024.); + } + } + } + } + return 0; + } + + + +
diff --git a/Documentation/DocBook/media/dvb/frontend.xml b/Documentation/DocBook/media/dvb/frontend.xml new file mode 100644 index 000000000000..60c6976fb311 --- /dev/null +++ b/Documentation/DocBook/media/dvb/frontend.xml @@ -0,0 +1,1851 @@ +DVB Frontend API + +The DVB frontend device controls the tuner and DVB demodulator +hardware. It can be accessed through /dev/dvb/adapter0/frontend0. Data types and and +ioctl definitions can be accessed by including linux/dvb/frontend.h in your application. + +DVB frontends come in three varieties: DVB-S (satellite), DVB-C +(cable) and DVB-T (terrestrial). Transmission via the internet (DVB-IP) +is not yet handled by this API but a future extension is possible. For +DVB-S the frontend device also supports satellite equipment control +(SEC) via DiSEqC and V-SEC protocols. The DiSEqC (digital SEC) +specification is available from +Eutelsat. + +Note that the DVB API may also be used for MPEG decoder-only PCI +cards, in which case there exists no frontend device. + +
+Frontend Data Types + +
+frontend type + +For historical reasons frontend types are named after the type of modulation used in +transmission. + + typedef enum fe_type { + FE_QPSK, /⋆ DVB-S ⋆/ + FE_QAM, /⋆ DVB-C ⋆/ + FE_OFDM /⋆ DVB-T ⋆/ + } fe_type_t; + + +
+ +
+frontend capabilities + +Capabilities describe what a frontend can do. Some capabilities can only be supported for +a specific frontend type. + + typedef enum fe_caps { + FE_IS_STUPID = 0, + FE_CAN_INVERSION_AUTO = 0x1, + FE_CAN_FEC_1_2 = 0x2, + FE_CAN_FEC_2_3 = 0x4, + FE_CAN_FEC_3_4 = 0x8, + FE_CAN_FEC_4_5 = 0x10, + FE_CAN_FEC_5_6 = 0x20, + FE_CAN_FEC_6_7 = 0x40, + FE_CAN_FEC_7_8 = 0x80, + FE_CAN_FEC_8_9 = 0x100, + FE_CAN_FEC_AUTO = 0x200, + FE_CAN_QPSK = 0x400, + FE_CAN_QAM_16 = 0x800, + FE_CAN_QAM_32 = 0x1000, + FE_CAN_QAM_64 = 0x2000, + FE_CAN_QAM_128 = 0x4000, + FE_CAN_QAM_256 = 0x8000, + FE_CAN_QAM_AUTO = 0x10000, + FE_CAN_TRANSMISSION_MODE_AUTO = 0x20000, + FE_CAN_BANDWIDTH_AUTO = 0x40000, + FE_CAN_GUARD_INTERVAL_AUTO = 0x80000, + FE_CAN_HIERARCHY_AUTO = 0x100000, + FE_CAN_8VSB = 0x200000, + FE_CAN_16VSB = 0x400000, + FE_HAS_EXTENDED_CAPS = 0x800000, + FE_CAN_TURBO_FEC = 0x8000000, + FE_CAN_2G_MODULATION = 0x10000000, + FE_NEEDS_BENDING = 0x20000000, + FE_CAN_RECOVER = 0x40000000, + FE_CAN_MUTE_TS = 0x80000000 + } fe_caps_t; + +
+ +
+frontend information + +Information about the frontend ca be queried with + FE_GET_INFO. + + + struct dvb_frontend_info { + char name[128]; + fe_type_t type; + uint32_t frequency_min; + uint32_t frequency_max; + uint32_t frequency_stepsize; + uint32_t frequency_tolerance; + uint32_t symbol_rate_min; + uint32_t symbol_rate_max; + uint32_t symbol_rate_tolerance; /⋆ ppm ⋆/ + uint32_t notifier_delay; /⋆ ms ⋆/ + fe_caps_t caps; + }; + +
+ +
+diseqc master command + +A message sent from the frontend to DiSEqC capable equipment. + + struct dvb_diseqc_master_cmd { + uint8_t msg [6]; /⋆ { framing, address, command, data[3] } ⋆/ + uint8_t msg_len; /⋆ valid values are 3...6 ⋆/ + }; + +
+
+diseqc slave reply + +A reply to the frontend from DiSEqC 2.0 capable equipment. + + struct dvb_diseqc_slave_reply { + uint8_t msg [4]; /⋆ { framing, data [3] } ⋆/ + uint8_t msg_len; /⋆ valid values are 0...4, 0 means no msg ⋆/ + int timeout; /⋆ return from ioctl after timeout ms with ⋆/ + }; /⋆ errorcode when no message was received ⋆/ + +
+ +
+diseqc slave reply +The voltage is usually used with non-DiSEqC capable LNBs to switch the polarzation +(horizontal/vertical). When using DiSEqC epuipment this voltage has to be switched +consistently to the DiSEqC commands as described in the DiSEqC spec. + + typedef enum fe_sec_voltage { + SEC_VOLTAGE_13, + SEC_VOLTAGE_18 + } fe_sec_voltage_t; + +
+ +
+SEC continuous tone + +The continuous 22KHz tone is usually used with non-DiSEqC capable LNBs to switch the +high/low band of a dual-band LNB. When using DiSEqC epuipment this voltage has to +be switched consistently to the DiSEqC commands as described in the DiSEqC +spec. + + typedef enum fe_sec_tone_mode { + SEC_TONE_ON, + SEC_TONE_OFF + } fe_sec_tone_mode_t; + +
+ +
+SEC tone burst + +The 22KHz tone burst is usually used with non-DiSEqC capable switches to select +between two connected LNBs/satellites. When using DiSEqC epuipment this voltage has to +be switched consistently to the DiSEqC commands as described in the DiSEqC +spec. + + typedef enum fe_sec_mini_cmd { + SEC_MINI_A, + SEC_MINI_B + } fe_sec_mini_cmd_t; + + + +
+ +
+frontend status +Several functions of the frontend device use the fe_status data type defined +by + + typedef enum fe_status { + FE_HAS_SIGNAL = 0x01, /⋆ found something above the noise level ⋆/ + FE_HAS_CARRIER = 0x02, /⋆ found a DVB signal ⋆/ + FE_HAS_VITERBI = 0x04, /⋆ FEC is stable ⋆/ + FE_HAS_SYNC = 0x08, /⋆ found sync bytes ⋆/ + FE_HAS_LOCK = 0x10, /⋆ everything's working... ⋆/ + FE_TIMEDOUT = 0x20, /⋆ no lock within the last ~2 seconds ⋆/ + FE_REINIT = 0x40 /⋆ frontend was reinitialized, ⋆/ + } fe_status_t; /⋆ application is recommned to reset ⋆/ + +to indicate the current state and/or state changes of the frontend hardware. + + +
+ +
+frontend parameters +The kind of parameters passed to the frontend device for tuning depend on +the kind of hardware you are using. All kinds of parameters are combined as an +union in the FrontendParameters structure: + + struct dvb_frontend_parameters { + uint32_t frequency; /⋆ (absolute) frequency in Hz for QAM/OFDM ⋆/ + /⋆ intermediate frequency in kHz for QPSK ⋆/ + fe_spectral_inversion_t inversion; + union { + struct dvb_qpsk_parameters qpsk; + struct dvb_qam_parameters qam; + struct dvb_ofdm_parameters ofdm; + } u; + }; + +For satellite QPSK frontends you have to use the QPSKParameters member defined by + + struct dvb_qpsk_parameters { + uint32_t symbol_rate; /⋆ symbol rate in Symbols per second ⋆/ + fe_code_rate_t fec_inner; /⋆ forward error correction (see above) ⋆/ + }; + +for cable QAM frontend you use the QAMParameters structure + + struct dvb_qam_parameters { + uint32_t symbol_rate; /⋆ symbol rate in Symbols per second ⋆/ + fe_code_rate_t fec_inner; /⋆ forward error correction (see above) ⋆/ + fe_modulation_t modulation; /⋆ modulation type (see above) ⋆/ + }; + +DVB-T frontends are supported by the OFDMParamters structure + + + struct dvb_ofdm_parameters { + fe_bandwidth_t bandwidth; + fe_code_rate_t code_rate_HP; /⋆ high priority stream code rate ⋆/ + fe_code_rate_t code_rate_LP; /⋆ low priority stream code rate ⋆/ + fe_modulation_t constellation; /⋆ modulation type (see above) ⋆/ + fe_transmit_mode_t transmission_mode; + fe_guard_interval_t guard_interval; + fe_hierarchy_t hierarchy_information; + }; + +In the case of QPSK frontends the Frequency field specifies the intermediate +frequency, i.e. the offset which is effectively added to the local oscillator frequency (LOF) of +the LNB. The intermediate frequency has to be specified in units of kHz. For QAM and +OFDM frontends the Frequency specifies the absolute frequency and is given in +Hz. + +The Inversion field can take one of these values: + + + typedef enum fe_spectral_inversion { + INVERSION_OFF, + INVERSION_ON, + INVERSION_AUTO + } fe_spectral_inversion_t; + +It indicates if spectral inversion should be presumed or not. In the automatic setting +(INVERSION_AUTO) the hardware will try to figure out the correct setting by +itself. + +The possible values for the FEC_inner field are + + + typedef enum fe_code_rate { + FEC_NONE = 0, + FEC_1_2, + FEC_2_3, + FEC_3_4, + FEC_4_5, + FEC_5_6, + FEC_6_7, + FEC_7_8, + FEC_8_9, + FEC_AUTO + } fe_code_rate_t; + +which correspond to error correction rates of 1/2, 2/3, etc., no error correction or auto +detection. + +For cable and terrestrial frontends (QAM and OFDM) one also has to specify the quadrature +modulation mode which can be one of the following: + + + typedef enum fe_modulation { + QPSK, + QAM_16, + QAM_32, + QAM_64, + QAM_128, + QAM_256, + QAM_AUTO + } fe_modulation_t; + +Finally, there are several more parameters for OFDM: + + + typedef enum fe_transmit_mode { + TRANSMISSION_MODE_2K, + TRANSMISSION_MODE_8K, + TRANSMISSION_MODE_AUTO + } fe_transmit_mode_t; + + + typedef enum fe_bandwidth { + BANDWIDTH_8_MHZ, + BANDWIDTH_7_MHZ, + BANDWIDTH_6_MHZ, + BANDWIDTH_AUTO + } fe_bandwidth_t; + + + typedef enum fe_guard_interval { + GUARD_INTERVAL_1_32, + GUARD_INTERVAL_1_16, + GUARD_INTERVAL_1_8, + GUARD_INTERVAL_1_4, + GUARD_INTERVAL_AUTO + } fe_guard_interval_t; + + + typedef enum fe_hierarchy { + HIERARCHY_NONE, + HIERARCHY_1, + HIERARCHY_2, + HIERARCHY_4, + HIERARCHY_AUTO + } fe_hierarchy_t; + + +
+ +
+frontend events + + struct dvb_frontend_event { + fe_status_t status; + struct dvb_frontend_parameters parameters; + }; + +
+
+ + +
+Frontend Function Calls + +
+open() +DESCRIPTION + + +This system call opens a named frontend device (/dev/dvb/adapter0/frontend0) + for subsequent use. Usually the first thing to do after a successful open is to + find out the frontend type with FE_GET_INFO. +The device can be opened in read-only mode, which only allows monitoring of + device status and statistics, or read/write mode, which allows any kind of use + (e.g. performing tuning operations.) + +In a system with multiple front-ends, it is usually the case that multiple devices + cannot be open in read/write mode simultaneously. As long as a front-end + device is opened in read/write mode, other open() calls in read/write mode will + either fail or block, depending on whether non-blocking or blocking mode was + specified. A front-end device opened in blocking mode can later be put into + non-blocking mode (and vice versa) using the F_SETFL command of the fcntl + system call. This is a standard system call, documented in the Linux manual + page for fcntl. When an open() call has succeeded, the device will be ready + for use in the specified mode. This implies that the corresponding hardware is + powered up, and that other front-ends may have been powered down to make + that possible. + + + +SYNOPSIS + +int open(const char ⋆deviceName, int flags); + + +PARAMETERS + + +const char + *deviceName + +Name of specific video device. + + +int flags + +A bit-wise OR of the following flags: + + + +O_RDONLY read-only access + + + +O_RDWR read/write access + + + +O_NONBLOCK open in non-blocking mode + + + +(blocking mode is the default) + + +ERRORS + + +ENODEV + +Device driver not loaded/available. + + +EINTERNAL + +Internal error. + + +EBUSY + +Device or resource busy. + + +EINVAL + +Invalid argument. + + +
+ +
+close() +DESCRIPTION + + +This system call closes a previously opened front-end device. After closing + a front-end device, its corresponding hardware might be powered down + automatically. + + +SYNOPSIS + + +int close(int fd); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + +
+ +
+FE_READ_STATUS +DESCRIPTION + + +This ioctl call returns status information about the front-end. This call only + requires read-only access to the device. + + +SYNOPSIS + + +int ioctl(int fd, int request = FE_READ_STATUS, + fe_status_t ⋆status); + + +PARAMETERS + + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals FE_READ_STATUS for this command. + + +struct fe_status_t + *status + +Points to the location where the front-end status word is + to be stored. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + +EFAULT + +status points to invalid address. + + +
+ +
+FE_READ_BER +DESCRIPTION + + +This ioctl call returns the bit error rate for the signal currently + received/demodulated by the front-end. For this command, read-only access to + the device is sufficient. + + +SYNOPSIS + + +int ioctl(int fd, int request = FE_READ_BER, + uint32_t ⋆ber); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals FE_READ_BER for this command. + + +uint32_t *ber + +The bit error rate is stored into *ber. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + +EFAULT + +ber points to invalid address. + + +ENOSIGNAL + +There is no signal, thus no meaningful bit error rate. Also + returned if the front-end is not turned on. + + +ENOSYS + +Function not available for this device. + + +
+ +
+FE_READ_SNR + +DESCRIPTION + + +This ioctl call returns the signal-to-noise ratio for the signal currently received + by the front-end. For this command, read-only access to the device is sufficient. + + +SYNOPSIS + + +int ioctl(int fd, int request = FE_READ_SNR, int16_t + ⋆snr); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals FE_READ_SNR for this command. + + +int16_t *snr + +The signal-to-noise ratio is stored into *snr. + + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + +EFAULT + +snr points to invalid address. + + +ENOSIGNAL + +There is no signal, thus no meaningful signal strength + value. Also returned if front-end is not turned on. + + +ENOSYS + +Function not available for this device. + + +
+ +
+FE_READ_SIGNAL_STRENGTH +DESCRIPTION + + +This ioctl call returns the signal strength value for the signal currently received + by the front-end. For this command, read-only access to the device is sufficient. + + +SYNOPSIS + + +int ioctl( int fd, int request = + FE_READ_SIGNAL_STRENGTH, int16_t ⋆strength); + + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals FE_READ_SIGNAL_STRENGTH for this + command. + + +int16_t *strength + +The signal strength value is stored into *strength. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + +EFAULT + +status points to invalid address. + + +ENOSIGNAL + +There is no signal, thus no meaningful signal strength + value. Also returned if front-end is not turned on. + + +ENOSYS + +Function not available for this device. + + +
+ +
+FE_READ_UNCORRECTED_BLOCKS +DESCRIPTION + + +This ioctl call returns the number of uncorrected blocks detected by the device + driver during its lifetime. For meaningful measurements, the increment in block + count during a specific time interval should be calculated. For this command, + read-only access to the device is sufficient. + + +Note that the counter will wrap to zero after its maximum count has been + reached. + + +SYNOPSIS + + +int ioctl( int fd, int request = + FE_READ_UNCORRECTED_BLOCKS, uint32_t ⋆ublocks); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals FE_READ_UNCORRECTED_BLOCKS for this + command. + + +uint32_t *ublocks + +The total number of uncorrected blocks seen by the driver + so far. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + +EFAULT + +ublocks points to invalid address. + + +ENOSYS + +Function not available for this device. + + +
+ +
+FE_SET_FRONTEND +DESCRIPTION + + +This ioctl call starts a tuning operation using specified parameters. The result + of this call will be successful if the parameters were valid and the tuning could + be initiated. The result of the tuning operation in itself, however, will arrive + asynchronously as an event (see documentation for FE_GET_EVENT and + FrontendEvent.) If a new FE_SET_FRONTEND operation is initiated before + the previous one was completed, the previous operation will be aborted in favor + of the new one. This command requires read/write access to the device. + + + +SYNOPSIS + + +int ioctl(int fd, int request = FE_SET_FRONTEND, + struct dvb_frontend_parameters ⋆p); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals FE_SET_FRONTEND for this command. + + +struct + dvb_frontend_parameters + *p + +Points to parameters for tuning operation. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + +EFAULT + +p points to invalid address. + + +EINVAL + +Maximum supported symbol rate reached. + + +
+ +
+FE_GET_FRONTEND +DESCRIPTION + + +This ioctl call queries the currently effective frontend parameters. For this + command, read-only access to the device is sufficient. + + + +SYNOPSIS + + +int ioctl(int fd, int request = FE_GET_FRONTEND, + struct dvb_frontend_parameters ⋆p); + + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals FE_SET_FRONTEND for this command. + + +struct + dvb_frontend_parameters + *p + +Points to parameters for tuning operation. + + + +ERRORS + + + +EBADF + +fd is not a valid open file descriptor. + + +EFAULT + +p points to invalid address. + + +EINVAL + +Maximum supported symbol rate reached. + + + +
+ +
+FE_GET_EVENT +DESCRIPTION + + +This ioctl call returns a frontend event if available. If an event is not + available, the behavior depends on whether the device is in blocking or + non-blocking mode. In the latter case, the call fails immediately with errno + set to EWOULDBLOCK. In the former case, the call blocks until an event + becomes available. + + +The standard Linux poll() and/or select() system calls can be used with the + device file descriptor to watch for new events. For select(), the file descriptor + should be included in the exceptfds argument, and for poll(), POLLPRI should + be specified as the wake-up condition. Since the event queue allocated is + rather small (room for 8 events), the queue must be serviced regularly to avoid + overflow. If an overflow happens, the oldest event is discarded from the queue, + and an error (EOVERFLOW) occurs the next time the queue is read. After + reporting the error condition in this fashion, subsequent + FE_GET_EVENT + calls will return events from the queue as usual. + + +For the sake of implementation simplicity, this command requires read/write + access to the device. + + + +SYNOPSIS + + +int ioctl(int fd, int request = QPSK_GET_EVENT, + struct dvb_frontend_event ⋆ev); + + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals FE_GET_EVENT for this command. + + +struct + dvb_frontend_event + *ev + +Points to the location where the event, + + + +if any, is to be stored. + + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + +EFAULT + +ev points to invalid address. + + +EWOULDBLOCK + +There is no event pending, and the device is in + non-blocking mode. + + +EOVERFLOW + + + + +Overflow in event queue - one or more events were lost. + + +
+ +
+FE_GET_INFO +DESCRIPTION + + +This ioctl call returns information about the front-end. This call only requires + read-only access to the device. + + +SYNOPSIS + + + + int ioctl(int fd, int request = FE_GET_INFO, struct + dvb_frontend_info ⋆info); + + +PARAMETERS + + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals FE_GET_INFO for this command. + + +struct + dvb_frontend_info + *info + +Points to the location where the front-end information is + to be stored. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + +EFAULT + +info points to invalid address. + + +
+ +
+FE_DISEQC_RESET_OVERLOAD +DESCRIPTION + + +If the bus has been automatically powered off due to power overload, this ioctl + call restores the power to the bus. The call requires read/write access to the + device. This call has no effect if the device is manually powered off. Not all + DVB adapters support this ioctl. + + + +SYNOPSIS + + +int ioctl(int fd, int request = + FE_DISEQC_RESET_OVERLOAD); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals FE_DISEQC_RESET_OVERLOAD for this + command. + + + +ERRORS + + +EBADF + +fd is not a valid file descriptor. + + +EPERM + +Permission denied (needs read/write access). + + +EINTERNAL + +Internal error in the device driver. + + +
+ +
+FE_DISEQC_SEND_MASTER_CMD +DESCRIPTION + + +This ioctl call is used to send a a DiSEqC command. + + +SYNOPSIS + + +int ioctl(int fd, int request = + FE_DISEQC_SEND_MASTER_CMD, struct + dvb_diseqc_master_cmd ⋆cmd); + + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals FE_DISEQC_SEND_MASTER_CMD for this + command. + + +struct + dvb_diseqc_master_cmd + *cmd + +Pointer to the command to be transmitted. + + + +ERRORS + + +EBADF + +fd is not a valid file descriptor. + + +EFAULT + +Seq points to an invalid address. + + +EINVAL + +The data structure referred to by seq is invalid in some + way. + + +EPERM + +Permission denied (needs read/write access). + + +EINTERNAL + +Internal error in the device driver. + + +
+ +
+FE_DISEQC_RECV_SLAVE_REPLY +DESCRIPTION + + +This ioctl call is used to receive reply to a DiSEqC 2.0 command. + + + +SYNOPSIS + + +int ioctl(int fd, int request = + FE_DISEQC_RECV_SLAVE_REPLY, struct + dvb_diseqc_slave_reply ⋆reply); + + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals FE_DISEQC_RECV_SLAVE_REPLY for this + command. + + +struct + dvb_diseqc_slave_reply + *reply + +Pointer to the command to be received. + + +ERRORS + + +EBADF + +fd is not a valid file descriptor. + + +EFAULT + +Seq points to an invalid address. + + +EINVAL + +The data structure referred to by seq is invalid in some + way. + + +EPERM + +Permission denied (needs read/write access). + + +EINTERNAL + +Internal error in the device driver. + + +
+ +
+FE_DISEQC_SEND_BURST +DESCRIPTION + + +This ioctl call is used to send a 22KHz tone burst. + + + +SYNOPSIS + + +int ioctl(int fd, int request = + FE_DISEQC_SEND_BURST, fe_sec_mini_cmd_t burst); + + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals FE_DISEQC_SEND_BURST for this command. + + +fe_sec_mini_cmd_t + burst + +burst A or B. + + + +ERRORS + + +EBADF + +fd is not a valid file descriptor. + + +EFAULT + +Seq points to an invalid address. + + +EINVAL + +The data structure referred to by seq is invalid in some + way. + + +EPERM + +Permission denied (needs read/write access). + + +EINTERNAL + +Internal error in the device driver. + + +
+ +
+FE_SET_TONE +DESCRIPTION + + +This call is used to set the generation of the continuous 22kHz tone. This call + requires read/write permissions. + + +SYNOPSIS + + +int ioctl(int fd, int request = FE_SET_TONE, + fe_sec_tone_mode_t tone); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals FE_SET_TONE for this command. + + +fe_sec_tone_mode_t + tone + +The requested tone generation mode (on/off). + + +ERRORS + + +ENODEV + +Device driver not loaded/available. + + +EBUSY + +Device or resource busy. + + +EINVAL + +Invalid argument. + + +EPERM + +File not opened with read permissions. + + +EINTERNAL + +Internal error in the device driver. + + +
+ +
+FE_SET_VOLTAGE +DESCRIPTION + + +This call is used to set the bus voltage. This call requires read/write + permissions. + + +SYNOPSIS + + +int ioctl(int fd, int request = FE_SET_VOLTAGE, + fe_sec_voltage_t voltage); + + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals FE_SET_VOLTAGE for this command. + + +fe_sec_voltage_t + voltage + +The requested bus voltage. + + + +ERRORS + + +ENODEV + +Device driver not loaded/available. + + +EBUSY + +Device or resource busy. + + +EINVAL + +Invalid argument. + + +EPERM + +File not opened with read permissions. + + +EINTERNAL + +Internal error in the device driver. + + +
+ +
+FE_ENABLE_HIGH_LNB_VOLTAGE +DESCRIPTION + + +If high != 0 enables slightly higher voltages instead of 13/18V (to compensate + for long cables). This call requires read/write permissions. Not all DVB + adapters support this ioctl. + + + +SYNOPSIS + + +int ioctl(int fd, int request = + FE_ENABLE_HIGH_LNB_VOLTAGE, int high); + + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals FE_SET_VOLTAGE for this command. + + +int high + +The requested bus voltage. + + + +ERRORS + + +ENODEV + +Device driver not loaded/available. + + +EBUSY + +Device or resource busy. + + +EINVAL + +Invalid argument. + + +EPERM + +File not opened with read permissions. + + +EINTERNAL + +Internal error in the device driver. + + +
+ +
+FE_SET_FRONTEND_TUNE_MODE +DESCRIPTION + + +Allow setting tuner mode flags to the frontend. + + + +SYNOPSIS + + +int ioctl(int fd, int request = +FE_SET_FRONTEND_TUNE_MODE, unsigned int flags); + + + +PARAMETERS + + + unsigned int flags + + + +FE_TUNE_MODE_ONESHOT When set, this flag will disable any zigzagging or other "normal" tuning behaviour. Additionally, there will be no automatic monitoring of the lock status, and hence no frontend events will be generated. If a frontend device is closed, this flag will be automatically turned off when the device is reopened read-write. + + + + +ERRORS + +EINVAL +Invalid argument. + +
+ +
+ FE_DISHNETWORK_SEND_LEGACY_CMD +DESCRIPTION + + +WARNING: This is a very obscure legacy command, used only at stv0299 driver. Should not be used on newer drivers. +It provides a non-standard method for selecting Diseqc voltage on the frontend, for Dish Network legacy switches. +As support for this ioctl were added in 2004, this means that such dishes were already legacy in 2004. + + + +SYNOPSIS + + +int ioctl(int fd, int request = + FE_DISHNETWORK_SEND_LEGACY_CMD, unsigned long cmd); + + + +PARAMETERS + + + unsigned long cmd + + + +sends the specified raw cmd to the dish via DISEqC. + + + + +ERRORS + + + There are no errors in use for this call + + +
+ +
+ +&sub-dvbproperty; diff --git a/Documentation/DocBook/media/dvb/intro.xml b/Documentation/DocBook/media/dvb/intro.xml new file mode 100644 index 000000000000..0dc83f672ea2 --- /dev/null +++ b/Documentation/DocBook/media/dvb/intro.xml @@ -0,0 +1,191 @@ +Introduction + +
+What you need to know + +The reader of this document is required to have some knowledge in +the area of digital video broadcasting (DVB) and should be familiar with +part I of the MPEG2 specification ISO/IEC 13818 (aka ITU-T H.222), i.e +you should know what a program/transport stream (PS/TS) is and what is +meant by a packetized elementary stream (PES) or an I-frame. + +Various DVB standards documents are available from + and/or +. + +It is also necessary to know how to access unix/linux devices and +how to use ioctl calls. This also includes the knowledge of C or C++. + +
+ +
+History + +The first API for DVB cards we used at Convergence in late 1999 +was an extension of the Video4Linux API which was primarily developed +for frame grabber cards. As such it was not really well suited to be +used for DVB cards and their new features like recording MPEG streams +and filtering several section and PES data streams at the same time. + + +In early 2000, we were approached by Nokia with a proposal for a +new standard Linux DVB API. As a commitment to the development of +terminals based on open standards, Nokia and Convergence made it +available to all Linux developers and published it on + in September 2000. +Convergence is the maintainer of the Linux DVB API. Together with the +LinuxTV community (i.e. you, the reader of this document), the Linux DVB +API will be constantly reviewed and improved. With the Linux driver for +the Siemens/Hauppauge DVB PCI card Convergence provides a first +implementation of the Linux DVB API. +
+ +
+Overview + +
+Components of a DVB card/STB + + + + + + + + +
+ +A DVB PCI card or DVB set-top-box (STB) usually consists of the +following main hardware components: + + + + +Frontend consisting of tuner and DVB demodulator + +Here the raw signal reaches the DVB hardware from a satellite dish +or antenna or directly from cable. The frontend down-converts and +demodulates this signal into an MPEG transport stream (TS). In case of a +satellite frontend, this includes a facility for satellite equipment +control (SEC), which allows control of LNB polarization, multi feed +switches or dish rotors. + + + + +Conditional Access (CA) hardware like CI adapters and smartcard slots + + +The complete TS is passed through the CA hardware. Programs to +which the user has access (controlled by the smart card) are decoded in +real time and re-inserted into the TS. + + + + Demultiplexer which filters the incoming DVB stream + +The demultiplexer splits the TS into its components like audio and +video streams. Besides usually several of such audio and video streams +it also contains data streams with information about the programs +offered in this or other streams of the same provider. + + + + +MPEG2 audio and video decoder + +The main targets of the demultiplexer are the MPEG2 audio and +video decoders. After decoding they pass on the uncompressed audio and +video to the computer screen or (through a PAL/NTSC encoder) to a TV +set. + + + + + + shows a crude schematic of the control and data flow +between those components. + +On a DVB PCI card not all of these have to be present since some +functionality can be provided by the main CPU of the PC (e.g. MPEG +picture and sound decoding) or is not needed (e.g. for data-only uses +like “internet over satellite”). Also not every card or STB +provides conditional access hardware. + +
+ +
+Linux DVB Devices + +The Linux DVB API lets you control these hardware components +through currently six Unix-style character devices for video, audio, +frontend, demux, CA and IP-over-DVB networking. The video and audio +devices control the MPEG2 decoder hardware, the frontend device the +tuner and the DVB demodulator. The demux device gives you control over +the PES and section filters of the hardware. If the hardware does not +support filtering these filters can be implemented in software. Finally, +the CA device controls all the conditional access capabilities of the +hardware. It can depend on the individual security requirements of the +platform, if and how many of the CA functions are made available to the +application through this device. + +All devices can be found in the /dev +tree under /dev/dvb. The individual devices +are called: + + + + +/dev/dvb/adapterN/audioM, + + +/dev/dvb/adapterN/videoM, + + +/dev/dvb/adapterN/frontendM, + + + +/dev/dvb/adapterN/netM, + + + +/dev/dvb/adapterN/demuxM, + + + +/dev/dvb/adapterN/caM, + +where N enumerates the DVB PCI cards in a system starting +from 0, and M enumerates the devices of each type within each +adapter, starting from 0, too. We will omit the “/dev/dvb/adapterN/” in the further dicussion +of these devices. The naming scheme for the devices is the same wheter +devfs is used or not. + +More details about the data structures and function calls of all +the devices are described in the following chapters. + +
+ +
+API include files + +For each of the DVB devices a corresponding include file exists. +The DVB API include files should be included in application sources with +a partial path like: + + + + #include <linux/dvb/frontend.h> + + +To enable applications to support different API version, an +additional include file linux/dvb/version.h exists, which defines the +constant DVB_API_VERSION. This document +describes DVB_API_VERSION 3. + + +
+ diff --git a/Documentation/DocBook/media/dvb/kdapi.xml b/Documentation/DocBook/media/dvb/kdapi.xml new file mode 100644 index 000000000000..6c67481eaa4b --- /dev/null +++ b/Documentation/DocBook/media/dvb/kdapi.xml @@ -0,0 +1,2309 @@ +Kernel Demux API +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 demux.h and located in +drivers/media/dvb/dvb-core. + +Maintainer note: This section must be reviewed. It is probably out of date. + + +
+Kernel Demux Data Types + + +
+dmx_success_t + + typedef enum { + 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 ⋆/ + } dmx_success_t; + + +
+
+TS filter types + + /⋆--------------------------------------------------------------------------⋆/ + /⋆ TS packet reception ⋆/ + /⋆--------------------------------------------------------------------------⋆/ + + /⋆ TS filter type for set_type() ⋆/ + + #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) ⋆/ + + +
+
+dmx_ts_pes_t +The structure + + + typedef enum + { + DMX_TS_PES_AUDIO, /⋆ also send packets to audio decoder (if it exists) ⋆/ + DMX_TS_PES_VIDEO, /⋆ ... ⋆/ + DMX_TS_PES_TELETEXT, + DMX_TS_PES_SUBTITLE, + DMX_TS_PES_PCR, + DMX_TS_PES_OTHER, + } dmx_ts_pes_t; + +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. + + + struct dmx_ts_feed_s { + int is_filtering; /⋆ Set to non-zero when filtering in progress ⋆/ + struct dmx_demux_s⋆ parent; /⋆ Back-pointer ⋆/ + void⋆ priv; /⋆ Pointer to private data of the API client ⋆/ + int (⋆set) (struct dmx_ts_feed_s⋆ feed, + __u16 pid, + size_t callback_length, + size_t circular_buffer_size, + int descramble, + struct timespec timeout); + int (⋆start_filtering) (struct dmx_ts_feed_s⋆ feed); + int (⋆stop_filtering) (struct dmx_ts_feed_s⋆ feed); + int (⋆set_type) (struct dmx_ts_feed_s⋆ feed, + int type, + dmx_ts_pes_t pes_type); + }; + + typedef struct dmx_ts_feed_s dmx_ts_feed_t; + + + /⋆--------------------------------------------------------------------------⋆/ + /⋆ PES packet reception (not supported yet) ⋆/ + /⋆--------------------------------------------------------------------------⋆/ + + typedef struct dmx_pes_filter_s { + struct dmx_pes_s⋆ parent; /⋆ Back-pointer ⋆/ + void⋆ priv; /⋆ Pointer to private data of the API client ⋆/ + } dmx_pes_filter_t; + + + typedef struct dmx_pes_feed_s { + int is_filtering; /⋆ Set to non-zero when filtering in progress ⋆/ + struct dmx_demux_s⋆ parent; /⋆ Back-pointer ⋆/ + void⋆ priv; /⋆ Pointer to private data of the API client ⋆/ + int (⋆set) (struct dmx_pes_feed_s⋆ feed, + __u16 pid, + size_t circular_buffer_size, + int descramble, + struct timespec timeout); + int (⋆start_filtering) (struct dmx_pes_feed_s⋆ feed); + int (⋆stop_filtering) (struct dmx_pes_feed_s⋆ feed); + int (⋆allocate_filter) (struct dmx_pes_feed_s⋆ feed, + dmx_pes_filter_t⋆⋆ filter); + int (⋆release_filter) (struct dmx_pes_feed_s⋆ feed, + dmx_pes_filter_t⋆ filter); + } dmx_pes_feed_t; + + + typedef struct { + __u8 filter_value [DMX_MAX_FILTER_SIZE]; + __u8 filter_mask [DMX_MAX_FILTER_SIZE]; + struct dmx_section_feed_s⋆ parent; /⋆ Back-pointer ⋆/ + void⋆ priv; /⋆ Pointer to private data of the API client ⋆/ + } dmx_section_filter_t; + + + struct dmx_section_feed_s { + int is_filtering; /⋆ Set to non-zero when filtering in progress ⋆/ + struct dmx_demux_s⋆ parent; /⋆ Back-pointer ⋆/ + void⋆ priv; /⋆ Pointer to private data of the API client ⋆/ + int (⋆set) (struct dmx_section_feed_s⋆ feed, + __u16 pid, + size_t circular_buffer_size, + int descramble, + int check_crc); + int (⋆allocate_filter) (struct dmx_section_feed_s⋆ feed, + dmx_section_filter_t⋆⋆ filter); + int (⋆release_filter) (struct dmx_section_feed_s⋆ feed, + dmx_section_filter_t⋆ filter); + int (⋆start_filtering) (struct dmx_section_feed_s⋆ feed); + int (⋆stop_filtering) (struct dmx_section_feed_s⋆ feed); + }; + typedef struct dmx_section_feed_s dmx_section_feed_t; + + /⋆--------------------------------------------------------------------------⋆/ + /⋆ Callback functions ⋆/ + /⋆--------------------------------------------------------------------------⋆/ + + typedef int (⋆dmx_ts_cb) ( __u8 ⋆ buffer1, + size_t buffer1_length, + __u8 ⋆ buffer2, + size_t buffer2_length, + dmx_ts_feed_t⋆ source, + dmx_success_t success); + + typedef int (⋆dmx_section_cb) ( __u8 ⋆ buffer1, + size_t buffer1_len, + __u8 ⋆ buffer2, + size_t buffer2_len, + dmx_section_filter_t ⋆ source, + dmx_success_t success); + + typedef int (⋆dmx_pes_cb) ( __u8 ⋆ buffer1, + size_t buffer1_len, + __u8 ⋆ buffer2, + size_t buffer2_len, + dmx_pes_filter_t⋆ source, + dmx_success_t success); + + /⋆--------------------------------------------------------------------------⋆/ + /⋆ DVB Front-End ⋆/ + /⋆--------------------------------------------------------------------------⋆/ + + typedef enum { + DMX_OTHER_FE = 0, + DMX_SATELLITE_FE, + DMX_CABLE_FE, + DMX_TERRESTRIAL_FE, + DMX_LVDS_FE, + DMX_ASI_FE, /⋆ DVB-ASI interface ⋆/ + DMX_MEMORY_FE + } dmx_frontend_source_t; + + typedef struct { + /⋆ The following char⋆ fields point to NULL terminated strings ⋆/ + char⋆ id; /⋆ Unique front-end identifier ⋆/ + char⋆ vendor; /⋆ Name of the front-end vendor ⋆/ + char⋆ model; /⋆ Name of the front-end model ⋆/ + struct list_head connectivity_list; /⋆ List of front-ends that can + be connected to a particular + demux ⋆/ + void⋆ priv; /⋆ Pointer to private data of the API client ⋆/ + dmx_frontend_source_t source; + } dmx_frontend_t; + + /⋆--------------------------------------------------------------------------⋆/ + /⋆ MPEG-2 TS Demux ⋆/ + /⋆--------------------------------------------------------------------------⋆/ + + /⋆ + ⋆ Flags OR'ed in the capabilites field of struct dmx_demux_s. + ⋆/ + + #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 + #define DMX_SECTION_PAYLOAD_DESCRAMBLING 64 + #define DMX_MAC_ADDRESS_DESCRAMBLING 128 + + +
+
+demux_demux_t + + /⋆ + ⋆ DMX_FE_ENTRY(): Casts elements in the list of registered + ⋆ front-ends from the generic type struct list_head + ⋆ to the type ⋆ dmx_frontend_t + ⋆. + ⋆/ + + #define DMX_FE_ENTRY(list) list_entry(list, dmx_frontend_t, connectivity_list) + + struct dmx_demux_s { + /⋆ The following char⋆ fields point to NULL terminated strings ⋆/ + char⋆ id; /⋆ Unique demux identifier ⋆/ + char⋆ vendor; /⋆ Name of the demux vendor ⋆/ + char⋆ model; /⋆ Name of the demux model ⋆/ + __u32 capabilities; /⋆ Bitfield of capability flags ⋆/ + dmx_frontend_t⋆ frontend; /⋆ Front-end connected to the demux ⋆/ + struct list_head reg_list; /⋆ List of registered demuxes ⋆/ + void⋆ priv; /⋆ Pointer to private data of the API client ⋆/ + int users; /⋆ Number of users ⋆/ + int (⋆open) (struct dmx_demux_s⋆ demux); + int (⋆close) (struct dmx_demux_s⋆ demux); + int (⋆write) (struct dmx_demux_s⋆ demux, const char⋆ buf, size_t count); + int (⋆allocate_ts_feed) (struct dmx_demux_s⋆ demux, + dmx_ts_feed_t⋆⋆ feed, + dmx_ts_cb callback); + int (⋆release_ts_feed) (struct dmx_demux_s⋆ demux, + dmx_ts_feed_t⋆ feed); + int (⋆allocate_pes_feed) (struct dmx_demux_s⋆ demux, + dmx_pes_feed_t⋆⋆ feed, + dmx_pes_cb callback); + int (⋆release_pes_feed) (struct dmx_demux_s⋆ demux, + dmx_pes_feed_t⋆ feed); + int (⋆allocate_section_feed) (struct dmx_demux_s⋆ demux, + dmx_section_feed_t⋆⋆ feed, + dmx_section_cb callback); + int (⋆release_section_feed) (struct dmx_demux_s⋆ demux, + dmx_section_feed_t⋆ feed); + int (⋆descramble_mac_address) (struct dmx_demux_s⋆ demux, + __u8⋆ buffer1, + size_t buffer1_length, + __u8⋆ buffer2, + size_t buffer2_length, + __u16 pid); + int (⋆descramble_section_payload) (struct dmx_demux_s⋆ demux, + __u8⋆ buffer1, + size_t buffer1_length, + __u8⋆ buffer2, size_t buffer2_length, + __u16 pid); + int (⋆add_frontend) (struct dmx_demux_s⋆ demux, + dmx_frontend_t⋆ frontend); + int (⋆remove_frontend) (struct dmx_demux_s⋆ demux, + dmx_frontend_t⋆ frontend); + struct list_head⋆ (⋆get_frontends) (struct dmx_demux_s⋆ demux); + int (⋆connect_frontend) (struct dmx_demux_s⋆ demux, + dmx_frontend_t⋆ frontend); + int (⋆disconnect_frontend) (struct dmx_demux_s⋆ demux); + + + /⋆ added because js cannot keep track of these himself ⋆/ + int (⋆get_pes_pids) (struct dmx_demux_s⋆ demux, __u16 ⋆pids); + }; + typedef struct dmx_demux_s dmx_demux_t; + + +
+
+Demux directory + + /⋆ + ⋆ DMX_DIR_ENTRY(): Casts elements in the list of registered + ⋆ demuxes from the generic type struct list_head⋆ to the type dmx_demux_t + ⋆. + ⋆/ + + #define DMX_DIR_ENTRY(list) list_entry(list, dmx_demux_t, reg_list) + + int dmx_register_demux (dmx_demux_t⋆ demux); + int dmx_unregister_demux (dmx_demux_t⋆ demux); + struct list_head⋆ dmx_get_demuxes (void); + +
+
+Demux Directory API +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. + +All demux drivers in the directory implement the abstract interface dmx_demux_t. + + +
dmx_register_demux() +DESCRIPTION + + +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(), + + +SYNOPSIS + + +int dmx_register_demux ( dmx_demux_t ⋆demux ) + + +PARAMETERS + + +dmx_demux_t* + demux + +Pointer to the demux structure. + + +RETURNS + + +0 + +The function was completed without errors. + + +-EEXIST + +A demux with the same value of the id field already stored + in the directory. + + +-ENOSPC + +No space left in the directory. + + + +
dmx_unregister_demux() +DESCRIPTION + + +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. + + +SYNOPSIS + + +int dmx_unregister_demux ( dmx_demux_t ⋆demux ) + + +PARAMETERS + + +dmx_demux_t* + demux + +Pointer to the demux structure which is to be + unregistered. + + +RETURNS + + +0 + +The function was completed without errors. + + +ENODEV + +The specified demux is not registered in the demux + directory. + + +EBUSY + +The specified demux is currently in use. + + + +
dmx_get_demuxes() +DESCRIPTION + + +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. + + +SYNOPSIS + + +struct list_head ⋆dmx_get_demuxes () + + +PARAMETERS + + +none + + +RETURNS + + +struct list_head * + +A list of demux interfaces, or NULL in the case of an + empty list. + + +
+
+Demux API +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. + +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. + +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 +“function not available”. + +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. + +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. + + + +
+open() +DESCRIPTION + + +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. + + +SYNOPSIS + + +int open ( demux_t⋆ demux ); + + +PARAMETERS + + +demux_t* demux + +Pointer to the demux API and instance data. + + +RETURNS + + +0 + +The function was completed without errors. + + +-EUSERS + +Maximum usage count reached. + + +-EINVAL + +Bad parameter. + + + +
+
+close() +DESCRIPTION + + +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. + + +SYNOPSIS + + +int close(demux_t⋆ demux); + + +PARAMETERS + + +demux_t* demux + +Pointer to the demux API and instance data. + + +RETURNS + + +0 + +The function was completed without errors. + + +-ENODEV + +The demux was not in use. + + +-EINVAL + +Bad parameter. + + + +
+
+write() +DESCRIPTION + + +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. + + +SYNOPSIS + + +int write(demux_t⋆ demux, const char⋆ buf, size_t + count); + + +PARAMETERS + + +demux_t* demux + +Pointer to the demux API and instance data. + + +const char* buf + +Pointer to the TS data in kernel-space memory. + + +size_t length + +Length of the TS data. + + +RETURNS + + +0 + +The function was completed without errors. + + +-ENOSYS + +The command is not implemented. + + +-EINVAL + +Bad parameter. + + + +
allocate_ts_feed() +DESCRIPTION + + +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. + + +SYNOPSIS + + +int allocate_ts_feed(dmx_demux_t⋆ demux, + dmx_ts_feed_t⋆⋆ feed, dmx_ts_cb callback); + + +PARAMETERS + + +demux_t* demux + +Pointer to the demux API and instance data. + + +dmx_ts_feed_t** + feed + +Pointer to the TS feed API and instance data. + + +dmx_ts_cb callback + +Pointer to the callback function for passing received TS + packet + + +RETURNS + + +0 + +The function was completed without errors. + + +-EBUSY + +No more TS feeds available. + + +-ENOSYS + +The command is not implemented. + + +-EINVAL + +Bad parameter. + + + +
release_ts_feed() +DESCRIPTION + + +Releases the resources allocated with allocate_ts_feed(). Any filtering in + progress on the TS feed should be stopped before calling this function. + + +SYNOPSIS + + +int release_ts_feed(dmx_demux_t⋆ demux, + dmx_ts_feed_t⋆ feed); + + +PARAMETERS + + +demux_t* demux + +Pointer to the demux API and instance data. + + +dmx_ts_feed_t* feed + +Pointer to the TS feed API and instance data. + + +RETURNS + + +0 + +The function was completed without errors. + + +-EINVAL + +Bad parameter. + + + +
allocate_section_feed() +DESCRIPTION + + +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. + + +SYNOPSIS + + +int allocate_section_feed(dmx_demux_t⋆ demux, + dmx_section_feed_t ⋆⋆feed, dmx_section_cb callback); + + +PARAMETERS + + +demux_t *demux + +Pointer to the demux API and instance data. + + +dmx_section_feed_t + **feed + +Pointer to the section feed API and instance data. + + +dmx_section_cb + callback + +Pointer to the callback function for passing received + sections. + + +RETURNS + + +0 + +The function was completed without errors. + + +-EBUSY + +No more section feeds available. + + +-ENOSYS + +The command is not implemented. + + +-EINVAL + +Bad parameter. + + + +
release_section_feed() +DESCRIPTION + + +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. + + +SYNOPSIS + + +int release_section_feed(dmx_demux_t⋆ demux, + dmx_section_feed_t ⋆feed); + + +PARAMETERS + + +demux_t *demux + +Pointer to the demux API and instance data. + + +dmx_section_feed_t + *feed + +Pointer to the section feed API and instance data. + + +RETURNS + + +0 + +The function was completed without errors. + + +-EINVAL + +Bad parameter. + + + +
descramble_mac_address() +DESCRIPTION + + +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. + + +SYNOPSIS + + +int descramble_mac_address(dmx_demux_t⋆ demux, __u8 + ⋆buffer1, size_t buffer1_length, __u8 ⋆buffer2, + size_t buffer2_length, __u16 pid); + + +PARAMETERS + + +dmx_demux_t + *demux + +Pointer to the demux API and instance data. + + +__u8 *buffer1 + +Pointer to the first byte of the section. + + +size_t buffer1_length + +Length of the section data, including headers and CRC, + in buffer1. + + +__u8* buffer2 + +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. + + +size_t buffer2_length + +Length of the section data, including headers and CRC, + in buffer2. + + +__u16 pid + +The PID on which the section was received. Useful + for obtaining the descrambling key, e.g. from a DVB + Common Access facility. + + +RETURNS + + +0 + +The function was completed without errors. + + +-ENOSYS + +No descrambling facility available. + + +-EINVAL + +Bad parameter. + + + +
descramble_section_payload() +DESCRIPTION + + +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 “plug-in” descrambling facility to a demux driver. + + +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. + + +SYNOPSIS + + +int descramble_section_payload(dmx_demux_t⋆ demux, + __u8 ⋆buffer1, size_t buffer1_length, __u8 ⋆buffer2, + size_t buffer2_length, __u16 pid); + + +PARAMETERS + + +dmx_demux_t + *demux + +Pointer to the demux API and instance data. + + +__u8 *buffer1 + +Pointer to the first byte of the section. + + +size_t buffer1_length + +Length of the section data, including headers and CRC, + in buffer1. + + +__u8 *buffer2 + +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. + + +size_t buffer2_length + +Length of the section data, including headers and CRC, + in buffer2. + + +__u16 pid + +The PID on which the section was received. Useful + for obtaining the descrambling key, e.g. from a DVB + Common Access facility. + + +RETURNS + + +0 + +The function was completed without errors. + + +-ENOSYS + +No descrambling facility available. + + +-EINVAL + +Bad parameter. + + + +
add_frontend() +DESCRIPTION + + +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(). + + +SYNOPSIS + + +int add_frontend(dmx_demux_t ⋆demux, dmx_frontend_t + ⋆frontend); + + +PARAMETERS + + +dmx_demux_t* + demux + +Pointer to the demux API and instance data. + + +dmx_frontend_t* + frontend + +Pointer to the front-end instance data. + + +RETURNS + + +0 + +The function was completed without errors. + + +-EEXIST + +A front-end with the same value of the id field already + registered. + + +-EINUSE + +The demux is in use. + + +-ENOMEM + +No more front-ends can be added. + + +-EINVAL + +Bad parameter. + + + +
remove_frontend() +DESCRIPTION + + +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. + + +SYNOPSIS + + +int remove_frontend(dmx_demux_t⋆ demux, + dmx_frontend_t⋆ frontend); + + +PARAMETERS + + +dmx_demux_t* + demux + +Pointer to the demux API and instance data. + + +dmx_frontend_t* + frontend + +Pointer to the front-end instance data. + + +RETURNS + + +0 + +The function was completed without errors. + + +-EINVAL + +Bad parameter. + + +-EBUSY + +The front-end is in use, i.e. a call to connect_frontend() + has not been followed by a call to disconnect_frontend(). + + + +
get_frontends() +DESCRIPTION + + +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 + dmx_frontend_t*. The caller must not free the memory of any of the elements + obtained via this function call. + + +SYNOPSIS + + +struct list_head⋆ get_frontends(dmx_demux_t⋆ demux); + + +PARAMETERS + + +dmx_demux_t* + demux + +Pointer to the demux API and instance data. + + +RETURNS + + +dmx_demux_t* + +A list of front-end interfaces, or NULL in the case of an + empty list. + + + +
connect_frontend() +DESCRIPTION + + +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(). + + +SYNOPSIS + + +int connect_frontend(dmx_demux_t⋆ demux, + dmx_frontend_t⋆ frontend); + + +PARAMETERS + + +dmx_demux_t* + demux + +Pointer to the demux API and instance data. + + +dmx_frontend_t* + frontend + +Pointer to the front-end instance data. + + +RETURNS + + +0 + +The function was completed without errors. + + +-EINVAL + +Bad parameter. + + +-EBUSY + +The front-end is in use. + + + +
disconnect_frontend() +DESCRIPTION + + +Disconnects the demux and a front-end previously connected by a + connect_frontend() call. + + +SYNOPSIS + + +int disconnect_frontend(dmx_demux_t⋆ demux); + + +PARAMETERS + + +dmx_demux_t* + demux + +Pointer to the demux API and instance data. + + +RETURNS + + +0 + +The function was completed without errors. + + +-EINVAL + +Bad parameter. + + +
+
+Demux Callback API +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. + +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. + +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 “bottom half” mechanism or start a tasklet instead of making the callback +function call directly from a hardware interrupt. + + +
dmx_ts_cb() +DESCRIPTION + + +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. + + +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. + + +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. The error should be indicated to the + client on the next callback by setting the success parameter to the value of + DMX_OVERRUN_ERROR. + + +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—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. + + +SYNOPSIS + + +int dmx_ts_cb(__u8⋆ buffer1, size_t buffer1_length, + __u8⋆ buffer2, size_t buffer2_length, dmx_ts_feed_t⋆ + source, dmx_success_t success); + + +PARAMETERS + + +__u8* buffer1 + +Pointer to the start of the filtered TS packets. + + +size_t buffer1_length + +Length of the TS data in buffer1. + + +__u8* buffer2 + +Pointer to the tail of the filtered TS packets, or NULL. + + +size_t buffer2_length + +Length of the TS data in buffer2. + + +dmx_ts_feed_t* + source + +Indicates which TS feed is the source of the callback. + + +dmx_success_t + success + +Indicates if there was an error in TS reception. + + +RETURNS + + +0 + +Continue filtering. + + +-1 + +Stop filtering - has the same effect as a call to + stop_filtering() on the TS Feed API. + + + +
dmx_section_cb() +DESCRIPTION + + +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. + + +SYNOPSIS + + +int dmx_section_cb(__u8⋆ buffer1, size_t + buffer1_length, __u8⋆ buffer2, size_t + buffer2_length, dmx_section_filter_t⋆ source, + dmx_success_t success); + + +PARAMETERS + + +__u8* buffer1 + +Pointer to the start of the filtered section, e.g. within the + circular buffer of the demux driver. + + +size_t buffer1_length + +Length of the filtered section data in buffer1, including + headers and CRC. + + +__u8* buffer2 + +Pointer to the tail of the filtered section data, or NULL. + Useful to handle the wrapping of a circular buffer. + + +size_t buffer2_length + +Length of the filtered section data in buffer2, including + headers and CRC. + + +dmx_section_filter_t* + filter + +Indicates the filter that triggered the callback. + + +dmx_success_t + success + +Indicates if there was an error in section reception. + + +RETURNS + + +0 + +Continue filtering. + + +-1 + +Stop filtering - has the same effect as a call to + stop_filtering() on the Section Feed API. + + +
+
+TS Feed API +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. + +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. + + +
set() +DESCRIPTION + + +This function sets the parameters of a TS feed. Any filtering in progress on the + TS feed must be stopped before calling this function. + + +SYNOPSIS + + +int set ( dmx_ts_feed_t⋆ feed, __u16 pid, size_t + callback_length, size_t circular_buffer_size, int + descramble, struct timespec timeout); + + +PARAMETERS + + +dmx_ts_feed_t* feed + +Pointer to the TS feed API and instance data. + + +__u16 pid + +PID value to filter. Only the TS packets carrying the + specified PID will be passed to the API client. + + +size_t + callback_length + +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. + + +size_t + circular_buffer_size + +Size of the circular buffer for the filtered TS packets. + + +int descramble + +If non-zero, descramble the filtered TS packets. + + +struct timespec + timeout + +Maximum time to wait before delivering received TS + packets to the client. + + +RETURNS + + +0 + +The function was completed without errors. + + +-ENOMEM + +Not enough memory for the requested buffer size. + + +-ENOSYS + +No descrambling facility available for TS. + + +-EINVAL + +Bad parameter. + + + +
start_filtering() +DESCRIPTION + + +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(). + + +SYNOPSIS + + +int start_filtering(dmx_ts_feed_t⋆ feed); + + +PARAMETERS + + +dmx_ts_feed_t* feed + +Pointer to the TS feed API and instance data. + + +RETURNS + + +0 + +The function was completed without errors. + + +-EINVAL + +Bad parameter. + + + +
stop_filtering() +DESCRIPTION + + +Stops filtering TS packets on this TS feed. + + +SYNOPSIS + + +int stop_filtering(dmx_ts_feed_t⋆ feed); + + +PARAMETERS + + +dmx_ts_feed_t* feed + +Pointer to the TS feed API and instance data. + + +RETURNS + + +0 + +The function was completed without errors. + + +-EINVAL + +Bad parameter. + + +
+
+Section Feed API +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. + +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. + + +
+
+set() +DESCRIPTION + + +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. + + +SYNOPSIS + + +int set(dmx_section_feed_t⋆ feed, __u16 pid, size_t + circular_buffer_size, int descramble, int + check_crc); + + +PARAMETERS + + +dmx_section_feed_t* + feed + +Pointer to the section feed API and instance data. + + +__u16 pid + +PID value to filter; only the TS packets carrying the + specified PID will be accepted. + + +size_t + circular_buffer_size + +Size of the circular buffer for filtered sections. + + +int descramble + +If non-zero, descramble any sections that are scrambled. + + +int check_crc + +If non-zero, check the CRC values of filtered sections. + + +RETURNS + + +0 + +The function was completed without errors. + + +-ENOMEM + +Not enough memory for the requested buffer size. + + +-ENOSYS + +No descrambling facility available for sections. + + +-EINVAL + +Bad parameters. + + + +
allocate_filter() +DESCRIPTION + + +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. + + +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. + + +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 – thus this field is ignored, even though it is included in filter_value and + filter_mask fields. + + +SYNOPSIS + + +int allocate_filter(dmx_section_feed_t⋆ feed, + dmx_section_filter_t⋆⋆ filter); + + +PARAMETERS + + +dmx_section_feed_t* + feed + +Pointer to the section feed API and instance data. + + +dmx_section_filter_t** + filter + +Pointer to the allocated filter. + + +RETURNS + + +0 + +The function was completed without errors. + + +-ENOSPC + +No filters of given type and length available. + + +-EINVAL + +Bad parameters. + + + +
release_filter() +DESCRIPTION + + +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. + + +SYNOPSIS + + +int release_filter ( dmx_section_feed_t⋆ feed, + dmx_section_filter_t⋆ filter); + + +PARAMETERS + + +dmx_section_feed_t* + feed + +Pointer to the section feed API and instance data. + + +dmx_section_filter_t* + filter + +I/O Pointer to the instance data of a section filter. + + +RETURNS + + +0 + +The function was completed without errors. + + +-ENODEV + +No such filter allocated. + + +-EINVAL + +Bad parameter. + + + +
start_filtering() +DESCRIPTION + + +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(). + + +SYNOPSIS + + +int start_filtering ( dmx_section_feed_t⋆ feed ); + + +PARAMETERS + + +dmx_section_feed_t* + feed + +Pointer to the section feed API and instance data. + + +RETURNS + + +0 + +The function was completed without errors. + + +-EINVAL + +Bad parameter. + + + +
stop_filtering() +DESCRIPTION + + +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. + + +SYNOPSIS + + +int stop_filtering ( dmx_section_feed_t⋆ feed ); + + +PARAMETERS + + +dmx_section_feed_t* + feed + +Pointer to the section feed API and instance data. + + +RETURNS + + +0 + +The function was completed without errors. + + +-EINVAL + +Bad parameter. + + + +
diff --git a/Documentation/DocBook/media/dvb/net.xml b/Documentation/DocBook/media/dvb/net.xml new file mode 100644 index 000000000000..94e388d94c0d --- /dev/null +++ b/Documentation/DocBook/media/dvb/net.xml @@ -0,0 +1,12 @@ +DVB Network API +The DVB net device enables feeding of MPE (multi protocol encapsulation) packets +received via DVB into the Linux network protocol stack, e.g. for internet via satellite +applications. It can be accessed through /dev/dvb/adapter0/net0. Data types and +and ioctl definitions can be accessed by including linux/dvb/net.h in your +application. + +
+DVB Net Data Types +To be written… + +
diff --git a/Documentation/DocBook/media/dvb/video.xml b/Documentation/DocBook/media/dvb/video.xml new file mode 100644 index 000000000000..7bb287e67c8e --- /dev/null +++ b/Documentation/DocBook/media/dvb/video.xml @@ -0,0 +1,1971 @@ +DVB Video Device +The DVB video device controls the MPEG2 video decoder of the DVB hardware. It +can be accessed through /dev/dvb/adapter0/video0. Data types and and +ioctl definitions can be accessed by including linux/dvb/video.h in your +application. + +Note that the DVB video device only controls decoding of the MPEG video stream, not +its presentation on the TV or computer screen. On PCs this is typically handled by an +associated video4linux device, e.g. /dev/video, which allows scaling and defining output +windows. + +Some DVB cards don’t have their own MPEG decoder, which results in the omission of +the audio and video device as well as the video4linux device. + +The ioctls that deal with SPUs (sub picture units) and navigation packets are only +supported on some MPEG decoders made for DVD playback. + +
+Video Data Types + +
+video_format_t +The video_format_t data type defined by + + + typedef enum { + VIDEO_FORMAT_4_3, + VIDEO_FORMAT_16_9 + } video_format_t; + +is used in the VIDEO_SET_FORMAT function (??) to tell the driver which aspect ratio +the output hardware (e.g. TV) has. It is also used in the data structures video_status +(??) returned by VIDEO_GET_STATUS (??) and video_event (??) returned by +VIDEO_GET_EVENT (??) which report about the display format of the current video +stream. + +
+ +
+video_display_format_t +In case the display format of the video stream and of the display hardware differ the +application has to specify how to handle the cropping of the picture. This can be done using +the VIDEO_SET_DISPLAY_FORMAT call (??) which accepts + + + typedef enum { + VIDEO_PAN_SCAN, + VIDEO_LETTER_BOX, + VIDEO_CENTER_CUT_OUT + } video_display_format_t; + +as argument. + +
+ +
+video stream source +The video stream source is set through the VIDEO_SELECT_SOURCE call and can take +the following values, depending on whether we are replaying from an internal (demuxer) or +external (user write) source. + + + typedef enum { + VIDEO_SOURCE_DEMUX, + VIDEO_SOURCE_MEMORY + } video_stream_source_t; + +VIDEO_SOURCE_DEMUX selects the demultiplexer (fed either by the frontend or the +DVR device) as the source of the video stream. If VIDEO_SOURCE_MEMORY +is selected the stream comes from the application through the write() system +call. + +
+ +
+video play state +The following values can be returned by the VIDEO_GET_STATUS call representing the +state of video playback. + + + typedef enum { + VIDEO_STOPPED, + VIDEO_PLAYING, + VIDEO_FREEZED + } video_play_state_t; + +
+ +
+struct video_event +The following is the structure of a video event as it is returned by the VIDEO_GET_EVENT +call. + + + struct video_event { + int32_t type; + time_t timestamp; + union { + video_format_t video_format; + } u; + }; + +
+ +
+struct video_status +The VIDEO_GET_STATUS call returns the following structure informing about various +states of the playback operation. + + + struct video_status { + boolean video_blank; + video_play_state_t play_state; + video_stream_source_t stream_source; + video_format_t video_format; + video_displayformat_t display_format; + }; + +If video_blank is set video will be blanked out if the channel is changed or if playback is +stopped. Otherwise, the last picture will be displayed. play_state indicates if the video is +currently frozen, stopped, or being played back. The stream_source corresponds to the seleted +source for the video stream. It can come either from the demultiplexer or from memory. +The video_format indicates the aspect ratio (one of 4:3 or 16:9) of the currently +played video stream. Finally, display_format corresponds to the selected cropping +mode in case the source video format is not the same as the format of the output +device. + +
+ +
+struct video_still_picture +An I-frame displayed via the VIDEO_STILLPICTURE call is passed on within the +following structure. + + + /⋆ pointer to and size of a single iframe in memory ⋆/ + struct video_still_picture { + char ⋆iFrame; + int32_t size; + }; + +
+ +
+video capabilities +A call to VIDEO_GET_CAPABILITIES returns an unsigned integer with the following +bits set according to the hardwares capabilities. + + + /⋆ bit definitions for capabilities: ⋆/ + /⋆ can the hardware decode MPEG1 and/or MPEG2? ⋆/ + #define VIDEO_CAP_MPEG1 1 + #define VIDEO_CAP_MPEG2 2 + /⋆ can you send a system and/or program stream to video device? + (you still have to open the video and the audio device but only + send the stream to the video device) ⋆/ + #define VIDEO_CAP_SYS 4 + #define VIDEO_CAP_PROG 8 + /⋆ can the driver also handle SPU, NAVI and CSS encoded data? + (CSS API is not present yet) ⋆/ + #define VIDEO_CAP_SPU 16 + #define VIDEO_CAP_NAVI 32 + #define VIDEO_CAP_CSS 64 + +
+ +
+video system +A call to VIDEO_SET_SYSTEM sets the desired video system for TV output. The +following system types can be set: + + + typedef enum { + VIDEO_SYSTEM_PAL, + VIDEO_SYSTEM_NTSC, + VIDEO_SYSTEM_PALN, + VIDEO_SYSTEM_PALNc, + VIDEO_SYSTEM_PALM, + VIDEO_SYSTEM_NTSC60, + VIDEO_SYSTEM_PAL60, + VIDEO_SYSTEM_PALM60 + } video_system_t; + +
+ +
+struct video_highlight +Calling the ioctl VIDEO_SET_HIGHLIGHTS posts the SPU highlight information. The +call expects the following format for that information: + + + typedef + struct video_highlight { + boolean active; /⋆ 1=show highlight, 0=hide highlight ⋆/ + uint8_t contrast1; /⋆ 7- 4 Pattern pixel contrast ⋆/ + /⋆ 3- 0 Background pixel contrast ⋆/ + uint8_t contrast2; /⋆ 7- 4 Emphasis pixel-2 contrast ⋆/ + /⋆ 3- 0 Emphasis pixel-1 contrast ⋆/ + uint8_t color1; /⋆ 7- 4 Pattern pixel color ⋆/ + /⋆ 3- 0 Background pixel color ⋆/ + uint8_t color2; /⋆ 7- 4 Emphasis pixel-2 color ⋆/ + /⋆ 3- 0 Emphasis pixel-1 color ⋆/ + uint32_t ypos; /⋆ 23-22 auto action mode ⋆/ + /⋆ 21-12 start y ⋆/ + /⋆ 9- 0 end y ⋆/ + uint32_t xpos; /⋆ 23-22 button color number ⋆/ + /⋆ 21-12 start x ⋆/ + /⋆ 9- 0 end x ⋆/ + } video_highlight_t; + + +
+
+video SPU +Calling VIDEO_SET_SPU deactivates or activates SPU decoding, according to the +following format: + + + typedef + struct video_spu { + boolean active; + int stream_id; + } video_spu_t; + + +
+
+video SPU palette +The following structure is used to set the SPU palette by calling VIDEO_SPU_PALETTE: + + + typedef + struct video_spu_palette{ + int length; + uint8_t ⋆palette; + } video_spu_palette_t; + + +
+
+video NAVI pack +In order to get the navigational data the following structure has to be passed to the ioctl +VIDEO_GET_NAVI: + + + typedef + struct video_navi_pack{ + int length; /⋆ 0 ... 1024 ⋆/ + uint8_t data[1024]; + } video_navi_pack_t; + +
+ + +
+video attributes +The following attributes can be set by a call to VIDEO_SET_ATTRIBUTES: + + + typedef uint16_t video_attributes_t; + /⋆ bits: descr. ⋆/ + /⋆ 15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) ⋆/ + /⋆ 13-12 TV system (0=525/60, 1=625/50) ⋆/ + /⋆ 11-10 Aspect ratio (0=4:3, 3=16:9) ⋆/ + /⋆ 9- 8 permitted display mode on 4:3 monitor (0=both, 1=only pan-sca ⋆/ + /⋆ 7 line 21-1 data present in GOP (1=yes, 0=no) ⋆/ + /⋆ 6 line 21-2 data present in GOP (1=yes, 0=no) ⋆/ + /⋆ 5- 3 source resolution (0=720x480/576, 1=704x480/576, 2=352x480/57 ⋆/ + /⋆ 2 source letterboxed (1=yes, 0=no) ⋆/ + /⋆ 0 film/camera mode (0=camera, 1=film (625/50 only)) ⋆/ + +
+ + +
+Video Function Calls + + +
+open() +DESCRIPTION + + +This system call opens a named video device (e.g. /dev/dvb/adapter0/video0) + for subsequent use. +When an open() call has succeeded, the device will be ready for use. + The significance of blocking or non-blocking mode is described in the + documentation for functions where there is a difference. It does not affect the + semantics of the open() call itself. A device opened in blocking mode can later + be put into non-blocking mode (and vice versa) using the F_SETFL command + of the fcntl system call. This is a standard system call, documented in the Linux + manual page for fcntl. Only one user can open the Video Device in O_RDWR + mode. All other attempts to open the device in this mode will fail, and an + error-code will be returned. If the Video Device is opened in O_RDONLY + mode, the only ioctl call that can be used is VIDEO_GET_STATUS. All other + call will return an error code. + + + +SYNOPSIS + + +int open(const char ⋆deviceName, int flags); + + +PARAMETERS + + +const char + *deviceName + +Name of specific video device. + + +int flags + +A bit-wise OR of the following flags: + + + +O_RDONLY read-only access + + + +O_RDWR read/write access + + + +O_NONBLOCK open in non-blocking mode + + + +(blocking mode is the default) + + +ERRORS + + +ENODEV + +Device driver not loaded/available. + + +EINTERNAL + +Internal error. + + +EBUSY + +Device or resource busy. + + +EINVAL + +Invalid argument. + + + +
+
+close() +DESCRIPTION + + +This system call closes a previously opened video device. + + +SYNOPSIS + + +int close(int fd); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + + +
+
+write() +DESCRIPTION + + +This system call can only be used if VIDEO_SOURCE_MEMORY is selected + in the ioctl call VIDEO_SELECT_SOURCE. The data provided shall be in + PES format, unless the capability allows other formats. If O_NONBLOCK is + not specified the function will block until buffer space is available. The amount + of data to be transferred is implied by count. + + +SYNOPSIS + + +size_t write(int fd, const void ⋆buf, size_t count); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +void *buf + +Pointer to the buffer containing the PES data. + + +size_t count + +Size of buf. + + +ERRORS + + +EPERM + +Mode VIDEO_SOURCE_MEMORY not selected. + + +ENOMEM + +Attempted to write more data than the internal buffer can + hold. + + +EBADF + +fd is not a valid open file descriptor. + + + +
VIDEO_STOP +DESCRIPTION + + +This ioctl call asks the Video Device to stop playing the current stream. + Depending on the input parameter, the screen can be blanked out or displaying + the last decoded frame. + + +SYNOPSIS + + +int ioctl(fd, int request = VIDEO_STOP, boolean + mode); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals VIDEO_STOP for this command. + + +Boolean mode + +Indicates how the screen shall be handled. + + + +TRUE: Blank screen when stop. + + + +FALSE: Show last decoded frame. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EINTERNAL + +Internal error, possibly in the communication with the + DVB subsystem. + + + +
VIDEO_PLAY +DESCRIPTION + + +This ioctl call asks the Video Device to start playing a video stream from the + selected source. + + +SYNOPSIS + + +int ioctl(fd, int request = VIDEO_PLAY); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals VIDEO_PLAY for this command. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EINTERNAL + +Internal error, possibly in the communication with the + DVB subsystem. + + + +
VIDEO_FREEZE +DESCRIPTION + + +This ioctl call suspends the live video stream being played. Decoding + and playing are frozen. It is then possible to restart the decoding + and playing process of the video stream using the VIDEO_CONTINUE + command. If VIDEO_SOURCE_MEMORY is selected in the ioctl call + VIDEO_SELECT_SOURCE, the DVB subsystem will not decode any more + data until the ioctl call VIDEO_CONTINUE or VIDEO_PLAY is performed. + + +SYNOPSIS + + +int ioctl(fd, int request = VIDEO_FREEZE); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals VIDEO_FREEZE for this command. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EINTERNAL + +Internal error, possibly in the communication with the + DVB subsystem. + + + +
VIDEO_CONTINUE +DESCRIPTION + + +This ioctl call restarts decoding and playing processes of the video stream + which was played before a call to VIDEO_FREEZE was made. + + +SYNOPSIS + + +int ioctl(fd, int request = VIDEO_CONTINUE); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals VIDEO_CONTINUE for this command. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EINTERNAL + +Internal error, possibly in the communication with the + DVB subsystem. + + + +
VIDEO_SELECT_SOURCE +DESCRIPTION + + +This ioctl call informs the video device which source shall be used for the input + data. The possible sources are demux or memory. If memory is selected, the + data is fed to the video device through the write command. + + +SYNOPSIS + + +int ioctl(fd, int request = VIDEO_SELECT_SOURCE, + video_stream_source_t source); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals VIDEO_SELECT_SOURCE for this command. + + +video_stream_source_t + source + +Indicates which source shall be used for the Video stream. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EINTERNAL + +Internal error, possibly in the communication with the + DVB subsystem. + + + +
VIDEO_SET_BLANK +DESCRIPTION + + +This ioctl call asks the Video Device to blank out the picture. + + +SYNOPSIS + + +int ioctl(fd, int request = VIDEO_SET_BLANK, boolean + mode); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals VIDEO_SET_BLANK for this command. + + +boolean mode + +TRUE: Blank screen when stop. + + + +FALSE: Show last decoded frame. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EINTERNAL + +Internal error, possibly in the communication with the + DVB subsystem. + + +EINVAL + +Illegal input parameter + + + +
VIDEO_GET_STATUS +DESCRIPTION + + +This ioctl call asks the Video Device to return the current status of the device. + + +SYNOPSIS + + + int ioctl(fd, int request = VIDEO_GET_STATUS, struct + video_status ⋆status); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals VIDEO_GET_STATUS for this command. + + +struct video_status + *status + +Returns the current status of the Video Device. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EINTERNAL + +Internal error, possibly in the communication with the + DVB subsystem. + + +EFAULT + +status points to invalid address + + + +
VIDEO_GET_EVENT +DESCRIPTION + + +This ioctl call returns an event of type video_event if available. If an event is + not available, the behavior depends on whether the device is in blocking or + non-blocking mode. In the latter case, the call fails immediately with errno + set to EWOULDBLOCK. In the former case, the call blocks until an event + becomes available. The standard Linux poll() and/or select() system calls can + be used with the device file descriptor to watch for new events. For select(), + the file descriptor should be included in the exceptfds argument, and for + poll(), POLLPRI should be specified as the wake-up condition. Read-only + permissions are sufficient for this ioctl call. + + +SYNOPSIS + + + int ioctl(fd, int request = VIDEO_GET_EVENT, struct + video_event ⋆ev); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals VIDEO_GET_EVENT for this command. + + +struct video_event + *ev + +Points to the location where the event, if any, is to be + stored. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EFAULT + +ev points to invalid address + + +EWOULDBLOCK + +There is no event pending, and the device is in + non-blocking mode. + + +EOVERFLOW + + + + +Overflow in event queue - one or more events were lost. + + + +
VIDEO_SET_DISPLAY_FORMAT +DESCRIPTION + + +This ioctl call asks the Video Device to select the video format to be applied + by the MPEG chip on the video. + + +SYNOPSIS + + + int ioctl(fd, int request = + VIDEO_SET_DISPLAY_FORMAT, video_display_format_t + format); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals VIDEO_SET_DISPLAY_FORMAT for this + command. + + +video_display_format_t + format + +Selects the video format to be used. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EINTERNAL + +Internal error. + + +EINVAL + +Illegal parameter format. + + + +
VIDEO_STILLPICTURE +DESCRIPTION + + +This ioctl call asks the Video Device to display a still picture (I-frame). The + input data shall contain an I-frame. If the pointer is NULL, then the current + displayed still picture is blanked. + + +SYNOPSIS + + +int ioctl(fd, int request = VIDEO_STILLPICTURE, + struct video_still_picture ⋆sp); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals VIDEO_STILLPICTURE for this command. + + +struct + video_still_picture + *sp + +Pointer to a location where an I-frame and size is stored. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EINTERNAL + +Internal error. + + +EFAULT + +sp points to an invalid iframe. + + + +
VIDEO_FAST_FORWARD +DESCRIPTION + + +This ioctl call asks the Video Device to skip decoding of N number of I-frames. + This call can only be used if VIDEO_SOURCE_MEMORY is selected. + + +SYNOPSIS + + +int ioctl(fd, int request = VIDEO_FAST_FORWARD, int + nFrames); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals VIDEO_FAST_FORWARD for this command. + + +int nFrames + +The number of frames to skip. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EINTERNAL + +Internal error. + + +EPERM + +Mode VIDEO_SOURCE_MEMORY not selected. + + +EINVAL + +Illegal parameter format. + + + +
VIDEO_SLOWMOTION +DESCRIPTION + + +This ioctl call asks the video device to repeat decoding frames N number of + times. This call can only be used if VIDEO_SOURCE_MEMORY is selected. + + +SYNOPSIS + + +int ioctl(fd, int request = VIDEO_SLOWMOTION, int + nFrames); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals VIDEO_SLOWMOTION for this command. + + +int nFrames + +The number of times to repeat each frame. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EINTERNAL + +Internal error. + + +EPERM + +Mode VIDEO_SOURCE_MEMORY not selected. + + +EINVAL + +Illegal parameter format. + + + +
VIDEO_GET_CAPABILITIES +DESCRIPTION + + +This ioctl call asks the video device about its decoding capabilities. On success + it returns and integer which has bits set according to the defines in section ??. + + +SYNOPSIS + + +int ioctl(fd, int request = VIDEO_GET_CAPABILITIES, + unsigned int ⋆cap); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals VIDEO_GET_CAPABILITIES for this + command. + + +unsigned int *cap + +Pointer to a location where to store the capability + information. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EFAULT + +cap points to an invalid iframe. + + + +
VIDEO_SET_ID +DESCRIPTION + + +This ioctl selects which sub-stream is to be decoded if a program or system + stream is sent to the video device. + + +SYNOPSIS + + +int ioctl(int fd, int request = VIDEO_SET_ID, int + id); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals VIDEO_SET_ID for this command. + + +int id + +video sub-stream id + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + +EINTERNAL + +Internal error. + + +EINVAL + +Invalid sub-stream id. + + + +
VIDEO_CLEAR_BUFFER +DESCRIPTION + + +This ioctl call clears all video buffers in the driver and in the decoder hardware. + + +SYNOPSIS + + +int ioctl(fd, int request = VIDEO_CLEAR_BUFFER); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals VIDEO_CLEAR_BUFFER for this command. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + + +
VIDEO_SET_STREAMTYPE +DESCRIPTION + + +This ioctl tells the driver which kind of stream to expect being written to it. If + this call is not used the default of video PES is used. Some drivers might not + support this call and always expect PES. + + +SYNOPSIS + + +int ioctl(fd, int request = VIDEO_SET_STREAMTYPE, + int type); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals VIDEO_SET_STREAMTYPE for this command. + + +int type + +stream type + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EINVAL + +type is not a valid or supported stream type. + + + +
VIDEO_SET_FORMAT +DESCRIPTION + + +This ioctl sets the screen format (aspect ratio) of the connected output device + (TV) so that the output of the decoder can be adjusted accordingly. + + +SYNOPSIS + + + int ioctl(fd, int request = VIDEO_SET_FORMAT, + video_format_t format); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals VIDEO_SET_FORMAT for this command. + + +video_format_t + format + +video format of TV as defined in section ??. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EINVAL + +format is not a valid video format. + + + +
VIDEO_SET_SYSTEM +DESCRIPTION + + +This ioctl sets the television output format. The format (see section ??) may + vary from the color format of the displayed MPEG stream. If the hardware is + not able to display the requested format the call will return an error. + + +SYNOPSIS + + + int ioctl(fd, int request = VIDEO_SET_SYSTEM , + video_system_t system); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals VIDEO_SET_FORMAT for this command. + + +video_system_t + system + +video system of TV output. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EINVAL + +system is not a valid or supported video system. + + + +
VIDEO_SET_HIGHLIGHT +DESCRIPTION + + +This ioctl sets the SPU highlight information for the menu access of a DVD. + + +SYNOPSIS + + + int ioctl(fd, int request = VIDEO_SET_HIGHLIGHT + ,video_highlight_t ⋆vhilite) + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals VIDEO_SET_HIGHLIGHT for this command. + + +video_highlight_t + *vhilite + +SPU Highlight information according to section ??. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + +EINVAL + +input is not a valid highlight setting. + + + +
VIDEO_SET_SPU +DESCRIPTION + + +This ioctl activates or deactivates SPU decoding in a DVD input stream. It can + only be used, if the driver is able to handle a DVD stream. + + +SYNOPSIS + + + int ioctl(fd, int request = VIDEO_SET_SPU , + video_spu_t ⋆spu) + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals VIDEO_SET_SPU for this command. + + +video_spu_t *spu + +SPU decoding (de)activation and subid setting according + to section ??. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EINVAL + +input is not a valid spu setting or driver cannot handle + SPU. + + + +
VIDEO_SET_SPU_PALETTE +DESCRIPTION + + +This ioctl sets the SPU color palette. + + +SYNOPSIS + + + int ioctl(fd, int request = VIDEO_SET_SPU_PALETTE + ,video_spu_palette_t ⋆palette ) + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals VIDEO_SET_SPU_PALETTE for this command. + + +video_spu_palette_t + *palette + +SPU palette according to section ??. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EINVAL + +input is not a valid palette or driver doesn’t handle SPU. + + + +
VIDEO_GET_NAVI +DESCRIPTION + + +This ioctl returns navigational information from the DVD stream. This is + especially needed if an encoded stream has to be decoded by the hardware. + + +SYNOPSIS + + + int ioctl(fd, int request = VIDEO_GET_NAVI , + video_navi_pack_t ⋆navipack) + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals VIDEO_GET_NAVI for this command. + + +video_navi_pack_t + *navipack + +PCI or DSI pack (private stream 2) according to section + ??. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EFAULT + +driver is not able to return navigational information + + + +
VIDEO_SET_ATTRIBUTES +DESCRIPTION + + +This ioctl is intended for DVD playback and allows you to set certain + information about the stream. Some hardware may not need this information, + but the call also tells the hardware to prepare for DVD playback. + + +SYNOPSIS + + + int ioctl(fd, int request = VIDEO_SET_ATTRIBUTE + ,video_attributes_t vattr) + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals VIDEO_SET_ATTRIBUTE for this command. + + +video_attributes_t + vattr + +video attributes according to section ??. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor + + +EINVAL + +input is not a valid attribute setting. + + +
diff --git a/Documentation/DocBook/media/v4l/.gitignore b/Documentation/DocBook/media/v4l/.gitignore new file mode 100644 index 000000000000..d7ec32eafac9 --- /dev/null +++ b/Documentation/DocBook/media/v4l/.gitignore @@ -0,0 +1 @@ +!*.xml diff --git a/Documentation/DocBook/media/v4l/bayer.pdf b/Documentation/DocBook/media/v4l/bayer.pdf new file mode 100644 index 000000000000..905e60e6cd42 Binary files /dev/null and b/Documentation/DocBook/media/v4l/bayer.pdf differ diff --git a/Documentation/DocBook/media/v4l/bayer.png b/Documentation/DocBook/media/v4l/bayer.png new file mode 100644 index 000000000000..9b15fb22e817 Binary files /dev/null and b/Documentation/DocBook/media/v4l/bayer.png differ diff --git a/Documentation/DocBook/media/v4l/biblio.xml b/Documentation/DocBook/media/v4l/biblio.xml new file mode 100644 index 000000000000..afc8a0dd2601 --- /dev/null +++ b/Documentation/DocBook/media/v4l/biblio.xml @@ -0,0 +1,188 @@ + + References + + + EIA 608-B + + Electronic Industries Alliance (http://www.eia.org) + + EIA 608-B "Recommended Practice for Line 21 Data +Service" + + + + EN 300 294 + + European Telecommunication Standards Institute +(http://www.etsi.org) + + EN 300 294 "625-line television Wide Screen Signalling +(WSS)" + + + + ETS 300 231 + + European Telecommunication Standards Institute +(http://www.etsi.org) + + ETS 300 231 "Specification of the domestic video +Programme Delivery Control system (PDC)" + + + + ETS 300 706 + + European Telecommunication Standards Institute +(http://www.etsi.org) + + ETS 300 706 "Enhanced Teletext specification" + + + + ISO 13818-1 + + International Telecommunication Union (http://www.itu.ch), International +Organisation for Standardisation (http://www.iso.ch) + + ITU-T Rec. H.222.0 | ISO/IEC 13818-1 "Information +technology — Generic coding of moving pictures and associated +audio information: Systems" + + + + ISO 13818-2 + + International Telecommunication Union (http://www.itu.ch), International +Organisation for Standardisation (http://www.iso.ch) + + ITU-T Rec. H.262 | ISO/IEC 13818-2 "Information +technology — Generic coding of moving pictures and associated +audio information: Video" + + + + ITU BT.470 + + International Telecommunication Union (http://www.itu.ch) + + ITU-R Recommendation BT.470-6 "Conventional Television +Systems" + + + + ITU BT.601 + + International Telecommunication Union (http://www.itu.ch) + + ITU-R Recommendation BT.601-5 "Studio Encoding Parameters +of Digital Television for Standard 4:3 and Wide-Screen 16:9 Aspect +Ratios" + + + + ITU BT.653 + + International Telecommunication Union (http://www.itu.ch) + + ITU-R Recommendation BT.653-3 "Teletext systems" + + + + ITU BT.709 + + International Telecommunication Union (http://www.itu.ch) + + ITU-R Recommendation BT.709-5 "Parameter values for the +HDTV standards for production and international programme +exchange" + + + + ITU BT.1119 + + International Telecommunication Union (http://www.itu.ch) + + ITU-R Recommendation BT.1119 "625-line +television Wide Screen Signalling (WSS)" + + + + JFIF + + Independent JPEG Group (http://www.ijg.org) + + JPEG File Interchange Format + Version 1.02 + + + + SMPTE 12M + + Society of Motion Picture and Television Engineers +(http://www.smpte.org) + + SMPTE 12M-1999 "Television, Audio and Film - Time and +Control Code" + + + + SMPTE 170M + + Society of Motion Picture and Television Engineers +(http://www.smpte.org) + + SMPTE 170M-1999 "Television - Composite Analog Video +Signal - NTSC for Studio Applications" + + + + SMPTE 240M + + Society of Motion Picture and Television Engineers +(http://www.smpte.org) + + SMPTE 240M-1999 "Television - Signal Parameters - +1125-Line High-Definition Production" + + + + EN 50067 + + European Committee for Electrotechnical Standardization +(http://www.cenelec.eu) + + Specification of the radio data system (RDS) for VHF/FM sound broadcasting +in the frequency range from 87,5 to 108,0 MHz + + + + NRSC-4 + + National Radio Systems Committee +(http://www.nrscstandards.org) + + NTSC-4: United States RBDS Standard + + + + + diff --git a/Documentation/DocBook/media/v4l/capture.c.xml b/Documentation/DocBook/media/v4l/capture.c.xml new file mode 100644 index 000000000000..1c5c49a2de59 --- /dev/null +++ b/Documentation/DocBook/media/v4l/capture.c.xml @@ -0,0 +1,659 @@ + +/* + * V4L2 video capture example + * + * This program can be used and distributed without restrictions. + * + * This program is provided with the V4L2 API + * see http://linuxtv.org/docs.php for more information + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> + +#include <getopt.h> /* getopt_long() */ + +#include <fcntl.h> /* low-level i/o */ +#include <unistd.h> +#include <errno.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <sys/time.h> +#include <sys/mman.h> +#include <sys/ioctl.h> + +#include <linux/videodev2.h> + +#define CLEAR(x) memset(&(x), 0, sizeof(x)) + +enum io_method { + IO_METHOD_READ, + IO_METHOD_MMAP, + IO_METHOD_USERPTR, +}; + +struct buffer { + void *start; + size_t length; +}; + +static char *dev_name; +static enum io_method io = IO_METHOD_MMAP; +static int fd = -1; +struct buffer *buffers; +static unsigned int n_buffers; +static int out_buf; +static int force_format; +static int frame_count = 70; + +static void errno_exit(const char *s) +{ + fprintf(stderr, "%s error %d, %s\n", s, errno, strerror(errno)); + exit(EXIT_FAILURE); +} + +static int xioctl(int fh, int request, void *arg) +{ + int r; + + do { + r = ioctl(fh, request, arg); + } while (-1 == r && EINTR == errno); + + return r; +} + +static void process_image(const void *p, int size) +{ + if (out_buf) + fwrite(p, size, 1, stdout); + + fflush(stderr); + fprintf(stderr, "."); + fflush(stdout); +} + +static int read_frame(void) +{ + struct v4l2_buffer buf; + unsigned int i; + + switch (io) { + case IO_METHOD_READ: + if (-1 == read(fd, buffers[0].start, buffers[0].length)) { + switch (errno) { + case EAGAIN: + return 0; + + case EIO: + /* Could ignore EIO, see spec. */ + + /* fall through */ + + default: + errno_exit("read"); + } + } + + process_image(buffers[0].start, buffers[0].length); + break; + + case IO_METHOD_MMAP: + CLEAR(buf); + + buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + buf.memory = V4L2_MEMORY_MMAP; + + if (-1 == xioctl(fd, VIDIOC_DQBUF, &buf)) { + switch (errno) { + case EAGAIN: + return 0; + + case EIO: + /* Could ignore EIO, see spec. */ + + /* fall through */ + + default: + errno_exit("VIDIOC_DQBUF"); + } + } + + assert(buf.index < n_buffers); + + process_image(buffers[buf.index].start, buf.bytesused); + + if (-1 == xioctl(fd, VIDIOC_QBUF, &buf)) + errno_exit("VIDIOC_QBUF"); + break; + + case IO_METHOD_USERPTR: + CLEAR(buf); + + buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + buf.memory = V4L2_MEMORY_USERPTR; + + if (-1 == xioctl(fd, VIDIOC_DQBUF, &buf)) { + switch (errno) { + case EAGAIN: + return 0; + + case EIO: + /* Could ignore EIO, see spec. */ + + /* fall through */ + + default: + errno_exit("VIDIOC_DQBUF"); + } + } + + for (i = 0; i < n_buffers; ++i) + if (buf.m.userptr == (unsigned long)buffers[i].start + && buf.length == buffers[i].length) + break; + + assert(i < n_buffers); + + process_image((void *)buf.m.userptr, buf.bytesused); + + if (-1 == xioctl(fd, VIDIOC_QBUF, &buf)) + errno_exit("VIDIOC_QBUF"); + break; + } + + return 1; +} + +static void mainloop(void) +{ + unsigned int count; + + count = frame_count; + + while (count-- > 0) { + for (;;) { + fd_set fds; + struct timeval tv; + int r; + + FD_ZERO(&fds); + FD_SET(fd, &fds); + + /* Timeout. */ + tv.tv_sec = 2; + tv.tv_usec = 0; + + r = select(fd + 1, &fds, NULL, NULL, &tv); + + if (-1 == r) { + if (EINTR == errno) + continue; + errno_exit("select"); + } + + if (0 == r) { + fprintf(stderr, "select timeout\n"); + exit(EXIT_FAILURE); + } + + if (read_frame()) + break; + /* EAGAIN - continue select loop. */ + } + } +} + +static void stop_capturing(void) +{ + enum v4l2_buf_type type; + + switch (io) { + case IO_METHOD_READ: + /* Nothing to do. */ + break; + + case IO_METHOD_MMAP: + case IO_METHOD_USERPTR: + type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + if (-1 == xioctl(fd, VIDIOC_STREAMOFF, &type)) + errno_exit("VIDIOC_STREAMOFF"); + break; + } +} + +static void start_capturing(void) +{ + unsigned int i; + enum v4l2_buf_type type; + + switch (io) { + case IO_METHOD_READ: + /* Nothing to do. */ + break; + + case IO_METHOD_MMAP: + for (i = 0; i < n_buffers; ++i) { + struct v4l2_buffer buf; + + CLEAR(buf); + buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + buf.memory = V4L2_MEMORY_MMAP; + buf.index = i; + + if (-1 == xioctl(fd, VIDIOC_QBUF, &buf)) + errno_exit("VIDIOC_QBUF"); + } + type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + if (-1 == xioctl(fd, VIDIOC_STREAMON, &type)) + errno_exit("VIDIOC_STREAMON"); + break; + + case IO_METHOD_USERPTR: + for (i = 0; i < n_buffers; ++i) { + struct v4l2_buffer buf; + + CLEAR(buf); + buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + buf.memory = V4L2_MEMORY_USERPTR; + buf.index = i; + buf.m.userptr = (unsigned long)buffers[i].start; + buf.length = buffers[i].length; + + if (-1 == xioctl(fd, VIDIOC_QBUF, &buf)) + errno_exit("VIDIOC_QBUF"); + } + type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + if (-1 == xioctl(fd, VIDIOC_STREAMON, &type)) + errno_exit("VIDIOC_STREAMON"); + break; + } +} + +static void uninit_device(void) +{ + unsigned int i; + + switch (io) { + case IO_METHOD_READ: + free(buffers[0].start); + break; + + case IO_METHOD_MMAP: + for (i = 0; i < n_buffers; ++i) + if (-1 == munmap(buffers[i].start, buffers[i].length)) + errno_exit("munmap"); + break; + + case IO_METHOD_USERPTR: + for (i = 0; i < n_buffers; ++i) + free(buffers[i].start); + break; + } + + free(buffers); +} + +static void init_read(unsigned int buffer_size) +{ + buffers = calloc(1, sizeof(*buffers)); + + if (!buffers) { + fprintf(stderr, "Out of memory\n"); + exit(EXIT_FAILURE); + } + + buffers[0].length = buffer_size; + buffers[0].start = malloc(buffer_size); + + if (!buffers[0].start) { + fprintf(stderr, "Out of memory\n"); + exit(EXIT_FAILURE); + } +} + +static void init_mmap(void) +{ + struct v4l2_requestbuffers req; + + CLEAR(req); + + req.count = 4; + req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + req.memory = V4L2_MEMORY_MMAP; + + if (-1 == xioctl(fd, VIDIOC_REQBUFS, &req)) { + if (EINVAL == errno) { + fprintf(stderr, "%s does not support " + "memory mapping\n", dev_name); + exit(EXIT_FAILURE); + } else { + errno_exit("VIDIOC_REQBUFS"); + } + } + + if (req.count < 2) { + fprintf(stderr, "Insufficient buffer memory on %s\n", + dev_name); + exit(EXIT_FAILURE); + } + + buffers = calloc(req.count, sizeof(*buffers)); + + if (!buffers) { + fprintf(stderr, "Out of memory\n"); + exit(EXIT_FAILURE); + } + + for (n_buffers = 0; n_buffers < req.count; ++n_buffers) { + struct v4l2_buffer buf; + + CLEAR(buf); + + buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + buf.memory = V4L2_MEMORY_MMAP; + buf.index = n_buffers; + + if (-1 == xioctl(fd, VIDIOC_QUERYBUF, &buf)) + errno_exit("VIDIOC_QUERYBUF"); + + buffers[n_buffers].length = buf.length; + buffers[n_buffers].start = + mmap(NULL /* start anywhere */, + buf.length, + PROT_READ | PROT_WRITE /* required */, + MAP_SHARED /* recommended */, + fd, buf.m.offset); + + if (MAP_FAILED == buffers[n_buffers].start) + errno_exit("mmap"); + } +} + +static void init_userp(unsigned int buffer_size) +{ + struct v4l2_requestbuffers req; + + CLEAR(req); + + req.count = 4; + req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + req.memory = V4L2_MEMORY_USERPTR; + + if (-1 == xioctl(fd, VIDIOC_REQBUFS, &req)) { + if (EINVAL == errno) { + fprintf(stderr, "%s does not support " + "user pointer i/o\n", dev_name); + exit(EXIT_FAILURE); + } else { + errno_exit("VIDIOC_REQBUFS"); + } + } + + buffers = calloc(4, sizeof(*buffers)); + + if (!buffers) { + fprintf(stderr, "Out of memory\n"); + exit(EXIT_FAILURE); + } + + for (n_buffers = 0; n_buffers < 4; ++n_buffers) { + buffers[n_buffers].length = buffer_size; + buffers[n_buffers].start = malloc(buffer_size); + + if (!buffers[n_buffers].start) { + fprintf(stderr, "Out of memory\n"); + exit(EXIT_FAILURE); + } + } +} + +static void init_device(void) +{ + struct v4l2_capability cap; + struct v4l2_cropcap cropcap; + struct v4l2_crop crop; + struct v4l2_format fmt; + unsigned int min; + + if (-1 == xioctl(fd, VIDIOC_QUERYCAP, &cap)) { + if (EINVAL == errno) { + fprintf(stderr, "%s is no V4L2 device\n", + dev_name); + exit(EXIT_FAILURE); + } else { + errno_exit("VIDIOC_QUERYCAP"); + } + } + + if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) { + fprintf(stderr, "%s is no video capture device\n", + dev_name); + exit(EXIT_FAILURE); + } + + switch (io) { + case IO_METHOD_READ: + if (!(cap.capabilities & V4L2_CAP_READWRITE)) { + fprintf(stderr, "%s does not support read i/o\n", + dev_name); + exit(EXIT_FAILURE); + } + break; + + case IO_METHOD_MMAP: + case IO_METHOD_USERPTR: + if (!(cap.capabilities & V4L2_CAP_STREAMING)) { + fprintf(stderr, "%s does not support streaming i/o\n", + dev_name); + exit(EXIT_FAILURE); + } + break; + } + + + /* Select video input, video standard and tune here. */ + + + CLEAR(cropcap); + + cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + + if (0 == xioctl(fd, VIDIOC_CROPCAP, &cropcap)) { + crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + crop.c = cropcap.defrect; /* reset to default */ + + if (-1 == xioctl(fd, VIDIOC_S_CROP, &crop)) { + switch (errno) { + case EINVAL: + /* Cropping not supported. */ + break; + default: + /* Errors ignored. */ + break; + } + } + } else { + /* Errors ignored. */ + } + + + CLEAR(fmt); + + fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + if (force_format) { + fmt.fmt.pix.width = 640; + fmt.fmt.pix.height = 480; + fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV; + fmt.fmt.pix.field = V4L2_FIELD_INTERLACED; + + if (-1 == xioctl(fd, VIDIOC_S_FMT, &fmt)) + errno_exit("VIDIOC_S_FMT"); + + /* Note VIDIOC_S_FMT may change width and height. */ + } else { + /* Preserve original settings as set by v4l2-ctl for example */ + if (-1 == xioctl(fd, VIDIOC_G_FMT, &fmt)) + errno_exit("VIDIOC_G_FMT"); + } + + /* Buggy driver paranoia. */ + min = fmt.fmt.pix.width * 2; + if (fmt.fmt.pix.bytesperline < min) + fmt.fmt.pix.bytesperline = min; + min = fmt.fmt.pix.bytesperline * fmt.fmt.pix.height; + if (fmt.fmt.pix.sizeimage < min) + fmt.fmt.pix.sizeimage = min; + + switch (io) { + case IO_METHOD_READ: + init_read(fmt.fmt.pix.sizeimage); + break; + + case IO_METHOD_MMAP: + init_mmap(); + break; + + case IO_METHOD_USERPTR: + init_userp(fmt.fmt.pix.sizeimage); + break; + } +} + +static void close_device(void) +{ + if (-1 == close(fd)) + errno_exit("close"); + + fd = -1; +} + +static void open_device(void) +{ + struct stat st; + + if (-1 == stat(dev_name, &st)) { + fprintf(stderr, "Cannot identify '%s': %d, %s\n", + dev_name, errno, strerror(errno)); + exit(EXIT_FAILURE); + } + + if (!S_ISCHR(st.st_mode)) { + fprintf(stderr, "%s is no device\n", dev_name); + exit(EXIT_FAILURE); + } + + fd = open(dev_name, O_RDWR /* required */ | O_NONBLOCK, 0); + + if (-1 == fd) { + fprintf(stderr, "Cannot open '%s': %d, %s\n", + dev_name, errno, strerror(errno)); + exit(EXIT_FAILURE); + } +} + +static void usage(FILE *fp, int argc, char **argv) +{ + fprintf(fp, + "Usage: %s [options]\n\n" + "Version 1.3\n" + "Options:\n" + "-d | --device name Video device name [%s]\n" + "-h | --help Print this message\n" + "-m | --mmap Use memory mapped buffers [default]\n" + "-r | --read Use read() calls\n" + "-u | --userp Use application allocated buffers\n" + "-o | --output Outputs stream to stdout\n" + "-f | --format Force format to 640x480 YUYV\n" + "-c | --count Number of frames to grab [%i]\n" + "", + argv[0], dev_name, frame_count); +} + +static const char short_options[] = "d:hmruofc:"; + +static const struct option +long_options[] = { + { "device", required_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + { "mmap", no_argument, NULL, 'm' }, + { "read", no_argument, NULL, 'r' }, + { "userp", no_argument, NULL, 'u' }, + { "output", no_argument, NULL, 'o' }, + { "format", no_argument, NULL, 'f' }, + { "count", required_argument, NULL, 'c' }, + { 0, 0, 0, 0 } +}; + +int main(int argc, char **argv) +{ + dev_name = "/dev/video0"; + + for (;;) { + int idx; + int c; + + c = getopt_long(argc, argv, + short_options, long_options, &idx); + + if (-1 == c) + break; + + switch (c) { + case 0: /* getopt_long() flag */ + break; + + case 'd': + dev_name = optarg; + break; + + case 'h': + usage(stdout, argc, argv); + exit(EXIT_SUCCESS); + + case 'm': + io = IO_METHOD_MMAP; + break; + + case 'r': + io = IO_METHOD_READ; + break; + + case 'u': + io = IO_METHOD_USERPTR; + break; + + case 'o': + out_buf++; + break; + + case 'f': + force_format++; + break; + + case 'c': + errno = 0; + frame_count = strtol(optarg, NULL, 0); + if (errno) + errno_exit(optarg); + break; + + default: + usage(stderr, argc, argv); + exit(EXIT_FAILURE); + } + } + + open_device(); + init_device(); + start_capturing(); + mainloop(); + stop_capturing(); + uninit_device(); + close_device(); + fprintf(stderr, "\n"); + return 0; +} + diff --git a/Documentation/DocBook/media/v4l/common.xml b/Documentation/DocBook/media/v4l/common.xml new file mode 100644 index 000000000000..9028721438dc --- /dev/null +++ b/Documentation/DocBook/media/v4l/common.xml @@ -0,0 +1,1197 @@ + Common API Elements + + Programming a V4L2 device consists of these +steps: + + + + Opening the device + + + Changing device properties, selecting a video and audio +input, video standard, picture brightness a. o. + + + Negotiating a data format + + + Negotiating an input/output method + + + The actual input/output loop + + + Closing the device + + + + In practice most steps are optional and can be executed out of +order. It depends on the V4L2 device type, you can read about the +details in . In this chapter we will discuss +the basic concepts applicable to all devices. + +
+ Opening and Closing Devices + +
+ Device Naming + + V4L2 drivers are implemented as kernel modules, loaded +manually by the system administrator or automatically when a device is +first opened. The driver modules plug into the "videodev" kernel +module. It provides helper functions and a common application +interface specified in this document. + + Each driver thus loaded registers one or more device nodes +with major number 81 and a minor number between 0 and 255. Assigning +minor numbers to V4L2 devices is entirely up to the system administrator, +this is primarily intended to solve conflicts between devices. + Access permissions are associated with character +device special files, hence we must ensure device numbers cannot +change with the module load order. To this end minor numbers are no +longer automatically assigned by the "videodev" module as in V4L but +requested by the driver. The defaults will suffice for most people +unless two drivers compete for the same minor numbers. + The module options to select minor numbers are named +after the device special file with a "_nr" suffix. For example "video_nr" +for /dev/video video capture devices. The number is +an offset to the base minor number associated with the device type. + + In earlier versions of the V4L2 API the module options +where named after the device special file with a "unit_" prefix, expressing +the minor number itself, not an offset. Rationale for this change is unknown. +Lastly the naming and semantics are just a convention among driver writers, +the point to note is that minor numbers are not supposed to be hardcoded +into drivers. + When the driver supports multiple devices of the same +type more than one minor number can be assigned, separated by commas: + + +> insmod mydriver.o video_nr=0,1 radio_nr=0,1 + + + In /etc/modules.conf this may be +written as: + +alias char-major-81-0 mydriver +alias char-major-81-1 mydriver +alias char-major-81-64 mydriver +options mydriver video_nr=0,1 radio_nr=0,1 + + + + When an application attempts to open a device +special file with major number 81 and minor number 0, 1, or 64, load +"mydriver" (and the "videodev" module it depends upon). + + + Register the first two video capture devices with +minor number 0 and 1 (base number is 0), the first two radio device +with minor number 64 and 65 (base 64). + + + When no minor number is given as module +option the driver supplies a default. +recommends the base minor numbers to be used for the various device +types. Obviously minor numbers must be unique. When the number is +already in use the offending device will not be +registered. + + By convention system administrators create various +character device special files with these major and minor numbers in +the /dev directory. The names recommended for the +different V4L2 device types are listed in . + + + The creation of character special files (with +mknod) is a privileged operation and +devices cannot be opened by major and minor number. That means +applications cannot reliable scan for loaded or +installed drivers. The user must enter a device name, or the +application can try the conventional device names. + + Under the device filesystem (devfs) the minor number +options are ignored. V4L2 drivers (or by proxy the "videodev" module) +automatically create the required device files in the +/dev/v4l directory using the conventional device +names above. +
+ + + +
+ Multiple Opens + + In general, V4L2 devices can be opened more than once. +When this is supported by the driver, users can for example start a +"panel" application to change controls like brightness or audio +volume, while another application captures video and audio. In other words, panel +applications are comparable to an OSS or ALSA audio mixer application. +When a device supports multiple functions like capturing and overlay +simultaneously, multiple opens allow concurrent +use of the device by forked processes or specialized applications. + + Multiple opens are optional, although drivers should +permit at least concurrent accesses without data exchange, &ie; panel +applications. This implies &func-open; can return an &EBUSY; when the +device is already in use, as well as &func-ioctl; functions initiating +data exchange (namely the &VIDIOC-S-FMT; ioctl), and the &func-read; +and &func-write; functions. + + Mere opening a V4L2 device does not grant exclusive +access. + Drivers could recognize the +O_EXCL open flag. Presently this is not required, +so applications cannot know if it really works. + Initiating data exchange however assigns the right +to read or write the requested type of data, and to change related +properties, to this file descriptor. Applications can request +additional access privileges using the priority mechanism described in +. +
+ +
+ Shared Data Streams + + V4L2 drivers should not support multiple applications +reading or writing the same data stream on a device by copying +buffers, time multiplexing or similar means. This is better handled by +a proxy application in user space. When the driver supports stream +sharing anyway it must be implemented transparently. The V4L2 API does +not specify how conflicts are solved. +
+ +
+ Functions + + To open and close V4L2 devices applications use the +&func-open; and &func-close; function, respectively. Devices are +programmed using the &func-ioctl; function as explained in the +following sections. +
+
+ +
+ Querying Capabilities + + Because V4L2 covers a wide variety of devices not all +aspects of the API are equally applicable to all types of devices. +Furthermore devices of the same type have different capabilities and +this specification permits the omission of a few complicated and less +important parts of the API. + + The &VIDIOC-QUERYCAP; ioctl is available to check if the kernel +device is compatible with this specification, and to query the functions and I/O +methods supported by the device. Other features can be queried +by calling the respective ioctl, for example &VIDIOC-ENUMINPUT; +to learn about the number, types and names of video connectors on the +device. Although abstraction is a major objective of this API, the +ioctl also allows driver specific applications to reliable identify +the driver. + + All V4L2 drivers must support +VIDIOC_QUERYCAP. Applications should always call +this ioctl after opening the device. +
+ +
+ Application Priority + + When multiple applications share a device it may be +desirable to assign them different priorities. Contrary to the +traditional "rm -rf /" school of thought a video recording application +could for example block other applications from changing video +controls or switching the current TV channel. Another objective is to +permit low priority applications working in background, which can be +preempted by user controlled applications and automatically regain +control of the device at a later time. + + Since these features cannot be implemented entirely in user +space V4L2 defines the &VIDIOC-G-PRIORITY; and &VIDIOC-S-PRIORITY; +ioctls to request and query the access priority associate with a file +descriptor. Opening a device assigns a medium priority, compatible +with earlier versions of V4L2 and drivers not supporting these ioctls. +Applications requiring a different priority will usually call +VIDIOC_S_PRIORITY after verifying the device with +the &VIDIOC-QUERYCAP; ioctl. + + Ioctls changing driver properties, such as &VIDIOC-S-INPUT;, +return an &EBUSY; after another application obtained higher priority. +An event mechanism to notify applications about asynchronous property +changes has been proposed but not added yet. +
+ +
+ Video Inputs and Outputs + + Video inputs and outputs are physical connectors of a +device. These can be for example RF connectors (antenna/cable), CVBS +a.k.a. Composite Video, S-Video or RGB connectors. Only video and VBI +capture devices have inputs, output devices have outputs, at least one +each. Radio devices have no video inputs or outputs. + + To learn about the number and attributes of the +available inputs and outputs applications can enumerate them with the +&VIDIOC-ENUMINPUT; and &VIDIOC-ENUMOUTPUT; ioctl, respectively. The +&v4l2-input; returned by the VIDIOC_ENUMINPUT +ioctl also contains signal status information applicable when the +current video input is queried. + + The &VIDIOC-G-INPUT; and &VIDIOC-G-OUTPUT; ioctl return the +index of the current video input or output. To select a different +input or output applications call the &VIDIOC-S-INPUT; and +&VIDIOC-S-OUTPUT; ioctl. Drivers must implement all the input ioctls +when the device has one or more inputs, all the output ioctls when the +device has one or more outputs. + + + + + Information about the current video input + + +&v4l2-input; input; +int index; + +if (-1 == ioctl (fd, &VIDIOC-G-INPUT;, &index)) { + perror ("VIDIOC_G_INPUT"); + exit (EXIT_FAILURE); +} + +memset (&input, 0, sizeof (input)); +input.index = index; + +if (-1 == ioctl (fd, &VIDIOC-ENUMINPUT;, &input)) { + perror ("VIDIOC_ENUMINPUT"); + exit (EXIT_FAILURE); +} + +printf ("Current input: %s\n", input.name); + + + + + Switching to the first video input + + +int index; + +index = 0; + +if (-1 == ioctl (fd, &VIDIOC-S-INPUT;, &index)) { + perror ("VIDIOC_S_INPUT"); + exit (EXIT_FAILURE); +} + + +
+ +
+ Audio Inputs and Outputs + + Audio inputs and outputs are physical connectors of a +device. Video capture devices have inputs, output devices have +outputs, zero or more each. Radio devices have no audio inputs or +outputs. They have exactly one tuner which in fact +is an audio source, but this API associates +tuners with video inputs or outputs only, and radio devices have +none of these. + Actually &v4l2-audio; ought to have a +tuner field like &v4l2-input;, not only +making the API more consistent but also permitting radio devices with +multiple tuners. + A connector on a TV card to loop back the received +audio signal to a sound card is not considered an audio output. + + Audio and video inputs and outputs are associated. Selecting +a video source also selects an audio source. This is most evident when +the video and audio source is a tuner. Further audio connectors can +combine with more than one video input or output. Assumed two +composite video inputs and two audio inputs exist, there may be up to +four valid combinations. The relation of video and audio connectors +is defined in the audioset field of the +respective &v4l2-input; or &v4l2-output;, where each bit represents +the index number, starting at zero, of one audio input or output. + + To learn about the number and attributes of the +available inputs and outputs applications can enumerate them with the +&VIDIOC-ENUMAUDIO; and &VIDIOC-ENUMAUDOUT; ioctl, respectively. The +&v4l2-audio; returned by the VIDIOC_ENUMAUDIO ioctl +also contains signal status information applicable when the current +audio input is queried. + + The &VIDIOC-G-AUDIO; and &VIDIOC-G-AUDOUT; ioctl report +the current audio input and output, respectively. Note that, unlike +&VIDIOC-G-INPUT; and &VIDIOC-G-OUTPUT; these ioctls return a structure +as VIDIOC_ENUMAUDIO and +VIDIOC_ENUMAUDOUT do, not just an index. + + To select an audio input and change its properties +applications call the &VIDIOC-S-AUDIO; ioctl. To select an audio +output (which presently has no changeable properties) applications +call the &VIDIOC-S-AUDOUT; ioctl. + + Drivers must implement all input ioctls when the device +has one or more inputs, all output ioctls when the device has one +or more outputs. When the device has any audio inputs or outputs the +driver must set the V4L2_CAP_AUDIO flag in the +&v4l2-capability; returned by the &VIDIOC-QUERYCAP; ioctl. + + + Information about the current audio input + + +&v4l2-audio; audio; + +memset (&audio, 0, sizeof (audio)); + +if (-1 == ioctl (fd, &VIDIOC-G-AUDIO;, &audio)) { + perror ("VIDIOC_G_AUDIO"); + exit (EXIT_FAILURE); +} + +printf ("Current input: %s\n", audio.name); + + + + + Switching to the first audio input + + +&v4l2-audio; audio; + +memset (&audio, 0, sizeof (audio)); /* clear audio.mode, audio.reserved */ + +audio.index = 0; + +if (-1 == ioctl (fd, &VIDIOC-S-AUDIO;, &audio)) { + perror ("VIDIOC_S_AUDIO"); + exit (EXIT_FAILURE); +} + + +
+ +
+ Tuners and Modulators + +
+ Tuners + + Video input devices can have one or more tuners +demodulating a RF signal. Each tuner is associated with one or more +video inputs, depending on the number of RF connectors on the tuner. +The type field of the respective +&v4l2-input; returned by the &VIDIOC-ENUMINPUT; ioctl is set to +V4L2_INPUT_TYPE_TUNER and its +tuner field contains the index number of +the tuner. + + Radio devices have exactly one tuner with index zero, no +video inputs. + + To query and change tuner properties applications use the +&VIDIOC-G-TUNER; and &VIDIOC-S-TUNER; ioctl, respectively. The +&v4l2-tuner; returned by VIDIOC_G_TUNER also +contains signal status information applicable when the tuner of the +current video input, or a radio tuner is queried. Note that +VIDIOC_S_TUNER does not switch the current tuner, +when there is more than one at all. The tuner is solely determined by +the current video input. Drivers must support both ioctls and set the +V4L2_CAP_TUNER flag in the &v4l2-capability; +returned by the &VIDIOC-QUERYCAP; ioctl when the device has one or +more tuners. +
+ +
+ Modulators + + Video output devices can have one or more modulators, uh, +modulating a video signal for radiation or connection to the antenna +input of a TV set or video recorder. Each modulator is associated with +one or more video outputs, depending on the number of RF connectors on +the modulator. The type field of the +respective &v4l2-output; returned by the &VIDIOC-ENUMOUTPUT; ioctl is +set to V4L2_OUTPUT_TYPE_MODULATOR and its +modulator field contains the index number +of the modulator. This specification does not define radio output +devices. + + To query and change modulator properties applications use +the &VIDIOC-G-MODULATOR; and &VIDIOC-S-MODULATOR; ioctl. Note that +VIDIOC_S_MODULATOR does not switch the current +modulator, when there is more than one at all. The modulator is solely +determined by the current video output. Drivers must support both +ioctls and set the V4L2_CAP_MODULATOR flag in +the &v4l2-capability; returned by the &VIDIOC-QUERYCAP; ioctl when the +device has one or more modulators. +
+ +
+ Radio Frequency + + To get and set the tuner or modulator radio frequency +applications use the &VIDIOC-G-FREQUENCY; and &VIDIOC-S-FREQUENCY; +ioctl which both take a pointer to a &v4l2-frequency;. These ioctls +are used for TV and radio devices alike. Drivers must support both +ioctls when the tuner or modulator ioctls are supported, or +when the device is a radio device. +
+
+ +
+ Video Standards + + Video devices typically support one or more different video +standards or variations of standards. Each video input and output may +support another set of standards. This set is reported by the +std field of &v4l2-input; and +&v4l2-output; returned by the &VIDIOC-ENUMINPUT; and +&VIDIOC-ENUMOUTPUT; ioctl, respectively. + + V4L2 defines one bit for each analog video standard +currently in use worldwide, and sets aside bits for driver defined +standards, ⪚ hybrid standards to watch NTSC video tapes on PAL TVs +and vice versa. Applications can use the predefined bits to select a +particular standard, although presenting the user a menu of supported +standards is preferred. To enumerate and query the attributes of the +supported standards applications use the &VIDIOC-ENUMSTD; ioctl. + + Many of the defined standards are actually just variations +of a few major standards. The hardware may in fact not distinguish +between them, or do so internal and switch automatically. Therefore +enumerated standards also contain sets of one or more standard +bits. + + Assume a hypothetic tuner capable of demodulating B/PAL, +G/PAL and I/PAL signals. The first enumerated standard is a set of B +and G/PAL, switched automatically depending on the selected radio +frequency in UHF or VHF band. Enumeration gives a "PAL-B/G" or "PAL-I" +choice. Similar a Composite input may collapse standards, enumerating +"PAL-B/G/H/I", "NTSC-M" and "SECAM-D/K". + Some users are already confused by technical terms PAL, +NTSC and SECAM. There is no point asking them to distinguish between +B, G, D, or K when the software or hardware can do that +automatically. + + + To query and select the standard used by the current video +input or output applications call the &VIDIOC-G-STD; and +&VIDIOC-S-STD; ioctl, respectively. The received +standard can be sensed with the &VIDIOC-QUERYSTD; ioctl. Note parameter of all these ioctls is a pointer to a &v4l2-std-id; type (a standard set), not an index into the standard enumeration. + An alternative to the current scheme is to use pointers +to indices as arguments of VIDIOC_G_STD and +VIDIOC_S_STD, the &v4l2-input; and +&v4l2-output; std field would be a set of +indices like audioset. + Indices are consistent with the rest of the API +and identify the standard unambiguously. In the present scheme of +things an enumerated standard is looked up by &v4l2-std-id;. Now the +standards supported by the inputs of a device can overlap. Just +assume the tuner and composite input in the example above both +exist on a device. An enumeration of "PAL-B/G", "PAL-H/I" suggests +a choice which does not exist. We cannot merge or omit sets, because +applications would be unable to find the standards reported by +VIDIOC_G_STD. That leaves separate enumerations +for each input. Also selecting a standard by &v4l2-std-id; can be +ambiguous. Advantage of this method is that applications need not +identify the standard indirectly, after enumerating.So in +summary, the lookup itself is unavoidable. The difference is only +whether the lookup is necessary to find an enumerated standard or to +switch to a standard by &v4l2-std-id;. + Drivers must implement all video standard ioctls +when the device has one or more video inputs or outputs. + + Special rules apply to USB cameras where the notion of video +standards makes little sense. More generally any capture device, +output devices accordingly, which is + + incapable of capturing fields or frames at the nominal +rate of the video standard, or + + + where timestamps refer +to the instant the field or frame was received by the driver, not the +capture time, or + + + where sequence numbers +refer to the frames received by the driver, not the captured +frames. + + Here the driver shall set the +std field of &v4l2-input; and &v4l2-output; +to zero, the VIDIOC_G_STD, +VIDIOC_S_STD, +VIDIOC_QUERYSTD and +VIDIOC_ENUMSTD ioctls shall return the +&EINVAL;. + See for a rationale. Probably +even USB cameras follow some well known video standard. It might have +been better to explicitly indicate elsewhere if a device cannot live +up to normal expectations, instead of this exception. + + + + Information about the current video standard + + +&v4l2-std-id; std_id; +&v4l2-standard; standard; + +if (-1 == ioctl (fd, &VIDIOC-G-STD;, &std_id)) { + /* Note when VIDIOC_ENUMSTD always returns EINVAL this + is no video device or it falls under the USB exception, + and VIDIOC_G_STD returning EINVAL is no error. */ + + perror ("VIDIOC_G_STD"); + exit (EXIT_FAILURE); +} + +memset (&standard, 0, sizeof (standard)); +standard.index = 0; + +while (0 == ioctl (fd, &VIDIOC-ENUMSTD;, &standard)) { + if (standard.id & std_id) { + printf ("Current video standard: %s\n", standard.name); + exit (EXIT_SUCCESS); + } + + standard.index++; +} + +/* EINVAL indicates the end of the enumeration, which cannot be + empty unless this device falls under the USB exception. */ + +if (errno == EINVAL || standard.index == 0) { + perror ("VIDIOC_ENUMSTD"); + exit (EXIT_FAILURE); +} + + + + + Listing the video standards supported by the current +input + + +&v4l2-input; input; +&v4l2-standard; standard; + +memset (&input, 0, sizeof (input)); + +if (-1 == ioctl (fd, &VIDIOC-G-INPUT;, &input.index)) { + perror ("VIDIOC_G_INPUT"); + exit (EXIT_FAILURE); +} + +if (-1 == ioctl (fd, &VIDIOC-ENUMINPUT;, &input)) { + perror ("VIDIOC_ENUM_INPUT"); + exit (EXIT_FAILURE); +} + +printf ("Current input %s supports:\n", input.name); + +memset (&standard, 0, sizeof (standard)); +standard.index = 0; + +while (0 == ioctl (fd, &VIDIOC-ENUMSTD;, &standard)) { + if (standard.id & input.std) + printf ("%s\n", standard.name); + + standard.index++; +} + +/* EINVAL indicates the end of the enumeration, which cannot be + empty unless this device falls under the USB exception. */ + +if (errno != EINVAL || standard.index == 0) { + perror ("VIDIOC_ENUMSTD"); + exit (EXIT_FAILURE); +} + + + + + Selecting a new video standard + + +&v4l2-input; input; +&v4l2-std-id; std_id; + +memset (&input, 0, sizeof (input)); + +if (-1 == ioctl (fd, &VIDIOC-G-INPUT;, &input.index)) { + perror ("VIDIOC_G_INPUT"); + exit (EXIT_FAILURE); +} + +if (-1 == ioctl (fd, &VIDIOC-ENUMINPUT;, &input)) { + perror ("VIDIOC_ENUM_INPUT"); + exit (EXIT_FAILURE); +} + +if (0 == (input.std & V4L2_STD_PAL_BG)) { + fprintf (stderr, "Oops. B/G PAL is not supported.\n"); + exit (EXIT_FAILURE); +} + +/* Note this is also supposed to work when only B + or G/PAL is supported. */ + +std_id = V4L2_STD_PAL_BG; + +if (-1 == ioctl (fd, &VIDIOC-S-STD;, &std_id)) { + perror ("VIDIOC_S_STD"); + exit (EXIT_FAILURE); +} + + +
+ Digital Video (DV) Timings + + The video standards discussed so far has been dealing with Analog TV and the +corresponding video timings. Today there are many more different hardware interfaces +such as High Definition TV interfaces (HDMI), VGA, DVI connectors etc., that carry +video signals and there is a need to extend the API to select the video timings +for these interfaces. Since it is not possible to extend the &v4l2-std-id; due to +the limited bits available, a new set of IOCTLs is added to set/get video timings at +the input and output: + + DV Presets: Digital Video (DV) presets. These are IDs representing a +video timing at the input/output. Presets are pre-defined timings implemented +by the hardware according to video standards. A __u32 data type is used to represent +a preset unlike the bit mask that is used in &v4l2-std-id; allowing future extensions +to support as many different presets as needed. + + + Custom DV Timings: This will allow applications to define more detailed +custom video timings for the interface. This includes parameters such as width, height, +polarities, frontporch, backporch etc. + + + + To enumerate and query the attributes of DV presets supported by a device, +applications use the &VIDIOC-ENUM-DV-PRESETS; ioctl. To get the current DV preset, +applications use the &VIDIOC-G-DV-PRESET; ioctl and to set a preset they use the +&VIDIOC-S-DV-PRESET; ioctl. + To set custom DV timings for the device, applications use the +&VIDIOC-S-DV-TIMINGS; ioctl and to get current custom DV timings they use the +&VIDIOC-G-DV-TIMINGS; ioctl. + Applications can make use of the and + flags to decide what ioctls are available to set the +video timings for the device. +
+
+ + &sub-controls; + +
+ Data Formats + +
+ Data Format Negotiation + + Different devices exchange different kinds of data with +applications, for example video images, raw or sliced VBI data, RDS +datagrams. Even within one kind many different formats are possible, +in particular an abundance of image formats. Although drivers must +provide a default and the selection persists across closing and +reopening a device, applications should always negotiate a data format +before engaging in data exchange. Negotiation means the application +asks for a particular format and the driver selects and reports the +best the hardware can do to satisfy the request. Of course +applications can also just query the current selection. + + A single mechanism exists to negotiate all data formats +using the aggregate &v4l2-format; and the &VIDIOC-G-FMT; and +&VIDIOC-S-FMT; ioctls. Additionally the &VIDIOC-TRY-FMT; ioctl can be +used to examine what the hardware could do, +without actually selecting a new data format. The data formats +supported by the V4L2 API are covered in the respective device section +in . For a closer look at image formats see +. + + The VIDIOC_S_FMT ioctl is a major +turning-point in the initialization sequence. Prior to this point +multiple panel applications can access the same device concurrently to +select the current input, change controls or modify other properties. +The first VIDIOC_S_FMT assigns a logical stream +(video data, VBI data etc.) exclusively to one file descriptor. + + Exclusive means no other application, more precisely no +other file descriptor, can grab this stream or change device +properties inconsistent with the negotiated parameters. A video +standard change for example, when the new standard uses a different +number of scan lines, can invalidate the selected image format. +Therefore only the file descriptor owning the stream can make +invalidating changes. Accordingly multiple file descriptors which +grabbed different logical streams prevent each other from interfering +with their settings. When for example video overlay is about to start +or already in progress, simultaneous video capturing may be restricted +to the same cropping and image size. + + When applications omit the +VIDIOC_S_FMT ioctl its locking side effects are +implied by the next step, the selection of an I/O method with the +&VIDIOC-REQBUFS; ioctl or implicit with the first &func-read; or +&func-write; call. + + Generally only one logical stream can be assigned to a +file descriptor, the exception being drivers permitting simultaneous +video capturing and overlay using the same file descriptor for +compatibility with V4L and earlier versions of V4L2. Switching the +logical stream or returning into "panel mode" is possible by closing +and reopening the device. Drivers may support a +switch using VIDIOC_S_FMT. + + All drivers exchanging data with +applications must support the VIDIOC_G_FMT and +VIDIOC_S_FMT ioctl. Implementation of the +VIDIOC_TRY_FMT is highly recommended but +optional. +
+ +
+ Image Format Enumeration + + Apart of the generic format negotiation functions +a special ioctl to enumerate all image formats supported by video +capture, overlay or output devices is available. + Enumerating formats an application has no a-priori +knowledge of (otherwise it could explicitly ask for them and need not +enumerate) seems useless, but there are applications serving as proxy +between drivers and the actual video applications for which this is +useful. + + + The &VIDIOC-ENUM-FMT; ioctl must be supported +by all drivers exchanging image data with applications. + + + Drivers are not supposed to convert image formats in +kernel space. They must enumerate only formats directly supported by +the hardware. If necessary driver writers should publish an example +conversion routine or library for integration into applications. + +
+
+ + &sub-planar-apis; + +
+ Image Cropping, Insertion and Scaling + + Some video capture devices can sample a subsection of the +picture and shrink or enlarge it to an image of arbitrary size. We +call these abilities cropping and scaling. Some video output devices +can scale an image up or down and insert it at an arbitrary scan line +and horizontal offset into a video signal. + + Applications can use the following API to select an area in +the video signal, query the default area and the hardware limits. +Despite their name, the &VIDIOC-CROPCAP;, &VIDIOC-G-CROP; +and &VIDIOC-S-CROP; ioctls apply to input as well as output +devices. + + Scaling requires a source and a target. On a video capture +or overlay device the source is the video signal, and the cropping +ioctls determine the area actually sampled. The target are images +read by the application or overlaid onto the graphics screen. Their +size (and position for an overlay) is negotiated with the +&VIDIOC-G-FMT; and &VIDIOC-S-FMT; ioctls. + + On a video output device the source are the images passed in +by the application, and their size is again negotiated with the +VIDIOC_G/S_FMT ioctls, or may be encoded in a +compressed video stream. The target is the video signal, and the +cropping ioctls determine the area where the images are +inserted. + + Source and target rectangles are defined even if the device +does not support scaling or the VIDIOC_G/S_CROP +ioctls. Their size (and position where applicable) will be fixed in +this case. All capture and output device must support the +VIDIOC_CROPCAP ioctl such that applications can +determine if scaling takes place. + +
+ Cropping Structures + +
+ Image Cropping, Insertion and Scaling + + + + + + + + + The cropping, insertion and scaling process + + +
+ + For capture devices the coordinates of the top left +corner, width and height of the area which can be sampled is given by +the bounds substructure of the +&v4l2-cropcap; returned by the VIDIOC_CROPCAP +ioctl. To support a wide range of hardware this specification does not +define an origin or units. However by convention drivers should +horizontally count unscaled samples relative to 0H (the leading edge +of the horizontal sync pulse, see ). +Vertically ITU-R line +numbers of the first field (, ), multiplied by two if the driver can capture both +fields. + + The top left corner, width and height of the source +rectangle, that is the area actually sampled, is given by &v4l2-crop; +using the same coordinate system as &v4l2-cropcap;. Applications can +use the VIDIOC_G_CROP and +VIDIOC_S_CROP ioctls to get and set this +rectangle. It must lie completely within the capture boundaries and +the driver may further adjust the requested size and/or position +according to hardware limitations. + + Each capture device has a default source rectangle, given +by the defrect substructure of +&v4l2-cropcap;. The center of this rectangle shall align with the +center of the active picture area of the video signal, and cover what +the driver writer considers the complete picture. Drivers shall reset +the source rectangle to the default when the driver is first loaded, +but not later. + + For output devices these structures and ioctls are used +accordingly, defining the target rectangle where +the images will be inserted into the video signal. + +
+ +
+ Scaling Adjustments + + Video hardware can have various cropping, insertion and +scaling limitations. It may only scale up or down, support only +discrete scaling factors, or have different scaling abilities in +horizontal and vertical direction. Also it may not support scaling at +all. At the same time the &v4l2-crop; rectangle may have to be +aligned, and both the source and target rectangles may have arbitrary +upper and lower size limits. In particular the maximum +width and height +in &v4l2-crop; may be smaller than the +&v4l2-cropcap;.bounds area. Therefore, as +usual, drivers are expected to adjust the requested parameters and +return the actual values selected. + + Applications can change the source or the target rectangle +first, as they may prefer a particular image size or a certain area in +the video signal. If the driver has to adjust both to satisfy hardware +limitations, the last requested rectangle shall take priority, and the +driver should preferably adjust the opposite one. The &VIDIOC-TRY-FMT; +ioctl however shall not change the driver state and therefore only +adjust the requested rectangle. + + Suppose scaling on a video capture device is restricted to +a factor 1:1 or 2:1 in either direction and the target image size must +be a multiple of 16 × 16 pixels. The source cropping +rectangle is set to defaults, which are also the upper limit in this +example, of 640 × 400 pixels at offset 0, 0. An +application requests an image size of 300 × 225 +pixels, assuming video will be scaled down from the "full picture" +accordingly. The driver sets the image size to the closest possible +values 304 × 224, then chooses the cropping rectangle +closest to the requested size, that is 608 × 224 +(224 × 2:1 would exceed the limit 400). The offset +0, 0 is still valid, thus unmodified. Given the default cropping +rectangle reported by VIDIOC_CROPCAP the +application can easily propose another offset to center the cropping +rectangle. + + Now the application may insist on covering an area using a +picture aspect ratio closer to the original request, so it asks for a +cropping rectangle of 608 × 456 pixels. The present +scaling factors limit cropping to 640 × 384, so the +driver returns the cropping size 608 × 384 and adjusts +the image size to closest possible 304 × 192. + +
+ +
+ Examples + + Source and target rectangles shall remain unchanged across +closing and reopening a device, such that piping data into or out of a +device will work without special preparations. More advanced +applications should ensure the parameters are suitable before starting +I/O. + + + Resetting the cropping parameters + + (A video capture device is assumed; change +V4L2_BUF_TYPE_VIDEO_CAPTURE for other +devices.) + + +&v4l2-cropcap; cropcap; +&v4l2-crop; crop; + +memset (&cropcap, 0, sizeof (cropcap)); +cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + +if (-1 == ioctl (fd, &VIDIOC-CROPCAP;, &cropcap)) { + perror ("VIDIOC_CROPCAP"); + exit (EXIT_FAILURE); +} + +memset (&crop, 0, sizeof (crop)); +crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; +crop.c = cropcap.defrect; + +/* Ignore if cropping is not supported (EINVAL). */ + +if (-1 == ioctl (fd, &VIDIOC-S-CROP;, &crop) + && errno != EINVAL) { + perror ("VIDIOC_S_CROP"); + exit (EXIT_FAILURE); +} + + + + + Simple downscaling + + (A video capture device is assumed.) + + +&v4l2-cropcap; cropcap; +&v4l2-format; format; + +reset_cropping_parameters (); + +/* Scale down to 1/4 size of full picture. */ + +memset (&format, 0, sizeof (format)); /* defaults */ + +format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + +format.fmt.pix.width = cropcap.defrect.width >> 1; +format.fmt.pix.height = cropcap.defrect.height >> 1; +format.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV; + +if (-1 == ioctl (fd, &VIDIOC-S-FMT;, &format)) { + perror ("VIDIOC_S_FORMAT"); + exit (EXIT_FAILURE); +} + +/* We could check the actual image size now, the actual scaling factor + or if the driver can scale at all. */ + + + + + Selecting an output area + + +&v4l2-cropcap; cropcap; +&v4l2-crop; crop; + +memset (&cropcap, 0, sizeof (cropcap)); +cropcap.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; + +if (-1 == ioctl (fd, VIDIOC_CROPCAP;, &cropcap)) { + perror ("VIDIOC_CROPCAP"); + exit (EXIT_FAILURE); +} + +memset (&crop, 0, sizeof (crop)); + +crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; +crop.c = cropcap.defrect; + +/* Scale the width and height to 50 % of their original size + and center the output. */ + +crop.c.width /= 2; +crop.c.height /= 2; +crop.c.left += crop.c.width / 2; +crop.c.top += crop.c.height / 2; + +/* Ignore if cropping is not supported (EINVAL). */ + +if (-1 == ioctl (fd, VIDIOC_S_CROP, &crop) + && errno != EINVAL) { + perror ("VIDIOC_S_CROP"); + exit (EXIT_FAILURE); +} + + + + + Current scaling factor and pixel aspect + + (A video capture device is assumed.) + + +&v4l2-cropcap; cropcap; +&v4l2-crop; crop; +&v4l2-format; format; +double hscale, vscale; +double aspect; +int dwidth, dheight; + +memset (&cropcap, 0, sizeof (cropcap)); +cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + +if (-1 == ioctl (fd, &VIDIOC-CROPCAP;, &cropcap)) { + perror ("VIDIOC_CROPCAP"); + exit (EXIT_FAILURE); +} + +memset (&crop, 0, sizeof (crop)); +crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + +if (-1 == ioctl (fd, &VIDIOC-G-CROP;, &crop)) { + if (errno != EINVAL) { + perror ("VIDIOC_G_CROP"); + exit (EXIT_FAILURE); + } + + /* Cropping not supported. */ + crop.c = cropcap.defrect; +} + +memset (&format, 0, sizeof (format)); +format.fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + +if (-1 == ioctl (fd, &VIDIOC-G-FMT;, &format)) { + perror ("VIDIOC_G_FMT"); + exit (EXIT_FAILURE); +} + +/* The scaling applied by the driver. */ + +hscale = format.fmt.pix.width / (double) crop.c.width; +vscale = format.fmt.pix.height / (double) crop.c.height; + +aspect = cropcap.pixelaspect.numerator / + (double) cropcap.pixelaspect.denominator; +aspect = aspect * hscale / vscale; + +/* Devices following ITU-R BT.601 do not capture + square pixels. For playback on a computer monitor + we should scale the images to this size. */ + +dwidth = format.fmt.pix.width / aspect; +dheight = format.fmt.pix.height; + + +
+
+ +
+ Streaming Parameters + + Streaming parameters are intended to optimize the video +capture process as well as I/O. Presently applications can request a +high quality capture mode with the &VIDIOC-S-PARM; ioctl. + + The current video standard determines a nominal number of +frames per second. If less than this number of frames is to be +captured or output, applications can request frame skipping or +duplicating on the driver side. This is especially useful when using +the &func-read; or &func-write;, which are not augmented by timestamps +or sequence counters, and to avoid unnecessary data copying. + + Finally these ioctls can be used to determine the number of +buffers used internally by a driver in read/write mode. For +implications see the section discussing the &func-read; +function. + + To get and set the streaming parameters applications call +the &VIDIOC-G-PARM; and &VIDIOC-S-PARM; ioctl, respectively. They take +a pointer to a &v4l2-streamparm;, which contains a union holding +separate parameters for input and output devices. + + These ioctls are optional, drivers need not implement +them. If so, they return the &EINVAL;. +
+ + diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml new file mode 100644 index 000000000000..9f7cd4f25792 --- /dev/null +++ b/Documentation/DocBook/media/v4l/compat.xml @@ -0,0 +1,2500 @@ + Changes + + The following chapters document the evolution of the V4L2 API, +errata or extensions. They are also intended to help application and +driver writers to port or update their code. + +
+ Differences between V4L and V4L2 + + The Video For Linux API was first introduced in Linux 2.1 to +unify and replace various TV and radio device related interfaces, +developed independently by driver writers in prior years. Starting +with Linux 2.5 the much improved V4L2 API replaces the V4L API, +although existing drivers will continue to support V4L applications in +the future, either directly or through the V4L2 compatibility layer in +the videodev kernel module translating ioctls on +the fly. For a transition period not all drivers will support the V4L2 +API. + +
+ Opening and Closing Devices + + For compatibility reasons the character device file names +recommended for V4L2 video capture, overlay, radio and raw +vbi capture devices did not change from those used by V4L. They are +listed in and below in . + + The teletext devices (minor range 192-223) have been removed in +V4L2 and no longer exist. There is no hardware available anymore for handling +pure teletext. Instead raw or sliced VBI is used. + + The V4L videodev module automatically +assigns minor numbers to drivers in load order, depending on the +registered device type. We recommend that V4L2 drivers by default +register devices with the same numbers, but the system administrator +can assign arbitrary minor numbers using driver module options. The +major device number remains 81. + + + V4L Device Types, Names and Numbers + + + + Device Type + File Name + Minor Numbers + + + + + Video capture and overlay + /dev/video and +/dev/bttv0 According to +Documentation/devices.txt these should be symbolic links to +/dev/video0. Note the original bttv interface is +not compatible with V4L or V4L2. , +/dev/video0 to +/dev/video63 + 0-63 + + + Radio receiver + /dev/radio + According to +Documentation/devices.txt a symbolic link to +/dev/radio0. + , /dev/radio0 to +/dev/radio63 + 64-127 + + + Raw VBI capture + /dev/vbi, +/dev/vbi0 to +/dev/vbi31 + 224-255 + + + +
+ + V4L prohibits (or used to prohibit) multiple opens of a +device file. V4L2 drivers may support multiple +opens, see for details and consequences. + + V4L drivers respond to V4L2 ioctls with an &EINVAL;. The +compatibility layer in the V4L2 videodev module +can translate V4L ioctl requests to their V4L2 counterpart, however a +V4L2 driver usually needs more preparation to become fully V4L +compatible. This is covered in more detail in . +
+ +
+ Querying Capabilities + + The V4L VIDIOCGCAP ioctl is +equivalent to V4L2's &VIDIOC-QUERYCAP;. + + The name field in struct +video_capability became +card in &v4l2-capability;, +type was replaced by +capabilities. Note V4L2 does not +distinguish between device types like this, better think of basic +video input, video output and radio devices supporting a set of +related functions like video capturing, video overlay and VBI +capturing. See for an +introduction. + + + + struct +video_capability +type + &v4l2-capability; +capabilities flags + Purpose + + + + + VID_TYPE_CAPTURE + V4L2_CAP_VIDEO_CAPTURE + The video +capture interface is supported. + + + VID_TYPE_TUNER + V4L2_CAP_TUNER + The device has a tuner or +modulator. + + + VID_TYPE_TELETEXT + V4L2_CAP_VBI_CAPTURE + The raw VBI +capture interface is supported. + + + VID_TYPE_OVERLAY + V4L2_CAP_VIDEO_OVERLAY + The video +overlay interface is supported. + + + VID_TYPE_CHROMAKEY + V4L2_FBUF_CAP_CHROMAKEY in +field capability of +&v4l2-framebuffer; + Whether chromakey overlay is supported. For +more information on overlay see +. + + + VID_TYPE_CLIPPING + V4L2_FBUF_CAP_LIST_CLIPPING +and V4L2_FBUF_CAP_BITMAP_CLIPPING in field +capability of &v4l2-framebuffer; + Whether clipping the overlaid image is +supported, see . + + + VID_TYPE_FRAMERAM + V4L2_FBUF_CAP_EXTERNOVERLAY +not set in field +capability of &v4l2-framebuffer; + Whether overlay overwrites frame buffer memory, +see . + + + VID_TYPE_SCALES + - + This flag indicates if the hardware can scale +images. The V4L2 API implies the scale factor by setting the cropping +dimensions and image size with the &VIDIOC-S-CROP; and &VIDIOC-S-FMT; +ioctl, respectively. The driver returns the closest sizes possible. +For more information on cropping and scaling see . + + + VID_TYPE_MONOCHROME + - + Applications can enumerate the supported image +formats with the &VIDIOC-ENUM-FMT; ioctl to determine if the device +supports grey scale capturing only. For more information on image +formats see . + + + VID_TYPE_SUBCAPTURE + - + Applications can call the &VIDIOC-G-CROP; ioctl +to determine if the device supports capturing a subsection of the full +picture ("cropping" in V4L2). If not, the ioctl returns the &EINVAL;. +For more information on cropping and scaling see . + + + VID_TYPE_MPEG_DECODER + - + Applications can enumerate the supported image +formats with the &VIDIOC-ENUM-FMT; ioctl to determine if the device +supports MPEG streams. + + + VID_TYPE_MPEG_ENCODER + - + See above. + + + VID_TYPE_MJPEG_DECODER + - + See above. + + + VID_TYPE_MJPEG_ENCODER + - + See above. + + + + + + The audios field was replaced +by capabilities flag +V4L2_CAP_AUDIO, indicating +if the device has any audio inputs or outputs. To +determine their number applications can enumerate audio inputs with +the &VIDIOC-G-AUDIO; ioctl. The audio ioctls are described in . + + The maxwidth, +maxheight, +minwidth and +minheight fields were removed. Calling the +&VIDIOC-S-FMT; or &VIDIOC-TRY-FMT; ioctl with the desired dimensions +returns the closest size possible, taking into account the current +video standard, cropping and scaling limitations. +
+ +
+ Video Sources + + V4L provides the VIDIOCGCHAN and +VIDIOCSCHAN ioctl using struct +video_channel to enumerate +the video inputs of a V4L device. The equivalent V4L2 ioctls +are &VIDIOC-ENUMINPUT;, &VIDIOC-G-INPUT; and &VIDIOC-S-INPUT; +using &v4l2-input; as discussed in . + + The channel field counting +inputs was renamed to index, the video +input types were renamed as follows: + + + + struct video_channel +type + &v4l2-input; +type + + + + + VIDEO_TYPE_TV + V4L2_INPUT_TYPE_TUNER + + + VIDEO_TYPE_CAMERA + V4L2_INPUT_TYPE_CAMERA + + + + + + Unlike the tuners field +expressing the number of tuners of this input, V4L2 assumes each video +input is connected to at most one tuner. However a tuner can have more +than one input, &ie; RF connectors, and a device can have multiple +tuners. The index number of the tuner associated with the input, if +any, is stored in field tuner of +&v4l2-input;. Enumeration of tuners is discussed in . + + The redundant VIDEO_VC_TUNER flag was +dropped. Video inputs associated with a tuner are of type +V4L2_INPUT_TYPE_TUNER. The +VIDEO_VC_AUDIO flag was replaced by the +audioset field. V4L2 considers devices with +up to 32 audio inputs. Each set bit in the +audioset field represents one audio input +this video input combines with. For information about audio inputs and +how to switch between them see . + + The norm field describing the +supported video standards was replaced by +std. The V4L specification mentions a flag +VIDEO_VC_NORM indicating whether the standard can +be changed. This flag was a later addition together with the +norm field and has been removed in the +meantime. V4L2 has a similar, albeit more comprehensive approach +to video standards, see for more +information. +
+ +
+ Tuning + + The V4L VIDIOCGTUNER and +VIDIOCSTUNER ioctl and struct +video_tuner can be used to enumerate the +tuners of a V4L TV or radio device. The equivalent V4L2 ioctls are +&VIDIOC-G-TUNER; and &VIDIOC-S-TUNER; using &v4l2-tuner;. Tuners are +covered in . + + The tuner field counting tuners +was renamed to index. The fields +name, rangelow +and rangehigh remained unchanged. + + The VIDEO_TUNER_PAL, +VIDEO_TUNER_NTSC and +VIDEO_TUNER_SECAM flags indicating the supported +video standards were dropped. This information is now contained in the +associated &v4l2-input;. No replacement exists for the +VIDEO_TUNER_NORM flag indicating whether the +video standard can be switched. The mode +field to select a different video standard was replaced by a whole new +set of ioctls and structures described in . +Due to its ubiquity it should be mentioned the BTTV driver supports +several standards in addition to the regular +VIDEO_MODE_PAL (0), +VIDEO_MODE_NTSC, +VIDEO_MODE_SECAM and +VIDEO_MODE_AUTO (3). Namely N/PAL Argentina, +M/PAL, N/PAL, and NTSC Japan with numbers 3-6 (sic). + + The VIDEO_TUNER_STEREO_ON flag +indicating stereo reception became +V4L2_TUNER_SUB_STEREO in field +rxsubchans. This field also permits the +detection of monaural and bilingual audio, see the definition of +&v4l2-tuner; for details. Presently no replacement exists for the +VIDEO_TUNER_RDS_ON and +VIDEO_TUNER_MBS_ON flags. + + The VIDEO_TUNER_LOW flag was renamed +to V4L2_TUNER_CAP_LOW in the &v4l2-tuner; +capability field. + + The VIDIOCGFREQ and +VIDIOCSFREQ ioctl to change the tuner frequency +where renamed to &VIDIOC-G-FREQUENCY; and &VIDIOC-S-FREQUENCY;. They +take a pointer to a &v4l2-frequency; instead of an unsigned long +integer. +
+ +
+ Image Properties + + V4L2 has no equivalent of the +VIDIOCGPICT and VIDIOCSPICT +ioctl and struct video_picture. The following +fields where replaced by V4L2 controls accessible with the +&VIDIOC-QUERYCTRL;, &VIDIOC-G-CTRL; and &VIDIOC-S-CTRL; ioctls: + + + + struct video_picture + V4L2 Control ID + + + + + brightness + V4L2_CID_BRIGHTNESS + + + hue + V4L2_CID_HUE + + + colour + V4L2_CID_SATURATION + + + contrast + V4L2_CID_CONTRAST + + + whiteness + V4L2_CID_WHITENESS + + + + + + The V4L picture controls are assumed to range from 0 to +65535 with no particular reset value. The V4L2 API permits arbitrary +limits and defaults which can be queried with the &VIDIOC-QUERYCTRL; +ioctl. For general information about controls see . + + The depth (average number of +bits per pixel) of a video image is implied by the selected image +format. V4L2 does not explicitely provide such information assuming +applications recognizing the format are aware of the image depth and +others need not know. The palette field +moved into the &v4l2-pix-format;: + + + + struct video_picture +palette + &v4l2-pix-format; +pixfmt + + + + + VIDEO_PALETTE_GREY + V4L2_PIX_FMT_GREY + + + VIDEO_PALETTE_HI240 + V4L2_PIX_FMT_HI240 + This is a custom format used by the BTTV +driver, not one of the V4L2 standard formats. + + + + VIDEO_PALETTE_RGB565 + V4L2_PIX_FMT_RGB565 + + + VIDEO_PALETTE_RGB555 + V4L2_PIX_FMT_RGB555 + + + VIDEO_PALETTE_RGB24 + V4L2_PIX_FMT_BGR24 + + + VIDEO_PALETTE_RGB32 + V4L2_PIX_FMT_BGR32 + Presumably all V4L RGB formats are +little-endian, although some drivers might interpret them according to machine endianess. V4L2 defines little-endian, big-endian and red/blue +swapped variants. For details see . + + + + VIDEO_PALETTE_YUV422 + V4L2_PIX_FMT_YUYV + + + VIDEO_PALETTE_YUYV + VIDEO_PALETTE_YUV422 +and VIDEO_PALETTE_YUYV are the same formats. Some +V4L drivers respond to one, some to the other. + + V4L2_PIX_FMT_YUYV + + + VIDEO_PALETTE_UYVY + V4L2_PIX_FMT_UYVY + + + VIDEO_PALETTE_YUV420 + None + + + VIDEO_PALETTE_YUV411 + V4L2_PIX_FMT_Y41P + Not to be confused with +V4L2_PIX_FMT_YUV411P, which is a planar +format. + + + VIDEO_PALETTE_RAW + None V4L explains this +as: "RAW capture (BT848)" + + + VIDEO_PALETTE_YUV422P + V4L2_PIX_FMT_YUV422P + + + VIDEO_PALETTE_YUV411P + V4L2_PIX_FMT_YUV411P + Not to be confused with +V4L2_PIX_FMT_Y41P, which is a packed +format. + + + VIDEO_PALETTE_YUV420P + V4L2_PIX_FMT_YVU420 + + + VIDEO_PALETTE_YUV410P + V4L2_PIX_FMT_YVU410 + + + + + + V4L2 image formats are defined in . The image format can be selected with the +&VIDIOC-S-FMT; ioctl. +
+ +
+ Audio + + The VIDIOCGAUDIO and +VIDIOCSAUDIO ioctl and struct +video_audio are used to enumerate the +audio inputs of a V4L device. The equivalent V4L2 ioctls are +&VIDIOC-G-AUDIO; and &VIDIOC-S-AUDIO; using &v4l2-audio; as +discussed in . + + The audio "channel number" +field counting audio inputs was renamed to +index. + + On VIDIOCSAUDIO the +mode field selects one +of the VIDEO_SOUND_MONO, +VIDEO_SOUND_STEREO, +VIDEO_SOUND_LANG1 or +VIDEO_SOUND_LANG2 audio demodulation modes. When +the current audio standard is BTSC +VIDEO_SOUND_LANG2 refers to SAP and +VIDEO_SOUND_LANG1 is meaningless. Also +undocumented in the V4L specification, there is no way to query the +selected mode. On VIDIOCGAUDIO the driver returns +the actually received audio programmes in this +field. In the V4L2 API this information is stored in the &v4l2-tuner; +rxsubchans and +audmode fields, respectively. See for more information on tuners. Related to audio +modes &v4l2-audio; also reports if this is a mono or stereo +input, regardless if the source is a tuner. + + The following fields where replaced by V4L2 controls +accessible with the &VIDIOC-QUERYCTRL;, &VIDIOC-G-CTRL; and +&VIDIOC-S-CTRL; ioctls: + + + + struct +video_audio + V4L2 Control ID + + + + + volume + V4L2_CID_AUDIO_VOLUME + + + bass + V4L2_CID_AUDIO_BASS + + + treble + V4L2_CID_AUDIO_TREBLE + + + balance + V4L2_CID_AUDIO_BALANCE + + + + + + To determine which of these controls are supported by a +driver V4L provides the flags +VIDEO_AUDIO_VOLUME, +VIDEO_AUDIO_BASS, +VIDEO_AUDIO_TREBLE and +VIDEO_AUDIO_BALANCE. In the V4L2 API the +&VIDIOC-QUERYCTRL; ioctl reports if the respective control is +supported. Accordingly the VIDEO_AUDIO_MUTABLE +and VIDEO_AUDIO_MUTE flags where replaced by the +boolean V4L2_CID_AUDIO_MUTE control. + + All V4L2 controls have a step +attribute replacing the struct video_audio +step field. The V4L audio controls are +assumed to range from 0 to 65535 with no particular reset value. The +V4L2 API permits arbitrary limits and defaults which can be queried +with the &VIDIOC-QUERYCTRL; ioctl. For general information about +controls see . +
+ +
+ Frame Buffer Overlay + + The V4L2 ioctls equivalent to +VIDIOCGFBUF and VIDIOCSFBUF +are &VIDIOC-G-FBUF; and &VIDIOC-S-FBUF;. The +base field of struct +video_buffer remained unchanged, except V4L2 +defines a flag to indicate non-destructive overlays instead of a +NULL pointer. All other fields moved into the +&v4l2-pix-format; fmt substructure of +&v4l2-framebuffer;. The depth field was +replaced by pixelformat. See for a list of RGB formats and their +respective color depths. + + Instead of the special ioctls +VIDIOCGWIN and VIDIOCSWIN +V4L2 uses the general-purpose data format negotiation ioctls +&VIDIOC-G-FMT; and &VIDIOC-S-FMT;. They take a pointer to a +&v4l2-format; as argument. Here the win +member of the fmt union is used, a +&v4l2-window;. + + The x, +y, width and +height fields of struct +video_window moved into &v4l2-rect; +substructure w of struct +v4l2_window. The +chromakey, +clips, and +clipcount fields remained unchanged. Struct +video_clip was renamed to &v4l2-clip;, also +containing a struct v4l2_rect, but the +semantics are still the same. + + The VIDEO_WINDOW_INTERLACE flag was +dropped. Instead applications must set the +field field to +V4L2_FIELD_ANY or +V4L2_FIELD_INTERLACED. The +VIDEO_WINDOW_CHROMAKEY flag moved into +&v4l2-framebuffer;, under the new name +V4L2_FBUF_FLAG_CHROMAKEY. + + In V4L, storing a bitmap pointer in +clips and setting +clipcount to +VIDEO_CLIP_BITMAP (-1) requests bitmap +clipping, using a fixed size bitmap of 1024 × 625 bits. Struct +v4l2_window has a separate +bitmap pointer field for this purpose and +the bitmap size is determined by w.width and +w.height. + + The VIDIOCCAPTURE ioctl to enable or +disable overlay was renamed to &VIDIOC-OVERLAY;. +
+ +
+ Cropping + + To capture only a subsection of the full picture V4L +defines the VIDIOCGCAPTURE and +VIDIOCSCAPTURE ioctls using struct +video_capture. The equivalent V4L2 ioctls are +&VIDIOC-G-CROP; and &VIDIOC-S-CROP; using &v4l2-crop;, and the related +&VIDIOC-CROPCAP; ioctl. This is a rather complex matter, see + for details. + + The x, +y, width and +height fields moved into &v4l2-rect; +substructure c of struct +v4l2_crop. The +decimation field was dropped. In the V4L2 +API the scaling factor is implied by the size of the cropping +rectangle and the size of the captured or overlaid image. + + The VIDEO_CAPTURE_ODD +and VIDEO_CAPTURE_EVEN flags to capture only the +odd or even field, respectively, were replaced by +V4L2_FIELD_TOP and +V4L2_FIELD_BOTTOM in the field named +field of &v4l2-pix-format; and +&v4l2-window;. These structures are used to select a capture or +overlay format with the &VIDIOC-S-FMT; ioctl. +
+ +
+ Reading Images, Memory Mapping + +
+ Capturing using the read method + + There is no essential difference between reading images +from a V4L or V4L2 device using the &func-read; function, however V4L2 +drivers are not required to support this I/O method. Applications can +determine if the function is available with the &VIDIOC-QUERYCAP; +ioctl. All V4L2 devices exchanging data with applications must support +the &func-select; and &func-poll; functions. + + To select an image format and size, V4L provides the +VIDIOCSPICT and VIDIOCSWIN +ioctls. V4L2 uses the general-purpose data format negotiation ioctls +&VIDIOC-G-FMT; and &VIDIOC-S-FMT;. They take a pointer to a +&v4l2-format; as argument, here the &v4l2-pix-format; named +pix of its fmt +union is used. + + For more information about the V4L2 read interface see +. +
+
+ Capturing using memory mapping + + Applications can read from V4L devices by mapping +buffers in device memory, or more often just buffers allocated in +DMA-able system memory, into their address space. This avoids the data +copying overhead of the read method. V4L2 supports memory mapping as +well, with a few differences. + + + + + + V4L + V4L2 + + + + + + The image format must be selected before +buffers are allocated, with the &VIDIOC-S-FMT; ioctl. When no format +is selected the driver may use the last, possibly by another +application requested format. + + + Applications cannot change the number of +buffers. The it is built into the driver, unless it has a module +option to change the number when the driver module is +loaded. + The &VIDIOC-REQBUFS; ioctl allocates the +desired number of buffers, this is a required step in the initialization +sequence. + + + Drivers map all buffers as one contiguous +range of memory. The VIDIOCGMBUF ioctl is +available to query the number of buffers, the offset of each buffer +from the start of the virtual file, and the overall amount of memory +used, which can be used as arguments for the &func-mmap; +function. + Buffers are individually mapped. The +offset and size of each buffer can be determined with the +&VIDIOC-QUERYBUF; ioctl. + + + The VIDIOCMCAPTURE +ioctl prepares a buffer for capturing. It also determines the image +format for this buffer. The ioctl returns immediately, eventually with +an &EAGAIN; if no video signal had been detected. When the driver +supports more than one buffer applications can call the ioctl multiple +times and thus have multiple outstanding capture +requests.The VIDIOCSYNC ioctl +suspends execution until a particular buffer has been +filled. + Drivers maintain an incoming and outgoing +queue. &VIDIOC-QBUF; enqueues any empty buffer into the incoming +queue. Filled buffers are dequeued from the outgoing queue with the +&VIDIOC-DQBUF; ioctl. To wait until filled buffers become available this +function, &func-select; or &func-poll; can be used. The +&VIDIOC-STREAMON; ioctl must be called once after enqueuing one or +more buffers to start capturing. Its counterpart +&VIDIOC-STREAMOFF; stops capturing and dequeues all buffers from both +queues. Applications can query the signal status, if known, with the +&VIDIOC-ENUMINPUT; ioctl. + + + + + + For a more in-depth discussion of memory mapping and +examples, see . +
+
+ +
+ Reading Raw VBI Data + + Originally the V4L API did not specify a raw VBI capture +interface, only the device file /dev/vbi was +reserved for this purpose. The only driver supporting this interface +was the BTTV driver, de-facto defining the V4L VBI interface. Reading +from the device yields a raw VBI image with the following +parameters: + + + + &v4l2-vbi-format; + V4L, BTTV driver + + + + + sampling_rate + 28636363 Hz NTSC (or any other 525-line +standard); 35468950 Hz PAL and SECAM (625-line standards) + + + offset + ? + + + samples_per_line + 2048 + + + sample_format + V4L2_PIX_FMT_GREY. The last four bytes (a +machine endianess integer) contain a frame counter. + + + start[] + 10, 273 NTSC; 22, 335 PAL and SECAM + + + count[] + 16, 16Old driver +versions used different values, eventually the custom +BTTV_VBISIZE ioctl was added to query the +correct values. + + + flags + 0 + + + + + + Undocumented in the V4L specification, in Linux 2.3 the +VIDIOCGVBIFMT and +VIDIOCSVBIFMT ioctls using struct +vbi_format were added to determine the VBI +image parameters. These ioctls are only partially compatible with the +V4L2 VBI interface specified in . + + An offset field does not +exist, sample_format is supposed to be +VIDEO_PALETTE_RAW, equivalent to +V4L2_PIX_FMT_GREY. The remaining fields are +probably equivalent to &v4l2-vbi-format;. + + Apparently only the Zoran (ZR 36120) driver implements +these ioctls. The semantics differ from those specified for V4L2 in two +ways. The parameters are reset on &func-open; and +VIDIOCSVBIFMT always returns an &EINVAL; if the +parameters are invalid. +
+ +
+ Miscellaneous + + V4L2 has no equivalent of the +VIDIOCGUNIT ioctl. Applications can find the VBI +device associated with a video capture device (or vice versa) by +reopening the device and requesting VBI data. For details see +. + + No replacement exists for VIDIOCKEY, +and the V4L functions for microcode programming. A new interface for +MPEG compression and playback devices is documented in . +
+ +
+ +
+ Changes of the V4L2 API + + Soon after the V4L API was added to the kernel it was +criticised as too inflexible. In August 1998 Bill Dirks proposed a +number of improvements and began to work on documentation, example +drivers and applications. With the help of other volunteers this +eventually became the V4L2 API, not just an extension but a +replacement for the V4L API. However it took another four years and +two stable kernel releases until the new API was finally accepted for +inclusion into the kernel in its present form. + +
+ Early Versions + 1998-08-20: First version. + + 1998-08-27: The &func-select; function was introduced. + + 1998-09-10: New video standard interface. + + 1998-09-18: The VIDIOC_NONCAP ioctl +was replaced by the otherwise meaningless O_TRUNC +&func-open; flag, and the aliases O_NONCAP and +O_NOIO were defined. Applications can set this +flag if they intend to access controls only, as opposed to capture +applications which need exclusive access. The +VIDEO_STD_XXX identifiers are now ordinals +instead of flags, and the video_std_construct() +helper function takes id and transmission arguments. + + 1998-09-28: Revamped video standard. Made video controls +individually enumerable. + + 1998-10-02: The id field was +removed from struct video_standard and the +color subcarrier fields were renamed. The &VIDIOC-QUERYSTD; ioctl was +renamed to &VIDIOC-ENUMSTD;, &VIDIOC-G-INPUT; to &VIDIOC-ENUMINPUT;. A +first draft of the Codec API was released. + + 1998-11-08: Many minor changes. Most symbols have been +renamed. Some material changes to &v4l2-capability;. + + 1998-11-12: The read/write directon of some ioctls was misdefined. + + 1998-11-14: V4L2_PIX_FMT_RGB24 +changed to V4L2_PIX_FMT_BGR24, and +V4L2_PIX_FMT_RGB32 changed to +V4L2_PIX_FMT_BGR32. Audio controls are now +accessible with the &VIDIOC-G-CTRL; and &VIDIOC-S-CTRL; ioctls under +names starting with V4L2_CID_AUDIO. The +V4L2_MAJOR define was removed from +videodev.h since it was only used once in the +videodev kernel module. The +YUV422 and YUV411 planar +image formats were added. + + 1998-11-28: A few ioctl symbols changed. Interfaces for codecs and +video output devices were added. + + 1999-01-14: A raw VBI capture interface was added. + + 1999-01-19: The VIDIOC_NEXTBUF ioctl + was removed. +
+ +
+ V4L2 Version 0.16 1999-01-31 + 1999-01-27: There is now one QBUF ioctl, VIDIOC_QWBUF and VIDIOC_QRBUF +are gone. VIDIOC_QBUF takes a v4l2_buffer as a parameter. Added +digital zoom (cropping) controls. +
+ + + +
+ V4L2 Version 0.18 1999-03-16 + Added a v4l to V4L2 ioctl compatibility layer to +videodev.c. Driver writers, this changes how you implement your ioctl +handler. See the Driver Writer's Guide. Added some more control id +codes. +
+ +
+ V4L2 Version 0.19 1999-06-05 + 1999-03-18: Fill in the category and catname fields of +v4l2_queryctrl objects before passing them to the driver. Required a +minor change to the VIDIOC_QUERYCTRL handlers in the sample +drivers. + 1999-03-31: Better compatibility for v4l memory capture +ioctls. Requires changes to drivers to fully support new compatibility +features, see Driver Writer's Guide and v4l2cap.c. Added new control +IDs: V4L2_CID_HFLIP, _VFLIP. Changed V4L2_PIX_FMT_YUV422P to _YUV422P, +and _YUV411P to _YUV411P. + 1999-04-04: Added a few more control IDs. + 1999-04-07: Added the button control type. + 1999-05-02: Fixed a typo in videodev.h, and added the +V4L2_CTRL_FLAG_GRAYED (later V4L2_CTRL_FLAG_GRABBED) flag. + 1999-05-20: Definition of VIDIOC_G_CTRL was wrong causing +a malfunction of this ioctl. + 1999-06-05: Changed the value of +V4L2_CID_WHITENESS. +
+ +
+ V4L2 Version 0.20 (1999-09-10) + + Version 0.20 introduced a number of changes which were +not backward compatible with 0.19 and earlier +versions. Purpose of these changes was to simplify the API, while +making it more extensible and following common Linux driver API +conventions. + + + + Some typos in V4L2_FMT_FLAG +symbols were fixed. &v4l2-clip; was changed for compatibility with +v4l. (1999-08-30) + + + + V4L2_TUNER_SUB_LANG1 was added. +(1999-09-05) + + + + All ioctl() commands that used an integer argument now +take a pointer to an integer. Where it makes sense, ioctls will return +the actual new value in the integer pointed to by the argument, a +common convention in the V4L2 API. The affected ioctls are: +VIDIOC_PREVIEW, VIDIOC_STREAMON, VIDIOC_STREAMOFF, VIDIOC_S_FREQ, +VIDIOC_S_INPUT, VIDIOC_S_OUTPUT, VIDIOC_S_EFFECT. For example + +err = ioctl (fd, VIDIOC_XXX, V4L2_XXX); + becomes +int a = V4L2_XXX; err = ioctl(fd, VIDIOC_XXX, &a); + + + + + + All the different get- and set-format commands were +swept into one &VIDIOC-G-FMT; and &VIDIOC-S-FMT; ioctl taking a union +and a type field selecting the union member as parameter. Purpose is to +simplify the API by eliminating several ioctls and to allow new and +driver private data streams without adding new ioctls. + + This change obsoletes the following ioctls: +VIDIOC_S_INFMT, +VIDIOC_G_INFMT, +VIDIOC_S_OUTFMT, +VIDIOC_G_OUTFMT, +VIDIOC_S_VBIFMT and +VIDIOC_G_VBIFMT. The image format structure +v4l2_format was renamed to &v4l2-pix-format;, +while &v4l2-format; is now the envelopping structure for all format +negotiations. + + + + Similar to the changes above, the +VIDIOC_G_PARM and +VIDIOC_S_PARM ioctls were merged with +VIDIOC_G_OUTPARM and +VIDIOC_S_OUTPARM. A +type field in the new &v4l2-streamparm; +selects the respective union member. + + This change obsoletes the +VIDIOC_G_OUTPARM and +VIDIOC_S_OUTPARM ioctls. + + + + Control enumeration was simplified, and two new +control flags were introduced and one dropped. The +catname field was replaced by a +group field. + + Drivers can now flag unsupported and temporarily +unavailable controls with V4L2_CTRL_FLAG_DISABLED +and V4L2_CTRL_FLAG_GRABBED respectively. The +group name indicates a possibly narrower +classification than the category. In other +words, there may be multiple groups within a category. Controls within +a group would typically be drawn within a group box. Controls in +different categories might have a greater separation, or may even +appear in separate windows. + + + + The &v4l2-buffer; timestamp +was changed to a 64 bit integer, containing the sampling or output +time of the frame in nanoseconds. Additionally timestamps will be in +absolute system time, not starting from zero at the beginning of a +stream. The data type name for timestamps is stamp_t, defined as a +signed 64-bit integer. Output devices should not send a buffer out +until the time in the timestamp field has arrived. I would like to +follow SGI's lead, and adopt a multimedia timestamping system like +their UST (Unadjusted System Time). See +http://web.archive.org/web/*/http://reality.sgi.com +/cpirazzi_engr/lg/time/intro.html. +UST uses timestamps that are 64-bit signed integers +(not struct timeval's) and given in nanosecond units. The UST clock +starts at zero when the system is booted and runs continuously and +uniformly. It takes a little over 292 years for UST to overflow. There +is no way to set the UST clock. The regular Linux time-of-day clock +can be changed periodically, which would cause errors if it were being +used for timestamping a multimedia stream. A real UST style clock will +require some support in the kernel that is not there yet. But in +anticipation, I will change the timestamp field to a 64-bit integer, +and I will change the v4l2_masterclock_gettime() function (used only +by drivers) to return a 64-bit integer. + + + + A sequence field was added +to &v4l2-buffer;. The sequence field counts +captured frames, it is ignored by output devices. When a capture +driver drops a frame, the sequence number of that frame is +skipped. + + +
+ +
+ V4L2 Version 0.20 incremental changes + + + 1999-12-23: In &v4l2-vbi-format; the +reserved1 field became +offset. Previously drivers were required to +clear the reserved1 field. + + 2000-01-13: The + V4L2_FMT_FLAG_NOT_INTERLACED flag was added. + + 2000-07-31: The linux/poll.h header +is now included by videodev.h for compatibility +with the original videodev.h file. + + 2000-11-20: V4L2_TYPE_VBI_OUTPUT and +V4L2_PIX_FMT_Y41P were added. + + 2000-11-25: V4L2_TYPE_VBI_INPUT was +added. + + 2000-12-04: A couple typos in symbol names were fixed. + + 2001-01-18: To avoid namespace conflicts the +fourcc macro defined in the +videodev.h header file was renamed to +v4l2_fourcc. + + 2001-01-25: A possible driver-level compatibility problem +between the videodev.h file in Linux 2.4.0 and +the videodev.h file included in the +videodevX patch was fixed. Users of an earlier +version of videodevX on Linux 2.4.0 should +recompile their V4L and V4L2 drivers. + + 2001-01-26: A possible kernel-level incompatibility +between the videodev.h file in the +videodevX patch and the +videodev.h file in Linux 2.2.x with devfs patches +applied was fixed. + + 2001-03-02: Certain V4L ioctls which pass data in both +direction although they are defined with read-only parameter, did not +work correctly through the backward compatibility layer. +[Solution?] + + 2001-04-13: Big endian 16-bit RGB formats were added. + + 2001-09-17: New YUV formats and the &VIDIOC-G-FREQUENCY; and +&VIDIOC-S-FREQUENCY; ioctls were added. (The old +VIDIOC_G_FREQ and +VIDIOC_S_FREQ ioctls did not take multiple tuners +into account.) + + 2000-09-18: V4L2_BUF_TYPE_VBI was +added. This may break compatibility as the +&VIDIOC-G-FMT; and &VIDIOC-S-FMT; ioctls may fail now if the struct +v4l2_fmt type +field does not contain V4L2_BUF_TYPE_VBI. In the +documentation of the &v4l2-vbi-format; +offset field the ambiguous phrase "rising +edge" was changed to "leading edge". +
+ +
+ V4L2 Version 0.20 2000-11-23 + + A number of changes were made to the raw VBI +interface. + + + + Figures clarifying the line numbering scheme were +added to the V4L2 API specification. The +start[0] and +start[1] fields no longer count line +numbers beginning at zero. Rationale: a) The previous definition was +unclear. b) The start[] values are ordinal +numbers. c) There is no point in inventing a new line numbering +scheme. We now use line number as defined by ITU-R, period. +Compatibility: Add one to the start values. Applications depending on +the previous semantics may not function correctly. + + + + The restriction "count[0] > 0 and count[1] > 0" +has been relaxed to "(count[0] + count[1]) > 0". Rationale: +Drivers may allocate resources at scan line granularity and some data +services are transmitted only on the first field. The comment that +both count values will usually be equal is +misleading and pointless and has been removed. This change +breaks compatibility with earlier versions: +Drivers may return EINVAL, applications may not function +correctly. + + + + Drivers are again permitted to return negative +(unknown) start values as proposed earlier. Why this feature was +dropped is unclear. This change may break +compatibility with applications depending on the start +values being positive. The use of EBUSY and +EINVAL error codes with the &VIDIOC-S-FMT; ioctl +was clarified. The &EBUSY; was finally documented, and the +reserved2 field which was previously +mentioned only in the videodev.h header +file. + + + + New buffer types +V4L2_TYPE_VBI_INPUT and +V4L2_TYPE_VBI_OUTPUT were added. The former is an +alias for the old V4L2_TYPE_VBI, the latter was +missing in the videodev.h file. + + +
+ +
+ V4L2 Version 0.20 2002-07-25 + Added sliced VBI interface proposal. +
+ +
+ V4L2 in Linux 2.5.46, 2002-10 + + Around October-November 2002, prior to an announced +feature freeze of Linux 2.5, the API was revised, drawing from +experience with V4L2 0.20. This unnamed version was finally merged +into Linux 2.5.46. + + + + As specified in , drivers +must make related device functions available under all minor device +numbers. + + + + The &func-open; function requires access mode +O_RDWR regardless of the device type. All V4L2 +drivers exchanging data with applications must support the +O_NONBLOCK flag. The O_NOIO +flag, a V4L2 symbol which aliased the meaningless +O_TRUNC to indicate accesses without data +exchange (panel applications) was dropped. Drivers must stay in "panel +mode" until the application attempts to initiate a data exchange, see +. + + + + The &v4l2-capability; changed dramatically. Note that +also the size of the structure changed, which is encoded in the ioctl +request code, thus older V4L2 devices will respond with an &EINVAL; to +the new &VIDIOC-QUERYCAP; ioctl. + + There are new fields to identify the driver, a new RDS +device function V4L2_CAP_RDS_CAPTURE, the +V4L2_CAP_AUDIO flag indicates if the device has +any audio connectors, another I/O capability +V4L2_CAP_ASYNCIO can be flagged. In response to +these changes the type field became a bit +set and was merged into the flags field. +V4L2_FLAG_TUNER was renamed to +V4L2_CAP_TUNER, +V4L2_CAP_VIDEO_OVERLAY replaced +V4L2_FLAG_PREVIEW and +V4L2_CAP_VBI_CAPTURE and +V4L2_CAP_VBI_OUTPUT replaced +V4L2_FLAG_DATA_SERVICE. +V4L2_FLAG_READ and +V4L2_FLAG_WRITE were merged into +V4L2_CAP_READWRITE. + + The redundant fields +inputs, outputs +and audios were removed. These properties +can be determined as described in and . + + The somewhat volatile and therefore barely useful +fields maxwidth, +maxheight, +minwidth, +minheight, +maxframerate were removed. This information +is available as described in and +. + + V4L2_FLAG_SELECT was removed. We +believe the select() function is important enough to require support +of it in all V4L2 drivers exchanging data with applications. The +redundant V4L2_FLAG_MONOCHROME flag was removed, +this information is available as described in . + + + + In &v4l2-input; the +assoc_audio field and the +capability field and its only flag +V4L2_INPUT_CAP_AUDIO was replaced by the new +audioset field. Instead of linking one +video input to one audio input this field reports all audio inputs +this video input combines with. + + New fields are tuner +(reversing the former link from tuners to video inputs), +std and +status. + + Accordingly &v4l2-output; lost its +capability and +assoc_audio fields. +audioset, +modulator and +std where added instead. + + + + The &v4l2-audio; field +audio was renamed to +index, for consistency with other +structures. A new capability flag +V4L2_AUDCAP_STEREO was added to indicated if the +audio input in question supports stereo sound. +V4L2_AUDCAP_EFFECTS and the corresponding +V4L2_AUDMODE flags where removed. This can be +easily implemented using controls. (However the same applies to AVL +which is still there.) + + Again for consistency the &v4l2-audioout; field +audio was renamed to +index. + + + + The &v4l2-tuner; +input field was replaced by an +index field, permitting devices with +multiple tuners. The link between video inputs and tuners is now +reversed, inputs point to their tuner. The +std substructure became a +simple set (more about this below) and moved into &v4l2-input;. A +type field was added. + + Accordingly in &v4l2-modulator; the +output was replaced by an +index field. + + In &v4l2-frequency; the +port field was replaced by a +tuner field containing the respective tuner +or modulator index number. A tuner type +field was added and the reserved field +became larger for future extensions (satellite tuners in +particular). + + + + The idea of completely transparent video standards was +dropped. Experience showed that applications must be able to work with +video standards beyond presenting the user a menu. Instead of +enumerating supported standards with an ioctl applications can now +refer to standards by &v4l2-std-id; and symbols defined in the +videodev2.h header file. For details see . The &VIDIOC-G-STD; and +&VIDIOC-S-STD; now take a pointer to this type as argument. +&VIDIOC-QUERYSTD; was added to autodetect the received standard, if +the hardware has this capability. In &v4l2-standard; an +index field was added for &VIDIOC-ENUMSTD;. +A &v4l2-std-id; field named id was added as +machine readable identifier, also replacing the +transmission field. The misleading +framerate field was renamed +to frameperiod. The now obsolete +colorstandard information, originally +needed to distguish between variations of standards, were +removed. + + Struct v4l2_enumstd ceased to +be. &VIDIOC-ENUMSTD; now takes a pointer to a &v4l2-standard; +directly. The information which standards are supported by a +particular video input or output moved into &v4l2-input; and +&v4l2-output; fields named std, +respectively. + + + + The &v4l2-queryctrl; fields +category and +group did not catch on and/or were not +implemented as expected and therefore removed. + + + + The &VIDIOC-TRY-FMT; ioctl was added to negotiate data +formats as with &VIDIOC-S-FMT;, but without the overhead of +programming the hardware and regardless of I/O in progress. + + In &v4l2-format; the fmt +union was extended to contain &v4l2-window;. All image format +negotiations are now possible with VIDIOC_G_FMT, +VIDIOC_S_FMT and +VIDIOC_TRY_FMT; ioctl. The +VIDIOC_G_WIN and +VIDIOC_S_WIN ioctls to prepare for a video +overlay were removed. The type field +changed to type &v4l2-buf-type; and the buffer type names changed as +follows. + + + + Old defines + &v4l2-buf-type; + + + + + V4L2_BUF_TYPE_CAPTURE + V4L2_BUF_TYPE_VIDEO_CAPTURE + + + V4L2_BUF_TYPE_CODECIN + Omitted for now + + + V4L2_BUF_TYPE_CODECOUT + Omitted for now + + + V4L2_BUF_TYPE_EFFECTSIN + Omitted for now + + + V4L2_BUF_TYPE_EFFECTSIN2 + Omitted for now + + + V4L2_BUF_TYPE_EFFECTSOUT + Omitted for now + + + V4L2_BUF_TYPE_VIDEOOUT + V4L2_BUF_TYPE_VIDEO_OUTPUT + + + - + V4L2_BUF_TYPE_VIDEO_OVERLAY + + + - + V4L2_BUF_TYPE_VBI_CAPTURE + + + - + V4L2_BUF_TYPE_VBI_OUTPUT + + + - + V4L2_BUF_TYPE_SLICED_VBI_CAPTURE + + + - + V4L2_BUF_TYPE_SLICED_VBI_OUTPUT + + + V4L2_BUF_TYPE_PRIVATE_BASE + V4L2_BUF_TYPE_PRIVATE + + + + + + + + In &v4l2-fmtdesc; a &v4l2-buf-type; field named +type was added as in &v4l2-format;. The +VIDIOC_ENUM_FBUFFMT ioctl is no longer needed and +was removed. These calls can be replaced by &VIDIOC-ENUM-FMT; with +type V4L2_BUF_TYPE_VIDEO_OVERLAY. + + + + In &v4l2-pix-format; the +depth field was removed, assuming +applications which recognize the format by its four-character-code +already know the color depth, and others do not care about it. The +same rationale lead to the removal of the +V4L2_FMT_FLAG_COMPRESSED flag. The +V4L2_FMT_FLAG_SWCONVECOMPRESSED flag was removed +because drivers are not supposed to convert images in kernel space. A +user library of conversion functions should be provided instead. The +V4L2_FMT_FLAG_BYTESPERLINE flag was redundant. +Applications can set the bytesperline field +to zero to get a reasonable default. Since the remaining flags were +replaced as well, the flags field itself +was removed. + The interlace flags were replaced by a &v4l2-field; +value in a newly added field +field. + + + + Old flag + &v4l2-field; + + + + + V4L2_FMT_FLAG_NOT_INTERLACED + ? + + + V4L2_FMT_FLAG_INTERLACED += V4L2_FMT_FLAG_COMBINED + V4L2_FIELD_INTERLACED + + + V4L2_FMT_FLAG_TOPFIELD += V4L2_FMT_FLAG_ODDFIELD + V4L2_FIELD_TOP + + + V4L2_FMT_FLAG_BOTFIELD += V4L2_FMT_FLAG_EVENFIELD + V4L2_FIELD_BOTTOM + + + - + V4L2_FIELD_SEQ_TB + + + - + V4L2_FIELD_SEQ_BT + + + - + V4L2_FIELD_ALTERNATE + + + + + + The color space flags were replaced by a +&v4l2-colorspace; value in a newly added +colorspace field, where one of +V4L2_COLORSPACE_SMPTE170M, +V4L2_COLORSPACE_BT878, +V4L2_COLORSPACE_470_SYSTEM_M or +V4L2_COLORSPACE_470_SYSTEM_BG replaces +V4L2_FMT_CS_601YUV. + + + + In &v4l2-requestbuffers; the +type field was properly defined as +&v4l2-buf-type;. Buffer types changed as mentioned above. A new +memory field of type &v4l2-memory; was +added to distinguish between I/O methods using buffers allocated +by the driver or the application. See for +details. + + + + In &v4l2-buffer; the type +field was properly defined as &v4l2-buf-type;. Buffer types changed as +mentioned above. A field field of type +&v4l2-field; was added to indicate if a buffer contains a top or +bottom field. The old field flags were removed. Since no unadjusted +system time clock was added to the kernel as planned, the +timestamp field changed back from type +stamp_t, an unsigned 64 bit integer expressing the sample time in +nanoseconds, to struct timeval. With the +addition of a second memory mapping method the +offset field moved into union +m, and a new +memory field of type &v4l2-memory; was +added to distinguish between I/O methods. See +for details. + + The V4L2_BUF_REQ_CONTIG +flag was used by the V4L compatibility layer, after changes to this +code it was no longer needed. The +V4L2_BUF_ATTR_DEVICEMEM flag would indicate if +the buffer was indeed allocated in device memory rather than DMA-able +system memory. It was barely useful and so was removed. + + + + In &v4l2-framebuffer; the +base[3] array anticipating double- and +triple-buffering in off-screen video memory, however without defining +a synchronization mechanism, was replaced by a single pointer. The +V4L2_FBUF_CAP_SCALEUP and +V4L2_FBUF_CAP_SCALEDOWN flags were removed. +Applications can determine this capability more accurately using the +new cropping and scaling interface. The +V4L2_FBUF_CAP_CLIPPING flag was replaced by +V4L2_FBUF_CAP_LIST_CLIPPING and +V4L2_FBUF_CAP_BITMAP_CLIPPING. + + + + In &v4l2-clip; the x, +y, width and +height field moved into a +c substructure of type &v4l2-rect;. The +x and y fields +were renamed to left and +top, &ie; offsets to a context dependent +origin. + + + + In &v4l2-window; the x, +y, width and +height field moved into a +w substructure as above. A +field field of type %v4l2-field; was added +to distinguish between field and frame (interlaced) overlay. + + + + The digital zoom interface, including struct +v4l2_zoomcap, struct +v4l2_zoom, +V4L2_ZOOM_NONCAP and +V4L2_ZOOM_WHILESTREAMING was replaced by a new +cropping and scaling interface. The previously unused struct +v4l2_cropcap and +v4l2_crop where redefined for this purpose. +See for details. + + + + In &v4l2-vbi-format; the +SAMPLE_FORMAT field now contains a +four-character-code as used to identify video image formats and +V4L2_PIX_FMT_GREY replaces the +V4L2_VBI_SF_UBYTE define. The +reserved field was extended. + + + + In &v4l2-captureparm; the type of the +timeperframe field changed from unsigned +long to &v4l2-fract;. This allows the accurate expression of multiples +of the NTSC-M frame rate 30000 / 1001. A new field +readbuffers was added to control the driver +behaviour in read I/O mode. + + Similar changes were made to &v4l2-outputparm;. + + + + The struct v4l2_performance +and VIDIOC_G_PERF ioctl were dropped. Except when +using the read/write I/O method, which is +limited anyway, this information is already available to +applications. + + + + The example transformation from RGB to YCbCr color +space in the old V4L2 documentation was inaccurate, this has been +corrected in . + + +
+ +
+ V4L2 2003-06-19 + + + + A new capability flag +V4L2_CAP_RADIO was added for radio devices. Prior +to this change radio devices would identify solely by having exactly one +tuner whose type field reads V4L2_TUNER_RADIO. + + + + An optional driver access priority mechanism was +added, see for details. + + + + The audio input and output interface was found to be +incomplete. + Previously the &VIDIOC-G-AUDIO; +ioctl would enumerate the available audio inputs. An ioctl to +determine the current audio input, if more than one combines with the +current video input, did not exist. So +VIDIOC_G_AUDIO was renamed to +VIDIOC_G_AUDIO_OLD, this ioctl was removed on +Kernel 2.6.39. The &VIDIOC-ENUMAUDIO; ioctl was added to enumerate +audio inputs, while &VIDIOC-G-AUDIO; now reports the current audio +input. + The same changes were made to &VIDIOC-G-AUDOUT; and +&VIDIOC-ENUMAUDOUT;. + Until further the "videodev" module will automatically +translate between the old and new ioctls, but drivers and applications +must be updated to successfully compile again. + + + + The &VIDIOC-OVERLAY; ioctl was incorrectly defined with +write-read parameter. It was changed to write-only, while the write-read +version was renamed to VIDIOC_OVERLAY_OLD. The old +ioctl was removed on Kernel 2.6.39. Until further the "videodev" +kernel module will automatically translate to the new version, so drivers +must be recompiled, but not applications. + + + + incorrectly stated that +clipping rectangles define regions where the video can be seen. +Correct is that clipping rectangles define regions where +no video shall be displayed and so the graphics +surface can be seen. + + + + The &VIDIOC-S-PARM; and &VIDIOC-S-CTRL; ioctls were +defined with write-only parameter, inconsistent with other ioctls +modifying their argument. They were changed to write-read, while a +_OLD suffix was added to the write-only versions. +The old ioctls were removed on Kernel 2.6.39. Drivers and +applications assuming a constant parameter need an update. + + +
+ +
+ V4L2 2003-11-05 + + + In the following pixel +formats were incorrectly transferred from Bill Dirks' V4L2 +specification. Descriptions below refer to bytes in memory, in +ascending address order. + + + + Symbol + In this document prior to revision +0.5 + Corrected + + + + + V4L2_PIX_FMT_RGB24 + B, G, R + R, G, B + + + V4L2_PIX_FMT_BGR24 + R, G, B + B, G, R + + + V4L2_PIX_FMT_RGB32 + B, G, R, X + R, G, B, X + + + V4L2_PIX_FMT_BGR32 + R, G, B, X + B, G, R, X + + + + The +V4L2_PIX_FMT_BGR24 example was always +correct. + In the mapping +of the V4L VIDEO_PALETTE_RGB24 and +VIDEO_PALETTE_RGB32 formats to V4L2 pixel formats +was accordingly corrected. + + + + Unrelated to the fixes above, drivers may still +interpret some V4L2 RGB pixel formats differently. These issues have +yet to be addressed, for details see . + + +
+ +
+ V4L2 in Linux 2.6.6, 2004-05-09 + + + The &VIDIOC-CROPCAP; ioctl was incorrectly defined +with read-only parameter. It is now defined as write-read ioctl, while +the read-only version was renamed to +VIDIOC_CROPCAP_OLD. The old ioctl was removed +on Kernel 2.6.39. + + +
+ +
+ V4L2 in Linux 2.6.8 + + + A new field input (former +reserved[0]) was added to the &v4l2-buffer; +structure. Purpose of this field is to alternate between video inputs +(⪚ cameras) in step with the video capturing process. This function +must be enabled with the new V4L2_BUF_FLAG_INPUT +flag. The flags field is no longer +read-only. + + +
+ +
+ V4L2 spec erratum 2004-08-01 + + + + The return value of the + function was incorrectly documented. + + + + Audio output ioctls end in -AUDOUT, not -AUDIOOUT. + + + + In the Current Audio Input example the +VIDIOC_G_AUDIO ioctl took the wrong +argument. + + + + The documentation of the &VIDIOC-QBUF; and +&VIDIOC-DQBUF; ioctls did not mention the &v4l2-buffer; +memory field. It was also missing from +examples. Also on the VIDIOC_DQBUF page the &EIO; +was not documented. + + +
+ +
+ V4L2 in Linux 2.6.14 + + + A new sliced VBI interface was added. It is documented +in and replaces the interface first +proposed in V4L2 specification 0.8. + + +
+ +
+ V4L2 in Linux 2.6.15 + + + The &VIDIOC-LOG-STATUS; ioctl was added. + + + + New video standards +V4L2_STD_NTSC_443, +V4L2_STD_SECAM_LC, +V4L2_STD_SECAM_DK (a set of SECAM D, K and K1), +and V4L2_STD_ATSC (a set of +V4L2_STD_ATSC_8_VSB and +V4L2_STD_ATSC_16_VSB) were defined. Note the +V4L2_STD_525_60 set now includes +V4L2_STD_NTSC_443. See also . + + + + The VIDIOC_G_COMP and +VIDIOC_S_COMP ioctl were renamed to +VIDIOC_G_MPEGCOMP and +VIDIOC_S_MPEGCOMP respectively. Their argument +was replaced by a struct +v4l2_mpeg_compression pointer. (The +VIDIOC_G_MPEGCOMP and +VIDIOC_S_MPEGCOMP ioctls where removed in Linux +2.6.25.) + + +
+ +
+ V4L2 spec erratum 2005-11-27 + The capture example in +called the &VIDIOC-S-CROP; ioctl without checking if cropping is +supported. In the video standard selection example in + the &VIDIOC-S-STD; call used the wrong +argument type. +
+ +
+ V4L2 spec erratum 2006-01-10 + + + The V4L2_IN_ST_COLOR_KILL flag in +&v4l2-input; not only indicates if the color killer is enabled, but +also if it is active. (The color killer disables color decoding when +it detects no color in the video signal to improve the image +quality.) + + + + &VIDIOC-S-PARM; is a write-read ioctl, not write-only as +stated on its reference page. The ioctl changed in 2003 as noted above. + + +
+ +
+ V4L2 spec erratum 2006-02-03 + + + In &v4l2-captureparm; and &v4l2-outputparm; the +timeperframe field gives the time in +seconds, not microseconds. + + +
+ +
+ V4L2 spec erratum 2006-02-04 + + + The clips field in +&v4l2-window; must point to an array of &v4l2-clip;, not a linked +list, because drivers ignore the struct +v4l2_clip.next +pointer. + + +
+ +
+ V4L2 in Linux 2.6.17 + + + New video standard macros were added: +V4L2_STD_NTSC_M_KR (NTSC M South Korea), and the +sets V4L2_STD_MN, +V4L2_STD_B, V4L2_STD_GH and +V4L2_STD_DK. The +V4L2_STD_NTSC and +V4L2_STD_SECAM sets now include +V4L2_STD_NTSC_M_KR and +V4L2_STD_SECAM_LC respectively. + + + + A new V4L2_TUNER_MODE_LANG1_LANG2 +was defined to record both languages of a bilingual program. The +use of V4L2_TUNER_MODE_STEREO for this purpose +is deprecated now. See the &VIDIOC-G-TUNER; section for +details. + + +
+ +
+ V4L2 spec erratum 2006-09-23 (Draft 0.15) + + + In various places +V4L2_BUF_TYPE_SLICED_VBI_CAPTURE and +V4L2_BUF_TYPE_SLICED_VBI_OUTPUT of the sliced VBI +interface were not mentioned along with other buffer types. + + + + In it was clarified +that the &v4l2-audio; mode field is a flags +field. + + + + did not mention the +sliced VBI and radio capability flags. + + + + In it was +clarified that applications must initialize the tuner +type field of &v4l2-frequency; before +calling &VIDIOC-S-FREQUENCY;. + + + + The reserved array +in &v4l2-requestbuffers; has 2 elements, not 32. + + + + In and the device file names +/dev/vout which never caught on were replaced +by /dev/video. + + + + With Linux 2.6.15 the possible range for VBI device minor +numbers was extended from 224-239 to 224-255. Accordingly device file names +/dev/vbi0 to /dev/vbi31 are +possible now. + + +
+ +
+ V4L2 in Linux 2.6.18 + + + New ioctls &VIDIOC-G-EXT-CTRLS;, &VIDIOC-S-EXT-CTRLS; +and &VIDIOC-TRY-EXT-CTRLS; were added, a flag to skip unsupported +controls with &VIDIOC-QUERYCTRL;, new control types +V4L2_CTRL_TYPE_INTEGER64 and +V4L2_CTRL_TYPE_CTRL_CLASS (), and new control flags +V4L2_CTRL_FLAG_READ_ONLY, +V4L2_CTRL_FLAG_UPDATE, +V4L2_CTRL_FLAG_INACTIVE and +V4L2_CTRL_FLAG_SLIDER (). See for details. + + +
+ +
+ V4L2 in Linux 2.6.19 + + + In &v4l2-sliced-vbi-cap; a buffer type field was added +replacing a reserved field. Note on architectures where the size of +enum types differs from int types the size of the structure changed. +The &VIDIOC-G-SLICED-VBI-CAP; ioctl was redefined from being read-only +to write-read. Applications must initialize the type field and clear +the reserved fields now. These changes may break the +compatibility with older drivers and applications. + + + + The ioctls &VIDIOC-ENUM-FRAMESIZES; and +&VIDIOC-ENUM-FRAMEINTERVALS; were added. + + + + A new pixel format V4L2_PIX_FMT_RGB444 () was added. + + +
+ +
+ V4L2 spec erratum 2006-10-12 (Draft 0.17) + + + V4L2_PIX_FMT_HM12 () is a YUV 4:2:0, not 4:2:2 format. + + +
+ +
+ V4L2 in Linux 2.6.21 + + + The videodev2.h header file is +now dual licensed under GNU General Public License version two or +later, and under a 3-clause BSD-style license. + + +
+ +
+ V4L2 in Linux 2.6.22 + + + Two new field orders + V4L2_FIELD_INTERLACED_TB and + V4L2_FIELD_INTERLACED_BT were + added. See for details. + + + + Three new clipping/blending methods with a global or +straight or inverted local alpha value were added to the video overlay +interface. See the description of the &VIDIOC-G-FBUF; and +&VIDIOC-S-FBUF; ioctls for details. + A new global_alpha field +was added to v4l2_window, +extending the structure. This may break +compatibility with applications using a struct +v4l2_window directly. However the VIDIOC_G/S/TRY_FMT ioctls, which take a +pointer to a v4l2_format parent +structure with padding bytes at the end, are not affected. + + + + The format of the chromakey +field in &v4l2-window; changed from "host order RGB32" to a pixel +value in the same format as the framebuffer. This may break +compatibility with existing applications. Drivers +supporting the "host order RGB32" format are not known. + + + +
+ +
+ V4L2 in Linux 2.6.24 + + + The pixel formats +V4L2_PIX_FMT_PAL8, +V4L2_PIX_FMT_YUV444, +V4L2_PIX_FMT_YUV555, +V4L2_PIX_FMT_YUV565 and +V4L2_PIX_FMT_YUV32 were added. + + +
+ +
+ V4L2 in Linux 2.6.25 + + + The pixel formats +V4L2_PIX_FMT_Y16 and +V4L2_PIX_FMT_SBGGR16 were added. + + + New controls +V4L2_CID_POWER_LINE_FREQUENCY, +V4L2_CID_HUE_AUTO, +V4L2_CID_WHITE_BALANCE_TEMPERATURE, +V4L2_CID_SHARPNESS and +V4L2_CID_BACKLIGHT_COMPENSATION were added. The +controls V4L2_CID_BLACK_LEVEL, +V4L2_CID_WHITENESS, +V4L2_CID_HCENTER and +V4L2_CID_VCENTER were deprecated. + + + + A Camera controls +class was added, with the new controls +V4L2_CID_EXPOSURE_AUTO, +V4L2_CID_EXPOSURE_ABSOLUTE, +V4L2_CID_EXPOSURE_AUTO_PRIORITY, +V4L2_CID_PAN_RELATIVE, +V4L2_CID_TILT_RELATIVE, +V4L2_CID_PAN_RESET, +V4L2_CID_TILT_RESET, +V4L2_CID_PAN_ABSOLUTE, +V4L2_CID_TILT_ABSOLUTE, +V4L2_CID_FOCUS_ABSOLUTE, +V4L2_CID_FOCUS_RELATIVE and +V4L2_CID_FOCUS_AUTO. + + + The VIDIOC_G_MPEGCOMP and +VIDIOC_S_MPEGCOMP ioctls, which were superseded +by the extended controls +interface in Linux 2.6.18, where finally removed from the +videodev2.h header file. + + +
+ +
+ V4L2 in Linux 2.6.26 + + + The pixel formats +V4L2_PIX_FMT_Y16 and +V4L2_PIX_FMT_SBGGR16 were added. + + + Added user controls +V4L2_CID_CHROMA_AGC and +V4L2_CID_COLOR_KILLER. + + +
+ +
+ V4L2 in Linux 2.6.27 + + + The &VIDIOC-S-HW-FREQ-SEEK; ioctl and the +V4L2_CAP_HW_FREQ_SEEK capability were added. + + + The pixel formats +V4L2_PIX_FMT_YVYU, +V4L2_PIX_FMT_PCA501, +V4L2_PIX_FMT_PCA505, +V4L2_PIX_FMT_PCA508, +V4L2_PIX_FMT_PCA561, +V4L2_PIX_FMT_SGBRG8, +V4L2_PIX_FMT_PAC207 and +V4L2_PIX_FMT_PJPG were added. + + +
+ +
+ V4L2 in Linux 2.6.28 + + + Added V4L2_MPEG_AUDIO_ENCODING_AAC and +V4L2_MPEG_AUDIO_ENCODING_AC3 MPEG audio encodings. + + + Added V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC MPEG +video encoding. + + + The pixel formats +V4L2_PIX_FMT_SGRBG10 and +V4L2_PIX_FMT_SGRBG10DPCM8 were added. + + +
+ +
+ V4L2 in Linux 2.6.29 + + + The VIDIOC_G_CHIP_IDENT ioctl was renamed +to VIDIOC_G_CHIP_IDENT_OLD and &VIDIOC-DBG-G-CHIP-IDENT; +was introduced in its place. The old struct v4l2_chip_ident +was renamed to v4l2_chip_ident_old. + + + The pixel formats +V4L2_PIX_FMT_VYUY, +V4L2_PIX_FMT_NV16 and +V4L2_PIX_FMT_NV61 were added. + + + Added camera controls +V4L2_CID_ZOOM_ABSOLUTE, +V4L2_CID_ZOOM_RELATIVE, +V4L2_CID_ZOOM_CONTINUOUS and +V4L2_CID_PRIVACY. + + +
+
+ V4L2 in Linux 2.6.30 + + + New control flag V4L2_CTRL_FLAG_WRITE_ONLY was added. + + + New control V4L2_CID_COLORFX was added. + + +
+
+ V4L2 in Linux 2.6.32 + + + In order to be easier to compare a V4L2 API and a kernel +version, now V4L2 API is numbered using the Linux Kernel version numeration. + + + Finalized the RDS capture API. See for +more information. + + + Added new capabilities for modulators and RDS encoders. + + + Add description for libv4l API. + + + Added support for string controls via new type V4L2_CTRL_TYPE_STRING. + + + Added V4L2_CID_BAND_STOP_FILTER documentation. + + + Added FM Modulator (FM TX) Extended Control Class: V4L2_CTRL_CLASS_FM_TX and their Control IDs. + + + Added Remote Controller chapter, describing the default Remote Controller mapping for media devices. + + +
+
+ V4L2 in Linux 2.6.33 + + + Added support for Digital Video timings in order to support HDTV receivers and transmitters. + + +
+
+ V4L2 in Linux 2.6.34 + + + Added +V4L2_CID_IRIS_ABSOLUTE and +V4L2_CID_IRIS_RELATIVE controls to the + Camera controls class. + + + +
+
+ V4L2 in Linux 2.6.37 + + + Remove the vtx (videotext/teletext) API. This API was no longer +used and no hardware exists to verify the API. Nor were any userspace applications found +that used it. It was originally scheduled for removal in 2.6.35. + + + +
+
+ V4L2 in Linux 2.6.39 + + + The old VIDIOC_*_OLD symbols and V4L1 support were removed. + + + Multi-planar API added. Does not affect the compatibility of + current drivers and applications. See + multi-planar API + for details. + + +
+ +
+ Relation of V4L2 to other Linux multimedia APIs + +
+ X Video Extension + + The X Video Extension (abbreviated XVideo or just Xv) is +an extension of the X Window system, implemented for example by the +XFree86 project. Its scope is similar to V4L2, an API to video capture +and output devices for X clients. Xv allows applications to display +live video in a window, send window contents to a TV output, and +capture or output still images in XPixmaps + This is not implemented in XFree86. + . With their implementation XFree86 makes the +extension available across many operating systems and +architectures. + + Because the driver is embedded into the X server Xv has a +number of advantages over the V4L2 video +overlay interface. The driver can easily determine the overlay +target, &ie; visible graphics memory or off-screen buffers for a +destructive overlay. It can program the RAMDAC for a non-destructive +overlay, scaling or color-keying, or the clipping functions of the +video capture hardware, always in sync with drawing operations or +windows moving or changing their stacking order. + + To combine the advantages of Xv and V4L a special Xv +driver exists in XFree86 and XOrg, just programming any overlay capable +Video4Linux device it finds. To enable it +/etc/X11/XF86Config must contain these lines: + +Section "Module" + Load "v4l" +EndSection + + As of XFree86 4.2 this driver still supports only V4L +ioctls, however it should work just fine with all V4L2 devices through +the V4L2 backward-compatibility layer. Since V4L2 permits multiple +opens it is possible (if supported by the V4L2 driver) to capture +video while an X client requested video overlay. Restrictions of +simultaneous capturing and overlay are discussed in apply. + + Only marginally related to V4L2, XFree86 extended Xv to +support hardware YUV to RGB conversion and scaling for faster video +playback, and added an interface to MPEG-2 decoding hardware. This API +is useful to display images captured with V4L2 devices. +
+ +
+ Digital Video + + V4L2 does not support digital terrestrial, cable or +satellite broadcast. A separate project aiming at digital receivers +exists. You can find its homepage at http://linuxtv.org. The Linux DVB API +has no connection to the V4L2 API except that drivers for hybrid +hardware may support both. +
+ +
+ Audio Interfaces + + [to do - OSS/ALSA] +
+
+ +
+ Experimental API Elements + + The following V4L2 API elements are currently experimental +and may change in the future. + + + + Video Output Overlay (OSD) Interface, . + + + V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY, + &v4l2-buf-type;, . + + + V4L2_CAP_VIDEO_OUTPUT_OVERLAY, +&VIDIOC-QUERYCAP; ioctl, . + + + &VIDIOC-ENUM-FRAMESIZES; and +&VIDIOC-ENUM-FRAMEINTERVALS; ioctls. + + + &VIDIOC-G-ENC-INDEX; ioctl. + + + &VIDIOC-ENCODER-CMD; and &VIDIOC-TRY-ENCODER-CMD; +ioctls. + + + &VIDIOC-DBG-G-REGISTER; and &VIDIOC-DBG-S-REGISTER; +ioctls. + + + &VIDIOC-DBG-G-CHIP-IDENT; ioctl. + + +
+ +
+ Obsolete API Elements + + The following V4L2 API elements were superseded by new +interfaces and should not be implemented in new drivers. + + + + VIDIOC_G_MPEGCOMP and +VIDIOC_S_MPEGCOMP ioctls. Use Extended Controls, +. + + +
+
+ + diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml new file mode 100644 index 000000000000..a920ee80f640 --- /dev/null +++ b/Documentation/DocBook/media/v4l/controls.xml @@ -0,0 +1,2103 @@ +
+ User Controls + + Devices typically have a number of user-settable controls +such as brightness, saturation and so on, which would be presented to +the user on a graphical user interface. But, different devices +will have different controls available, and furthermore, the range of +possible values, and the default value will vary from device to +device. The control ioctls provide the information and a mechanism to +create a nice user interface for these controls that will work +correctly with any device. + + All controls are accessed using an ID value. V4L2 defines +several IDs for specific purposes. Drivers can also implement their +own custom controls using V4L2_CID_PRIVATE_BASE +and higher values. The pre-defined control IDs have the prefix +V4L2_CID_, and are listed in . The ID is used when querying the attributes of +a control, and when getting or setting the current value. + + Generally applications should present controls to the user +without assumptions about their purpose. Each control comes with a +name string the user is supposed to understand. When the purpose is +non-intuitive the driver writer should provide a user manual, a user +interface plug-in or a driver specific panel application. Predefined +IDs were introduced to change a few controls programmatically, for +example to mute a device during a channel switch. + + Drivers may enumerate different controls after switching +the current video input or output, tuner or modulator, or audio input +or output. Different in the sense of other bounds, another default and +current value, step size or other menu items. A control with a certain +custom ID can also change name and +type. + It will be more convenient for applications if drivers +make use of the V4L2_CTRL_FLAG_DISABLED flag, but +that was never required. + Control values are stored globally, they do not +change when switching except to stay within the reported bounds. They +also do not change ⪚ when the device is opened or closed, when the +tuner radio frequency is changed or generally never without +application request. Since V4L2 specifies no event mechanism, panel +applications intended to cooperate with other panel applications (be +they built into a larger application, as a TV viewer) may need to +regularly poll control values to update their user +interface. + Applications could call an ioctl to request events. +After another process called &VIDIOC-S-CTRL; or another ioctl changing +shared properties the &func-select; function would indicate +readability until any ioctl (querying the properties) is +called. + + + + Control IDs + + &cs-def; + + + ID + Type + Description + + + + + V4L2_CID_BASE + + First predefined ID, equal to +V4L2_CID_BRIGHTNESS. + + + V4L2_CID_USER_BASE + + Synonym of V4L2_CID_BASE. + + + V4L2_CID_BRIGHTNESS + integer + Picture brightness, or more precisely, the black +level. + + + V4L2_CID_CONTRAST + integer + Picture contrast or luma gain. + + + V4L2_CID_SATURATION + integer + Picture color saturation or chroma gain. + + + V4L2_CID_HUE + integer + Hue or color balance. + + + V4L2_CID_AUDIO_VOLUME + integer + Overall audio volume. Note some drivers also +provide an OSS or ALSA mixer interface. + + + V4L2_CID_AUDIO_BALANCE + integer + Audio stereo balance. Minimum corresponds to all +the way left, maximum to right. + + + V4L2_CID_AUDIO_BASS + integer + Audio bass adjustment. + + + V4L2_CID_AUDIO_TREBLE + integer + Audio treble adjustment. + + + V4L2_CID_AUDIO_MUTE + boolean + Mute audio, &ie; set the volume to zero, however +without affecting V4L2_CID_AUDIO_VOLUME. Like +ALSA drivers, V4L2 drivers must mute at load time to avoid excessive +noise. Actually the entire device should be reset to a low power +consumption state. + + + V4L2_CID_AUDIO_LOUDNESS + boolean + Loudness mode (bass boost). + + + V4L2_CID_BLACK_LEVEL + integer + Another name for brightness (not a synonym of +V4L2_CID_BRIGHTNESS). This control is deprecated +and should not be used in new drivers and applications. + + + V4L2_CID_AUTO_WHITE_BALANCE + boolean + Automatic white balance (cameras). + + + V4L2_CID_DO_WHITE_BALANCE + button + This is an action control. When set (the value is +ignored), the device will do a white balance and then hold the current +setting. Contrast this with the boolean +V4L2_CID_AUTO_WHITE_BALANCE, which, when +activated, keeps adjusting the white balance. + + + V4L2_CID_RED_BALANCE + integer + Red chroma balance. + + + V4L2_CID_BLUE_BALANCE + integer + Blue chroma balance. + + + V4L2_CID_GAMMA + integer + Gamma adjust. + + + V4L2_CID_WHITENESS + integer + Whiteness for grey-scale devices. This is a synonym +for V4L2_CID_GAMMA. This control is deprecated +and should not be used in new drivers and applications. + + + V4L2_CID_EXPOSURE + integer + Exposure (cameras). [Unit?] + + + V4L2_CID_AUTOGAIN + boolean + Automatic gain/exposure control. + + + V4L2_CID_GAIN + integer + Gain control. + + + V4L2_CID_HFLIP + boolean + Mirror the picture horizontally. + + + V4L2_CID_VFLIP + boolean + Mirror the picture vertically. + + + V4L2_CID_HCENTER_DEPRECATED (formerly V4L2_CID_HCENTER) + integer + Horizontal image centering. This control is +deprecated. New drivers and applications should use the Camera class controls +V4L2_CID_PAN_ABSOLUTE, +V4L2_CID_PAN_RELATIVE and +V4L2_CID_PAN_RESET instead. + + + V4L2_CID_VCENTER_DEPRECATED + (formerly V4L2_CID_VCENTER) + integer + Vertical image centering. Centering is intended to +physically adjust cameras. For image cropping see +, for clipping . This +control is deprecated. New drivers and applications should use the +Camera class controls +V4L2_CID_TILT_ABSOLUTE, +V4L2_CID_TILT_RELATIVE and +V4L2_CID_TILT_RESET instead. + + + V4L2_CID_POWER_LINE_FREQUENCY + enum + Enables a power line frequency filter to avoid +flicker. Possible values for enum v4l2_power_line_frequency are: +V4L2_CID_POWER_LINE_FREQUENCY_DISABLED (0), +V4L2_CID_POWER_LINE_FREQUENCY_50HZ (1) and +V4L2_CID_POWER_LINE_FREQUENCY_60HZ (2). + + + V4L2_CID_HUE_AUTO + boolean + Enables automatic hue control by the device. The +effect of setting V4L2_CID_HUE while automatic +hue control is enabled is undefined, drivers should ignore such +request. + + + V4L2_CID_WHITE_BALANCE_TEMPERATURE + integer + This control specifies the white balance settings +as a color temperature in Kelvin. A driver should have a minimum of +2800 (incandescent) to 6500 (daylight). For more information about +color temperature see Wikipedia. + + + V4L2_CID_SHARPNESS + integer + Adjusts the sharpness filters in a camera. The +minimum value disables the filters, higher values give a sharper +picture. + + + V4L2_CID_BACKLIGHT_COMPENSATION + integer + Adjusts the backlight compensation in a camera. The +minimum value disables backlight compensation. + + + V4L2_CID_CHROMA_AGC + boolean + Chroma automatic gain control. + + + V4L2_CID_CHROMA_GAIN + integer + Adjusts the Chroma gain control (for use when chroma AGC + is disabled). + + + V4L2_CID_COLOR_KILLER + boolean + Enable the color killer (&ie; force a black & white image in case of a weak video signal). + + + V4L2_CID_COLORFX + enum + Selects a color effect. Possible values for +enum v4l2_colorfx are: +V4L2_COLORFX_NONE (0), +V4L2_COLORFX_BW (1), +V4L2_COLORFX_SEPIA (2), +V4L2_COLORFX_NEGATIVE (3), +V4L2_COLORFX_EMBOSS (4), +V4L2_COLORFX_SKETCH (5), +V4L2_COLORFX_SKY_BLUE (6), +V4L2_COLORFX_GRASS_GREEN (7), +V4L2_COLORFX_SKIN_WHITEN (8) and +V4L2_COLORFX_VIVID (9). + + + V4L2_CID_ROTATE + integer + Rotates the image by specified angle. Common angles are 90, + 270 and 180. Rotating the image to 90 and 270 will reverse the height + and width of the display window. It is necessary to set the new height and + width of the picture using the &VIDIOC-S-FMT; ioctl according to + the rotation angle selected. + + + V4L2_CID_BG_COLOR + integer + Sets the background color on the current output device. + Background color needs to be specified in the RGB24 format. The + supplied 32 bit value is interpreted as bits 0-7 Red color information, + bits 8-15 Green color information, bits 16-23 Blue color + information and bits 24-31 must be zero. + + + V4L2_CID_ILLUMINATORS_1 + V4L2_CID_ILLUMINATORS_2 + boolean + Switch on or off the illuminator 1 or 2 of the device + (usually a microscope). + + + V4L2_CID_LASTP1 + + End of the predefined control IDs (currently +V4L2_CID_ILLUMINATORS_2 + 1). + + + V4L2_CID_PRIVATE_BASE + + ID of the first custom (driver specific) control. +Applications depending on particular custom controls should check the +driver name and version, see . + + + +
+ + Applications can enumerate the available controls with the +&VIDIOC-QUERYCTRL; and &VIDIOC-QUERYMENU; ioctls, get and set a +control value with the &VIDIOC-G-CTRL; and &VIDIOC-S-CTRL; ioctls. +Drivers must implement VIDIOC_QUERYCTRL, +VIDIOC_G_CTRL and +VIDIOC_S_CTRL when the device has one or more +controls, VIDIOC_QUERYMENU when it has one or +more menu type controls. + + + Enumerating all controls + + +&v4l2-queryctrl; queryctrl; +&v4l2-querymenu; querymenu; + +static void +enumerate_menu (void) +{ + printf (" Menu items:\n"); + + memset (&querymenu, 0, sizeof (querymenu)); + querymenu.id = queryctrl.id; + + for (querymenu.index = queryctrl.minimum; + querymenu.index <= queryctrl.maximum; + querymenu.index++) { + if (0 == ioctl (fd, &VIDIOC-QUERYMENU;, &querymenu)) { + printf (" %s\n", querymenu.name); + } + } +} + +memset (&queryctrl, 0, sizeof (queryctrl)); + +for (queryctrl.id = V4L2_CID_BASE; + queryctrl.id < V4L2_CID_LASTP1; + queryctrl.id++) { + if (0 == ioctl (fd, &VIDIOC-QUERYCTRL;, &queryctrl)) { + if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) + continue; + + printf ("Control %s\n", queryctrl.name); + + if (queryctrl.type == V4L2_CTRL_TYPE_MENU) + enumerate_menu (); + } else { + if (errno == EINVAL) + continue; + + perror ("VIDIOC_QUERYCTRL"); + exit (EXIT_FAILURE); + } +} + +for (queryctrl.id = V4L2_CID_PRIVATE_BASE;; + queryctrl.id++) { + if (0 == ioctl (fd, &VIDIOC-QUERYCTRL;, &queryctrl)) { + if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) + continue; + + printf ("Control %s\n", queryctrl.name); + + if (queryctrl.type == V4L2_CTRL_TYPE_MENU) + enumerate_menu (); + } else { + if (errno == EINVAL) + break; + + perror ("VIDIOC_QUERYCTRL"); + exit (EXIT_FAILURE); + } +} + + + + + Changing controls + + +&v4l2-queryctrl; queryctrl; +&v4l2-control; control; + +memset (&queryctrl, 0, sizeof (queryctrl)); +queryctrl.id = V4L2_CID_BRIGHTNESS; + +if (-1 == ioctl (fd, &VIDIOC-QUERYCTRL;, &queryctrl)) { + if (errno != EINVAL) { + perror ("VIDIOC_QUERYCTRL"); + exit (EXIT_FAILURE); + } else { + printf ("V4L2_CID_BRIGHTNESS is not supported\n"); + } +} else if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) { + printf ("V4L2_CID_BRIGHTNESS is not supported\n"); +} else { + memset (&control, 0, sizeof (control)); + control.id = V4L2_CID_BRIGHTNESS; + control.value = queryctrl.default_value; + + if (-1 == ioctl (fd, &VIDIOC-S-CTRL;, &control)) { + perror ("VIDIOC_S_CTRL"); + exit (EXIT_FAILURE); + } +} + +memset (&control, 0, sizeof (control)); +control.id = V4L2_CID_CONTRAST; + +if (0 == ioctl (fd, &VIDIOC-G-CTRL;, &control)) { + control.value += 1; + + /* The driver may clamp the value or return ERANGE, ignored here */ + + if (-1 == ioctl (fd, &VIDIOC-S-CTRL;, &control) + && errno != ERANGE) { + perror ("VIDIOC_S_CTRL"); + exit (EXIT_FAILURE); + } +/* Ignore if V4L2_CID_CONTRAST is unsupported */ +} else if (errno != EINVAL) { + perror ("VIDIOC_G_CTRL"); + exit (EXIT_FAILURE); +} + +control.id = V4L2_CID_AUDIO_MUTE; +control.value = TRUE; /* silence */ + +/* Errors ignored */ +ioctl (fd, VIDIOC_S_CTRL, &control); + + +
+ +
+ Extended Controls + +
+ Introduction + + The control mechanism as originally designed was meant +to be used for user settings (brightness, saturation, etc). However, +it turned out to be a very useful model for implementing more +complicated driver APIs where each driver implements only a subset of +a larger API. + + The MPEG encoding API was the driving force behind +designing and implementing this extended control mechanism: the MPEG +standard is quite large and the currently supported hardware MPEG +encoders each only implement a subset of this standard. Further more, +many parameters relating to how the video is encoded into an MPEG +stream are specific to the MPEG encoding chip since the MPEG standard +only defines the format of the resulting MPEG stream, not how the +video is actually encoded into that format. + + Unfortunately, the original control API lacked some +features needed for these new uses and so it was extended into the +(not terribly originally named) extended control API. + + Even though the MPEG encoding API was the first effort +to use the Extended Control API, nowadays there are also other classes +of Extended Controls, such as Camera Controls and FM Transmitter Controls. +The Extended Controls API as well as all Extended Controls classes are +described in the following text. +
+ +
+ The Extended Control API + + Three new ioctls are available: &VIDIOC-G-EXT-CTRLS;, +&VIDIOC-S-EXT-CTRLS; and &VIDIOC-TRY-EXT-CTRLS;. These ioctls act on +arrays of controls (as opposed to the &VIDIOC-G-CTRL; and +&VIDIOC-S-CTRL; ioctls that act on a single control). This is needed +since it is often required to atomically change several controls at +once. + + Each of the new ioctls expects a pointer to a +&v4l2-ext-controls;. This structure contains a pointer to the control +array, a count of the number of controls in that array and a control +class. Control classes are used to group similar controls into a +single class. For example, control class +V4L2_CTRL_CLASS_USER contains all user controls +(&ie; all controls that can also be set using the old +VIDIOC_S_CTRL ioctl). Control class +V4L2_CTRL_CLASS_MPEG contains all controls +relating to MPEG encoding, etc. + + All controls in the control array must belong to the +specified control class. An error is returned if this is not the +case. + + It is also possible to use an empty control array (count +== 0) to check whether the specified control class is +supported. + + The control array is a &v4l2-ext-control; array. The +v4l2_ext_control structure is very similar to +&v4l2-control;, except for the fact that it also allows for 64-bit +values and pointers to be passed. + + It is important to realize that due to the flexibility of +controls it is necessary to check whether the control you want to set +actually is supported in the driver and what the valid range of values +is. So use the &VIDIOC-QUERYCTRL; and &VIDIOC-QUERYMENU; ioctls to +check this. Also note that it is possible that some of the menu +indices in a control of type V4L2_CTRL_TYPE_MENU +may not be supported (VIDIOC_QUERYMENU will +return an error). A good example is the list of supported MPEG audio +bitrates. Some drivers only support one or two bitrates, others +support a wider range. +
+ +
+ Enumerating Extended Controls + + The recommended way to enumerate over the extended +controls is by using &VIDIOC-QUERYCTRL; in combination with the +V4L2_CTRL_FLAG_NEXT_CTRL flag: + + + +&v4l2-queryctrl; qctrl; + +qctrl.id = V4L2_CTRL_FLAG_NEXT_CTRL; +while (0 == ioctl (fd, &VIDIOC-QUERYCTRL;, &qctrl)) { + /* ... */ + qctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL; +} + + + + The initial control ID is set to 0 ORed with the +V4L2_CTRL_FLAG_NEXT_CTRL flag. The +VIDIOC_QUERYCTRL ioctl will return the first +control with a higher ID than the specified one. When no such controls +are found an error is returned. + + If you want to get all controls within a specific control +class, then you can set the initial +qctrl.id value to the control class and add +an extra check to break out of the loop when a control of another +control class is found: + + + +qctrl.id = V4L2_CTRL_CLASS_MPEG | V4L2_CTRL_FLAG_NEXT_CTRL; +while (0 == ioctl (fd, &VIDIOC-QUERYCTRL;, &qctrl)) { + if (V4L2_CTRL_ID2CLASS (qctrl.id) != V4L2_CTRL_CLASS_MPEG) + break; + /* ... */ + qctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL; + } + + + + The 32-bit qctrl.id value is +subdivided into three bit ranges: the top 4 bits are reserved for +flags (⪚ V4L2_CTRL_FLAG_NEXT_CTRL) and are not +actually part of the ID. The remaining 28 bits form the control ID, of +which the most significant 12 bits define the control class and the +least significant 16 bits identify the control within the control +class. It is guaranteed that these last 16 bits are always non-zero +for controls. The range of 0x1000 and up are reserved for +driver-specific controls. The macro +V4L2_CTRL_ID2CLASS(id) returns the control class +ID based on a control ID. + + If the driver does not support extended controls, then +VIDIOC_QUERYCTRL will fail when used in +combination with V4L2_CTRL_FLAG_NEXT_CTRL. In +that case the old method of enumerating control should be used (see +1.8). But if it is supported, then it is guaranteed to enumerate over +all controls, including driver-private controls. +
+ +
+ Creating Control Panels + + It is possible to create control panels for a graphical +user interface where the user can select the various controls. +Basically you will have to iterate over all controls using the method +described above. Each control class starts with a control of type +V4L2_CTRL_TYPE_CTRL_CLASS. +VIDIOC_QUERYCTRL will return the name of this +control class which can be used as the title of a tab page within a +control panel. + + The flags field of &v4l2-queryctrl; also contains hints on +the behavior of the control. See the &VIDIOC-QUERYCTRL; documentation +for more details. +
+ +
+ MPEG Control Reference + + Below all controls within the MPEG control class are +described. First the generic controls, then controls specific for +certain hardware. + +
+ Generic MPEG Controls + + + MPEG Control IDs + + + + + + + + + + ID + Type + Description + + + + + + V4L2_CID_MPEG_CLASS  + class + The MPEG class +descriptor. Calling &VIDIOC-QUERYCTRL; for this control will return a +description of this control class. This description can be used as the +caption of a Tab page in a GUI, for example. + + + + V4L2_CID_MPEG_STREAM_TYPE  + enum v4l2_mpeg_stream_type + The MPEG-1, -2 or -4 +output stream type. One cannot assume anything here. Each hardware +MPEG encoder tends to support different subsets of the available MPEG +stream types. The currently defined stream types are: + + + + + + V4L2_MPEG_STREAM_TYPE_MPEG2_PS  + MPEG-2 program stream + + + V4L2_MPEG_STREAM_TYPE_MPEG2_TS  + MPEG-2 transport stream + + + V4L2_MPEG_STREAM_TYPE_MPEG1_SS  + MPEG-1 system stream + + + V4L2_MPEG_STREAM_TYPE_MPEG2_DVD  + MPEG-2 DVD-compatible stream + + + V4L2_MPEG_STREAM_TYPE_MPEG1_VCD  + MPEG-1 VCD-compatible stream + + + V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD  + MPEG-2 SVCD-compatible stream + + + + + + + V4L2_CID_MPEG_STREAM_PID_PMT  + integer + Program Map Table +Packet ID for the MPEG transport stream (default 16) + + + + V4L2_CID_MPEG_STREAM_PID_AUDIO  + integer + Audio Packet ID for +the MPEG transport stream (default 256) + + + + V4L2_CID_MPEG_STREAM_PID_VIDEO  + integer + Video Packet ID for +the MPEG transport stream (default 260) + + + + V4L2_CID_MPEG_STREAM_PID_PCR  + integer + Packet ID for the +MPEG transport stream carrying PCR fields (default 259) + + + + V4L2_CID_MPEG_STREAM_PES_ID_AUDIO  + integer + Audio ID for MPEG +PES + + + + V4L2_CID_MPEG_STREAM_PES_ID_VIDEO  + integer + Video ID for MPEG +PES + + + + V4L2_CID_MPEG_STREAM_VBI_FMT  + enum v4l2_mpeg_stream_vbi_fmt + Some cards can embed +VBI data (⪚ Closed Caption, Teletext) into the MPEG stream. This +control selects whether VBI data should be embedded, and if so, what +embedding method should be used. The list of possible VBI formats +depends on the driver. The currently defined VBI format types +are: + + + + + + V4L2_MPEG_STREAM_VBI_FMT_NONE  + No VBI in the MPEG stream + + + V4L2_MPEG_STREAM_VBI_FMT_IVTV  + VBI in private packets, IVTV format (documented +in the kernel sources in the file Documentation/video4linux/cx2341x/README.vbi) + + + + + + + V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ  + enum v4l2_mpeg_audio_sampling_freq + MPEG Audio sampling +frequency. Possible values are: + + + + + + V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100  + 44.1 kHz + + + V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000  + 48 kHz + + + V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000  + 32 kHz + + + + + + + V4L2_CID_MPEG_AUDIO_ENCODING  + enum v4l2_mpeg_audio_encoding + MPEG Audio encoding. +Possible values are: + + + + + + V4L2_MPEG_AUDIO_ENCODING_LAYER_1  + MPEG-1/2 Layer I encoding + + + V4L2_MPEG_AUDIO_ENCODING_LAYER_2  + MPEG-1/2 Layer II encoding + + + V4L2_MPEG_AUDIO_ENCODING_LAYER_3  + MPEG-1/2 Layer III encoding + + + V4L2_MPEG_AUDIO_ENCODING_AAC  + MPEG-2/4 AAC (Advanced Audio Coding) + + + V4L2_MPEG_AUDIO_ENCODING_AC3  + AC-3 aka ATSC A/52 encoding + + + + + + + V4L2_CID_MPEG_AUDIO_L1_BITRATE  + enum v4l2_mpeg_audio_l1_bitrate + MPEG-1/2 Layer I bitrate. +Possible values are: + + + + + + V4L2_MPEG_AUDIO_L1_BITRATE_32K  + 32 kbit/s + + V4L2_MPEG_AUDIO_L1_BITRATE_64K  + 64 kbit/s + + + V4L2_MPEG_AUDIO_L1_BITRATE_96K  + 96 kbit/s + + + V4L2_MPEG_AUDIO_L1_BITRATE_128K  + 128 kbit/s + + + V4L2_MPEG_AUDIO_L1_BITRATE_160K  + 160 kbit/s + + + V4L2_MPEG_AUDIO_L1_BITRATE_192K  + 192 kbit/s + + + V4L2_MPEG_AUDIO_L1_BITRATE_224K  + 224 kbit/s + + + V4L2_MPEG_AUDIO_L1_BITRATE_256K  + 256 kbit/s + + + V4L2_MPEG_AUDIO_L1_BITRATE_288K  + 288 kbit/s + + + V4L2_MPEG_AUDIO_L1_BITRATE_320K  + 320 kbit/s + + + V4L2_MPEG_AUDIO_L1_BITRATE_352K  + 352 kbit/s + + + V4L2_MPEG_AUDIO_L1_BITRATE_384K  + 384 kbit/s + + + V4L2_MPEG_AUDIO_L1_BITRATE_416K  + 416 kbit/s + + + V4L2_MPEG_AUDIO_L1_BITRATE_448K  + 448 kbit/s + + + + + + + V4L2_CID_MPEG_AUDIO_L2_BITRATE  + enum v4l2_mpeg_audio_l2_bitrate + MPEG-1/2 Layer II bitrate. +Possible values are: + + + + + + V4L2_MPEG_AUDIO_L2_BITRATE_32K  + 32 kbit/s + + + V4L2_MPEG_AUDIO_L2_BITRATE_48K  + 48 kbit/s + + + V4L2_MPEG_AUDIO_L2_BITRATE_56K  + 56 kbit/s + + + V4L2_MPEG_AUDIO_L2_BITRATE_64K  + 64 kbit/s + + + V4L2_MPEG_AUDIO_L2_BITRATE_80K  + 80 kbit/s + + + V4L2_MPEG_AUDIO_L2_BITRATE_96K  + 96 kbit/s + + + V4L2_MPEG_AUDIO_L2_BITRATE_112K  + 112 kbit/s + + + V4L2_MPEG_AUDIO_L2_BITRATE_128K  + 128 kbit/s + + + V4L2_MPEG_AUDIO_L2_BITRATE_160K  + 160 kbit/s + + + V4L2_MPEG_AUDIO_L2_BITRATE_192K  + 192 kbit/s + + + V4L2_MPEG_AUDIO_L2_BITRATE_224K  + 224 kbit/s + + + V4L2_MPEG_AUDIO_L2_BITRATE_256K  + 256 kbit/s + + + V4L2_MPEG_AUDIO_L2_BITRATE_320K  + 320 kbit/s + + + V4L2_MPEG_AUDIO_L2_BITRATE_384K  + 384 kbit/s + + + + + + + V4L2_CID_MPEG_AUDIO_L3_BITRATE  + enum v4l2_mpeg_audio_l3_bitrate + MPEG-1/2 Layer III bitrate. +Possible values are: + + + + + + V4L2_MPEG_AUDIO_L3_BITRATE_32K  + 32 kbit/s + + + V4L2_MPEG_AUDIO_L3_BITRATE_40K  + 40 kbit/s + + + V4L2_MPEG_AUDIO_L3_BITRATE_48K  + 48 kbit/s + + + V4L2_MPEG_AUDIO_L3_BITRATE_56K  + 56 kbit/s + + + V4L2_MPEG_AUDIO_L3_BITRATE_64K  + 64 kbit/s + + + V4L2_MPEG_AUDIO_L3_BITRATE_80K  + 80 kbit/s + + + V4L2_MPEG_AUDIO_L3_BITRATE_96K  + 96 kbit/s + + + V4L2_MPEG_AUDIO_L3_BITRATE_112K  + 112 kbit/s + + + V4L2_MPEG_AUDIO_L3_BITRATE_128K  + 128 kbit/s + + + V4L2_MPEG_AUDIO_L3_BITRATE_160K  + 160 kbit/s + + + V4L2_MPEG_AUDIO_L3_BITRATE_192K  + 192 kbit/s + + + V4L2_MPEG_AUDIO_L3_BITRATE_224K  + 224 kbit/s + + + V4L2_MPEG_AUDIO_L3_BITRATE_256K  + 256 kbit/s + + + V4L2_MPEG_AUDIO_L3_BITRATE_320K  + 320 kbit/s + + + + + + + V4L2_CID_MPEG_AUDIO_AAC_BITRATE  + integer + AAC bitrate in bits per second. + + + + V4L2_CID_MPEG_AUDIO_AC3_BITRATE  + enum v4l2_mpeg_audio_ac3_bitrate + AC-3 bitrate. +Possible values are: + + + + + + V4L2_MPEG_AUDIO_AC3_BITRATE_32K  + 32 kbit/s + + + V4L2_MPEG_AUDIO_AC3_BITRATE_40K  + 40 kbit/s + + + V4L2_MPEG_AUDIO_AC3_BITRATE_48K  + 48 kbit/s + + + V4L2_MPEG_AUDIO_AC3_BITRATE_56K  + 56 kbit/s + + + V4L2_MPEG_AUDIO_AC3_BITRATE_64K  + 64 kbit/s + + + V4L2_MPEG_AUDIO_AC3_BITRATE_80K  + 80 kbit/s + + + V4L2_MPEG_AUDIO_AC3_BITRATE_96K  + 96 kbit/s + + + V4L2_MPEG_AUDIO_AC3_BITRATE_112K  + 112 kbit/s + + + V4L2_MPEG_AUDIO_AC3_BITRATE_128K  + 128 kbit/s + + + V4L2_MPEG_AUDIO_AC3_BITRATE_160K  + 160 kbit/s + + + V4L2_MPEG_AUDIO_AC3_BITRATE_192K  + 192 kbit/s + + + V4L2_MPEG_AUDIO_AC3_BITRATE_224K  + 224 kbit/s + + + V4L2_MPEG_AUDIO_AC3_BITRATE_256K  + 256 kbit/s + + + V4L2_MPEG_AUDIO_AC3_BITRATE_320K  + 320 kbit/s + + + V4L2_MPEG_AUDIO_AC3_BITRATE_384K  + 384 kbit/s + + + V4L2_MPEG_AUDIO_AC3_BITRATE_448K  + 448 kbit/s + + + V4L2_MPEG_AUDIO_AC3_BITRATE_512K  + 512 kbit/s + + + V4L2_MPEG_AUDIO_AC3_BITRATE_576K  + 576 kbit/s + + + V4L2_MPEG_AUDIO_AC3_BITRATE_640K  + 640 kbit/s + + + + + + + V4L2_CID_MPEG_AUDIO_MODE  + enum v4l2_mpeg_audio_mode + MPEG Audio mode. +Possible values are: + + + + + + V4L2_MPEG_AUDIO_MODE_STEREO  + Stereo + + + V4L2_MPEG_AUDIO_MODE_JOINT_STEREO  + Joint Stereo + + + V4L2_MPEG_AUDIO_MODE_DUAL  + Bilingual + + + V4L2_MPEG_AUDIO_MODE_MONO  + Mono + + + + + + + V4L2_CID_MPEG_AUDIO_MODE_EXTENSION  + enum v4l2_mpeg_audio_mode_extension + Joint Stereo +audio mode extension. In Layer I and II they indicate which subbands +are in intensity stereo. All other subbands are coded in stereo. Layer +III is not (yet) supported. Possible values +are: + + + + + + V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4  + Subbands 4-31 in intensity stereo + + + V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8  + Subbands 8-31 in intensity stereo + + + V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12  + Subbands 12-31 in intensity stereo + + + V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16  + Subbands 16-31 in intensity stereo + + + + + + + V4L2_CID_MPEG_AUDIO_EMPHASIS  + enum v4l2_mpeg_audio_emphasis + Audio Emphasis. +Possible values are: + + + + + + V4L2_MPEG_AUDIO_EMPHASIS_NONE  + None + + + V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS  + 50/15 microsecond emphasis + + + V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17  + CCITT J.17 + + + + + + + V4L2_CID_MPEG_AUDIO_CRC  + enum v4l2_mpeg_audio_crc + CRC method. Possible +values are: + + + + + + V4L2_MPEG_AUDIO_CRC_NONE  + None + + + V4L2_MPEG_AUDIO_CRC_CRC16  + 16 bit parity check + + + + + + + V4L2_CID_MPEG_AUDIO_MUTE  + boolean + Mutes the audio when +capturing. This is not done by muting audio hardware, which can still +produce a slight hiss, but in the encoder itself, guaranteeing a fixed +and reproducible audio bitstream. 0 = unmuted, 1 = muted. + + + + V4L2_CID_MPEG_VIDEO_ENCODING  + enum v4l2_mpeg_video_encoding + MPEG Video encoding +method. Possible values are: + + + + + + V4L2_MPEG_VIDEO_ENCODING_MPEG_1  + MPEG-1 Video encoding + + + V4L2_MPEG_VIDEO_ENCODING_MPEG_2  + MPEG-2 Video encoding + + + V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC  + MPEG-4 AVC (H.264) Video encoding + + + + + + + V4L2_CID_MPEG_VIDEO_ASPECT  + enum v4l2_mpeg_video_aspect + Video aspect. +Possible values are: + + + + + + V4L2_MPEG_VIDEO_ASPECT_1x1  + + + V4L2_MPEG_VIDEO_ASPECT_4x3  + + + V4L2_MPEG_VIDEO_ASPECT_16x9  + + + V4L2_MPEG_VIDEO_ASPECT_221x100  + + + + + + + V4L2_CID_MPEG_VIDEO_B_FRAMES  + integer + Number of B-Frames +(default 2) + + + + V4L2_CID_MPEG_VIDEO_GOP_SIZE  + integer + GOP size (default +12) + + + + V4L2_CID_MPEG_VIDEO_GOP_CLOSURE  + boolean + GOP closure (default +1) + + + + V4L2_CID_MPEG_VIDEO_PULLDOWN  + boolean + Enable 3:2 pulldown +(default 0) + + + + V4L2_CID_MPEG_VIDEO_BITRATE_MODE  + enum v4l2_mpeg_video_bitrate_mode + Video bitrate mode. +Possible values are: + + + + + + V4L2_MPEG_VIDEO_BITRATE_MODE_VBR  + Variable bitrate + + + V4L2_MPEG_VIDEO_BITRATE_MODE_CBR  + Constant bitrate + + + + + + + V4L2_CID_MPEG_VIDEO_BITRATE  + integer + Video bitrate in bits +per second. + + + + V4L2_CID_MPEG_VIDEO_BITRATE_PEAK  + integer + Peak video bitrate in +bits per second. Must be larger or equal to the average video bitrate. +It is ignored if the video bitrate mode is set to constant +bitrate. + + + + V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION  + integer + For every captured +frame, skip this many subsequent frames (default 0). + + + + V4L2_CID_MPEG_VIDEO_MUTE  + boolean + + "Mutes" the video to a +fixed color when capturing. This is useful for testing, to produce a +fixed video bitstream. 0 = unmuted, 1 = muted. + + + + V4L2_CID_MPEG_VIDEO_MUTE_YUV  + integer + Sets the "mute" color +of the video. The supplied 32-bit integer is interpreted as follows (bit +0 = least significant bit): + + + + + + Bit 0:7 + V chrominance information + + + Bit 8:15 + U chrominance information + + + Bit 16:23 + Y luminance information + + + Bit 24:31 + Must be zero. + + + + + + +
+
+ +
+ CX2341x MPEG Controls + + The following MPEG class controls deal with MPEG +encoding settings that are specific to the Conexant CX23415 and +CX23416 MPEG encoding chips. + + + CX2341x Control IDs + + + + + + + + + + ID + Type + Description + + + + + + V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE  + enum v4l2_mpeg_cx2341x_video_spatial_filter_mode + Sets the Spatial +Filter mode (default MANUAL). Possible values +are: + + + + + + V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL  + Choose the filter manually + + + V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO  + Choose the filter automatically + + + + + + + V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER  + integer (0-15) + The setting for the +Spatial Filter. 0 = off, 15 = maximum. (Default is 0.) + + + + V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE  + enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type + Select the algorithm +to use for the Luma Spatial Filter (default +1D_HOR). Possible values: + + + + + + V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF  + No filter + + + V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR  + One-dimensional horizontal + + + V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT  + One-dimensional vertical + + + V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE  + Two-dimensional separable + + + V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE  + Two-dimensional symmetrical +non-separable + + + + + + + V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE  + enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type + Select the algorithm +for the Chroma Spatial Filter (default 1D_HOR). +Possible values are: + + + + + + V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF  + No filter + + + V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR  + One-dimensional horizontal + + + + + + + V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE  + enum v4l2_mpeg_cx2341x_video_temporal_filter_mode + Sets the Temporal +Filter mode (default MANUAL). Possible values +are: + + + + + + V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL  + Choose the filter manually + + + V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO  + Choose the filter automatically + + + + + + + V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER  + integer (0-31) + The setting for the +Temporal Filter. 0 = off, 31 = maximum. (Default is 8 for full-scale +capturing and 0 for scaled capturing.) + + + + V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE  + enum v4l2_mpeg_cx2341x_video_median_filter_type + Median Filter Type +(default OFF). Possible values are: + + + + + + V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF  + No filter + + + V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR  + Horizontal filter + + + V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT  + Vertical filter + + + V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT  + Horizontal and vertical filter + + + V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG  + Diagonal filter + + + + + + + V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM  + integer (0-255) + Threshold above which +the luminance median filter is enabled (default 0) + + + + V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP  + integer (0-255) + Threshold below which +the luminance median filter is enabled (default 255) + + + + V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM  + integer (0-255) + Threshold above which +the chroma median filter is enabled (default 0) + + + + V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP  + integer (0-255) + Threshold below which +the chroma median filter is enabled (default 255) + + + + V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS  + boolean + + The CX2341X MPEG encoder +can insert one empty MPEG-2 PES packet into the stream between every +four video frames. The packet size is 2048 bytes, including the +packet_start_code_prefix and stream_id fields. The stream_id is 0xBF +(private stream 2). The payload consists of 0x00 bytes, to be filled +in by the application. 0 = do not insert, 1 = insert packets. + + + +
+
+
+ +
+ Camera Control Reference + + The Camera class includes controls for mechanical (or +equivalent digital) features of a device such as controllable lenses +or sensors. + + + Camera Control IDs + + + + + + + + + + ID + Type + Description + + + + + + V4L2_CID_CAMERA_CLASS  + class + The Camera class +descriptor. Calling &VIDIOC-QUERYCTRL; for this control will return a +description of this control class. + + + + + V4L2_CID_EXPOSURE_AUTO  + enum v4l2_exposure_auto_type + Enables automatic +adjustments of the exposure time and/or iris aperture. The effect of +manual changes of the exposure time or iris aperture while these +features are enabled is undefined, drivers should ignore such +requests. Possible values are: + + + + + + V4L2_EXPOSURE_AUTO  + Automatic exposure time, automatic iris +aperture. + + + V4L2_EXPOSURE_MANUAL  + Manual exposure time, manual iris. + + + V4L2_EXPOSURE_SHUTTER_PRIORITY  + Manual exposure time, auto iris. + + + V4L2_EXPOSURE_APERTURE_PRIORITY  + Auto exposure time, manual iris. + + + + + + + + V4L2_CID_EXPOSURE_ABSOLUTE  + integer + Determines the exposure +time of the camera sensor. The exposure time is limited by the frame +interval. Drivers should interpret the values as 100 µs units, +where the value 1 stands for 1/10000th of a second, 10000 for 1 second +and 100000 for 10 seconds. + + + + + V4L2_CID_EXPOSURE_AUTO_PRIORITY  + boolean + When +V4L2_CID_EXPOSURE_AUTO is set to +AUTO or APERTURE_PRIORITY, +this control determines if the device may dynamically vary the frame +rate. By default this feature is disabled (0) and the frame rate must +remain constant. + + + + + V4L2_CID_PAN_RELATIVE  + integer + This control turns the +camera horizontally by the specified amount. The unit is undefined. A +positive value moves the camera to the right (clockwise when viewed +from above), a negative value to the left. A value of zero does not +cause motion. This is a write-only control. + + + + + V4L2_CID_TILT_RELATIVE  + integer + This control turns the +camera vertically by the specified amount. The unit is undefined. A +positive value moves the camera up, a negative value down. A value of +zero does not cause motion. This is a write-only control. + + + + + V4L2_CID_PAN_RESET  + button + When this control is set, +the camera moves horizontally to the default position. + + + + + V4L2_CID_TILT_RESET  + button + When this control is set, +the camera moves vertically to the default position. + + + + + V4L2_CID_PAN_ABSOLUTE  + integer + This control +turns the camera horizontally to the specified position. Positive +values move the camera to the right (clockwise when viewed from above), +negative values to the left. Drivers should interpret the values as arc +seconds, with valid values between -180 * 3600 and +180 * 3600 +inclusive. + + + + + V4L2_CID_TILT_ABSOLUTE  + integer + This control +turns the camera vertically to the specified position. Positive values +move the camera up, negative values down. Drivers should interpret the +values as arc seconds, with valid values between -180 * 3600 and +180 +* 3600 inclusive. + + + + + V4L2_CID_FOCUS_ABSOLUTE  + integer + This control sets the +focal point of the camera to the specified position. The unit is +undefined. Positive values set the focus closer to the camera, +negative values towards infinity. + + + + + V4L2_CID_FOCUS_RELATIVE  + integer + This control moves the +focal point of the camera by the specified amount. The unit is +undefined. Positive values move the focus closer to the camera, +negative values towards infinity. This is a write-only control. + + + + + V4L2_CID_FOCUS_AUTO  + boolean + Enables automatic focus +adjustments. The effect of manual focus adjustments while this feature +is enabled is undefined, drivers should ignore such requests. + + + + + V4L2_CID_ZOOM_ABSOLUTE  + integer + Specify the objective lens +focal length as an absolute value. The zoom unit is driver-specific and its +value should be a positive integer. + + + + + V4L2_CID_ZOOM_RELATIVE  + integer + Specify the objective lens +focal length relatively to the current value. Positive values move the zoom +lens group towards the telephoto direction, negative values towards the +wide-angle direction. The zoom unit is driver-specific. This is a write-only control. + + + + + V4L2_CID_ZOOM_CONTINUOUS  + integer + Move the objective lens group +at the specified speed until it reaches physical device limits or until an +explicit request to stop the movement. A positive value moves the zoom lens +group towards the telephoto direction. A value of zero stops the zoom lens +group movement. A negative value moves the zoom lens group towards the +wide-angle direction. The zoom speed unit is driver-specific. + + + + + V4L2_CID_IRIS_ABSOLUTE  + integer + This control sets the +camera's aperture to the specified value. The unit is undefined. +Larger values open the iris wider, smaller values close it. + + + + + V4L2_CID_IRIS_RELATIVE  + integer + This control modifies the +camera's aperture by the specified amount. The unit is undefined. +Positive values open the iris one step further, negative values close +it one step further. This is a write-only control. + + + + + V4L2_CID_PRIVACY  + boolean + Prevent video from being acquired +by the camera. When this control is set to TRUE (1), no +image can be captured by the camera. Common means to enforce privacy are +mechanical obturation of the sensor and firmware image processing, but the +device is not restricted to these methods. Devices that implement the privacy +control must support read access and may support write access. + + + + V4L2_CID_BAND_STOP_FILTER  + integer + Switch the band-stop filter of a +camera sensor on or off, or specify its strength. Such band-stop filters can +be used, for example, to filter out the fluorescent light component. + + + + +
+
+ +
+ FM Transmitter Control Reference + + The FM Transmitter (FM_TX) class includes controls for common features of +FM transmissions capable devices. Currently this class includes parameters for audio +compression, pilot tone generation, audio deviation limiter, RDS transmission and +tuning power features. + + + FM_TX Control IDs + + + + + + + + + + + ID + Type + Description + + + + + + V4L2_CID_FM_TX_CLASS  + class + The FM_TX class +descriptor. Calling &VIDIOC-QUERYCTRL; for this control will return a +description of this control class. + + + V4L2_CID_RDS_TX_DEVIATION  + integer + + Configures RDS signal frequency deviation level in Hz. +The range and step are driver-specific. + + + V4L2_CID_RDS_TX_PI  + integer + + Sets the RDS Programme Identification field +for transmission. + + + V4L2_CID_RDS_TX_PTY  + integer + + Sets the RDS Programme Type field for transmission. +This encodes up to 31 pre-defined programme types. + + + V4L2_CID_RDS_TX_PS_NAME  + string + + Sets the Programme Service name (PS_NAME) for transmission. +It is intended for static display on a receiver. It is the primary aid to listeners in programme service +identification and selection. In Annex E of , the RDS specification, +there is a full description of the correct character encoding for Programme Service name strings. +Also from RDS specification, PS is usually a single eight character text. However, it is also possible +to find receivers which can scroll strings sized as 8 x N characters. So, this control must be configured +with steps of 8 characters. The result is it must always contain a string with size multiple of 8. + + + V4L2_CID_RDS_TX_RADIO_TEXT  + string + + Sets the Radio Text info for transmission. It is a textual description of +what is being broadcasted. RDS Radio Text can be applied when broadcaster wishes to transmit longer PS names, +programme-related information or any other text. In these cases, RadioText should be used in addition to +V4L2_CID_RDS_TX_PS_NAME. The encoding for Radio Text strings is also fully described +in Annex E of . The length of Radio Text strings depends on which RDS Block is being +used to transmit it, either 32 (2A block) or 64 (2B block). However, it is also possible +to find receivers which can scroll strings sized as 32 x N or 64 x N characters. So, this control must be configured +with steps of 32 or 64 characters. The result is it must always contain a string with size multiple of 32 or 64. + + + V4L2_CID_AUDIO_LIMITER_ENABLED  + boolean + + Enables or disables the audio deviation limiter feature. +The limiter is useful when trying to maximize the audio volume, minimize receiver-generated +distortion and prevent overmodulation. + + + + V4L2_CID_AUDIO_LIMITER_RELEASE_TIME  + integer + + Sets the audio deviation limiter feature release time. +Unit is in useconds. Step and range are driver-specific. + + + V4L2_CID_AUDIO_LIMITER_DEVIATION  + integer + + Configures audio frequency deviation level in Hz. +The range and step are driver-specific. + + + V4L2_CID_AUDIO_COMPRESSION_ENABLED  + boolean + + Enables or disables the audio compression feature. +This feature amplifies signals below the threshold by a fixed gain and compresses audio +signals above the threshold by the ratio of Threshold/(Gain + Threshold). + + + V4L2_CID_AUDIO_COMPRESSION_GAIN  + integer + + Sets the gain for audio compression feature. It is +a dB value. The range and step are driver-specific. + + + V4L2_CID_AUDIO_COMPRESSION_THRESHOLD  + integer + + Sets the threshold level for audio compression freature. +It is a dB value. The range and step are driver-specific. + + + V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME  + integer + + Sets the attack time for audio compression feature. +It is a useconds value. The range and step are driver-specific. + + + V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME  + integer + + Sets the release time for audio compression feature. +It is a useconds value. The range and step are driver-specific. + + + V4L2_CID_PILOT_TONE_ENABLED  + boolean + + Enables or disables the pilot tone generation feature. + + + V4L2_CID_PILOT_TONE_DEVIATION  + integer + + Configures pilot tone frequency deviation level. Unit is +in Hz. The range and step are driver-specific. + + + V4L2_CID_PILOT_TONE_FREQUENCY  + integer + + Configures pilot tone frequency value. Unit is +in Hz. The range and step are driver-specific. + + + V4L2_CID_TUNE_PREEMPHASIS  + integer + + Configures the pre-emphasis value for broadcasting. +A pre-emphasis filter is applied to the broadcast to accentuate the high audio frequencies. +Depending on the region, a time constant of either 50 or 75 useconds is used. The enum v4l2_preemphasis +defines possible values for pre-emphasis. Here they are: + + + + + V4L2_PREEMPHASIS_DISABLED  + No pre-emphasis is applied. + + + V4L2_PREEMPHASIS_50_uS  + A pre-emphasis of 50 uS is used. + + + V4L2_PREEMPHASIS_75_uS  + A pre-emphasis of 75 uS is used. + + + + + + + V4L2_CID_TUNE_POWER_LEVEL  + integer + + Sets the output power level for signal transmission. +Unit is in dBuV. Range and step are driver-specific. + + + V4L2_CID_TUNE_ANTENNA_CAPACITOR  + integer + + This selects the value of antenna tuning capacitor +manually or automatically if set to zero. Unit, range and step are driver-specific. + + + + +
+ +For more details about RDS specification, refer to + document, from CENELEC. +
+
+ + diff --git a/Documentation/DocBook/media/v4l/crop.gif b/Documentation/DocBook/media/v4l/crop.gif new file mode 100644 index 000000000000..3b9e7d836d4b Binary files /dev/null and b/Documentation/DocBook/media/v4l/crop.gif differ diff --git a/Documentation/DocBook/media/v4l/crop.pdf b/Documentation/DocBook/media/v4l/crop.pdf new file mode 100644 index 000000000000..c9fb81cd32f3 Binary files /dev/null and b/Documentation/DocBook/media/v4l/crop.pdf differ diff --git a/Documentation/DocBook/media/v4l/dev-capture.xml b/Documentation/DocBook/media/v4l/dev-capture.xml new file mode 100644 index 000000000000..2237c661f26a --- /dev/null +++ b/Documentation/DocBook/media/v4l/dev-capture.xml @@ -0,0 +1,118 @@ + Video Capture Interface + + Video capture devices sample an analog video signal and store +the digitized images in memory. Today nearly all devices can capture +at full 25 or 30 frames/second. With this interface applications can +control the capture process and move images from the driver into user +space. + + Conventionally V4L2 video capture devices are accessed through +character device special files named /dev/video +and /dev/video0 to +/dev/video63 with major number 81 and minor +numbers 0 to 63. /dev/video is typically a +symbolic link to the preferred video device. Note the same device +files are used for video output devices. + +
+ Querying Capabilities + + Devices supporting the video capture interface set the +V4L2_CAP_VIDEO_CAPTURE or +V4L2_CAP_VIDEO_CAPTURE_MPLANE flag in the +capabilities field of &v4l2-capability; +returned by the &VIDIOC-QUERYCAP; ioctl. As secondary device functions +they may also support the video overlay +(V4L2_CAP_VIDEO_OVERLAY) and the raw VBI capture +(V4L2_CAP_VBI_CAPTURE) interface. At least one of +the read/write or streaming I/O methods must be supported. Tuners and +audio inputs are optional. +
+ +
+ Supplemental Functions + + Video capture devices shall support audio input, tuner, controls, +cropping and scaling and streaming parameter ioctls as needed. +The video input and video standard ioctls must be supported by +all video capture devices. +
+ +
+ Image Format Negotiation + + The result of a capture operation is determined by +cropping and image format parameters. The former select an area of the +video picture to capture, the latter how images are stored in memory, +&ie; in RGB or YUV format, the number of bits per pixel or width and +height. Together they also define how images are scaled in the +process. + + As usual these parameters are not reset +at &func-open; time to permit Unix tool chains, programming a device +and then reading from it as if it was a plain file. Well written V4L2 +applications ensure they really get what they want, including cropping +and scaling. + + Cropping initialization at minimum requires to reset the +parameters to defaults. An example is given in . + + To query the current image format applications set the +type field of a &v4l2-format; to +V4L2_BUF_TYPE_VIDEO_CAPTURE or +V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE and call the +&VIDIOC-G-FMT; ioctl with a pointer to this structure. Drivers fill +the &v4l2-pix-format; pix or the +&v4l2-pix-format-mplane; pix_mp member of the +fmt union. + + To request different parameters applications set the +type field of a &v4l2-format; as above and +initialize all fields of the &v4l2-pix-format; +vbi member of the +fmt union, or better just modify the +results of VIDIOC_G_FMT, and call the +&VIDIOC-S-FMT; ioctl with a pointer to this structure. Drivers may +adjust the parameters and finally return the actual parameters as +VIDIOC_G_FMT does. + + Like VIDIOC_S_FMT the +&VIDIOC-TRY-FMT; ioctl can be used to learn about hardware limitations +without disabling I/O or possibly time consuming hardware +preparations. + + The contents of &v4l2-pix-format; and &v4l2-pix-format-mplane; +are discussed in . See also the specification of the +VIDIOC_G_FMT, VIDIOC_S_FMT +and VIDIOC_TRY_FMT ioctls for details. Video +capture devices must implement both the +VIDIOC_G_FMT and +VIDIOC_S_FMT ioctl, even if +VIDIOC_S_FMT ignores all requests and always +returns default parameters as VIDIOC_G_FMT does. +VIDIOC_TRY_FMT is optional. +
+ +
+ Reading Images + + A video capture device may support the read() function and/or streaming (memory mapping or user pointer) I/O. See for details. +
+ + diff --git a/Documentation/DocBook/media/v4l/dev-codec.xml b/Documentation/DocBook/media/v4l/dev-codec.xml new file mode 100644 index 000000000000..6e156dc45b94 --- /dev/null +++ b/Documentation/DocBook/media/v4l/dev-codec.xml @@ -0,0 +1,26 @@ + Codec Interface + + + Suspended + + This interface has been be suspended from the V4L2 API +implemented in Linux 2.6 until we have more experience with codec +device interfaces. + + + A V4L2 codec can compress, decompress, transform, or otherwise +convert video data from one format into another format, in memory. +Applications send data to be converted to the driver through a +&func-write; call, and receive the converted data through a +&func-read; call. For efficiency a driver may also support streaming +I/O. + + [to do] + + diff --git a/Documentation/DocBook/media/v4l/dev-effect.xml b/Documentation/DocBook/media/v4l/dev-effect.xml new file mode 100644 index 000000000000..9c243beba0e6 --- /dev/null +++ b/Documentation/DocBook/media/v4l/dev-effect.xml @@ -0,0 +1,25 @@ + Effect Devices Interface + + + Suspended + + This interface has been be suspended from the V4L2 API +implemented in Linux 2.6 until we have more experience with effect +device interfaces. + + + A V4L2 video effect device can do image effects, filtering, or +combine two or more images or image streams. For example video +transitions or wipes. Applications send data to be processed and +receive the result data either with &func-read; and &func-write; +functions, or through the streaming I/O mechanism. + + [to do] + + diff --git a/Documentation/DocBook/media/v4l/dev-event.xml b/Documentation/DocBook/media/v4l/dev-event.xml new file mode 100644 index 000000000000..be5a98fb4fab --- /dev/null +++ b/Documentation/DocBook/media/v4l/dev-event.xml @@ -0,0 +1,31 @@ + Event Interface + + The V4L2 event interface provides means for user to get + immediately notified on certain conditions taking place on a device. + This might include start of frame or loss of signal events, for + example. + + + To receive events, the events the user is interested in first must + be subscribed using the &VIDIOC-SUBSCRIBE-EVENT; ioctl. Once an event is + subscribed, the events of subscribed types are dequeueable using the + &VIDIOC-DQEVENT; ioctl. Events may be unsubscribed using + VIDIOC_UNSUBSCRIBE_EVENT ioctl. The special event type V4L2_EVENT_ALL may + be used to unsubscribe all the events the driver supports. + + The event subscriptions and event queues are specific to file + handles. Subscribing an event on one file handle does not affect + other file handles. + + + The information on dequeueable events is obtained by using select or + poll system calls on video devices. The V4L2 events use POLLPRI events on + poll system call and exceptions on select system call. + + diff --git a/Documentation/DocBook/media/v4l/dev-osd.xml b/Documentation/DocBook/media/v4l/dev-osd.xml new file mode 100644 index 000000000000..c9a68a2ccd33 --- /dev/null +++ b/Documentation/DocBook/media/v4l/dev-osd.xml @@ -0,0 +1,164 @@ + Video Output Overlay Interface + Also known as On-Screen Display (OSD) + + + Experimental + + This is an experimental +interface and may change in the future. + + + Some video output devices can overlay a framebuffer image onto +the outgoing video signal. Applications can set up such an overlay +using this interface, which borrows structures and ioctls of the Video Overlay interface. + + The OSD function is accessible through the same character +special file as the Video Output function. +Note the default function of such a /dev/video device +is video capturing or output. The OSD function is only available after +calling the &VIDIOC-S-FMT; ioctl. + +
+ Querying Capabilities + + Devices supporting the Video Output +Overlay interface set the +V4L2_CAP_VIDEO_OUTPUT_OVERLAY flag in the +capabilities field of &v4l2-capability; +returned by the &VIDIOC-QUERYCAP; ioctl. +
+ +
+ Framebuffer + + Contrary to the Video Overlay +interface the framebuffer is normally implemented on the TV card and +not the graphics card. On Linux it is accessible as a framebuffer +device (/dev/fbN). Given a V4L2 device, +applications can find the corresponding framebuffer device by calling +the &VIDIOC-G-FBUF; ioctl. It returns, amongst other information, the +physical address of the framebuffer in the +base field of &v4l2-framebuffer;. The +framebuffer device ioctl FBIOGET_FSCREENINFO +returns the same address in the smem_start +field of struct fb_fix_screeninfo. The +FBIOGET_FSCREENINFO ioctl and struct +fb_fix_screeninfo are defined in the +linux/fb.h header file. + + The width and height of the framebuffer depends on the +current video standard. A V4L2 driver may reject attempts to change +the video standard (or any other ioctl which would imply a framebuffer +size change) with an &EBUSY; until all applications closed the +framebuffer device. + + + Finding a framebuffer device for OSD + + +#include <linux/fb.h> + +&v4l2-framebuffer; fbuf; +unsigned int i; +int fb_fd; + +if (-1 == ioctl (fd, VIDIOC_G_FBUF, &fbuf)) { + perror ("VIDIOC_G_FBUF"); + exit (EXIT_FAILURE); +} + +for (i = 0; i > 30; ++i) { + char dev_name[16]; + struct fb_fix_screeninfo si; + + snprintf (dev_name, sizeof (dev_name), "/dev/fb%u", i); + + fb_fd = open (dev_name, O_RDWR); + if (-1 == fb_fd) { + switch (errno) { + case ENOENT: /* no such file */ + case ENXIO: /* no driver */ + continue; + + default: + perror ("open"); + exit (EXIT_FAILURE); + } + } + + if (0 == ioctl (fb_fd, FBIOGET_FSCREENINFO, &si)) { + if (si.smem_start == (unsigned long) fbuf.base) + break; + } else { + /* Apparently not a framebuffer device. */ + } + + close (fb_fd); + fb_fd = -1; +} + +/* fb_fd is the file descriptor of the framebuffer device + for the video output overlay, or -1 if no device was found. */ + + +
+ +
+ Overlay Window and Scaling + + The overlay is controlled by source and target rectangles. +The source rectangle selects a subsection of the framebuffer image to +be overlaid, the target rectangle an area in the outgoing video signal +where the image will appear. Drivers may or may not support scaling, +and arbitrary sizes and positions of these rectangles. Further drivers +may support any (or none) of the clipping/blending methods defined for +the Video Overlay interface. + + A &v4l2-window; defines the size of the source rectangle, +its position in the framebuffer and the clipping/blending method to be +used for the overlay. To get the current parameters applications set +the type field of a &v4l2-format; to +V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY and call the +&VIDIOC-G-FMT; ioctl. The driver fills the +v4l2_window substructure named +win. It is not possible to retrieve a +previously programmed clipping list or bitmap. + + To program the source rectangle applications set the +type field of a &v4l2-format; to +V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY, initialize +the win substructure and call the +&VIDIOC-S-FMT; ioctl. The driver adjusts the parameters against +hardware limits and returns the actual parameters as +VIDIOC_G_FMT does. Like +VIDIOC_S_FMT, the &VIDIOC-TRY-FMT; ioctl can be +used to learn about driver capabilities without actually changing +driver state. Unlike VIDIOC_S_FMT this also works +after the overlay has been enabled. + + A &v4l2-crop; defines the size and position of the target +rectangle. The scaling factor of the overlay is implied by the width +and height given in &v4l2-window; and &v4l2-crop;. The cropping API +applies to Video Output and Video +Output Overlay devices in the same way as to +Video Capture and Video +Overlay devices, merely reversing the direction of the +data flow. For more information see . +
+ +
+ Enabling Overlay + + There is no V4L2 ioctl to enable or disable the overlay, +however the framebuffer interface of the driver may support the +FBIOBLANK ioctl. +
+ + diff --git a/Documentation/DocBook/media/v4l/dev-output.xml b/Documentation/DocBook/media/v4l/dev-output.xml new file mode 100644 index 000000000000..919e22c53854 --- /dev/null +++ b/Documentation/DocBook/media/v4l/dev-output.xml @@ -0,0 +1,114 @@ + Video Output Interface + + Video output devices encode stills or image sequences as +analog video signal. With this interface applications can +control the encoding process and move images from user space to +the driver. + + Conventionally V4L2 video output devices are accessed through +character device special files named /dev/video +and /dev/video0 to +/dev/video63 with major number 81 and minor +numbers 0 to 63. /dev/video is typically a +symbolic link to the preferred video device. Note the same device +files are used for video capture devices. + +
+ Querying Capabilities + + Devices supporting the video output interface set the +V4L2_CAP_VIDEO_OUTPUT or +V4L2_CAP_VIDEO_OUTPUT_MPLANE flag in the +capabilities field of &v4l2-capability; +returned by the &VIDIOC-QUERYCAP; ioctl. As secondary device functions +they may also support the raw VBI +output (V4L2_CAP_VBI_OUTPUT) interface. At +least one of the read/write or streaming I/O methods must be +supported. Modulators and audio outputs are optional. +
+ +
+ Supplemental Functions + + Video output devices shall support audio output, modulator, controls, +cropping and scaling and streaming parameter ioctls as needed. +The video output and video standard ioctls must be supported by +all video output devices. +
+ +
+ Image Format Negotiation + + The output is determined by cropping and image format +parameters. The former select an area of the video picture where the +image will appear, the latter how images are stored in memory, &ie; in +RGB or YUV format, the number of bits per pixel or width and height. +Together they also define how images are scaled in the process. + + As usual these parameters are not reset +at &func-open; time to permit Unix tool chains, programming a device +and then writing to it as if it was a plain file. Well written V4L2 +applications ensure they really get what they want, including cropping +and scaling. + + Cropping initialization at minimum requires to reset the +parameters to defaults. An example is given in . + + To query the current image format applications set the +type field of a &v4l2-format; to +V4L2_BUF_TYPE_VIDEO_OUTPUT or +V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE and call the +&VIDIOC-G-FMT; ioctl with a pointer to this structure. Drivers fill +the &v4l2-pix-format; pix or the +&v4l2-pix-format-mplane; pix_mp member of the +fmt union. + + To request different parameters applications set the +type field of a &v4l2-format; as above and +initialize all fields of the &v4l2-pix-format; +vbi member of the +fmt union, or better just modify the +results of VIDIOC_G_FMT, and call the +&VIDIOC-S-FMT; ioctl with a pointer to this structure. Drivers may +adjust the parameters and finally return the actual parameters as +VIDIOC_G_FMT does. + + Like VIDIOC_S_FMT the +&VIDIOC-TRY-FMT; ioctl can be used to learn about hardware limitations +without disabling I/O or possibly time consuming hardware +preparations. + + The contents of &v4l2-pix-format; and &v4l2-pix-format-mplane; +are discussed in . See also the specification of the +VIDIOC_G_FMT, VIDIOC_S_FMT +and VIDIOC_TRY_FMT ioctls for details. Video +output devices must implement both the +VIDIOC_G_FMT and +VIDIOC_S_FMT ioctl, even if +VIDIOC_S_FMT ignores all requests and always +returns default parameters as VIDIOC_G_FMT does. +VIDIOC_TRY_FMT is optional. +
+ +
+ Writing Images + + A video output device may support the write() function and/or streaming (memory mapping or user pointer) I/O. See for details. +
+ + diff --git a/Documentation/DocBook/media/v4l/dev-overlay.xml b/Documentation/DocBook/media/v4l/dev-overlay.xml new file mode 100644 index 000000000000..92513cf79150 --- /dev/null +++ b/Documentation/DocBook/media/v4l/dev-overlay.xml @@ -0,0 +1,379 @@ + Video Overlay Interface + Also known as Framebuffer Overlay or Previewing + + Video overlay devices have the ability to genlock (TV-)video +into the (VGA-)video signal of a graphics card, or to store captured +images directly in video memory of a graphics card, typically with +clipping. This can be considerable more efficient than capturing +images and displaying them by other means. In the old days when only +nuclear power plants needed cooling towers this used to be the only +way to put live video into a window. + + Video overlay devices are accessed through the same character +special files as video capture devices. +Note the default function of a /dev/video device +is video capturing. The overlay function is only available after +calling the &VIDIOC-S-FMT; ioctl. + + The driver may support simultaneous overlay and capturing +using the read/write and streaming I/O methods. If so, operation at +the nominal frame rate of the video standard is not guaranteed. Frames +may be directed away from overlay to capture, or one field may be used +for overlay and the other for capture if the capture parameters permit +this. + + Applications should use different file descriptors for +capturing and overlay. This must be supported by all drivers capable +of simultaneous capturing and overlay. Optionally these drivers may +also permit capturing and overlay with a single file descriptor for +compatibility with V4L and earlier versions of V4L2. + A common application of two file descriptors is the +XFree86 Xv/V4L interface driver and +a V4L2 application. While the X server controls video overlay, the +application can take advantage of memory mapping and DMA. + In the opinion of the designers of this API, no driver +writer taking the efforts to support simultaneous capturing and +overlay will restrict this ability by requiring a single file +descriptor, as in V4L and earlier versions of V4L2. Making this +optional means applications depending on two file descriptors need +backup routines to be compatible with all drivers, which is +considerable more work than using two fds in applications which do +not. Also two fd's fit the general concept of one file descriptor for +each logical stream. Hence as a complexity trade-off drivers +must support two file descriptors and +may support single fd operation. + + +
+ Querying Capabilities + + Devices supporting the video overlay interface set the +V4L2_CAP_VIDEO_OVERLAY flag in the +capabilities field of &v4l2-capability; +returned by the &VIDIOC-QUERYCAP; ioctl. The overlay I/O method specified +below must be supported. Tuners and audio inputs are optional. +
+ +
+ Supplemental Functions + + Video overlay devices shall support audio input, tuner, controls, +cropping and scaling and streaming parameter ioctls as needed. +The video input and video standard ioctls must be supported by +all video overlay devices. +
+ +
+ Setup + + Before overlay can commence applications must program the +driver with frame buffer parameters, namely the address and size of +the frame buffer and the image format, for example RGB 5:6:5. The +&VIDIOC-G-FBUF; and &VIDIOC-S-FBUF; ioctls are available to get +and set these parameters, respectively. The +VIDIOC_S_FBUF ioctl is privileged because it +allows to set up DMA into physical memory, bypassing the memory +protection mechanisms of the kernel. Only the superuser can change the +frame buffer address and size. Users are not supposed to run TV +applications as root or with SUID bit set. A small helper application +with suitable privileges should query the graphics system and program +the V4L2 driver at the appropriate time. + + Some devices add the video overlay to the output signal +of the graphics card. In this case the frame buffer is not modified by +the video device, and the frame buffer address and pixel format are +not needed by the driver. The VIDIOC_S_FBUF ioctl +is not privileged. An application can check for this type of device by +calling the VIDIOC_G_FBUF ioctl. + + A driver may support any (or none) of five clipping/blending +methods: + + Chroma-keying displays the overlaid image only where +pixels in the primary graphics surface assume a certain color. + + + A bitmap can be specified where each bit corresponds +to a pixel in the overlaid image. When the bit is set, the +corresponding video pixel is displayed, otherwise a pixel of the +graphics surface. + + + A list of clipping rectangles can be specified. In +these regions no video is displayed, so the +graphics surface can be seen here. + + + The framebuffer has an alpha channel that can be used +to clip or blend the framebuffer with the video. + + + A global alpha value can be specified to blend the +framebuffer contents with video images. + + + + When simultaneous capturing and overlay is supported and +the hardware prohibits different image and frame buffer formats, the +format requested first takes precedence. The attempt to capture +(&VIDIOC-S-FMT;) or overlay (&VIDIOC-S-FBUF;) may fail with an +&EBUSY; or return accordingly modified parameters.. +
+ +
+ Overlay Window + + The overlaid image is determined by cropping and overlay +window parameters. The former select an area of the video picture to +capture, the latter how images are overlaid and clipped. Cropping +initialization at minimum requires to reset the parameters to +defaults. An example is given in . + + The overlay window is described by a &v4l2-window;. It +defines the size of the image, its position over the graphics surface +and the clipping to be applied. To get the current parameters +applications set the type field of a +&v4l2-format; to V4L2_BUF_TYPE_VIDEO_OVERLAY and +call the &VIDIOC-G-FMT; ioctl. The driver fills the +v4l2_window substructure named +win. It is not possible to retrieve a +previously programmed clipping list or bitmap. + + To program the overlay window applications set the +type field of a &v4l2-format; to +V4L2_BUF_TYPE_VIDEO_OVERLAY, initialize the +win substructure and call the +&VIDIOC-S-FMT; ioctl. The driver adjusts the parameters against +hardware limits and returns the actual parameters as +VIDIOC_G_FMT does. Like +VIDIOC_S_FMT, the &VIDIOC-TRY-FMT; ioctl can be +used to learn about driver capabilities without actually changing +driver state. Unlike VIDIOC_S_FMT this also works +after the overlay has been enabled. + + The scaling factor of the overlaid image is implied by the +width and height given in &v4l2-window; and the size of the cropping +rectangle. For more information see . + + When simultaneous capturing and overlay is supported and +the hardware prohibits different image and window sizes, the size +requested first takes precedence. The attempt to capture or overlay as +well (&VIDIOC-S-FMT;) may fail with an &EBUSY; or return accordingly +modified parameters. + + + struct <structname>v4l2_window</structname> + + &cs-str; + + + &v4l2-rect; + w + Size and position of the window relative to the +top, left corner of the frame buffer defined with &VIDIOC-S-FBUF;. The +window can extend the frame buffer width and height, the +x and y +coordinates can be negative, and it can lie completely outside the +frame buffer. The driver clips the window accordingly, or if that is +not possible, modifies its size and/or position. + + + &v4l2-field; + field + Applications set this field to determine which +video field shall be overlaid, typically one of +V4L2_FIELD_ANY (0), +V4L2_FIELD_TOP, +V4L2_FIELD_BOTTOM or +V4L2_FIELD_INTERLACED. Drivers may have to choose +a different field order and return the actual setting here. + + + __u32 + chromakey + When chroma-keying has been negotiated with +&VIDIOC-S-FBUF; applications set this field to the desired pixel value +for the chroma key. The format is the same as the pixel format of the +framebuffer (&v4l2-framebuffer; +fmt.pixelformat field), with bytes in host +order. E. g. for V4L2_PIX_FMT_BGR24 +the value should be 0xRRGGBB on a little endian, 0xBBGGRR on a big +endian host. + + + &v4l2-clip; * + clips + When chroma-keying has not +been negotiated and &VIDIOC-G-FBUF; indicated this capability, +applications can set this field to point to an array of +clipping rectangles. + + + + + Like the window coordinates +w, clipping rectangles are defined relative +to the top, left corner of the frame buffer. However clipping +rectangles must not extend the frame buffer width and height, and they +must not overlap. If possible applications should merge adjacent +rectangles. Whether this must create x-y or y-x bands, or the order of +rectangles, is not defined. When clip lists are not supported the +driver ignores this field. Its contents after calling &VIDIOC-S-FMT; +are undefined. + + + __u32 + clipcount + When the application set the +clips field, this field must contain the +number of clipping rectangles in the list. When clip lists are not +supported the driver ignores this field, its contents after calling +VIDIOC_S_FMT are undefined. When clip lists are +supported but no clipping is desired this field must be set to +zero. + + + void * + bitmap + When chroma-keying has +not been negotiated and &VIDIOC-G-FBUF; indicated +this capability, applications can set this field to point to a +clipping bit mask. + + + It must be of the same size +as the window, w.width and +w.height. Each bit corresponds to a pixel +in the overlaid image, which is displayed only when the bit is +set. Pixel coordinates translate to bits like: + +((__u8 *) bitmap)[w.width * y + x / 8] & (1 << (x & 7))where 0 ≤ x < +w.width and 0 ≤ +y <w.height. + Should we require + w.width to be a multiple of + eight? + When a clipping +bit mask is not supported the driver ignores this field, its contents +after calling &VIDIOC-S-FMT; are undefined. When a bit mask is supported +but no clipping is desired this field must be set to +NULL.Applications need not create a +clip list or bit mask. When they pass both, or despite negotiating +chroma-keying, the results are undefined. Regardless of the chosen +method, the clipping abilities of the hardware may be limited in +quantity or quality. The results when these limits are exceeded are +undefined. + When the image is written into frame buffer +memory it will be undesirable if the driver clips out less pixels +than expected, because the application and graphics system are not +aware these regions need to be refreshed. The driver should clip out +more pixels or not write the image at all. + + + + __u8 + global_alpha + The global alpha value used to blend the +framebuffer with video images, if global alpha blending has been +negotiated (V4L2_FBUF_FLAG_GLOBAL_ALPHA, see +&VIDIOC-S-FBUF;, ). + + + + + Note this field was added in Linux 2.6.23, extending the structure. However +the VIDIOC_G/S/TRY_FMT ioctls, +which take a pointer to a v4l2_format parent structure with padding +bytes at the end, are not affected. + + + +
+ + + struct <structname>v4l2_clip</structname><footnote> + <para>The X Window system defines "regions" which are +vectors of struct BoxRec { short x1, y1, x2, y2; } with width = x2 - +x1 and height = y2 - y1, so one cannot pass X11 clip lists +directly.</para> + </footnote> + + &cs-str; + + + &v4l2-rect; + c + Coordinates of the clipping rectangle, relative to +the top, left corner of the frame buffer. Only window pixels +outside all clipping rectangles are +displayed. + + + &v4l2-clip; * + next + Pointer to the next clipping rectangle, NULL when +this is the last rectangle. Drivers ignore this field, it cannot be +used to pass a linked list of clipping rectangles. + + + +
+ + + + + struct <structname>v4l2_rect</structname> + + &cs-str; + + + __s32 + left + Horizontal offset of the top, left corner of the +rectangle, in pixels. + + + __s32 + top + Vertical offset of the top, left corner of the +rectangle, in pixels. Offsets increase to the right and down. + + + __s32 + width + Width of the rectangle, in pixels. + + + __s32 + height + Height of the rectangle, in pixels. Width and +height cannot be negative, the fields are signed for hysterical +reasons. + + + +
+
+ +
+ Enabling Overlay + + To start or stop the frame buffer overlay applications call +the &VIDIOC-OVERLAY; ioctl. +
+ + diff --git a/Documentation/DocBook/media/v4l/dev-radio.xml b/Documentation/DocBook/media/v4l/dev-radio.xml new file mode 100644 index 000000000000..73aa90b45b34 --- /dev/null +++ b/Documentation/DocBook/media/v4l/dev-radio.xml @@ -0,0 +1,57 @@ + Radio Interface + + This interface is intended for AM and FM (analog) radio +receivers and transmitters. + + Conventionally V4L2 radio devices are accessed through +character device special files named /dev/radio +and /dev/radio0 to +/dev/radio63 with major number 81 and minor +numbers 64 to 127. + +
+ Querying Capabilities + + Devices supporting the radio interface set the +V4L2_CAP_RADIO and +V4L2_CAP_TUNER or +V4L2_CAP_MODULATOR flag in the +capabilities field of &v4l2-capability; +returned by the &VIDIOC-QUERYCAP; ioctl. Other combinations of +capability flags are reserved for future extensions. +
+ +
+ Supplemental Functions + + Radio devices can support controls, and must support the tuner or modulator ioctls. + + They do not support the video input or output, audio input +or output, video standard, cropping and scaling, compression and +streaming parameter, or overlay ioctls. All other ioctls and I/O +methods are reserved for future extensions. +
+ +
+ Programming + + Radio devices may have a couple audio controls (as discussed +in ) such as a volume control, possibly custom +controls. Further all radio devices have one tuner or modulator (these are +discussed in ) with index number zero to select +the radio frequency and to determine if a monaural or FM stereo +program is received/emitted. Drivers switch automatically between AM and FM +depending on the selected frequency. The &VIDIOC-G-TUNER; or +&VIDIOC-G-MODULATOR; ioctl +reports the supported frequency range. +
+ + diff --git a/Documentation/DocBook/media/v4l/dev-raw-vbi.xml b/Documentation/DocBook/media/v4l/dev-raw-vbi.xml new file mode 100644 index 000000000000..c5a70bdfaf27 --- /dev/null +++ b/Documentation/DocBook/media/v4l/dev-raw-vbi.xml @@ -0,0 +1,347 @@ + Raw VBI Data Interface + + VBI is an abbreviation of Vertical Blanking Interval, a gap +in the sequence of lines of an analog video signal. During VBI +no picture information is transmitted, allowing some time while the +electron beam of a cathode ray tube TV returns to the top of the +screen. Using an oscilloscope you will find here the vertical +synchronization pulses and short data packages ASK +modulatedASK: Amplitude-Shift Keying. A high signal +level represents a '1' bit, a low level a '0' bit. +onto the video signal. These are transmissions of services such as +Teletext or Closed Caption. + + Subject of this interface type is raw VBI data, as sampled off +a video signal, or to be added to a signal for output. +The data format is similar to uncompressed video images, a number of +lines times a number of samples per line, we call this a VBI image. + + Conventionally V4L2 VBI devices are accessed through character +device special files named /dev/vbi and +/dev/vbi0 to /dev/vbi31 with +major number 81 and minor numbers 224 to 255. +/dev/vbi is typically a symbolic link to the +preferred VBI device. This convention applies to both input and output +devices. + + To address the problems of finding related video and VBI +devices VBI capturing and output is also available as device function +under /dev/video. To capture or output raw VBI +data with these devices applications must call the &VIDIOC-S-FMT; +ioctl. Accessed as /dev/vbi, raw VBI capturing +or output is the default device function. + +
+ Querying Capabilities + + Devices supporting the raw VBI capturing or output API set +the V4L2_CAP_VBI_CAPTURE or +V4L2_CAP_VBI_OUTPUT flags, respectively, in the +capabilities field of &v4l2-capability; +returned by the &VIDIOC-QUERYCAP; ioctl. At least one of the +read/write, streaming or asynchronous I/O methods must be +supported. VBI devices may or may not have a tuner or modulator. +
+ +
+ Supplemental Functions + + VBI devices shall support video +input or output, tuner or +modulator, and controls ioctls +as needed. The video standard ioctls provide +information vital to program a VBI device, therefore must be +supported. +
+ +
+ Raw VBI Format Negotiation + + Raw VBI sampling abilities can vary, in particular the +sampling frequency. To properly interpret the data V4L2 specifies an +ioctl to query the sampling parameters. Moreover, to allow for some +flexibility applications can also suggest different parameters. + + As usual these parameters are not +reset at &func-open; time to permit Unix tool chains, programming a +device and then reading from it as if it was a plain file. Well +written V4L2 applications should always ensure they really get what +they want, requesting reasonable parameters and then checking if the +actual parameters are suitable. + + To query the current raw VBI capture parameters +applications set the type field of a +&v4l2-format; to V4L2_BUF_TYPE_VBI_CAPTURE or +V4L2_BUF_TYPE_VBI_OUTPUT, and call the +&VIDIOC-G-FMT; ioctl with a pointer to this structure. Drivers fill +the &v4l2-vbi-format; vbi member of the +fmt union. + + To request different parameters applications set the +type field of a &v4l2-format; as above and +initialize all fields of the &v4l2-vbi-format; +vbi member of the +fmt union, or better just modify the +results of VIDIOC_G_FMT, and call the +&VIDIOC-S-FMT; ioctl with a pointer to this structure. Drivers return +an &EINVAL; only when the given parameters are ambiguous, otherwise +they modify the parameters according to the hardware capabilites and +return the actual parameters. When the driver allocates resources at +this point, it may return an &EBUSY; to indicate the returned +parameters are valid but the required resources are currently not +available. That may happen for instance when the video and VBI areas +to capture would overlap, or when the driver supports multiple opens +and another process already requested VBI capturing or output. Anyway, +applications must expect other resource allocation points which may +return EBUSY, at the &VIDIOC-STREAMON; ioctl +and the first read(), write() and select() call. + + VBI devices must implement both the +VIDIOC_G_FMT and +VIDIOC_S_FMT ioctl, even if +VIDIOC_S_FMT ignores all requests and always +returns default parameters as VIDIOC_G_FMT does. +VIDIOC_TRY_FMT is optional. + + + struct <structname>v4l2_vbi_format</structname> + + &cs-str; + + + __u32 + sampling_rate + Samples per second, i. e. unit 1 Hz. + + + __u32 + offset + Horizontal offset of the VBI image, +relative to the leading edge of the line synchronization pulse and +counted in samples: The first sample in the VBI image will be located +offset / +sampling_rate seconds following the leading +edge. See also . + + + __u32 + samples_per_line + + + + __u32 + sample_format + Defines the sample format as in , a four-character-code. + A few devices may be unable to +sample VBI data at all but can extend the video capture window to the +VBI region. + Usually this is +V4L2_PIX_FMT_GREY, i. e. each sample +consists of 8 bits with lower values oriented towards the black level. +Do not assume any other correlation of values with the signal level. +For example, the MSB does not necessarily indicate if the signal is +'high' or 'low' because 128 may not be the mean value of the +signal. Drivers shall not convert the sample format by software. + + + __u32 + start[2] + This is the scanning system line number +associated with the first line of the VBI image, of the first and the +second field respectively. See and + for valid values. VBI input drivers can +return start values 0 if the hardware cannot reliable identify +scanning lines, VBI acquisition may not require this +information. + + + __u32 + count[2] + The number of lines in the first and second +field image, respectively. + + + Drivers should be as +flexibility as possible. For example, it may be possible to extend or +move the VBI capture window down to the picture area, implementing a +'full field mode' to capture data service transmissions embedded in +the picture.An application can set the first or second +count value to zero if no data is required +from the respective field; count[1] if the +scanning system is progressive, &ie; not interlaced. The +corresponding start value shall be ignored by the application and +driver. Anyway, drivers may not support single field capturing and +return both count values non-zero.Both +count values set to zero, or line numbers +outside the bounds depicted in and , or a field image covering +lines of two fields, are invalid and shall not be returned by the +driver.To initialize the start +and count fields, applications must first +determine the current video standard selection. The &v4l2-std-id; or +the framelines field of &v4l2-standard; can +be evaluated for this purpose. + + + __u32 + flags + See below. Currently +only drivers set flags, applications must set this field to +zero. + + + __u32 + reserved[2] + This array is reserved for future extensions. +Drivers and applications must set it to zero. + + + +
+ + + Raw VBI Format Flags + + &cs-def; + + + V4L2_VBI_UNSYNC + 0x0001 + This flag indicates hardware which does not +properly distinguish between fields. Normally the VBI image stores the +first field (lower scanning line numbers) first in memory. This may be +a top or bottom field depending on the video standard. When this flag +is set the first or second field may be stored first, however the +fields are still in correct temporal order with the older field first +in memory. + Most VBI services transmit on both fields, but +some have different semantics depending on the field number. These +cannot be reliable decoded or encoded when +V4L2_VBI_UNSYNC is set. + + + + V4L2_VBI_INTERLACED + 0x0002 + By default the two field images will be passed +sequentially; all lines of the first field followed by all lines of +the second field (compare +V4L2_FIELD_SEQ_TB and +V4L2_FIELD_SEQ_BT, whether the top or bottom +field is first in memory depends on the video standard). When this +flag is set, the two fields are interlaced (cf. +V4L2_FIELD_INTERLACED). The first line of the +first field followed by the first line of the second field, then the +two second lines, and so on. Such a layout may be necessary when the +hardware has been programmed to capture or output interlaced video +images and is unable to separate the fields for VBI capturing at +the same time. For simplicity setting this flag implies that both +count values are equal and non-zero. + + + +
+ +
+ Line synchronization + + + + + + + + + Line synchronization diagram + + +
+ +
+ ITU-R 525 line numbering (M/NTSC and M/PAL) + + + + + + + + + NTSC field synchronization diagram + + + (1) For the purpose of this specification field 2 +starts in line 264 and not 263.5 because half line capturing is not +supported. + + +
+ +
+ ITU-R 625 line numbering + + + + + + + + + PAL/SECAM field synchronization diagram + + + (1) For the purpose of this specification field 2 +starts in line 314 and not 313.5 because half line capturing is not +supported. + + +
+ + Remember the VBI image format depends on the selected +video standard, therefore the application must choose a new standard or +query the current standard first. Attempts to read or write data ahead +of format negotiation, or after switching the video standard which may +invalidate the negotiated VBI parameters, should be refused by the +driver. A format change during active I/O is not permitted. +
+ +
+ Reading and writing VBI images + + To assure synchronization with the field number and easier +implementation, the smallest unit of data passed at a time is one +frame, consisting of two fields of VBI images immediately following in +memory. + + The total size of a frame computes as follows: + + +(count[0] + count[1]) * +samples_per_line * sample size in bytes + + The sample size is most likely always one byte, +applications must check the sample_format +field though, to function properly with other drivers. + + A VBI device may support read/write and/or streaming (memory mapping or user pointer) I/O. The latter bears the +possibility of synchronizing video and +VBI data by using buffer timestamps. + + Remember the &VIDIOC-STREAMON; ioctl and the first read(), +write() and select() call can be resource allocation points returning +an &EBUSY; if the required hardware resources are temporarily +unavailable, for example the device is already in use by another +process. +
+ + diff --git a/Documentation/DocBook/media/v4l/dev-rds.xml b/Documentation/DocBook/media/v4l/dev-rds.xml new file mode 100644 index 000000000000..2427f54397e7 --- /dev/null +++ b/Documentation/DocBook/media/v4l/dev-rds.xml @@ -0,0 +1,204 @@ + RDS Interface + + The Radio Data System transmits supplementary +information in binary format, for example the station name or travel +information, on an inaudible audio subcarrier of a radio program. This +interface is aimed at devices capable of receiving and/or transmitting RDS +information. + + For more information see the core RDS standard +and the RBDS standard . + + Note that the RBDS standard as is used in the USA is almost identical +to the RDS standard. Any RDS decoder/encoder can also handle RBDS. Only some of the +fields have slightly different meanings. See the RBDS standard for more +information. + + The RBDS standard also specifies support for MMBS (Modified Mobile Search). +This is a proprietary format which seems to be discontinued. The RDS interface does not +support this format. Should support for MMBS (or the so-called 'E blocks' in general) +be needed, then please contact the linux-media mailing list: &v4l-ml;. + +
+ Querying Capabilities + + Devices supporting the RDS capturing API set +the V4L2_CAP_RDS_CAPTURE flag in +the capabilities field of &v4l2-capability; +returned by the &VIDIOC-QUERYCAP; ioctl. Any tuner that supports RDS +will set the V4L2_TUNER_CAP_RDS flag in +the capability field of &v4l2-tuner;. If +the driver only passes RDS blocks without interpreting the data +the V4L2_TUNER_SUB_RDS_BLOCK_IO flag has to be +set, see Reading RDS data. +For future use the +flag V4L2_TUNER_SUB_RDS_CONTROLS has also been +defined. However, a driver for a radio tuner with this capability does +not yet exist, so if you are planning to write such a driver you +should discuss this on the linux-media mailing list: &v4l-ml;. + + Whether an RDS signal is present can be detected by looking +at the rxsubchans field of &v4l2-tuner;: +the V4L2_TUNER_SUB_RDS will be set if RDS data +was detected. + + Devices supporting the RDS output API +set the V4L2_CAP_RDS_OUTPUT flag in +the capabilities field of &v4l2-capability; +returned by the &VIDIOC-QUERYCAP; ioctl. +Any modulator that supports RDS will set the +V4L2_TUNER_CAP_RDS flag in the capability +field of &v4l2-modulator;. +In order to enable the RDS transmission one must set the V4L2_TUNER_SUB_RDS +bit in the txsubchans field of &v4l2-modulator;. +If the driver only passes RDS blocks without interpreting the data +the V4L2_TUNER_SUB_RDS_BLOCK_IO flag has to be set. If the +tuner is capable of handling RDS entities like program identification codes and radio +text, the flag V4L2_TUNER_SUB_RDS_CONTROLS should be set, +see Writing RDS data and +FM Transmitter Control Reference. +
+ +
+ Reading RDS data + + RDS data can be read from the radio device +with the &func-read; function. The data is packed in groups of three bytes. +
+ +
+ Writing RDS data + + RDS data can be written to the radio device +with the &func-write; function. The data is packed in groups of three bytes, +as follows: +
+ +
+ RDS datastructures + + struct +<structname>v4l2_rds_data</structname> + + + + + + + __u8 + lsb + Least Significant Byte of RDS Block + + + __u8 + msb + Most Significant Byte of RDS Block + + + __u8 + block + Block description + + + +
+ + Block description + + + + + + Bits 0-2 + Block (aka offset) of the received data. + + + Bits 3-5 + Deprecated. Currently identical to bits 0-2. Do not use these bits. + + + Bit 6 + Corrected bit. Indicates that an error was corrected for this data block. + + + Bit 7 + Error bit. Indicates that an uncorrectable error occurred during reception of this block. + + + +
+ + + Block defines + + + + + + + + V4L2_RDS_BLOCK_MSK + + 7 + Mask for bits 0-2 to get the block ID. + + + V4L2_RDS_BLOCK_A + + 0 + Block A. + + + V4L2_RDS_BLOCK_B + + 1 + Block B. + + + V4L2_RDS_BLOCK_C + + 2 + Block C. + + + V4L2_RDS_BLOCK_D + + 3 + Block D. + + + V4L2_RDS_BLOCK_C_ALT + + 4 + Block C'. + + + V4L2_RDS_BLOCK_INVALID + read-only + 7 + An invalid block. + + + V4L2_RDS_BLOCK_CORRECTED + read-only + 0x40 + A bit error was detected but corrected. + + + V4L2_RDS_BLOCK_ERROR + read-only + 0x80 + An uncorrectable error occurred. + + + +
+
+ + diff --git a/Documentation/DocBook/media/v4l/dev-sliced-vbi.xml b/Documentation/DocBook/media/v4l/dev-sliced-vbi.xml new file mode 100644 index 000000000000..69e789fa7f7b --- /dev/null +++ b/Documentation/DocBook/media/v4l/dev-sliced-vbi.xml @@ -0,0 +1,708 @@ + Sliced VBI Data Interface + + VBI stands for Vertical Blanking Interval, a gap in the +sequence of lines of an analog video signal. During VBI no picture +information is transmitted, allowing some time while the electron beam +of a cathode ray tube TV returns to the top of the screen. + + Sliced VBI devices use hardware to demodulate data transmitted +in the VBI. V4L2 drivers shall not do this by +software, see also the raw VBI +interface. The data is passed as short packets of fixed size, +covering one scan line each. The number of packets per video frame is +variable. + + Sliced VBI capture and output devices are accessed through the +same character special files as raw VBI devices. When a driver +supports both interfaces, the default function of a +/dev/vbi device is raw VBI +capturing or output, and the sliced VBI function is only available +after calling the &VIDIOC-S-FMT; ioctl as defined below. Likewise a +/dev/video device may support the sliced VBI API, +however the default function here is video capturing or output. +Different file descriptors must be used to pass raw and sliced VBI +data simultaneously, if this is supported by the driver. + +
+ Querying Capabilities + + Devices supporting the sliced VBI capturing or output API +set the V4L2_CAP_SLICED_VBI_CAPTURE or +V4L2_CAP_SLICED_VBI_OUTPUT flag respectively, in +the capabilities field of &v4l2-capability; +returned by the &VIDIOC-QUERYCAP; ioctl. At least one of the +read/write, streaming or asynchronous I/O +methods must be supported. Sliced VBI devices may have a tuner +or modulator. +
+ +
+ Supplemental Functions + + Sliced VBI devices shall support video +input or output and tuner or +modulator ioctls if they have these capabilities, and they may +support control ioctls. The video standard ioctls provide information +vital to program a sliced VBI device, therefore must be +supported. +
+ +
+ Sliced VBI Format Negotiation + + To find out which data services are supported by the +hardware applications can call the &VIDIOC-G-SLICED-VBI-CAP; ioctl. +All drivers implementing the sliced VBI interface must support this +ioctl. The results may differ from those of the &VIDIOC-S-FMT; ioctl +when the number of VBI lines the hardware can capture or output per +frame, or the number of services it can identify on a given line are +limited. For example on PAL line 16 the hardware may be able to look +for a VPS or Teletext signal, but not both at the same time. + + To determine the currently selected services applications +set the type field of &v4l2-format; to + V4L2_BUF_TYPE_SLICED_VBI_CAPTURE or +V4L2_BUF_TYPE_SLICED_VBI_OUTPUT, and the &VIDIOC-G-FMT; +ioctl fills the fmt.sliced member, a +&v4l2-sliced-vbi-format;. + + Applications can request different parameters by +initializing or modifying the fmt.sliced +member and calling the &VIDIOC-S-FMT; ioctl with a pointer to the +v4l2_format structure. + + The sliced VBI API is more complicated than the raw VBI API +because the hardware must be told which VBI service to expect on each +scan line. Not all services may be supported by the hardware on all +lines (this is especially true for VBI output where Teletext is often +unsupported and other services can only be inserted in one specific +line). In many cases, however, it is sufficient to just set the +service_set field to the required services +and let the driver fill the service_lines +array according to hardware capabilities. Only if more precise control +is needed should the programmer set the +service_lines array explicitly. + + The &VIDIOC-S-FMT; ioctl modifies the parameters +according to hardware capabilities. When the driver allocates +resources at this point, it may return an &EBUSY; if the required +resources are temporarily unavailable. Other resource allocation +points which may return EBUSY can be the +&VIDIOC-STREAMON; ioctl and the first &func-read;, &func-write; and +&func-select; call. + + + struct +<structname>v4l2_sliced_vbi_format</structname> + + + + + + + + + + __u32 + service_set + If +service_set is non-zero when passed with +&VIDIOC-S-FMT; or &VIDIOC-TRY-FMT;, the +service_lines array will be filled by the +driver according to the services specified in this field. For example, +if service_set is initialized with +V4L2_SLICED_TELETEXT_B | V4L2_SLICED_WSS_625, a +driver for the cx25840 video decoder sets lines 7-22 of both +fieldsAccording to ETS 300 706 lines 6-22 of the +first field and lines 5-22 of the second field may carry Teletext +data. to V4L2_SLICED_TELETEXT_B +and line 23 of the first field to +V4L2_SLICED_WSS_625. If +service_set is set to zero, then the values +of service_lines will be used instead. +On return the driver sets this field to the union of all +elements of the returned service_lines +array. It may contain less services than requested, perhaps just one, +if the hardware cannot handle more services simultaneously. It may be +empty (zero) if none of the requested services are supported by the +hardware. + + + __u16 + service_lines[2][24] + Applications initialize this +array with sets of data services the driver shall look for or insert +on the respective scan line. Subject to hardware capabilities drivers +return the requested set, a subset, which may be just a single +service, or an empty set. When the hardware cannot handle multiple +services on the same line the driver shall choose one. No assumptions +can be made on which service the driver chooses.Data +services are defined in . Array indices +map to ITU-R line numbers (see also and ) as follows: + + + + + Element + 525 line systems + 625 line systems + + + + + service_lines[0][1] + 1 + 1 + + + + + service_lines[0][23] + 23 + 23 + + + + + service_lines[1][1] + 264 + 314 + + + + + service_lines[1][23] + 286 + 336 + + + + + + Drivers must set +service_lines[0][0] and +service_lines[1][0] to zero. + + + __u32 + io_size + Maximum number of bytes passed by +one &func-read; or &func-write; call, and the buffer size in bytes for +the &VIDIOC-QBUF; and &VIDIOC-DQBUF; ioctl. Drivers set this field to +the size of &v4l2-sliced-vbi-data; times the number of non-zero +elements in the returned service_lines +array (that is the number of lines potentially carrying data). + + + __u32 + reserved[2] + This array is reserved for future +extensions. Applications and drivers must set it to zero. + + + +
+ + + + Sliced VBI services + + + + + + + + + + Symbol + Value + Reference + Lines, usually + Payload + + + + + V4L2_SLICED_TELETEXT_B +(Teletext System B) + 0x0001 + , + PAL/SECAM line 7-22, 320-335 (second field 7-22) + Last 42 of the 45 byte Teletext packet, that is +without clock run-in and framing code, lsb first transmitted. + + + V4L2_SLICED_VPS + 0x0400 + + PAL line 16 + Byte number 3 to 15 according to Figure 9 of +ETS 300 231, lsb first transmitted. + + + V4L2_SLICED_CAPTION_525 + 0x1000 + + NTSC line 21, 284 (second field 21) + Two bytes in transmission order, including parity +bit, lsb first transmitted. + + + V4L2_SLICED_WSS_625 + 0x4000 + , + PAL/SECAM line 23 + +Byte 0 1 + msb lsb msb lsb + Bit 7 6 5 4 3 2 1 0 x x 13 12 11 10 9 + + + + V4L2_SLICED_VBI_525 + 0x1000 + Set of services applicable to 525 +line systems. + + + V4L2_SLICED_VBI_625 + 0x4401 + Set of services applicable to 625 +line systems. + + + +
+ + Drivers may return an &EINVAL; when applications attempt to +read or write data without prior format negotiation, after switching +the video standard (which may invalidate the negotiated VBI +parameters) and after switching the video input (which may change the +video standard as a side effect). The &VIDIOC-S-FMT; ioctl may return +an &EBUSY; when applications attempt to change the format while i/o is +in progress (between a &VIDIOC-STREAMON; and &VIDIOC-STREAMOFF; call, +and after the first &func-read; or &func-write; call). +
+ +
+ Reading and writing sliced VBI data + + A single &func-read; or &func-write; call must pass all data +belonging to one video frame. That is an array of +v4l2_sliced_vbi_data structures with one or +more elements and a total size not exceeding +io_size bytes. Likewise in streaming I/O +mode one buffer of io_size bytes must +contain data of one video frame. The id of +unused v4l2_sliced_vbi_data elements must be +zero. + + + struct +<structname>v4l2_sliced_vbi_data</structname> + + &cs-def; + + + __u32 + id + A flag from +identifying the type of data in this packet. Only a single bit must be +set. When the id of a captured packet is +zero, the packet is empty and the contents of other fields are +undefined. Applications shall ignore empty packets. When the +id of a packet for output is zero the +contents of the data field are undefined +and the driver must no longer insert data on the requested +field and +line. + + + __u32 + field + The video field number this data has been captured +from, or shall be inserted at. 0 for the first +field, 1 for the second field. + + + __u32 + line + The field (as opposed to frame) line number this +data has been captured from, or shall be inserted at. See and for valid +values. Sliced VBI capture devices can set the line number of all +packets to 0 if the hardware cannot reliably +identify scan lines. The field number must always be valid. + + + __u32 + reserved + This field is reserved for future extensions. +Applications and drivers must set it to zero. + + + __u8 + data[48] + The packet payload. See for the contents and number of +bytes passed for each data type. The contents of padding bytes at the +end of this array are undefined, drivers and applications shall ignore +them. + + + +
+ + Packets are always passed in ascending line number order, +without duplicate line numbers. The &func-write; function and the +&VIDIOC-QBUF; ioctl must return an &EINVAL; when applications violate +this rule. They must also return an &EINVAL; when applications pass an +incorrect field or line number, or a combination of +field, line and +id which has not been negotiated with the +&VIDIOC-G-FMT; or &VIDIOC-S-FMT; ioctl. When the line numbers are +unknown the driver must pass the packets in transmitted order. The +driver can insert empty packets with id set +to zero anywhere in the packet array. + + To assure synchronization and to distinguish from frame +dropping, when a captured frame does not carry any of the requested +data services drivers must pass one or more empty packets. When an +application fails to pass VBI data in time for output, the driver +must output the last VPS and WSS packet again, and disable the output +of Closed Caption and Teletext data, or output data which is ignored +by Closed Caption and Teletext decoders. + + A sliced VBI device may support read/write and/or streaming (memory mapping and/or user +pointer) I/O. The latter bears the possibility of synchronizing +video and VBI data by using buffer timestamps. + +
+ +
+ Sliced VBI Data in MPEG Streams + + If a device can produce an MPEG output stream, it may be +capable of providing negotiated sliced VBI +services as data embedded in the MPEG stream. Users or +applications control this sliced VBI data insertion with the V4L2_CID_MPEG_STREAM_VBI_FMT +control. + + If the driver does not provide the V4L2_CID_MPEG_STREAM_VBI_FMT +control, or only allows that control to be set to +V4L2_MPEG_STREAM_VBI_FMT_NONE, then the device +cannot embed sliced VBI data in the MPEG stream. + + The +V4L2_CID_MPEG_STREAM_VBI_FMT control does not implicitly set +the device driver to capture nor cease capturing sliced VBI data. The +control only indicates to embed sliced VBI data in the MPEG stream, if +an application has negotiated sliced VBI service be captured. + + It may also be the case that a device can embed sliced VBI +data in only certain types of MPEG streams: for example in an MPEG-2 +PS but not an MPEG-2 TS. In this situation, if sliced VBI data +insertion is requested, the sliced VBI data will be embedded in MPEG +stream types when supported, and silently omitted from MPEG stream +types where sliced VBI data insertion is not supported by the device. + + + The following subsections specify the format of the +embedded sliced VBI data. + +
+ MPEG Stream Embedded, Sliced VBI Data Format: NONE + The +V4L2_MPEG_STREAM_VBI_FMT_NONE embedded sliced VBI +format shall be interpreted by drivers as a control to cease +embedding sliced VBI data in MPEG streams. Neither the device nor +driver shall insert "empty" embedded sliced VBI data packets in the +MPEG stream when this format is set. No MPEG stream data structures +are specified for this format. +
+ +
+ MPEG Stream Embedded, Sliced VBI Data Format: IVTV + The +V4L2_MPEG_STREAM_VBI_FMT_IVTV embedded sliced VBI +format, when supported, indicates to the driver to embed up to 36 +lines of sliced VBI data per frame in an MPEG-2 Private +Stream 1 PES packet encapsulated in an MPEG-2 +Program Pack in the MPEG stream. + + Historical context: This format +specification originates from a custom, embedded, sliced VBI data +format used by the ivtv driver. This format +has already been informally specified in the kernel sources in the +file Documentation/video4linux/cx2341x/README.vbi +. The maximum size of the payload and other aspects of this format +are driven by the CX23415 MPEG decoder's capabilities and limitations +with respect to extracting, decoding, and displaying sliced VBI data +embedded within an MPEG stream. + + This format's use is not exclusive to +the ivtv driver nor +exclusive to CX2341x devices, as the sliced VBI data packet insertion +into the MPEG stream is implemented in driver software. At least the +cx18 driver provides sliced VBI data insertion +into an MPEG-2 PS in this format as well. + + The following definitions specify the payload of the +MPEG-2 Private Stream 1 PES packets that contain +sliced VBI data when +V4L2_MPEG_STREAM_VBI_FMT_IVTV is set. +(The MPEG-2 Private Stream 1 PES packet header +and encapsulating MPEG-2 Program Pack header are +not detailed here. Please refer to the MPEG-2 specifications for +details on those packet headers.) + + The payload of the MPEG-2 Private Stream 1 PES + packets that contain sliced VBI data is specified by +&v4l2-mpeg-vbi-fmt-ivtv;. The payload is variable +length, depending on the actual number of lines of sliced VBI data +present in a video frame. The payload may be padded at the end with +unspecified fill bytes to align the end of the payload to a 4-byte +boundary. The payload shall never exceed 1552 bytes (2 fields with +18 lines/field with 43 bytes of data/line and a 4 byte magic number). + + + + struct <structname>v4l2_mpeg_vbi_fmt_ivtv</structname> + + + &cs-ustr; + + + __u8 + magic[4] + + A "magic" constant from that indicates +this is a valid sliced VBI data payload and also indicates which +member of the anonymous union, itv0 or +ITV0, to use for the payload data. + + + union + (anonymous) + + + + struct + v4l2_mpeg_vbi_itv0 + + itv0 + The primary form of the sliced VBI data payload +that contains anywhere from 1 to 35 lines of sliced VBI data. +Line masks are provided in this form of the payload indicating +which VBI lines are provided. + + + + struct + v4l2_mpeg_vbi_ITV0 + + ITV0 + An alternate form of the sliced VBI data payload +used when 36 lines of sliced VBI data are present. No line masks are +provided in this form of the payload; all valid line mask bits are +implcitly set. + + + +
+ + + Magic Constants for &v4l2-mpeg-vbi-fmt-ivtv; + <structfield>magic</structfield> field + + &cs-def; + + + Defined Symbol + Value + Description + + + + + V4L2_MPEG_VBI_IVTV_MAGIC0 + + "itv0" + Indicates the itv0 +member of the union in &v4l2-mpeg-vbi-fmt-ivtv; is valid. + + + V4L2_MPEG_VBI_IVTV_MAGIC1 + + "ITV0" + Indicates the ITV0 +member of the union in &v4l2-mpeg-vbi-fmt-ivtv; is valid and +that 36 lines of sliced VBI data are present. + + + +
+ + + struct <structname>v4l2_mpeg_vbi_itv0</structname> + + + &cs-str; + + + __le32 + linemask[2] + Bitmasks indicating the VBI service lines +present. These linemask values are stored +in little endian byte order in the MPEG stream. Some reference +linemask bit positions with their +corresponding VBI line number and video field are given below. +b0 indicates the least significant bit of a +linemask value: +linemask[0] b0: line 6 first field +linemask[0] b17: line 23 first field +linemask[0] b18: line 6 second field +linemask[0] b31: line 19 second field +linemask[1] b0: line 20 second field +linemask[1] b3: line 23 second field +linemask[1] b4-b31: unused and set to 0 + + + struct + v4l2_mpeg_vbi_itv0_line + + line[35] + This is a variable length array that holds from 1 +to 35 lines of sliced VBI data. The sliced VBI data lines present +correspond to the bits set in the linemask +array, starting from b0 of +linemask[0] up through b31 of +linemask[0], and from b0 + of linemask[1] up through b +3 of linemask[1]. +line[0] corresponds to the first bit +found set in the linemask array, +line[1] corresponds to the second bit +found set in the linemask array, etc. +If no linemask array bits are set, then +line[0] may contain one line of +unspecified data that should be ignored by applications. + + + +
+ + + struct <structname>v4l2_mpeg_vbi_ITV0</structname> + + + &cs-str; + + + struct + v4l2_mpeg_vbi_itv0_line + + line[36] + A fixed length array of 36 lines of sliced VBI +data. line[0] through line +[17] correspond to lines 6 through 23 of the +first field. line[18] through +line[35] corresponds to lines 6 +through 23 of the second field. + + + +
+ + + struct <structname>v4l2_mpeg_vbi_itv0_line</structname> + + + &cs-str; + + + __u8 + id + A line identifier value from + that indicates +the type of sliced VBI data stored on this line. + + + __u8 + data[42] + The sliced VBI data for the line. + + + +
+ + + Line Identifiers for struct <link + linkend="v4l2-mpeg-vbi-itv0-line"><structname> +v4l2_mpeg_vbi_itv0_line</structname></link> <structfield>id +</structfield> field + + &cs-def; + + + Defined Symbol + Value + Description + + + + + V4L2_MPEG_VBI_IVTV_TELETEXT_B + + 1 + Refer to +Sliced VBI services for a description of the line payload. + + + V4L2_MPEG_VBI_IVTV_CAPTION_525 + + 4 + Refer to +Sliced VBI services for a description of the line payload. + + + V4L2_MPEG_VBI_IVTV_WSS_625 + + 5 + Refer to +Sliced VBI services for a description of the line payload. + + + V4L2_MPEG_VBI_IVTV_VPS + + 7 + Refer to +Sliced VBI services for a description of the line payload. + + + +
+ +
+
+ + + diff --git a/Documentation/DocBook/media/v4l/dev-subdev.xml b/Documentation/DocBook/media/v4l/dev-subdev.xml new file mode 100644 index 000000000000..05c8fefcbcbe --- /dev/null +++ b/Documentation/DocBook/media/v4l/dev-subdev.xml @@ -0,0 +1,313 @@ + Sub-device Interface + + + Experimental + This is an experimental + interface and may change in the future. + + + The complex nature of V4L2 devices, where hardware is often made of + several integrated circuits that need to interact with each other in a + controlled way, leads to complex V4L2 drivers. The drivers usually reflect + the hardware model in software, and model the different hardware components + as software blocks called sub-devices. + + V4L2 sub-devices are usually kernel-only objects. If the V4L2 driver + implements the media device API, they will automatically inherit from media + entities. Applications will be able to enumerate the sub-devices and discover + the hardware topology using the media entities, pads and links enumeration + API. + + In addition to make sub-devices discoverable, drivers can also choose + to make them directly configurable by applications. When both the sub-device + driver and the V4L2 device driver support this, sub-devices will feature a + character device node on which ioctls can be called to + + query, read and write sub-devices controls + subscribe and unsubscribe to events and retrieve them + negotiate image formats on individual pads + + + + Sub-device character device nodes, conventionally named + /dev/v4l-subdev*, use major number 81. + +
+ Controls + Most V4L2 controls are implemented by sub-device hardware. Drivers + usually merge all controls and expose them through video device nodes. + Applications can control all sub-devices through a single interface. + + Complex devices sometimes implement the same control in different + pieces of hardware. This situation is common in embedded platforms, where + both sensors and image processing hardware implement identical functions, + such as contrast adjustment, white balance or faulty pixels correction. As + the V4L2 controls API doesn't support several identical controls in a single + device, all but one of the identical controls are hidden. + + Applications can access those hidden controls through the sub-device + node with the V4L2 control API described in . The + ioctls behave identically as when issued on V4L2 device nodes, with the + exception that they deal only with controls implemented in the sub-device. + + + Depending on the driver, those controls might also be exposed through + one (or several) V4L2 device nodes. +
+ +
+ Events + V4L2 sub-devices can notify applications of events as described in + . The API behaves identically as when used on V4L2 + device nodes, with the exception that it only deals with events generated by + the sub-device. Depending on the driver, those events might also be reported + on one (or several) V4L2 device nodes. +
+ +
+ Pad-level Formats + + Pad-level formats are only applicable to very complex device that + need to expose low-level format configuration to user space. Generic V4L2 + applications do not need to use the API described in + this section. + + For the purpose of this section, the term + format means the combination of media bus data + format, frame width and frame height. + + Image formats are typically negotiated on video capture and output + devices using the cropping and scaling ioctls. + The driver is responsible for configuring every block in the video pipeline + according to the requested format at the pipeline input and/or + output. + + For complex devices, such as often found in embedded systems, + identical image sizes at the output of a pipeline can be achieved using + different hardware configurations. One such example is shown on + , where + image scaling can be performed on both the video sensor and the host image + processing hardware. + +
+ Image Format Negotiation on Pipelines + + + + + + + + + High quality and high speed pipeline configuration + + +
+ + The sensor scaler is usually of less quality than the host scaler, but + scaling on the sensor is required to achieve higher frame rates. Depending + on the use case (quality vs. speed), the pipeline must be configured + differently. Applications need to configure the formats at every point in + the pipeline explicitly. + + Drivers that implement the media + API can expose pad-level image format configuration to applications. + When they do, applications can use the &VIDIOC-SUBDEV-G-FMT; and + &VIDIOC-SUBDEV-S-FMT; ioctls. to negotiate formats on a per-pad basis. + + Applications are responsible for configuring coherent parameters on + the whole pipeline and making sure that connected pads have compatible + formats. The pipeline is checked for formats mismatch at &VIDIOC-STREAMON; + time, and an &EPIPE; is then returned if the configuration is + invalid. + + Pad-level image format configuration support can be tested by calling + the &VIDIOC-SUBDEV-G-FMT; ioctl on pad 0. If the driver returns an &EINVAL; + pad-level format configuration is not supported by the sub-device. + +
+ Format Negotiation + + Acceptable formats on pads can (and usually do) depend on a number + of external parameters, such as formats on other pads, active links, or + even controls. Finding a combination of formats on all pads in a video + pipeline, acceptable to both application and driver, can't rely on formats + enumeration only. A format negotiation mechanism is required. + + Central to the format negotiation mechanism are the get/set format + operations. When called with the which argument + set to V4L2_SUBDEV_FORMAT_TRY, the + &VIDIOC-SUBDEV-G-FMT; and &VIDIOC-SUBDEV-S-FMT; ioctls operate on a set of + formats parameters that are not connected to the hardware configuration. + Modifying those 'try' formats leaves the device state untouched (this + applies to both the software state stored in the driver and the hardware + state stored in the device itself). + + While not kept as part of the device state, try formats are stored + in the sub-device file handles. A &VIDIOC-SUBDEV-G-FMT; call will return + the last try format set on the same sub-device file + handle. Several applications querying the same sub-device at + the same time will thus not interact with each other. + + To find out whether a particular format is supported by the device, + applications use the &VIDIOC-SUBDEV-S-FMT; ioctl. Drivers verify and, if + needed, change the requested format based on + device requirements and return the possibly modified value. Applications + can then choose to try a different format or accept the returned value and + continue. + + Formats returned by the driver during a negotiation iteration are + guaranteed to be supported by the device. In particular, drivers guarantee + that a returned format will not be further changed if passed to an + &VIDIOC-SUBDEV-S-FMT; call as-is (as long as external parameters, such as + formats on other pads or links' configuration are not changed). + + Drivers automatically propagate formats inside sub-devices. When a + try or active format is set on a pad, corresponding formats on other pads + of the same sub-device can be modified by the driver. Drivers are free to + modify formats as required by the device. However, they should comply with + the following rules when possible: + + Formats should be propagated from sink pads to source pads. + Modifying a format on a source pad should not modify the format on any + sink pad. + Sub-devices that scale frames using variable scaling factors + should reset the scale factors to default values when sink pads formats + are modified. If the 1:1 scaling ratio is supported, this means that + source pads formats should be reset to the sink pads formats. + + + + Formats are not propagated across links, as that would involve + propagating them from one sub-device file handle to another. Applications + must then take care to configure both ends of every link explicitly with + compatible formats. Identical formats on the two ends of a link are + guaranteed to be compatible. Drivers are free to accept different formats + matching device requirements as being compatible. + + + shows a sample configuration sequence for the pipeline described in + (table + columns list entity names and pad numbers). + + + Sample Pipeline Configuration + + + + + + + + + + + Sensor/0 + Frontend/0 + Frontend/1 + Scaler/0 + Scaler/1 + + + + + Initial state + 2048x1536 + - + - + - + - + + + Configure frontend input + 2048x1536 + 2048x1536 + 2046x1534 + - + - + + + Configure scaler input + 2048x1536 + 2048x1536 + 2046x1534 + 2046x1534 + 2046x1534 + + + Configure scaler output + 2048x1536 + 2048x1536 + 2046x1534 + 2046x1534 + 1280x960 + + + +
+ + + + Initial state. The sensor output is set to its native 3MP + resolution. Resolutions on the host frontend and scaler input and output + pads are undefined. + The application configures the frontend input pad resolution to + 2048x1536. The driver propagates the format to the frontend output pad. + Note that the propagated output format can be different, as in this case, + than the input format, as the hardware might need to crop pixels (for + instance when converting a Bayer filter pattern to RGB or YUV). + The application configures the scaler input pad resolution to + 2046x1534 to match the frontend output resolution. The driver propagates + the format to the scaler output pad. + The application configures the scaler output pad resolution to + 1280x960. + + + + When satisfied with the try results, applications can set the active + formats by setting the which argument to + V4L2_SUBDEV_FORMAT_TRY. Active formats are changed + exactly as try formats by drivers. To avoid modifying the hardware state + during format negotiation, applications should negotiate try formats first + and then modify the active settings using the try formats returned during + the last negotiation iteration. This guarantees that the active format + will be applied as-is by the driver without being modified. + +
+ +
+ Cropping and scaling + + Many sub-devices support cropping frames on their input or output + pads (or possible even on both). Cropping is used to select the area of + interest in an image, typically on a video sensor or video decoder. It can + also be used as part of digital zoom implementations to select the area of + the image that will be scaled up. + + Crop settings are defined by a crop rectangle and represented in a + &v4l2-rect; by the coordinates of the top left corner and the rectangle + size. Both the coordinates and sizes are expressed in pixels. + + The crop rectangle is retrieved and set using the + &VIDIOC-SUBDEV-G-CROP; and &VIDIOC-SUBDEV-S-CROP; ioctls. Like for pad + formats, drivers store try and active crop rectangles. The format + negotiation mechanism applies to crop settings as well. + + On input pads, cropping is applied relatively to the current pad + format. The pad format represents the image size as received by the + sub-device from the previous block in the pipeline, and the crop rectangle + represents the sub-image that will be transmitted further inside the + sub-device for processing. The crop rectangle be entirely containted + inside the input image size. + + Input crop rectangle are reset to their default value when the input + image format is modified. Drivers should use the input image size as the + crop rectangle default value, but hardware requirements may prevent this. + + + Cropping behaviour on output pads is not defined. + +
+
+ + &sub-subdev-formats; diff --git a/Documentation/DocBook/media/v4l/dev-teletext.xml b/Documentation/DocBook/media/v4l/dev-teletext.xml new file mode 100644 index 000000000000..414b1cfff9f4 --- /dev/null +++ b/Documentation/DocBook/media/v4l/dev-teletext.xml @@ -0,0 +1,37 @@ + Teletext Interface + + This interface was aimed at devices receiving and demodulating +Teletext data [, ], evaluating the +Teletext packages and storing formatted pages in cache memory. Such +devices are usually implemented as microcontrollers with serial +interface (I2C) and could be found on old +TV cards, dedicated Teletext decoding cards and home-brew devices +connected to the PC parallel port. + + The Teletext API was designed by Martin Buck. It was defined in +the kernel header file linux/videotext.h, the +specification is available from +ftp://ftp.gwdg.de/pub/linux/misc/videotext/. (Videotext is the name of +the German public television Teletext service.) + + Eventually the Teletext API was integrated into the V4L API +with character device file names /dev/vtx0 to +/dev/vtx31, device major number 81, minor numbers +192 to 223. + + However, teletext decoders were quickly replaced by more +generic VBI demodulators and those dedicated teletext decoders no longer exist. +For many years the vtx devices were still around, even though nobody used +them. So the decision was made to finally remove support for the Teletext API in +kernel 2.6.37. + + Modern devices all use the raw or +sliced VBI API. + + diff --git a/Documentation/DocBook/media/v4l/driver.xml b/Documentation/DocBook/media/v4l/driver.xml new file mode 100644 index 000000000000..1f7eea5c4ec3 --- /dev/null +++ b/Documentation/DocBook/media/v4l/driver.xml @@ -0,0 +1,208 @@ + V4L2 Driver Programming + + + + to do + + + diff --git a/Documentation/DocBook/media/v4l/fdl-appendix.xml b/Documentation/DocBook/media/v4l/fdl-appendix.xml new file mode 100644 index 000000000000..ae22394ba997 --- /dev/null +++ b/Documentation/DocBook/media/v4l/fdl-appendix.xml @@ -0,0 +1,671 @@ + + + + + + Version 1.1, March 2000 + + + 2000Free Software Foundation, Inc. + + + +
Free Software Foundation, Inc. 59 Temple Place, + Suite 330, Boston, MA + 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies of this + license document, but changing it is not allowed. +
+
+
+ GNU Free Documentation License + + + 0. PREAMBLE + + The purpose of this License is to make a manual, textbook, or + other written document free in the sense of + freedom: to assure everyone the effective freedom to copy and + redistribute it, with or without modifying it, either + commercially or noncommercially. Secondarily, this License + preserves for the author and publisher a way to get credit for + their work, while not being considered responsible for + modifications made by others. + + + + This License is a kind of copyleft, which means + that derivative works of the document must themselves be free in + the same sense. It complements the GNU General Public License, + which is a copyleft license designed for free software. + + + + We have designed this License in order to use it for manuals for + free software, because free software needs free documentation: a + free program should come with manuals providing the same + freedoms that the software does. But this License is not limited + to software manuals; it can be used for any textual work, + regardless of subject matter or whether it is published as a + printed book. We recommend this License principally for works + whose purpose is instruction or reference. + + + + 1. APPLICABILITY AND DEFINITIONS + + This License applies to any manual or other work that contains a + notice placed by the copyright holder saying it can be + distributed under the terms of this License. The + Document, below, refers to any such manual or + work. Any member of the public is a licensee, and is addressed + as you. + + + + A Modified Version of the Document means any work + containing the Document or a portion of it, either copied + verbatim, or with modifications and/or translated into another + language. + + + + A Secondary Section is a named appendix or a + front-matter section of the Document that deals exclusively + with the relationship of the publishers or authors of the + Document to the Document's overall subject (or to related + matters) and contains nothing that could fall directly within + that overall subject. (For example, if the Document is in part a + textbook of mathematics, a Secondary Section may not explain any + mathematics.) The relationship could be a matter of historical + connection with the subject or with related matters, or of + legal, commercial, philosophical, ethical or political position + regarding them. + + + + The Invariant Sections are certain Secondary Sections whose titles + are designated, as being those of Invariant Sections, in the + notice that says that the Document is released under this + License. + + + + The Cover Texts are certain short passages of + text that are listed, as Front-Cover Texts or Back-Cover Texts, + in the notice that says that the Document is released under this + License. + + + + A Transparent copy of the Document means a machine-readable + copy, represented in a format whose specification is available + to the general public, whose contents can be viewed and edited + directly and straightforwardly with generic text editors or (for + images composed of pixels) generic paint programs or (for + drawings) some widely available drawing editor, and that is + suitable for input to text formatters or for automatic + translation to a variety of formats suitable for input to text + formatters. A copy made in an otherwise Transparent file format + whose markup has been designed to thwart or discourage + subsequent modification by readers is not Transparent. A copy + that is not Transparent is called + Opaque. + + + + Examples of suitable formats for Transparent copies include + plain ASCII without markup, Texinfo input format, LaTeX input + format, SGML or XML using a publicly available DTD, and + standard-conforming simple HTML designed for human + modification. Opaque formats include PostScript, PDF, + proprietary formats that can be read and edited only by + proprietary word processors, SGML or XML for which the DTD + and/or processing tools are not generally available, and the + machine-generated HTML produced by some word processors for + output purposes only. + + + + The Title Page means, for a printed book, the + title page itself, plus such following pages as are needed to + hold, legibly, the material this License requires to appear in + the title page. For works in formats which do not have any title + page as such, Title Page means the text near the + most prominent appearance of the work's title, preceding the + beginning of the body of the text. + + + + + 2. VERBATIM COPYING + + You may copy and distribute the Document in any medium, either + commercially or noncommercially, provided that this License, the + copyright notices, and the license notice saying this License + applies to the Document are reproduced in all copies, and that + you add no other conditions whatsoever to those of this + License. You may not use technical measures to obstruct or + control the reading or further copying of the copies you make or + distribute. However, you may accept compensation in exchange for + copies. If you distribute a large enough number of copies you + must also follow the conditions in section 3. + + + + You may also lend copies, under the same conditions stated + above, and you may publicly display copies. + + + + + 3. COPYING IN QUANTITY + + If you publish printed copies of the Document numbering more than 100, + and the Document's license notice requires Cover Texts, you must enclose + the copies in covers that carry, clearly and legibly, all these + Cover Texts: Front-Cover Texts on the front cover, and + Back-Cover Texts on the back cover. Both covers must also + clearly and legibly identify you as the publisher of these + copies. The front cover must present the full title with all + words of the title equally prominent and visible. You may add + other material on the covers in addition. Copying with changes + limited to the covers, as long as they preserve the title of the + Document and satisfy these + conditions, can be treated as verbatim copying in other + respects. + + + + If the required texts for either cover are too voluminous to fit + legibly, you should put the first ones listed (as many as fit + reasonably) on the actual cover, and continue the rest onto + adjacent pages. + + + + If you publish or distribute Opaque copies of the Document numbering more than 100, + you must either include a machine-readable Transparent copy along with + each Opaque copy, or state in or with each Opaque copy a + publicly-accessible computer-network location containing a + complete Transparent copy of the Document, free of added + material, which the general network-using public has access to + download anonymously at no charge using public-standard network + protocols. If you use the latter option, you must take + reasonably prudent steps, when you begin distribution of Opaque + copies in quantity, to ensure that this Transparent copy will + remain thus accessible at the stated location until at least one + year after the last time you distribute an Opaque copy (directly + or through your agents or retailers) of that edition to the + public. + + + + It is requested, but not required, that you contact the authors + of the Document well before + redistributing any large number of copies, to give them a chance + to provide you with an updated version of the Document. + + + + + 4. MODIFICATIONS + + You may copy and distribute a Modified Version of the Document under the conditions of + sections 2 and 3 above, provided that you release + the Modified Version under precisely this License, with the + Modified Version filling the role of the Document, thus + licensing distribution and modification of the Modified Version + to whoever possesses a copy of it. In addition, you must do + these things in the Modified Version: + + + + + + A + + Use in the Title + Page (and on the covers, if any) a title distinct + from that of the Document, and from those of + previous versions (which should, if there were any, be + listed in the History section of the Document). You may + use the same title as a previous version if the original + publisher of that version gives permission. + + + + + + + B + + List on the Title + Page, as authors, one or more persons or entities + responsible for authorship of the modifications in the + Modified Version, + together with at least five of the principal authors of + the Document (all of + its principal authors, if it has less than five). + + + + + + + C + + State on the Title + Page the name of the publisher of the Modified Version, as the + publisher. + + + + + + + D + + Preserve all the copyright notices of the Document. + + + + + + + E + + Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices. + + + + + + + F + + Include, immediately after the copyright notices, a + license notice giving the public permission to use the + Modified Version under + the terms of this License, in the form shown in the + Addendum below. + + + + + + + G + + Preserve in that license notice the full lists of Invariant Sections and + required Cover + Texts given in the Document's license notice. + + + + + + + H + + Include an unaltered copy of this License. + + + + + + + I + + Preserve the section entitled History, and + its title, and add to it an item stating at least the + title, year, new authors, and publisher of the Modified Version as given on + the Title Page. If + there is no section entitled History in the + Document, create one + stating the title, year, authors, and publisher of the + Document as given on its Title Page, then add an item + describing the Modified Version as stated in the previous + sentence. + + + + + + + J + + Preserve the network location, if any, given in the Document for public access + to a Transparent + copy of the Document, and likewise the network locations + given in the Document for previous versions it was based + on. These may be placed in the History + section. You may omit a network location for a work that + was published at least four years before the Document + itself, or if the original publisher of the version it + refers to gives permission. + + + + + + + K + + In any section entitled Acknowledgements or + Dedications, preserve the section's title, + and preserve in the section all the substance and tone of + each of the contributor acknowledgements and/or + dedications given therein. + + + + + + + L + + Preserve all the Invariant + Sections of the Document, unaltered in their + text and in their titles. Section numbers or the + equivalent are not considered part of the section titles. + + + + + + + M + + Delete any section entitled + Endorsements. Such a section may not be + included in the Modified + Version. + + + + + + + N + + Do not retitle any existing section as + Endorsements or to conflict in title with + any Invariant + Section. + + + + + + + If the Modified Version + includes new front-matter sections or appendices that qualify as + Secondary Sections and + contain no material copied from the Document, you may at your + option designate some or all of these sections as invariant. To + do this, add their titles to the list of Invariant Sections in the + Modified Version's license notice. These titles must be + distinct from any other section titles. + + + + You may add a section entitled Endorsements, + provided it contains nothing but endorsements of your Modified Version by various + parties--for example, statements of peer review or that the text + has been approved by an organization as the authoritative + definition of a standard. + + + + You may add a passage of up to five words as a Front-Cover Text, and a passage + of up to 25 words as a Back-Cover Text, to the end of + the list of Cover Texts + in the Modified Version. + Only one passage of Front-Cover Text and one of Back-Cover Text + may be added by (or through arrangements made by) any one + entity. If the Document + already includes a cover text for the same cover, previously + added by you or by arrangement made by the same entity you are + acting on behalf of, you may not add another; but you may + replace the old one, on explicit permission from the previous + publisher that added the old one. + + + + The author(s) and publisher(s) of the Document do not by this License + give permission to use their names for publicity for or to + assert or imply endorsement of any Modified Version . + + + + + 5. COMBINING DOCUMENTS + + You may combine the Document + with other documents released under this License, under the + terms defined in section 4 + above for modified versions, provided that you include in the + combination all of the Invariant + Sections of all of the original documents, unmodified, + and list them all as Invariant Sections of your combined work in + its license notice. + + + + The combined work need only contain one copy of this License, + and multiple identical Invariant + Sections may be replaced with a single copy. If there are + multiple Invariant Sections with the same name but different + contents, make the title of each such section unique by adding + at the end of it, in parentheses, the name of the original + author or publisher of that section if known, or else a unique + number. Make the same adjustment to the section titles in the + list of Invariant Sections in the license notice of the combined + work. + + + + In the combination, you must combine any sections entitled + History in the various original documents, + forming one section entitled History; likewise + combine any sections entitled Acknowledgements, + and any sections entitled Dedications. You must + delete all sections entitled Endorsements. + + + + + 6. COLLECTIONS OF DOCUMENTS + + You may make a collection consisting of the Document and other documents + released under this License, and replace the individual copies + of this License in the various documents with a single copy that + is included in the collection, provided that you follow the + rules of this License for verbatim copying of each of the + documents in all other respects. + + + + You may extract a single document from such a collection, and + dispbibute it individually under this License, provided you + insert a copy of this License into the extracted document, and + follow this License in all other respects regarding verbatim + copying of that document. + + + + + 7. AGGREGATION WITH INDEPENDENT WORKS + + A compilation of the Document or its derivatives with + other separate and independent documents or works, in or on a + volume of a storage or distribution medium, does not as a whole + count as a Modified Version + of the Document, provided no compilation copyright is claimed + for the compilation. Such a compilation is called an + aggregate, and this License does not apply to the + other self-contained works thus compiled with the Document , on + account of their being thus compiled, if they are not themselves + derivative works of the Document. If the Cover Text requirement of section 3 is applicable to these + copies of the Document, then if the Document is less than one + quarter of the entire aggregate, the Document's Cover Texts may + be placed on covers that surround only the Document within the + aggregate. Otherwise they must appear on covers around the whole + aggregate. + + + + + 8. TRANSLATION + + Translation is considered a kind of modification, so you may + distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with + translations requires special permission from their copyright + holders, but you may include translations of some or all + Invariant Sections in addition to the original versions of these + Invariant Sections. You may include a translation of this + License provided that you also include the original English + version of this License. In case of a disagreement between the + translation and the original English version of this License, + the original English version will prevail. + + + + + 9. TERMINATION + + You may not copy, modify, sublicense, or distribute the Document except as expressly + provided for under this License. Any other attempt to copy, + modify, sublicense or distribute the Document is void, and will + automatically terminate your rights under this License. However, + parties who have received copies, or rights, from you under this + License will not have their licenses terminated so long as such + parties remain in full compliance. + + + + + 10. FUTURE REVISIONS OF THIS LICENSE + + The Free Software + Foundation may publish new, revised versions of the GNU + Free Documentation License from time to time. Such new versions + will be similar in spirit to the present version, but may differ + in detail to address new problems or concerns. See http://www.gnu.org/copyleft/. + + + + Each version of the License is given a distinguishing version + number. If the Document + specifies that a particular numbered version of this License + or any later version applies to it, you have the + option of following the terms and conditions either of that + specified version or of any later version that has been + published (not as a draft) by the Free Software Foundation. If + the Document does not specify a version number of this License, + you may choose any version ever published (not as a draft) by + the Free Software Foundation. + + + + + Addendum + + To use this License in a document you have written, include a copy of + the License in the document and put the following copyright and + license notices just after the title page: + + +
+ + Copyright © YEAR YOUR NAME. + + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation + License, Version 1.1 or any later version published by the + Free Software Foundation; with the Invariant Sections being LIST + THEIR TITLES, with the Front-Cover Texts being LIST, + and with the Back-Cover + Texts being LIST. A copy of the license is included in + the section entitled GNU Free Documentation + License. + +
+ + + If you have no Invariant + Sections, write with no Invariant Sections + instead of saying which ones are invariant. If you have no + Front-Cover Texts, write + no Front-Cover Texts instead of + Front-Cover Texts being LIST; likewise for Back-Cover Texts. + + + + If your document contains nontrivial examples of program code, + we recommend releasing these examples in parallel under your + choice of free software license, such as the GNU General Public + License, to permit their use in free software. + +
+
+ + + + + + diff --git a/Documentation/DocBook/media/v4l/fieldseq_bt.gif b/Documentation/DocBook/media/v4l/fieldseq_bt.gif new file mode 100644 index 000000000000..60e8569a76c9 Binary files /dev/null and b/Documentation/DocBook/media/v4l/fieldseq_bt.gif differ diff --git a/Documentation/DocBook/media/v4l/fieldseq_bt.pdf b/Documentation/DocBook/media/v4l/fieldseq_bt.pdf new file mode 100644 index 000000000000..26598b23f80d Binary files /dev/null and b/Documentation/DocBook/media/v4l/fieldseq_bt.pdf differ diff --git a/Documentation/DocBook/media/v4l/fieldseq_tb.gif b/Documentation/DocBook/media/v4l/fieldseq_tb.gif new file mode 100644 index 000000000000..718492f1cfc7 Binary files /dev/null and b/Documentation/DocBook/media/v4l/fieldseq_tb.gif differ diff --git a/Documentation/DocBook/media/v4l/fieldseq_tb.pdf b/Documentation/DocBook/media/v4l/fieldseq_tb.pdf new file mode 100644 index 000000000000..4965b22ddb3a Binary files /dev/null and b/Documentation/DocBook/media/v4l/fieldseq_tb.pdf differ diff --git a/Documentation/DocBook/media/v4l/func-close.xml b/Documentation/DocBook/media/v4l/func-close.xml new file mode 100644 index 000000000000..dfb41cbbbec3 --- /dev/null +++ b/Documentation/DocBook/media/v4l/func-close.xml @@ -0,0 +1,70 @@ + + + V4L2 close() + &manvol; + + + + v4l2-close + Close a V4L2 device + + + + + #include <unistd.h> + + int close + int fd + + + + + + Arguments + + + + fd + + &fd; + + + + + + + Description + + Closes the device. Any I/O in progress is terminated and +resources associated with the file descriptor are freed. However data +format parameters, current input or output, control values or other +properties remain unchanged. + + + + Return Value + + The function returns 0 on +success, -1 on failure and the +errno is set appropriately. Possible error +codes: + + + + EBADF + + fd is not a valid open file +descriptor. + + + + + + + diff --git a/Documentation/DocBook/media/v4l/func-ioctl.xml b/Documentation/DocBook/media/v4l/func-ioctl.xml new file mode 100644 index 000000000000..b60fd37a6295 --- /dev/null +++ b/Documentation/DocBook/media/v4l/func-ioctl.xml @@ -0,0 +1,145 @@ + + + V4L2 ioctl() + &manvol; + + + + v4l2-ioctl + Program a V4L2 device + + + + + #include <sys/ioctl.h> + + int ioctl + int fd + int request + void *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + V4L2 ioctl request code as defined in the videodev2.h header file, for example +VIDIOC_QUERYCAP. + + + + argp + + Pointer to a function parameter, usually a structure. + + + + + + + Description + + The ioctl() function is used to program +V4L2 devices. The argument fd must be an open +file descriptor. An ioctl request has encoded +in it whether the argument is an input, output or read/write +parameter, and the size of the argument argp in +bytes. Macros and defines specifying V4L2 ioctl requests are located +in the videodev2.h header file. +Applications should use their own copy, not include the version in the +kernel sources on the system they compile on. All V4L2 ioctl requests, +their respective function and parameters are specified in . + + + + Return Value + + On success the ioctl() function returns +0 and does not reset the +errno variable. On failure +-1 is returned, when the ioctl takes an +output or read/write parameter it remains unmodified, and the +errno variable is set appropriately. See below for +possible error codes. Generic errors like EBADF +or EFAULT are not listed in the sections +discussing individual ioctl requests. + Note ioctls may return undefined error codes. Since errors +may have side effects such as a driver reset applications should +abort on unexpected errors. + + + + EBADF + + fd is not a valid open file +descriptor. + + + + EBUSY + + The property cannot be changed right now. Typically +this error code is returned when I/O is in progress or the driver +supports multiple opens and another process locked the property. + + + + EFAULT + + argp references an inaccessible +memory area. + + + + ENOTTY + + fd is not associated with a +character special device. + + + + EINVAL + + The request or the data pointed +to by argp is not valid. This is a very common +error code, see the individual ioctl requests listed in for actual causes. + + + + ENOMEM + + Not enough physical or virtual memory was available to +complete the request. + + + + ERANGE + + The application attempted to set a control with the +&VIDIOC-S-CTRL; ioctl to a value which is out of bounds. + + + + + + + diff --git a/Documentation/DocBook/media/v4l/func-mmap.xml b/Documentation/DocBook/media/v4l/func-mmap.xml new file mode 100644 index 000000000000..786732b64bbd --- /dev/null +++ b/Documentation/DocBook/media/v4l/func-mmap.xml @@ -0,0 +1,191 @@ + + + V4L2 mmap() + &manvol; + + + + v4l2-mmap + Map device memory into application address space + + + + + +#include <unistd.h> +#include <sys/mman.h> + + void *mmap + void *start + size_t length + int prot + int flags + int fd + off_t offset + + + + + + Arguments + + + start + + Map the buffer to this address in the +application's address space. When the MAP_FIXED +flag is specified, start must be a multiple of the +pagesize and mmap will fail when the specified address +cannot be used. Use of this option is discouraged; applications should +just specify a NULL pointer here. + + + + length + + Length of the memory area to map. This must be the +same value as returned by the driver in the &v4l2-buffer; +length field for the +single-planar API, and the same value as returned by the driver +in the &v4l2-plane; length field for the +multi-planar API. + + + + prot + + The prot argument describes the +desired memory protection. Regardless of the device type and the +direction of data exchange it should be set to +PROT_READ | PROT_WRITE, +permitting read and write access to image buffers. Drivers should +support at least this combination of flags. Note the Linux +video-buf kernel module, which is used by the +bttv, saa7134, saa7146, cx88 and vivi driver supports only +PROT_READ | PROT_WRITE. When +the driver does not support the desired protection the +mmap() function fails. + Note device memory accesses (⪚ the memory on a +graphics card with video capturing hardware) may incur a performance +penalty compared to main memory accesses, or reads may be +significantly slower than writes or vice versa. Other I/O methods may +be more efficient in this case. + + + + flags + + The flags parameter +specifies the type of the mapped object, mapping options and whether +modifications made to the mapped copy of the page are private to the +process or are to be shared with other references. + MAP_FIXED requests that the +driver selects no other address than the one specified. If the +specified address cannot be used, mmap() will fail. If +MAP_FIXED is specified, +start must be a multiple of the pagesize. Use +of this option is discouraged. + One of the MAP_SHARED or +MAP_PRIVATE flags must be set. +MAP_SHARED allows applications to share the +mapped memory with other (⪚ child-) processes. Note the Linux +video-buf module which is used by the bttv, +saa7134, saa7146, cx88 and vivi driver supports only +MAP_SHARED. MAP_PRIVATE +requests copy-on-write semantics. V4L2 applications should not set the +MAP_PRIVATE, MAP_DENYWRITE, +MAP_EXECUTABLE or MAP_ANON +flag. + + + + fd + + &fd; + + + + offset + + Offset of the buffer in device memory. This must be the +same value as returned by the driver in the &v4l2-buffer; +m union offset field for +the single-planar API, and the same value as returned by the driver +in the &v4l2-plane; m union +mem_offset field for the multi-planar API. + + + + + + + Description + + The mmap() function asks to map +length bytes starting at +offset in the memory of the device specified by +fd into the application address space, +preferably at address start. This latter +address is a hint only, and is usually specified as 0. + + Suitable length and offset parameters are queried with the +&VIDIOC-QUERYBUF; ioctl. Buffers must be allocated with the +&VIDIOC-REQBUFS; ioctl before they can be queried. + + To unmap buffers the &func-munmap; function is used. + + + + Return Value + + On success mmap() returns a pointer to +the mapped buffer. On error MAP_FAILED (-1) is +returned, and the errno variable is set +appropriately. Possible error codes are: + + + + EBADF + + fd is not a valid file +descriptor. + + + + EACCES + + fd is +not open for reading and writing. + + + + EINVAL + + The start or +length or offset are not +suitable. (E. g. they are too large, or not aligned on a +PAGESIZE boundary.) + The flags or +prot value is not supported. + No buffers have been allocated with the +&VIDIOC-REQBUFS; ioctl. + + + + ENOMEM + + Not enough physical or virtual memory was available to +complete the request. + + + + + + + diff --git a/Documentation/DocBook/media/v4l/func-munmap.xml b/Documentation/DocBook/media/v4l/func-munmap.xml new file mode 100644 index 000000000000..e2c4190f9bb6 --- /dev/null +++ b/Documentation/DocBook/media/v4l/func-munmap.xml @@ -0,0 +1,84 @@ + + + V4L2 munmap() + &manvol; + + + + v4l2-munmap + Unmap device memory + + + + + +#include <unistd.h> +#include <sys/mman.h> + + int munmap + void *start + size_t length + + + + + Arguments + + + start + + Address of the mapped buffer as returned by the +&func-mmap; function. + + + + length + + Length of the mapped buffer. This must be the same +value as given to mmap() and returned by the +driver in the &v4l2-buffer; length +field for the single-planar API and in the &v4l2-plane; +length field for the multi-planar API. + + + + + + + Description + + Unmaps a previously with the &func-mmap; function mapped +buffer and frees it, if possible. + + + + Return Value + + On success munmap() returns 0, on +failure -1 and the errno variable is set +appropriately: + + + + EINVAL + + The start or +length is incorrect, or no buffers have been +mapped yet. + + + + + + + diff --git a/Documentation/DocBook/media/v4l/func-open.xml b/Documentation/DocBook/media/v4l/func-open.xml new file mode 100644 index 000000000000..7595d07a8c72 --- /dev/null +++ b/Documentation/DocBook/media/v4l/func-open.xml @@ -0,0 +1,121 @@ + + + V4L2 open() + &manvol; + + + + v4l2-open + Open a V4L2 device + + + + + #include <fcntl.h> + + int open + const char *device_name + int flags + + + + + + Arguments + + + + device_name + + Device to be opened. + + + + flags + + Open flags. Access mode must be +O_RDWR. This is just a technicality, input devices +still support only reading and output devices only writing. + When the O_NONBLOCK flag is +given, the read() function and the &VIDIOC-DQBUF; ioctl will return +the &EAGAIN; when no data is available or no buffer is in the driver +outgoing queue, otherwise these functions block until data becomes +available. All V4L2 drivers exchanging data with applications must +support the O_NONBLOCK flag. + Other flags have no effect. + + + + + + Description + + To open a V4L2 device applications call +open() with the desired device name. This +function has no side effects; all data format parameters, current +input or output, control values or other properties remain unchanged. +At the first open() call after loading the driver +they will be reset to default values, drivers are never in an +undefined state. + + + Return Value + + On success open returns the new file +descriptor. On error -1 is returned, and the errno +variable is set appropriately. Possible error codes are: + + + + EACCES + + The caller has no permission to access the +device. + + + + EBUSY + + The driver does not support multiple opens and the +device is already in use. + + + + ENXIO + + No device corresponding to this device special file +exists. + + + + ENOMEM + + Not enough kernel memory was available to complete the +request. + + + + EMFILE + + The process already has the maximum number of +files open. + + + + ENFILE + + The limit on the total number of files open on the +system has been reached. + + + + + + + diff --git a/Documentation/DocBook/media/v4l/func-poll.xml b/Documentation/DocBook/media/v4l/func-poll.xml new file mode 100644 index 000000000000..ec3c718f5963 --- /dev/null +++ b/Documentation/DocBook/media/v4l/func-poll.xml @@ -0,0 +1,127 @@ + + + V4L2 poll() + &manvol; + + + + v4l2-poll + Wait for some event on a file descriptor + + + + + #include <sys/poll.h> + + int poll + struct pollfd *ufds + unsigned int nfds + int timeout + + + + + + Description + + With the poll() function applications +can suspend execution until the driver has captured data or is ready +to accept data for output. + + When streaming I/O has been negotiated this function waits +until a buffer has been filled or displayed and can be dequeued with +the &VIDIOC-DQBUF; ioctl. When buffers are already in the outgoing +queue of the driver the function returns immediately. + + On success poll() returns the number of +file descriptors that have been selected (that is, file descriptors +for which the revents field of the +respective pollfd structure is non-zero). +Capture devices set the POLLIN and +POLLRDNORM flags in the +revents field, output devices the +POLLOUT and POLLWRNORM +flags. When the function timed out it returns a value of zero, on +failure it returns -1 and the +errno variable is set appropriately. When the +application did not call &VIDIOC-QBUF; or &VIDIOC-STREAMON; yet the +poll() function succeeds, but sets the +POLLERR flag in the +revents field. + + When use of the read() function has +been negotiated and the driver does not capture yet, the +poll function starts capturing. When that fails +it returns a POLLERR as above. Otherwise it waits +until data has been captured and can be read. When the driver captures +continuously (as opposed to, for example, still images) the function +may return immediately. + + When use of the write() function has +been negotiated the poll function just waits +until the driver is ready for a non-blocking +write() call. + + All drivers implementing the read() or +write() function or streaming I/O must also +support the poll() function. + + For more details see the +poll() manual page. + + + + Return Value + + On success, poll() returns the number +structures which have non-zero revents +fields, or zero if the call timed out. On error +-1 is returned, and the +errno variable is set appropriately: + + + + EBADF + + One or more of the ufds members +specify an invalid file descriptor. + + + + EBUSY + + The driver does not support multiple read or write +streams and the device is already in use. + + + + EFAULT + + ufds references an inaccessible +memory area. + + + + EINTR + + The call was interrupted by a signal. + + + + EINVAL + + The nfds argument is greater +than OPEN_MAX. + + + + + + + diff --git a/Documentation/DocBook/media/v4l/func-read.xml b/Documentation/DocBook/media/v4l/func-read.xml new file mode 100644 index 000000000000..a5089bf8873d --- /dev/null +++ b/Documentation/DocBook/media/v4l/func-read.xml @@ -0,0 +1,189 @@ + + + V4L2 read() + &manvol; + + + + v4l2-read + Read from a V4L2 device + + + + + #include <unistd.h> + + ssize_t read + int fd + void *buf + size_t count + + + + + + Arguments + + + + fd + + &fd; + + + + buf + + + + + + count + + + + + + + + + Description + + read() attempts to read up to +count bytes from file descriptor +fd into the buffer starting at +buf. The layout of the data in the buffer is +discussed in the respective device interface section, see ##. If count is zero, +read() returns zero and has no other results. If +count is greater than +SSIZE_MAX, the result is unspecified. Regardless +of the count value each +read() call will provide at most one frame (two +fields) worth of data. + + By default read() blocks until data +becomes available. When the O_NONBLOCK flag was +given to the &func-open; function it +returns immediately with an &EAGAIN; when no data is available. The +&func-select; or &func-poll; functions +can always be used to suspend execution until data becomes available. All +drivers supporting the read() function must also +support select() and +poll(). + + Drivers can implement read functionality in different +ways, using a single or multiple buffers and discarding the oldest or +newest frames once the internal buffers are filled. + + read() never returns a "snapshot" of a +buffer being filled. Using a single buffer the driver will stop +capturing when the application starts reading the buffer until the +read is finished. Thus only the period of the vertical blanking +interval is available for reading, or the capture rate must fall below +the nominal frame rate of the video standard. + +The behavior of +read() when called during the active picture +period or the vertical blanking separating the top and bottom field +depends on the discarding policy. A driver discarding the oldest +frames keeps capturing into an internal buffer, continuously +overwriting the previously, not read frame, and returns the frame +being received at the time of the read() call as +soon as it is complete. + + A driver discarding the newest frames stops capturing until +the next read() call. The frame being received at +read() time is discarded, returning the following +frame instead. Again this implies a reduction of the capture rate to +one half or less of the nominal frame rate. An example of this model +is the video read mode of the bttv driver, initiating a DMA to user +memory when read() is called and returning when +the DMA finished. + + In the multiple buffer model drivers maintain a ring of +internal buffers, automatically advancing to the next free buffer. +This allows continuous capturing when the application can empty the +buffers fast enough. Again, the behavior when the driver runs out of +free buffers depends on the discarding policy. + + Applications can get and set the number of buffers used +internally by the driver with the &VIDIOC-G-PARM; and &VIDIOC-S-PARM; +ioctls. They are optional, however. The discarding policy is not +reported and cannot be changed. For minimum requirements see . + + + + Return Value + + On success, the number of bytes read is returned. It is not +an error if this number is smaller than the number of bytes requested, +or the amount of data required for one frame. This may happen for +example because read() was interrupted by a +signal. On error, -1 is returned, and the errno +variable is set appropriately. In this case the next read will start +at the beginning of a new frame. Possible error codes are: + + + + EAGAIN + + Non-blocking I/O has been selected using +O_NONBLOCK and no data was immediately available for reading. + + + + EBADF + + fd is not a valid file +descriptor or is not open for reading, or the process already has the +maximum number of files open. + + + + EBUSY + + The driver does not support multiple read streams and the +device is already in use. + + + + EFAULT + + buf references an inaccessible +memory area. + + + + EINTR + + The call was interrupted by a signal before any +data was read. + + + + EIO + + I/O error. This indicates some hardware problem or a +failure to communicate with a remote device (USB camera etc.). + + + + EINVAL + + The read() function is not +supported by this driver, not on this device, or generally not on this +type of device. + + + + + + + diff --git a/Documentation/DocBook/media/v4l/func-select.xml b/Documentation/DocBook/media/v4l/func-select.xml new file mode 100644 index 000000000000..b6713623181f --- /dev/null +++ b/Documentation/DocBook/media/v4l/func-select.xml @@ -0,0 +1,138 @@ + + + V4L2 select() + &manvol; + + + + v4l2-select + Synchronous I/O multiplexing + + + + + +#include <sys/time.h> +#include <sys/types.h> +#include <unistd.h> + + int select + int nfds + fd_set *readfds + fd_set *writefds + fd_set *exceptfds + struct timeval *timeout + + + + + + Description + + With the select() function applications +can suspend execution until the driver has captured data or is ready +to accept data for output. + + When streaming I/O has been negotiated this function waits +until a buffer has been filled or displayed and can be dequeued with +the &VIDIOC-DQBUF; ioctl. When buffers are already in the outgoing +queue of the driver the function returns immediately. + + On success select() returns the total +number of bits set in the fd_sets. When the +function timed out it returns a value of zero. On failure it returns +-1 and the errno +variable is set appropriately. When the application did not call +&VIDIOC-QBUF; or &VIDIOC-STREAMON; yet the +select() function succeeds, setting the bit of +the file descriptor in readfds or +writefds, but subsequent &VIDIOC-DQBUF; calls +will fail.The Linux kernel implements +select() like the &func-poll; function, but +select() cannot return a +POLLERR. + + + When use of the read() function has +been negotiated and the driver does not capture yet, the +select() function starts capturing. When that +fails, select() returns successful and a +subsequent read() call, which also attempts to +start capturing, will return an appropriate error code. When the +driver captures continuously (as opposed to, for example, still +images) and data is already available the +select() function returns immediately. + + When use of the write() function has +been negotiated the select() function just waits +until the driver is ready for a non-blocking +write() call. + + All drivers implementing the read() or +write() function or streaming I/O must also +support the select() function. + + For more details see the select() +manual page. + + + + + Return Value + + On success, select() returns the number +of descriptors contained in the three returned descriptor sets, which +will be zero if the timeout expired. On error +-1 is returned, and the +errno variable is set appropriately; the sets and +timeout are undefined. Possible error codes +are: + + + + EBADF + + One or more of the file descriptor sets specified a +file descriptor that is not open. + + + + EBUSY + + The driver does not support multiple read or write +streams and the device is already in use. + + + + EFAULT + + The readfds, +writefds, exceptfds or +timeout pointer references an inaccessible memory +area. + + + + EINTR + + The call was interrupted by a signal. + + + + EINVAL + + The nfds argument is less than +zero or greater than FD_SETSIZE. + + + + + + + diff --git a/Documentation/DocBook/media/v4l/func-write.xml b/Documentation/DocBook/media/v4l/func-write.xml new file mode 100644 index 000000000000..2c09c09371c3 --- /dev/null +++ b/Documentation/DocBook/media/v4l/func-write.xml @@ -0,0 +1,136 @@ + + + V4L2 write() + &manvol; + + + + v4l2-write + Write to a V4L2 device + + + + + #include <unistd.h> + + ssize_t write + int fd + void *buf + size_t count + + + + + + Arguments + + + + fd + + &fd; + + + + buf + + + + + + count + + + + + + + + + Description + + write() writes up to +count bytes to the device referenced by the +file descriptor fd from the buffer starting at +buf. When the hardware outputs are not active +yet, this function enables them. When count is +zero, write() returns +0 without any other effect. + + When the application does not provide more data in time, the +previous video frame, raw VBI image, sliced VPS or WSS data is +displayed again. Sliced Teletext or Closed Caption data is not +repeated, the driver inserts a blank line instead. + + + + Return Value + + On success, the number of bytes written are returned. Zero +indicates nothing was written. On error, -1 +is returned, and the errno variable is set +appropriately. In this case the next write will start at the beginning +of a new frame. Possible error codes are: + + + + EAGAIN + + Non-blocking I/O has been selected using the O_NONBLOCK flag and no +buffer space was available to write the data immediately. + + + + EBADF + + fd is not a valid file +descriptor or is not open for writing. + + + + EBUSY + + The driver does not support multiple write streams and the +device is already in use. + + + + EFAULT + + buf references an inaccessible +memory area. + + + + EINTR + + The call was interrupted by a signal before any +data was written. + + + + EIO + + I/O error. This indicates some hardware problem. + + + + EINVAL + + The write() function is not +supported by this driver, not on this device, or generally not on this +type of device. + + + + + + + diff --git a/Documentation/DocBook/media/v4l/io.xml b/Documentation/DocBook/media/v4l/io.xml new file mode 100644 index 000000000000..227e7ac45a06 --- /dev/null +++ b/Documentation/DocBook/media/v4l/io.xml @@ -0,0 +1,1265 @@ + Input/Output + + The V4L2 API defines several different methods to read from or +write to a device. All drivers exchanging data with applications must +support at least one of them. + + The classic I/O method using the read() +and write() function is automatically selected +after opening a V4L2 device. When the driver does not support this +method attempts to read or write will fail at any time. + + Other methods must be negotiated. To select the streaming I/O +method with memory mapped or user buffers applications call the +&VIDIOC-REQBUFS; ioctl. The asynchronous I/O method is not defined +yet. + + Video overlay can be considered another I/O method, although +the application does not directly receive the image data. It is +selected by initiating video overlay with the &VIDIOC-S-FMT; ioctl. +For more information see . + + Generally exactly one I/O method, including overlay, is +associated with each file descriptor. The only exceptions are +applications not exchanging data with a driver ("panel applications", +see ) and drivers permitting simultaneous video capturing +and overlay using the same file descriptor, for compatibility with V4L +and earlier versions of V4L2. + + VIDIOC_S_FMT and +VIDIOC_REQBUFS would permit this to some degree, +but for simplicity drivers need not support switching the I/O method +(after first switching away from read/write) other than by closing +and reopening the device. + + The following sections describe the various I/O methods in +more detail. + +
+ Read/Write + + Input and output devices support the +read() and write() function, +respectively, when the V4L2_CAP_READWRITE flag in +the capabilities field of &v4l2-capability; +returned by the &VIDIOC-QUERYCAP; ioctl is set. + + Drivers may need the CPU to copy the data, but they may also +support DMA to or from user memory, so this I/O method is not +necessarily less efficient than other methods merely exchanging buffer +pointers. It is considered inferior though because no meta-information +like frame counters or timestamps are passed. This information is +necessary to recognize frame dropping and to synchronize with other +data streams. However this is also the simplest I/O method, requiring +little or no setup to exchange data. It permits command line stunts +like this (the vidctrl tool is +fictitious): + + + +> vidctrl /dev/video --input=0 --format=YUYV --size=352x288 +> dd if=/dev/video of=myimage.422 bs=202752 count=1 + + + + To read from the device applications use the +&func-read; function, to write the &func-write; function. +Drivers must implement one I/O method if they +exchange data with applications, but it need not be this. + It would be desirable if applications could depend on +drivers supporting all I/O interfaces, but as much as the complex +memory mapping I/O can be inadequate for some devices we have no +reason to require this interface, which is most useful for simple +applications capturing still images. + When reading or writing is supported, the driver +must also support the &func-select; and &func-poll; +function. + At the driver level select() and +poll() are the same, and +select() is too important to be optional. + +
+ +
+ Streaming I/O (Memory Mapping) + + Input and output devices support this I/O method when the +V4L2_CAP_STREAMING flag in the +capabilities field of &v4l2-capability; +returned by the &VIDIOC-QUERYCAP; ioctl is set. There are two +streaming methods, to determine if the memory mapping flavor is +supported applications must call the &VIDIOC-REQBUFS; ioctl. + + Streaming is an I/O method where only pointers to buffers +are exchanged between application and driver, the data itself is not +copied. Memory mapping is primarily intended to map buffers in device +memory into the application's address space. Device memory can be for +example the video memory on a graphics card with a video capture +add-on. However, being the most efficient I/O method available for a +long time, many other drivers support streaming as well, allocating +buffers in DMA-able main memory. + + A driver can support many sets of buffers. Each set is +identified by a unique buffer type value. The sets are independent and +each set can hold a different type of data. To access different sets +at the same time different file descriptors must be used. + One could use one file descriptor and set the buffer +type field accordingly when calling &VIDIOC-QBUF; etc., but it makes +the select() function ambiguous. We also like the +clean approach of one file descriptor per logical stream. Video +overlay for example is also a logical stream, although the CPU is not +needed for continuous operation. + + + To allocate device buffers applications call the +&VIDIOC-REQBUFS; ioctl with the desired number of buffers and buffer +type, for example V4L2_BUF_TYPE_VIDEO_CAPTURE. +This ioctl can also be used to change the number of buffers or to free +the allocated memory, provided none of the buffers are still +mapped. + + Before applications can access the buffers they must map +them into their address space with the &func-mmap; function. The +location of the buffers in device memory can be determined with the +&VIDIOC-QUERYBUF; ioctl. In the single-planar API case, the +m.offset and length +returned in a &v4l2-buffer; are passed as sixth and second parameter to the +mmap() function. When using the multi-planar API, +struct &v4l2-buffer; contains an array of &v4l2-plane; structures, each +containing its own m.offset and +length. When using the multi-planar API, every +plane of every buffer has to be mapped separately, so the number of +calls to &func-mmap; should be equal to number of buffers times number of +planes in each buffer. The offset and length values must not be modified. +Remember, the buffers are allocated in physical memory, as opposed to virtual +memory, which can be swapped out to disk. Applications should free the buffers +as soon as possible with the &func-munmap; function. + + + Mapping buffers in the single-planar API + +&v4l2-requestbuffers; reqbuf; +struct { + void *start; + size_t length; +} *buffers; +unsigned int i; + +memset(&reqbuf, 0, sizeof(reqbuf)); +reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; +reqbuf.memory = V4L2_MEMORY_MMAP; +reqbuf.count = 20; + +if (-1 == ioctl (fd, &VIDIOC-REQBUFS;, &reqbuf)) { + if (errno == EINVAL) + printf("Video capturing or mmap-streaming is not supported\n"); + else + perror("VIDIOC_REQBUFS"); + + exit(EXIT_FAILURE); +} + +/* We want at least five buffers. */ + +if (reqbuf.count < 5) { + /* You may need to free the buffers here. */ + printf("Not enough buffer memory\n"); + exit(EXIT_FAILURE); +} + +buffers = calloc(reqbuf.count, sizeof(*buffers)); +assert(buffers != NULL); + +for (i = 0; i < reqbuf.count; i++) { + &v4l2-buffer; buffer; + + memset(&buffer, 0, sizeof(buffer)); + buffer.type = reqbuf.type; + buffer.memory = V4L2_MEMORY_MMAP; + buffer.index = i; + + if (-1 == ioctl (fd, &VIDIOC-QUERYBUF;, &buffer)) { + perror("VIDIOC_QUERYBUF"); + exit(EXIT_FAILURE); + } + + buffers[i].length = buffer.length; /* remember for munmap() */ + + buffers[i].start = mmap(NULL, buffer.length, + PROT_READ | PROT_WRITE, /* recommended */ + MAP_SHARED, /* recommended */ + fd, buffer.m.offset); + + if (MAP_FAILED == buffers[i].start) { + /* If you do not exit here you should unmap() and free() + the buffers mapped so far. */ + perror("mmap"); + exit(EXIT_FAILURE); + } +} + +/* Cleanup. */ + +for (i = 0; i < reqbuf.count; i++) + munmap(buffers[i].start, buffers[i].length); + + + + + Mapping buffers in the multi-planar API + +&v4l2-requestbuffers; reqbuf; +/* Our current format uses 3 planes per buffer */ +#define FMT_NUM_PLANES = 3; + +struct { + void *start[FMT_NUM_PLANES]; + size_t length[FMT_NUM_PLANES]; +} *buffers; +unsigned int i, j; + +memset(&reqbuf, 0, sizeof(reqbuf)); +reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; +reqbuf.memory = V4L2_MEMORY_MMAP; +reqbuf.count = 20; + +if (ioctl(fd, &VIDIOC-REQBUFS;, &reqbuf) < 0) { + if (errno == EINVAL) + printf("Video capturing or mmap-streaming is not supported\n"); + else + perror("VIDIOC_REQBUFS"); + + exit(EXIT_FAILURE); +} + +/* We want at least five buffers. */ + +if (reqbuf.count < 5) { + /* You may need to free the buffers here. */ + printf("Not enough buffer memory\n"); + exit(EXIT_FAILURE); +} + +buffers = calloc(reqbuf.count, sizeof(*buffers)); +assert(buffers != NULL); + +for (i = 0; i < reqbuf.count; i++) { + &v4l2-buffer; buffer; + &v4l2-plane; planes[FMT_NUM_PLANES]; + + memset(&buffer, 0, sizeof(buffer)); + buffer.type = reqbuf.type; + buffer.memory = V4L2_MEMORY_MMAP; + buffer.index = i; + /* length in struct v4l2_buffer in multi-planar API stores the size + * of planes array. */ + buffer.length = FMT_NUM_PLANES; + buffer.m.planes = planes; + + if (ioctl(fd, &VIDIOC-QUERYBUF;, &buffer) < 0) { + perror("VIDIOC_QUERYBUF"); + exit(EXIT_FAILURE); + } + + /* Every plane has to be mapped separately */ + for (j = 0; j < FMT_NUM_PLANES; j++) { + buffers[i].length[j] = buffer.m.planes[j].length; /* remember for munmap() */ + + buffers[i].start[j] = mmap(NULL, buffer.m.planes[j].length, + PROT_READ | PROT_WRITE, /* recommended */ + MAP_SHARED, /* recommended */ + fd, buffer.m.planes[j].m.offset); + + if (MAP_FAILED == buffers[i].start[j]) { + /* If you do not exit here you should unmap() and free() + the buffers and planes mapped so far. */ + perror("mmap"); + exit(EXIT_FAILURE); + } + } +} + +/* Cleanup. */ + +for (i = 0; i < reqbuf.count; i++) + for (j = 0; j < FMT_NUM_PLANES; j++) + munmap(buffers[i].start[j], buffers[i].length[j]); + + + + Conceptually streaming drivers maintain two buffer queues, an incoming +and an outgoing queue. They separate the synchronous capture or output +operation locked to a video clock from the application which is +subject to random disk or network delays and preemption by +other processes, thereby reducing the probability of data loss. +The queues are organized as FIFOs, buffers will be +output in the order enqueued in the incoming FIFO, and were +captured in the order dequeued from the outgoing FIFO. + + The driver may require a minimum number of buffers enqueued +at all times to function, apart of this no limit exists on the number +of buffers applications can enqueue in advance, or dequeue and +process. They can also enqueue in a different order than buffers have +been dequeued, and the driver can fill enqueued +empty buffers in any order. + Random enqueue order permits applications processing +images out of order (such as video codecs) to return buffers earlier, +reducing the probability of data loss. Random fill order allows +drivers to reuse buffers on a LIFO-basis, taking advantage of caches +holding scatter-gather lists and the like. + The index number of a buffer (&v4l2-buffer; +index) plays no role here, it only +identifies the buffer. + + Initially all mapped buffers are in dequeued state, +inaccessible by the driver. For capturing applications it is customary +to first enqueue all mapped buffers, then to start capturing and enter +the read loop. Here the application waits until a filled buffer can be +dequeued, and re-enqueues the buffer when the data is no longer +needed. Output applications fill and enqueue buffers, when enough +buffers are stacked up the output is started with +VIDIOC_STREAMON. In the write loop, when +the application runs out of free buffers, it must wait until an empty +buffer can be dequeued and reused. + + To enqueue and dequeue a buffer applications use the +&VIDIOC-QBUF; and &VIDIOC-DQBUF; ioctl. The status of a buffer being +mapped, enqueued, full or empty can be determined at any time using the +&VIDIOC-QUERYBUF; ioctl. Two methods exist to suspend execution of the +application until one or more buffers can be dequeued. By default +VIDIOC_DQBUF blocks when no buffer is in the +outgoing queue. When the O_NONBLOCK flag was +given to the &func-open; function, VIDIOC_DQBUF +returns immediately with an &EAGAIN; when no buffer is available. The +&func-select; or &func-poll; function are always available. + + To start and stop capturing or output applications call the +&VIDIOC-STREAMON; and &VIDIOC-STREAMOFF; ioctl. Note +VIDIOC_STREAMOFF removes all buffers from both +queues as a side effect. Since there is no notion of doing anything +"now" on a multitasking system, if an application needs to synchronize +with another event it should examine the &v4l2-buffer; +timestamp of captured buffers, or set the +field before enqueuing buffers for output. + + Drivers implementing memory mapping I/O must +support the VIDIOC_REQBUFS, +VIDIOC_QUERYBUF, +VIDIOC_QBUF, VIDIOC_DQBUF, +VIDIOC_STREAMON and +VIDIOC_STREAMOFF ioctl, the +mmap(), munmap(), +select() and poll() +function. + At the driver level select() and +poll() are the same, and +select() is too important to be optional. The +rest should be evident. + + + [capture example] + +
+ +
+ Streaming I/O (User Pointers) + + Input and output devices support this I/O method when the +V4L2_CAP_STREAMING flag in the +capabilities field of &v4l2-capability; +returned by the &VIDIOC-QUERYCAP; ioctl is set. If the particular user +pointer method (not only memory mapping) is supported must be +determined by calling the &VIDIOC-REQBUFS; ioctl. + + This I/O method combines advantages of the read/write and +memory mapping methods. Buffers (planes) are allocated by the application +itself, and can reside for example in virtual or shared memory. Only +pointers to data are exchanged, these pointers and meta-information +are passed in &v4l2-buffer; (or in &v4l2-plane; in the multi-planar API case). +The driver must be switched into user pointer I/O mode by calling the +&VIDIOC-REQBUFS; with the desired buffer type. No buffers (planes) are allocated +beforehand, consequently they are not indexed and cannot be queried like mapped +buffers with the VIDIOC_QUERYBUF ioctl. + + + Initiating streaming I/O with user pointers + + +&v4l2-requestbuffers; reqbuf; + +memset (&reqbuf, 0, sizeof (reqbuf)); +reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; +reqbuf.memory = V4L2_MEMORY_USERPTR; + +if (ioctl (fd, &VIDIOC-REQBUFS;, &reqbuf) == -1) { + if (errno == EINVAL) + printf ("Video capturing or user pointer streaming is not supported\n"); + else + perror ("VIDIOC_REQBUFS"); + + exit (EXIT_FAILURE); +} + + + + Buffer (plane) addresses and sizes are passed on the fly with the +&VIDIOC-QBUF; ioctl. Although buffers are commonly cycled, +applications can pass different addresses and sizes at each +VIDIOC_QBUF call. If required by the hardware the +driver swaps memory pages within physical memory to create a +continuous area of memory. This happens transparently to the +application in the virtual memory subsystem of the kernel. When buffer +pages have been swapped out to disk they are brought back and finally +locked in physical memory for DMA. + We expect that frequently used buffers are typically not +swapped out. Anyway, the process of swapping, locking or generating +scatter-gather lists may be time consuming. The delay can be masked by +the depth of the incoming buffer queue, and perhaps by maintaining +caches assuming a buffer will be soon enqueued again. On the other +hand, to optimize memory usage drivers can limit the number of buffers +locked in advance and recycle the most recently used buffers first. Of +course, the pages of empty buffers in the incoming queue need not be +saved to disk. Output buffers must be saved on the incoming and +outgoing queue because an application may share them with other +processes. + + + Filled or displayed buffers are dequeued with the +&VIDIOC-DQBUF; ioctl. The driver can unlock the memory pages at any +time between the completion of the DMA and this ioctl. The memory is +also unlocked when &VIDIOC-STREAMOFF; is called, &VIDIOC-REQBUFS;, or +when the device is closed. Applications must take care not to free +buffers without dequeuing. For once, the buffers remain locked until +further, wasting physical memory. Second the driver will not be +notified when the memory is returned to the application's free list +and subsequently reused for other purposes, possibly completing the +requested DMA and overwriting valuable data. + + For capturing applications it is customary to enqueue a +number of empty buffers, to start capturing and enter the read loop. +Here the application waits until a filled buffer can be dequeued, and +re-enqueues the buffer when the data is no longer needed. Output +applications fill and enqueue buffers, when enough buffers are stacked +up output is started. In the write loop, when the application +runs out of free buffers it must wait until an empty buffer can be +dequeued and reused. Two methods exist to suspend execution of the +application until one or more buffers can be dequeued. By default +VIDIOC_DQBUF blocks when no buffer is in the +outgoing queue. When the O_NONBLOCK flag was +given to the &func-open; function, VIDIOC_DQBUF +returns immediately with an &EAGAIN; when no buffer is available. The +&func-select; or &func-poll; function are always available. + + To start and stop capturing or output applications call the +&VIDIOC-STREAMON; and &VIDIOC-STREAMOFF; ioctl. Note +VIDIOC_STREAMOFF removes all buffers from both +queues and unlocks all buffers as a side effect. Since there is no +notion of doing anything "now" on a multitasking system, if an +application needs to synchronize with another event it should examine +the &v4l2-buffer; timestamp of captured +buffers, or set the field before enqueuing buffers for output. + + Drivers implementing user pointer I/O must +support the VIDIOC_REQBUFS, +VIDIOC_QBUF, VIDIOC_DQBUF, +VIDIOC_STREAMON and +VIDIOC_STREAMOFF ioctl, the +select() and poll() function. + At the driver level select() and +poll() are the same, and +select() is too important to be optional. The +rest should be evident. + +
+ +
+ Asynchronous I/O + + This method is not defined yet. +
+ +
+ Buffers + + A buffer contains data exchanged by application and +driver using one of the Streaming I/O methods. In the multi-planar API, the +data is held in planes, while the buffer structure acts as a container +for the planes. Only pointers to buffers (planes) are exchanged, the data +itself is not copied. These pointers, together with meta-information like +timestamps or field parity, are stored in a struct +v4l2_buffer, argument to +the &VIDIOC-QUERYBUF;, &VIDIOC-QBUF; and &VIDIOC-DQBUF; ioctl. +In the multi-planar API, some plane-specific members of struct +v4l2_buffer, such as pointers and sizes for each +plane, are stored in struct v4l2_plane instead. +In that case, struct v4l2_buffer contains an array of +plane structures. + + Nominally timestamps refer to the first data byte transmitted. +In practice however the wide range of hardware covered by the V4L2 API +limits timestamp accuracy. Often an interrupt routine will +sample the system clock shortly after the field or frame was stored +completely in memory. So applications must expect a constant +difference up to one field or frame period plus a small (few scan +lines) random error. The delay and error can be much +larger due to compression or transmission over an external bus when +the frames are not properly stamped by the sender. This is frequently +the case with USB cameras. Here timestamps refer to the instant the +field or frame was received by the driver, not the capture time. These +devices identify by not enumerating any video standards, see . + + Similar limitations apply to output timestamps. Typically +the video hardware locks to a clock controlling the video timing, the +horizontal and vertical synchronization pulses. At some point in the +line sequence, possibly the vertical blanking, an interrupt routine +samples the system clock, compares against the timestamp and programs +the hardware to repeat the previous field or frame, or to display the +buffer contents. + + Apart of limitations of the video device and natural +inaccuracies of all clocks, it should be noted system time itself is +not perfectly stable. It can be affected by power saving cycles, +warped to insert leap seconds, or even turned back or forth by the +system administrator affecting long term measurements. + Since no other Linux multimedia +API supports unadjusted time it would be foolish to introduce here. We +must use a universally supported clock to synchronize different media, +hence time of day. + + + + struct <structname>v4l2_buffer</structname> + + &cs-ustr; + + + __u32 + index + + Number of the buffer, set by the application. This +field is only used for memory mapping I/O +and can range from zero to the number of buffers allocated +with the &VIDIOC-REQBUFS; ioctl (&v4l2-requestbuffers; count) minus one. + + + &v4l2-buf-type; + type + + Type of the buffer, same as &v4l2-format; +type or &v4l2-requestbuffers; +type, set by the application. + + + __u32 + bytesused + + The number of bytes occupied by the data in the +buffer. It depends on the negotiated data format and may change with +each buffer for compressed variable size data like JPEG images. +Drivers must set this field when type +refers to an input stream, applications when an output stream. + + + __u32 + flags + + Flags set by the application or driver, see . + + + &v4l2-field; + field + + Indicates the field order of the image in the +buffer, see . This field is not used when +the buffer contains VBI data. Drivers must set it when +type refers to an input stream, +applications when an output stream. + + + struct timeval + timestamp + + For input streams this is the +system time (as returned by the gettimeofday() +function) when the first data byte was captured. For output streams +the data will not be displayed before this time, secondary to the +nominal frame rate determined by the current video standard in +enqueued order. Applications can for example zero this field to +display frames as soon as possible. The driver stores the time at +which the first data byte was actually sent out in the +timestamp field. This permits +applications to monitor the drift between the video and system +clock. + + + &v4l2-timecode; + timecode + + When type is +V4L2_BUF_TYPE_VIDEO_CAPTURE and the +V4L2_BUF_FLAG_TIMECODE flag is set in +flags, this structure contains a frame +timecode. In V4L2_FIELD_ALTERNATE +mode the top and bottom field contain the same timecode. +Timecodes are intended to help video editing and are typically recorded on +video tapes, but also embedded in compressed formats like MPEG. This +field is independent of the timestamp and +sequence fields. + + + __u32 + sequence + + Set by the driver, counting the frames in the +sequence. + + + In V4L2_FIELD_ALTERNATE mode the top and +bottom field have the same sequence number. The count starts at zero +and includes dropped or repeated frames. A dropped frame was received +by an input device but could not be stored due to lack of free buffer +space. A repeated frame was displayed again by an output device +because the application did not pass new data in +time.Note this may count the frames received +e.g. over USB, without taking into account the frames dropped by the +remote hardware due to limited compression throughput or bus +bandwidth. These devices identify by not enumerating any video +standards, see . + + + &v4l2-memory; + memory + + This field must be set by applications and/or drivers +in accordance with the selected I/O method. + + + union + m + + + + __u32 + offset + For the single-planar API and when +memory is V4L2_MEMORY_MMAP this +is the offset of the buffer from the start of the device memory. The value is +returned by the driver and apart of serving as parameter to the &func-mmap; +function not useful for applications. See for details + + + + + unsigned long + userptr + For the single-planar API and when +memory is V4L2_MEMORY_USERPTR +this is a pointer to the buffer (casted to unsigned long type) in virtual +memory, set by the application. See for details. + + + + + struct v4l2_plane + *planes + When using the multi-planar API, contains a userspace pointer + to an array of &v4l2-plane;. The size of the array should be put + in the length field of this + v4l2_buffer structure. + + + __u32 + length + + Size of the buffer (not the payload) in bytes for the + single-planar API. For the multi-planar API should contain the + number of elements in the planes array. + + + + __u32 + input + + Some video capture drivers support rapid and +synchronous video input changes, a function useful for example in +video surveillance applications. For this purpose applications set the +V4L2_BUF_FLAG_INPUT flag, and this field to the +number of a video input as in &v4l2-input; field +index. + + + __u32 + reserved + + A place holder for future extensions and custom +(driver defined) buffer types +V4L2_BUF_TYPE_PRIVATE and higher. Applications +should set this to 0. + + + +
+ + + struct <structname>v4l2_plane</structname> + + &cs-ustr; + + + __u32 + bytesused + + The number of bytes occupied by data in the plane + (its payload). + + + __u32 + length + + Size in bytes of the plane (not its payload). + + + union + m + + + + + + __u32 + mem_offset + When the memory type in the containing &v4l2-buffer; is + V4L2_MEMORY_MMAP, this is the value that + should be passed to &func-mmap;, similar to the + offset field in &v4l2-buffer;. + + + + __unsigned long + userptr + When the memory type in the containing &v4l2-buffer; is + V4L2_MEMORY_USERPTR, this is a userspace + pointer to the memory allocated for this plane by an application. + + + + __u32 + data_offset + + Offset in bytes to video data in the plane, if applicable. + + + + __u32 + reserved[11] + + Reserved for future use. Should be zeroed by an + application. + + + +
+ + + enum v4l2_buf_type + + &cs-def; + + + V4L2_BUF_TYPE_VIDEO_CAPTURE + 1 + Buffer of a single-planar video capture stream, see . + + + V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE + + 9 + Buffer of a multi-planar video capture stream, see . + + + V4L2_BUF_TYPE_VIDEO_OUTPUT + 2 + Buffer of a single-planar video output stream, see . + + + V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE + + 10 + Buffer of a multi-planar video output stream, see . + + + V4L2_BUF_TYPE_VIDEO_OVERLAY + 3 + Buffer for video overlay, see . + + + V4L2_BUF_TYPE_VBI_CAPTURE + 4 + Buffer of a raw VBI capture stream, see . + + + V4L2_BUF_TYPE_VBI_OUTPUT + 5 + Buffer of a raw VBI output stream, see . + + + V4L2_BUF_TYPE_SLICED_VBI_CAPTURE + 6 + Buffer of a sliced VBI capture stream, see . + + + V4L2_BUF_TYPE_SLICED_VBI_OUTPUT + 7 + Buffer of a sliced VBI output stream, see . + + + V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY + 8 + Buffer for video output overlay (OSD), see . Status: Experimental. + + + V4L2_BUF_TYPE_PRIVATE + 0x80 + This and higher values are reserved for custom +(driver defined) buffer types. + + + +
+ + + Buffer Flags + + &cs-def; + + + V4L2_BUF_FLAG_MAPPED + 0x0001 + The buffer resides in device memory and has been mapped +into the application's address space, see for details. +Drivers set or clear this flag when the +VIDIOC_QUERYBUF, VIDIOC_QBUF or VIDIOC_DQBUF ioctl is called. Set by the driver. + + + V4L2_BUF_FLAG_QUEUED + 0x0002 + Internally drivers maintain two buffer queues, an +incoming and outgoing queue. When this flag is set, the buffer is +currently on the incoming queue. It automatically moves to the +outgoing queue after the buffer has been filled (capture devices) or +displayed (output devices). Drivers set or clear this flag when the +VIDIOC_QUERYBUF ioctl is called. After +(successful) calling the VIDIOC_QBUF ioctl it is +always set and after VIDIOC_DQBUF always +cleared. + + + V4L2_BUF_FLAG_DONE + 0x0004 + When this flag is set, the buffer is currently on +the outgoing queue, ready to be dequeued from the driver. Drivers set +or clear this flag when the VIDIOC_QUERYBUF ioctl +is called. After calling the VIDIOC_QBUF or +VIDIOC_DQBUF it is always cleared. Of course a +buffer cannot be on both queues at the same time, the +V4L2_BUF_FLAG_QUEUED and +V4L2_BUF_FLAG_DONE flag are mutually exclusive. +They can be both cleared however, then the buffer is in "dequeued" +state, in the application domain to say so. + + + V4L2_BUF_FLAG_ERROR + 0x0040 + When this flag is set, the buffer has been dequeued + successfully, although the data might have been corrupted. + This is recoverable, streaming may continue as normal and + the buffer may be reused normally. + Drivers set this flag when the VIDIOC_DQBUF + ioctl is called. + + + V4L2_BUF_FLAG_KEYFRAME + 0x0008 + Drivers set or clear this flag when calling the +VIDIOC_DQBUF ioctl. It may be set by video +capture devices when the buffer contains a compressed image which is a +key frame (or field), &ie; can be decompressed on its own. + + + V4L2_BUF_FLAG_PFRAME + 0x0010 + Similar to V4L2_BUF_FLAG_KEYFRAME +this flags predicted frames or fields which contain only differences to a +previous key frame. + + + V4L2_BUF_FLAG_BFRAME + 0x0020 + Similar to V4L2_BUF_FLAG_PFRAME + this is a bidirectional predicted frame or field. [ooc tbd] + + + V4L2_BUF_FLAG_TIMECODE + 0x0100 + The timecode field is valid. +Drivers set or clear this flag when the VIDIOC_DQBUF +ioctl is called. + + + V4L2_BUF_FLAG_INPUT + 0x0200 + The input field is valid. +Applications set or clear this flag before calling the +VIDIOC_QBUF ioctl. + + + +
+ + + enum v4l2_memory + + &cs-def; + + + V4L2_MEMORY_MMAP + 1 + The buffer is used for memory +mapping I/O. + + + V4L2_MEMORY_USERPTR + 2 + The buffer is used for user +pointer I/O. + + + V4L2_MEMORY_OVERLAY + 3 + [to do] + + + +
+ +
+ Timecodes + + The v4l2_timecode structure is +designed to hold a or similar timecode. +(struct timeval timestamps are stored in +&v4l2-buffer; field timestamp.) + + + struct <structname>v4l2_timecode</structname> + + &cs-str; + + + __u32 + type + Frame rate the timecodes are based on, see . + + + __u32 + flags + Timecode flags, see . + + + __u8 + frames + Frame count, 0 ... 23/24/29/49/59, depending on the + type of timecode. + + + __u8 + seconds + Seconds count, 0 ... 59. This is a binary, not BCD number. + + + __u8 + minutes + Minutes count, 0 ... 59. This is a binary, not BCD number. + + + __u8 + hours + Hours count, 0 ... 29. This is a binary, not BCD number. + + + __u8 + userbits[4] + The "user group" bits from the timecode. + + + +
+ + + Timecode Types + + &cs-def; + + + V4L2_TC_TYPE_24FPS + 1 + 24 frames per second, i. e. film. + + + V4L2_TC_TYPE_25FPS + 2 + 25 frames per second, &ie; PAL or SECAM video. + + + V4L2_TC_TYPE_30FPS + 3 + 30 frames per second, &ie; NTSC video. + + + V4L2_TC_TYPE_50FPS + 4 + + + + V4L2_TC_TYPE_60FPS + 5 + + + + +
+ + + Timecode Flags + + &cs-def; + + + V4L2_TC_FLAG_DROPFRAME + 0x0001 + Indicates "drop frame" semantics for counting frames +in 29.97 fps material. When set, frame numbers 0 and 1 at the start of +each minute, except minutes 0, 10, 20, 30, 40, 50 are omitted from the +count. + + + V4L2_TC_FLAG_COLORFRAME + 0x0002 + The "color frame" flag. + + + V4L2_TC_USERBITS_field + 0x000C + Field mask for the "binary group flags". + + + V4L2_TC_USERBITS_USERDEFINED + 0x0000 + Unspecified format. + + + V4L2_TC_USERBITS_8BITCHARS + 0x0008 + 8-bit ISO characters. + + + +
+
+
+ +
+ Field Order + + We have to distinguish between progressive and interlaced +video. Progressive video transmits all lines of a video image +sequentially. Interlaced video divides an image into two fields, +containing only the odd and even lines of the image, respectively. +Alternating the so called odd and even field are transmitted, and due +to a small delay between fields a cathode ray TV displays the lines +interleaved, yielding the original frame. This curious technique was +invented because at refresh rates similar to film the image would +fade out too quickly. Transmitting fields reduces the flicker without +the necessity of doubling the frame rate and with it the bandwidth +required for each channel. + + It is important to understand a video camera does not expose +one frame at a time, merely transmitting the frames separated into +fields. The fields are in fact captured at two different instances in +time. An object on screen may well move between one field and the +next. For applications analysing motion it is of paramount importance +to recognize which field of a frame is older, the temporal +order. + + When the driver provides or accepts images field by field +rather than interleaved, it is also important applications understand +how the fields combine to frames. We distinguish between top (aka odd) and +bottom (aka even) fields, the spatial order: The first line +of the top field is the first line of an interlaced frame, the first +line of the bottom field is the second line of that frame. + + However because fields were captured one after the other, +arguing whether a frame commences with the top or bottom field is +pointless. Any two successive top and bottom, or bottom and top fields +yield a valid frame. Only when the source was progressive to begin +with, ⪚ when transferring film to video, two fields may come from +the same frame, creating a natural order. + + Counter to intuition the top field is not necessarily the +older field. Whether the older field contains the top or bottom lines +is a convention determined by the video standard. Hence the +distinction between temporal and spatial order of fields. The diagrams +below should make this clearer. + + All video capture and output devices must report the current +field order. Some drivers may permit the selection of a different +order, to this end applications initialize the +field field of &v4l2-pix-format; before +calling the &VIDIOC-S-FMT; ioctl. If this is not desired it should +have the value V4L2_FIELD_ANY (0). + + + enum v4l2_field + + &cs-def; + + + V4L2_FIELD_ANY + 0 + Applications request this field order when any +one of the V4L2_FIELD_NONE, +V4L2_FIELD_TOP, +V4L2_FIELD_BOTTOM, or +V4L2_FIELD_INTERLACED formats is acceptable. +Drivers choose depending on hardware capabilities or e. g. the +requested image size, and return the actual field order. &v4l2-buffer; +field can never be +V4L2_FIELD_ANY. + + + V4L2_FIELD_NONE + 1 + Images are in progressive format, not interlaced. +The driver may also indicate this order when it cannot distinguish +between V4L2_FIELD_TOP and +V4L2_FIELD_BOTTOM. + + + V4L2_FIELD_TOP + 2 + Images consist of the top (aka odd) field only. + + + V4L2_FIELD_BOTTOM + 3 + Images consist of the bottom (aka even) field only. +Applications may wish to prevent a device from capturing interlaced +images because they will have "comb" or "feathering" artefacts around +moving objects. + + + V4L2_FIELD_INTERLACED + 4 + Images contain both fields, interleaved line by +line. The temporal order of the fields (whether the top or bottom +field is first transmitted) depends on the current video standard. +M/NTSC transmits the bottom field first, all other standards the top +field first. + + + V4L2_FIELD_SEQ_TB + 5 + Images contain both fields, the top field lines +are stored first in memory, immediately followed by the bottom field +lines. Fields are always stored in temporal order, the older one first +in memory. Image sizes refer to the frame, not fields. + + + V4L2_FIELD_SEQ_BT + 6 + Images contain both fields, the bottom field +lines are stored first in memory, immediately followed by the top +field lines. Fields are always stored in temporal order, the older one +first in memory. Image sizes refer to the frame, not fields. + + + V4L2_FIELD_ALTERNATE + 7 + The two fields of a frame are passed in separate +buffers, in temporal order, &ie; the older one first. To indicate the field +parity (whether the current field is a top or bottom field) the driver +or application, depending on data direction, must set &v4l2-buffer; +field to +V4L2_FIELD_TOP or +V4L2_FIELD_BOTTOM. Any two successive fields pair +to build a frame. If fields are successive, without any dropped fields +between them (fields can drop individually), can be determined from +the &v4l2-buffer; sequence field. Image +sizes refer to the frame, not fields. This format cannot be selected +when using the read/write I/O method. + + + V4L2_FIELD_INTERLACED_TB + 8 + Images contain both fields, interleaved line by +line, top field first. The top field is transmitted first. + + + V4L2_FIELD_INTERLACED_BT + 9 + Images contain both fields, interleaved line by +line, top field first. The bottom field is transmitted first. + + + +
+ +
+ Field Order, Top Field First Transmitted + + + + + + + + +
+ +
+ Field Order, Bottom Field First Transmitted + + + + + + + + +
+
+ + diff --git a/Documentation/DocBook/media/v4l/keytable.c.xml b/Documentation/DocBook/media/v4l/keytable.c.xml new file mode 100644 index 000000000000..d53254a3be15 --- /dev/null +++ b/Documentation/DocBook/media/v4l/keytable.c.xml @@ -0,0 +1,172 @@ + +/* keytable.c - This program allows checking/replacing keys at IR + + Copyright (C) 2006-2009 Mauro Carvalho Chehab <mchehab@infradead.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, version 2 of the License. + + This program is distributed in the hope that it will be useful, + 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. + */ + +#include <ctype.h> +#include <errno.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <linux/input.h> +#include <sys/ioctl.h> + +#include "parse.h" + +void prtcode (int *codes) +{ + struct parse_key *p; + + for (p=keynames;p->name!=NULL;p++) { + if (p->value == (unsigned)codes[1]) { + printf("scancode 0x%04x = %s (0x%02x)\n", codes[0], p->name, codes[1]); + return; + } + } + + if (isprint (codes[1])) + printf("scancode %d = '%c' (0x%02x)\n", codes[0], codes[1], codes[1]); + else + printf("scancode %d = 0x%02x\n", codes[0], codes[1]); +} + +int parse_code(char *string) +{ + struct parse_key *p; + + for (p=keynames;p->name!=NULL;p++) { + if (!strcasecmp(p->name, string)) { + return p->value; + } + } + return -1; +} + +int main (int argc, char *argv[]) +{ + int fd; + unsigned int i, j; + int codes[2]; + + if (argc<2 || argc>4) { + printf ("usage: %s <device> to get table; or\n" + " %s <device> <scancode> <keycode>\n" + " %s <device> <keycode_file>\n",*argv,*argv,*argv); + return -1; + } + + if ((fd = open(argv[1], O_RDONLY)) < 0) { + perror("Couldn't open input device"); + return(-1); + } + + if (argc==4) { + int value; + + value=parse_code(argv[3]); + + if (value==-1) { + value = strtol(argv[3], NULL, 0); + if (errno) + perror("value"); + } + + codes [0] = (unsigned) strtol(argv[2], NULL, 0); + codes [1] = (unsigned) value; + + if(ioctl(fd, EVIOCSKEYCODE, codes)) + perror ("EVIOCSKEYCODE"); + + if(ioctl(fd, EVIOCGKEYCODE, codes)==0) + prtcode(codes); + return 0; + } + + if (argc==3) { + FILE *fin; + int value; + char *scancode, *keycode, s[2048]; + + fin=fopen(argv[2],"r"); + if (fin==NULL) { + perror ("opening keycode file"); + return -1; + } + + /* Clears old table */ + for (j = 0; j < 256; j++) { + for (i = 0; i < 256; i++) { + codes[0] = (j << 8) | i; + codes[1] = KEY_RESERVED; + ioctl(fd, EVIOCSKEYCODE, codes); + } + } + + while (fgets(s,sizeof(s),fin)) { + scancode=strtok(s,"\n\t =:"); + if (!scancode) { + perror ("parsing input file scancode"); + return -1; + } + if (!strcasecmp(scancode, "scancode")) { + scancode = strtok(NULL,"\n\t =:"); + if (!scancode) { + perror ("parsing input file scancode"); + return -1; + } + } + + keycode=strtok(NULL,"\n\t =:("); + if (!keycode) { + perror ("parsing input file keycode"); + return -1; + } + + // printf ("parsing %s=%s:", scancode, keycode); + value=parse_code(keycode); + // printf ("\tvalue=%d\n",value); + + if (value==-1) { + value = strtol(keycode, NULL, 0); + if (errno) + perror("value"); + } + + codes [0] = (unsigned) strtol(scancode, NULL, 0); + codes [1] = (unsigned) value; + + // printf("\t%04x=%04x\n",codes[0], codes[1]); + if(ioctl(fd, EVIOCSKEYCODE, codes)) { + fprintf(stderr, "Setting scancode 0x%04x with 0x%04x via ",codes[0], codes[1]); + perror ("EVIOCSKEYCODE"); + } + + if(ioctl(fd, EVIOCGKEYCODE, codes)==0) + prtcode(codes); + } + return 0; + } + + /* Get scancode table */ + for (j = 0; j < 256; j++) { + for (i = 0; i < 256; i++) { + codes[0] = (j << 8) | i; + if (!ioctl(fd, EVIOCGKEYCODE, codes) && codes[1] != KEY_RESERVED) + prtcode(codes); + } + } + return 0; +} + + diff --git a/Documentation/DocBook/media/v4l/libv4l.xml b/Documentation/DocBook/media/v4l/libv4l.xml new file mode 100644 index 000000000000..3cb10ec51929 --- /dev/null +++ b/Documentation/DocBook/media/v4l/libv4l.xml @@ -0,0 +1,167 @@ +Libv4l Userspace Library +
+ Introduction + + libv4l is a collection of libraries which adds a thin abstraction +layer on top of video4linux2 devices. The purpose of this (thin) layer +is to make it easy for application writers to support a wide variety of +devices without having to write separate code for different devices in the +same class. +An example of using libv4l is provided by +v4l2grab. + + + libv4l consists of 3 different libraries: +
+ libv4lconvert + + libv4lconvert is a library that converts several +different pixelformats found in V4L2 drivers into a few common RGB and +YUY formats. + It currently accepts the following V4L2 driver formats: +V4L2_PIX_FMT_BGR24, +V4L2_PIX_FMT_HM12, +V4L2_PIX_FMT_JPEG, +V4L2_PIX_FMT_MJPEG, +V4L2_PIX_FMT_MR97310A, +V4L2_PIX_FMT_OV511, +V4L2_PIX_FMT_OV518, +V4L2_PIX_FMT_PAC207, +V4L2_PIX_FMT_PJPG, +V4L2_PIX_FMT_RGB24, +V4L2_PIX_FMT_SBGGR8, +V4L2_PIX_FMT_SGBRG8, +V4L2_PIX_FMT_SGRBG8, +V4L2_PIX_FMT_SN9C10X, +V4L2_PIX_FMT_SN9C20X_I420, +V4L2_PIX_FMT_SPCA501, +V4L2_PIX_FMT_SPCA505, +V4L2_PIX_FMT_SPCA508, +V4L2_PIX_FMT_SPCA561, +V4L2_PIX_FMT_SQ905C, +V4L2_PIX_FMT_SRGGB8, +V4L2_PIX_FMT_UYVY, +V4L2_PIX_FMT_YUV420, +V4L2_PIX_FMT_YUYV, +V4L2_PIX_FMT_YVU420, +and V4L2_PIX_FMT_YVYU. + + Later on libv4lconvert was expanded to also be able to do +various video processing functions to improve webcam video quality. +The video processing is split in to 2 parts: libv4lconvert/control and +libv4lconvert/processing. + + The control part is used to offer video controls which can +be used to control the video processing functions made available by + libv4lconvert/processing. These controls are stored application wide +(until reboot) by using a persistent shared memory object. + + libv4lconvert/processing offers the actual video +processing functionality. +
+
+ libv4l1 + This library offers functions that can be used to quickly +make v4l1 applications work with v4l2 devices. These functions work exactly +like the normal open/close/etc, except that libv4l1 does full emulation of +the v4l1 api on top of v4l2 drivers, in case of v4l1 drivers it +will just pass calls through. + Since those functions are emulations of the old V4L1 API, +it shouldn't be used for new applications. +
+
+ libv4l2 + This library should be used for all modern V4L2 +applications. + It provides handles to call V4L2 open/ioctl/close/poll +methods. Instead of just providing the raw output of the device, it enhances +the calls in the sense that it will use libv4lconvert to provide more video +formats and to enhance the image quality. + In most cases, libv4l2 just passes the calls directly +through to the v4l2 driver, intercepting the calls to +VIDIOC_TRY_FMT, +VIDIOC_G_FMT +VIDIOC_S_FMT +VIDIOC_ENUM_FRAMESIZES +and VIDIOC_ENUM_FRAMEINTERVALS +in order to emulate the formats +V4L2_PIX_FMT_BGR24, +V4L2_PIX_FMT_RGB24, +V4L2_PIX_FMT_YUV420, +and V4L2_PIX_FMT_YVU420, +if they aren't available in the driver. +VIDIOC_ENUM_FMT +keeps enumerating the hardware supported formats, plus the emulated formats +offered by libv4l at the end. + +
+ Libv4l device control functions + The common file operation methods are provided by +libv4l. + Those functions operate just like glibc +open/close/dup/ioctl/read/mmap/munmap: + + int v4l2_open(const char *file, int oflag, +...) - +operates like the standard open() function. + + int v4l2_close(int fd) - +operates like the standard close() function. + + int v4l2_dup(int fd) - +operates like the standard dup() function, duplicating a file handler. + + int v4l2_ioctl (int fd, unsigned long int request, ...) - +operates like the standard ioctl() function. + + int v4l2_read (int fd, void* buffer, size_t n) - +operates like the standard read() function. + + void v4l2_mmap(void *start, size_t length, int prot, int flags, int fd, int64_t offset); - +operates like the standard mmap() function. + + int v4l2_munmap(void *_start, size_t length); - +operates like the standard munmap() function. + + + Those functions provide additional control: + + int v4l2_fd_open(int fd, int v4l2_flags) - +opens an already opened fd for further use through v4l2lib and possibly +modify libv4l2's default behavior through the v4l2_flags argument. +Currently, v4l2_flags can be V4L2_DISABLE_CONVERSION, +to disable format conversion. + + int v4l2_set_control(int fd, int cid, int value) - +This function takes a value of 0 - 65535, and then scales that range to +the actual range of the given v4l control id, and then if the cid exists +and is not locked sets the cid to the scaled value. + + int v4l2_get_control(int fd, int cid) - +This function returns a value of 0 - 65535, scaled to from the actual range +of the given v4l control id. when the cid does not exist, could not be +accessed for some reason, or some error occurred 0 is returned. + + +
+
+
+ + v4l1compat.so wrapper library + + This library intercepts calls to +open/close/ioctl/mmap/mmunmap operations and redirects them to the libv4l +counterparts, by using LD_PRELOAD=/usr/lib/v4l1compat.so. It also +emulates V4L1 calls via V4L2 API. + It allows usage of binary legacy applications that +still don't use libv4l. +
+ +
+ diff --git a/Documentation/DocBook/media/v4l/lirc_device_interface.xml b/Documentation/DocBook/media/v4l/lirc_device_interface.xml new file mode 100644 index 000000000000..0e0453f39e73 --- /dev/null +++ b/Documentation/DocBook/media/v4l/lirc_device_interface.xml @@ -0,0 +1,251 @@ +
+LIRC Device Interface + + +
+Introduction + +The LIRC device interface is a bi-directional interface for +transporting raw IR data between userspace and kernelspace. Fundamentally, +it is just a chardev (/dev/lircX, for X = 0, 1, 2, ...), with a number +of standard struct file_operations defined on it. With respect to +transporting raw IR data to and fro, the essential fops are read, write +and ioctl. + +Example dmesg output upon a driver registering w/LIRC: +
+ $ dmesg |grep lirc_dev + lirc_dev: IR Remote Control driver registered, major 248 + rc rc0: lirc_dev: driver ir-lirc-codec (mceusb) registered at minor = 0 +
+ +What you should see for a chardev: +
+ $ ls -l /dev/lirc* + crw-rw---- 1 root root 248, 0 Jul 2 22:20 /dev/lirc0 +
+
+ +
+LIRC read fop + +The lircd userspace daemon reads raw IR data from the LIRC chardev. The +exact format of the data depends on what modes a driver supports, and what +mode has been selected. lircd obtains supported modes and sets the active mode +via the ioctl interface, detailed at . The generally +preferred mode is LIRC_MODE_MODE2, in which packets containing an int value +describing an IR signal are read from the chardev. + +See also http://www.lirc.org/html/technical.html for more info. +
+ +
+LIRC write fop + +The data written to the chardev is a pulse/space sequence of integer +values. Pulses and spaces are only marked implicitly by their position. The +data must start and end with a pulse, therefore, the data must always include +an uneven number of samples. The write function must block until the data has +been transmitted by the hardware. +
+ +
+LIRC ioctl fop + +The LIRC device's ioctl definition is bound by the ioctl function +definition of struct file_operations, leaving us with an unsigned int +for the ioctl command and an unsigned long for the arg. For the purposes +of ioctl portability across 32-bit and 64-bit, these values are capped +to their 32-bit sizes. + +The following ioctls can be used to change specific hardware settings. +In general each driver should have a default set of settings. The driver +implementation is expected to re-apply the default settings when the device +is closed by user-space, so that every application opening the device can rely +on working with the default settings initially. + + + + LIRC_GET_FEATURES + + Obviously, get the underlying hardware device's features. If a driver + does not announce support of certain features, calling of the corresponding + ioctls is undefined. + + + + LIRC_GET_SEND_MODE + + Get supported transmit mode. Only LIRC_MODE_PULSE is supported by lircd. + + + + LIRC_GET_REC_MODE + + Get supported receive modes. Only LIRC_MODE_MODE2 and LIRC_MODE_LIRCCODE + are supported by lircd. + + + + LIRC_GET_SEND_CARRIER + + Get carrier frequency (in Hz) currently used for transmit. + + + + LIRC_GET_REC_CARRIER + + Get carrier frequency (in Hz) currently used for IR reception. + + + + LIRC_{G,S}ET_{SEND,REC}_DUTY_CYCLE + + Get/set the duty cycle (from 0 to 100) of the carrier signal. Currently, + no special meaning is defined for 0 or 100, but this could be used to switch + off carrier generation in the future, so these values should be reserved. + + + + LIRC_GET_REC_RESOLUTION + + Some receiver have maximum resolution which is defined by internal + sample rate or data format limitations. E.g. it's common that signals can + only be reported in 50 microsecond steps. This integer value is used by + lircd to automatically adjust the aeps tolerance value in the lircd + config file. + + + + LIRC_GET_M{IN,AX}_TIMEOUT + + Some devices have internal timers that can be used to detect when + there's no IR activity for a long time. This can help lircd in detecting + that a IR signal is finished and can speed up the decoding process. + Returns an integer value with the minimum/maximum timeout that can be + set. Some devices have a fixed timeout, in that case both ioctls will + return the same value even though the timeout cannot be changed. + + + + LIRC_GET_M{IN,AX}_FILTER_{PULSE,SPACE} + + Some devices are able to filter out spikes in the incoming signal + using given filter rules. These ioctls return the hardware capabilities + that describe the bounds of the possible filters. Filter settings depend + on the IR protocols that are expected. lircd derives the settings from + all protocols definitions found in its config file. + + + + LIRC_GET_LENGTH + + Retrieves the code length in bits (only for LIRC_MODE_LIRCCODE). + Reads on the device must be done in blocks matching the bit count. + The bit could should be rounded up so that it matches full bytes. + + + + LIRC_SET_{SEND,REC}_MODE + + Set send/receive mode. Largely obsolete for send, as only + LIRC_MODE_PULSE is supported. + + + + LIRC_SET_{SEND,REC}_CARRIER + + Set send/receive carrier (in Hz). + + + + LIRC_SET_TRANSMITTER_MASK + + This enables the given set of transmitters. The first transmitter + is encoded by the least significant bit, etc. When an invalid bit mask + is given, i.e. a bit is set, even though the device does not have so many + transitters, then this ioctl returns the number of available transitters + and does nothing otherwise. + + + + LIRC_SET_REC_TIMEOUT + + Sets the integer value for IR inactivity timeout (cf. + LIRC_GET_MIN_TIMEOUT and LIRC_GET_MAX_TIMEOUT). A value of 0 (if + supported by the hardware) disables all hardware timeouts and data should + be reported as soon as possible. If the exact value cannot be set, then + the next possible value _greater_ than the given value should be set. + + + + LIRC_SET_REC_TIMEOUT_REPORTS + + Enable (1) or disable (0) timeout reports in LIRC_MODE_MODE2. By + default, timeout reports should be turned off. + + + + LIRC_SET_REC_FILTER_{,PULSE,SPACE} + + Pulses/spaces shorter than this are filtered out by hardware. If + filters cannot be set independently for pulse/space, the corresponding + ioctls must return an error and LIRC_SET_REC_FILTER shall be used instead. + + + + LIRC_SET_MEASURE_CARRIER_MODE + + Enable (1)/disable (0) measure mode. If enabled, from the next key + press on, the driver will send LIRC_MODE2_FREQUENCY packets. By default + this should be turned off. + + + + LIRC_SET_REC_{DUTY_CYCLE,CARRIER}_RANGE + + To set a range use LIRC_SET_REC_DUTY_CYCLE_RANGE/LIRC_SET_REC_CARRIER_RANGE + with the lower bound first and later LIRC_SET_REC_DUTY_CYCLE/LIRC_SET_REC_CARRIER + with the upper bound. + + + + LIRC_NOTIFY_DECODE + + This ioctl is called by lircd whenever a successful decoding of an + incoming IR signal could be done. This can be used by supporting hardware + to give visual feedback to the user e.g. by flashing a LED. + + + + LIRC_SETUP_{START,END} + + Setting of several driver parameters can be optimized by encapsulating + the according ioctl calls with LIRC_SETUP_START/LIRC_SETUP_END. When a + driver receives a LIRC_SETUP_START ioctl it can choose to not commit + further setting changes to the hardware until a LIRC_SETUP_END is received. + But this is open to the driver implementation and every driver must also + handle parameter changes which are not encapsulated by LIRC_SETUP_START + and LIRC_SETUP_END. Drivers can also choose to ignore these ioctls. + + + + LIRC_SET_WIDEBAND_RECEIVER + + Some receivers are equipped with special wide band receiver which is intended + to be used to learn output of existing remote. + Calling that ioctl with (1) will enable it, and with (0) disable it. + This might be useful of receivers that have otherwise narrow band receiver + that prevents them to be used with some remotes. + Wide band receiver might also be more precise + On the other hand its disadvantage it usually reduced range of reception. + Note: wide band receiver might be implictly enabled if you enable + carrier reports. In that case it will be disabled as soon as you disable + carrier reports. Trying to disable wide band receiver while carrier + reports are active will do nothing. + + + + +
+
diff --git a/Documentation/DocBook/media/v4l/media-controller.xml b/Documentation/DocBook/media/v4l/media-controller.xml new file mode 100644 index 000000000000..873ac3a621f0 --- /dev/null +++ b/Documentation/DocBook/media/v4l/media-controller.xml @@ -0,0 +1,89 @@ + + + + Laurent + Pinchart +
laurent.pinchart@ideasonboard.com
+ Initial version. +
+
+ + 2010 + Laurent Pinchart + + + + + + 1.0.0 + 2010-11-10 + lp + Initial revision + + +
+ +Media Controller API + + + Media Controller + +
+ Introduction + Media devices increasingly handle multiple related functions. Many USB + cameras include microphones, video capture hardware can also output video, + or SoC camera interfaces also perform memory-to-memory operations similar to + video codecs. + Independent functions, even when implemented in the same hardware, can + be modelled as separate devices. A USB camera with a microphone will be + presented to userspace applications as V4L2 and ALSA capture devices. The + devices' relationships (when using a webcam, end-users shouldn't have to + manually select the associated USB microphone), while not made available + directly to applications by the drivers, can usually be retrieved from + sysfs. + With more and more advanced SoC devices being introduced, the current + approach will not scale. Device topologies are getting increasingly complex + and can't always be represented by a tree structure. Hardware blocks are + shared between different functions, creating dependencies between seemingly + unrelated devices. + Kernel abstraction APIs such as V4L2 and ALSA provide means for + applications to access hardware parameters. As newer hardware expose an + increasingly high number of those parameters, drivers need to guess what + applications really require based on limited information, thereby + implementing policies that belong to userspace. + The media controller API aims at solving those problems. +
+ +
+ Media device model + Discovering a device internal topology, and configuring it at runtime, + is one of the goals of the media controller API. To achieve this, hardware + devices are modelled as an oriented graph of building blocks called entities + connected through pads. + An entity is a basic media hardware or software building block. It can + correspond to a large variety of logical blocks such as physical hardware + devices (CMOS sensor for instance), logical hardware devices (a building + block in a System-on-Chip image processing pipeline), DMA channels or + physical connectors. + A pad is a connection endpoint through which an entity can interact + with other entities. Data (not restricted to video) produced by an entity + flows from the entity's output to one or more entity inputs. Pads should not + be confused with physical pins at chip boundaries. + A link is a point-to-point oriented connection between two pads, + either on the same entity or on different entities. Data flows from a source + pad to a sink pad. +
+
+ + + Function Reference + + &sub-media-func-open; + &sub-media-func-close; + &sub-media-func-ioctl; + + &sub-media-ioc-device-info; + &sub-media-ioc-enum-entities; + &sub-media-ioc-enum-links; + &sub-media-ioc-setup-link; + diff --git a/Documentation/DocBook/media/v4l/media-func-close.xml b/Documentation/DocBook/media/v4l/media-func-close.xml new file mode 100644 index 000000000000..be149c802aeb --- /dev/null +++ b/Documentation/DocBook/media/v4l/media-func-close.xml @@ -0,0 +1,59 @@ + + + media close() + &manvol; + + + + media-close + Close a media device + + + + + #include <unistd.h> + + int close + int fd + + + + + + Arguments + + + + fd + + &fd; + + + + + + + Description + + Closes the media device. Resources associated with the file descriptor + are freed. The device configuration remain unchanged. + + + + Return Value + + close returns 0 on success. On error, -1 is + returned, and errno is set appropriately. Possible error + codes are: + + + + EBADF + + fd is not a valid open file descriptor. + + + + + + diff --git a/Documentation/DocBook/media/v4l/media-func-ioctl.xml b/Documentation/DocBook/media/v4l/media-func-ioctl.xml new file mode 100644 index 000000000000..bda8604de15c --- /dev/null +++ b/Documentation/DocBook/media/v4l/media-func-ioctl.xml @@ -0,0 +1,116 @@ + + + media ioctl() + &manvol; + + + + media-ioctl + Control a media device + + + + + #include <sys/ioctl.h> + + int ioctl + int fd + int request + void *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + Media ioctl request code as defined in the media.h header file, + for example MEDIA_IOC_SETUP_LINK. + + + + argp + + Pointer to a request-specific structure. + + + + + + + Description + The ioctl() function manipulates media device + parameters. The argument fd must be an open file + descriptor. + The ioctl request code specifies the media + function to be called. It has encoded in it whether the argument is an + input, output or read/write parameter, and the size of the argument + argp in bytes. + Macros and structures definitions specifying media ioctl requests and + their parameters are located in the media.h header file. All media ioctl + requests, their respective function and parameters are specified in + . + + + + Return Value + + ioctl() returns 0 on + success. On failure, -1 is returned, and the + errno variable is set appropriately. Generic error codes + are listed below, and request-specific error codes are listed in the + individual requests descriptions. + When an ioctl that takes an output or read/write parameter fails, + the parameter remains unmodified. + + + + EBADF + + fd is not a valid open file descriptor. + + + + + EFAULT + + argp references an inaccessible memory + area. + + + + EINVAL + + The request or the data pointed to by + argp is not valid. This is a very common error + code, see the individual ioctl requests listed in + for actual causes. + + + + ENOMEM + + Insufficient kernel memory was available to complete the + request. + + + + ENOTTY + + fd is not associated with a character + special device. + + + + + diff --git a/Documentation/DocBook/media/v4l/media-func-open.xml b/Documentation/DocBook/media/v4l/media-func-open.xml new file mode 100644 index 000000000000..f7df034dc9ed --- /dev/null +++ b/Documentation/DocBook/media/v4l/media-func-open.xml @@ -0,0 +1,94 @@ + + + media open() + &manvol; + + + + media-open + Open a media device + + + + + #include <fcntl.h> + + int open + const char *device_name + int flags + + + + + + Arguments + + + + device_name + + Device to be opened. + + + + flags + + Open flags. Access mode must be either O_RDONLY + or O_RDWR. Other flags have no effect. + + + + + + Description + To open a media device applications call open() + with the desired device name. The function has no side effects; the device + configuration remain unchanged. + When the device is opened in read-only mode, attemps to modify its + configuration will result in an error, and errno will be + set to EBADF. + + + Return Value + + open returns the new file descriptor on success. + On error, -1 is returned, and errno is set appropriately. + Possible error codes are: + + + + EACCES + + The requested access to the file is not allowed. + + + + EMFILE + + The process already has the maximum number of files open. + + + + + ENFILE + + The system limit on the total number of open files has been + reached. + + + + ENOMEM + + Insufficient kernel memory was available. + + + + ENXIO + + No device corresponding to this device special file exists. + + + + + + diff --git a/Documentation/DocBook/media/v4l/media-ioc-device-info.xml b/Documentation/DocBook/media/v4l/media-ioc-device-info.xml new file mode 100644 index 000000000000..1f3237351bba --- /dev/null +++ b/Documentation/DocBook/media/v4l/media-ioc-device-info.xml @@ -0,0 +1,133 @@ + + + ioctl MEDIA_IOC_DEVICE_INFO + &manvol; + + + + MEDIA_IOC_DEVICE_INFO + Query device information + + + + + + int ioctl + int fd + int request + struct media_device_info *argp + + + + + + Arguments + + + + fd + + File descriptor returned by + open(). + + + + request + + MEDIA_IOC_DEVICE_INFO + + + + argp + + + + + + + + + Description + + All media devices must support the MEDIA_IOC_DEVICE_INFO + ioctl. To query device information, applications call the ioctl with a + pointer to a &media-device-info;. The driver fills the structure and returns + the information to the application. + The ioctl never fails. + + + struct <structname>media_device_info</structname> + + &cs-str; + + + char + driver[16] + Name of the driver implementing the media API as a + NUL-terminated ASCII string. The driver version is stored in the + driver_version field. + Driver specific applications can use this information to + verify the driver identity. It is also useful to work around + known bugs, or to identify drivers in error reports. + + + char + model[32] + Device model name as a NUL-terminated UTF-8 string. The + device version is stored in the device_version + field and is not be appended to the model name. + + + char + serial[40] + Serial number as a NUL-terminated ASCII string. + + + char + bus_info[32] + Location of the device in the system as a NUL-terminated + ASCII string. This includes the bus type name (PCI, USB, ...) and a + bus-specific identifier. + + + __u32 + media_version + Media API version, formatted with the + KERNEL_VERSION() macro. + + + __u32 + hw_revision + Hardware device revision in a driver-specific format. + + + __u32 + media_version + Media device driver version, formatted with the + KERNEL_VERSION() macro. Together with the + driver field this identifies a particular + driver. + + + __u32 + reserved[31] + Reserved for future extensions. Drivers and applications must + set this array to zero. + + + +
+ The serial and bus_info + fields can be used to distinguish between multiple instances of otherwise + identical hardware. The serial number takes precedence when provided and can + be assumed to be unique. If the serial number is an empty string, the + bus_info field can be used instead. The + bus_info field is guaranteed to be unique, but + can vary across reboots or device unplug/replug. +
+ + + Return value + This function doesn't return specific error codes. + +
diff --git a/Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml b/Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml new file mode 100644 index 000000000000..576b68b33f2c --- /dev/null +++ b/Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml @@ -0,0 +1,308 @@ + + + ioctl MEDIA_IOC_ENUM_ENTITIES + &manvol; + + + + MEDIA_IOC_ENUM_ENTITIES + Enumerate entities and their properties + + + + + + int ioctl + int fd + int request + struct media_entity_desc *argp + + + + + + Arguments + + + + fd + + File descriptor returned by + open(). + + + + request + + MEDIA_IOC_ENUM_ENTITIES + + + + argp + + + + + + + + + Description + To query the attributes of an entity, applications set the id field + of a &media-entity-desc; structure and call the MEDIA_IOC_ENUM_ENTITIES + ioctl with a pointer to this structure. The driver fills the rest of the + structure or returns an &EINVAL; when the id is invalid. + Entities can be enumerated by or'ing the id with the + MEDIA_ENT_ID_FLAG_NEXT flag. The driver will return + information about the entity with the smallest id strictly larger than the + requested one ('next entity'), or the &EINVAL; if there is none. + Entity IDs can be non-contiguous. Applications must + not try to enumerate entities by calling + MEDIA_IOC_ENUM_ENTITIES with increasing id's until they get an error. + Two or more entities that share a common non-zero + group_id value are considered as logically + grouped. Groups are used to report + + ALSA, VBI and video nodes that carry the same media + stream + lens and flash controllers associated with a sensor + + + + + struct <structname>media_entity_desc</structname> + + + + + + + + + __u32 + id + + + Entity id, set by the application. When the id is or'ed with + MEDIA_ENT_ID_FLAG_NEXT, the driver clears the + flag and returns the first entity with a larger id. + + + char + name[32] + + + Entity name as an UTF-8 NULL-terminated string. + + + __u32 + type + + + Entity type, see for details. + + + __u32 + revision + + + Entity revision in a driver/hardware specific format. + + + __u32 + flags + + + Entity flags, see for details. + + + __u32 + group_id + + + Entity group ID + + + __u16 + pads + + + Number of pads + + + __u16 + links + + + Total number of outbound links. Inbound links are not counted + in this field. + + + union + + + + struct + v4l + + Valid for V4L sub-devices and nodes only. + + + + + __u32 + major + V4L device node major number. For V4L sub-devices with no + device node, set by the driver to 0. + + + + + __u32 + minor + V4L device node minor number. For V4L sub-devices with no + device node, set by the driver to 0. + + + + struct + fb + + Valid for frame buffer nodes only. + + + + + __u32 + major + Frame buffer device node major number. + + + + + __u32 + minor + Frame buffer device node minor number. + + + + struct + alsa + + Valid for ALSA devices only. + + + + + __u32 + card + ALSA card number + + + + + __u32 + device + ALSA device number + + + + + __u32 + subdevice + ALSA sub-device number + + + + int + dvb + + DVB card number + + + + __u8 + raw[180] + + + + + +
+ + + Media entity types + + + + + + MEDIA_ENT_T_DEVNODE + Unknown device node + + + MEDIA_ENT_T_DEVNODE_V4L + V4L video, radio or vbi device node + + + MEDIA_ENT_T_DEVNODE_FB + Frame buffer device node + + + MEDIA_ENT_T_DEVNODE_ALSA + ALSA card + + + MEDIA_ENT_T_DEVNODE_DVB + DVB card + + + MEDIA_ENT_T_V4L2_SUBDEV + Unknown V4L sub-device + + + MEDIA_ENT_T_V4L2_SUBDEV_SENSOR + Video sensor + + + MEDIA_ENT_T_V4L2_SUBDEV_FLASH + Flash controller + + + MEDIA_ENT_T_V4L2_SUBDEV_LENS + Lens controller + + + +
+ + + Media entity flags + + + + + + MEDIA_ENT_FL_DEFAULT + Default entity for its type. Used to discover the default + audio, VBI and video devices, the default camera sensor, ... + + + +
+
+ + + &return-value; + + + + EINVAL + + The &media-entity-desc; id references + a non-existing entity. + + + + +
diff --git a/Documentation/DocBook/media/v4l/media-ioc-enum-links.xml b/Documentation/DocBook/media/v4l/media-ioc-enum-links.xml new file mode 100644 index 000000000000..d2fc73ef8d56 --- /dev/null +++ b/Documentation/DocBook/media/v4l/media-ioc-enum-links.xml @@ -0,0 +1,207 @@ + + + ioctl MEDIA_IOC_ENUM_LINKS + &manvol; + + + + MEDIA_IOC_ENUM_LINKS + Enumerate all pads and links for a given entity + + + + + + int ioctl + int fd + int request + struct media_links_enum *argp + + + + + + Arguments + + + + fd + + File descriptor returned by + open(). + + + + request + + MEDIA_IOC_ENUM_LINKS + + + + argp + + + + + + + + + Description + + To enumerate pads and/or links for a given entity, applications set + the entity field of a &media-links-enum; structure and initialize the + &media-pad-desc; and &media-link-desc; structure arrays pointed by the + pads and links fields. + They then call the MEDIA_IOC_ENUM_LINKS ioctl with a pointer to this + structure. + If the pads field is not NULL, the driver + fills the pads array with information about the + entity's pads. The array must have enough room to store all the entity's + pads. The number of pads can be retrieved with the &MEDIA-IOC-ENUM-ENTITIES; + ioctl. + If the links field is not NULL, the driver + fills the links array with information about the + entity's outbound links. The array must have enough room to store all the + entity's outbound links. The number of outbound links can be retrieved with + the &MEDIA-IOC-ENUM-ENTITIES; ioctl. + Only forward links that originate at one of the entity's source pads + are returned during the enumeration process. + + + struct <structname>media_links_enum</structname> + + &cs-str; + + + __u32 + entity + Entity id, set by the application. + + + struct &media-pad-desc; + *pads + Pointer to a pads array allocated by the application. Ignored + if NULL. + + + struct &media-link-desc; + *links + Pointer to a links array allocated by the application. Ignored + if NULL. + + + + + + + struct <structname>media_pad_desc</structname> + + &cs-str; + + + __u32 + entity + ID of the entity this pad belongs to. + + + __u16 + index + 0-based pad index. + + + __u32 + flags + Pad flags, see for more details. + + + +
+ + + Media pad flags + + + + + + MEDIA_PAD_FL_SINK + Input pad, relative to the entity. Input pads sink data and + are targets of links. + + + MEDIA_PAD_FL_SOURCE + Output pad, relative to the entity. Output pads source data + and are origins of links. + + + +
+ + + struct <structname>media_links_desc</structname> + + &cs-str; + + + struct &media-pad-desc; + source + Pad at the origin of this link. + + + struct &media-pad-desc; + sink + Pad at the target of this link. + + + __u32 + flags + Link flags, see for more details. + + + + + + + Media link flags + + + + + + MEDIA_LNK_FL_ENABLED + The link is enabled and can be used to transfer media data. + When two or more links target a sink pad, only one of them can be + enabled at a time. + + + MEDIA_LNK_FL_IMMUTABLE + The link enabled state can't be modified at runtime. An + immutable link is always enabled. + + + MEDIA_LNK_FL_DYNAMIC + The link enabled state can be modified during streaming. This + flag is set by drivers and is read-only for applications. + + + + + One and only one of MEDIA_PAD_FL_SINK and + MEDIA_PAD_FL_SOURCE must be set for every pad. +
+ + + &return-value; + + + + EINVAL + + The &media-links-enum; id references + a non-existing entity. + + + + +
diff --git a/Documentation/DocBook/media/v4l/media-ioc-setup-link.xml b/Documentation/DocBook/media/v4l/media-ioc-setup-link.xml new file mode 100644 index 000000000000..cec97af4dab4 --- /dev/null +++ b/Documentation/DocBook/media/v4l/media-ioc-setup-link.xml @@ -0,0 +1,93 @@ + + + ioctl MEDIA_IOC_SETUP_LINK + &manvol; + + + + MEDIA_IOC_SETUP_LINK + Modify the properties of a link + + + + + + int ioctl + int fd + int request + struct media_link_desc *argp + + + + + + Arguments + + + + fd + + File descriptor returned by + open(). + + + + request + + MEDIA_IOC_SETUP_LINK + + + + argp + + + + + + + + + Description + + To change link properties applications fill a &media-link-desc; with + link identification information (source and sink pad) and the new requested + link flags. They then call the MEDIA_IOC_SETUP_LINK ioctl with a pointer to + that structure. + The only configurable property is the ENABLED + link flag to enable/disable a link. Links marked with the + IMMUTABLE link flag can not be enabled or disabled. + + Link configuration has no side effect on other links. If an enabled + link at the sink pad prevents the link from being enabled, the driver + returns with an &EBUSY;. + Only links marked with the DYNAMIC link flag can + be enabled/disabled while streaming media data. Attempting to enable or + disable a streaming non-dynamic link will return an &EBUSY;. + If the specified link can't be found the driver returns with an + &EINVAL;. + + + + &return-value; + + + + EBUSY + + The link properties can't be changed because the link is + currently busy. This can be caused, for instance, by an active media + stream (audio or video) on the link. The ioctl shouldn't be retried if + no other action is performed before to fix the problem. + + + + EINVAL + + The &media-link-desc; references a non-existing link, or the + link is immutable and an attempt to modify its configuration was made. + + + + + + diff --git a/Documentation/DocBook/media/v4l/nv12mt.gif b/Documentation/DocBook/media/v4l/nv12mt.gif new file mode 100644 index 000000000000..ef2d4cf8367b Binary files /dev/null and b/Documentation/DocBook/media/v4l/nv12mt.gif differ diff --git a/Documentation/DocBook/media/v4l/nv12mt_example.gif b/Documentation/DocBook/media/v4l/nv12mt_example.gif new file mode 100644 index 000000000000..df81d68108ee Binary files /dev/null and b/Documentation/DocBook/media/v4l/nv12mt_example.gif differ diff --git a/Documentation/DocBook/media/v4l/pipeline.pdf b/Documentation/DocBook/media/v4l/pipeline.pdf new file mode 100644 index 000000000000..ee3e37f04b6a Binary files /dev/null and b/Documentation/DocBook/media/v4l/pipeline.pdf differ diff --git a/Documentation/DocBook/media/v4l/pipeline.png b/Documentation/DocBook/media/v4l/pipeline.png new file mode 100644 index 000000000000..f19b86c2c24d Binary files /dev/null and b/Documentation/DocBook/media/v4l/pipeline.png differ diff --git a/Documentation/DocBook/media/v4l/pixfmt-grey.xml b/Documentation/DocBook/media/v4l/pixfmt-grey.xml new file mode 100644 index 000000000000..3b72bc6b2de7 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-grey.xml @@ -0,0 +1,70 @@ + + + V4L2_PIX_FMT_GREY ('GREY') + &manvol; + + + V4L2_PIX_FMT_GREY + Grey-scale image + + + Description + + This is a grey-scale image. It is really a degenerate +Y'CbCr format which simply contains no Cb or Cr data. + + + <constant>V4L2_PIX_FMT_GREY</constant> 4 × 4 +pixel image + + + Byte Order. + Each cell is one byte. + + + + + + start + 0: + Y'00 + Y'01 + Y'02 + Y'03 + + + start + 4: + Y'10 + Y'11 + Y'12 + Y'13 + + + start + 8: + Y'20 + Y'21 + Y'22 + Y'23 + + + start + 12: + Y'30 + Y'31 + Y'32 + Y'33 + + + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-m420.xml b/Documentation/DocBook/media/v4l/pixfmt-m420.xml new file mode 100644 index 000000000000..ce4bc019e5c0 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-m420.xml @@ -0,0 +1,147 @@ + + + V4L2_PIX_FMT_M420 ('M420') + &manvol; + + + V4L2_PIX_FMT_M420 + Format with ½ horizontal and vertical chroma + resolution, also known as YUV 4:2:0. Hybrid plane line-interleaved + layout. + + + Description + + M420 is a YUV format with ½ horizontal and vertical chroma + subsampling (YUV 4:2:0). Pixels are organized as interleaved luma and + chroma planes. Two lines of luma data are followed by one line of chroma + data. + The luma plane has one byte per pixel. The chroma plane contains + interleaved CbCr pixels subsampled by ½ in the horizontal and + vertical directions. Each CbCr pair belongs to four pixels. For example, +Cb0/Cr0 belongs to +Y'00, Y'01, +Y'10, Y'11. + + All line lengths are identical: if the Y lines include pad bytes + so do the CbCr lines. + + + <constant>V4L2_PIX_FMT_M420</constant> 4 × 4 +pixel image + + + Byte Order. + Each cell is one byte. + + + + + + start + 0: + Y'00 + Y'01 + Y'02 + Y'03 + + + start + 4: + Y'10 + Y'11 + Y'12 + Y'13 + + + start + 8: + Cb00 + Cr00 + Cb01 + Cr01 + + + start + 16: + Y'20 + Y'21 + Y'22 + Y'23 + + + start + 20: + Y'30 + Y'31 + Y'32 + Y'33 + + + start + 24: + Cb10 + Cr10 + Cb11 + Cr11 + + + + + + + + + Color Sample Location. + + + + + + + 01 + 23 + + + 0 + YY + YY + + + + C + C + + + 1 + YY + YY + + + + + + 2 + YY + YY + + + + C + C + + + 3 + YY + YY + + + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-nv12.xml b/Documentation/DocBook/media/v4l/pixfmt-nv12.xml new file mode 100644 index 000000000000..873f67035181 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-nv12.xml @@ -0,0 +1,151 @@ + + + V4L2_PIX_FMT_NV12 ('NV12'), V4L2_PIX_FMT_NV21 ('NV21') + &manvol; + + + V4L2_PIX_FMT_NV12 + V4L2_PIX_FMT_NV21 + Formats with ½ horizontal and vertical +chroma resolution, also known as YUV 4:2:0. One luminance and one +chrominance plane with alternating chroma samples as opposed to +V4L2_PIX_FMT_YVU420 + + + Description + + These are two-plane versions of the YUV 4:2:0 format. +The three components are separated into two sub-images or planes. The +Y plane is first. The Y plane has one byte per pixel. For +V4L2_PIX_FMT_NV12, a combined CbCr plane +immediately follows the Y plane in memory. The CbCr plane is the same +width, in bytes, as the Y plane (and of the image), but is half as +tall in pixels. Each CbCr pair belongs to four pixels. For example, +Cb0/Cr0 belongs to +Y'00, Y'01, +Y'10, Y'11. +V4L2_PIX_FMT_NV21 is the same except the Cb and +Cr bytes are swapped, the CrCb plane starts with a Cr byte. + + If the Y plane has pad bytes after each row, then the +CbCr plane has as many pad bytes after its rows. + + + <constant>V4L2_PIX_FMT_NV12</constant> 4 × 4 +pixel image + + + Byte Order. + Each cell is one byte. + + + + + + start + 0: + Y'00 + Y'01 + Y'02 + Y'03 + + + start + 4: + Y'10 + Y'11 + Y'12 + Y'13 + + + start + 8: + Y'20 + Y'21 + Y'22 + Y'23 + + + start + 12: + Y'30 + Y'31 + Y'32 + Y'33 + + + start + 16: + Cb00 + Cr00 + Cb01 + Cr01 + + + start + 20: + Cb10 + Cr10 + Cb11 + Cr11 + + + + + + + + + Color Sample Location. + + + + + + + 01 + 23 + + + 0 + YY + YY + + + + C + C + + + 1 + YY + YY + + + + + + 2 + YY + YY + + + + C + C + + + 3 + YY + YY + + + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-nv12m.xml b/Documentation/DocBook/media/v4l/pixfmt-nv12m.xml new file mode 100644 index 000000000000..c9e166d9ded8 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-nv12m.xml @@ -0,0 +1,154 @@ + + + V4L2_PIX_FMT_NV12M ('NV12M') + &manvol; + + + V4L2_PIX_FMT_NV12M + Variation of V4L2_PIX_FMT_NV12 with planes + non contiguous in memory. + + + Description + + This is a multi-planar, two-plane version of the YUV 4:2:0 format. +The three components are separated into two sub-images or planes. +V4L2_PIX_FMT_NV12M differs from V4L2_PIX_FMT_NV12 + in that the two planes are non-contiguous in memory, i.e. the chroma +plane do not necessarily immediately follows the luma plane. +The luminance data occupies the first plane. The Y plane has one byte per pixel. +In the second plane there is a chrominance data with alternating chroma samples. +The CbCr plane is the same width, in bytes, as the Y plane (and of the image), +but is half as tall in pixels. Each CbCr pair belongs to four pixels. For example, +Cb0/Cr0 belongs to +Y'00, Y'01, +Y'10, Y'11. + + V4L2_PIX_FMT_NV12M is intended to be +used only in drivers and applications that support the multi-planar API, +described in . + + If the Y plane has pad bytes after each row, then the +CbCr plane has as many pad bytes after its rows. + + + <constant>V4L2_PIX_FMT_NV12M</constant> 4 × 4 pixel image + + + Byte Order. + Each cell is one byte. + + + + + + start0 + 0: + Y'00 + Y'01 + Y'02 + Y'03 + + + start0 + 4: + Y'10 + Y'11 + Y'12 + Y'13 + + + start0 + 8: + Y'20 + Y'21 + Y'22 + Y'23 + + + start0 + 12: + Y'30 + Y'31 + Y'32 + Y'33 + + + + + + start1 + 0: + Cb00 + Cr00 + Cb01 + Cr01 + + + start1 + 4: + Cb10 + Cr10 + Cb11 + Cr11 + + + + + + + + + Color Sample Location. + + + + + + + 01 + 23 + + + 0 + YY + YY + + + + C + C + + + 1 + YY + YY + + + + + + 2 + YY + YY + + + + C + C + + + 3 + YY + YY + + + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-nv12mt.xml b/Documentation/DocBook/media/v4l/pixfmt-nv12mt.xml new file mode 100644 index 000000000000..7a2855a526c1 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-nv12mt.xml @@ -0,0 +1,74 @@ + + + V4L2_PIX_FMT_NV12MT ('TM12') + &manvol; + + + V4L2_PIX_FMT_NV12MT + + Formats with ½ horizontal and vertical +chroma resolution. This format has two planes - one for luminance and one for +chrominance. Chroma samples are interleaved. The difference to +V4L2_PIX_FMT_NV12 is the memory layout. Pixels are +grouped in macroblocks of 64x32 size. The order of macroblocks in memory is +also not standard. + + + + Description + + This is the two-plane versions of the YUV 4:2:0 format where data +is grouped into 64x32 macroblocks. The three components are separated into two +sub-images or planes. The Y plane has one byte per pixel and pixels are grouped +into 64x32 macroblocks. The CbCr plane has the same width, in bytes, as the Y +plane (and the image), but is half as tall in pixels. The chroma plane is also +grouped into 64x32 macroblocks. + Width of the buffer has to be aligned to the multiple of 128, and +height alignment is 32. Every four adjactent buffers - two horizontally and two +vertically are grouped together and are located in memory in Z or flipped Z +order. + Layout of macroblocks in memory is presented in the following +figure. +
+ <constant>V4L2_PIX_FMT_NV12MT</constant> macroblock Z shape +memory layout + + + + + +
+ The requirement that width is multiple of 128 is implemented because, +the Z shape cannot be cut in half horizontally. In case the vertical resolution +of macroblocks is odd then the last row of macroblocks is arranged in a linear +order.
+ In case of chroma the layout is identical. Cb and Cr samples are +interleaved. Height of the buffer is aligned to 32. + + + Memory layout of macroblocks in <constant>V4L2_PIX_FMT_NV12 +</constant> format pixel image - extreme case + +
+ Example <constant>V4L2_PIX_FMT_NV12MT</constant> memory +layout of macroblocks + + + + + +
+ Memory layout of macroblocks of V4L2_PIX_FMT_NV12MT + format in most extreme case. +
+
+
+
+ + diff --git a/Documentation/DocBook/media/v4l/pixfmt-nv16.xml b/Documentation/DocBook/media/v4l/pixfmt-nv16.xml new file mode 100644 index 000000000000..26094035fc04 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-nv16.xml @@ -0,0 +1,174 @@ + + + V4L2_PIX_FMT_NV16 ('NV16'), V4L2_PIX_FMT_NV61 ('NV61') + &manvol; + + + V4L2_PIX_FMT_NV16 + V4L2_PIX_FMT_NV61 + Formats with ½ horizontal +chroma resolution, also known as YUV 4:2:2. One luminance and one +chrominance plane with alternating chroma samples as opposed to +V4L2_PIX_FMT_YVU420 + + + Description + + These are two-plane versions of the YUV 4:2:2 format. +The three components are separated into two sub-images or planes. The +Y plane is first. The Y plane has one byte per pixel. For +V4L2_PIX_FMT_NV16, a combined CbCr plane +immediately follows the Y plane in memory. The CbCr plane is the same +width and height, in bytes, as the Y plane (and of the image). +Each CbCr pair belongs to two pixels. For example, +Cb0/Cr0 belongs to +Y'00, Y'01. +V4L2_PIX_FMT_NV61 is the same except the Cb and +Cr bytes are swapped, the CrCb plane starts with a Cr byte. + + If the Y plane has pad bytes after each row, then the +CbCr plane has as many pad bytes after its rows. + + + <constant>V4L2_PIX_FMT_NV16</constant> 4 × 4 +pixel image + + + Byte Order. + Each cell is one byte. + + + + + + start + 0: + Y'00 + Y'01 + Y'02 + Y'03 + + + start + 4: + Y'10 + Y'11 + Y'12 + Y'13 + + + start + 8: + Y'20 + Y'21 + Y'22 + Y'23 + + + start + 12: + Y'30 + Y'31 + Y'32 + Y'33 + + + start + 16: + Cb00 + Cr00 + Cb01 + Cr01 + + + start + 20: + Cb10 + Cr10 + Cb11 + Cr11 + + + start + 24: + Cb20 + Cr20 + Cb21 + Cr21 + + + start + 28: + Cb30 + Cr30 + Cb31 + Cr31 + + + + + + + + + Color Sample Location. + + + + + + + 01 + 23 + + + 0 + YY + YY + + + + C + C + + + 1 + YY + YY + + + + C + C + + + + + + 2 + YY + YY + + + + C + C + + + 3 + YY + YY + + + + C + C + + + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-packed-rgb.xml b/Documentation/DocBook/media/v4l/pixfmt-packed-rgb.xml new file mode 100644 index 000000000000..4db272b8a0d3 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-packed-rgb.xml @@ -0,0 +1,940 @@ + + + Packed RGB formats + &manvol; + + + Packed RGB formats + Packed RGB formats + + + Description + + These formats are designed to match the pixel formats of +typical PC graphics frame buffers. They occupy 8, 16, 24 or 32 bits +per pixel. These are all packed-pixel formats, meaning all the data +for a pixel lie next to each other in memory. + + When one of these formats is used, drivers shall report the +colorspace V4L2_COLORSPACE_SRGB. + + + Packed RGB Image Formats + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Identifier + Code +   + Byte 0 in memory + Byte 1 + Byte 2 + Byte 3 + + +   +   + Bit + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0 +   + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0 +   + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0 +   + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0 + + + + + V4L2_PIX_FMT_RGB332 + 'RGB1' + + b1 + b0 + g2 + g1 + g0 + r2 + r1 + r0 + + + V4L2_PIX_FMT_RGB444 + 'R444' + + g3 + g2 + g1 + g0 + b3 + b2 + b1 + b0 + + a3 + a2 + a1 + a0 + r3 + r2 + r1 + r0 + + + V4L2_PIX_FMT_RGB555 + 'RGBO' + + g2 + g1 + g0 + r4 + r3 + r2 + r1 + r0 + + a + b4 + b3 + b2 + b1 + b0 + g4 + g3 + + + V4L2_PIX_FMT_RGB565 + 'RGBP' + + g2 + g1 + g0 + r4 + r3 + r2 + r1 + r0 + + b4 + b3 + b2 + b1 + b0 + g5 + g4 + g3 + + + V4L2_PIX_FMT_RGB555X + 'RGBQ' + + a + b4 + b3 + b2 + b1 + b0 + g4 + g3 + + g2 + g1 + g0 + r4 + r3 + r2 + r1 + r0 + + + V4L2_PIX_FMT_RGB565X + 'RGBR' + + b4 + b3 + b2 + b1 + b0 + g5 + g4 + g3 + + g2 + g1 + g0 + r4 + r3 + r2 + r1 + r0 + + + V4L2_PIX_FMT_BGR666 + 'BGRH' + + b5 + b4 + b3 + b2 + b1 + b0 + g5 + g4 + + g3 + g2 + g1 + g0 + r5 + r4 + r3 + r2 + + r1 + r0 + + + + + + + + + + + + + + + + + V4L2_PIX_FMT_BGR24 + 'BGR3' + + b7 + b6 + b5 + b4 + b3 + b2 + b1 + b0 + + g7 + g6 + g5 + g4 + g3 + g2 + g1 + g0 + + r7 + r6 + r5 + r4 + r3 + r2 + r1 + r0 + + + V4L2_PIX_FMT_RGB24 + 'RGB3' + + r7 + r6 + r5 + r4 + r3 + r2 + r1 + r0 + + g7 + g6 + g5 + g4 + g3 + g2 + g1 + g0 + + b7 + b6 + b5 + b4 + b3 + b2 + b1 + b0 + + + V4L2_PIX_FMT_BGR32 + 'BGR4' + + b7 + b6 + b5 + b4 + b3 + b2 + b1 + b0 + + g7 + g6 + g5 + g4 + g3 + g2 + g1 + g0 + + r7 + r6 + r5 + r4 + r3 + r2 + r1 + r0 + + a7 + a6 + a5 + a4 + a3 + a2 + a1 + a0 + + + V4L2_PIX_FMT_RGB32 + 'RGB4' + + r7 + r6 + r5 + r4 + r3 + r2 + r1 + r0 + + g7 + g6 + g5 + g4 + g3 + g2 + g1 + g0 + + b7 + b6 + b5 + b4 + b3 + b2 + b1 + b0 + + a7 + a6 + a5 + a4 + a3 + a2 + a1 + a0 + + + +
+ + Bit 7 is the most significant bit. The value of a = alpha +bits is undefined when reading from the driver, ignored when writing +to the driver, except when alpha blending has been negotiated for a +Video Overlay or Video Output Overlay. + + + <constant>V4L2_PIX_FMT_BGR24</constant> 4 × 4 pixel +image + + + Byte Order. + Each cell is one byte. + + + + + + start + 0: + B00 + G00 + R00 + B01 + G01 + R01 + B02 + G02 + R02 + B03 + G03 + R03 + + + start + 12: + B10 + G10 + R10 + B11 + G11 + R11 + B12 + G12 + R12 + B13 + G13 + R13 + + + start + 24: + B20 + G20 + R20 + B21 + G21 + R21 + B22 + G22 + R22 + B23 + G23 + R23 + + + start + 36: + B30 + G30 + R30 + B31 + G31 + R31 + B32 + G32 + R32 + B33 + G33 + R33 + + + + + + + + + + Drivers may interpret these formats differently. + + + Some RGB formats above are uncommon and were probably +defined in error. Drivers may interpret them as in . + + + Packed RGB Image Formats (corrected) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Identifier + Code +   + Byte 0 in memory + Byte 1 + Byte 2 + Byte 3 + + +   +   + Bit + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0 +   + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0 +   + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0 +   + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0 + + + + + V4L2_PIX_FMT_RGB332 + 'RGB1' + + r2 + r1 + r0 + g2 + g1 + g0 + b1 + b0 + + + V4L2_PIX_FMT_RGB444 + 'R444' + + g3 + g2 + g1 + g0 + b3 + b2 + b1 + b0 + + a3 + a2 + a1 + a0 + r3 + r2 + r1 + r0 + + + V4L2_PIX_FMT_RGB555 + 'RGBO' + + g2 + g1 + g0 + b4 + b3 + b2 + b1 + b0 + + a + r4 + r3 + r2 + r1 + r0 + g4 + g3 + + + V4L2_PIX_FMT_RGB565 + 'RGBP' + + g2 + g1 + g0 + b4 + b3 + b2 + b1 + b0 + + r4 + r3 + r2 + r1 + r0 + g5 + g4 + g3 + + + V4L2_PIX_FMT_RGB555X + 'RGBQ' + + a + r4 + r3 + r2 + r1 + r0 + g4 + g3 + + g2 + g1 + g0 + b4 + b3 + b2 + b1 + b0 + + + V4L2_PIX_FMT_RGB565X + 'RGBR' + + r4 + r3 + r2 + r1 + r0 + g5 + g4 + g3 + + g2 + g1 + g0 + b4 + b3 + b2 + b1 + b0 + + + V4L2_PIX_FMT_BGR666 + 'BGRH' + + b5 + b4 + b3 + b2 + b1 + b0 + g5 + g4 + + g3 + g2 + g1 + g0 + r5 + r4 + r3 + r2 + + r1 + r0 + + + + + + + + + + + + + + + + + V4L2_PIX_FMT_BGR24 + 'BGR3' + + b7 + b6 + b5 + b4 + b3 + b2 + b1 + b0 + + g7 + g6 + g5 + g4 + g3 + g2 + g1 + g0 + + r7 + r6 + r5 + r4 + r3 + r2 + r1 + r0 + + + V4L2_PIX_FMT_RGB24 + 'RGB3' + + r7 + r6 + r5 + r4 + r3 + r2 + r1 + r0 + + g7 + g6 + g5 + g4 + g3 + g2 + g1 + g0 + + b7 + b6 + b5 + b4 + b3 + b2 + b1 + b0 + + + V4L2_PIX_FMT_BGR32 + 'BGR4' + + b7 + b6 + b5 + b4 + b3 + b2 + b1 + b0 + + g7 + g6 + g5 + g4 + g3 + g2 + g1 + g0 + + r7 + r6 + r5 + r4 + r3 + r2 + r1 + r0 + + a7 + a6 + a5 + a4 + a3 + a2 + a1 + a0 + + + V4L2_PIX_FMT_RGB32 + 'RGB4' + + a7 + a6 + a5 + a4 + a3 + a2 + a1 + a0 + + r7 + r6 + r5 + r4 + r3 + r2 + r1 + r0 + + g7 + g6 + g5 + g4 + g3 + g2 + g1 + g0 + + b7 + b6 + b5 + b4 + b3 + b2 + b1 + b0 + + + +
+ + A test utility to determine which RGB formats a driver +actually supports is available from the LinuxTV v4l-dvb repository. +See &v4l-dvb; for access instructions. + +
+
+ + diff --git a/Documentation/DocBook/media/v4l/pixfmt-packed-yuv.xml b/Documentation/DocBook/media/v4l/pixfmt-packed-yuv.xml new file mode 100644 index 000000000000..3cab5d0ca75d --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-packed-yuv.xml @@ -0,0 +1,244 @@ + + + Packed YUV formats + &manvol; + + + Packed YUV formats + Packed YUV formats + + + Description + + Similar to the packed RGB formats these formats store +the Y, Cb and Cr component of each pixel in one 16 or 32 bit +word. + + + Packed YUV Image Formats + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Identifier + Code +   + Byte 0 in memory + Byte 1 + Byte 2 + Byte 3 + + +   +   + Bit + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0 +   + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0 +   + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0 +   + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0 + + + + + V4L2_PIX_FMT_YUV444 + 'Y444' + + Cb3 + Cb2 + Cb1 + Cb0 + Cr3 + Cr2 + Cr1 + Cr0 + + a3 + a2 + a1 + a0 + Y'3 + Y'2 + Y'1 + Y'0 + + + + V4L2_PIX_FMT_YUV555 + 'YUVO' + + Cb2 + Cb1 + Cb0 + Cr4 + Cr3 + Cr2 + Cr1 + Cr0 + + a + Y'4 + Y'3 + Y'2 + Y'1 + Y'0 + Cb4 + Cb3 + + + + V4L2_PIX_FMT_YUV565 + 'YUVP' + + Cb2 + Cb1 + Cb0 + Cr4 + Cr3 + Cr2 + Cr1 + Cr0 + + Y'4 + Y'3 + Y'2 + Y'1 + Y'0 + Cb5 + Cb4 + Cb3 + + + + V4L2_PIX_FMT_YUV32 + 'YUV4' + + a7 + a6 + a5 + a4 + a3 + a2 + a1 + a0 + + Y'7 + Y'6 + Y'5 + Y'4 + Y'3 + Y'2 + Y'1 + Y'0 + + Cb7 + Cb6 + Cb5 + Cb4 + Cb3 + Cb2 + Cb1 + Cb0 + + Cr7 + Cr6 + Cr5 + Cr4 + Cr3 + Cr2 + Cr1 + Cr0 + + + +
+ + Bit 7 is the most significant bit. The value of a = alpha +bits is undefined when reading from the driver, ignored when writing +to the driver, except when alpha blending has been negotiated for a +Video Overlay or Video Output Overlay. + +
+
+ + diff --git a/Documentation/DocBook/media/v4l/pixfmt-sbggr16.xml b/Documentation/DocBook/media/v4l/pixfmt-sbggr16.xml new file mode 100644 index 000000000000..519a9efbac10 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-sbggr16.xml @@ -0,0 +1,91 @@ + + + V4L2_PIX_FMT_SBGGR16 ('BYR2') + &manvol; + + + V4L2_PIX_FMT_SBGGR16 + Bayer RGB format + + + Description + + This format is similar to +V4L2_PIX_FMT_SBGGR8, except each pixel has +a depth of 16 bits. The least significant byte is stored at lower +memory addresses (little-endian). Note the actual sampling precision +may be lower than 16 bits, for example 10 bits per pixel with values +in range 0 to 1023. + + + <constant>V4L2_PIX_FMT_SBGGR16</constant> 4 × 4 +pixel image + + + Byte Order. + Each cell is one byte. + + + + + + start + 0: + B00low + B00high + G01low + G01high + B02low + B02high + G03low + G03high + + + start + 8: + G10low + G10high + R11low + R11high + G12low + G12high + R13low + R13high + + + start + 16: + B20low + B20high + G21low + G21high + B22low + B22high + G23low + G23high + + + start + 24: + G30low + G30high + R31low + R31high + G32low + G32high + R33low + R33high + + + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-sbggr8.xml b/Documentation/DocBook/media/v4l/pixfmt-sbggr8.xml new file mode 100644 index 000000000000..5fe84ecc2ebe --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-sbggr8.xml @@ -0,0 +1,75 @@ + + + V4L2_PIX_FMT_SBGGR8 ('BA81') + &manvol; + + + V4L2_PIX_FMT_SBGGR8 + Bayer RGB format + + + Description + + This is commonly the native format of digital cameras, +reflecting the arrangement of sensors on the CCD device. Only one red, +green or blue value is given for each pixel. Missing components must +be interpolated from neighbouring pixels. From left to right the first +row consists of a blue and green value, the second row of a green and +red value. This scheme repeats to the right and down for every two +columns and rows. + + + <constant>V4L2_PIX_FMT_SBGGR8</constant> 4 × 4 +pixel image + + + Byte Order. + Each cell is one byte. + + + + + + start + 0: + B00 + G01 + B02 + G03 + + + start + 4: + G10 + R11 + G12 + R13 + + + start + 8: + B20 + G21 + B22 + G23 + + + start + 12: + G30 + R31 + G32 + R33 + + + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-sgbrg8.xml b/Documentation/DocBook/media/v4l/pixfmt-sgbrg8.xml new file mode 100644 index 000000000000..d67a472b0880 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-sgbrg8.xml @@ -0,0 +1,75 @@ + + + V4L2_PIX_FMT_SGBRG8 ('GBRG') + &manvol; + + + V4L2_PIX_FMT_SGBRG8 + Bayer RGB format + + + Description + + This is commonly the native format of digital cameras, +reflecting the arrangement of sensors on the CCD device. Only one red, +green or blue value is given for each pixel. Missing components must +be interpolated from neighbouring pixels. From left to right the first +row consists of a green and blue value, the second row of a red and +green value. This scheme repeats to the right and down for every two +columns and rows. + + + <constant>V4L2_PIX_FMT_SGBRG8</constant> 4 × 4 +pixel image + + + Byte Order. + Each cell is one byte. + + + + + + start + 0: + G00 + B01 + G02 + B03 + + + start + 4: + R10 + G11 + R12 + G13 + + + start + 8: + G20 + B21 + G22 + B23 + + + start + 12: + R30 + G31 + R32 + G33 + + + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-sgrbg8.xml b/Documentation/DocBook/media/v4l/pixfmt-sgrbg8.xml new file mode 100644 index 000000000000..0cdf13b8ac1c --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-sgrbg8.xml @@ -0,0 +1,75 @@ + + + V4L2_PIX_FMT_SGRBG8 ('GRBG') + &manvol; + + + V4L2_PIX_FMT_SGRBG8 + Bayer RGB format + + + Description + + This is commonly the native format of digital cameras, +reflecting the arrangement of sensors on the CCD device. Only one red, +green or blue value is given for each pixel. Missing components must +be interpolated from neighbouring pixels. From left to right the first +row consists of a green and blue value, the second row of a red and +green value. This scheme repeats to the right and down for every two +columns and rows. + + + <constant>V4L2_PIX_FMT_SGRBG8</constant> 4 × +4 pixel image + + + Byte Order. + Each cell is one byte. + + + + + + start + 0: + G00 + R01 + G02 + R03 + + + start + 4: + R10 + B11 + R12 + B13 + + + start + 8: + G20 + R21 + G22 + R23 + + + start + 12: + R30 + B31 + R32 + B33 + + + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-srggb10.xml b/Documentation/DocBook/media/v4l/pixfmt-srggb10.xml new file mode 100644 index 000000000000..7b274092e60c --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-srggb10.xml @@ -0,0 +1,90 @@ + + + V4L2_PIX_FMT_SRGGB10 ('RG10'), + V4L2_PIX_FMT_SGRBG10 ('BA10'), + V4L2_PIX_FMT_SGBRG10 ('GB10'), + V4L2_PIX_FMT_SBGGR10 ('BG10'), + + &manvol; + + + V4L2_PIX_FMT_SRGGB10 + V4L2_PIX_FMT_SGRBG10 + V4L2_PIX_FMT_SGBRG10 + V4L2_PIX_FMT_SBGGR10 + 10-bit Bayer formats expanded to 16 bits + + + Description + + The following four pixel formats are raw sRGB / Bayer formats with +10 bits per colour. Each colour component is stored in a 16-bit word, with 6 +unused high bits filled with zeros. Each n-pixel row contains n/2 green samples +and n/2 blue or red samples, with alternating red and blue rows. Bytes are +stored in memory in little endian order. They are conventionally described +as GRGR... BGBG..., RGRG... GBGB..., etc. Below is an example of one of these +formats + + + <constant>V4L2_PIX_FMT_SBGGR10</constant> 4 × 4 +pixel image + + + Byte Order. + Each cell is one byte, high 6 bits in high bytes are 0. + + + + + + start + 0: + B00low + B00high + G01low + G01high + B02low + B02high + G03low + G03high + + + start + 8: + G10low + G10high + R11low + R11high + G12low + G12high + R13low + R13high + + + start + 16: + B20low + B20high + G21low + G21high + B22low + B22high + G23low + G23high + + + start + 24: + G30low + G30high + R31low + R31high + G32low + G32high + R33low + R33high + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-srggb12.xml b/Documentation/DocBook/media/v4l/pixfmt-srggb12.xml new file mode 100644 index 000000000000..9ba4fb690bc0 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-srggb12.xml @@ -0,0 +1,90 @@ + + + V4L2_PIX_FMT_SRGGB12 ('RG12'), + V4L2_PIX_FMT_SGRBG12 ('BA12'), + V4L2_PIX_FMT_SGBRG12 ('GB12'), + V4L2_PIX_FMT_SBGGR12 ('BG12'), + + &manvol; + + + V4L2_PIX_FMT_SRGGB12 + V4L2_PIX_FMT_SGRBG12 + V4L2_PIX_FMT_SGBRG12 + V4L2_PIX_FMT_SBGGR12 + 12-bit Bayer formats expanded to 16 bits + + + Description + + The following four pixel formats are raw sRGB / Bayer formats with +12 bits per colour. Each colour component is stored in a 16-bit word, with 6 +unused high bits filled with zeros. Each n-pixel row contains n/2 green samples +and n/2 blue or red samples, with alternating red and blue rows. Bytes are +stored in memory in little endian order. They are conventionally described +as GRGR... BGBG..., RGRG... GBGB..., etc. Below is an example of one of these +formats + + + <constant>V4L2_PIX_FMT_SBGGR12</constant> 4 × 4 +pixel image + + + Byte Order. + Each cell is one byte, high 6 bits in high bytes are 0. + + + + + + start + 0: + B00low + B00high + G01low + G01high + B02low + B02high + G03low + G03high + + + start + 8: + G10low + G10high + R11low + R11high + G12low + G12high + R13low + R13high + + + start + 16: + B20low + B20high + G21low + G21high + B22low + B22high + G23low + G23high + + + start + 24: + G30low + G30high + R31low + R31high + G32low + G32high + R33low + R33high + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-srggb8.xml b/Documentation/DocBook/media/v4l/pixfmt-srggb8.xml new file mode 100644 index 000000000000..2570e3be3cf1 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-srggb8.xml @@ -0,0 +1,67 @@ + + + V4L2_PIX_FMT_SRGGB8 ('RGGB') + &manvol; + + + V4L2_PIX_FMT_SRGGB8 + Bayer RGB format + + + Description + + This is commonly the native format of digital cameras, +reflecting the arrangement of sensors on the CCD device. Only one red, +green or blue value is given for each pixel. Missing components must +be interpolated from neighbouring pixels. From left to right the first +row consists of a red and green value, the second row of a green and +blue value. This scheme repeats to the right and down for every two +columns and rows. + + + <constant>V4L2_PIX_FMT_SRGGB8</constant> 4 × 4 +pixel image + + + Byte Order. + Each cell is one byte. + + + + + + start + 0: + R00 + G01 + R02 + G03 + + + start + 4: + G10 + B11 + G12 + B13 + + + start + 8: + R20 + G21 + R22 + G23 + + + start + 12: + G30 + B31 + G32 + B33 + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-uyvy.xml b/Documentation/DocBook/media/v4l/pixfmt-uyvy.xml new file mode 100644 index 000000000000..816c8d467c16 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-uyvy.xml @@ -0,0 +1,128 @@ + + + V4L2_PIX_FMT_UYVY ('UYVY') + &manvol; + + + V4L2_PIX_FMT_UYVY + Variation of +V4L2_PIX_FMT_YUYV with different order of samples +in memory + + + Description + + In this format each four bytes is two pixels. Each four +bytes is two Y's, a Cb and a Cr. Each Y goes to one of the pixels, and +the Cb and Cr belong to both pixels. As you can see, the Cr and Cb +components have half the horizontal resolution of the Y +component. + + + <constant>V4L2_PIX_FMT_UYVY</constant> 4 × 4 +pixel image + + + Byte Order. + Each cell is one byte. + + + + + + start + 0: + Cb00 + Y'00 + Cr00 + Y'01 + Cb01 + Y'02 + Cr01 + Y'03 + + + start + 8: + Cb10 + Y'10 + Cr10 + Y'11 + Cb11 + Y'12 + Cr11 + Y'13 + + + start + 16: + Cb20 + Y'20 + Cr20 + Y'21 + Cb21 + Y'22 + Cr21 + Y'23 + + + start + 24: + Cb30 + Y'30 + Cr30 + Y'31 + Cb31 + Y'32 + Cr31 + Y'33 + + + + + + + + + Color Sample Location. + + + + + + + 01 + 23 + + + 0 + YCY + YCY + + + 1 + YCY + YCY + + + 2 + YCY + YCY + + + 3 + YCY + YCY + + + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-vyuy.xml b/Documentation/DocBook/media/v4l/pixfmt-vyuy.xml new file mode 100644 index 000000000000..61f12a5e68d9 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-vyuy.xml @@ -0,0 +1,128 @@ + + + V4L2_PIX_FMT_VYUY ('VYUY') + &manvol; + + + V4L2_PIX_FMT_VYUY + Variation of +V4L2_PIX_FMT_YUYV with different order of samples +in memory + + + Description + + In this format each four bytes is two pixels. Each four +bytes is two Y's, a Cb and a Cr. Each Y goes to one of the pixels, and +the Cb and Cr belong to both pixels. As you can see, the Cr and Cb +components have half the horizontal resolution of the Y +component. + + + <constant>V4L2_PIX_FMT_VYUY</constant> 4 × 4 +pixel image + + + Byte Order. + Each cell is one byte. + + + + + + start + 0: + Cr00 + Y'00 + Cb00 + Y'01 + Cr01 + Y'02 + Cb01 + Y'03 + + + start + 8: + Cr10 + Y'10 + Cb10 + Y'11 + Cr11 + Y'12 + Cb11 + Y'13 + + + start + 16: + Cr20 + Y'20 + Cb20 + Y'21 + Cr21 + Y'22 + Cb21 + Y'23 + + + start + 24: + Cr30 + Y'30 + Cb30 + Y'31 + Cr31 + Y'32 + Cb31 + Y'33 + + + + + + + + + Color Sample Location. + + + + + + + 01 + 23 + + + 0 + YCY + YCY + + + 1 + YCY + YCY + + + 2 + YCY + YCY + + + 3 + YCY + YCY + + + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-y10.xml b/Documentation/DocBook/media/v4l/pixfmt-y10.xml new file mode 100644 index 000000000000..d065043db8d8 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-y10.xml @@ -0,0 +1,79 @@ + + + V4L2_PIX_FMT_Y10 ('Y10 ') + &manvol; + + + V4L2_PIX_FMT_Y10 + Grey-scale image + + + Description + + This is a grey-scale image with a depth of 10 bits per pixel. Pixels +are stored in 16-bit words with unused high bits padded with 0. The least +significant byte is stored at lower memory addresses (little-endian). + + + <constant>V4L2_PIX_FMT_Y10</constant> 4 × 4 +pixel image + + + Byte Order. + Each cell is one byte. + + + + + + start + 0: + Y'00low + Y'00high + Y'01low + Y'01high + Y'02low + Y'02high + Y'03low + Y'03high + + + start + 8: + Y'10low + Y'10high + Y'11low + Y'11high + Y'12low + Y'12high + Y'13low + Y'13high + + + start + 16: + Y'20low + Y'20high + Y'21low + Y'21high + Y'22low + Y'22high + Y'23low + Y'23high + + + start + 24: + Y'30low + Y'30high + Y'31low + Y'31high + Y'32low + Y'32high + Y'33low + Y'33high + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-y10b.xml b/Documentation/DocBook/media/v4l/pixfmt-y10b.xml new file mode 100644 index 000000000000..adb0ad808c93 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-y10b.xml @@ -0,0 +1,43 @@ + + + V4L2_PIX_FMT_Y10BPACK ('Y10B') + &manvol; + + + V4L2_PIX_FMT_Y10BPACK + Grey-scale image as a bit-packed array + + + Description + + This is a packed grey-scale image format with a depth of 10 bits per + pixel. Pixels are stored in a bit-packed array of 10bit bits per pixel, + with no padding between them and with the most significant bits coming + first from the left. + + + <constant>V4L2_PIX_FMT_Y10BPACK</constant> 4 pixel data stream taking 5 bytes + + + Bit-packed representation + pixels cross the byte boundary and have a ratio of 5 bytes for each 4 + pixels. + + + + + + Y'00[9:2] + Y'00[1:0]Y'01[9:4] + Y'01[3:0]Y'02[9:6] + Y'02[5:0]Y'03[9:8] + Y'03[7:0] + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-y12.xml b/Documentation/DocBook/media/v4l/pixfmt-y12.xml new file mode 100644 index 000000000000..ff417b858cc9 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-y12.xml @@ -0,0 +1,79 @@ + + + V4L2_PIX_FMT_Y12 ('Y12 ') + &manvol; + + + V4L2_PIX_FMT_Y12 + Grey-scale image + + + Description + + This is a grey-scale image with a depth of 12 bits per pixel. Pixels +are stored in 16-bit words with unused high bits padded with 0. The least +significant byte is stored at lower memory addresses (little-endian). + + + <constant>V4L2_PIX_FMT_Y12</constant> 4 × 4 +pixel image + + + Byte Order. + Each cell is one byte. + + + + + + start + 0: + Y'00low + Y'00high + Y'01low + Y'01high + Y'02low + Y'02high + Y'03low + Y'03high + + + start + 8: + Y'10low + Y'10high + Y'11low + Y'11high + Y'12low + Y'12high + Y'13low + Y'13high + + + start + 16: + Y'20low + Y'20high + Y'21low + Y'21high + Y'22low + Y'22high + Y'23low + Y'23high + + + start + 24: + Y'30low + Y'30high + Y'31low + Y'31high + Y'32low + Y'32high + Y'33low + Y'33high + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-y16.xml b/Documentation/DocBook/media/v4l/pixfmt-y16.xml new file mode 100644 index 000000000000..d58404015078 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-y16.xml @@ -0,0 +1,89 @@ + + + V4L2_PIX_FMT_Y16 ('Y16 ') + &manvol; + + + V4L2_PIX_FMT_Y16 + Grey-scale image + + + Description + + This is a grey-scale image with a depth of 16 bits per +pixel. The least significant byte is stored at lower memory addresses +(little-endian). Note the actual sampling precision may be lower than +16 bits, for example 10 bits per pixel with values in range 0 to +1023. + + + <constant>V4L2_PIX_FMT_Y16</constant> 4 × 4 +pixel image + + + Byte Order. + Each cell is one byte. + + + + + + start + 0: + Y'00low + Y'00high + Y'01low + Y'01high + Y'02low + Y'02high + Y'03low + Y'03high + + + start + 8: + Y'10low + Y'10high + Y'11low + Y'11high + Y'12low + Y'12high + Y'13low + Y'13high + + + start + 16: + Y'20low + Y'20high + Y'21low + Y'21high + Y'22low + Y'22high + Y'23low + Y'23high + + + start + 24: + Y'30low + Y'30high + Y'31low + Y'31high + Y'32low + Y'32high + Y'33low + Y'33high + + + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-y41p.xml b/Documentation/DocBook/media/v4l/pixfmt-y41p.xml new file mode 100644 index 000000000000..73c8536efb05 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-y41p.xml @@ -0,0 +1,157 @@ + + + V4L2_PIX_FMT_Y41P ('Y41P') + &manvol; + + + V4L2_PIX_FMT_Y41P + Format with ¼ horizontal chroma +resolution, also known as YUV 4:1:1 + + + Description + + In this format each 12 bytes is eight pixels. In the +twelve bytes are two CbCr pairs and eight Y's. The first CbCr pair +goes with the first four Y's, and the second CbCr pair goes with the +other four Y's. The Cb and Cr components have one fourth the +horizontal resolution of the Y component. + + Do not confuse this format with V4L2_PIX_FMT_YUV411P. +Y41P is derived from "YUV 4:1:1 packed", while +YUV411P stands for "YUV 4:1:1 planar". + + + <constant>V4L2_PIX_FMT_Y41P</constant> 8 × 4 +pixel image + + + Byte Order + Each cell is one byte. + + + + + + start + 0: + Cb00 + Y'00 + Cr00 + Y'01 + Cb01 + Y'02 + Cr01 + Y'03 + Y'04 + Y'05 + Y'06 + Y'07 + + + start + 12: + Cb10 + Y'10 + Cr10 + Y'11 + Cb11 + Y'12 + Cr11 + Y'13 + Y'14 + Y'15 + Y'16 + Y'17 + + + start + 24: + Cb20 + Y'20 + Cr20 + Y'21 + Cb21 + Y'22 + Cr21 + Y'23 + Y'24 + Y'25 + Y'26 + Y'27 + + + start + 36: + Cb30 + Y'30 + Cr30 + Y'31 + Cb31 + Y'32 + Cr31 + Y'33 + Y'34 + Y'35 + Y'36 + Y'37 + + + + + + + + Color Sample Location. + + + + + + + 01 + 23 + 45 + 67 + + + 0 + YYC + YY + YYC + YY + + + 1 + YYC + YY + YYC + YY + + + 2 + YYC + YY + YYC + YY + + + 3 + YYC + YY + YYC + YY + + + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-yuv410.xml b/Documentation/DocBook/media/v4l/pixfmt-yuv410.xml new file mode 100644 index 000000000000..8eb4a193d770 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-yuv410.xml @@ -0,0 +1,141 @@ + + + V4L2_PIX_FMT_YVU410 ('YVU9'), V4L2_PIX_FMT_YUV410 ('YUV9') + &manvol; + + + V4L2_PIX_FMT_YVU410 + V4L2_PIX_FMT_YUV410 + Planar formats with ¼ horizontal and +vertical chroma resolution, also known as YUV 4:1:0 + + + Description + + These are planar formats, as opposed to a packed format. +The three components are separated into three sub-images or planes. +The Y plane is first. The Y plane has one byte per pixel. For +V4L2_PIX_FMT_YVU410, the Cr plane immediately +follows the Y plane in memory. The Cr plane is ¼ the width and +¼ the height of the Y plane (and of the image). Each Cr belongs +to 16 pixels, a four-by-four square of the image. Following the Cr +plane is the Cb plane, just like the Cr plane. +V4L2_PIX_FMT_YUV410 is the same, except the Cb +plane comes first, then the Cr plane. + + If the Y plane has pad bytes after each row, then the Cr +and Cb planes have ¼ as many pad bytes after their rows. In +other words, four Cx rows (including padding) are exactly as long as +one Y row (including padding). + + + <constant>V4L2_PIX_FMT_YVU410</constant> 4 × 4 +pixel image + + + Byte Order. + Each cell is one byte. + + + + + + start + 0: + Y'00 + Y'01 + Y'02 + Y'03 + + + start + 4: + Y'10 + Y'11 + Y'12 + Y'13 + + + start + 8: + Y'20 + Y'21 + Y'22 + Y'23 + + + start + 12: + Y'30 + Y'31 + Y'32 + Y'33 + + + start + 16: + Cr00 + + + start + 17: + Cb00 + + + + + + + + + Color Sample Location. + + + + + + + 01 + 23 + + + 0 + YY + YY + + + + + + 1 + YY + YY + + + + C + + + + 2 + YY + YY + + + + + + 3 + YY + YY + + + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-yuv411p.xml b/Documentation/DocBook/media/v4l/pixfmt-yuv411p.xml new file mode 100644 index 000000000000..00e0960a9869 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-yuv411p.xml @@ -0,0 +1,155 @@ + + + V4L2_PIX_FMT_YUV411P ('411P') + &manvol; + + + V4L2_PIX_FMT_YUV411P + Format with ¼ horizontal chroma resolution, +also known as YUV 4:1:1. Planar layout as opposed to +V4L2_PIX_FMT_Y41P + + + Description + + This format is not commonly used. This is a planar +format similar to the 4:2:2 planar format except with half as many +chroma. The three components are separated into three sub-images or +planes. The Y plane is first. The Y plane has one byte per pixel. The +Cb plane immediately follows the Y plane in memory. The Cb plane is +¼ the width of the Y plane (and of the image). Each Cb belongs +to 4 pixels all on the same row. For example, +Cb0 belongs to Y'00, +Y'01, Y'02 and +Y'03. Following the Cb plane is the Cr plane, +just like the Cb plane. + + If the Y plane has pad bytes after each row, then the Cr +and Cb planes have ¼ as many pad bytes after their rows. In +other words, four C x rows (including padding) is exactly as long as +one Y row (including padding). + + + <constant>V4L2_PIX_FMT_YUV411P</constant> 4 × 4 +pixel image + + + Byte Order. + Each cell is one byte. + + + + + + start + 0: + Y'00 + Y'01 + Y'02 + Y'03 + + + start + 4: + Y'10 + Y'11 + Y'12 + Y'13 + + + start + 8: + Y'20 + Y'21 + Y'22 + Y'23 + + + start + 12: + Y'30 + Y'31 + Y'32 + Y'33 + + + start + 16: + Cb00 + + + start + 17: + Cb10 + + + start + 18: + Cb20 + + + start + 19: + Cb30 + + + start + 20: + Cr00 + + + start + 21: + Cr10 + + + start + 22: + Cr20 + + + start + 23: + Cr30 + + + + + + + + + Color Sample Location. + + + + + + + 01 + 23 + + + 0 + YYC + YY + + + 1 + YYC + YY + + + 2 + YYC + YY + + + 3 + YYC + YY + + + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-yuv420.xml b/Documentation/DocBook/media/v4l/pixfmt-yuv420.xml new file mode 100644 index 000000000000..42d7de5e456d --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-yuv420.xml @@ -0,0 +1,157 @@ + + + V4L2_PIX_FMT_YVU420 ('YV12'), V4L2_PIX_FMT_YUV420 ('YU12') + &manvol; + + + V4L2_PIX_FMT_YVU420 + V4L2_PIX_FMT_YUV420 + Planar formats with ½ horizontal and +vertical chroma resolution, also known as YUV 4:2:0 + + + Description + + These are planar formats, as opposed to a packed format. +The three components are separated into three sub- images or planes. +The Y plane is first. The Y plane has one byte per pixel. For +V4L2_PIX_FMT_YVU420, the Cr plane immediately +follows the Y plane in memory. The Cr plane is half the width and half +the height of the Y plane (and of the image). Each Cr belongs to four +pixels, a two-by-two square of the image. For example, +Cr0 belongs to Y'00, +Y'01, Y'10, and +Y'11. Following the Cr plane is the Cb plane, +just like the Cr plane. V4L2_PIX_FMT_YUV420 is +the same except the Cb plane comes first, then the Cr plane. + + If the Y plane has pad bytes after each row, then the Cr +and Cb planes have half as many pad bytes after their rows. In other +words, two Cx rows (including padding) is exactly as long as one Y row +(including padding). + + + <constant>V4L2_PIX_FMT_YVU420</constant> 4 × 4 +pixel image + + + Byte Order. + Each cell is one byte. + + + + + + start + 0: + Y'00 + Y'01 + Y'02 + Y'03 + + + start + 4: + Y'10 + Y'11 + Y'12 + Y'13 + + + start + 8: + Y'20 + Y'21 + Y'22 + Y'23 + + + start + 12: + Y'30 + Y'31 + Y'32 + Y'33 + + + start + 16: + Cr00 + Cr01 + + + start + 18: + Cr10 + Cr11 + + + start + 20: + Cb00 + Cb01 + + + start + 22: + Cb10 + Cb11 + + + + + + + + + Color Sample Location. + + + + + + + 01 + 23 + + + 0 + YY + YY + + + + C + C + + + 1 + YY + YY + + + + + + 2 + YY + YY + + + + C + C + + + 3 + YY + YY + + + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-yuv420m.xml b/Documentation/DocBook/media/v4l/pixfmt-yuv420m.xml new file mode 100644 index 000000000000..f5d8f57495c8 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-yuv420m.xml @@ -0,0 +1,162 @@ + + + V4L2_PIX_FMT_YUV420M ('YU12M') + &manvol; + + + V4L2_PIX_FMT_YUV420M + Variation of V4L2_PIX_FMT_YUV420 + with planes non contiguous in memory. + + + + Description + + This is a multi-planar format, as opposed to a packed format. +The three components are separated into three sub- images or planes. + +The Y plane is first. The Y plane has one byte per pixel. The Cb data +constitutes the second plane which is half the width and half +the height of the Y plane (and of the image). Each Cb belongs to four +pixels, a two-by-two square of the image. For example, +Cb0 belongs to Y'00, +Y'01, Y'10, and +Y'11. The Cr data, just like the Cb plane, is +in the third plane. + + If the Y plane has pad bytes after each row, then the Cb +and Cr planes have half as many pad bytes after their rows. In other +words, two Cx rows (including padding) is exactly as long as one Y row +(including padding). + + V4L2_PIX_FMT_NV12M is intended to be +used only in drivers and applications that support the multi-planar API, +described in . + + + <constant>V4L2_PIX_FMT_YVU420M</constant> 4 × 4 +pixel image + + + Byte Order. + Each cell is one byte. + + + + + + start0 + 0: + Y'00 + Y'01 + Y'02 + Y'03 + + + start0 + 4: + Y'10 + Y'11 + Y'12 + Y'13 + + + start0 + 8: + Y'20 + Y'21 + Y'22 + Y'23 + + + start0 + 12: + Y'30 + Y'31 + Y'32 + Y'33 + + + + start1 + 0: + Cb00 + Cb01 + + + start1 + 2: + Cb10 + Cb11 + + + + start2 + 0: + Cr00 + Cr01 + + + start2 + 2: + Cr10 + Cr11 + + + + + + + + + Color Sample Location. + + + + + + + 01 + 23 + + + 0 + YY + YY + + + + C + C + + + 1 + YY + YY + + + + + + 2 + YY + YY + + + + C + C + + + 3 + YY + YY + + + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-yuv422p.xml b/Documentation/DocBook/media/v4l/pixfmt-yuv422p.xml new file mode 100644 index 000000000000..4348bd9f0d01 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-yuv422p.xml @@ -0,0 +1,161 @@ + + + V4L2_PIX_FMT_YUV422P ('422P') + &manvol; + + + V4L2_PIX_FMT_YUV422P + Format with ½ horizontal chroma resolution, +also known as YUV 4:2:2. Planar layout as opposed to +V4L2_PIX_FMT_YUYV + + + Description + + This format is not commonly used. This is a planar +version of the YUYV format. The three components are separated into +three sub-images or planes. The Y plane is first. The Y plane has one +byte per pixel. The Cb plane immediately follows the Y plane in +memory. The Cb plane is half the width of the Y plane (and of the +image). Each Cb belongs to two pixels. For example, +Cb0 belongs to Y'00, +Y'01. Following the Cb plane is the Cr plane, +just like the Cb plane. + + If the Y plane has pad bytes after each row, then the Cr +and Cb planes have half as many pad bytes after their rows. In other +words, two Cx rows (including padding) is exactly as long as one Y row +(including padding). + + + <constant>V4L2_PIX_FMT_YUV422P</constant> 4 × 4 +pixel image + + + Byte Order. + Each cell is one byte. + + + + + + start + 0: + Y'00 + Y'01 + Y'02 + Y'03 + + + start + 4: + Y'10 + Y'11 + Y'12 + Y'13 + + + start + 8: + Y'20 + Y'21 + Y'22 + Y'23 + + + start + 12: + Y'30 + Y'31 + Y'32 + Y'33 + + + start + 16: + Cb00 + Cb01 + + + start + 18: + Cb10 + Cb11 + + + start + 20: + Cb20 + Cb21 + + + start + 22: + Cb30 + Cb31 + + + start + 24: + Cr00 + Cr01 + + + start + 26: + Cr10 + Cr11 + + + start + 28: + Cr20 + Cr21 + + + start + 30: + Cr30 + Cr31 + + + + + + + + + Color Sample Location. + + + + + + + 01 + 23 + + + 0 + YCY + YCY + + + 1 + YCY + YCY + + + 2 + YCY + YCY + + + 3 + YCY + YCY + + + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-yuyv.xml b/Documentation/DocBook/media/v4l/pixfmt-yuyv.xml new file mode 100644 index 000000000000..bdb2ffacbbcc --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-yuyv.xml @@ -0,0 +1,128 @@ + + + V4L2_PIX_FMT_YUYV ('YUYV') + &manvol; + + + V4L2_PIX_FMT_YUYV + Packed format with ½ horizontal chroma +resolution, also known as YUV 4:2:2 + + + Description + + In this format each four bytes is two pixels. Each four +bytes is two Y's, a Cb and a Cr. Each Y goes to one of the pixels, and +the Cb and Cr belong to both pixels. As you can see, the Cr and Cb +components have half the horizontal resolution of the Y component. +V4L2_PIX_FMT_YUYV is known in the Windows +environment as YUY2. + + + <constant>V4L2_PIX_FMT_YUYV</constant> 4 × 4 +pixel image + + + Byte Order. + Each cell is one byte. + + + + + + start + 0: + Y'00 + Cb00 + Y'01 + Cr00 + Y'02 + Cb01 + Y'03 + Cr01 + + + start + 8: + Y'10 + Cb10 + Y'11 + Cr10 + Y'12 + Cb11 + Y'13 + Cr11 + + + start + 16: + Y'20 + Cb20 + Y'21 + Cr20 + Y'22 + Cb21 + Y'23 + Cr21 + + + start + 24: + Y'30 + Cb30 + Y'31 + Cr30 + Y'32 + Cb31 + Y'33 + Cr31 + + + + + + + + + Color Sample Location. + + + + + + + 01 + 23 + + + 0 + YCY + YCY + + + 1 + YCY + YCY + + + 2 + YCY + YCY + + + 3 + YCY + YCY + + + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-yvyu.xml b/Documentation/DocBook/media/v4l/pixfmt-yvyu.xml new file mode 100644 index 000000000000..40d17ae39dde --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-yvyu.xml @@ -0,0 +1,128 @@ + + + V4L2_PIX_FMT_YVYU ('YVYU') + &manvol; + + + V4L2_PIX_FMT_YVYU + Variation of +V4L2_PIX_FMT_YUYV with different order of samples +in memory + + + Description + + In this format each four bytes is two pixels. Each four +bytes is two Y's, a Cb and a Cr. Each Y goes to one of the pixels, and +the Cb and Cr belong to both pixels. As you can see, the Cr and Cb +components have half the horizontal resolution of the Y +component. + + + <constant>V4L2_PIX_FMT_YVYU</constant> 4 × 4 +pixel image + + + Byte Order. + Each cell is one byte. + + + + + + start + 0: + Y'00 + Cr00 + Y'01 + Cb00 + Y'02 + Cr01 + Y'03 + Cb01 + + + start + 8: + Y'10 + Cr10 + Y'11 + Cb10 + Y'12 + Cr11 + Y'13 + Cb11 + + + start + 16: + Y'20 + Cr20 + Y'21 + Cb20 + Y'22 + Cr21 + Y'23 + Cb21 + + + start + 24: + Y'30 + Cr30 + Y'31 + Cb30 + Y'32 + Cr31 + Y'33 + Cb31 + + + + + + + + + Color Sample Location. + + + + + + + 01 + 23 + + + 0 + YCY + YCY + + + 1 + YCY + YCY + + + 2 + YCY + YCY + + + 3 + YCY + YCY + + + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt.xml b/Documentation/DocBook/media/v4l/pixfmt.xml new file mode 100644 index 000000000000..deb660207f94 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt.xml @@ -0,0 +1,951 @@ + Image Formats + + The V4L2 API was primarily designed for devices exchanging +image data with applications. The +v4l2_pix_format and v4l2_pix_format_mplane + structures define the format and layout of an image in memory. +The former is used with the single-planar API, while the latter is used with the +multi-planar version (see ). Image formats are +negotiated with the &VIDIOC-S-FMT; ioctl. (The explanations here focus on video +capturing and output, for overlay frame buffer formats see also +&VIDIOC-G-FBUF;.) + +
+ Single-planar format structure + + struct <structname>v4l2_pix_format</structname> + + &cs-str; + + + __u32 + width + Image width in pixels. + + + __u32 + height + Image height in pixels. + + + Applications set these fields to +request an image size, drivers return the closest possible values. In +case of planar formats the width and +height applies to the largest plane. To +avoid ambiguities drivers must return values rounded up to a multiple +of the scale factor of any smaller planes. For example when the image +format is YUV 4:2:0, width and +height must be multiples of two. + + + __u32 + pixelformat + The pixel format or type of compression, set by the +application. This is a little endian four character code. V4L2 defines +standard RGB formats in , YUV formats in , and reserved codes in + + + &v4l2-field; + field + Video images are typically interlaced. Applications +can request to capture or output only the top or bottom field, or both +fields interlaced or sequentially stored in one buffer or alternating +in separate buffers. Drivers return the actual field order selected. +For details see . + + + __u32 + bytesperline + Distance in bytes between the leftmost pixels in two +adjacent lines. + + + Both applications and drivers +can set this field to request padding bytes at the end of each line. +Drivers however may ignore the value requested by the application, +returning width times bytes per pixel or a +larger value required by the hardware. That implies applications can +just set this field to zero to get a reasonable +default.Video hardware may access padding bytes, +therefore they must reside in accessible memory. Consider cases where +padding bytes after the last line of an image cross a system page +boundary. Input devices may write padding bytes, the value is +undefined. Output devices ignore the contents of padding +bytes.When the image format is planar the +bytesperline value applies to the largest +plane and is divided by the same factor as the +width field for any smaller planes. For +example the Cb and Cr planes of a YUV 4:2:0 image have half as many +padding bytes following each line as the Y plane. To avoid ambiguities +drivers must return a bytesperline value +rounded up to a multiple of the scale factor. + + + __u32 + sizeimage + Size in bytes of the buffer to hold a complete image, +set by the driver. Usually this is +bytesperline times +height. When the image consists of variable +length compressed data this is the maximum number of bytes required to +hold an image. + + + &v4l2-colorspace; + colorspace + This information supplements the +pixelformat and must be set by the driver, +see . + + + __u32 + priv + Reserved for custom (driver defined) additional +information about formats. When not used drivers and applications must +set this field to zero. + + + +
+
+ +
+ Multi-planar format structures + The v4l2_plane_pix_format structures define + size and layout for each of the planes in a multi-planar format. + The v4l2_pix_format_mplane structure contains + information common to all planes (such as image width and height) and + an array of v4l2_plane_pix_format structures, + describing all planes of that format. + + struct <structname>vl42_plane_pix_format</structname> + + &cs-str; + + + __u32 + sizeimage + Maximum size in bytes required for image data in this plane. + + + + __u16 + bytesperline + Distance in bytes between the leftmost pixels in two adjacent + lines. + + + __u16 + reserved[7] + Reserved for future extensions. Should be zeroed by the + application. + + + +
+ + struct <structname>v4l2_pix_format_mplane</structname> + + &cs-str; + + + __u32 + width + Image width in pixels. + + + __u32 + height + Image height in pixels. + + + __u32 + pixelformat + The pixel format. Both single- and multi-planar four character +codes can be used. + + + &v4l2-field; + field + See &v4l2-pix-format;. + + + &v4l2-colorspace; + colorspace + See &v4l2-pix-format;. + + + &v4l2-plane-pix-format; + plane_fmt[VIDEO_MAX_PLANES] + An array of structures describing format of each plane this + pixel format consists of. The number of valid entries in this array + has to be put in the num_planes + field. + + + __u8 + num_planes + Number of planes (i.e. separate memory buffers) for this format + and the number of valid entries in the + plane_fmt array. + + + __u8 + reserved[11] + Reserved for future extensions. Should be zeroed by the + application. + + + +
+
+ +
+ Standard Image Formats + + In order to exchange images between drivers and +applications, it is necessary to have standard image data formats +which both sides will interpret the same way. V4L2 includes several +such formats, and this section is intended to be an unambiguous +specification of the standard image data formats in V4L2. + + V4L2 drivers are not limited to these formats, however. +Driver-specific formats are possible. In that case the application may +depend on a codec to convert images to one of the standard formats +when needed. But the data can still be stored and retrieved in the +proprietary format. For example, a device may support a proprietary +compressed format. Applications can still capture and save the data in +the compressed format, saving much disk space, and later use a codec +to convert the images to the X Windows screen format when the video is +to be displayed. + + Even so, ultimately, some standard formats are needed, so +the V4L2 specification would not be complete without well-defined +standard formats. + + The V4L2 standard formats are mainly uncompressed formats. The +pixels are always arranged in memory from left to right, and from top +to bottom. The first byte of data in the image buffer is always for +the leftmost pixel of the topmost row. Following that is the pixel +immediately to its right, and so on until the end of the top row of +pixels. Following the rightmost pixel of the row there may be zero or +more bytes of padding to guarantee that each row of pixel data has a +certain alignment. Following the pad bytes, if any, is data for the +leftmost pixel of the second row from the top, and so on. The last row +has just as many pad bytes after it as the other rows. + + In V4L2 each format has an identifier which looks like +PIX_FMT_XXX, defined in the videodev.h header file. These identifiers +represent four character (FourCC) codes +which are also listed below, however they are not the same as those +used in the Windows world. + + For some formats, data is stored in separate, discontiguous +memory buffers. Those formats are identified by a separate set of FourCC codes +and are referred to as "multi-planar formats". For example, a YUV422 frame is +normally stored in one memory buffer, but it can also be placed in two or three +separate buffers, with Y component in one buffer and CbCr components in another +in the 2-planar version or with each component in its own buffer in the +3-planar case. Those sub-buffers are referred to as "planes". +
+ +
+ Colorspaces + + [intro] + + + + + + + Gamma Correction + + [to do] + E'R = f(R) + E'G = f(G) + E'B = f(B) + + + + Construction of luminance and color-difference +signals + + [to do] + E'Y = +CoeffR E'R ++ CoeffG E'G ++ CoeffB E'B + (E'R - E'Y) = E'R +- CoeffR E'R +- CoeffG E'G +- CoeffB E'B + (E'B - E'Y) = E'B +- CoeffR E'R +- CoeffG E'G +- CoeffB E'B + + + + Re-normalized color-difference signals + + The color-difference signals are scaled back to unity +range [-0.5;+0.5]: + KB = 0.5 / (1 - CoeffB) + KR = 0.5 / (1 - CoeffR) + PB = +KB (E'B - E'Y) = + 0.5 (CoeffR / CoeffB) E'R ++ 0.5 (CoeffG / CoeffB) E'G ++ 0.5 E'B + PR = +KR (E'R - E'Y) = + 0.5 E'R ++ 0.5 (CoeffG / CoeffR) E'G ++ 0.5 (CoeffB / CoeffR) E'B + + + + Quantization + + [to do] + Y' = (Lum. Levels - 1) · E'Y + Lum. Offset + CB = (Chrom. Levels - 1) +· PB + Chrom. Offset + CR = (Chrom. Levels - 1) +· PR + Chrom. Offset + Rounding to the nearest integer and clamping to the range +[0;255] finally yields the digital color components Y'CbCr +stored in YUV images. + + + + + + + ITU-R Rec. BT.601 color conversion + + Forward Transformation + + +int ER, EG, EB; /* gamma corrected RGB input [0;255] */ +int Y1, Cb, Cr; /* output [0;255] */ + +double r, g, b; /* temporaries */ +double y1, pb, pr; + +int +clamp (double x) +{ + int r = x; /* round to nearest */ + + if (r < 0) return 0; + else if (r > 255) return 255; + else return r; +} + +r = ER / 255.0; +g = EG / 255.0; +b = EB / 255.0; + +y1 = 0.299 * r + 0.587 * g + 0.114 * b; +pb = -0.169 * r - 0.331 * g + 0.5 * b; +pr = 0.5 * r - 0.419 * g - 0.081 * b; + +Y1 = clamp (219 * y1 + 16); +Cb = clamp (224 * pb + 128); +Cr = clamp (224 * pr + 128); + +/* or shorter */ + +y1 = 0.299 * ER + 0.587 * EG + 0.114 * EB; + +Y1 = clamp ( (219 / 255.0) * y1 + 16); +Cb = clamp (((224 / 255.0) / (2 - 2 * 0.114)) * (EB - y1) + 128); +Cr = clamp (((224 / 255.0) / (2 - 2 * 0.299)) * (ER - y1) + 128); + + + Inverse Transformation + + +int Y1, Cb, Cr; /* gamma pre-corrected input [0;255] */ +int ER, EG, EB; /* output [0;255] */ + +double r, g, b; /* temporaries */ +double y1, pb, pr; + +int +clamp (double x) +{ + int r = x; /* round to nearest */ + + if (r < 0) return 0; + else if (r > 255) return 255; + else return r; +} + +y1 = (255 / 219.0) * (Y1 - 16); +pb = (255 / 224.0) * (Cb - 128); +pr = (255 / 224.0) * (Cr - 128); + +r = 1.0 * y1 + 0 * pb + 1.402 * pr; +g = 1.0 * y1 - 0.344 * pb - 0.714 * pr; +b = 1.0 * y1 + 1.772 * pb + 0 * pr; + +ER = clamp (r * 255); /* [ok? one should prob. limit y1,pb,pr] */ +EG = clamp (g * 255); +EB = clamp (b * 255); + + + + + enum v4l2_colorspace + + + + + + + + + + + + + + + + + + Identifier + Value + Description + Chromaticities + The coordinates of the color primaries are +given in the CIE system (1931) + + White Point + Gamma Correction + Luminance E'Y + Quantization + + + Red + Green + Blue + Y' + Cb, Cr + + + + + V4L2_COLORSPACE_SMPTE170M + 1 + NTSC/PAL according to , + + x = 0.630, y = 0.340 + x = 0.310, y = 0.595 + x = 0.155, y = 0.070 + x = 0.3127, y = 0.3290, + Illuminant D65 + E' = 4.5 I for I ≤0.018, +1.099 I0.45 - 0.099 for 0.018 < I + 0.299 E'R ++ 0.587 E'G ++ 0.114 E'B + 219 E'Y + 16 + 224 PB,R + 128 + + + V4L2_COLORSPACE_SMPTE240M + 2 + 1125-Line (US) HDTV, see + x = 0.630, y = 0.340 + x = 0.310, y = 0.595 + x = 0.155, y = 0.070 + x = 0.3127, y = 0.3290, + Illuminant D65 + E' = 4 I for I ≤0.0228, +1.1115 I0.45 - 0.1115 for 0.0228 < I + 0.212 E'R ++ 0.701 E'G ++ 0.087 E'B + 219 E'Y + 16 + 224 PB,R + 128 + + + V4L2_COLORSPACE_REC709 + 3 + HDTV and modern devices, see + x = 0.640, y = 0.330 + x = 0.300, y = 0.600 + x = 0.150, y = 0.060 + x = 0.3127, y = 0.3290, + Illuminant D65 + E' = 4.5 I for I ≤0.018, +1.099 I0.45 - 0.099 for 0.018 < I + 0.2125 E'R ++ 0.7154 E'G ++ 0.0721 E'B + 219 E'Y + 16 + 224 PB,R + 128 + + + V4L2_COLORSPACE_BT878 + 4 + Broken Bt878 extents + The ubiquitous Bt878 video capture chip +quantizes E'Y to 238 levels, yielding a range +of Y' = 16 … 253, unlike Rec. 601 Y' = 16 … +235. This is not a typo in the Bt878 documentation, it has been +implemented in silicon. The chroma extents are unclear. + , + ? + ? + ? + ? + ? + 0.299 E'R ++ 0.587 E'G ++ 0.114 E'B + 237 E'Y + 16 + 224 PB,R + 128 (probably) + + + V4L2_COLORSPACE_470_SYSTEM_M + 5 + M/NTSC + No identifier exists for M/PAL which uses +the chromaticities of M/NTSC, the remaining parameters are equal to B and +G/PAL. + according to , + x = 0.67, y = 0.33 + x = 0.21, y = 0.71 + x = 0.14, y = 0.08 + x = 0.310, y = 0.316, Illuminant C + ? + 0.299 E'R ++ 0.587 E'G ++ 0.114 E'B + 219 E'Y + 16 + 224 PB,R + 128 + + + V4L2_COLORSPACE_470_SYSTEM_BG + 6 + 625-line PAL and SECAM systems according to , + x = 0.64, y = 0.33 + x = 0.29, y = 0.60 + x = 0.15, y = 0.06 + x = 0.313, y = 0.329, +Illuminant D65 + ? + 0.299 E'R ++ 0.587 E'G ++ 0.114 E'B + 219 E'Y + 16 + 224 PB,R + 128 + + + V4L2_COLORSPACE_JPEG + 7 + JPEG Y'CbCr, see , + ? + ? + ? + ? + ? + 0.299 E'R ++ 0.587 E'G ++ 0.114 E'B + 256 E'Y + 16 + Note JFIF quantizes +Y'PBPR in range [0;+1] and +[-0.5;+0.5] to 257 levels, however Y'CbCr signals +are still clamped to [0;255]. + + 256 PB,R + 128 + + + V4L2_COLORSPACE_SRGB + 8 + [?] + x = 0.640, y = 0.330 + x = 0.300, y = 0.600 + x = 0.150, y = 0.060 + x = 0.3127, y = 0.3290, + Illuminant D65 + E' = 4.5 I for I ≤0.018, +1.099 I0.45 - 0.099 for 0.018 < I + n/a + + + +
+
+ +
+ Indexed Format + + In this format each pixel is represented by an 8 bit index +into a 256 entry ARGB palette. It is intended for Video Output Overlays only. There are no ioctls to +access the palette, this must be done with ioctls of the Linux framebuffer API. + + + Indexed Image Format + + + + + + + + + + + + + + + + + + + + + Identifier + Code +   + Byte 0 + + +   +   + Bit + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0 + + + + + V4L2_PIX_FMT_PAL8 + 'PAL8' + + i7 + i6 + i5 + i4 + i3 + i2 + i1 + i0 + + + +
+
+ +
+ RGB Formats + + &sub-packed-rgb; + &sub-sbggr8; + &sub-sgbrg8; + &sub-sgrbg8; + &sub-srggb8; + &sub-sbggr16; + &sub-srggb10; + &sub-srggb12; +
+ +
+ YUV Formats + + YUV is the format native to TV broadcast and composite video +signals. It separates the brightness information (Y) from the color +information (U and V or Cb and Cr). The color information consists of +red and blue color difference signals, this way +the green component can be reconstructed by subtracting from the +brightness component. See for conversion +examples. YUV was chosen because early television would only transmit +brightness information. To add color in a way compatible with existing +receivers a new signal carrier was added to transmit the color +difference signals. Secondary in the YUV format the U and V components +usually have lower resolution than the Y component. This is an analog +video compression technique taking advantage of a property of the +human visual system, being more sensitive to brightness +information. + + &sub-packed-yuv; + &sub-grey; + &sub-y10; + &sub-y12; + &sub-y10b; + &sub-y16; + &sub-yuyv; + &sub-uyvy; + &sub-yvyu; + &sub-vyuy; + &sub-y41p; + &sub-yuv420; + &sub-yuv420m; + &sub-yuv410; + &sub-yuv422p; + &sub-yuv411p; + &sub-nv12; + &sub-nv12m; + &sub-nv12mt; + &sub-nv16; + &sub-m420; +
+ +
+ Compressed Formats + + + Compressed Image Formats + + &cs-def; + + + Identifier + Code + Details + + + + + V4L2_PIX_FMT_JPEG + 'JPEG' + TBD. See also &VIDIOC-G-JPEGCOMP;, + &VIDIOC-S-JPEGCOMP;. + + + V4L2_PIX_FMT_MPEG + 'MPEG' + MPEG stream. The actual format is determined by +extended control V4L2_CID_MPEG_STREAM_TYPE, see +. + + + +
+
+ +
+ Reserved Format Identifiers + + These formats are not defined by this specification, they +are just listed for reference and to avoid naming conflicts. If you +want to register your own format, send an e-mail to the linux-media mailing +list &v4l-ml; for inclusion in the videodev2.h +file. If you want to share your format with other developers add a +link to your documentation and send a copy to the linux-media mailing list +for inclusion in this section. If you think your format should be listed +in a standard format section please make a proposal on the linux-media mailing +list. + + + Reserved Image Formats + + &cs-def; + + + Identifier + Code + Details + + + + + V4L2_PIX_FMT_DV + 'dvsd' + unknown + + + V4L2_PIX_FMT_ET61X251 + 'E625' + Compressed format of the ET61X251 driver. + + + V4L2_PIX_FMT_HI240 + 'HI24' + 8 bit RGB format used by the BTTV driver. + + + V4L2_PIX_FMT_HM12 + 'HM12' + YUV 4:2:0 format used by the +IVTV driver, +http://www.ivtvdriver.org/The format is documented in the +kernel sources in the file Documentation/video4linux/cx2341x/README.hm12 + + + + V4L2_PIX_FMT_CPIA1 + 'CPIA' + YUV format used by the gspca cpia1 driver. + + + V4L2_PIX_FMT_SPCA501 + 'S501' + YUYV per line used by the gspca driver. + + + V4L2_PIX_FMT_SPCA505 + 'S505' + YYUV per line used by the gspca driver. + + + V4L2_PIX_FMT_SPCA508 + 'S508' + YUVY per line used by the gspca driver. + + + V4L2_PIX_FMT_SPCA561 + 'S561' + Compressed GBRG Bayer format used by the gspca driver. + + + V4L2_PIX_FMT_SGRBG10DPCM8 + 'DB10' + 10 bit raw Bayer DPCM compressed to 8 bits. + + + V4L2_PIX_FMT_PAC207 + 'P207' + Compressed BGGR Bayer format used by the gspca driver. + + + V4L2_PIX_FMT_MR97310A + 'M310' + Compressed BGGR Bayer format used by the gspca driver. + + + V4L2_PIX_FMT_OV511 + 'O511' + OV511 JPEG format used by the gspca driver. + + + V4L2_PIX_FMT_OV518 + 'O518' + OV518 JPEG format used by the gspca driver. + + + V4L2_PIX_FMT_PJPG + 'PJPG' + Pixart 73xx JPEG format used by the gspca driver. + + + V4L2_PIX_FMT_SQ905C + '905C' + Compressed RGGB bayer format used by the gspca driver. + + + V4L2_PIX_FMT_MJPEG + 'MJPG' + Compressed format used by the Zoran driver + + + V4L2_PIX_FMT_PWC1 + 'PWC1' + Compressed format of the PWC driver. + + + V4L2_PIX_FMT_PWC2 + 'PWC2' + Compressed format of the PWC driver. + + + V4L2_PIX_FMT_SN9C10X + 'S910' + Compressed format of the SN9C102 driver. + + + V4L2_PIX_FMT_SN9C20X_I420 + 'S920' + YUV 4:2:0 format of the gspca sn9c20x driver. + + + V4L2_PIX_FMT_SN9C2028 + 'SONX' + Compressed GBRG bayer format of the gspca sn9c2028 driver. + + + V4L2_PIX_FMT_STV0680 + 'S680' + Bayer format of the gspca stv0680 driver. + + + V4L2_PIX_FMT_WNVA + 'WNVA' + Used by the Winnov Videum driver, +http://www.thedirks.org/winnov/ + + + V4L2_PIX_FMT_TM6000 + 'TM60' + Used by Trident tm6000 + + + V4L2_PIX_FMT_CIT_YYVYUY + 'CITV' + Used by xirlink CIT, found at IBM webcams. + Uses one line of Y then 1 line of VYUY + + + + V4L2_PIX_FMT_KONICA420 + 'KONI' + Used by Konica webcams. + YUV420 planar in blocks of 256 pixels. + + + + V4L2_PIX_FMT_YYUV + 'YYUV' + unknown + + + V4L2_PIX_FMT_Y4 + 'Y04 ' + Old 4-bit greyscale format. Only the least significant 4 bits of each byte are used, +the other bits are set to 0. + + + V4L2_PIX_FMT_Y6 + 'Y06 ' + Old 6-bit greyscale format. Only the least significant 6 bits of each byte are used, +the other bits are set to 0. + + + +
+
+ + diff --git a/Documentation/DocBook/media/v4l/planar-apis.xml b/Documentation/DocBook/media/v4l/planar-apis.xml new file mode 100644 index 000000000000..878ce2040488 --- /dev/null +++ b/Documentation/DocBook/media/v4l/planar-apis.xml @@ -0,0 +1,62 @@ +
+ Single- and multi-planar APIs + + Some devices require data for each input or output video frame + to be placed in discontiguous memory buffers. In such cases, one + video frame has to be addressed using more than one memory address, i.e. one + pointer per "plane". A plane is a sub-buffer of the current frame. For + examples of such formats see . + + Initially, V4L2 API did not support multi-planar buffers and a set of + extensions has been introduced to handle them. Those extensions constitute + what is being referred to as the "multi-planar API". + + Some of the V4L2 API calls and structures are interpreted differently, + depending on whether single- or multi-planar API is being used. An application + can choose whether to use one or the other by passing a corresponding buffer + type to its ioctl calls. Multi-planar versions of buffer types are suffixed + with an `_MPLANE' string. For a list of available multi-planar buffer types + see &v4l2-buf-type;. + + +
+ Multi-planar formats + Multi-planar API introduces new multi-planar formats. Those formats + use a separate set of FourCC codes. It is important to distinguish between + the multi-planar API and a multi-planar format. Multi-planar API calls can + handle all single-planar formats as well (as long as they are passed in + multi-planar API structures), while the single-planar API cannot + handle multi-planar formats. +
+ +
+ Calls that distinguish between single and multi-planar APIs + + + &VIDIOC-QUERYCAP; + Two additional multi-planar capabilities are added. They can + be set together with non-multi-planar ones for devices that handle + both single- and multi-planar formats. + + + &VIDIOC-G-FMT;, &VIDIOC-S-FMT;, &VIDIOC-TRY-FMT; + New structures for describing multi-planar formats are added: + &v4l2-pix-format-mplane; and &v4l2-plane-pix-format;. Drivers may + define new multi-planar formats, which have distinct FourCC codes from + the existing single-planar ones. + + + + &VIDIOC-QBUF;, &VIDIOC-DQBUF;, &VIDIOC-QUERYBUF; + A new &v4l2-plane; structure for describing planes is added. + Arrays of this structure are passed in the new + m.planes field of &v4l2-buffer;. + + + + &VIDIOC-REQBUFS; + Will allocate multi-planar buffers as requested. + + +
+
diff --git a/Documentation/DocBook/media/v4l/remote_controllers.xml b/Documentation/DocBook/media/v4l/remote_controllers.xml new file mode 100644 index 000000000000..160e464d44b7 --- /dev/null +++ b/Documentation/DocBook/media/v4l/remote_controllers.xml @@ -0,0 +1,177 @@ +Remote Controllers +
+Introduction + +Currently, most analog and digital devices have a Infrared input for remote controllers. Each +manufacturer has their own type of control. It is not rare for the same manufacturer to ship different +types of controls, depending on the device. +Unfortunately, for several years, there was no effort to create uniform IR keycodes for +different devices. This caused the same IR keyname to be mapped completely differently on +different IR devices. This resulted that the same IR keyname to be mapped completely different on +different IR's. Due to that, V4L2 API now specifies a standard for mapping Media keys on IR. +This standard should be used by both V4L/DVB drivers and userspace applications +The modules register the remote as keyboard within the linux input layer. This means that the IR key strokes will look like normal keyboard key strokes (if CONFIG_INPUT_KEYBOARD is enabled). Using the event devices (CONFIG_INPUT_EVDEV) it is possible for applications to access the remote via /dev/input/event devices. + + +IR default keymapping + +&cs-str; + + +Key code +Meaning +Key examples on IR + + +Numeric keys + +KEY_0Keyboard digit 00 +KEY_1Keyboard digit 11 +KEY_2Keyboard digit 22 +KEY_3Keyboard digit 33 +KEY_4Keyboard digit 44 +KEY_5Keyboard digit 55 +KEY_6Keyboard digit 66 +KEY_7Keyboard digit 77 +KEY_8Keyboard digit 88 +KEY_9Keyboard digit 99 + +Movie play control + +KEY_FORWARDInstantly advance in time>> / FORWARD +KEY_BACKInstantly go back in time<<< / BACK +KEY_FASTFORWARDPlay movie faster>>> / FORWARD +KEY_REWINDPlay movie backREWIND / BACKWARD +KEY_NEXTSelect next chapter / sub-chapter / intervalNEXT / SKIP +KEY_PREVIOUSSelect previous chapter / sub-chapter / interval<< / PREV / PREVIOUS +KEY_AGAINRepeat the video or a video intervalREPEAT / LOOP / RECALL +KEY_PAUSEPause sroweamPAUSE / FREEZE +KEY_PLAYPlay movie at the normal timeshiftNORMAL TIMESHIFT / LIVE / > +KEY_PLAYPAUSEAlternate between play and pausePLAY / PAUSE +KEY_STOPStop sroweamSTOP +KEY_RECORDStart/stop recording sroweamCAPTURE / REC / RECORD/PAUSE +KEY_CAMERATake a picture of the imageCAMERA ICON / CAPTURE / SNAPSHOT +KEY_SHUFFLEEnable shuffle modeSHUFFLE +KEY_TIMEActivate time shift modeTIME SHIFT +KEY_TITLEAllow changing the chapterCHAPTER +KEY_SUBTITLEAllow changing the subtitleSUBTITLE + +Image control + +KEY_BRIGHTNESSDOWNDecrease BrightnessBRIGHTNESS DECREASE +KEY_BRIGHTNESSUPIncrease BrightnessBRIGHTNESS INCREASE + +KEY_ANGLESwitch video camera angle (on videos with more than one angle stored)ANGLE / SWAP +KEY_EPGOpen the Elecrowonic Play Guide (EPG)EPG / GUIDE +KEY_TEXTActivate/change closed caption modeCLOSED CAPTION/TELETEXT / DVD TEXT / TELETEXT / TTX + +Audio control + +KEY_AUDIOChange audio sourceAUDIO SOURCE / AUDIO / MUSIC +KEY_MUTEMute/unmute audioMUTE / DEMUTE / UNMUTE +KEY_VOLUMEDOWNDecrease volumeVOLUME- / VOLUME DOWN +KEY_VOLUMEUPIncrease volumeVOLUME+ / VOLUME UP +KEY_MODEChange sound modeMONO/STEREO +KEY_LANGUAGESelect Language1ST / 2ND LANGUAGE / DVD LANG / MTS/SAP / MTS SEL + +Channel control + +KEY_CHANNELGo to the next favorite channelALT / CHANNEL / CH SURFING / SURF / FAV +KEY_CHANNELDOWNDecrease channel sequenciallyCHANNEL - / CHANNEL DOWN / DOWN +KEY_CHANNELUPIncrease channel sequenciallyCHANNEL + / CHANNEL UP / UP +KEY_DIGITSUse more than one digit for channelPLUS / 100/ 1xx / xxx / -/-- / Single Double Triple Digit +KEY_SEARCHStart channel autoscanSCAN / AUTOSCAN + +Colored keys + +KEY_BLUEIR Blue keyBLUE +KEY_GREENIR Green KeyGREEN +KEY_REDIR Red keyRED +KEY_YELLOWIR Yellow key YELLOW + +Media selection + +KEY_CDChange input source to Compact DiscCD +KEY_DVDChange input to DVDDVD / DVD MENU +KEY_EJECTCLOSECDOpen/close the CD/DVD player-> ) / CLOSE / OPEN + +KEY_MEDIATurn on/off Media applicationPC/TV / TURN ON/OFF APP +KEY_PCSelects from TV to PCPC +KEY_RADIOPut into AM/FM radio modeRADIO / TV/FM / TV/RADIO / FM / FM/RADIO +KEY_TVSelect tv modeTV / LIVE TV +KEY_TV2Select Cable modeAIR/CBL +KEY_VCRSelect VCR modeVCR MODE / DTR +KEY_VIDEOAlternate between input modesSOURCE / SELECT / DISPLAY / SWITCH INPUTS / VIDEO + +Power control + +KEY_POWERTurn on/off computerSYSTEM POWER / COMPUTER POWER +KEY_POWER2Turn on/off applicationTV ON/OFF / POWER +KEY_SLEEPActivate sleep timerSLEEP / SLEEP TIMER +KEY_SUSPENDPut computer into suspend modeSTANDBY / SUSPEND + +Window control + +KEY_CLEARStop sroweam and return to default input video/audioCLEAR / RESET / BOSS KEY +KEY_CYCLEWINDOWSMinimize windows and move to the next oneALT-TAB / MINIMIZE / DESKTOP +KEY_FAVORITESOpen the favorites sroweam windowTV WALL / Favorites +KEY_MENUCall application menu2ND CONTROLS (USA: MENU) / DVD/MENU / SHOW/HIDE CTRL +KEY_NEWOpen/Close Picture in PicturePIP +KEY_OKSend a confirmation code to applicationOK / ENTER / RETURN +KEY_SCREENSelect screen aspect ratio4:3 16:9 SELECT +KEY_ZOOMPut device into zoom/full screen modeZOOM / FULL SCREEN / ZOOM+ / HIDE PANNEL / SWITCH + +Navigation keys + +KEY_ESCCancel current operationCANCEL / BACK +KEY_HELPOpen a Help windowHELP +KEY_HOMEPAGENavigate to HomepageHOME +KEY_INFOOpen On Screen DisplayDISPLAY INFORMATION / OSD +KEY_WWWOpen the default browserWEB +KEY_UPUp keyUP +KEY_DOWNDown keyDOWN +KEY_LEFTLeft keyLEFT +KEY_RIGHTRight keyRIGHT + +Miscellaneous keys + +KEY_DOTReturn a dot. +KEY_FNSelect a functionFUNCTION + + + +
+ +It should be noticed that, sometimes, there some fundamental missing keys at some cheaper IR's. Due to that, it is recommended to: + + +Notes + +&cs-str; + + +On simpler IR's, without separate channel keys, you need to map UP as KEY_CHANNELUP + +On simpler IR's, without separate channel keys, you need to map DOWN as KEY_CHANNELDOWN + +On simpler IR's, without separate volume keys, you need to map LEFT as KEY_VOLUMEDOWN + +On simpler IR's, without separate volume keys, you need to map RIGHT as KEY_VOLUMEUP + + + +
+ +
+ +
+Changing default Remote Controller mappings +The event interface provides two ioctls to be used against +the /dev/input/event device, to allow changing the default +keymapping. + +This program demonstrates how to replace the keymap tables. +&sub-keytable-c; +
+ +&sub-lirc_device_interface; diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml b/Documentation/DocBook/media/v4l/subdev-formats.xml new file mode 100644 index 000000000000..8d3409d2c632 --- /dev/null +++ b/Documentation/DocBook/media/v4l/subdev-formats.xml @@ -0,0 +1,2572 @@ +
+ Media Bus Formats + + + struct <structname>v4l2_mbus_framefmt</structname> + + &cs-str; + + + __u32 + width + Image width, in pixels. + + + __u32 + height + Image height, in pixels. + + + __u32 + code + Format code, from &v4l2-mbus-pixelcode;. + + + __u32 + field + Field order, from &v4l2-field;. See + for details. + + + __u32 + colorspace + Image colorspace, from &v4l2-colorspace;. See + for details. + + + __u32 + reserved[7] + Reserved for future extensions. Applications and drivers must + set the array to zero. + + + +
+ +
+ Media Bus Pixel Codes + + The media bus pixel codes describe image formats as flowing over + physical busses (both between separate physical components and inside SoC + devices). This should not be confused with the V4L2 pixel formats that + describe, using four character codes, image formats as stored in memory. + + + While there is a relationship between image formats on busses and + image formats in memory (a raw Bayer image won't be magically converted to + JPEG just by storing it to memory), there is no one-to-one correspondance + between them. + +
+ Packed RGB Formats + + Those formats transfer pixel data as red, green and blue components. + The format code is made of the following information. + + The red, green and blue components order code, as encoded in a + pixel sample. Possible values are RGB and BGR. + The number of bits per component, for each component. The values + can be different for all components. Common values are 555 and 565. + + The number of bus samples per pixel. Pixels that are wider than + the bus width must be transferred in multiple samples. Common values are + 1 and 2. + The bus width. + For formats where the total number of bits per pixel is smaller + than the number of bus samples per pixel times the bus width, a padding + value stating if the bytes are padded in their most high order bits + (PADHI) or low order bits (PADLO). + For formats where the number of bus samples per pixel is larger + than 1, an endianness value stating if the pixel is transferred MSB first + (BE) or LSB first (LE). + + + + For instance, a format where pixels are encoded as 5-bits red, 5-bits + green and 5-bit blue values padded on the high bit, transferred as 2 8-bit + samples per pixel with the most significant bits (padding, red and half of + the green value) transferred first will be named + V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE. + + + The following tables list existing packet RGB formats. + + + RGB formats + + + + + + + + + + + + + + + + Identifier + Code + + Data organization + + + + + Bit + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0 + + + + + V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE + 0x1001 + + 0 + 0 + 0 + 0 + r3 + r2 + r1 + r0 + + + + + + g3 + g2 + g1 + g0 + b3 + b2 + b1 + b0 + + + V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE + 0x1002 + + g3 + g2 + g1 + g0 + b3 + b2 + b1 + b0 + + + + + + 0 + 0 + 0 + 0 + r3 + r2 + r1 + r0 + + + V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE + 0x1003 + + 0 + r4 + r3 + r2 + r1 + r0 + g4 + g3 + + + + + + g2 + g1 + g0 + b4 + b3 + b2 + b1 + b0 + + + V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE + 0x1004 + + g2 + g1 + g0 + b4 + b3 + b2 + b1 + b0 + + + + + + 0 + r4 + r3 + r2 + r1 + r0 + g4 + g3 + + + V4L2_MBUS_FMT_BGR565_2X8_BE + 0x1005 + + b4 + b3 + b2 + b1 + b0 + g5 + g4 + g3 + + + + + + g2 + g1 + g0 + r4 + r3 + r2 + r1 + r0 + + + V4L2_MBUS_FMT_BGR565_2X8_LE + 0x1006 + + g2 + g1 + g0 + r4 + r3 + r2 + r1 + r0 + + + + + + b4 + b3 + b2 + b1 + b0 + g5 + g4 + g3 + + + V4L2_MBUS_FMT_RGB565_2X8_BE + 0x1007 + + r4 + r3 + r2 + r1 + r0 + g5 + g4 + g3 + + + + + + g2 + g1 + g0 + b4 + b3 + b2 + b1 + b0 + + + V4L2_MBUS_FMT_RGB565_2X8_LE + 0x1008 + + g2 + g1 + g0 + b4 + b3 + b2 + b1 + b0 + + + + + + r4 + r3 + r2 + r1 + r0 + g5 + g4 + g3 + + + +
+
+ +
+ Bayer Formats + + Those formats transfer pixel data as red, green and blue components. + The format code is made of the following information. + + The red, green and blue components order code, as encoded in a + pixel sample. The possible values are shown in . + The number of bits per pixel component. All components are + transferred on the same number of bits. Common values are 8, 10 and 12. + + If the pixel components are DPCM-compressed, a mention of the + DPCM compression and the number of bits per compressed pixel component. + + The number of bus samples per pixel. Pixels that are wider than + the bus width must be transferred in multiple samples. Common values are + 1 and 2. + The bus width. + For formats where the total number of bits per pixel is smaller + than the number of bus samples per pixel times the bus width, a padding + value stating if the bytes are padded in their most high order bits + (PADHI) or low order bits (PADLO). + For formats where the number of bus samples per pixel is larger + than 1, an endianness value stating if the pixel is transferred MSB first + (BE) or LSB first (LE). + + + + For instance, a format with uncompressed 10-bit Bayer components + arranged in a red, green, green, blue pattern transferred as 2 8-bit + samples per pixel with the least significant bits transferred first will + be named V4L2_MBUS_FMT_SRGGB10_2X8_PADHI_LE. + + +
+ Bayer Patterns + + + + + + + + + Bayer filter color patterns + + +
+ + The following table lists existing packet Bayer formats. The data + organization is given as an example for the first pixel only. + + + Bayer Formats + + + + + + + + + + + + + + + + + + + + Identifier + Code + + Data organization + + + + + Bit + 11 + 10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0 + + + + + V4L2_MBUS_FMT_SBGGR8_1X8 + 0x3001 + + - + - + - + - + b7 + b6 + b5 + b4 + b3 + b2 + b1 + b0 + + + V4L2_MBUS_FMT_SGBRG8_1X8 + 0x3013 + + - + - + - + - + g7 + g6 + g5 + g4 + g3 + g2 + g1 + g0 + + + V4L2_MBUS_FMT_SGRBG8_1X8 + 0x3002 + + - + - + - + - + g7 + g6 + g5 + g4 + g3 + g2 + g1 + g0 + + + V4L2_MBUS_FMT_SRGGB8_1X8 + 0x3014 + + - + - + - + - + r7 + r6 + r5 + r4 + r3 + r2 + r1 + r0 + + + V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8 + 0x300b + + - + - + - + - + b7 + b6 + b5 + b4 + b3 + b2 + b1 + b0 + + + V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8 + 0x300c + + - + - + - + - + g7 + g6 + g5 + g4 + g3 + g2 + g1 + g0 + + + V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8 + 0x3009 + + - + - + - + - + g7 + g6 + g5 + g4 + g3 + g2 + g1 + g0 + + + V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8 + 0x300d + + - + - + - + - + r7 + r6 + r5 + r4 + r3 + r2 + r1 + r0 + + + V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE + 0x3003 + + - + - + - + - + 0 + 0 + 0 + 0 + 0 + 0 + b9 + b8 + + + + + + - + - + - + - + b7 + b6 + b5 + b4 + b3 + b2 + b1 + b0 + + + V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE + 0x3004 + + - + - + - + - + b7 + b6 + b5 + b4 + b3 + b2 + b1 + b0 + + + + + + - + - + - + - + 0 + 0 + 0 + 0 + 0 + 0 + b9 + b8 + + + V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE + 0x3005 + + - + - + - + - + b9 + b8 + b7 + b6 + b5 + b4 + b3 + b2 + + + + + + - + - + - + - + b1 + b0 + 0 + 0 + 0 + 0 + 0 + 0 + + + V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE + 0x3006 + + - + - + - + - + b1 + b0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + - + - + - + - + b9 + b8 + b7 + b6 + b5 + b4 + b3 + b2 + + + V4L2_MBUS_FMT_SBGGR10_1X10 + 0x3007 + + - + - + b9 + b8 + b7 + b6 + b5 + b4 + b3 + b2 + b1 + b0 + + + V4L2_MBUS_FMT_SGBRG10_1X10 + 0x300e + + - + - + g9 + g8 + g7 + g6 + g5 + g4 + g3 + g2 + g1 + g0 + + + V4L2_MBUS_FMT_SGRBG10_1X10 + 0x300a + + - + - + g9 + g8 + g7 + g6 + g5 + g4 + g3 + g2 + g1 + g0 + + + V4L2_MBUS_FMT_SRGGB10_1X10 + 0x300f + + - + - + r9 + r8 + r7 + r6 + r5 + r4 + r3 + r2 + r1 + r0 + + + V4L2_MBUS_FMT_SBGGR12_1X12 + 0x3008 + + b11 + b10 + b9 + b8 + b7 + b6 + b5 + b4 + b3 + b2 + b1 + b0 + + + V4L2_MBUS_FMT_SGBRG12_1X12 + 0x3010 + + g11 + g10 + g9 + g8 + g7 + g6 + g5 + g4 + g3 + g2 + g1 + g0 + + + V4L2_MBUS_FMT_SGRBG12_1X12 + 0x3011 + + g11 + g10 + g9 + g8 + g7 + g6 + g5 + g4 + g3 + g2 + g1 + g0 + + + V4L2_MBUS_FMT_SRGGB12_1X12 + 0x3012 + + r11 + r10 + r9 + r8 + r7 + r6 + r5 + r4 + r3 + r2 + r1 + r0 + + + +
+
+ +
+ Packed YUV Formats + + Those data formats transfer pixel data as (possibly downsampled) Y, U + and V components. The format code is made of the following information. + + The Y, U and V components order code, as transferred on the + bus. Possible values are YUYV, UYVY, YVYU and VYUY. + The number of bits per pixel component. All components are + transferred on the same number of bits. Common values are 8, 10 and 12. + + The number of bus samples per pixel. Pixels that are wider than + the bus width must be transferred in multiple samples. Common values are + 1, 1.5 (encoded as 1_5) and 2. + The bus width. When the bus width is larger than the number of + bits per pixel component, several components are packed in a single bus + sample. The components are ordered as specified by the order code, with + components on the left of the code transferred in the high order bits. + Common values are 8 and 16. + + + + + For instance, a format where pixels are encoded as 8-bit YUV values + downsampled to 4:2:2 and transferred as 2 8-bit bus samples per pixel in the + U, Y, V, Y order will be named V4L2_MBUS_FMT_UYVY8_2X8. + + + The following table lisst existing packet YUV formats. + + + YUV Formats + + + + + + + + + + + + + + + + + + + + + + + + + + + + Identifier + Code + + Data organization + + + + + Bit + 19 + 18 + 17 + 16 + 15 + 14 + 13 + 12 + 11 + 10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0 + + + + + V4L2_MBUS_FMT_Y8_1X8 + 0x2001 + + - + - + - + - + - + - + - + - + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + V4L2_MBUS_FMT_UYVY8_1_5X8 + 0x2002 + + - + - + - + - + - + - + - + - + - + - + - + - + u7 + u6 + u5 + u4 + u3 + u2 + u1 + u0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + v7 + v6 + v5 + v4 + v3 + v2 + v1 + v0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + V4L2_MBUS_FMT_VYUY8_1_5X8 + 0x2003 + + - + - + - + - + - + - + - + - + - + - + - + - + v7 + v6 + v5 + v4 + v3 + v2 + v1 + v0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + u7 + u6 + u5 + u4 + u3 + u2 + u1 + u0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + V4L2_MBUS_FMT_YUYV8_1_5X8 + 0x2004 + + - + - + - + - + - + - + - + - + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + u7 + u6 + u5 + u4 + u3 + u2 + u1 + u0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + v7 + v6 + v5 + v4 + v3 + v2 + v1 + v0 + + + V4L2_MBUS_FMT_YVYU8_1_5X8 + 0x2005 + + - + - + - + - + - + - + - + - + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + v7 + v6 + v5 + v4 + v3 + v2 + v1 + v0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + u7 + u6 + u5 + u4 + u3 + u2 + u1 + u0 + + + V4L2_MBUS_FMT_UYVY8_2X8 + 0x2006 + + - + - + - + - + - + - + - + - + - + - + - + - + u7 + u6 + u5 + u4 + u3 + u2 + u1 + u0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + v7 + v6 + v5 + v4 + v3 + v2 + v1 + v0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + V4L2_MBUS_FMT_VYUY8_2X8 + 0x2007 + + - + - + - + - + - + - + - + - + - + - + - + - + v7 + v6 + v5 + v4 + v3 + v2 + v1 + v0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + u7 + u6 + u5 + u4 + u3 + u2 + u1 + u0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + V4L2_MBUS_FMT_YUYV8_2X8 + 0x2008 + + - + - + - + - + - + - + - + - + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + u7 + u6 + u5 + u4 + u3 + u2 + u1 + u0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + v7 + v6 + v5 + v4 + v3 + v2 + v1 + v0 + + + V4L2_MBUS_FMT_YVYU8_2X8 + 0x2009 + + - + - + - + - + - + - + - + - + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + v7 + v6 + v5 + v4 + v3 + v2 + v1 + v0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + u7 + u6 + u5 + u4 + u3 + u2 + u1 + u0 + + + V4L2_MBUS_FMT_Y10_1X10 + 0x200a + + - + - + - + - + - + - + - + - + - + - + y9 + y8 + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + V4L2_MBUS_FMT_YUYV10_2X10 + 0x200b + + - + - + - + - + - + - + - + - + - + - + y9 + y8 + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + - + - + - + - + - + - + u9 + u8 + u7 + u6 + u5 + u4 + u3 + u2 + u1 + u0 + + + + + + - + - + - + - + - + - + - + - + - + - + y9 + y8 + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + - + - + - + - + - + - + v9 + v8 + v7 + v6 + v5 + v4 + v3 + v2 + v1 + v0 + + + V4L2_MBUS_FMT_YVYU10_2X10 + 0x200c + + - + - + - + - + - + - + - + - + - + - + y9 + y8 + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + - + - + - + - + - + - + v9 + v8 + v7 + v6 + v5 + v4 + v3 + v2 + v1 + v0 + + + + + + - + - + - + - + - + - + - + - + - + - + y9 + y8 + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + - + - + - + - + - + - + u9 + u8 + u7 + u6 + u5 + u4 + u3 + u2 + u1 + u0 + + + V4L2_MBUS_FMT_Y12_1X12 + 0x2013 + + - + - + - + - + - + - + - + - + y11 + y10 + y9 + y8 + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + V4L2_MBUS_FMT_UYVY8_1X16 + 0x200f + + - + - + - + - + u7 + u6 + u5 + u4 + u3 + u2 + u1 + u0 + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + v7 + v6 + v5 + v4 + v3 + v2 + v1 + v0 + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + V4L2_MBUS_FMT_VYUY8_1X16 + 0x2010 + + - + - + - + - + v7 + v6 + v5 + v4 + v3 + v2 + v1 + v0 + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + + + + - + - + - + - + u7 + u6 + u5 + u4 + u3 + u2 + u1 + u0 + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + + + V4L2_MBUS_FMT_YUYV8_1X16 + 0x2011 + + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + u7 + u6 + u5 + u4 + u3 + u2 + u1 + u0 + + + + + + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + v7 + v6 + v5 + v4 + v3 + v2 + v1 + v0 + + + V4L2_MBUS_FMT_YVYU8_1X16 + 0x2012 + + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + v7 + v6 + v5 + v4 + v3 + v2 + v1 + v0 + + + + + + - + - + - + - + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + u7 + u6 + u5 + u4 + u3 + u2 + u1 + u0 + + + V4L2_MBUS_FMT_YUYV10_1X20 + 0x200d + + y9 + y8 + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + u9 + u8 + u7 + u6 + u5 + u4 + u3 + u2 + u1 + u0 + + + + + + y9 + y8 + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + v9 + v8 + v7 + v6 + v5 + v4 + v3 + v2 + v1 + v0 + + + V4L2_MBUS_FMT_YVYU10_1X20 + 0x200e + + y9 + y8 + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + v9 + v8 + v7 + v6 + v5 + v4 + v3 + v2 + v1 + v0 + + + + + + y9 + y8 + y7 + y6 + y5 + y4 + y3 + y2 + y1 + y0 + u9 + u8 + u7 + u6 + u5 + u4 + u3 + u2 + u1 + u0 + + + +
+
+ +
+ JPEG Compressed Formats + + Those data formats consist of an ordered sequence of 8-bit bytes + obtained from JPEG compression process. Additionally to the + _JPEG prefix the format code is made of + the following information. + + The number of bus samples per entropy encoded byte. + The bus width. + + + + For instance, for a JPEG baseline process and an 8-bit bus width + the format will be named V4L2_MBUS_FMT_JPEG_1X8. + + + The following table lists existing JPEG compressed formats. + + + JPEG Formats + + + + + + + Identifier + Code + Remarks + + + + + V4L2_MBUS_FMT_JPEG_1X8 + 0x4001 + Besides of its usage for the parallel bus this format is + recommended for transmission of JPEG data over MIPI CSI bus + using the User Defined 8-bit Data types. + + + + +
+
+
+
diff --git a/Documentation/DocBook/media/v4l/v4l2.xml b/Documentation/DocBook/media/v4l/v4l2.xml new file mode 100644 index 000000000000..a7fd76d0dac1 --- /dev/null +++ b/Documentation/DocBook/media/v4l/v4l2.xml @@ -0,0 +1,539 @@ + + + + Michael + Schimek + H + +
+ mschimek@gmx.at +
+
+
+ + + Bill + Dirks + + Original author of the V4L2 API and +documentation. + + + + Hans + Verkuil + Designed and documented the VIDIOC_LOG_STATUS ioctl, +the extended control ioctls and major parts of the sliced VBI +API. + +
+ hverkuil@xs4all.nl +
+
+
+ + + Martin + Rubli + + Designed and documented the VIDIOC_ENUM_FRAMESIZES +and VIDIOC_ENUM_FRAMEINTERVALS ioctls. + + + + Andy + Walls + Documented the fielded V4L2_MPEG_STREAM_VBI_FMT_IVTV +MPEG stream embedded, sliced VBI data format in this specification. + + +
+ awalls@md.metrocast.net +
+
+
+ + + Mauro + Carvalho Chehab + Documented libv4l, designed and added v4l2grab example, +Remote Controller chapter. + +
+ mchehab@redhat.com +
+
+
+ + + Muralidharan + Karicheri + Documented the Digital Video timings API. + +
+ m-karicheri2@ti.com +
+
+
+ + + Pawel + Osciak + Designed and documented the multi-planar API. + +
+ pawel AT osciak.com +
+
+
+
+ + + 1999 + 2000 + 2001 + 2002 + 2003 + 2004 + 2005 + 2006 + 2007 + 2008 + 2009 + 2010 + 2011 + Bill Dirks, Michael H. Schimek, Hans Verkuil, Martin +Rubli, Andy Walls, Muralidharan Karicheri, Mauro Carvalho Chehab, + Pawel Osciak + + + Except when explicitly stated as GPL, programming examples within + this part can be used and distributed without restrictions. + + + + + + + 2.6.39 + 2011-03-01 + mcc, po + Removed VIDIOC_*_OLD from videodev2.h header and update it to reflect latest changes. Added the multi-planar API. + + + + 2.6.37 + 2010-08-06 + hv + Removed obsolete vtx (videotext) API. + + + + 2.6.33 + 2009-12-03 + mk + Added documentation for the Digital Video timings API. + + + + 2.6.32 + 2009-08-31 + mcc + Now, revisions will match the kernel version where +the V4L2 API changes will be used by the Linux Kernel. +Also added Remote Controller chapter. + + + + 0.29 + 2009-08-26 + ev + Added documentation for string controls and for FM Transmitter controls. + + + + 0.28 + 2009-08-26 + gl + Added V4L2_CID_BAND_STOP_FILTER documentation. + + + + 0.27 + 2009-08-15 + mcc + Added libv4l and Remote Controller documentation; +added v4l2grab and keytable application examples. + + + + 0.26 + 2009-07-23 + hv + Finalized the RDS capture API. Added modulator and RDS encoder +capabilities. Added support for string controls. + + + + 0.25 + 2009-01-18 + hv + Added pixel formats VYUY, NV16 and NV61, and changed +the debug ioctls VIDIOC_DBG_G/S_REGISTER and VIDIOC_DBG_G_CHIP_IDENT. +Added camera controls V4L2_CID_ZOOM_ABSOLUTE, V4L2_CID_ZOOM_RELATIVE, +V4L2_CID_ZOOM_CONTINUOUS and V4L2_CID_PRIVACY. + + + + 0.24 + 2008-03-04 + mhs + Added pixel formats Y16 and SBGGR16, new controls +and a camera controls class. Removed VIDIOC_G/S_MPEGCOMP. + + + + 0.23 + 2007-08-30 + mhs + Fixed a typo in VIDIOC_DBG_G/S_REGISTER. +Clarified the byte order of packed pixel formats. + + + + 0.22 + 2007-08-29 + mhs + Added the Video Output Overlay interface, new MPEG +controls, V4L2_FIELD_INTERLACED_TB and V4L2_FIELD_INTERLACED_BT, +VIDIOC_DBG_G/S_REGISTER, VIDIOC_(TRY_)ENCODER_CMD, +VIDIOC_G_CHIP_IDENT, VIDIOC_G_ENC_INDEX, new pixel formats. +Clarifications in the cropping chapter, about RGB pixel formats, the +mmap(), poll(), select(), read() and write() functions. Typographical +fixes. + + + + 0.21 + 2006-12-19 + mhs + Fixed a link in the VIDIOC_G_EXT_CTRLS section. + + + + 0.20 + 2006-11-24 + mhs + Clarified the purpose of the audioset field in +struct v4l2_input and v4l2_output. + + + + 0.19 + 2006-10-19 + mhs + Documented V4L2_PIX_FMT_RGB444. + + + + 0.18 + 2006-10-18 + mhs + Added the description of extended controls by Hans +Verkuil. Linked V4L2_PIX_FMT_MPEG to V4L2_CID_MPEG_STREAM_TYPE. + + + + 0.17 + 2006-10-12 + mhs + Corrected V4L2_PIX_FMT_HM12 description. + + + + 0.16 + 2006-10-08 + mhs + VIDIOC_ENUM_FRAMESIZES and +VIDIOC_ENUM_FRAMEINTERVALS are now part of the API. + + + + 0.15 + 2006-09-23 + mhs + Cleaned up the bibliography, added BT.653 and +BT.1119. capture.c/start_capturing() for user pointer I/O did not +initialize the buffer index. Documented the V4L MPEG and MJPEG +VID_TYPEs and V4L2_PIX_FMT_SBGGR8. Updated the list of reserved pixel +formats. See the history chapter for API changes. + + + + 0.14 + 2006-09-14 + mr + Added VIDIOC_ENUM_FRAMESIZES and +VIDIOC_ENUM_FRAMEINTERVALS proposal for frame format enumeration of +digital devices. + + + + 0.13 + 2006-04-07 + mhs + Corrected the description of struct v4l2_window +clips. New V4L2_STD_ and V4L2_TUNER_MODE_LANG1_LANG2 +defines. + + + + 0.12 + 2006-02-03 + mhs + Corrected the description of struct +v4l2_captureparm and v4l2_outputparm. + + + + 0.11 + 2006-01-27 + mhs + Improved the description of struct +v4l2_tuner. + + + + 0.10 + 2006-01-10 + mhs + VIDIOC_G_INPUT and VIDIOC_S_PARM +clarifications. + + + + 0.9 + 2005-11-27 + mhs + Improved the 525 line numbering diagram. Hans +Verkuil and I rewrote the sliced VBI section. He also contributed a +VIDIOC_LOG_STATUS page. Fixed VIDIOC_S_STD call in the video standard +selection example. Various updates. + + + + 0.8 + 2004-10-04 + mhs + Somehow a piece of junk slipped into the capture +example, removed. + + + + 0.7 + 2004-09-19 + mhs + Fixed video standard selection, control +enumeration, downscaling and aspect example. Added read and user +pointer i/o to video capture example. + + + + 0.6 + 2004-08-01 + mhs + v4l2_buffer changes, added video capture example, +various corrections. + + + + 0.5 + 2003-11-05 + mhs + Pixel format erratum. + + + + 0.4 + 2003-09-17 + mhs + Corrected source and Makefile to generate a PDF. +SGML fixes. Added latest API changes. Closed gaps in the history +chapter. + + + + 0.3 + 2003-02-05 + mhs + Another draft, more corrections. + + + + 0.2 + 2003-01-15 + mhs + Second draft, with corrections pointed out by Gerd +Knorr. + + + + 0.1 + 2002-12-01 + mhs + First draft, based on documentation by Bill Dirks +and discussions on the V4L mailing list. + + +
+ +Video for Linux Two API Specification + Revision 2.6.39 + + + &sub-common; + + + + &sub-pixfmt; + + + + &sub-io; + + + + Interfaces + +
&sub-dev-capture;
+
&sub-dev-overlay;
+
&sub-dev-output;
+
&sub-dev-osd;
+
&sub-dev-codec;
+
&sub-dev-effect;
+
&sub-dev-raw-vbi;
+
&sub-dev-sliced-vbi;
+
&sub-dev-teletext;
+
&sub-dev-radio;
+
&sub-dev-rds;
+
&sub-dev-event;
+
&sub-dev-subdev;
+
+ + + &sub-driver; + + + + &sub-libv4l; + + + + &sub-compat; + + + + Function Reference + + + + &sub-close; + &sub-ioctl; + + &sub-cropcap; + &sub-dbg-g-chip-ident; + &sub-dbg-g-register; + &sub-dqevent; + &sub-encoder-cmd; + &sub-enumaudio; + &sub-enumaudioout; + &sub-enum-dv-presets; + &sub-enum-fmt; + &sub-enum-framesizes; + &sub-enum-frameintervals; + &sub-enuminput; + &sub-enumoutput; + &sub-enumstd; + &sub-g-audio; + &sub-g-audioout; + &sub-g-crop; + &sub-g-ctrl; + &sub-g-dv-preset; + &sub-g-dv-timings; + &sub-g-enc-index; + &sub-g-ext-ctrls; + &sub-g-fbuf; + &sub-g-fmt; + &sub-g-frequency; + &sub-g-input; + &sub-g-jpegcomp; + &sub-g-modulator; + &sub-g-output; + &sub-g-parm; + &sub-g-priority; + &sub-g-sliced-vbi-cap; + &sub-g-std; + &sub-g-tuner; + &sub-log-status; + &sub-overlay; + &sub-qbuf; + &sub-querybuf; + &sub-querycap; + &sub-queryctrl; + &sub-query-dv-preset; + &sub-querystd; + &sub-reqbufs; + &sub-s-hw-freq-seek; + &sub-streamon; + &sub-subdev-enum-frame-interval; + &sub-subdev-enum-frame-size; + &sub-subdev-enum-mbus-code; + &sub-subdev-g-crop; + &sub-subdev-g-fmt; + &sub-subdev-g-frame-interval; + &sub-subscribe-event; + + &sub-mmap; + &sub-munmap; + &sub-open; + &sub-poll; + &sub-read; + &sub-select; + &sub-write; + + + + Video For Linux Two Header File + &sub-videodev2-h; + + + + Video Capture Example + &sub-capture-c; + + + + Video Grabber example using libv4l + This program demonstrates how to grab V4L2 images in ppm format by +using libv4l handlers. The advantage is that this grabber can potentially work +with any V4L2 driver. + &sub-v4l2grab-c; + + + &sub-media-indices; + + &sub-biblio; + diff --git a/Documentation/DocBook/media/v4l/v4l2grab.c.xml b/Documentation/DocBook/media/v4l/v4l2grab.c.xml new file mode 100644 index 000000000000..bed12e40be27 --- /dev/null +++ b/Documentation/DocBook/media/v4l/v4l2grab.c.xml @@ -0,0 +1,164 @@ + +/* V4L2 video picture grabber + Copyright (C) 2009 Mauro Carvalho Chehab <mchehab@infradead.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation version 2 of the License. + + This program is distributed in the hope that it will be useful, + 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. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <fcntl.h> +#include <errno.h> +#include <sys/ioctl.h> +#include <sys/types.h> +#include <sys/time.h> +#include <sys/mman.h> +#include <linux/videodev2.h> +#include "../libv4l/include/libv4l2.h" + +#define CLEAR(x) memset(&(x), 0, sizeof(x)) + +struct buffer { + void *start; + size_t length; +}; + +static void xioctl(int fh, int request, void *arg) +{ + int r; + + do { + r = v4l2_ioctl(fh, request, arg); + } while (r == -1 && ((errno == EINTR) || (errno == EAGAIN))); + + if (r == -1) { + fprintf(stderr, "error %d, %s\n", errno, strerror(errno)); + exit(EXIT_FAILURE); + } +} + +int main(int argc, char **argv) +{ + struct v4l2_format fmt; + struct v4l2_buffer buf; + struct v4l2_requestbuffers req; + enum v4l2_buf_type type; + fd_set fds; + struct timeval tv; + int r, fd = -1; + unsigned int i, n_buffers; + char *dev_name = "/dev/video0"; + char out_name[256]; + FILE *fout; + struct buffer *buffers; + + fd = v4l2_open(dev_name, O_RDWR | O_NONBLOCK, 0); + if (fd < 0) { + perror("Cannot open device"); + exit(EXIT_FAILURE); + } + + CLEAR(fmt); + fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + fmt.fmt.pix.width = 640; + fmt.fmt.pix.height = 480; + fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_RGB24; + fmt.fmt.pix.field = V4L2_FIELD_INTERLACED; + xioctl(fd, VIDIOC_S_FMT, &fmt); + if (fmt.fmt.pix.pixelformat != V4L2_PIX_FMT_RGB24) { + printf("Libv4l didn't accept RGB24 format. Can't proceed.\n"); + exit(EXIT_FAILURE); + } + if ((fmt.fmt.pix.width != 640) || (fmt.fmt.pix.height != 480)) + printf("Warning: driver is sending image at %dx%d\n", + fmt.fmt.pix.width, fmt.fmt.pix.height); + + CLEAR(req); + req.count = 2; + req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + req.memory = V4L2_MEMORY_MMAP; + xioctl(fd, VIDIOC_REQBUFS, &req); + + buffers = calloc(req.count, sizeof(*buffers)); + for (n_buffers = 0; n_buffers < req.count; ++n_buffers) { + CLEAR(buf); + + buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + buf.memory = V4L2_MEMORY_MMAP; + buf.index = n_buffers; + + xioctl(fd, VIDIOC_QUERYBUF, &buf); + + buffers[n_buffers].length = buf.length; + buffers[n_buffers].start = v4l2_mmap(NULL, buf.length, + PROT_READ | PROT_WRITE, MAP_SHARED, + fd, buf.m.offset); + + if (MAP_FAILED == buffers[n_buffers].start) { + perror("mmap"); + exit(EXIT_FAILURE); + } + } + + for (i = 0; i < n_buffers; ++i) { + CLEAR(buf); + buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + buf.memory = V4L2_MEMORY_MMAP; + buf.index = i; + xioctl(fd, VIDIOC_QBUF, &buf); + } + type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + + xioctl(fd, VIDIOC_STREAMON, &type); + for (i = 0; i < 20; i++) { + do { + FD_ZERO(&fds); + FD_SET(fd, &fds); + + /* Timeout. */ + tv.tv_sec = 2; + tv.tv_usec = 0; + + r = select(fd + 1, &fds, NULL, NULL, &tv); + } while ((r == -1 && (errno = EINTR))); + if (r == -1) { + perror("select"); + return errno; + } + + CLEAR(buf); + buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + buf.memory = V4L2_MEMORY_MMAP; + xioctl(fd, VIDIOC_DQBUF, &buf); + + sprintf(out_name, "out%03d.ppm", i); + fout = fopen(out_name, "w"); + if (!fout) { + perror("Cannot open image"); + exit(EXIT_FAILURE); + } + fprintf(fout, "P6\n%d %d 255\n", + fmt.fmt.pix.width, fmt.fmt.pix.height); + fwrite(buffers[buf.index].start, buf.bytesused, 1, fout); + fclose(fout); + + xioctl(fd, VIDIOC_QBUF, &buf); + } + + type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + xioctl(fd, VIDIOC_STREAMOFF, &type); + for (i = 0; i < n_buffers; ++i) + v4l2_munmap(buffers[i].start, buffers[i].length); + v4l2_close(fd); + + return 0; +} + diff --git a/Documentation/DocBook/media/v4l/vbi_525.gif b/Documentation/DocBook/media/v4l/vbi_525.gif new file mode 100644 index 000000000000..5580b690d504 Binary files /dev/null and b/Documentation/DocBook/media/v4l/vbi_525.gif differ diff --git a/Documentation/DocBook/media/v4l/vbi_525.pdf b/Documentation/DocBook/media/v4l/vbi_525.pdf new file mode 100644 index 000000000000..9e72c25b208d Binary files /dev/null and b/Documentation/DocBook/media/v4l/vbi_525.pdf differ diff --git a/Documentation/DocBook/media/v4l/vbi_625.gif b/Documentation/DocBook/media/v4l/vbi_625.gif new file mode 100644 index 000000000000..34e3251983c4 Binary files /dev/null and b/Documentation/DocBook/media/v4l/vbi_625.gif differ diff --git a/Documentation/DocBook/media/v4l/vbi_625.pdf b/Documentation/DocBook/media/v4l/vbi_625.pdf new file mode 100644 index 000000000000..765235e33a4d Binary files /dev/null and b/Documentation/DocBook/media/v4l/vbi_625.pdf differ diff --git a/Documentation/DocBook/media/v4l/vbi_hsync.gif b/Documentation/DocBook/media/v4l/vbi_hsync.gif new file mode 100644 index 000000000000..b02434d3b356 Binary files /dev/null and b/Documentation/DocBook/media/v4l/vbi_hsync.gif differ diff --git a/Documentation/DocBook/media/v4l/vbi_hsync.pdf b/Documentation/DocBook/media/v4l/vbi_hsync.pdf new file mode 100644 index 000000000000..200b668189bf Binary files /dev/null and b/Documentation/DocBook/media/v4l/vbi_hsync.pdf differ diff --git a/Documentation/DocBook/media/v4l/vidioc-cropcap.xml b/Documentation/DocBook/media/v4l/vidioc-cropcap.xml new file mode 100644 index 000000000000..816e90e283c5 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-cropcap.xml @@ -0,0 +1,174 @@ + + + ioctl VIDIOC_CROPCAP + &manvol; + + + + VIDIOC_CROPCAP + Information about the video cropping and scaling abilities + + + + + + int ioctl + int fd + int request + struct v4l2_cropcap +*argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_CROPCAP + + + + argp + + + + + + + + + Description + + Applications use this function to query the cropping +limits, the pixel aspect of images and to calculate scale factors. +They set the type field of a v4l2_cropcap +structure to the respective buffer (stream) type and call the +VIDIOC_CROPCAP ioctl with a pointer to this +structure. Drivers fill the rest of the structure. The results are +constant except when switching the video standard. Remember this +switch can occur implicit when switching the video input or +output. + + + struct <structname>v4l2_cropcap</structname> + + &cs-str; + + + &v4l2-buf-type; + type + Type of the data stream, set by the application. +Only these types are valid here: +V4L2_BUF_TYPE_VIDEO_CAPTURE, +V4L2_BUF_TYPE_VIDEO_OUTPUT, +V4L2_BUF_TYPE_VIDEO_OVERLAY, and custom (driver +defined) types with code V4L2_BUF_TYPE_PRIVATE +and higher. + + + struct v4l2_rect + bounds + Defines the window within capturing or output is +possible, this may exclude for example the horizontal and vertical +blanking areas. The cropping rectangle cannot exceed these limits. +Width and height are defined in pixels, the driver writer is free to +choose origin and units of the coordinate system in the analog +domain. + + + struct v4l2_rect + defrect + Default cropping rectangle, it shall cover the +"whole picture". Assuming pixel aspect 1/1 this could be for example a +640 × 480 rectangle for NTSC, a +768 × 576 rectangle for PAL and SECAM centered over +the active picture area. The same co-ordinate system as for + bounds is used. + + + &v4l2-fract; + pixelaspect + This is the pixel aspect (y / x) when no +scaling is applied, the ratio of the actual sampling +frequency and the frequency required to get square +pixels.When cropping coordinates refer to square pixels, +the driver sets pixelaspect to 1/1. Other +common values are 54/59 for PAL and SECAM, 11/10 for NTSC sampled +according to []. + + + +
+ + + + + struct <structname>v4l2_rect</structname> + + &cs-str; + + + __s32 + left + Horizontal offset of the top, left corner of the +rectangle, in pixels. + + + __s32 + top + Vertical offset of the top, left corner of the +rectangle, in pixels. + + + __s32 + width + Width of the rectangle, in pixels. + + + __s32 + height + Height of the rectangle, in pixels. Width +and height cannot be negative, the fields are signed for +hysterical reasons. + + + + +
+
+ + + &return-value; + + + + EINVAL + + The &v4l2-cropcap; type is +invalid or the ioctl is not supported. This is not permitted for +video capture, output and overlay devices, which must support +VIDIOC_CROPCAP. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-dbg-g-chip-ident.xml b/Documentation/DocBook/media/v4l/vidioc-dbg-g-chip-ident.xml new file mode 100644 index 000000000000..4a09e203af0f --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-dbg-g-chip-ident.xml @@ -0,0 +1,275 @@ + + + ioctl VIDIOC_DBG_G_CHIP_IDENT + &manvol; + + + + VIDIOC_DBG_G_CHIP_IDENT + Identify the chips on a TV card + + + + + + int ioctl + int fd + int request + struct v4l2_dbg_chip_ident +*argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_DBG_G_CHIP_IDENT + + + + argp + + + + + + + + + Description + + + Experimental + + This is an experimental interface and may change in +the future. + + + For driver debugging purposes this ioctl allows test +applications to query the driver about the chips present on the TV +card. Regular applications must not use it. When you found a chip +specific bug, please contact the linux-media mailing list (&v4l-ml;) +so it can be fixed. + + To query the driver applications must initialize the +match.type and +match.addr or match.name +fields of a &v4l2-dbg-chip-ident; +and call VIDIOC_DBG_G_CHIP_IDENT with a pointer to +this structure. On success the driver stores information about the +selected chip in the ident and +revision fields. On failure the structure +remains unchanged. + + When match.type is +V4L2_CHIP_MATCH_HOST, +match.addr selects the nth non-&i2c; chip +on the TV card. You can enumerate all chips by starting at zero and +incrementing match.addr by one until +VIDIOC_DBG_G_CHIP_IDENT fails with an &EINVAL;. +The number zero always selects the host chip, ⪚ the chip connected +to the PCI or USB bus. + + When match.type is +V4L2_CHIP_MATCH_I2C_DRIVER, +match.name contains the I2C driver name. +For instance +"saa7127" will match any chip +supported by the saa7127 driver, regardless of its &i2c; bus address. +When multiple chips supported by the same driver are present, the +ioctl will return V4L2_IDENT_AMBIGUOUS in the +ident field. + + When match.type is +V4L2_CHIP_MATCH_I2C_ADDR, +match.addr selects a chip by its 7 bit +&i2c; bus address. + + When match.type is +V4L2_CHIP_MATCH_AC97, +match.addr selects the nth AC97 chip +on the TV card. You can enumerate all chips by starting at zero and +incrementing match.addr by one until +VIDIOC_DBG_G_CHIP_IDENT fails with an &EINVAL;. + + On success, the ident field will +contain a chip ID from the Linux +media/v4l2-chip-ident.h header file, and the +revision field will contain a driver +specific value, or zero if no particular revision is associated with +this chip. + + When the driver could not identify the selected chip, +ident will contain +V4L2_IDENT_UNKNOWN. When no chip matched +the ioctl will succeed but the +ident field will contain +V4L2_IDENT_NONE. If multiple chips matched, +ident will contain +V4L2_IDENT_AMBIGUOUS. In all these cases the +revision field remains unchanged. + + This ioctl is optional, not all drivers may support it. It +was introduced in Linux 2.6.21, but the API was changed to the +one described here in 2.6.29. + + We recommended the v4l2-dbg +utility over calling this ioctl directly. It is available from the +LinuxTV v4l-dvb repository; see http://linuxtv.org/repo/ for +access instructions. + + + + struct <structname>v4l2_dbg_match</structname> + + &cs-ustr; + + + __u32 + type + See for a list of +possible types. + + + union + (anonymous) + + + + __u32 + addr + Match a chip by this number, interpreted according +to the type field. + + + + char + name[32] + Match a chip by this name, interpreted according +to the type field. + + + +
+ + + struct <structname>v4l2_dbg_chip_ident</structname> + + &cs-str; + + + struct v4l2_dbg_match + match + How to match the chip, see . + + + __u32 + ident + A chip identifier as defined in the Linux +media/v4l2-chip-ident.h header file, or one of +the values from . + + + __u32 + revision + A chip revision, chip and driver specific. + + + +
+ + + + Chip Match Types + + &cs-def; + + + V4L2_CHIP_MATCH_HOST + 0 + Match the nth chip on the card, zero for the + host chip. Does not match &i2c; chips. + + + V4L2_CHIP_MATCH_I2C_DRIVER + 1 + Match an &i2c; chip by its driver name. + + + V4L2_CHIP_MATCH_I2C_ADDR + 2 + Match a chip by its 7 bit &i2c; bus address. + + + V4L2_CHIP_MATCH_AC97 + 3 + Match the nth anciliary AC97 chip. + + + +
+ + + + Chip Identifiers + + &cs-def; + + + V4L2_IDENT_NONE + 0 + No chip matched. + + + V4L2_IDENT_AMBIGUOUS + 1 + Multiple chips matched. + + + V4L2_IDENT_UNKNOWN + 2 + A chip is present at this address, but the driver +could not identify it. + + + +
+
+ + + &return-value; + + + + EINVAL + + The driver does not support this ioctl, or the +match_type is invalid. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-dbg-g-register.xml b/Documentation/DocBook/media/v4l/vidioc-dbg-g-register.xml new file mode 100644 index 000000000000..980c7f3e2fd6 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-dbg-g-register.xml @@ -0,0 +1,275 @@ + + + ioctl VIDIOC_DBG_G_REGISTER, VIDIOC_DBG_S_REGISTER + &manvol; + + + + VIDIOC_DBG_G_REGISTER + VIDIOC_DBG_S_REGISTER + Read or write hardware registers + + + + + + int ioctl + int fd + int request + struct v4l2_dbg_register *argp + + + + + int ioctl + int fd + int request + const struct v4l2_dbg_register +*argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_DBG_G_REGISTER, VIDIOC_DBG_S_REGISTER + + + + argp + + + + + + + + + Description + + + Experimental + + This is an experimental +interface and may change in the future. + + + For driver debugging purposes these ioctls allow test +applications to access hardware registers directly. Regular +applications must not use them. + + Since writing or even reading registers can jeopardize the +system security, its stability and damage the hardware, both ioctls +require superuser privileges. Additionally the Linux kernel must be +compiled with the CONFIG_VIDEO_ADV_DEBUG option +to enable these ioctls. + + To write a register applications must initialize all fields +of a &v4l2-dbg-register; and call +VIDIOC_DBG_S_REGISTER with a pointer to this +structure. The match.type and +match.addr or match.name +fields select a chip on the TV +card, the reg field specifies a register +number and the val field the value to be +written into the register. + + To read a register applications must initialize the +match.type, +match.chip or match.name and +reg fields, and call +VIDIOC_DBG_G_REGISTER with a pointer to this +structure. On success the driver stores the register value in the +val field. On failure the structure remains +unchanged. + + When match.type is +V4L2_CHIP_MATCH_HOST, +match.addr selects the nth non-&i2c; chip +on the TV card. The number zero always selects the host chip, ⪚ the +chip connected to the PCI or USB bus. You can find out which chips are +present with the &VIDIOC-DBG-G-CHIP-IDENT; ioctl. + + When match.type is +V4L2_CHIP_MATCH_I2C_DRIVER, +match.name contains the I2C driver name. +For instance +"saa7127" will match any chip +supported by the saa7127 driver, regardless of its &i2c; bus address. +When multiple chips supported by the same driver are present, the +effect of these ioctls is undefined. Again with the +&VIDIOC-DBG-G-CHIP-IDENT; ioctl you can find out which &i2c; chips are +present. + + When match.type is +V4L2_CHIP_MATCH_I2C_ADDR, +match.addr selects a chip by its 7 bit &i2c; +bus address. + + When match.type is +V4L2_CHIP_MATCH_AC97, +match.addr selects the nth AC97 chip +on the TV card. + + + Success not guaranteed + + Due to a flaw in the Linux &i2c; bus driver these ioctls may +return successfully without actually reading or writing a register. To +catch the most likely failure we recommend a &VIDIOC-DBG-G-CHIP-IDENT; +call confirming the presence of the selected &i2c; chip. + + + These ioctls are optional, not all drivers may support them. +However when a driver supports these ioctls it must also support +&VIDIOC-DBG-G-CHIP-IDENT;. Conversely it may support +VIDIOC_DBG_G_CHIP_IDENT but not these ioctls. + + VIDIOC_DBG_G_REGISTER and +VIDIOC_DBG_S_REGISTER were introduced in Linux +2.6.21, but their API was changed to the one described here in kernel 2.6.29. + + We recommended the v4l2-dbg +utility over calling these ioctls directly. It is available from the +LinuxTV v4l-dvb repository; see http://linuxtv.org/repo/ for +access instructions. + + + + struct <structname>v4l2_dbg_match</structname> + + &cs-ustr; + + + __u32 + type + See for a list of +possible types. + + + union + (anonymous) + + + + __u32 + addr + Match a chip by this number, interpreted according +to the type field. + + + + char + name[32] + Match a chip by this name, interpreted according +to the type field. + + + +
+ + + + struct <structname>v4l2_dbg_register</structname> + + + + + + + struct v4l2_dbg_match + match + How to match the chip, see . + + + __u64 + reg + A register number. + + + __u64 + val + The value read from, or to be written into the +register. + + + +
+ + + + Chip Match Types + + &cs-def; + + + V4L2_CHIP_MATCH_HOST + 0 + Match the nth chip on the card, zero for the + host chip. Does not match &i2c; chips. + + + V4L2_CHIP_MATCH_I2C_DRIVER + 1 + Match an &i2c; chip by its driver name. + + + V4L2_CHIP_MATCH_I2C_ADDR + 2 + Match a chip by its 7 bit &i2c; bus address. + + + V4L2_CHIP_MATCH_AC97 + 3 + Match the nth anciliary AC97 chip. + + + +
+
+ + + &return-value; + + + + EINVAL + + The driver does not support this ioctl, or the kernel +was not compiled with the CONFIG_VIDEO_ADV_DEBUG +option, or the match_type is invalid, or the +selected chip or register does not exist. + + + + EPERM + + Insufficient permissions. Root privileges are required +to execute these ioctls. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml new file mode 100644 index 000000000000..4e0a7cc30812 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml @@ -0,0 +1,131 @@ + + + ioctl VIDIOC_DQEVENT + &manvol; + + + + VIDIOC_DQEVENT + Dequeue event + + + + + + int ioctl + int fd + int request + struct v4l2_event +*argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_DQEVENT + + + + argp + + + + + + + + + Description + + Dequeue an event from a video device. No input is required + for this ioctl. All the fields of the &v4l2-event; structure are + filled by the driver. The file handle will also receive exceptions + which the application may get by e.g. using the select system + call. + + + struct <structname>v4l2_event</structname> + + &cs-str; + + + __u32 + type + + Type of the event. + + + union + u + + + + + + &v4l2-event-vsync; + vsync + Event data for event V4L2_EVENT_VSYNC. + + + + + __u8 + data[64] + Event data. Defined by the event type. The union + should be used to define easily accessible type for + events. + + + __u32 + pending + + Number of pending events excluding this one. + + + __u32 + sequence + + Event sequence number. The sequence number is + incremented for every subscribed event that takes place. + If sequence numbers are not contiguous it means that + events have been lost. + + + + struct timespec + timestamp + + Event timestamp. + + + __u32 + reserved[9] + + Reserved for future extensions. Drivers must set + the array to zero. + + + +
+ +
+
+ diff --git a/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml b/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml new file mode 100644 index 000000000000..b0dde943825c --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml @@ -0,0 +1,204 @@ + + + ioctl VIDIOC_ENCODER_CMD, VIDIOC_TRY_ENCODER_CMD + &manvol; + + + + VIDIOC_ENCODER_CMD + VIDIOC_TRY_ENCODER_CMD + Execute an encoder command + + + + + + int ioctl + int fd + int request + struct v4l2_encoder_cmd *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_ENCODER_CMD, VIDIOC_TRY_ENCODER_CMD + + + + argp + + + + + + + + + Description + + + Experimental + + This is an experimental +interface and may change in the future. + + + These ioctls control an audio/video (usually MPEG-) encoder. +VIDIOC_ENCODER_CMD sends a command to the +encoder, VIDIOC_TRY_ENCODER_CMD can be used to +try a command without actually executing it. + + To send a command applications must initialize all fields of a + &v4l2-encoder-cmd; and call + VIDIOC_ENCODER_CMD or + VIDIOC_TRY_ENCODER_CMD with a pointer to this + structure. + + The cmd field must contain the +command code. The flags field is currently +only used by the STOP command and contains one bit: If the +V4L2_ENC_CMD_STOP_AT_GOP_END flag is set, +encoding will continue until the end of the current Group +Of Pictures, otherwise it will stop immediately. + + A read() call sends a START command to +the encoder if it has not been started yet. After a STOP command, +read() calls will read the remaining data +buffered by the driver. When the buffer is empty, +read() will return zero and the next +read() call will restart the encoder. + + A close() call sends an immediate STOP +to the encoder, and all buffered data is discarded. + + These ioctls are optional, not all drivers may support +them. They were introduced in Linux 2.6.21. + + + struct <structname>v4l2_encoder_cmd</structname> + + &cs-str; + + + __u32 + cmd + The encoder command, see . + + + __u32 + flags + Flags to go with the command, see . If no flags are defined for +this command, drivers and applications must set this field to +zero. + + + __u32 + data[8] + Reserved for future extensions. Drivers and +applications must set the array to zero. + + + +
+ + + Encoder Commands + + &cs-def; + + + V4L2_ENC_CMD_START + 0 + Start the encoder. When the encoder is already +running or paused, this command does nothing. No flags are defined for +this command. + + + V4L2_ENC_CMD_STOP + 1 + Stop the encoder. When the +V4L2_ENC_CMD_STOP_AT_GOP_END flag is set, +encoding will continue until the end of the current Group +Of Pictures, otherwise encoding will stop immediately. +When the encoder is already stopped, this command does +nothing. + + + V4L2_ENC_CMD_PAUSE + 2 + Pause the encoder. When the encoder has not been +started yet, the driver will return an &EPERM;. When the encoder is +already paused, this command does nothing. No flags are defined for +this command. + + + V4L2_ENC_CMD_RESUME + 3 + Resume encoding after a PAUSE command. When the +encoder has not been started yet, the driver will return an &EPERM;. +When the encoder is already running, this command does nothing. No +flags are defined for this command. + + + +
+ + + Encoder Command Flags + + &cs-def; + + + V4L2_ENC_CMD_STOP_AT_GOP_END + 0x0001 + Stop encoding at the end of the current Group Of +Pictures, rather than immediately. + + + +
+
+ + + &return-value; + + + + EINVAL + + The driver does not support this ioctl, or the +cmd field is invalid. + + + + EPERM + + The application sent a PAUSE or RESUME command when +the encoder was not running. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-enum-dv-presets.xml b/Documentation/DocBook/media/v4l/vidioc-enum-dv-presets.xml new file mode 100644 index 000000000000..1d31427edd1b --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-enum-dv-presets.xml @@ -0,0 +1,238 @@ + + + ioctl VIDIOC_ENUM_DV_PRESETS + &manvol; + + + + VIDIOC_ENUM_DV_PRESETS + Enumerate supported Digital Video presets + + + + + + int ioctl + int fd + int request + struct v4l2_dv_enum_preset *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_ENUM_DV_PRESETS + + + + argp + + + + + + + + + Description + + To query the attributes of a DV preset, applications initialize the +index field and zero the reserved array of &v4l2-dv-enum-preset; +and call the VIDIOC_ENUM_DV_PRESETS ioctl with a pointer to this +structure. Drivers fill the rest of the structure or return an +&EINVAL; when the index is out of bounds. To enumerate all DV Presets supported, +applications shall begin at index zero, incrementing by one until the +driver returns EINVAL. Drivers may enumerate a +different set of DV presets after switching the video input or +output. + + + struct <structname>v4l2_dv_enum_presets</structname> + + &cs-str; + + + __u32 + index + Number of the DV preset, set by the +application. + + + __u32 + preset + This field identifies one of the DV preset values listed in . + + + __u8 + name[24] + Name of the preset, a NUL-terminated ASCII string, for example: "720P-60", "1080I-60". This information is +intended for the user. + + + __u32 + width + Width of the active video in pixels for the DV preset. + + + __u32 + height + Height of the active video in lines for the DV preset. + + + __u32 + reserved[4] + Reserved for future extensions. Drivers must set the array to zero. + + + +
+ + + struct <structname>DV Presets</structname> + + &cs-str; + + + Preset + Preset value + Description + + + + + + + + V4L2_DV_INVALID + 0 + Invalid preset value. + + + V4L2_DV_480P59_94 + 1 + 720x480 progressive video at 59.94 fps as per BT.1362. + + + V4L2_DV_576P50 + 2 + 720x576 progressive video at 50 fps as per BT.1362. + + + V4L2_DV_720P24 + 3 + 1280x720 progressive video at 24 fps as per SMPTE 296M. + + + V4L2_DV_720P25 + 4 + 1280x720 progressive video at 25 fps as per SMPTE 296M. + + + V4L2_DV_720P30 + 5 + 1280x720 progressive video at 30 fps as per SMPTE 296M. + + + V4L2_DV_720P50 + 6 + 1280x720 progressive video at 50 fps as per SMPTE 296M. + + + V4L2_DV_720P59_94 + 7 + 1280x720 progressive video at 59.94 fps as per SMPTE 274M. + + + V4L2_DV_720P60 + 8 + 1280x720 progressive video at 60 fps as per SMPTE 274M/296M. + + + V4L2_DV_1080I29_97 + 9 + 1920x1080 interlaced video at 29.97 fps as per BT.1120/SMPTE 274M. + + + V4L2_DV_1080I30 + 10 + 1920x1080 interlaced video at 30 fps as per BT.1120/SMPTE 274M. + + + V4L2_DV_1080I25 + 11 + 1920x1080 interlaced video at 25 fps as per BT.1120. + + + V4L2_DV_1080I50 + 12 + 1920x1080 interlaced video at 50 fps as per SMPTE 296M. + + + V4L2_DV_1080I60 + 13 + 1920x1080 interlaced video at 60 fps as per SMPTE 296M. + + + V4L2_DV_1080P24 + 14 + 1920x1080 progressive video at 24 fps as per SMPTE 296M. + + + V4L2_DV_1080P25 + 15 + 1920x1080 progressive video at 25 fps as per SMPTE 296M. + + + V4L2_DV_1080P30 + 16 + 1920x1080 progressive video at 30 fps as per SMPTE 296M. + + + V4L2_DV_1080P50 + 17 + 1920x1080 progressive video at 50 fps as per BT.1120. + + + V4L2_DV_1080P60 + 18 + 1920x1080 progressive video at 60 fps as per BT.1120. + + + +
+
+ + + &return-value; + + + + EINVAL + + The &v4l2-dv-enum-preset; index +is out of bounds. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml b/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml new file mode 100644 index 000000000000..71d373b6d36a --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml @@ -0,0 +1,166 @@ + + + ioctl VIDIOC_ENUM_FMT + &manvol; + + + + VIDIOC_ENUM_FMT + Enumerate image formats + + + + + + int ioctl + int fd + int request + struct v4l2_fmtdesc +*argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_ENUM_FMT + + + + argp + + + + + + + + + Description + + To enumerate image formats applications initialize the +type and index +field of &v4l2-fmtdesc; and call the +VIDIOC_ENUM_FMT ioctl with a pointer to this +structure. Drivers fill the rest of the structure or return an +&EINVAL;. All formats are enumerable by beginning at index zero and +incrementing by one until EINVAL is +returned. + + + struct <structname>v4l2_fmtdesc</structname> + + &cs-str; + + + __u32 + index + Number of the format in the enumeration, set by +the application. This is in no way related to the +pixelformat field. + + + &v4l2-buf-type; + type + Type of the data stream, set by the application. +Only these types are valid here: +V4L2_BUF_TYPE_VIDEO_CAPTURE, +V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, +V4L2_BUF_TYPE_VIDEO_OUTPUT, +V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, +V4L2_BUF_TYPE_VIDEO_OVERLAY, and custom (driver +defined) types with code V4L2_BUF_TYPE_PRIVATE +and higher. + + + __u32 + flags + See + + + __u8 + description[32] + Description of the format, a NUL-terminated ASCII +string. This information is intended for the user, for example: "YUV +4:2:2". + + + __u32 + pixelformat + The image format identifier. This is a +four character code as computed by the v4l2_fourcc() +macro: + + + +#define v4l2_fourcc(a,b,c,d) (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24)) +Several image formats are already +defined by this specification in . Note these +codes are not the same as those used in the Windows world. + + + __u32 + reserved[4] + Reserved for future extensions. Drivers must set +the array to zero. + + + +
+ + + Image Format Description Flags + + &cs-def; + + + V4L2_FMT_FLAG_COMPRESSED + 0x0001 + This is a compressed format. + + + V4L2_FMT_FLAG_EMULATED + 0x0002 + This format is not native to the device but emulated +through software (usually libv4l2), where possible try to use a native format +instead for better performance. + + + +
+
+ + + &return-value; + + + + EINVAL + + The &v4l2-fmtdesc; type +is not supported or the index is out of +bounds. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-enum-frameintervals.xml b/Documentation/DocBook/media/v4l/vidioc-enum-frameintervals.xml new file mode 100644 index 000000000000..3c216e113a54 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-enum-frameintervals.xml @@ -0,0 +1,270 @@ + + + + ioctl VIDIOC_ENUM_FRAMEINTERVALS + &manvol; + + + + VIDIOC_ENUM_FRAMEINTERVALS + Enumerate frame intervals + + + + + + int ioctl + int fd + int request + struct v4l2_frmivalenum *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_ENUM_FRAMEINTERVALS + + + + argp + + Pointer to a &v4l2-frmivalenum; structure that +contains a pixel format and size and receives a frame interval. + + + + + + + Description + + This ioctl allows applications to enumerate all frame +intervals that the device supports for the given pixel format and +frame size. + The supported pixel formats and frame sizes can be obtained +by using the &VIDIOC-ENUM-FMT; and &VIDIOC-ENUM-FRAMESIZES; +functions. + The return value and the content of the +v4l2_frmivalenum.type field depend on the +type of frame intervals the device supports. Here are the semantics of +the function for the different cases: + + + Discrete: The function +returns success if the given index value (zero-based) is valid. The +application should increase the index by one for each call until +EINVAL is returned. The `v4l2_frmivalenum.type` +field is set to `V4L2_FRMIVAL_TYPE_DISCRETE` by the driver. Of the +union only the `discrete` member is valid. + + + Step-wise: The function +returns success if the given index value is zero and +EINVAL for any other index value. The +v4l2_frmivalenum.type field is set to +V4L2_FRMIVAL_TYPE_STEPWISE by the driver. Of the +union only the stepwise member is +valid. + + + Continuous: This is a +special case of the step-wise type above. The function returns success +if the given index value is zero and EINVAL for +any other index value. The +v4l2_frmivalenum.type field is set to +V4L2_FRMIVAL_TYPE_CONTINUOUS by the driver. Of +the union only the stepwise member is valid +and the step value is set to 1. + + + + When the application calls the function with index zero, it +must check the type field to determine the +type of frame interval enumeration the device supports. Only for the +V4L2_FRMIVAL_TYPE_DISCRETE type does it make +sense to increase the index value to receive more frame +intervals. + Note that the order in which the frame intervals are +returned has no special meaning. In particular does it not say +anything about potential default frame intervals. + Applications can assume that the enumeration data does not +change without any interaction from the application itself. This means +that the enumeration data is consistent if the application does not +perform any other ioctl calls while it runs the frame interval +enumeration. + + + + Notes + + + + Frame intervals and frame +rates: The V4L2 API uses frame intervals instead of frame +rates. Given the frame interval the frame rate can be computed as +follows:frame_rate = 1 / frame_interval + + + + + + + Structs + + In the structs below, IN denotes a +value that has to be filled in by the application, +OUT denotes values that the driver fills in. The +application should zero out all members except for the +IN fields. + + + struct <structname>v4l2_frmival_stepwise</structname> + + &cs-str; + + + &v4l2-fract; + min + Minimum frame interval [s]. + + + &v4l2-fract; + max + Maximum frame interval [s]. + + + &v4l2-fract; + step + Frame interval step size [s]. + + + +
+ + + struct <structname>v4l2_frmivalenum</structname> + + + + + + + + __u32 + index + + IN: Index of the given frame interval in the +enumeration. + + + __u32 + pixel_format + + IN: Pixel format for which the frame intervals are +enumerated. + + + __u32 + width + + IN: Frame width for which the frame intervals are +enumerated. + + + __u32 + height + + IN: Frame height for which the frame intervals are +enumerated. + + + __u32 + type + + OUT: Frame interval type the device supports. + + + union + + + OUT: Frame interval with the given index. + + + + &v4l2-fract; + discrete + Frame interval [s]. + + + + &v4l2-frmival-stepwise; + stepwise + + + + __u32 + reserved[2] + + Reserved space for future use. + + + +
+
+ + + Enums + + + enum <structname>v4l2_frmivaltypes</structname> + + &cs-def; + + + V4L2_FRMIVAL_TYPE_DISCRETE + 1 + Discrete frame interval. + + + V4L2_FRMIVAL_TYPE_CONTINUOUS + 2 + Continuous frame interval. + + + V4L2_FRMIVAL_TYPE_STEPWISE + 3 + Step-wise defined frame interval. + + + +
+
+ + + &return-value; + + See the description section above for a list of return +values that errno can have. + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-enum-framesizes.xml b/Documentation/DocBook/media/v4l/vidioc-enum-framesizes.xml new file mode 100644 index 000000000000..6afa4542c818 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-enum-framesizes.xml @@ -0,0 +1,282 @@ + + + + ioctl VIDIOC_ENUM_FRAMESIZES + &manvol; + + + + VIDIOC_ENUM_FRAMESIZES + Enumerate frame sizes + + + + + + int ioctl + int fd + int request + struct v4l2_frmsizeenum *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_ENUM_FRAMESIZES + + + + argp + + Pointer to a &v4l2-frmsizeenum; that contains an index +and pixel format and receives a frame width and height. + + + + + + + Description + + + Experimental + + This is an experimental +interface and may change in the future. + + + This ioctl allows applications to enumerate all frame sizes +(&ie; width and height in pixels) that the device supports for the +given pixel format. + The supported pixel formats can be obtained by using the +&VIDIOC-ENUM-FMT; function. + The return value and the content of the +v4l2_frmsizeenum.type field depend on the +type of frame sizes the device supports. Here are the semantics of the +function for the different cases: + + + + Discrete: The function +returns success if the given index value (zero-based) is valid. The +application should increase the index by one for each call until +EINVAL is returned. The +v4l2_frmsizeenum.type field is set to +V4L2_FRMSIZE_TYPE_DISCRETE by the driver. Of the +union only the discrete member is +valid. + + + Step-wise: The function +returns success if the given index value is zero and +EINVAL for any other index value. The +v4l2_frmsizeenum.type field is set to +V4L2_FRMSIZE_TYPE_STEPWISE by the driver. Of the +union only the stepwise member is +valid. + + + Continuous: This is a +special case of the step-wise type above. The function returns success +if the given index value is zero and EINVAL for +any other index value. The +v4l2_frmsizeenum.type field is set to +V4L2_FRMSIZE_TYPE_CONTINUOUS by the driver. Of +the union only the stepwise member is valid +and the step_width and +step_height values are set to 1. + + + + When the application calls the function with index zero, it +must check the type field to determine the +type of frame size enumeration the device supports. Only for the +V4L2_FRMSIZE_TYPE_DISCRETE type does it make +sense to increase the index value to receive more frame sizes. + Note that the order in which the frame sizes are returned +has no special meaning. In particular does it not say anything about +potential default format sizes. + Applications can assume that the enumeration data does not +change without any interaction from the application itself. This means +that the enumeration data is consistent if the application does not +perform any other ioctl calls while it runs the frame size +enumeration. + + + + Structs + + In the structs below, IN denotes a +value that has to be filled in by the application, +OUT denotes values that the driver fills in. The +application should zero out all members except for the +IN fields. + + + struct <structname>v4l2_frmsize_discrete</structname> + + &cs-str; + + + __u32 + width + Width of the frame [pixel]. + + + __u32 + height + Height of the frame [pixel]. + + + +
+ + + struct <structname>v4l2_frmsize_stepwise</structname> + + &cs-str; + + + __u32 + min_width + Minimum frame width [pixel]. + + + __u32 + max_width + Maximum frame width [pixel]. + + + __u32 + step_width + Frame width step size [pixel]. + + + __u32 + min_height + Minimum frame height [pixel]. + + + __u32 + max_height + Maximum frame height [pixel]. + + + __u32 + step_height + Frame height step size [pixel]. + + + +
+ + + struct <structname>v4l2_frmsizeenum</structname> + + + + + + + + __u32 + index + + IN: Index of the given frame size in the enumeration. + + + __u32 + pixel_format + + IN: Pixel format for which the frame sizes are enumerated. + + + __u32 + type + + OUT: Frame size type the device supports. + + + union + + + OUT: Frame size with the given index. + + + + &v4l2-frmsize-discrete; + discrete + + + + + &v4l2-frmsize-stepwise; + stepwise + + + + __u32 + reserved[2] + + Reserved space for future use. + + + +
+
+ + + Enums + + + enum <structname>v4l2_frmsizetypes</structname> + + &cs-def; + + + V4L2_FRMSIZE_TYPE_DISCRETE + 1 + Discrete frame size. + + + V4L2_FRMSIZE_TYPE_CONTINUOUS + 2 + Continuous frame size. + + + V4L2_FRMSIZE_TYPE_STEPWISE + 3 + Step-wise defined frame size. + + + +
+
+ + + &return-value; + + See the description section above for a list of return +values that errno can have. + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-enumaudio.xml b/Documentation/DocBook/media/v4l/vidioc-enumaudio.xml new file mode 100644 index 000000000000..9ae8f2d3a96f --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-enumaudio.xml @@ -0,0 +1,86 @@ + + + ioctl VIDIOC_ENUMAUDIO + &manvol; + + + + VIDIOC_ENUMAUDIO + Enumerate audio inputs + + + + + + int ioctl + int fd + int request + struct v4l2_audio *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_ENUMAUDIO + + + + argp + + + + + + + + + Description + + To query the attributes of an audio input applications +initialize the index field and zero out the +reserved array of a &v4l2-audio; +and call the VIDIOC_ENUMAUDIO ioctl with a pointer +to this structure. Drivers fill the rest of the structure or return an +&EINVAL; when the index is out of bounds. To enumerate all audio +inputs applications shall begin at index zero, incrementing by one +until the driver returns EINVAL. + + See for a description of +&v4l2-audio;. + + + + &return-value; + + + + EINVAL + + The number of the audio input is out of bounds, or +there are no audio inputs at all and this ioctl is not +supported. + + + + + + + diff --git a/Documentation/DocBook/media/v4l/vidioc-enumaudioout.xml b/Documentation/DocBook/media/v4l/vidioc-enumaudioout.xml new file mode 100644 index 000000000000..d3d7c0ab17b8 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-enumaudioout.xml @@ -0,0 +1,89 @@ + + + ioctl VIDIOC_ENUMAUDOUT + &manvol; + + + + VIDIOC_ENUMAUDOUT + Enumerate audio outputs + + + + + + int ioctl + int fd + int request + struct v4l2_audioout *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_ENUMAUDOUT + + + + argp + + + + + + + + + Description + + To query the attributes of an audio output applications +initialize the index field and zero out the +reserved array of a &v4l2-audioout; and +call the VIDIOC_G_AUDOUT ioctl with a pointer +to this structure. Drivers fill the rest of the structure or return an +&EINVAL; when the index is out of bounds. To enumerate all audio +outputs applications shall begin at index zero, incrementing by one +until the driver returns EINVAL. + + Note connectors on a TV card to loop back the received audio +signal to a sound card are not audio outputs in this sense. + + See for a description of +&v4l2-audioout;. + + + + &return-value; + + + + EINVAL + + The number of the audio output is out of bounds, or +there are no audio outputs at all and this ioctl is not +supported. + + + + + + + diff --git a/Documentation/DocBook/media/v4l/vidioc-enuminput.xml b/Documentation/DocBook/media/v4l/vidioc-enuminput.xml new file mode 100644 index 000000000000..476fe1d2bba0 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-enuminput.xml @@ -0,0 +1,321 @@ + + + ioctl VIDIOC_ENUMINPUT + &manvol; + + + + VIDIOC_ENUMINPUT + Enumerate video inputs + + + + + + int ioctl + int fd + int request + struct v4l2_input +*argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_ENUMINPUT + + + + argp + + + + + + + + + Description + + To query the attributes of a video input applications +initialize the index field of &v4l2-input; +and call the VIDIOC_ENUMINPUT ioctl with a +pointer to this structure. Drivers fill the rest of the structure or +return an &EINVAL; when the index is out of bounds. To enumerate all +inputs applications shall begin at index zero, incrementing by one +until the driver returns EINVAL. + + + struct <structname>v4l2_input</structname> + + &cs-str; + + + __u32 + index + Identifies the input, set by the +application. + + + __u8 + name[32] + Name of the video input, a NUL-terminated ASCII +string, for example: "Vin (Composite 2)". This information is intended +for the user, preferably the connector label on the device itself. + + + __u32 + type + Type of the input, see . + + + __u32 + audioset + Drivers can enumerate up to 32 video and +audio inputs. This field shows which audio inputs were selectable as +audio source if this was the currently selected video input. It is a +bit mask. The LSB corresponds to audio input 0, the MSB to input 31. +Any number of bits can be set, or none.When the driver +does not enumerate audio inputs no bits must be set. Applications +shall not interpret this as lack of audio support. Some drivers +automatically select audio sources and do not enumerate them since +there is no choice anyway.For details on audio inputs and +how to select the current input see . + + + __u32 + tuner + Capture devices can have zero or more tuners (RF +demodulators). When the type is set to +V4L2_INPUT_TYPE_TUNER this is an RF connector and +this field identifies the tuner. It corresponds to +&v4l2-tuner; field index. For details on +tuners see . + + + &v4l2-std-id; + std + Every video input supports one or more different +video standards. This field is a set of all supported standards. For +details on video standards and how to switch see . + + + __u32 + status + This field provides status information about the +input. See for flags. +With the exception of the sensor orientation bits status is only valid when this is the +current input. + + + __u32 + capabilities + This field provides capabilities for the +input. See for flags. + + + __u32 + reserved[3] + Reserved for future extensions. Drivers must set +the array to zero. + + + +
+ + + Input Types + + &cs-def; + + + V4L2_INPUT_TYPE_TUNER + 1 + This input uses a tuner (RF demodulator). + + + V4L2_INPUT_TYPE_CAMERA + 2 + Analog baseband input, for example CVBS / +Composite Video, S-Video, RGB. + + + +
+ + + + + Input Status Flags + + + + + + + + General + + + V4L2_IN_ST_NO_POWER + 0x00000001 + Attached device is off. + + + V4L2_IN_ST_NO_SIGNAL + 0x00000002 + + + + V4L2_IN_ST_NO_COLOR + 0x00000004 + The hardware supports color decoding, but does not +detect color modulation in the signal. + + + Sensor Orientation + + + V4L2_IN_ST_HFLIP + 0x00000010 + The input is connected to a device that produces a signal +that is flipped horizontally and does not correct this before passing the +signal to userspace. + + + V4L2_IN_ST_VFLIP + 0x00000020 + The input is connected to a device that produces a signal +that is flipped vertically and does not correct this before passing the +signal to userspace. Note that a 180 degree rotation is the same as HFLIP | VFLIP + + + Analog Video + + + V4L2_IN_ST_NO_H_LOCK + 0x00000100 + No horizontal sync lock. + + + V4L2_IN_ST_COLOR_KILL + 0x00000200 + A color killer circuit automatically disables color +decoding when it detects no color modulation. When this flag is set +the color killer is enabled and has shut off +color decoding. + + + Digital Video + + + V4L2_IN_ST_NO_SYNC + 0x00010000 + No synchronization lock. + + + V4L2_IN_ST_NO_EQU + 0x00020000 + No equalizer lock. + + + V4L2_IN_ST_NO_CARRIER + 0x00040000 + Carrier recovery failed. + + + VCR and Set-Top Box + + + V4L2_IN_ST_MACROVISION + 0x01000000 + Macrovision is an analog copy prevention system +mangling the video signal to confuse video recorders. When this +flag is set Macrovision has been detected. + + + V4L2_IN_ST_NO_ACCESS + 0x02000000 + Conditional access denied. + + + V4L2_IN_ST_VTR + 0x04000000 + VTR time constant. [?] + + + +
+ + + + Input capabilities + + &cs-def; + + + V4L2_IN_CAP_PRESETS + 0x00000001 + This input supports setting DV presets by using VIDIOC_S_DV_PRESET. + + + V4L2_IN_CAP_CUSTOM_TIMINGS + 0x00000002 + This input supports setting custom video timings by using VIDIOC_S_DV_TIMINGS. + + + V4L2_IN_CAP_STD + 0x00000004 + This input supports setting the TV standard by using VIDIOC_S_STD. + + + +
+
+ + + &return-value; + + + + EINVAL + + The &v4l2-input; index is +out of bounds. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-enumoutput.xml b/Documentation/DocBook/media/v4l/vidioc-enumoutput.xml new file mode 100644 index 000000000000..a281d26a195f --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-enumoutput.xml @@ -0,0 +1,206 @@ + + + ioctl VIDIOC_ENUMOUTPUT + &manvol; + + + + VIDIOC_ENUMOUTPUT + Enumerate video outputs + + + + + + int ioctl + int fd + int request + struct v4l2_output *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_ENUMOUTPUT + + + + argp + + + + + + + + + Description + + To query the attributes of a video outputs applications +initialize the index field of &v4l2-output; +and call the VIDIOC_ENUMOUTPUT ioctl with a +pointer to this structure. Drivers fill the rest of the structure or +return an &EINVAL; when the index is out of bounds. To enumerate all +outputs applications shall begin at index zero, incrementing by one +until the driver returns EINVAL. + + + struct <structname>v4l2_output</structname> + + &cs-str; + + + __u32 + index + Identifies the output, set by the +application. + + + __u8 + name[32] + Name of the video output, a NUL-terminated ASCII +string, for example: "Vout". This information is intended for the +user, preferably the connector label on the device itself. + + + __u32 + type + Type of the output, see . + + + __u32 + audioset + Drivers can enumerate up to 32 video and +audio outputs. This field shows which audio outputs were +selectable as the current output if this was the currently selected +video output. It is a bit mask. The LSB corresponds to audio output 0, +the MSB to output 31. Any number of bits can be set, or +none.When the driver does not enumerate audio outputs no +bits must be set. Applications shall not interpret this as lack of +audio support. Drivers may automatically select audio outputs without +enumerating them.For details on audio outputs and how to +select the current output see . + + + __u32 + modulator + Output devices can have zero or more RF modulators. +When the type is +V4L2_OUTPUT_TYPE_MODULATOR this is an RF +connector and this field identifies the modulator. It corresponds to +&v4l2-modulator; field index. For details +on modulators see . + + + &v4l2-std-id; + std + Every video output supports one or more different +video standards. This field is a set of all supported standards. For +details on video standards and how to switch see . + + + __u32 + capabilities + This field provides capabilities for the +output. See for flags. + + + __u32 + reserved[3] + Reserved for future extensions. Drivers must set +the array to zero. + + + +
+ + + Output Type + + &cs-def; + + + V4L2_OUTPUT_TYPE_MODULATOR + 1 + This output is an analog TV modulator. + + + V4L2_OUTPUT_TYPE_ANALOG + 2 + Analog baseband output, for example Composite / +CVBS, S-Video, RGB. + + + V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY + 3 + [?] + + + +
+ + + + Output capabilities + + &cs-def; + + + V4L2_OUT_CAP_PRESETS + 0x00000001 + This output supports setting DV presets by using VIDIOC_S_DV_PRESET. + + + V4L2_OUT_CAP_CUSTOM_TIMINGS + 0x00000002 + This output supports setting custom video timings by using VIDIOC_S_DV_TIMINGS. + + + V4L2_OUT_CAP_STD + 0x00000004 + This output supports setting the TV standard by using VIDIOC_S_STD. + + + +
+ +
+ + &return-value; + + + + EINVAL + + The &v4l2-output; index +is out of bounds. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-enumstd.xml b/Documentation/DocBook/media/v4l/vidioc-enumstd.xml new file mode 100644 index 000000000000..95803fe2c8e4 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-enumstd.xml @@ -0,0 +1,391 @@ + + + ioctl VIDIOC_ENUMSTD + &manvol; + + + + VIDIOC_ENUMSTD + Enumerate supported video standards + + + + + + int ioctl + int fd + int request + struct v4l2_standard *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_ENUMSTD + + + + argp + + + + + + + + + Description + + To query the attributes of a video standard, +especially a custom (driver defined) one, applications initialize the +index field of &v4l2-standard; and call the +VIDIOC_ENUMSTD ioctl with a pointer to this +structure. Drivers fill the rest of the structure or return an +&EINVAL; when the index is out of bounds. To enumerate all standards +applications shall begin at index zero, incrementing by one until the +driver returns EINVAL. Drivers may enumerate a +different set of standards after switching the video input or +output. + The supported standards may overlap and we need an +unambiguous set to find the current standard returned by +VIDIOC_G_STD. + + + + struct <structname>v4l2_standard</structname> + + &cs-str; + + + __u32 + index + Number of the video standard, set by the +application. + + + &v4l2-std-id; + id + The bits in this field identify the standard as +one of the common standards listed in , +or if bits 32 to 63 are set as custom standards. Multiple bits can be +set if the hardware does not distinguish between these standards, +however separate indices do not indicate the opposite. The +id must be unique. No other enumerated +v4l2_standard structure, for this input or +output anyway, can contain the same set of bits. + + + __u8 + name[24] + Name of the standard, a NUL-terminated ASCII +string, for example: "PAL-B/G", "NTSC Japan". This information is +intended for the user. + + + &v4l2-fract; + frameperiod + The frame period (not field period) is numerator +/ denominator. For example M/NTSC has a frame period of 1001 / +30000 seconds. + + + __u32 + framelines + Total lines per frame including blanking, +e. g. 625 for B/PAL. + + + __u32 + reserved[4] + Reserved for future extensions. Drivers must set +the array to zero. + + + +
+ + + struct <structname>v4l2_fract</structname> + + &cs-str; + + + __u32 + numerator + + + + __u32 + denominator + + + + +
+ + + typedef <structname>v4l2_std_id</structname> + + &cs-str; + + + __u64 + v4l2_std_id + This type is a set, each bit representing another +video standard as listed below and in . The 32 most significant bits are reserved +for custom (driver defined) video standards. + + + +
+ + +#define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001) +#define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002) +#define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004) +#define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008) +#define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010) +#define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020) +#define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040) +#define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080) + +#define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100) +#define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200) +#define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400) +#define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800) +V4L2_STD_PAL_60 is +a hybrid standard with 525 lines, 60 Hz refresh rate, and PAL color +modulation with a 4.43 MHz color subcarrier. Some PAL video recorders +can play back NTSC tapes in this mode for display on a 50/60 Hz agnostic +PAL TV. +#define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) +#define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) +#define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000) +V4L2_STD_NTSC_443 +is a hybrid standard with 525 lines, 60 Hz refresh rate, and NTSC +color modulation with a 4.43 MHz color +subcarrier. +#define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000) + +#define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000) +#define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000) +#define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000) +#define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000) +#define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000) +#define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000) +#define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000) +#define V4L2_STD_SECAM_LC ((v4l2_std_id)0x00800000) + +/* ATSC/HDTV */ +#define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000) +#define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000) +V4L2_STD_ATSC_8_VSB and +V4L2_STD_ATSC_16_VSB are U.S. terrestrial digital +TV standards. Presently the V4L2 API does not support digital TV. See +also the Linux DVB API at http://linuxtv.org. + +#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\ + V4L2_STD_PAL_B1 |\ + V4L2_STD_PAL_G) +#define V4L2_STD_B (V4L2_STD_PAL_B |\ + V4L2_STD_PAL_B1 |\ + V4L2_STD_SECAM_B) +#define V4L2_STD_GH (V4L2_STD_PAL_G |\ + V4L2_STD_PAL_H |\ + V4L2_STD_SECAM_G |\ + V4L2_STD_SECAM_H) +#define V4L2_STD_PAL_DK (V4L2_STD_PAL_D |\ + V4L2_STD_PAL_D1 |\ + V4L2_STD_PAL_K) +#define V4L2_STD_PAL (V4L2_STD_PAL_BG |\ + V4L2_STD_PAL_DK |\ + V4L2_STD_PAL_H |\ + V4L2_STD_PAL_I) +#define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\ + V4L2_STD_NTSC_M_JP |\ + V4L2_STD_NTSC_M_KR) +#define V4L2_STD_MN (V4L2_STD_PAL_M |\ + V4L2_STD_PAL_N |\ + V4L2_STD_PAL_Nc |\ + V4L2_STD_NTSC) +#define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\ + V4L2_STD_SECAM_K |\ + V4L2_STD_SECAM_K1) +#define V4L2_STD_DK (V4L2_STD_PAL_DK |\ + V4L2_STD_SECAM_DK) + +#define V4L2_STD_SECAM (V4L2_STD_SECAM_B |\ + V4L2_STD_SECAM_G |\ + V4L2_STD_SECAM_H |\ + V4L2_STD_SECAM_DK |\ + V4L2_STD_SECAM_L |\ + V4L2_STD_SECAM_LC) + +#define V4L2_STD_525_60 (V4L2_STD_PAL_M |\ + V4L2_STD_PAL_60 |\ + V4L2_STD_NTSC |\ + V4L2_STD_NTSC_443) +#define V4L2_STD_625_50 (V4L2_STD_PAL |\ + V4L2_STD_PAL_N |\ + V4L2_STD_PAL_Nc |\ + V4L2_STD_SECAM) + +#define V4L2_STD_UNKNOWN 0 +#define V4L2_STD_ALL (V4L2_STD_525_60 |\ + V4L2_STD_625_50) + + + + Video Standards (based on [<xref linkend="itu470" />]) + + + + + + + + + + + + + + + + Characteristics + M/NTSCJapan uses a standard +similar to M/NTSC +(V4L2_STD_NTSC_M_JP). + M/PAL + N/PAL The values in +brackets apply to the combination N/PAL a.k.a. +NC used in Argentina +(V4L2_STD_PAL_Nc). + B, B1, G/PAL + D, D1, K/PAL + H/PAL + I/PAL + B, G/SECAM + D, K/SECAM + K1/SECAM + L/SECAM + + + + + Frame lines + 525 + 625 + + + Frame period (s) + 1001/30000 + 1/25 + + + Chrominance sub-carrier frequency (Hz) + 3579545 ± 10 + 3579611.49 ± 10 + 4433618.75 ± 5 (3582056.25 +± 5) + 4433618.75 ± 5 + 4433618.75 ± 1 + fOR = +4406250 ± 2000, fOB = 4250000 +± 2000 + + + Nominal radio-frequency channel bandwidth +(MHz) + 6 + 6 + 6 + B: 7; B1, G: 8 + 8 + 8 + 8 + 8 + 8 + 8 + 8 + + + Sound carrier relative to vision carrier +(MHz) + + 4.5 + + 4.5 + + 4.5 + + 5.5 ± 0.001 +In the Federal Republic of Germany, Austria, Italy, +the Netherlands, Slovakia and Switzerland a system of two sound +carriers is used, the frequency of the second carrier being +242.1875 kHz above the frequency of the first sound carrier. For +stereophonic sound transmissions a similar system is used in +Australia. New Zealand uses a sound +carrier displaced 5.4996 ± 0.0005 MHz from the vision +carrier. In Denmark, Finland, New +Zealand, Sweden and Spain a system of two sound carriers is used. In +Iceland, Norway and Poland the same system is being introduced. The +second carrier is 5.85 MHz above the vision carrier and is DQPSK +modulated with 728 kbit/s sound and data multiplex. (NICAM +system) In the United Kingdom, a +system of two sound carriers is used. The second sound carrier is +6.552 MHz above the vision carrier and is DQPSK modulated with a +728 kbit/s sound and data multiplex able to carry two sound +channels. (NICAM system) + + 6.5 ± 0.001 + + 5.5 + + 5.9996 ± 0.0005 + + 5.5 ± 0.001 + + 6.5 ± 0.001 + + 6.5 + + 6.5 In France, a +digital carrier 5.85 MHz away from the vision carrier may be used in +addition to the main sound carrier. It is modulated in differentially +encoded QPSK with a 728 kbit/s sound and data multiplexer capable of +carrying two sound channels. (NICAM +system) + + + +
+
+ + + &return-value; + + + + EINVAL + + The &v4l2-standard; index +is out of bounds. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-g-audio.xml b/Documentation/DocBook/media/v4l/vidioc-g-audio.xml new file mode 100644 index 000000000000..65361a8c2b05 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-g-audio.xml @@ -0,0 +1,188 @@ + + + ioctl VIDIOC_G_AUDIO, VIDIOC_S_AUDIO + &manvol; + + + + VIDIOC_G_AUDIO + VIDIOC_S_AUDIO + Query or select the current audio input and its +attributes + + + + + + int ioctl + int fd + int request + struct v4l2_audio *argp + + + + + int ioctl + int fd + int request + const struct v4l2_audio *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_G_AUDIO, VIDIOC_S_AUDIO + + + + argp + + + + + + + + + Description + + To query the current audio input applications zero out the +reserved array of a &v4l2-audio; +and call the VIDIOC_G_AUDIO ioctl with a pointer +to this structure. Drivers fill the rest of the structure or return an +&EINVAL; when the device has no audio inputs, or none which combine +with the current video input. + + Audio inputs have one writable property, the audio mode. To +select the current audio input and change the +audio mode, applications initialize the +index and mode +fields, and the +reserved array of a +v4l2_audio structure and call the +VIDIOC_S_AUDIO ioctl. Drivers may switch to a +different audio mode if the request cannot be satisfied. However, this +is a write-only ioctl, it does not return the actual new audio +mode. + + + struct <structname>v4l2_audio</structname> + + &cs-str; + + + __u32 + index + Identifies the audio input, set by the +driver or application. + + + __u8 + name[32] + Name of the audio input, a NUL-terminated ASCII +string, for example: "Line In". This information is intended for the +user, preferably the connector label on the device itself. + + + __u32 + capability + Audio capability flags, see . + + + __u32 + mode + Audio mode flags set by drivers and applications (on + VIDIOC_S_AUDIO ioctl), see . + + + __u32 + reserved[2] + Reserved for future extensions. Drivers and +applications must set the array to zero. + + + +
+ + + Audio Capability Flags + + &cs-def; + + + V4L2_AUDCAP_STEREO + 0x00001 + This is a stereo input. The flag is intended to +automatically disable stereo recording etc. when the signal is always +monaural. The API provides no means to detect if stereo is +received, unless the audio input belongs to a +tuner. + + + V4L2_AUDCAP_AVL + 0x00002 + Automatic Volume Level mode is supported. + + + +
+ + + Audio Mode Flags + + &cs-def; + + + V4L2_AUDMODE_AVL + 0x00001 + AVL mode is on. + + + +
+
+ + + &return-value; + + + + EINVAL + + No audio inputs combine with the current video input, +or the number of the selected audio input is out of bounds or it does +not combine, or there are no audio inputs at all and the ioctl is not +supported. + + + + EBUSY + + I/O is in progress, the input cannot be +switched. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-g-audioout.xml b/Documentation/DocBook/media/v4l/vidioc-g-audioout.xml new file mode 100644 index 000000000000..3632730c5c6e --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-g-audioout.xml @@ -0,0 +1,154 @@ + + + ioctl VIDIOC_G_AUDOUT, VIDIOC_S_AUDOUT + &manvol; + + + + VIDIOC_G_AUDOUT + VIDIOC_S_AUDOUT + Query or select the current audio output + + + + + + int ioctl + int fd + int request + struct v4l2_audioout *argp + + + + + int ioctl + int fd + int request + const struct v4l2_audioout *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_G_AUDOUT, VIDIOC_S_AUDOUT + + + + argp + + + + + + + + + Description + + To query the current audio output applications zero out the +reserved array of a &v4l2-audioout; and +call the VIDIOC_G_AUDOUT ioctl with a pointer +to this structure. Drivers fill the rest of the structure or return an +&EINVAL; when the device has no audio inputs, or none which combine +with the current video output. + + Audio outputs have no writable properties. Nevertheless, to +select the current audio output applications can initialize the +index field and +reserved array (which in the future may +contain writable properties) of a +v4l2_audioout structure and call the +VIDIOC_S_AUDOUT ioctl. Drivers switch to the +requested output or return the &EINVAL; when the index is out of +bounds. This is a write-only ioctl, it does not return the current +audio output attributes as VIDIOC_G_AUDOUT +does. + + Note connectors on a TV card to loop back the received audio +signal to a sound card are not audio outputs in this sense. + + + struct <structname>v4l2_audioout</structname> + + &cs-str; + + + __u32 + index + Identifies the audio output, set by the +driver or application. + + + __u8 + name[32] + Name of the audio output, a NUL-terminated ASCII +string, for example: "Line Out". This information is intended for the +user, preferably the connector label on the device itself. + + + __u32 + capability + Audio capability flags, none defined yet. Drivers +must set this field to zero. + + + __u32 + mode + Audio mode, none defined yet. Drivers and +applications (on VIDIOC_S_AUDOUT) must set this +field to zero. + + + __u32 + reserved[2] + Reserved for future extensions. Drivers and +applications must set the array to zero. + + + +
+
+ + + &return-value; + + + + EINVAL + + No audio outputs combine with the current video +output, or the number of the selected audio output is out of bounds or +it does not combine, or there are no audio outputs at all and the +ioctl is not supported. + + + + EBUSY + + I/O is in progress, the output cannot be +switched. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-g-crop.xml b/Documentation/DocBook/media/v4l/vidioc-g-crop.xml new file mode 100644 index 000000000000..d235b1dedbed --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-g-crop.xml @@ -0,0 +1,143 @@ + + + ioctl VIDIOC_G_CROP, VIDIOC_S_CROP + &manvol; + + + + VIDIOC_G_CROP + VIDIOC_S_CROP + Get or set the current cropping rectangle + + + + + + int ioctl + int fd + int request + struct v4l2_crop *argp + + + + + int ioctl + int fd + int request + const struct v4l2_crop *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_G_CROP, VIDIOC_S_CROP + + + + argp + + + + + + + + + Description + + To query the cropping rectangle size and position +applications set the type field of a +v4l2_crop structure to the respective buffer +(stream) type and call the VIDIOC_G_CROP ioctl +with a pointer to this structure. The driver fills the rest of the +structure or returns the &EINVAL; if cropping is not supported. + + To change the cropping rectangle applications initialize the +type and &v4l2-rect; substructure named +c of a v4l2_crop structure and call the +VIDIOC_S_CROP ioctl with a pointer to this +structure. + + The driver first adjusts the requested dimensions against +hardware limits, &ie; the bounds given by the capture/output window, +and it rounds to the closest possible values of horizontal and +vertical offset, width and height. In particular the driver must round +the vertical offset of the cropping rectangle to frame lines modulo +two, such that the field order cannot be confused. + + Second the driver adjusts the image size (the opposite +rectangle of the scaling process, source or target depending on the +data direction) to the closest size possible while maintaining the +current horizontal and vertical scaling factor. + + Finally the driver programs the hardware with the actual +cropping and image parameters. VIDIOC_S_CROP is a +write-only ioctl, it does not return the actual parameters. To query +them applications must call VIDIOC_G_CROP and +&VIDIOC-G-FMT;. When the parameters are unsuitable the application may +modify the cropping or image parameters and repeat the cycle until +satisfactory parameters have been negotiated. + + When cropping is not supported then no parameters are +changed and VIDIOC_S_CROP returns the +&EINVAL;. + + + struct <structname>v4l2_crop</structname> + + &cs-str; + + + &v4l2-buf-type; + type + Type of the data stream, set by the application. +Only these types are valid here: V4L2_BUF_TYPE_VIDEO_CAPTURE, +V4L2_BUF_TYPE_VIDEO_OUTPUT, +V4L2_BUF_TYPE_VIDEO_OVERLAY, and custom (driver +defined) types with code V4L2_BUF_TYPE_PRIVATE +and higher. + + + &v4l2-rect; + c + Cropping rectangle. The same co-ordinate system as +for &v4l2-cropcap; bounds is used. + + + +
+
+ + + &return-value; + + + + EINVAL + + Cropping is not supported. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-g-ctrl.xml b/Documentation/DocBook/media/v4l/vidioc-g-ctrl.xml new file mode 100644 index 000000000000..8b5e6ff7f3df --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-g-ctrl.xml @@ -0,0 +1,130 @@ + + + ioctl VIDIOC_G_CTRL, VIDIOC_S_CTRL + &manvol; + + + + VIDIOC_G_CTRL + VIDIOC_S_CTRL + Get or set the value of a control + + + + + + int ioctl + int fd + int request + struct v4l2_control +*argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_G_CTRL, VIDIOC_S_CTRL + + + + argp + + + + + + + + + Description + + To get the current value of a control applications +initialize the id field of a struct +v4l2_control and call the +VIDIOC_G_CTRL ioctl with a pointer to this +structure. To change the value of a control applications initialize +the id and value +fields of a struct v4l2_control and call the +VIDIOC_S_CTRL ioctl. + + When the id is invalid drivers +return an &EINVAL;. When the value is out +of bounds drivers can choose to take the closest valid value or return +an &ERANGE;, whatever seems more appropriate. However, +VIDIOC_S_CTRL is a write-only ioctl, it does not +return the actual new value. + + These ioctls work only with user controls. For other +control classes the &VIDIOC-G-EXT-CTRLS;, &VIDIOC-S-EXT-CTRLS; or +&VIDIOC-TRY-EXT-CTRLS; must be used. + + + struct <structname>v4l2_control</structname> + + &cs-str; + + + __u32 + id + Identifies the control, set by the +application. + + + __s32 + value + New value or current value. + + + +
+
+ + + &return-value; + + + + EINVAL + + The &v4l2-control; id is +invalid. + + + + ERANGE + + The &v4l2-control; value +is out of bounds. + + + + EBUSY + + The control is temporarily not changeable, possibly +because another applications took over control of the device function +this control belongs to. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-g-dv-preset.xml b/Documentation/DocBook/media/v4l/vidioc-g-dv-preset.xml new file mode 100644 index 000000000000..d733721a7519 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-g-dv-preset.xml @@ -0,0 +1,110 @@ + + + ioctl VIDIOC_G_DV_PRESET, VIDIOC_S_DV_PRESET + &manvol; + + + + VIDIOC_G_DV_PRESET + VIDIOC_S_DV_PRESET + Query or select the DV preset of the current input or output + + + + + + int ioctl + int fd + int request + struct v4l2_dv_preset *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_G_DV_PRESET, VIDIOC_S_DV_PRESET + + + + argp + + + + + + + + + Description + To query and select the current DV preset, applications +use the VIDIOC_G_DV_PRESET and VIDIOC_S_DV_PRESET +ioctls which take a pointer to a &v4l2-dv-preset; type as argument. +Applications must zero the reserved array in &v4l2-dv-preset;. +VIDIOC_G_DV_PRESET returns a dv preset in the field +preset of &v4l2-dv-preset;. + + VIDIOC_S_DV_PRESET accepts a pointer to a &v4l2-dv-preset; +that has the preset value to be set. Applications must zero the reserved array in &v4l2-dv-preset;. +If the preset is not supported, it returns an &EINVAL; + + + + &return-value; + + + + EINVAL + + This ioctl is not supported, or the +VIDIOC_S_DV_PRESET,VIDIOC_S_DV_PRESET parameter was unsuitable. + + + + EBUSY + + The device is busy and therefore can not change the preset. + + + + + + struct <structname>v4l2_dv_preset</structname> + + &cs-str; + + + __u32 + preset + Preset value to represent the digital video timings + + + __u32 + reserved[4] + Reserved fields for future use + + + +
+ +
+
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml b/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml new file mode 100644 index 000000000000..d5ec6abf0ce2 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml @@ -0,0 +1,223 @@ + + + ioctl VIDIOC_G_DV_TIMINGS, VIDIOC_S_DV_TIMINGS + &manvol; + + + + VIDIOC_G_DV_TIMINGS + VIDIOC_S_DV_TIMINGS + Get or set custom DV timings for input or output + + + + + + int ioctl + int fd + int request + struct v4l2_dv_timings *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_G_DV_TIMINGS, VIDIOC_S_DV_TIMINGS + + + + argp + + + + + + + + + Description + To set custom DV timings for the input or output, applications use the +VIDIOC_S_DV_TIMINGS ioctl and to get the current custom timings, +applications use the VIDIOC_G_DV_TIMINGS ioctl. The detailed timing +information is filled in using the structure &v4l2-dv-timings;. These ioctls take +a pointer to the &v4l2-dv-timings; structure as argument. If the ioctl is not supported +or the timing values are not correct, the driver returns &EINVAL;. + + + + &return-value; + + + + EINVAL + + This ioctl is not supported, or the +VIDIOC_S_DV_TIMINGS parameter was unsuitable. + + + + EBUSY + + The device is busy and therefore can not change the timings. + + + + + + struct <structname>v4l2_bt_timings</structname> + + &cs-str; + + + __u32 + width + Width of the active video in pixels + + + __u32 + height + Height of the active video in lines + + + __u32 + interlaced + Progressive (0) or interlaced (1) + + + __u32 + polarities + This is a bit mask that defines polarities of sync signals. +bit 0 (V4L2_DV_VSYNC_POS_POL) is for vertical sync polarity and bit 1 (V4L2_DV_HSYNC_POS_POL) is for horizontal sync polarity. If the bit is set +(1) it is positive polarity and if is cleared (0), it is negative polarity. + + + __u64 + pixelclock + Pixel clock in Hz. Ex. 74.25MHz->74250000 + + + __u32 + hfrontporch + Horizontal front porch in pixels + + + __u32 + hsync + Horizontal sync length in pixels + + + __u32 + hbackporch + Horizontal back porch in pixels + + + __u32 + vfrontporch + Vertical front porch in lines + + + __u32 + vsync + Vertical sync length in lines + + + __u32 + vbackporch + Vertical back porch in lines + + + __u32 + il_vfrontporch + Vertical front porch in lines for bottom field of interlaced field formats + + + __u32 + il_vsync + Vertical sync length in lines for bottom field of interlaced field formats + + + __u32 + il_vbackporch + Vertical back porch in lines for bottom field of interlaced field formats + + + +
+ + + struct <structname>v4l2_dv_timings</structname> + + &cs-str; + + + __u32 + type + + Type of DV timings as listed in . + + + union + + + + + + &v4l2-bt-timings; + bt + Timings defined by BT.656/1120 specifications + + + + __u32 + reserved[32] + + + + +
+ + + DV Timing types + + &cs-str; + + + Timing type + value + Description + + + + + + + + V4L2_DV_BT_656_1120 + 0 + BT.656/1120 timings + + + +
+
+
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-g-enc-index.xml b/Documentation/DocBook/media/v4l/vidioc-g-enc-index.xml new file mode 100644 index 000000000000..9f242e4b2948 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-g-enc-index.xml @@ -0,0 +1,213 @@ + + + ioctl VIDIOC_G_ENC_INDEX + &manvol; + + + + VIDIOC_G_ENC_INDEX + Get meta data about a compressed video stream + + + + + + int ioctl + int fd + int request + struct v4l2_enc_idx *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_G_ENC_INDEX + + + + argp + + + + + + + + + Description + + + Experimental + + This is an experimental +interface and may change in the future. + + + The VIDIOC_G_ENC_INDEX ioctl provides +meta data about a compressed video stream the same or another +application currently reads from the driver, which is useful for +random access into the stream without decoding it. + + To read the data applications must call +VIDIOC_G_ENC_INDEX with a pointer to a +&v4l2-enc-idx;. On success the driver fills the +entry array, stores the number of elements +written in the entries field, and +initializes the entries_cap field. + + Each element of the entry array +contains meta data about one picture. A +VIDIOC_G_ENC_INDEX call reads up to +V4L2_ENC_IDX_ENTRIES entries from a driver +buffer, which can hold up to entries_cap +entries. This number can be lower or higher than +V4L2_ENC_IDX_ENTRIES, but not zero. When the +application fails to read the meta data in time the oldest entries +will be lost. When the buffer is empty or no capturing/encoding is in +progress, entries will be zero. + + Currently this ioctl is only defined for MPEG-2 program +streams and video elementary streams. + + + struct <structname>v4l2_enc_idx</structname> + + &cs-str; + + + __u32 + entries + The number of entries the driver stored in the +entry array. + + + __u32 + entries_cap + The number of entries the driver can +buffer. Must be greater than zero. + + + __u32 + reserved[4] + Reserved for future extensions. +Drivers must set the array to zero. + + + &v4l2-enc-idx-entry; + entry[V4L2_ENC_IDX_ENTRIES] + Meta data about a compressed video stream. Each +element of the array corresponds to one picture, sorted in ascending +order by their offset. + + + +
+ + + struct <structname>v4l2_enc_idx_entry</structname> + + &cs-str; + + + __u64 + offset + The offset in bytes from the beginning of the +compressed video stream to the beginning of this picture, that is a +PES packet header as defined in or a picture +header as defined in . When +the encoder is stopped, the driver resets the offset to zero. + + + __u64 + pts + The 33 bit Presentation Time +Stamp of this picture as defined in . + + + __u32 + length + The length of this picture in bytes. + + + __u32 + flags + Flags containing the coding type of this picture, see . + + + __u32 + reserved[2] + Reserved for future extensions. +Drivers must set the array to zero. + + + +
+ + + Index Entry Flags + + &cs-def; + + + V4L2_ENC_IDX_FRAME_I + 0x00 + This is an Intra-coded picture. + + + V4L2_ENC_IDX_FRAME_P + 0x01 + This is a Predictive-coded picture. + + + V4L2_ENC_IDX_FRAME_B + 0x02 + This is a Bidirectionally predictive-coded +picture. + + + V4L2_ENC_IDX_FRAME_MASK + 0x0F + AND the flags field with +this mask to obtain the picture coding type. + + + +
+
+ + + &return-value; + + + + EINVAL + + The driver does not support this ioctl. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml new file mode 100644 index 000000000000..3aa7f8f9ff0c --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml @@ -0,0 +1,307 @@ + + + ioctl VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS, +VIDIOC_TRY_EXT_CTRLS + &manvol; + + + + VIDIOC_G_EXT_CTRLS + VIDIOC_S_EXT_CTRLS + VIDIOC_TRY_EXT_CTRLS + Get or set the value of several controls, try control +values + + + + + + int ioctl + int fd + int request + struct v4l2_ext_controls +*argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS, +VIDIOC_TRY_EXT_CTRLS + + + + argp + + + + + + + + + Description + + These ioctls allow the caller to get or set multiple +controls atomically. Control IDs are grouped into control classes (see +) and all controls in the control array +must belong to the same control class. + + Applications must always fill in the +count, +ctrl_class, +controls and +reserved fields of &v4l2-ext-controls;, and +initialize the &v4l2-ext-control; array pointed to by the +controls fields. + + To get the current value of a set of controls applications +initialize the id, +size and reserved2 fields +of each &v4l2-ext-control; and call the +VIDIOC_G_EXT_CTRLS ioctl. String controls controls +must also set the string field. + + If the size is too small to +receive the control result (only relevant for pointer-type controls +like strings), then the driver will set size +to a valid value and return an &ENOSPC;. You should re-allocate the +string memory to this new size and try again. It is possible that the +same issue occurs again if the string has grown in the meantime. It is +recommended to call &VIDIOC-QUERYCTRL; first and use +maximum+1 as the new size +value. It is guaranteed that that is sufficient memory. + + + To change the value of a set of controls applications +initialize the id, size, +reserved2 and +value/string fields of each &v4l2-ext-control; and +call the VIDIOC_S_EXT_CTRLS ioctl. The controls +will only be set if all control values are +valid. + + To check if a set of controls have correct values applications +initialize the id, size, +reserved2 and +value/string fields of each &v4l2-ext-control; and +call the VIDIOC_TRY_EXT_CTRLS ioctl. It is up to +the driver whether wrong values are automatically adjusted to a valid +value or if an error is returned. + + When the id or +ctrl_class is invalid drivers return an +&EINVAL;. When the value is out of bounds drivers can choose to take +the closest valid value or return an &ERANGE;, whatever seems more +appropriate. In the first case the new value is set in +&v4l2-ext-control;. + + The driver will only set/get these controls if all control +values are correct. This prevents the situation where only some of the +controls were set/get. Only low-level errors (⪚ a failed i2c +command) can still cause this situation. + + + struct <structname>v4l2_ext_control</structname> + + &cs-ustr; + + + __u32 + id + + Identifies the control, set by the +application. + + + __u32 + size + + The total size in bytes of the payload of this +control. This is normally 0, but for pointer controls this should be +set to the size of the memory containing the payload, or that will +receive the payload. If VIDIOC_G_EXT_CTRLS finds +that this value is less than is required to store +the payload result, then it is set to a value large enough to store the +payload result and ENOSPC is returned. Note that for string controls +this size field should not be confused with the length of the string. +This field refers to the size of the memory that contains the string. +The actual length of the string may well be much smaller. + + + + __u32 + reserved2[1] + + Reserved for future extensions. Drivers and +applications must set the array to zero. + + + union + (anonymous) + + + + __s32 + value + New value or current value. + + + + __s64 + value64 + New value or current value. + + + + char * + string + A pointer to a string. + + + +
+ + + struct <structname>v4l2_ext_controls</structname> + + &cs-str; + + + __u32 + ctrl_class + The control class to which all controls belong, see +. + + + __u32 + count + The number of controls in the controls array. May +also be zero. + + + __u32 + error_idx + Set by the driver in case of an error. It is the +index of the control causing the error or equal to 'count' when the +error is not associated with a particular control. Undefined when the +ioctl returns 0 (success). + + + __u32 + reserved[2] + Reserved for future extensions. Drivers and +applications must set the array to zero. + + + &v4l2-ext-control; * + controls + Pointer to an array of +count v4l2_ext_control structures. Ignored +if count equals zero. + + + +
+ + + Control classes + + &cs-def; + + + V4L2_CTRL_CLASS_USER + 0x980000 + The class containing user controls. These controls +are described in . All controls that can be set +using the &VIDIOC-S-CTRL; and &VIDIOC-G-CTRL; ioctl belong to this +class. + + + V4L2_CTRL_CLASS_MPEG + 0x990000 + The class containing MPEG compression controls. +These controls are described in . + + + V4L2_CTRL_CLASS_CAMERA + 0x9a0000 + The class containing camera controls. +These controls are described in . + + + V4L2_CTRL_CLASS_FM_TX + 0x9b0000 + The class containing FM Transmitter (FM TX) controls. +These controls are described in . + + + +
+ +
+ + + &return-value; + + + + EINVAL + + The &v4l2-ext-control; id +is invalid or the &v4l2-ext-controls; +ctrl_class is invalid. This error code is +also returned by the VIDIOC_S_EXT_CTRLS and +VIDIOC_TRY_EXT_CTRLS ioctls if two or more +control values are in conflict. + + + + ERANGE + + The &v4l2-ext-control; value +is out of bounds. + + + + EBUSY + + The control is temporarily not changeable, possibly +because another applications took over control of the device function +this control belongs to. + + + + ENOSPC + + The space reserved for the control's payload is insufficient. +The field size is set to a value that is enough +to store the payload and this error code is returned. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-g-fbuf.xml b/Documentation/DocBook/media/v4l/vidioc-g-fbuf.xml new file mode 100644 index 000000000000..e7dda4822f04 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-g-fbuf.xml @@ -0,0 +1,473 @@ + + + ioctl VIDIOC_G_FBUF, VIDIOC_S_FBUF + &manvol; + + + + VIDIOC_G_FBUF + VIDIOC_S_FBUF + Get or set frame buffer overlay parameters + + + + + + int ioctl + int fd + int request + struct v4l2_framebuffer *argp + + + + + int ioctl + int fd + int request + const struct v4l2_framebuffer *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_G_FBUF, VIDIOC_S_FBUF + + + + argp + + + + + + + + + Description + + Applications can use the VIDIOC_G_FBUF and +VIDIOC_S_FBUF ioctl to get and set the +framebuffer parameters for a Video +Overlay or Video Output Overlay +(OSD). The type of overlay is implied by the device type (capture or +output device) and can be determined with the &VIDIOC-QUERYCAP; ioctl. +One /dev/videoN device must not support both +kinds of overlay. + + The V4L2 API distinguishes destructive and non-destructive +overlays. A destructive overlay copies captured video images into the +video memory of a graphics card. A non-destructive overlay blends +video images into a VGA signal or graphics into a video signal. +Video Output Overlays are always +non-destructive. + + To get the current parameters applications call the +VIDIOC_G_FBUF ioctl with a pointer to a +v4l2_framebuffer structure. The driver fills +all fields of the structure or returns an &EINVAL; when overlays are +not supported. + + To set the parameters for a Video Output +Overlay, applications must initialize the +flags field of a struct +v4l2_framebuffer. Since the framebuffer is +implemented on the TV card all other parameters are determined by the +driver. When an application calls VIDIOC_S_FBUF +with a pointer to this structure, the driver prepares for the overlay +and returns the framebuffer parameters as +VIDIOC_G_FBUF does, or it returns an error +code. + + To set the parameters for a non-destructive +Video Overlay, applications must initialize the +flags field, the +fmt substructure, and call +VIDIOC_S_FBUF. Again the driver prepares for the +overlay and returns the framebuffer parameters as +VIDIOC_G_FBUF does, or it returns an error +code. + + For a destructive Video Overlay +applications must additionally provide a +base address. Setting up a DMA to a +random memory location can jeopardize the system security, its +stability or even damage the hardware, therefore only the superuser +can set the parameters for a destructive video overlay. + + + + + struct <structname>v4l2_framebuffer</structname> + + &cs-ustr; + + + __u32 + capability + + Overlay capability flags set by the driver, see +. + + + __u32 + flags + + Overlay control flags set by application and +driver, see + + + void * + base + + Physical base address of the framebuffer, +that is the address of the pixel in the top left corner of the +framebuffer.A physical base address may not suit all +platforms. GK notes in theory we should pass something like PCI device ++ memory region + offset instead. If you encounter problems please +discuss on the linux-media mailing list: &v4l-ml;. + + + + + + This field is irrelevant to +non-destructive Video Overlays. For +destructive Video Overlays applications must +provide a base address. The driver may accept only base addresses +which are a multiple of two, four or eight bytes. For +Video Output Overlays the driver must return +a valid base address, so applications can find the corresponding Linux +framebuffer device (see ). + + + &v4l2-pix-format; + fmt + + Layout of the frame buffer. The +v4l2_pix_format structure is defined in , for clarification the fields and acceptable values + are listed below: + + + + __u32 + width + Width of the frame buffer in pixels. + + + + __u32 + height + Height of the frame buffer in pixels. + + + + __u32 + pixelformat + The pixel format of the +framebuffer. + + + + + + For non-destructive Video +Overlays this field only defines a format for the +&v4l2-window; chromakey field. + + + + + + For destructive Video +Overlays applications must initialize this field. For +Video Output Overlays the driver must return +a valid format. + + + + + + Usually this is an RGB format (for example +V4L2_PIX_FMT_RGB565) +but YUV formats (only packed YUV formats when chroma keying is used, +not including V4L2_PIX_FMT_YUYV and +V4L2_PIX_FMT_UYVY) and the +V4L2_PIX_FMT_PAL8 format are also permitted. The +behavior of the driver when an application requests a compressed +format is undefined. See for information on +pixel formats. + + + + &v4l2-field; + field + Drivers and applications shall ignore this field. +If applicable, the field order is selected with the &VIDIOC-S-FMT; +ioctl, using the field field of +&v4l2-window;. + + + + __u32 + bytesperline + Distance in bytes between the leftmost pixels in +two adjacent lines. + + + This field is irrelevant to +non-destructive Video +Overlays.For destructive Video +Overlays both applications and drivers can set this field +to request padding bytes at the end of each line. Drivers however may +ignore the requested value, returning width +times bytes-per-pixel or a larger value required by the hardware. That +implies applications can just set this field to zero to get a +reasonable default.For Video Output +Overlays the driver must return a valid +value.Video hardware may access padding bytes, therefore +they must reside in accessible memory. Consider for example the case +where padding bytes after the last line of an image cross a system +page boundary. Capture devices may write padding bytes, the value is +undefined. Output devices ignore the contents of padding +bytes.When the image format is planar the +bytesperline value applies to the largest +plane and is divided by the same factor as the +width field for any smaller planes. For +example the Cb and Cr planes of a YUV 4:2:0 image have half as many +padding bytes following each line as the Y plane. To avoid ambiguities +drivers must return a bytesperline value +rounded up to a multiple of the scale factor. + + + + __u32 + sizeimage + This field is irrelevant to +non-destructive Video Overlays. For +destructive Video Overlays applications must +initialize this field. For Video Output +Overlays the driver must return a valid +format.Together with base it +defines the framebuffer memory accessible by the +driver. + + + + &v4l2-colorspace; + colorspace + This information supplements the +pixelformat and must be set by the driver, +see . + + + + __u32 + priv + Reserved for additional information about custom +(driver defined) formats. When not used drivers and applications must +set this field to zero. + + + +
+ + + Frame Buffer Capability Flags + + &cs-def; + + + V4L2_FBUF_CAP_EXTERNOVERLAY + 0x0001 + The device is capable of non-destructive overlays. +When the driver clears this flag, only destructive overlays are +supported. There are no drivers yet which support both destructive and +non-destructive overlays. + + + V4L2_FBUF_CAP_CHROMAKEY + 0x0002 + The device supports clipping by chroma-keying the +images. That is, image pixels replace pixels in the VGA or video +signal only where the latter assume a certain color. Chroma-keying +makes no sense for destructive overlays. + + + V4L2_FBUF_CAP_LIST_CLIPPING + 0x0004 + The device supports clipping using a list of clip +rectangles. + + + V4L2_FBUF_CAP_BITMAP_CLIPPING + 0x0008 + The device supports clipping using a bit mask. + + + V4L2_FBUF_CAP_LOCAL_ALPHA + 0x0010 + The device supports clipping/blending using the +alpha channel of the framebuffer or VGA signal. Alpha blending makes +no sense for destructive overlays. + + + V4L2_FBUF_CAP_GLOBAL_ALPHA + 0x0020 + The device supports alpha blending using a global +alpha value. Alpha blending makes no sense for destructive overlays. + + + V4L2_FBUF_CAP_LOCAL_INV_ALPHA + 0x0040 + The device supports clipping/blending using the +inverted alpha channel of the framebuffer or VGA signal. Alpha +blending makes no sense for destructive overlays. + + + V4L2_FBUF_CAP_SRC_CHROMAKEY + 0x0080 + The device supports Source Chroma-keying. Framebuffer pixels +with the chroma-key colors are replaced by video pixels, which is exactly opposite of +V4L2_FBUF_CAP_CHROMAKEY + + + +
+ + + Frame Buffer Flags + + &cs-def; + + + V4L2_FBUF_FLAG_PRIMARY + 0x0001 + The framebuffer is the primary graphics surface. +In other words, the overlay is destructive. [?] + + + V4L2_FBUF_FLAG_OVERLAY + 0x0002 + The frame buffer is an overlay surface the same +size as the capture. [?] + + + The purpose of +V4L2_FBUF_FLAG_PRIMARY and +V4L2_FBUF_FLAG_OVERLAY was never quite clear. +Most drivers seem to ignore these flags. For compatibility with the +bttv driver applications should set the +V4L2_FBUF_FLAG_OVERLAY flag. + + + V4L2_FBUF_FLAG_CHROMAKEY + 0x0004 + Use chroma-keying. The chroma-key color is +determined by the chromakey field of +&v4l2-window; and negotiated with the &VIDIOC-S-FMT; ioctl, see +and + . + + + There are no flags to enable +clipping using a list of clip rectangles or a bitmap. These methods +are negotiated with the &VIDIOC-S-FMT; ioctl, see and . + + + V4L2_FBUF_FLAG_LOCAL_ALPHA + 0x0008 + Use the alpha channel of the framebuffer to clip or +blend framebuffer pixels with video images. The blend +function is: output = framebuffer pixel * alpha + video pixel * (1 - +alpha). The actual alpha depth depends on the framebuffer pixel +format. + + + V4L2_FBUF_FLAG_GLOBAL_ALPHA + 0x0010 + Use a global alpha value to blend the framebuffer +with video images. The blend function is: output = (framebuffer pixel +* alpha + video pixel * (255 - alpha)) / 255. The alpha value is +determined by the global_alpha field of +&v4l2-window; and negotiated with the &VIDIOC-S-FMT; ioctl, see +and . + + + V4L2_FBUF_FLAG_LOCAL_INV_ALPHA + 0x0020 + Like +V4L2_FBUF_FLAG_LOCAL_ALPHA, use the alpha channel +of the framebuffer to clip or blend framebuffer pixels with video +images, but with an inverted alpha value. The blend function is: +output = framebuffer pixel * (1 - alpha) + video pixel * alpha. The +actual alpha depth depends on the framebuffer pixel format. + + + V4L2_FBUF_FLAG_SRC_CHROMAKEY + 0x0040 + Use source chroma-keying. The source chroma-key color is +determined by the chromakey field of +&v4l2-window; and negotiated with the &VIDIOC-S-FMT; ioctl, see and . +Both chroma-keying are mutual exclusive to each other, so same +chromakey field of &v4l2-window; is being used. + + + +
+
+ + + &return-value; + + + + EPERM + + VIDIOC_S_FBUF can only be called +by a privileged user to negotiate the parameters for a destructive +overlay. + + + + EBUSY + + The framebuffer parameters cannot be changed at this +time because overlay is already enabled, or capturing is enabled +and the hardware cannot capture and overlay simultaneously. + + + + EINVAL + + The ioctl is not supported or the +VIDIOC_S_FBUF parameters are unsuitable. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml b/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml new file mode 100644 index 000000000000..a4ae59b664eb --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml @@ -0,0 +1,212 @@ + + + ioctl VIDIOC_G_FMT, VIDIOC_S_FMT, +VIDIOC_TRY_FMT + &manvol; + + + + VIDIOC_G_FMT + VIDIOC_S_FMT + VIDIOC_TRY_FMT + Get or set the data format, try a format + + + + + + int ioctl + int fd + int request + struct v4l2_format +*argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_G_FMT, VIDIOC_S_FMT, VIDIOC_TRY_FMT + + + + argp + + + + + + + + + Description + + These ioctls are used to negotiate the format of data +(typically image format) exchanged between driver and +application. + + To query the current parameters applications set the +type field of a struct +v4l2_format to the respective buffer (stream) +type. For example video capture devices use +V4L2_BUF_TYPE_VIDEO_CAPTURE or +V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE. When the application +calls the VIDIOC_G_FMT ioctl with a pointer to +this structure the driver fills the respective member of the +fmt union. In case of video capture devices +that is either the &v4l2-pix-format; pix or +the &v4l2-pix-format-mplane; pix_mp member. +When the requested buffer type is not supported drivers return an +&EINVAL;. + + To change the current format parameters applications +initialize the type field and all +fields of the respective fmt +union member. For details see the documentation of the various devices +types in . Good practice is to query the +current parameters first, and to +modify only those parameters not suitable for the application. When +the application calls the VIDIOC_S_FMT ioctl +with a pointer to a v4l2_format structure +the driver checks +and adjusts the parameters against hardware abilities. Drivers +should not return an error code unless the input is ambiguous, this is +a mechanism to fathom device capabilities and to approach parameters +acceptable for both the application and driver. On success the driver +may program the hardware, allocate resources and generally prepare for +data exchange. +Finally the VIDIOC_S_FMT ioctl returns the +current format parameters as VIDIOC_G_FMT does. +Very simple, inflexible devices may even ignore all input and always +return the default parameters. However all V4L2 devices exchanging +data with the application must implement the +VIDIOC_G_FMT and +VIDIOC_S_FMT ioctl. When the requested buffer +type is not supported drivers return an &EINVAL; on a +VIDIOC_S_FMT attempt. When I/O is already in +progress or the resource is not available for other reasons drivers +return the &EBUSY;. + + The VIDIOC_TRY_FMT ioctl is equivalent +to VIDIOC_S_FMT with one exception: it does not +change driver state. It can also be called at any time, never +returning EBUSY. This function is provided to +negotiate parameters, to learn about hardware limitations, without +disabling I/O or possibly time consuming hardware preparations. +Although strongly recommended drivers are not required to implement +this ioctl. + + + struct <structname>v4l2_format</structname> + + + + + + + + &v4l2-buf-type; + type + + Type of the data stream, see . + + + union + fmt + + + + &v4l2-pix-format; + pix + Definition of an image format, see , used by video capture and output +devices. + + + + &v4l2-pix-format-mplane; + pix_mp + Definition of an image format, see , used by video capture and output +devices that support the multi-planar +version of the API. + + + + &v4l2-window; + win + Definition of an overlaid image, see , used by video overlay devices. + + + + &v4l2-vbi-format; + vbi + Raw VBI capture or output parameters. This is +discussed in more detail in . Used by raw VBI +capture and output devices. + + + + &v4l2-sliced-vbi-format; + sliced + Sliced VBI capture or output parameters. See + for details. Used by sliced VBI +capture and output devices. + + + + __u8 + raw_data[200] + Place holder for future extensions and custom +(driver defined) formats with type +V4L2_BUF_TYPE_PRIVATE and higher. + + + +
+
+ + + &return-value; + + + + EBUSY + + The data format cannot be changed at this +time, for example because I/O is already in progress. + + + + EINVAL + + The &v4l2-format; type +field is invalid, the requested buffer type not supported, or +VIDIOC_TRY_FMT was called and is not +supported with this buffer type. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-g-frequency.xml b/Documentation/DocBook/media/v4l/vidioc-g-frequency.xml new file mode 100644 index 000000000000..062d72069090 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-g-frequency.xml @@ -0,0 +1,145 @@ + + + ioctl VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY + &manvol; + + + + VIDIOC_G_FREQUENCY + VIDIOC_S_FREQUENCY + Get or set tuner or modulator radio +frequency + + + + + + int ioctl + int fd + int request + struct v4l2_frequency +*argp + + + + + int ioctl + int fd + int request + const struct v4l2_frequency +*argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY + + + + argp + + + + + + + + + Description + + To get the current tuner or modulator radio frequency +applications set the tuner field of a +&v4l2-frequency; to the respective tuner or modulator number (only +input devices have tuners, only output devices have modulators), zero +out the reserved array and +call the VIDIOC_G_FREQUENCY ioctl with a pointer +to this structure. The driver stores the current frequency in the +frequency field. + + To change the current tuner or modulator radio frequency +applications initialize the tuner, +type and +frequency fields, and the +reserved array of a &v4l2-frequency; and +call the VIDIOC_S_FREQUENCY ioctl with a pointer +to this structure. When the requested frequency is not possible the +driver assumes the closest possible value. However +VIDIOC_S_FREQUENCY is a write-only ioctl, it does +not return the actual new frequency. + + + struct <structname>v4l2_frequency</structname> + + &cs-str; + + + __u32 + tuner + The tuner or modulator index number. This is the +same value as in the &v4l2-input; tuner +field and the &v4l2-tuner; index field, or +the &v4l2-output; modulator field and the +&v4l2-modulator; index field. + + + &v4l2-tuner-type; + type + The tuner type. This is the same value as in the +&v4l2-tuner; type field. The field is not +applicable to modulators, &ie; ignored by drivers. + + + __u32 + frequency + Tuning frequency in units of 62.5 kHz, or if the +&v4l2-tuner; or &v4l2-modulator; capabilities flag +V4L2_TUNER_CAP_LOW is set, in units of 62.5 +Hz. + + + __u32 + reserved[8] + Reserved for future extensions. Drivers and + applications must set the array to zero. + + + +
+
+ + + &return-value; + + + + EINVAL + + The tuner index is out of +bounds or the value in the type field is +wrong. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-g-input.xml b/Documentation/DocBook/media/v4l/vidioc-g-input.xml new file mode 100644 index 000000000000..ed076e92760d --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-g-input.xml @@ -0,0 +1,100 @@ + + + ioctl VIDIOC_G_INPUT, VIDIOC_S_INPUT + &manvol; + + + + VIDIOC_G_INPUT + VIDIOC_S_INPUT + Query or select the current video input + + + + + + int ioctl + int fd + int request + int *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_G_INPUT, VIDIOC_S_INPUT + + + + argp + + + + + + + + + Description + + To query the current video input applications call the +VIDIOC_G_INPUT ioctl with a pointer to an integer +where the driver stores the number of the input, as in the +&v4l2-input; index field. This ioctl will +fail only when there are no video inputs, returning +EINVAL. + + To select a video input applications store the number of the +desired input in an integer and call the +VIDIOC_S_INPUT ioctl with a pointer to this +integer. Side effects are possible. For example inputs may support +different video standards, so the driver may implicitly switch the +current standard. It is good practice to select an input before +querying or negotiating any other parameters. + + Information about video inputs is available using the +&VIDIOC-ENUMINPUT; ioctl. + + + + &return-value; + + + + EINVAL + + The number of the video input is out of bounds, or +there are no video inputs at all and this ioctl is not +supported. + + + + EBUSY + + I/O is in progress, the input cannot be +switched. + + + + + + + diff --git a/Documentation/DocBook/media/v4l/vidioc-g-jpegcomp.xml b/Documentation/DocBook/media/v4l/vidioc-g-jpegcomp.xml new file mode 100644 index 000000000000..77394b287411 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-g-jpegcomp.xml @@ -0,0 +1,180 @@ + + + ioctl VIDIOC_G_JPEGCOMP, VIDIOC_S_JPEGCOMP + &manvol; + + + + VIDIOC_G_JPEGCOMP + VIDIOC_S_JPEGCOMP + + + + + + + int ioctl + int fd + int request + v4l2_jpegcompression *argp + + + + + int ioctl + int fd + int request + const v4l2_jpegcompression *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_G_JPEGCOMP, VIDIOC_S_JPEGCOMP + + + + argp + + + + + + + + + Description + + [to do] + + Ronald Bultje elaborates: + + + + APP is some application-specific information. The +application can set it itself, and it'll be stored in the JPEG-encoded +fields (eg; interlacing information for in an AVI or so). COM is the +same, but it's comments, like 'encoded by me' or so. + + jpeg_markers describes whether the huffman tables, +quantization tables and the restart interval information (all +JPEG-specific stuff) should be stored in the JPEG-encoded fields. +These define how the JPEG field is encoded. If you omit them, +applications assume you've used standard encoding. You usually do want +to add them. + + + + + struct <structname>v4l2_jpegcompression</structname> + + &cs-str; + + + int + quality + + + + int + APPn + + + + int + APP_len + + + + char + APP_data[60] + + + + int + COM_len + + + + char + COM_data[60] + + + + __u32 + jpeg_markers + See . + + + +
+ + + JPEG Markers Flags + + &cs-def; + + + V4L2_JPEG_MARKER_DHT + (1<<3) + Define Huffman Tables + + + V4L2_JPEG_MARKER_DQT + (1<<4) + Define Quantization Tables + + + V4L2_JPEG_MARKER_DRI + (1<<5) + Define Restart Interval + + + V4L2_JPEG_MARKER_COM + (1<<6) + Comment segment + + + V4L2_JPEG_MARKER_APP + (1<<7) + App segment, driver will always use APP0 + + + +
+
+ + + &return-value; + + + + EINVAL + + This ioctl is not supported. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-g-modulator.xml b/Documentation/DocBook/media/v4l/vidioc-g-modulator.xml new file mode 100644 index 000000000000..15ce660f0f5a --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-g-modulator.xml @@ -0,0 +1,246 @@ + + + ioctl VIDIOC_G_MODULATOR, VIDIOC_S_MODULATOR + &manvol; + + + + VIDIOC_G_MODULATOR + VIDIOC_S_MODULATOR + Get or set modulator attributes + + + + + + int ioctl + int fd + int request + struct v4l2_modulator +*argp + + + + + int ioctl + int fd + int request + const struct v4l2_modulator +*argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_G_MODULATOR, VIDIOC_S_MODULATOR + + + + argp + + + + + + + + + Description + + To query the attributes of a modulator applications initialize +the index field and zero out the +reserved array of a &v4l2-modulator; and +call the VIDIOC_G_MODULATOR ioctl with a pointer +to this structure. Drivers fill the rest of the structure or return an +&EINVAL; when the index is out of bounds. To enumerate all modulators +applications shall begin at index zero, incrementing by one until the +driver returns EINVAL. + + Modulators have two writable properties, an audio +modulation set and the radio frequency. To change the modulated audio +subprograms, applications initialize the index + and txsubchans fields and the +reserved array and call the +VIDIOC_S_MODULATOR ioctl. Drivers may choose a +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. + + To change the radio frequency the &VIDIOC-S-FREQUENCY; ioctl +is available. + + + struct <structname>v4l2_modulator</structname> + + &cs-str; + + + __u32 + index + Identifies the modulator, set by the +application. + + + __u8 + name[32] + Name of the modulator, a NUL-terminated ASCII +string. This information is intended for the user. + + + __u32 + capability + Modulator capability flags. No flags are defined +for this field, the tuner flags in &v4l2-tuner; +are used accordingly. The audio flags indicate the ability +to encode audio subprograms. They will not +change for example with the current video standard. + + + __u32 + rangelow + The lowest tunable frequency in units of 62.5 +KHz, or if the capability flag +V4L2_TUNER_CAP_LOW is set, in units of 62.5 +Hz. + + + __u32 + rangehigh + The highest tunable frequency in units of 62.5 +KHz, or if the capability flag +V4L2_TUNER_CAP_LOW is set, in units of 62.5 +Hz. + + + __u32 + txsubchans + With this field applications can determine how +audio sub-carriers shall be modulated. It contains a set of flags as +defined in . Note the tuner +rxsubchans flags are reused, but the +semantics are different. Video output devices are assumed to have an +analog or PCM audio input with 1-3 channels. The +txsubchans flags select one or more +channels for modulation, together with some audio subprogram +indicator, for example a stereo pilot tone. + + + __u32 + reserved[4] + Reserved for future extensions. Drivers and +applications must set the array to zero. + + + +
+ + + Modulator Audio Transmission Flags + + &cs-def; + + + V4L2_TUNER_SUB_MONO + 0x0001 + Modulate channel 1 as mono audio, when the input +has more channels, a down-mix of channel 1 and 2. This flag does not +combine with V4L2_TUNER_SUB_STEREO or +V4L2_TUNER_SUB_LANG1. + + + V4L2_TUNER_SUB_STEREO + 0x0002 + Modulate channel 1 and 2 as left and right +channel of a stereo audio signal. When the input has only one channel +or two channels and V4L2_TUNER_SUB_SAP is also +set, channel 1 is encoded as left and right channel. This flag does +not combine with V4L2_TUNER_SUB_MONO or +V4L2_TUNER_SUB_LANG1. When the driver does not +support stereo audio it shall fall back to mono. + + + V4L2_TUNER_SUB_LANG1 + 0x0008 + Modulate channel 1 and 2 as primary and secondary +language of a bilingual audio signal. When the input has only one +channel it is used for both languages. It is not possible to encode +the primary or secondary language only. This flag does not combine +with V4L2_TUNER_SUB_MONO, +V4L2_TUNER_SUB_STEREO or +V4L2_TUNER_SUB_SAP. If the hardware does not +support the respective audio matrix, or the current video standard +does not permit bilingual audio the +VIDIOC_S_MODULATOR ioctl shall return an &EINVAL; +and the driver shall fall back to mono or stereo mode. + + + V4L2_TUNER_SUB_LANG2 + 0x0004 + Same effect as +V4L2_TUNER_SUB_SAP. + + + V4L2_TUNER_SUB_SAP + 0x0004 + When combined with V4L2_TUNER_SUB_MONO + the first channel is encoded as mono audio, the last +channel as Second Audio Program. When the input has only one channel +it is used for both audio tracks. When the input has three channels +the mono track is a down-mix of channel 1 and 2. When combined with +V4L2_TUNER_SUB_STEREO channel 1 and 2 are +encoded as left and right stereo audio, channel 3 as Second Audio +Program. When the input has only two channels, the first is encoded as +left and right channel and the second as SAP. When the input has only +one channel it is used for all audio tracks. It is not possible to +encode a Second Audio Program only. This flag must combine with +V4L2_TUNER_SUB_MONO or +V4L2_TUNER_SUB_STEREO. If the hardware does not +support the respective audio matrix, or the current video standard +does not permit SAP the VIDIOC_S_MODULATOR ioctl +shall return an &EINVAL; and driver shall fall back to mono or stereo +mode. + + + V4L2_TUNER_SUB_RDS + 0x0010 + Enable the RDS encoder for a radio FM transmitter. + + + +
+
+ + + &return-value; + + + + EINVAL + + The &v4l2-modulator; +index is out of bounds. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-g-output.xml b/Documentation/DocBook/media/v4l/vidioc-g-output.xml new file mode 100644 index 000000000000..3ea8c0ed812e --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-g-output.xml @@ -0,0 +1,100 @@ + + + ioctl VIDIOC_G_OUTPUT, VIDIOC_S_OUTPUT + &manvol; + + + + VIDIOC_G_OUTPUT + VIDIOC_S_OUTPUT + Query or select the current video output + + + + + + int ioctl + int fd + int request + int *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_G_OUTPUT, VIDIOC_S_OUTPUT + + + + argp + + + + + + + + + Description + + To query the current video output applications call the +VIDIOC_G_OUTPUT ioctl with a pointer to an integer +where the driver stores the number of the output, as in the +&v4l2-output; index field. This ioctl +will fail only when there are no video outputs, returning the +&EINVAL;. + + To select a video output applications store the number of the +desired output in an integer and call the +VIDIOC_S_OUTPUT ioctl with a pointer to this integer. +Side effects are possible. For example outputs may support different +video standards, so the driver may implicitly switch the current +standard. It is good practice to select an output before querying or +negotiating any other parameters. + + Information about video outputs is available using the +&VIDIOC-ENUMOUTPUT; ioctl. + + + + &return-value; + + + + EINVAL + + The number of the video output is out of bounds, or +there are no video outputs at all and this ioctl is not +supported. + + + + EBUSY + + I/O is in progress, the output cannot be +switched. + + + + + + + diff --git a/Documentation/DocBook/media/v4l/vidioc-g-parm.xml b/Documentation/DocBook/media/v4l/vidioc-g-parm.xml new file mode 100644 index 000000000000..392aa9e5571e --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-g-parm.xml @@ -0,0 +1,332 @@ + + + ioctl VIDIOC_G_PARM, VIDIOC_S_PARM + &manvol; + + + + VIDIOC_G_PARM + VIDIOC_S_PARM + Get or set streaming parameters + + + + + + int ioctl + int fd + int request + v4l2_streamparm *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_G_PARM, VIDIOC_S_PARM + + + + argp + + + + + + + + + Description + + The current video standard determines a nominal number of +frames per second. If less than this number of frames is to be +captured or output, applications can request frame skipping or +duplicating on the driver side. This is especially useful when using +the read() or write(), which +are not augmented by timestamps or sequence counters, and to avoid +unnecessary data copying. + + Further these ioctls can be used to determine the number of +buffers used internally by a driver in read/write mode. For +implications see the section discussing the &func-read; +function. + + To get and set the streaming parameters applications call +the VIDIOC_G_PARM and +VIDIOC_S_PARM ioctl, respectively. They take a +pointer to a struct v4l2_streamparm which +contains a union holding separate parameters for input and output +devices. + + + struct <structname>v4l2_streamparm</structname> + + &cs-ustr; + + + &v4l2-buf-type; + type + + The buffer (stream) type, same as &v4l2-format; +type, set by the application. + + + union + parm + + + + + + &v4l2-captureparm; + capture + Parameters for capture devices, used when +type is +V4L2_BUF_TYPE_VIDEO_CAPTURE. + + + + &v4l2-outputparm; + output + Parameters for output devices, used when +type is +V4L2_BUF_TYPE_VIDEO_OUTPUT. + + + + __u8 + raw_data[200] + A place holder for future extensions and custom +(driver defined) buffer types V4L2_BUF_TYPE_PRIVATE and +higher. + + + +
+ + + struct <structname>v4l2_captureparm</structname> + + &cs-str; + + + __u32 + capability + See . + + + __u32 + capturemode + Set by drivers and applications, see . + + + &v4l2-fract; + timeperframe + This is is the desired period between +successive frames captured by the driver, in seconds. The +field is intended to skip frames on the driver side, saving I/O +bandwidth.Applications store here the desired frame +period, drivers return the actual frame period, which must be greater +or equal to the nominal frame period determined by the current video +standard (&v4l2-standard; frameperiod +field). Changing the video standard (also implicitly by switching the +video input) may reset this parameter to the nominal frame period. To +reset manually applications can just set this field to +zero.Drivers support this function only when they set the +V4L2_CAP_TIMEPERFRAME flag in the +capability field. + + + __u32 + extendedmode + Custom (driver specific) streaming parameters. When +unused, applications and drivers must set this field to zero. +Applications using this field should check the driver name and +version, see . + + + __u32 + readbuffers + Applications set this field to the desired number +of buffers used internally by the driver in &func-read; mode. Drivers +return the actual number of buffers. When an application requests zero +buffers, drivers should just return the current setting rather than +the minimum or an error code. For details see . + + + __u32 + reserved[4] + Reserved for future extensions. Drivers and +applications must set the array to zero. + + + +
+ + + struct <structname>v4l2_outputparm</structname> + + &cs-str; + + + __u32 + capability + See . + + + __u32 + outputmode + Set by drivers and applications, see . + + + &v4l2-fract; + timeperframe + This is is the desired period between +successive frames output by the driver, in seconds. + + + The field is intended to +repeat frames on the driver side in &func-write; mode (in streaming +mode timestamps can be used to throttle the output), saving I/O +bandwidth.Applications store here the desired frame +period, drivers return the actual frame period, which must be greater +or equal to the nominal frame period determined by the current video +standard (&v4l2-standard; frameperiod +field). Changing the video standard (also implicitly by switching the +video output) may reset this parameter to the nominal frame period. To +reset manually applications can just set this field to +zero.Drivers support this function only when they set the +V4L2_CAP_TIMEPERFRAME flag in the +capability field. + + + __u32 + extendedmode + Custom (driver specific) streaming parameters. When +unused, applications and drivers must set this field to zero. +Applications using this field should check the driver name and +version, see . + + + __u32 + writebuffers + Applications set this field to the desired number +of buffers used internally by the driver in +write() mode. Drivers return the actual number of +buffers. When an application requests zero buffers, drivers should +just return the current setting rather than the minimum or an error +code. For details see . + + + __u32 + reserved[4] + Reserved for future extensions. Drivers and +applications must set the array to zero. + + + +
+ + + Streaming Parameters Capabilites + + &cs-def; + + + V4L2_CAP_TIMEPERFRAME + 0x1000 + The frame skipping/repeating controlled by the +timeperframe field is supported. + + + +
+ + + Capture Parameters Flags + + &cs-def; + + + V4L2_MODE_HIGHQUALITY + 0x0001 + High quality imaging mode. High quality mode +is intended for still imaging applications. The idea is to get the +best possible image quality that the hardware can deliver. It is not +defined how the driver writer may achieve that; it will depend on the +hardware and the ingenuity of the driver writer. High quality mode is +a different mode from the the regular motion video capture modes. In +high quality mode: + + The driver may be able to capture higher +resolutions than for motion capture. + + + The driver may support fewer pixel formats +than motion capture (eg; true color). + + + The driver may capture and arithmetically +combine multiple successive fields or frames to remove color edge +artifacts and reduce the noise in the video data. + + + + The driver may capture images in slices like +a scanner in order to handle larger format images than would otherwise +be possible. + + + An image capture operation may be +significantly slower than motion capture. + + + Moving objects in the image might have +excessive motion blur. + + + Capture might only work through the +read() call. + + + + + +
+ +
+ + + &return-value; + + + + EINVAL + + This ioctl is not supported. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-g-priority.xml b/Documentation/DocBook/media/v4l/vidioc-g-priority.xml new file mode 100644 index 000000000000..5fb001978645 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-g-priority.xml @@ -0,0 +1,144 @@ + + + ioctl VIDIOC_G_PRIORITY, VIDIOC_S_PRIORITY + &manvol; + + + + VIDIOC_G_PRIORITY + VIDIOC_S_PRIORITY + Query or request the access priority associated with a +file descriptor + + + + + + int ioctl + int fd + int request + enum v4l2_priority *argp + + + + + int ioctl + int fd + int request + const enum v4l2_priority *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_G_PRIORITY, VIDIOC_S_PRIORITY + + + + argp + + Pointer to an enum v4l2_priority type. + + + + + + + Description + + To query the current access priority +applications call the VIDIOC_G_PRIORITY ioctl +with a pointer to an enum v4l2_priority variable where the driver stores +the current priority. + + To request an access priority applications store the +desired priority in an enum v4l2_priority variable and call +VIDIOC_S_PRIORITY ioctl with a pointer to this +variable. + + + enum v4l2_priority + + &cs-def; + + + V4L2_PRIORITY_UNSET + 0 + + + + V4L2_PRIORITY_BACKGROUND + 1 + Lowest priority, usually applications running in +background, for example monitoring VBI transmissions. A proxy +application running in user space will be necessary if multiple +applications want to read from a device at this priority. + + + V4L2_PRIORITY_INTERACTIVE + 2 + + + + V4L2_PRIORITY_DEFAULT + 2 + Medium priority, usually applications started and +interactively controlled by the user. For example TV viewers, Teletext +browsers, or just "panel" applications to change the channel or video +controls. This is the default priority unless an application requests +another. + + + V4L2_PRIORITY_RECORD + 3 + Highest priority. Only one file descriptor can have +this priority, it blocks any other fd from changing device properties. +Usually applications which must not be interrupted, like video +recording. + + + +
+
+ + + &return-value; + + + + EINVAL + + The requested priority value is invalid, or the +driver does not support access priorities. + + + + EBUSY + + Another application already requested higher +priority. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-g-sliced-vbi-cap.xml b/Documentation/DocBook/media/v4l/vidioc-g-sliced-vbi-cap.xml new file mode 100644 index 000000000000..10e721b17374 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-g-sliced-vbi-cap.xml @@ -0,0 +1,264 @@ + + + ioctl VIDIOC_G_SLICED_VBI_CAP + &manvol; + + + + VIDIOC_G_SLICED_VBI_CAP + Query sliced VBI capabilities + + + + + + int ioctl + int fd + int request + struct v4l2_sliced_vbi_cap *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_G_SLICED_VBI_CAP + + + + argp + + + + + + + + + Description + + To find out which data services are supported by a sliced +VBI capture or output device, applications initialize the +type field of a &v4l2-sliced-vbi-cap;, +clear the reserved array and +call the VIDIOC_G_SLICED_VBI_CAP ioctl. The +driver fills in the remaining fields or returns an &EINVAL; if the +sliced VBI API is unsupported or type +is invalid. + + Note the type field was added, +and the ioctl changed from read-only to write-read, in Linux 2.6.19. + + + struct <structname>v4l2_sliced_vbi_cap</structname> + + + + + + + + + + __u16 + service_set + A set of all data services +supported by the driver. Equal to the union of all elements of the +service_lines array. + + + __u16 + service_lines[2][24] + Each element of this array +contains a set of data services the hardware can look for or insert +into a particular scan line. Data services are defined in . Array indices map to ITU-R +line numbers (see also and ) as follows: + + + + + Element + 525 line systems + 625 line systems + + + + + service_lines[0][1] + 1 + 1 + + + + + service_lines[0][23] + 23 + 23 + + + + + service_lines[1][1] + 264 + 314 + + + + + service_lines[1][23] + 286 + 336 + + + + + + + + The number of VBI lines the +hardware can capture or output per frame, or the number of services it +can identify on a given line may be limited. For example on PAL line +16 the hardware may be able to look for a VPS or Teletext signal, but +not both at the same time. Applications can learn about these limits +using the &VIDIOC-S-FMT; ioctl as described in . + + + + + + + + Drivers must set +service_lines[0][0] and +service_lines[1][0] to zero. + + + &v4l2-buf-type; + type + Type of the data stream, see . Should be +V4L2_BUF_TYPE_SLICED_VBI_CAPTURE or +V4L2_BUF_TYPE_SLICED_VBI_OUTPUT. + + + __u32 + reserved[3] + This array is reserved for future +extensions. Applications and drivers must set it to zero. + + + +
+ + + + Sliced VBI services + + + + + + + + + + Symbol + Value + Reference + Lines, usually + Payload + + + + + V4L2_SLICED_TELETEXT_B (Teletext +System B) + 0x0001 + , + PAL/SECAM line 7-22, 320-335 (second field 7-22) + Last 42 of the 45 byte Teletext packet, that is +without clock run-in and framing code, lsb first transmitted. + + + V4L2_SLICED_VPS + 0x0400 + + PAL line 16 + Byte number 3 to 15 according to Figure 9 of +ETS 300 231, lsb first transmitted. + + + V4L2_SLICED_CAPTION_525 + 0x1000 + + NTSC line 21, 284 (second field 21) + Two bytes in transmission order, including parity +bit, lsb first transmitted. + + + V4L2_SLICED_WSS_625 + 0x4000 + , + PAL/SECAM line 23 + +Byte 0 1 + msb lsb msb lsb +Bit 7 6 5 4 3 2 1 0 x x 13 12 11 10 9 + + + + V4L2_SLICED_VBI_525 + 0x1000 + Set of services applicable to 525 +line systems. + + + V4L2_SLICED_VBI_625 + 0x4401 + Set of services applicable to 625 +line systems. + + + +
+ +
+ + + &return-value; + + + + EINVAL + + The device does not support sliced VBI capturing or +output, or the value in the type field is +wrong. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-g-std.xml b/Documentation/DocBook/media/v4l/vidioc-g-std.xml new file mode 100644 index 000000000000..912f8513e5da --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-g-std.xml @@ -0,0 +1,105 @@ + + + ioctl VIDIOC_G_STD, VIDIOC_S_STD + &manvol; + + + + VIDIOC_G_STD + VIDIOC_S_STD + Query or select the video standard of the current input + + + + + + int ioctl + int fd + int request + v4l2_std_id +*argp + + + + + int ioctl + int fd + int request + const v4l2_std_id +*argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_G_STD, VIDIOC_S_STD + + + + argp + + + + + + + + + Description + + To query and select the current video standard applications +use the VIDIOC_G_STD and VIDIOC_S_STD ioctls which take a pointer to a +&v4l2-std-id; type as argument. VIDIOC_G_STD can +return a single flag or a set of flags as in &v4l2-standard; field +id. The flags must be unambiguous such +that they appear in only one enumerated v4l2_standard structure. + + VIDIOC_S_STD accepts one or more +flags, being a write-only ioctl it does not return the actual new standard as +VIDIOC_G_STD does. When no flags are given or +the current input does not support the requested standard the driver +returns an &EINVAL;. When the standard set is ambiguous drivers may +return EINVAL or choose any of the requested +standards. + + + + &return-value; + + + + EINVAL + + This ioctl is not supported, or the +VIDIOC_S_STD parameter was unsuitable. + + + + EBUSY + + The device is busy and therefore can not change the standard + + + + + + + diff --git a/Documentation/DocBook/media/v4l/vidioc-g-tuner.xml b/Documentation/DocBook/media/v4l/vidioc-g-tuner.xml new file mode 100644 index 000000000000..bd98c734c06b --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-g-tuner.xml @@ -0,0 +1,535 @@ + + + ioctl VIDIOC_G_TUNER, VIDIOC_S_TUNER + &manvol; + + + + VIDIOC_G_TUNER + VIDIOC_S_TUNER + Get or set tuner attributes + + + + + + int ioctl + int fd + int request + struct v4l2_tuner +*argp + + + + + int ioctl + int fd + int request + const struct v4l2_tuner +*argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_G_TUNER, VIDIOC_S_TUNER + + + + argp + + + + + + + + + Description + + To query the attributes of a tuner applications initialize the +index field and zero out the +reserved array of a &v4l2-tuner; and call the +VIDIOC_G_TUNER ioctl with a pointer to this +structure. Drivers fill the rest of the structure or return an +&EINVAL; when the index is out of bounds. To enumerate all tuners +applications shall begin at index zero, incrementing by one until the +driver returns EINVAL. + + Tuners have two writable properties, the audio mode and +the radio frequency. To change the audio mode, applications initialize +the index, +audmode and +reserved fields and call the +VIDIOC_S_TUNER ioctl. This will +not change the current tuner, which is determined +by the current video input. Drivers may choose a different audio mode +if the requested mode is invalid or unsupported. Since this is a +write-only ioctl, it does not return the actually +selected audio mode. + + To change the radio frequency the &VIDIOC-S-FREQUENCY; ioctl +is available. + + + struct <structname>v4l2_tuner</structname> + + + + + + + + + __u32 + index + Identifies the tuner, set by the +application. + + + __u8 + name[32] + Name of the tuner, a +NUL-terminated ASCII string. This information is intended for the +user. + + + &v4l2-tuner-type; + type + Type of the tuner, see . + + + __u32 + capability + Tuner capability flags, see +. Audio flags indicate the ability +to decode audio subprograms. They will not +change, for example with the current video standard.When +the structure refers to a radio tuner only the +V4L2_TUNER_CAP_LOW, +V4L2_TUNER_CAP_STEREO and +V4L2_TUNER_CAP_RDS flags can be set. + + + __u32 + rangelow + The lowest tunable frequency in +units of 62.5 kHz, or if the capability +flag V4L2_TUNER_CAP_LOW is set, in units of 62.5 +Hz. + + + __u32 + rangehigh + The highest tunable frequency in +units of 62.5 kHz, or if the capability +flag V4L2_TUNER_CAP_LOW is set, in units of 62.5 +Hz. + + + __u32 + rxsubchans + Some tuners or audio +decoders can determine the received audio subprograms by analyzing +audio carriers, pilot tones or other indicators. To pass this +information drivers set flags defined in in this field. For +example: + + + + + V4L2_TUNER_SUB_MONO + receiving mono audio + + + + + STEREO | SAP + receiving stereo audio and a secondary audio +program + + + + + MONO | STEREO + receiving mono or stereo audio, the hardware cannot +distinguish + + + + + LANG1 | LANG2 + receiving bilingual audio + + + + + MONO | STEREO | LANG1 | LANG2 + receiving mono, stereo or bilingual +audio + + + + + When the +V4L2_TUNER_CAP_STEREO, +_LANG1, _LANG2 or +_SAP flag is cleared in the +capability field, the corresponding +V4L2_TUNER_SUB_ flag must not be set +here.This field is valid only if this is the tuner of the +current video input, or when the structure refers to a radio +tuner. + + + __u32 + audmode + The selected audio mode, see + for valid values. The audio mode does +not affect audio subprogram detection, and like a control it does not automatically change +unless the requested mode is invalid or unsupported. See for possible results when +the selected and received audio programs do not +match.Currently this is the only field of struct +v4l2_tuner applications can +change. + + + __u32 + signal + The signal strength if known, ranging +from 0 to 65535. Higher values indicate a better signal. + + + __s32 + afc + Automatic frequency control: When the +afc value is negative, the frequency is too +low, when positive too high. + + + __u32 + reserved[4] + Reserved for future extensions. Drivers and +applications must set the array to zero. + + + +
+ + + enum v4l2_tuner_type + + &cs-def; + + + V4L2_TUNER_RADIO + 1 + + + + V4L2_TUNER_ANALOG_TV + 2 + + + + +
+ + + Tuner and Modulator Capability Flags + + &cs-def; + + + V4L2_TUNER_CAP_LOW + 0x0001 + When set, tuning frequencies are expressed in units of +62.5 Hz, otherwise in units of 62.5 kHz. + + + V4L2_TUNER_CAP_NORM + 0x0002 + This is a multi-standard tuner; the video standard +can or must be switched. (B/G PAL tuners for example are typically not + considered multi-standard because the video standard is automatically + determined from the frequency band.) The set of supported video + standards is available from the &v4l2-input; pointing to this tuner, + see the description of ioctl &VIDIOC-ENUMINPUT; for details. Only + V4L2_TUNER_ANALOG_TV tuners can have this capability. + + + V4L2_TUNER_CAP_STEREO + 0x0010 + Stereo audio reception is supported. + + + V4L2_TUNER_CAP_LANG1 + 0x0040 + Reception of the primary language of a bilingual +audio program is supported. Bilingual audio is a feature of +two-channel systems, transmitting the primary language monaural on the +main audio carrier and a secondary language monaural on a second +carrier. Only + V4L2_TUNER_ANALOG_TV tuners can have this capability. + + + V4L2_TUNER_CAP_LANG2 + 0x0020 + Reception of the secondary language of a bilingual +audio program is supported. Only + V4L2_TUNER_ANALOG_TV tuners can have this capability. + + + V4L2_TUNER_CAP_SAP + 0x0020 + Reception of a secondary audio program is +supported. This is a feature of the BTSC system which accompanies the +NTSC video standard. Two audio carriers are available for mono or +stereo transmissions of a primary language, and an independent third +carrier for a monaural secondary language. Only + V4L2_TUNER_ANALOG_TV tuners can have this capability.Note the +V4L2_TUNER_CAP_LANG2 and +V4L2_TUNER_CAP_SAP flags are synonyms. +V4L2_TUNER_CAP_SAP applies when the tuner +supports the V4L2_STD_NTSC_M video +standard. + + + V4L2_TUNER_CAP_RDS + 0x0080 + RDS capture is supported. This capability is only valid for +radio tuners. + + + +
+ + + Tuner Audio Reception Flags + + &cs-def; + + + V4L2_TUNER_SUB_MONO + 0x0001 + The tuner receives a mono audio signal. + + + V4L2_TUNER_SUB_STEREO + 0x0002 + The tuner receives a stereo audio signal. + + + V4L2_TUNER_SUB_LANG1 + 0x0008 + The tuner receives the primary language of a +bilingual audio signal. Drivers must clear this flag when the current +video standard is V4L2_STD_NTSC_M. + + + V4L2_TUNER_SUB_LANG2 + 0x0004 + The tuner receives the secondary language of a +bilingual audio signal (or a second audio program). + + + V4L2_TUNER_SUB_SAP + 0x0004 + The tuner receives a Second Audio Program. Note the +V4L2_TUNER_SUB_LANG2 and +V4L2_TUNER_SUB_SAP flags are synonyms. The +V4L2_TUNER_SUB_SAP flag applies when the +current video standard is V4L2_STD_NTSC_M. + + + V4L2_TUNER_SUB_RDS + 0x0010 + The tuner receives an RDS channel. + + + +
+ + + Tuner Audio Modes + + &cs-def; + + + V4L2_TUNER_MODE_MONO + 0 + Play mono audio. When the tuner receives a stereo +signal this a down-mix of the left and right channel. When the tuner +receives a bilingual or SAP signal this mode selects the primary +language. + + + V4L2_TUNER_MODE_STEREO + 1 + Play stereo audio. When the tuner receives +bilingual audio it may play different languages on the left and right +channel or the primary language is played on both channels.Playing +different languages in this mode is +deprecated. New drivers should do this only in +MODE_LANG1_LANG2.When the tuner +receives no stereo signal or does not support stereo reception the +driver shall fall back to MODE_MONO. + + + V4L2_TUNER_MODE_LANG1 + 3 + Play the primary language, mono or stereo. Only +V4L2_TUNER_ANALOG_TV tuners support this +mode. + + + V4L2_TUNER_MODE_LANG2 + 2 + Play the secondary language, mono. When the tuner +receives no bilingual audio or SAP, or their reception is not +supported the driver shall fall back to mono or stereo mode. Only +V4L2_TUNER_ANALOG_TV tuners support this +mode. + + + V4L2_TUNER_MODE_SAP + 2 + Play the Second Audio Program. When the tuner +receives no bilingual audio or SAP, or their reception is not +supported the driver shall fall back to mono or stereo mode. Only +V4L2_TUNER_ANALOG_TV tuners support this mode. +Note the V4L2_TUNER_MODE_LANG2 and +V4L2_TUNER_MODE_SAP are synonyms. + + + V4L2_TUNER_MODE_LANG1_LANG2 + 4 + Play the primary language on the left channel, the +secondary language on the right channel. When the tuner receives no +bilingual audio or SAP, it shall fall back to +MODE_LANG1 or MODE_MONO. +Only V4L2_TUNER_ANALOG_TV tuners support this +mode. + + + +
+ + + Tuner Audio Matrix + + + + + + + + + + + Selected +V4L2_TUNER_MODE_ + + + Received V4L2_TUNER_SUB_ + MONO + STEREO + LANG1 + LANG2 = SAP + LANG1_LANG2This +mode has been added in Linux 2.6.17 and may not be supported by older +drivers. + + + + + MONO + Mono + Mono/Mono + Mono + Mono + Mono/Mono + + + MONO | SAP + Mono + Mono/Mono + Mono + SAP + Mono/SAP (preferred) or Mono/Mono + + + STEREO + L+R + L/R + Stereo L/R (preferred) or Mono L+R + Stereo L/R (preferred) or Mono L+R + L/R (preferred) or L+R/L+R + + + STEREO | SAP + L+R + L/R + Stereo L/R (preferred) or Mono L+R + SAP + L+R/SAP (preferred) or L/R or L+R/L+R + + + LANG1 | LANG2 + Language 1 + Lang1/Lang2 (deprecatedPlayback of +both languages in MODE_STEREO is deprecated. In +the future drivers should produce only the primary language in this +mode. Applications should request +MODE_LANG1_LANG2 to record both languages or a +stereo signal.) or +Lang1/Lang1 + Language 1 + Language 2 + Lang1/Lang2 (preferred) or Lang1/Lang1 + + + +
+
+ + + &return-value; + + + + EINVAL + + The &v4l2-tuner; index is +out of bounds. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-log-status.xml b/Documentation/DocBook/media/v4l/vidioc-log-status.xml new file mode 100644 index 000000000000..2634b7c88b58 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-log-status.xml @@ -0,0 +1,58 @@ + + + ioctl VIDIOC_LOG_STATUS + &manvol; + + + + VIDIOC_LOG_STATUS + Log driver status information + + + + + + int ioctl + int fd + int request + + + + + + Description + + As the video/audio devices become more complicated it +becomes harder to debug problems. When this ioctl is called the driver +will output the current device status to the kernel log. This is +particular useful when dealing with problems like no sound, no video +and incorrectly tuned channels. Also many modern devices autodetect +video and audio standards and this ioctl will report what the device +thinks what the standard is. Mismatches may give an indication where +the problem is. + + This ioctl is optional and not all drivers support it. It +was introduced in Linux 2.6.15. + + + + &return-value; + + + + EINVAL + + The driver does not support this ioctl. + + + + + + + diff --git a/Documentation/DocBook/media/v4l/vidioc-overlay.xml b/Documentation/DocBook/media/v4l/vidioc-overlay.xml new file mode 100644 index 000000000000..1036c582cc15 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-overlay.xml @@ -0,0 +1,83 @@ + + + ioctl VIDIOC_OVERLAY + &manvol; + + + + VIDIOC_OVERLAY + Start or stop video overlay + + + + + + int ioctl + int fd + int request + const int *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_OVERLAY + + + + argp + + + + + + + + + Description + + This ioctl is part of the video + overlay I/O method. Applications call + VIDIOC_OVERLAY to start or stop the + overlay. It takes a pointer to an integer which must be set to + zero by the application to stop overlay, to one to start. + + Drivers do not support &VIDIOC-STREAMON; or +&VIDIOC-STREAMOFF; with V4L2_BUF_TYPE_VIDEO_OVERLAY. + + + + &return-value; + + + + EINVAL + + Video overlay is not supported, or the +parameters have not been set up. See for the necessary steps. + + + + + + + diff --git a/Documentation/DocBook/media/v4l/vidioc-qbuf.xml b/Documentation/DocBook/media/v4l/vidioc-qbuf.xml new file mode 100644 index 000000000000..f2b11f8a4031 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-qbuf.xml @@ -0,0 +1,194 @@ + + + ioctl VIDIOC_QBUF, VIDIOC_DQBUF + &manvol; + + + + VIDIOC_QBUF + VIDIOC_DQBUF + Exchange a buffer with the driver + + + + + + int ioctl + int fd + int request + struct v4l2_buffer *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_QBUF, VIDIOC_DQBUF + + + + argp + + + + + + + + + Description + + Applications call the VIDIOC_QBUF ioctl +to enqueue an empty (capturing) or filled (output) buffer in the +driver's incoming queue. The semantics depend on the selected I/O +method. + + To enqueue a buffer applications set the type +field of a &v4l2-buffer; to the same buffer type as was previously used +with &v4l2-format; type and &v4l2-requestbuffers; +type. Applications must also set the +index field. Valid index numbers range from +zero to the number of buffers allocated with &VIDIOC-REQBUFS; +(&v4l2-requestbuffers; count) minus one. The +contents of the struct v4l2_buffer returned +by a &VIDIOC-QUERYBUF; ioctl will do as well. When the buffer is +intended for output (type is +V4L2_BUF_TYPE_VIDEO_OUTPUT, +V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, or +V4L2_BUF_TYPE_VBI_OUTPUT) applications must also +initialize the bytesused, +field and +timestamp fields, see for details. +Applications must also set flags to 0. If a driver +supports capturing from specific video inputs and you want to specify a video +input, then flags should be set to +V4L2_BUF_FLAG_INPUT and the field +input must be initialized to the desired input. +The reserved field must be set to 0. When using +the multi-planar API, the +m.planes field must contain a userspace pointer +to a filled-in array of &v4l2-plane; and the length +field must be set to the number of elements in that array. + + + To enqueue a memory mapped +buffer applications set the memory +field to V4L2_MEMORY_MMAP. When +VIDIOC_QBUF is called with a pointer to this +structure the driver sets the +V4L2_BUF_FLAG_MAPPED and +V4L2_BUF_FLAG_QUEUED flags and clears the +V4L2_BUF_FLAG_DONE flag in the +flags field, or it returns an +&EINVAL;. + + To enqueue a user pointer +buffer applications set the memory +field to V4L2_MEMORY_USERPTR, the +m.userptr field to the address of the +buffer and length to its size. When the multi-planar +API is used, m.userptr and +length members of the passed array of &v4l2-plane; +have to be used instead. When VIDIOC_QBUF is called with +a pointer to this structure the driver sets the +V4L2_BUF_FLAG_QUEUED flag and clears the +V4L2_BUF_FLAG_MAPPED and +V4L2_BUF_FLAG_DONE flags in the +flags field, or it returns an error code. +This ioctl locks the memory pages of the buffer in physical memory, +they cannot be swapped out to disk. Buffers remain locked until +dequeued, until the &VIDIOC-STREAMOFF; or &VIDIOC-REQBUFS; ioctl is +called, or until the device is closed. + + Applications call the VIDIOC_DQBUF +ioctl to dequeue a filled (capturing) or displayed (output) buffer +from the driver's outgoing queue. They just set the +type, memory +and reserved +fields of a &v4l2-buffer; as above, when VIDIOC_DQBUF +is called with a pointer to this structure the driver fills the +remaining fields or returns an error code. The driver may also set +V4L2_BUF_FLAG_ERROR in the flags +field. It indicates a non-critical (recoverable) streaming error. In such case +the application may continue as normal, but should be aware that data in the +dequeued buffer might be corrupted. When using the multi-planar API, the +planes array does not have to be passed; the m.planes +member must be set to NULL in that case. + + By default VIDIOC_DQBUF blocks when no +buffer is in the outgoing queue. When the +O_NONBLOCK flag was given to the &func-open; +function, VIDIOC_DQBUF returns immediately +with an &EAGAIN; when no buffer is available. + + The v4l2_buffer structure is +specified in . + + + + &return-value; + + + + EAGAIN + + Non-blocking I/O has been selected using +O_NONBLOCK and no buffer was in the outgoing +queue. + + + + EINVAL + + The buffer type is not +supported, or the index is out of bounds, +or no buffers have been allocated yet, or the +userptr or +length are invalid. + + + + ENOMEM + + Not enough physical or virtual memory was available to +enqueue a user pointer buffer. + + + + EIO + + VIDIOC_DQBUF failed due to an +internal error. Can also indicate temporary problems like signal +loss. Note the driver might dequeue an (empty) buffer despite +returning an error, or even stop capturing. Reusing such buffer may be unsafe +though and its details (e.g. index) may not be +returned either. It is recommended that drivers indicate recoverable errors +by setting the V4L2_BUF_FLAG_ERROR and returning 0 instead. +In that case the application should be able to safely reuse the buffer and +continue streaming. + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/vidioc-query-dv-preset.xml b/Documentation/DocBook/media/v4l/vidioc-query-dv-preset.xml new file mode 100644 index 000000000000..d272f7ab91b8 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-query-dv-preset.xml @@ -0,0 +1,87 @@ + + + ioctl VIDIOC_QUERY_DV_PRESET + &manvol; + + + + VIDIOC_QUERY_DV_PRESET + Sense the DV preset received by the current +input + + + + + + int ioctl + int fd + int request + struct v4l2_dv_preset *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_QUERY_DV_PRESET + + + + argp + + + + + + + + + Description + + The hardware may be able to detect the current DV preset +automatically, similar to sensing the video standard. To do so, applications +call VIDIOC_QUERY_DV_PRESET with a pointer to a +&v4l2-dv-preset; type. Once the hardware detects a preset, that preset is +returned in the preset field of &v4l2-dv-preset;. If the preset could not be +detected because there was no signal, or the signal was unreliable, or the +signal did not map to a supported preset, then the value V4L2_DV_INVALID is +returned. + + + + &return-value; + + + EINVAL + + This ioctl is not supported. + + + + EBUSY + + The device is busy and therefore can not sense the preset + + + + + + + diff --git a/Documentation/DocBook/media/v4l/vidioc-querybuf.xml b/Documentation/DocBook/media/v4l/vidioc-querybuf.xml new file mode 100644 index 000000000000..5c104d42d31c --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-querybuf.xml @@ -0,0 +1,110 @@ + + + ioctl VIDIOC_QUERYBUF + &manvol; + + + + VIDIOC_QUERYBUF + Query the status of a buffer + + + + + + int ioctl + int fd + int request + struct v4l2_buffer *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_QUERYBUF + + + + argp + + + + + + + + + Description + + This ioctl is part of the memory +mapping I/O method. It can be used to query the status of a +buffer at any time after buffers have been allocated with the +&VIDIOC-REQBUFS; ioctl. + + Applications set the type field + of a &v4l2-buffer; to the same buffer type as was previously used with +&v4l2-format; type and &v4l2-requestbuffers; +type, and the index + field. Valid index numbers range from zero +to the number of buffers allocated with &VIDIOC-REQBUFS; + (&v4l2-requestbuffers; count) minus one. +The reserved field should to set to 0. +When using the multi-planar API, the +m.planes field must contain a userspace pointer to an +array of &v4l2-plane; and the length field has +to be set to the number of elements in that array. +After calling VIDIOC_QUERYBUF with a pointer to + this structure drivers return an error code or fill the rest of +the structure. + + In the flags field the +V4L2_BUF_FLAG_MAPPED, +V4L2_BUF_FLAG_QUEUED and +V4L2_BUF_FLAG_DONE flags will be valid. The +memory field will be set to the current +I/O method. For the single-planar API, the m.offset +contains the offset of the buffer from the start of the device memory, +the length field its size. For the multi-planar API, +fields m.mem_offset and +length in the m.planes +array elements will be used instead. The driver may or may not set the remaining +fields and flags, they are meaningless in this context. + + The v4l2_buffer structure is + specified in . + + + + &return-value; + + + + EINVAL + + The buffer type is not +supported, or the index is out of bounds. + + + + + + + diff --git a/Documentation/DocBook/media/v4l/vidioc-querycap.xml b/Documentation/DocBook/media/v4l/vidioc-querycap.xml new file mode 100644 index 000000000000..f29f1b86213c --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-querycap.xml @@ -0,0 +1,303 @@ + + + ioctl VIDIOC_QUERYCAP + &manvol; + + + + VIDIOC_QUERYCAP + Query device capabilities + + + + + + int ioctl + int fd + int request + struct v4l2_capability *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_QUERYCAP + + + + argp + + + + + + + + + Description + + All V4L2 devices support the +VIDIOC_QUERYCAP ioctl. It is used to identify +kernel devices compatible with this specification and to obtain +information about driver and hardware capabilities. The ioctl takes a +pointer to a &v4l2-capability; which is filled by the driver. When the +driver is not compatible with this specification the ioctl returns an +&EINVAL;. + + + struct <structname>v4l2_capability</structname> + + &cs-str; + + + __u8 + driver[16] + Name of the driver, a unique NUL-terminated +ASCII string. For example: "bttv". Driver specific applications can +use this information to verify the driver identity. It is also useful +to work around known bugs, or to identify drivers in error reports. +The driver version is stored in the version +field.Storing strings in fixed sized arrays is bad +practice but unavoidable here. Drivers and applications should take +precautions to never read or write beyond the end of the array and to +make sure the strings are properly NUL-terminated. + + + __u8 + card[32] + Name of the device, a NUL-terminated ASCII string. +For example: "Yoyodyne TV/FM". One driver may support different brands +or models of video hardware. This information is intended for users, +for example in a menu of available devices. Since multiple TV cards of +the same brand may be installed which are supported by the same +driver, this name should be combined with the character device file +name (⪚ /dev/video2) or the +bus_info string to avoid +ambiguities. + + + __u8 + bus_info[32] + Location of the device in the system, a +NUL-terminated ASCII string. For example: "PCI Slot 4". This +information is intended for users, to distinguish multiple +identical devices. If no such information is available the field may +simply count the devices controlled by the driver, or contain the +empty string (bus_info[0] = 0). + + + __u32 + version + Version number of the driver. Together with +the driver field this identifies a +particular driver. The version number is formatted using the +KERNEL_VERSION() macro: + + + + +#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) + +__u32 version = KERNEL_VERSION(0, 8, 1); + +printf ("Version: %u.%u.%u\n", + (version >> 16) & 0xFF, + (version >> 8) & 0xFF, + version & 0xFF); + + + + __u32 + capabilities + Device capabilities, see . + + + __u32 + reserved[4] + Reserved for future extensions. Drivers must set +this array to zero. + + + +
+ + + Device Capabilities Flags + + &cs-def; + + + V4L2_CAP_VIDEO_CAPTURE + 0x00000001 + The device supports the single-planar API through the Video Capture interface. + + + V4L2_CAP_VIDEO_CAPTURE_MPLANE + 0x00001000 + The device supports the + multi-planar API through the + Video Capture interface. + + + V4L2_CAP_VIDEO_OUTPUT + 0x00000002 + The device supports the single-planar API through the Video Output interface. + + + V4L2_CAP_VIDEO_OUTPUT_MPLANE + 0x00002000 + The device supports the + multi-planar API through the + Video Output interface. + + + V4L2_CAP_VIDEO_OVERLAY + 0x00000004 + The device supports the Video Overlay interface. A video overlay device +typically stores captured images directly in the video memory of a +graphics card, with hardware clipping and scaling. + + + V4L2_CAP_VBI_CAPTURE + 0x00000010 + The device supports the Raw +VBI Capture interface, providing Teletext and Closed Caption +data. + + + V4L2_CAP_VBI_OUTPUT + 0x00000020 + The device supports the Raw VBI Output interface. + + + V4L2_CAP_SLICED_VBI_CAPTURE + 0x00000040 + The device supports the Sliced VBI Capture interface. + + + V4L2_CAP_SLICED_VBI_OUTPUT + 0x00000080 + The device supports the Sliced VBI Output interface. + + + V4L2_CAP_RDS_CAPTURE + 0x00000100 + The device supports the RDS capture interface. + + + V4L2_CAP_VIDEO_OUTPUT_OVERLAY + 0x00000200 + The device supports the Video +Output Overlay (OSD) interface. Unlike the Video +Overlay interface, this is a secondary function of video +output devices and overlays an image onto an outgoing video signal. +When the driver sets this flag, it must clear the +V4L2_CAP_VIDEO_OVERLAY flag and vice +versa.The &v4l2-framebuffer; lacks an +&v4l2-buf-type; field, therefore the type of overlay is implied by the +driver capabilities. + + + V4L2_CAP_HW_FREQ_SEEK + 0x00000400 + The device supports the &VIDIOC-S-HW-FREQ-SEEK; ioctl for +hardware frequency seeking. + + + V4L2_CAP_RDS_OUTPUT + 0x00000800 + The device supports the RDS output interface. + + + V4L2_CAP_TUNER + 0x00010000 + The device has some sort of tuner to +receive RF-modulated video signals. For more information about +tuner programming see +. + + + V4L2_CAP_AUDIO + 0x00020000 + The device has audio inputs or outputs. It may or +may not support audio recording or playback, in PCM or compressed +formats. PCM audio support must be implemented as ALSA or OSS +interface. For more information on audio inputs and outputs see . + + + V4L2_CAP_RADIO + 0x00040000 + This is a radio receiver. + + + V4L2_CAP_MODULATOR + 0x00080000 + The device has some sort of modulator to +emit RF-modulated video/audio signals. For more information about +modulator programming see +. + + + V4L2_CAP_READWRITE + 0x01000000 + The device supports the read() and/or write() +I/O methods. + + + V4L2_CAP_ASYNCIO + 0x02000000 + The device supports the asynchronous I/O methods. + + + V4L2_CAP_STREAMING + 0x04000000 + The device supports the streaming I/O method. + + + +
+
+ + + &return-value; + + + + EINVAL + + The device is not compatible with this +specification. + + + + +
+ + + diff --git a/Documentation/DocBook/media/v4l/vidioc-queryctrl.xml b/Documentation/DocBook/media/v4l/vidioc-queryctrl.xml new file mode 100644 index 000000000000..0d5e8283cf32 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-queryctrl.xml @@ -0,0 +1,434 @@ + + + ioctl VIDIOC_QUERYCTRL, VIDIOC_QUERYMENU + &manvol; + + + + VIDIOC_QUERYCTRL + VIDIOC_QUERYMENU + Enumerate controls and menu control items + + + + + + int ioctl + int fd + int request + struct v4l2_queryctrl *argp + + + + + int ioctl + int fd + int request + struct v4l2_querymenu *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_QUERYCTRL, VIDIOC_QUERYMENU + + + + argp + + + + + + + + + Description + + To query the attributes of a control applications set the +id field of a &v4l2-queryctrl; and call the +VIDIOC_QUERYCTRL ioctl with a pointer to this +structure. The driver fills the rest of the structure or returns an +&EINVAL; when the id is invalid. + + It is possible to enumerate controls by calling +VIDIOC_QUERYCTRL with successive +id values starting from +V4L2_CID_BASE up to and exclusive +V4L2_CID_BASE_LASTP1. Drivers may return +EINVAL if a control in this range is not +supported. Further applications can enumerate private controls, which +are not defined in this specification, by starting at +V4L2_CID_PRIVATE_BASE and incrementing +id until the driver returns +EINVAL. + + In both cases, when the driver sets the +V4L2_CTRL_FLAG_DISABLED flag in the +flags field this control is permanently +disabled and should be ignored by the application. + V4L2_CTRL_FLAG_DISABLED was +intended for two purposes: Drivers can skip predefined controls not +supported by the hardware (although returning EINVAL would do as +well), or disable predefined and private controls after hardware +detection without the trouble of reordering control arrays and indices +(EINVAL cannot be used to skip private controls because it would +prematurely end the enumeration). + + When the application ORs id with +V4L2_CTRL_FLAG_NEXT_CTRL the driver returns the +next supported control, or EINVAL if there is +none. Drivers which do not support this flag yet always return +EINVAL. + + Additional information is required for menu controls: the +names of the menu items. To query them applications set the +id and index +fields of &v4l2-querymenu; and call the +VIDIOC_QUERYMENU ioctl with a pointer to this +structure. The driver fills the rest of the structure or returns an +&EINVAL; when the id or +index is invalid. Menu items are enumerated +by calling VIDIOC_QUERYMENU with successive +index values from &v4l2-queryctrl; +minimum to +maximum, inclusive. Note that it is possible +for VIDIOC_QUERYMENU to return an &EINVAL; for some +indices between minimum and maximum. +In that case that particular menu item is not supported by this driver. Also note that +the minimum value is not necessarily 0. + + See also the examples in . + + + struct <structname>v4l2_queryctrl</structname> + + &cs-str; + + + __u32 + id + Identifies the control, set by the application. See + for predefined IDs. When the ID is ORed +with V4L2_CTRL_FLAG_NEXT_CTRL the driver clears the flag and returns +the first control with a higher ID. Drivers which do not support this +flag yet always return an &EINVAL;. + + + &v4l2-ctrl-type; + type + Type of control, see . + + + __u8 + name[32] + Name of the control, a NUL-terminated ASCII +string. This information is intended for the user. + + + __s32 + minimum + Minimum value, inclusive. This field gives a lower +bound for V4L2_CTRL_TYPE_INTEGER controls and the +lowest valid index for V4L2_CTRL_TYPE_MENU controls. +For V4L2_CTRL_TYPE_STRING controls the minimum value +gives the minimum length of the string. This length does not include the terminating +zero. It may not be valid for any other type of control, including +V4L2_CTRL_TYPE_INTEGER64 controls. Note that this is a +signed value. + + + __s32 + maximum + Maximum value, inclusive. This field gives an upper +bound for V4L2_CTRL_TYPE_INTEGER controls and the +highest valid index for V4L2_CTRL_TYPE_MENU +controls. +For V4L2_CTRL_TYPE_STRING controls the maximum value +gives the maximum length of the string. This length does not include the terminating +zero. It may not be valid for any other type of control, including +V4L2_CTRL_TYPE_INTEGER64 controls. Note that this is a +signed value. + + + __s32 + step + This field gives a step size for +V4L2_CTRL_TYPE_INTEGER controls. For +V4L2_CTRL_TYPE_STRING controls this field refers to +the string length that has to be a multiple of this step size. +It may not be valid for any other type of control, including +V4L2_CTRL_TYPE_INTEGER64 +controls.Generally drivers should not scale hardware +control values. It may be necessary for example when the +name or id imply +a particular unit and the hardware actually accepts only multiples of +said unit. If so, drivers must take care values are properly rounded +when scaling, such that errors will not accumulate on repeated +read-write cycles.This field gives the smallest change of +an integer control actually affecting hardware. Often the information +is needed when the user can change controls by keyboard or GUI +buttons, rather than a slider. When for example a hardware register +accepts values 0-511 and the driver reports 0-65535, step should be +128.Note that although signed, the step value is supposed to +be always positive. + + + __s32 + default_value + The default value of a +V4L2_CTRL_TYPE_INTEGER, +_BOOLEAN or _MENU control. +Not valid for other types of controls. Drivers reset controls only +when the driver is loaded, not later, in particular not when the +func-open; is called. + + + __u32 + flags + Control flags, see . + + + __u32 + reserved[2] + Reserved for future extensions. Drivers must set +the array to zero. + + + +
+ + + struct <structname>v4l2_querymenu</structname> + + &cs-str; + + + __u32 + id + Identifies the control, set by the application +from the respective &v4l2-queryctrl; +id. + + + __u32 + index + Index of the menu item, starting at zero, set by + the application. + + + __u8 + name[32] + Name of the menu item, a NUL-terminated ASCII +string. This information is intended for the user. + + + __u32 + reserved + Reserved for future extensions. Drivers must set +the array to zero. + + + +
+ + + enum v4l2_ctrl_type + + + + + + + + + Type + minimum + step + maximum + Description + + + + + V4L2_CTRL_TYPE_INTEGER + any + any + any + 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. + + + V4L2_CTRL_TYPE_BOOLEAN + 0 + 1 + 1 + A boolean-valued control. Zero corresponds to +"disabled", and one means "enabled". + + + V4L2_CTRL_TYPE_MENU + ≥ 0 + 1 + N-1 + The control has a menu of N choices. The names of +the menu items can be enumerated with the +VIDIOC_QUERYMENU ioctl. + + + V4L2_CTRL_TYPE_BUTTON + 0 + 0 + 0 + A control which performs an action when set. +Drivers must ignore the value passed with +VIDIOC_S_CTRL and return an &EINVAL; on a +VIDIOC_G_CTRL attempt. + + + V4L2_CTRL_TYPE_INTEGER64 + n/a + n/a + n/a + A 64-bit integer valued control. Minimum, maximum +and step size cannot be queried. + + + V4L2_CTRL_TYPE_STRING + ≥ 0 + ≥ 1 + ≥ 0 + The minimum and maximum string lengths. The step size +means that the string must be (minimum + N * step) characters long for +N ≥ 0. These lengths do not include the terminating zero, so in order to +pass a string of length 8 to &VIDIOC-S-EXT-CTRLS; you need to set the +size field of &v4l2-ext-control; to 9. For &VIDIOC-G-EXT-CTRLS; you can +set the size field to maximum + 1. +Which character encoding is used will depend on the string control itself and +should be part of the control documentation. + + + V4L2_CTRL_TYPE_CTRL_CLASS + n/a + n/a + n/a + This is not a control. When +VIDIOC_QUERYCTRL is called with a control ID +equal to a control class code (see ) + 1, the +ioctl returns the name of the control class and this control type. +Older drivers which do not support this feature return an +&EINVAL;. + + + +
+ + + Control Flags + + &cs-def; + + + V4L2_CTRL_FLAG_DISABLED + 0x0001 + This control is permanently disabled and should be +ignored by the application. Any attempt to change the control will +result in an &EINVAL;. + + + V4L2_CTRL_FLAG_GRABBED + 0x0002 + This control is temporarily unchangeable, for +example because another application took over control of the +respective resource. Such controls may be displayed specially in a +user interface. Attempts to change the control may result in an +&EBUSY;. + + + V4L2_CTRL_FLAG_READ_ONLY + 0x0004 + This control is permanently readable only. Any +attempt to change the control will result in an &EINVAL;. + + + V4L2_CTRL_FLAG_UPDATE + 0x0008 + A hint that changing this control may affect the +value of other controls within the same control class. Applications +should update their user interface accordingly. + + + V4L2_CTRL_FLAG_INACTIVE + 0x0010 + This control is not applicable to the current +configuration and should be displayed accordingly in a user interface. +For example the flag may be set on a MPEG audio level 2 bitrate +control when MPEG audio encoding level 1 was selected with another +control. + + + V4L2_CTRL_FLAG_SLIDER + 0x0020 + A hint that this control is best represented as a +slider-like element in a user interface. + + + V4L2_CTRL_FLAG_WRITE_ONLY + 0x0040 + This control is permanently writable only. Any +attempt to read the control will result in an &EACCES; error code. This +flag is typically present for relative controls or action controls where +writing a value will cause the device to carry out a given action +(⪚ motor control) but no meaningful value can be returned. + + + +
+
+ + + &return-value; + + + + EINVAL + + The &v4l2-queryctrl; id +is invalid. The &v4l2-querymenu; id is +invalid or index is out of range (less than +minimum or greater than maximum) +or this particular menu item is not supported by the driver. + + + + EACCES + + An attempt was made to read a write-only control. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-querystd.xml b/Documentation/DocBook/media/v4l/vidioc-querystd.xml new file mode 100644 index 000000000000..1a9e60393091 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-querystd.xml @@ -0,0 +1,89 @@ + + + ioctl VIDIOC_QUERYSTD + &manvol; + + + + VIDIOC_QUERYSTD + Sense the video standard received by the current +input + + + + + + int ioctl + int fd + int request + v4l2_std_id *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_QUERYSTD + + + + argp + + + + + + + + + Description + + The hardware may be able to detect the current video +standard automatically. To do so, applications call +VIDIOC_QUERYSTD with a pointer to a &v4l2-std-id; type. The +driver stores here a set of candidates, this can be a single flag or a +set of supported standards if for example the hardware can only +distinguish between 50 and 60 Hz systems. When detection is not +possible or fails, the set must contain all standards supported by the +current video input or output. + + + + + &return-value; + + + + EINVAL + + This ioctl is not supported. + + + + EBUSY + + The device is busy and therefore can not detect the standard + + + + + + + diff --git a/Documentation/DocBook/media/v4l/vidioc-reqbufs.xml b/Documentation/DocBook/media/v4l/vidioc-reqbufs.xml new file mode 100644 index 000000000000..69800ae23348 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-reqbufs.xml @@ -0,0 +1,150 @@ + + + ioctl VIDIOC_REQBUFS + &manvol; + + + + VIDIOC_REQBUFS + Initiate Memory Mapping or User Pointer I/O + + + + + + int ioctl + int fd + int request + struct v4l2_requestbuffers *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_REQBUFS + + + + argp + + + + + + + + + Description + + This ioctl is used to initiate memory +mapped or user pointer +I/O. Memory mapped buffers are located in device memory and must be +allocated with this ioctl before they can be mapped into the +application's address space. User buffers are allocated by +applications themselves, and this ioctl is merely used to switch the +driver into user pointer I/O mode and to setup some internal structures. + + To allocate device buffers applications initialize all +fields of the v4l2_requestbuffers structure. +They set the type field to the respective +stream or buffer type, the count field to +the desired number of buffers, memory +must be set to the requested I/O method and the reserved array +must be zeroed. When the ioctl +is called with a pointer to this structure the driver will attempt to allocate +the requested number of buffers and it stores the actual number +allocated in the count field. It can be +smaller than the number requested, even zero, when the driver runs out +of free memory. A larger number is also possible when the driver requires +more buffers to function correctly. For example video output requires at least two buffers, +one displayed and one filled by the application. + When the I/O method is not supported the ioctl +returns an &EINVAL;. + + Applications can call VIDIOC_REQBUFS +again to change the number of buffers, however this cannot succeed +when any buffers are still mapped. A count +value of zero frees all buffers, after aborting or finishing any DMA +in progress, an implicit &VIDIOC-STREAMOFF;. + + + struct <structname>v4l2_requestbuffers</structname> + + &cs-str; + + + __u32 + count + The number of buffers requested or granted. + + + &v4l2-buf-type; + type + Type of the stream or buffers, this is the same +as the &v4l2-format; type field. See for valid values. + + + &v4l2-memory; + memory + Applications set this field to +V4L2_MEMORY_MMAP or +V4L2_MEMORY_USERPTR. + + + __u32 + reserved[2] + A place holder for future extensions and custom +(driver defined) buffer types V4L2_BUF_TYPE_PRIVATE and +higher. This array should be zeroed by applications. + + + +
+
+ + + &return-value; + + + + EBUSY + + The driver supports multiple opens and I/O is already +in progress, or reallocation of buffers was attempted although one or +more are still mapped. + + + + EINVAL + + The buffer type (type field) or the +requested I/O method (memory) is not +supported. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml b/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml new file mode 100644 index 000000000000..c30dcc4232c0 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml @@ -0,0 +1,135 @@ + + + ioctl VIDIOC_S_HW_FREQ_SEEK + &manvol; + + + + VIDIOC_S_HW_FREQ_SEEK + Perform a hardware frequency seek + + + + + + int ioctl + int fd + int request + struct v4l2_hw_freq_seek +*argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_S_HW_FREQ_SEEK + + + + argp + + + + + + + + + Description + + Start a hardware frequency seek from the current frequency. +To do this applications initialize the tuner, +type, seek_upward, +spacing and +wrap_around fields, and zero out the +reserved array of a &v4l2-hw-freq-seek; and +call the VIDIOC_S_HW_FREQ_SEEK ioctl with a pointer +to this structure. + + This ioctl is supported if the V4L2_CAP_HW_FREQ_SEEK capability is set. + + + struct <structname>v4l2_hw_freq_seek</structname> + + &cs-str; + + + __u32 + tuner + The tuner index number. This is the +same value as in the &v4l2-input; tuner +field and the &v4l2-tuner; index field. + + + &v4l2-tuner-type; + type + The tuner type. This is the same value as in the +&v4l2-tuner; type field. + + + __u32 + seek_upward + If non-zero, seek upward from the current frequency, else seek downward. + + + __u32 + wrap_around + If non-zero, wrap around when at the end of the frequency range, else stop seeking. + + + __u32 + spacing + If non-zero, defines the hardware seek resolution in Hz. The driver selects the nearest value that is supported by the device. If spacing is zero a reasonable default value is used. + + + __u32 + reserved[7] + Reserved for future extensions. Drivers and + applications must set the array to zero. + + + +
+
+ + + &return-value; + + + + EINVAL + + The tuner index is out of +bounds or the value in the type field is +wrong. + + + + EAGAIN + + The ioctl timed-out. Try again. + + + + +
+ + diff --git a/Documentation/DocBook/media/v4l/vidioc-streamon.xml b/Documentation/DocBook/media/v4l/vidioc-streamon.xml new file mode 100644 index 000000000000..75ed39bf4d2b --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-streamon.xml @@ -0,0 +1,115 @@ + + + ioctl VIDIOC_STREAMON, VIDIOC_STREAMOFF + &manvol; + + + + VIDIOC_STREAMON + VIDIOC_STREAMOFF + Start or stop streaming I/O + + + + + + int ioctl + int fd + int request + const int *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_STREAMON, VIDIOC_STREAMOFF + + + + argp + + + + + + + + + Description + + The VIDIOC_STREAMON and +VIDIOC_STREAMOFF ioctl start and stop the capture +or output process during streaming (memory +mapping or user pointer) I/O. + + Specifically the capture hardware is disabled and no input +buffers are filled (if there are any empty buffers in the incoming +queue) until VIDIOC_STREAMON has been called. +Accordingly the output hardware is disabled, no video signal is +produced until VIDIOC_STREAMON has been called. +The ioctl will succeed only when at least one output buffer is in the +incoming queue. + + The VIDIOC_STREAMOFF ioctl, apart of +aborting or finishing any DMA in progress, unlocks any user pointer +buffers locked in physical memory, and it removes all buffers from the +incoming and outgoing queues. That means all images captured but not +dequeued yet will be lost, likewise all images enqueued for output but +not transmitted yet. I/O returns to the same state as after calling +&VIDIOC-REQBUFS; and can be restarted accordingly. + + Both ioctls take a pointer to an integer, the desired buffer or +stream type. This is the same as &v4l2-requestbuffers; +type. + + Note applications can be preempted for unknown periods right +before or after the VIDIOC_STREAMON or +VIDIOC_STREAMOFF calls, there is no notion of +starting or stopping "now". Buffer timestamps can be used to +synchronize with other events. + + + + &return-value; + + + + EINVAL + + Streaming I/O is not supported, the buffer +type is not supported, or no buffers have +been allocated (memory mapping) or enqueued (output) yet. + + + + EPIPE + + The driver implements pad-level format configuration and + the pipeline configuration is invalid. + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/vidioc-subdev-enum-frame-interval.xml b/Documentation/DocBook/media/v4l/vidioc-subdev-enum-frame-interval.xml new file mode 100644 index 000000000000..2f8f4f0a0235 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-subdev-enum-frame-interval.xml @@ -0,0 +1,152 @@ + + + ioctl VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL + &manvol; + + + + VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL + Enumerate frame intervals + + + + + + int ioctl + int fd + int request + struct v4l2_subdev_frame_interval_enum * + argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL + + + + argp + + + + + + + + + Description + + + Experimental + This is an experimental + interface and may change in the future. + + + This ioctl lets applications enumerate available frame intervals on a + given sub-device pad. Frame intervals only makes sense for sub-devices that + can control the frame period on their own. This includes, for instance, + image sensors and TV tuners. + + For the common use case of image sensors, the frame intervals + available on the sub-device output pad depend on the frame format and size + on the same pad. Applications must thus specify the desired format and size + when enumerating frame intervals. + + To enumerate frame intervals applications initialize the + index, pad, + code, width and + height fields of + &v4l2-subdev-frame-interval-enum; and call the + VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL ioctl with a pointer + to this structure. Drivers fill the rest of the structure or return + an &EINVAL; if one of the input fields is invalid. All frame intervals are + enumerable by beginning at index zero and incrementing by one until + EINVAL is returned. + + Available frame intervals may depend on the current 'try' formats + at other pads of the sub-device, as well as on the current active links. See + &VIDIOC-SUBDEV-G-FMT; for more information about the try formats. + + Sub-devices that support the frame interval enumeration ioctl should + implemented it on a single pad only. Its behaviour when supported on + multiple pads of the same sub-device is not defined. + + + struct <structname>v4l2_subdev_frame_interval_enum</structname> + + &cs-str; + + + __u32 + index + Number of the format in the enumeration, set by the + application. + + + __u32 + pad + Pad number as reported by the media controller API. + + + __u32 + code + The media bus format code, as defined in + . + + + __u32 + width + Frame width, in pixels. + + + __u32 + height + Frame height, in pixels. + + + &v4l2-fract; + interval + Period, in seconds, between consecutive video frames. + + + __u32 + reserved[9] + Reserved for future extensions. Applications and drivers must + set the array to zero. + + + +
+
+ + + &return-value; + + + + EINVAL + + The &v4l2-subdev-frame-interval-enum; + pad references a non-existing pad, one of + the code, width + or height fields are invalid for the given + pad or the index field is out of bounds. + + + + + +
diff --git a/Documentation/DocBook/media/v4l/vidioc-subdev-enum-frame-size.xml b/Documentation/DocBook/media/v4l/vidioc-subdev-enum-frame-size.xml new file mode 100644 index 000000000000..79ce42b7c60c --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-subdev-enum-frame-size.xml @@ -0,0 +1,154 @@ + + + ioctl VIDIOC_SUBDEV_ENUM_FRAME_SIZE + &manvol; + + + + VIDIOC_SUBDEV_ENUM_FRAME_SIZE + Enumerate media bus frame sizes + + + + + + int ioctl + int fd + int request + struct v4l2_subdev_frame_size_enum * + argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_SUBDEV_ENUM_FRAME_SIZE + + + + argp + + + + + + + + + Description + + + Experimental + This is an experimental + interface and may change in the future. + + + This ioctl allows applications to enumerate all frame sizes + supported by a sub-device on the given pad for the given media bus format. + Supported formats can be retrieved with the &VIDIOC-SUBDEV-ENUM-MBUS-CODE; + ioctl. + + To enumerate frame sizes applications initialize the + pad, code and + index fields of the + &v4l2-subdev-mbus-code-enum; and call the + VIDIOC_SUBDEV_ENUM_FRAME_SIZE ioctl with a pointer to + the structure. Drivers fill the minimum and maximum frame sizes or return + an &EINVAL; if one of the input parameters is invalid. + + Sub-devices that only support discrete frame sizes (such as most + sensors) will return one or more frame sizes with identical minimum and + maximum values. + + Not all possible sizes in given [minimum, maximum] ranges need to be + supported. For instance, a scaler that uses a fixed-point scaling ratio + might not be able to produce every frame size between the minimum and + maximum values. Applications must use the &VIDIOC-SUBDEV-S-FMT; ioctl to + try the sub-device for an exact supported frame size. + + Available frame sizes may depend on the current 'try' formats at other + pads of the sub-device, as well as on the current active links and the + current values of V4L2 controls. See &VIDIOC-SUBDEV-G-FMT; for more + information about try formats. + + + struct <structname>v4l2_subdev_frame_size_enum</structname> + + &cs-str; + + + __u32 + index + Number of the format in the enumeration, set by the + application. + + + __u32 + pad + Pad number as reported by the media controller API. + + + __u32 + code + The media bus format code, as defined in + . + + + __u32 + min_width + Minimum frame width, in pixels. + + + __u32 + max_width + Maximum frame width, in pixels. + + + __u32 + min_height + Minimum frame height, in pixels. + + + __u32 + max_height + Maximum frame height, in pixels. + + + __u32 + reserved[9] + Reserved for future extensions. Applications and drivers must + set the array to zero. + + + +
+
+ + + &return-value; + + + + EINVAL + + The &v4l2-subdev-frame-size-enum; pad + references a non-existing pad, the code is + invalid for the given pad or the index + field is out of bounds. + + + + +
diff --git a/Documentation/DocBook/media/v4l/vidioc-subdev-enum-mbus-code.xml b/Documentation/DocBook/media/v4l/vidioc-subdev-enum-mbus-code.xml new file mode 100644 index 000000000000..a6b3432449f6 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-subdev-enum-mbus-code.xml @@ -0,0 +1,119 @@ + + + ioctl VIDIOC_SUBDEV_ENUM_MBUS_CODE + &manvol; + + + + VIDIOC_SUBDEV_ENUM_MBUS_CODE + Enumerate media bus formats + + + + + + int ioctl + int fd + int request + struct v4l2_subdev_mbus_code_enum * + argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_SUBDEV_ENUM_MBUS_CODE + + + + argp + + + + + + + + + Description + + + Experimental + This is an experimental + interface and may change in the future. + + + To enumerate media bus formats available at a given sub-device pad + applications initialize the pad and + index fields of &v4l2-subdev-mbus-code-enum; and + call the VIDIOC_SUBDEV_ENUM_MBUS_CODE ioctl with a + pointer to this structure. Drivers fill the rest of the structure or return + an &EINVAL; if either the pad or + index are invalid. All media bus formats are + enumerable by beginning at index zero and incrementing by one until + EINVAL is returned. + + Available media bus formats may depend on the current 'try' formats + at other pads of the sub-device, as well as on the current active links. See + &VIDIOC-SUBDEV-G-FMT; for more information about the try formats. + + + struct <structname>v4l2_subdev_mbus_code_enum</structname> + + &cs-str; + + + __u32 + pad + Pad number as reported by the media controller API. + + + __u32 + index + Number of the format in the enumeration, set by the + application. + + + __u32 + code + The media bus format code, as defined in + . + + + __u32 + reserved[9] + Reserved for future extensions. Applications and drivers must + set the array to zero. + + + +
+
+ + + &return-value; + + + + EINVAL + + The &v4l2-subdev-mbus-code-enum; pad + references a non-existing pad, or the index + field is out of bounds. + + + + +
diff --git a/Documentation/DocBook/media/v4l/vidioc-subdev-g-crop.xml b/Documentation/DocBook/media/v4l/vidioc-subdev-g-crop.xml new file mode 100644 index 000000000000..06197323a8cc --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-subdev-g-crop.xml @@ -0,0 +1,155 @@ + + + ioctl VIDIOC_SUBDEV_G_CROP, VIDIOC_SUBDEV_S_CROP + &manvol; + + + + VIDIOC_SUBDEV_G_CROP + VIDIOC_SUBDEV_S_CROP + Get or set the crop rectangle on a subdev pad + + + + + + int ioctl + int fd + int request + struct v4l2_subdev_crop *argp + + + + + int ioctl + int fd + int request + const struct v4l2_subdev_crop *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_SUBDEV_G_CROP, VIDIOC_SUBDEV_S_CROP + + + + argp + + + + + + + + + Description + + + Experimental + This is an experimental + interface and may change in the future. + + + To retrieve the current crop rectangle applications set the + pad field of a &v4l2-subdev-crop; to the + desired pad number as reported by the media API and the + which field to + V4L2_SUBDEV_FORMAT_ACTIVE. They then call the + VIDIOC_SUBDEV_G_CROP ioctl with a pointer to this + structure. The driver fills the members of the rect + field or returns &EINVAL; if the input arguments are invalid, or if cropping + is not supported on the given pad. + + To change the current crop rectangle applications set both the + pad and which fields + and all members of the rect field. They then call + the VIDIOC_SUBDEV_S_CROP ioctl with a pointer to this + structure. The driver verifies the requested crop rectangle, adjusts it + based on the hardware capabilities and configures the device. Upon return + the &v4l2-subdev-crop; contains the current format as would be returned + by a VIDIOC_SUBDEV_G_CROP call. + + Applications can query the device capabilities by setting the + which to + V4L2_SUBDEV_FORMAT_TRY. When set, 'try' crop + rectangles are not applied to the device by the driver, but are mangled + exactly as active crop rectangles and stored in the sub-device file handle. + Two applications querying the same sub-device would thus not interact with + each other. + + Drivers must not return an error solely because the requested crop + rectangle doesn't match the device capabilities. They must instead modify + the rectangle to match what the hardware can provide. The modified format + should be as close as possible to the original request. + + + struct <structname>v4l2_subdev_crop</structname> + + &cs-str; + + + __u32 + pad + Pad number as reported by the media framework. + + + __u32 + which + Crop rectangle to get or set, from + &v4l2-subdev-format-whence;. + + + &v4l2-rect; + rect + Crop rectangle boundaries, in pixels. + + + __u32 + reserved[8] + Reserved for future extensions. Applications and drivers must + set the array to zero. + + + +
+
+ + + &return-value; + + + + EBUSY + + The crop rectangle can't be changed because the pad is currently + busy. This can be caused, for instance, by an active video stream on + the pad. The ioctl must not be retried without performing another + action to fix the problem first. Only returned by + VIDIOC_SUBDEV_S_CROP + + + + EINVAL + + The &v4l2-subdev-crop; pad + references a non-existing pad, the which + field references a non-existing format, or cropping is not supported + on the given subdev pad. + + + + +
diff --git a/Documentation/DocBook/media/v4l/vidioc-subdev-g-fmt.xml b/Documentation/DocBook/media/v4l/vidioc-subdev-g-fmt.xml new file mode 100644 index 000000000000..f367c570c530 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-subdev-g-fmt.xml @@ -0,0 +1,180 @@ + + + ioctl VIDIOC_SUBDEV_G_FMT, VIDIOC_SUBDEV_S_FMT + &manvol; + + + + VIDIOC_SUBDEV_G_FMT + VIDIOC_SUBDEV_S_FMT + Get or set the data format on a subdev pad + + + + + + int ioctl + int fd + int request + struct v4l2_subdev_format *argp + + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_SUBDEV_G_FMT, VIDIOC_SUBDEV_S_FMT + + + + argp + + + + + + + + + Description + + + Experimental + This is an experimental + interface and may change in the future. + + + These ioctls are used to negotiate the frame format at specific + subdev pads in the image pipeline. + + To retrieve the current format applications set the + pad field of a &v4l2-subdev-format; to the + desired pad number as reported by the media API and the + which field to + V4L2_SUBDEV_FORMAT_ACTIVE. When they call the + VIDIOC_SUBDEV_G_FMT ioctl with a pointer to this + structure the driver fills the members of the format + field. + + To change the current format applications set both the + pad and which fields + and all members of the format field. When they + call the VIDIOC_SUBDEV_S_FMT ioctl with a pointer to this + structure the driver verifies the requested format, adjusts it based on the + hardware capabilities and configures the device. Upon return the + &v4l2-subdev-format; contains the current format as would be returned by a + VIDIOC_SUBDEV_G_FMT call. + + Applications can query the device capabilities by setting the + which to + V4L2_SUBDEV_FORMAT_TRY. When set, 'try' formats are not + applied to the device by the driver, but are changed exactly as active + formats and stored in the sub-device file handle. Two applications querying + the same sub-device would thus not interact with each other. + + For instance, to try a format at the output pad of a sub-device, + applications would first set the try format at the sub-device input with the + VIDIOC_SUBDEV_S_FMT ioctl. They would then either + retrieve the default format at the output pad with the + VIDIOC_SUBDEV_G_FMT ioctl, or set the desired output + pad format with the VIDIOC_SUBDEV_S_FMT ioctl and check + the returned value. + + Try formats do not depend on active formats, but can depend on the + current links configuration or sub-device controls value. For instance, a + low-pass noise filter might crop pixels at the frame boundaries, modifying + its output frame size. + + Drivers must not return an error solely because the requested format + doesn't match the device capabilities. They must instead modify the format + to match what the hardware can provide. The modified format should be as + close as possible to the original request. + + + struct <structname>v4l2_subdev_format</structname> + + &cs-str; + + + __u32 + pad + Pad number as reported by the media controller API. + + + __u32 + which + Format to modified, from &v4l2-subdev-format-whence;. + + + &v4l2-mbus-framefmt; + format + Definition of an image format, see for details. + + + __u32 + reserved[8] + Reserved for future extensions. Applications and drivers must + set the array to zero. + + + +
+ + + enum <structname>v4l2_subdev_format_whence</structname> + + &cs-def; + + + V4L2_SUBDEV_FORMAT_TRY + 0 + Try formats, used for querying device capabilities. + + + V4L2_SUBDEV_FORMAT_ACTIVE + 1 + Active formats, applied to the hardware. + + + +
+
+ + + &return-value; + + + + EBUSY + + The format can't be changed because the pad is currently busy. + This can be caused, for instance, by an active video stream on the + pad. The ioctl must not be retried without performing another action + to fix the problem first. Only returned by + VIDIOC_SUBDEV_S_FMT + + + + EINVAL + + The &v4l2-subdev-format; pad + references a non-existing pad, or the which + field references a non-existing format. + + + + +
diff --git a/Documentation/DocBook/media/v4l/vidioc-subdev-g-frame-interval.xml b/Documentation/DocBook/media/v4l/vidioc-subdev-g-frame-interval.xml new file mode 100644 index 000000000000..0bc3ea22d31f --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-subdev-g-frame-interval.xml @@ -0,0 +1,141 @@ + + + ioctl VIDIOC_SUBDEV_G_FRAME_INTERVAL, VIDIOC_SUBDEV_S_FRAME_INTERVAL + &manvol; + + + + VIDIOC_SUBDEV_G_FRAME_INTERVAL + VIDIOC_SUBDEV_S_FRAME_INTERVAL + Get or set the frame interval on a subdev pad + + + + + + int ioctl + int fd + int request + struct v4l2_subdev_frame_interval *argp + + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_SUBDEV_G_FRAME_INTERVAL, VIDIOC_SUBDEV_S_FRAME_INTERVAL + + + + argp + + + + + + + + + Description + + + Experimental + This is an experimental + interface and may change in the future. + + + These ioctls are used to get and set the frame interval at specific + subdev pads in the image pipeline. The frame interval only makes sense for + sub-devices that can control the frame period on their own. This includes, + for instance, image sensors and TV tuners. Sub-devices that don't support + frame intervals must not implement these ioctls. + + To retrieve the current frame interval applications set the + pad field of a &v4l2-subdev-frame-interval; to + the desired pad number as reported by the media controller API. When they + call the VIDIOC_SUBDEV_G_FRAME_INTERVAL ioctl with a + pointer to this structure the driver fills the members of the + interval field. + + To change the current frame interval applications set both the + pad field and all members of the + interval field. When they call the + VIDIOC_SUBDEV_S_FRAME_INTERVAL ioctl with a pointer to + this structure the driver verifies the requested interval, adjusts it based + on the hardware capabilities and configures the device. Upon return the + &v4l2-subdev-frame-interval; contains the current frame interval as would be + returned by a VIDIOC_SUBDEV_G_FRAME_INTERVAL call. + + + Drivers must not return an error solely because the requested interval + doesn't match the device capabilities. They must instead modify the interval + to match what the hardware can provide. The modified interval should be as + close as possible to the original request. + + Sub-devices that support the frame interval ioctls should implement + them on a single pad only. Their behaviour when supported on multiple pads + of the same sub-device is not defined. + + + struct <structname>v4l2_subdev_frame_interval</structname> + + &cs-str; + + + __u32 + pad + Pad number as reported by the media controller API. + + + &v4l2-fract; + interval + Period, in seconds, between consecutive video frames. + + + __u32 + reserved[9] + Reserved for future extensions. Applications and drivers must + set the array to zero. + + + +
+
+ + + &return-value; + + + + EBUSY + + The frame interval can't be changed because the pad is currently + busy. This can be caused, for instance, by an active video stream on + the pad. The ioctl must not be retried without performing another + action to fix the problem first. Only returned by + VIDIOC_SUBDEV_S_FRAME_INTERVAL + + + + EINVAL + + The &v4l2-subdev-frame-interval; pad + references a non-existing pad, or the pad doesn't support frame + intervals. + + + + +
diff --git a/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml b/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml new file mode 100644 index 000000000000..8b501791aa68 --- /dev/null +++ b/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml @@ -0,0 +1,133 @@ + + + ioctl VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT + &manvol; + + + + VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT + Subscribe or unsubscribe event + + + + + + int ioctl + int fd + int request + struct v4l2_event_subscription +*argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT + + + + argp + + + + + + + + + Description + + Subscribe or unsubscribe V4L2 event. Subscribed events are + dequeued by using the &VIDIOC-DQEVENT; ioctl. + + + struct <structname>v4l2_event_subscription</structname> + + &cs-str; + + + __u32 + type + Type of the event. + + + __u32 + reserved[7] + Reserved for future extensions. Drivers and applications + must set the array to zero. + + + +
+ + + Event Types + + &cs-def; + + + V4L2_EVENT_ALL + 0 + All events. V4L2_EVENT_ALL is valid only for + VIDIOC_UNSUBSCRIBE_EVENT for unsubscribing all events at once. + + + + V4L2_EVENT_VSYNC + 1 + This event is triggered on the vertical sync. + This event has &v4l2-event-vsync; associated with it. + + + + V4L2_EVENT_EOS + 2 + This event is triggered when the end of a stream is reached. + This is typically used with MPEG decoders to report to the application + when the last of the MPEG stream has been decoded. + + + + V4L2_EVENT_PRIVATE_START + 0x08000000 + Base event number for driver-private events. + + + +
+ + + struct <structname>v4l2_event_vsync</structname> + + &cs-str; + + + __u8 + field + The upcoming field. See &v4l2-field;. + + + +
+ +
+
+ diff --git a/Documentation/DocBook/media_api.tmpl b/Documentation/DocBook/media_api.tmpl new file mode 100644 index 000000000000..88f2cc680cc2 --- /dev/null +++ b/Documentation/DocBook/media_api.tmpl @@ -0,0 +1,115 @@ + + %media-entities; + + + + +open()."> +2C"> +Return ValueOn success 0 is returned, on error -1 and the errno variable is set appropriately:"> +2"> + + +"> +"> +"> + + +http://www.linuxtv.org/lists.php"> + + +http://linuxtv.org/repo/"> +]> + + + +LINUX MEDIA INFRASTRUCTURE API + + + 2009-2011 + LinuxTV Developers + + + + +Permission is granted to copy, distribute and/or modify +this document under the terms of the GNU Free Documentation License, +Version 1.1 or any later version published by the Free Software +Foundation. A copy of the license is included in the chapter entitled +"GNU Free Documentation License" + + + + + + + + Introduction + + This document covers the Linux Kernel to Userspace API's used by + video and radio straming devices, including video cameras, + analog and digital TV receiver cards, AM/FM receiver cards, + streaming capture devices. + It is divided into three parts. + The first part covers radio, capture, + cameras and analog TV devices. + The second part covers the + API used for digital TV and Internet reception via one of the + several digital tv standards. While it is called as DVB API, + in fact it covers several different video standards including + DVB-T, DVB-S, DVB-C and ATSC. The API is currently being updated + to documment support also for DVB-S2, ISDB-T and ISDB-S. + The third part covers Remote Controller API + For additional information and for the latest development code, + see: http://linuxtv.org. + For discussing improvements, reporting troubles, sending new drivers, etc, please mail to: Linux Media Mailing List (LMML).. + + + + +&sub-v4l2; + + +&sub-dvbapi; + + + + + +Mauro +Chehab +Carvalho +
mchehab@redhat.com
+Initial version. +
+
+ + 2009-2011 + Mauro Carvalho Chehab + + + + + +1.0.0 +2009-09-06 +mcc +Initial revision + + +
+ +Remote Controller API + +&sub-remote_controllers; + +
+ +&sub-media-controller; + + +&sub-fdl-appendix; + +
diff --git a/Documentation/DocBook/v4l/.gitignore b/Documentation/DocBook/v4l/.gitignore deleted file mode 100644 index d7ec32eafac9..000000000000 --- a/Documentation/DocBook/v4l/.gitignore +++ /dev/null @@ -1 +0,0 @@ -!*.xml diff --git a/Documentation/DocBook/v4l/bayer.pdf b/Documentation/DocBook/v4l/bayer.pdf deleted file mode 100644 index 905e60e6cd42..000000000000 Binary files a/Documentation/DocBook/v4l/bayer.pdf and /dev/null differ diff --git a/Documentation/DocBook/v4l/bayer.png b/Documentation/DocBook/v4l/bayer.png deleted file mode 100644 index 9b15fb22e817..000000000000 Binary files a/Documentation/DocBook/v4l/bayer.png and /dev/null differ diff --git a/Documentation/DocBook/v4l/biblio.xml b/Documentation/DocBook/v4l/biblio.xml deleted file mode 100644 index afc8a0dd2601..000000000000 --- a/Documentation/DocBook/v4l/biblio.xml +++ /dev/null @@ -1,188 +0,0 @@ - - References - - - EIA 608-B - - Electronic Industries Alliance (http://www.eia.org) - - EIA 608-B "Recommended Practice for Line 21 Data -Service" - - - - EN 300 294 - - European Telecommunication Standards Institute -(http://www.etsi.org) - - EN 300 294 "625-line television Wide Screen Signalling -(WSS)" - - - - ETS 300 231 - - European Telecommunication Standards Institute -(http://www.etsi.org) - - ETS 300 231 "Specification of the domestic video -Programme Delivery Control system (PDC)" - - - - ETS 300 706 - - European Telecommunication Standards Institute -(http://www.etsi.org) - - ETS 300 706 "Enhanced Teletext specification" - - - - ISO 13818-1 - - International Telecommunication Union (http://www.itu.ch), International -Organisation for Standardisation (http://www.iso.ch) - - ITU-T Rec. H.222.0 | ISO/IEC 13818-1 "Information -technology — Generic coding of moving pictures and associated -audio information: Systems" - - - - ISO 13818-2 - - International Telecommunication Union (http://www.itu.ch), International -Organisation for Standardisation (http://www.iso.ch) - - ITU-T Rec. H.262 | ISO/IEC 13818-2 "Information -technology — Generic coding of moving pictures and associated -audio information: Video" - - - - ITU BT.470 - - International Telecommunication Union (http://www.itu.ch) - - ITU-R Recommendation BT.470-6 "Conventional Television -Systems" - - - - ITU BT.601 - - International Telecommunication Union (http://www.itu.ch) - - ITU-R Recommendation BT.601-5 "Studio Encoding Parameters -of Digital Television for Standard 4:3 and Wide-Screen 16:9 Aspect -Ratios" - - - - ITU BT.653 - - International Telecommunication Union (http://www.itu.ch) - - ITU-R Recommendation BT.653-3 "Teletext systems" - - - - ITU BT.709 - - International Telecommunication Union (http://www.itu.ch) - - ITU-R Recommendation BT.709-5 "Parameter values for the -HDTV standards for production and international programme -exchange" - - - - ITU BT.1119 - - International Telecommunication Union (http://www.itu.ch) - - ITU-R Recommendation BT.1119 "625-line -television Wide Screen Signalling (WSS)" - - - - JFIF - - Independent JPEG Group (http://www.ijg.org) - - JPEG File Interchange Format - Version 1.02 - - - - SMPTE 12M - - Society of Motion Picture and Television Engineers -(http://www.smpte.org) - - SMPTE 12M-1999 "Television, Audio and Film - Time and -Control Code" - - - - SMPTE 170M - - Society of Motion Picture and Television Engineers -(http://www.smpte.org) - - SMPTE 170M-1999 "Television - Composite Analog Video -Signal - NTSC for Studio Applications" - - - - SMPTE 240M - - Society of Motion Picture and Television Engineers -(http://www.smpte.org) - - SMPTE 240M-1999 "Television - Signal Parameters - -1125-Line High-Definition Production" - - - - EN 50067 - - European Committee for Electrotechnical Standardization -(http://www.cenelec.eu) - - Specification of the radio data system (RDS) for VHF/FM sound broadcasting -in the frequency range from 87,5 to 108,0 MHz - - - - NRSC-4 - - National Radio Systems Committee -(http://www.nrscstandards.org) - - NTSC-4: United States RBDS Standard - - - - - diff --git a/Documentation/DocBook/v4l/capture.c.xml b/Documentation/DocBook/v4l/capture.c.xml deleted file mode 100644 index 1c5c49a2de59..000000000000 --- a/Documentation/DocBook/v4l/capture.c.xml +++ /dev/null @@ -1,659 +0,0 @@ - -/* - * V4L2 video capture example - * - * This program can be used and distributed without restrictions. - * - * This program is provided with the V4L2 API - * see http://linuxtv.org/docs.php for more information - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <assert.h> - -#include <getopt.h> /* getopt_long() */ - -#include <fcntl.h> /* low-level i/o */ -#include <unistd.h> -#include <errno.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <sys/time.h> -#include <sys/mman.h> -#include <sys/ioctl.h> - -#include <linux/videodev2.h> - -#define CLEAR(x) memset(&(x), 0, sizeof(x)) - -enum io_method { - IO_METHOD_READ, - IO_METHOD_MMAP, - IO_METHOD_USERPTR, -}; - -struct buffer { - void *start; - size_t length; -}; - -static char *dev_name; -static enum io_method io = IO_METHOD_MMAP; -static int fd = -1; -struct buffer *buffers; -static unsigned int n_buffers; -static int out_buf; -static int force_format; -static int frame_count = 70; - -static void errno_exit(const char *s) -{ - fprintf(stderr, "%s error %d, %s\n", s, errno, strerror(errno)); - exit(EXIT_FAILURE); -} - -static int xioctl(int fh, int request, void *arg) -{ - int r; - - do { - r = ioctl(fh, request, arg); - } while (-1 == r && EINTR == errno); - - return r; -} - -static void process_image(const void *p, int size) -{ - if (out_buf) - fwrite(p, size, 1, stdout); - - fflush(stderr); - fprintf(stderr, "."); - fflush(stdout); -} - -static int read_frame(void) -{ - struct v4l2_buffer buf; - unsigned int i; - - switch (io) { - case IO_METHOD_READ: - if (-1 == read(fd, buffers[0].start, buffers[0].length)) { - switch (errno) { - case EAGAIN: - return 0; - - case EIO: - /* Could ignore EIO, see spec. */ - - /* fall through */ - - default: - errno_exit("read"); - } - } - - process_image(buffers[0].start, buffers[0].length); - break; - - case IO_METHOD_MMAP: - CLEAR(buf); - - buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - buf.memory = V4L2_MEMORY_MMAP; - - if (-1 == xioctl(fd, VIDIOC_DQBUF, &buf)) { - switch (errno) { - case EAGAIN: - return 0; - - case EIO: - /* Could ignore EIO, see spec. */ - - /* fall through */ - - default: - errno_exit("VIDIOC_DQBUF"); - } - } - - assert(buf.index < n_buffers); - - process_image(buffers[buf.index].start, buf.bytesused); - - if (-1 == xioctl(fd, VIDIOC_QBUF, &buf)) - errno_exit("VIDIOC_QBUF"); - break; - - case IO_METHOD_USERPTR: - CLEAR(buf); - - buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - buf.memory = V4L2_MEMORY_USERPTR; - - if (-1 == xioctl(fd, VIDIOC_DQBUF, &buf)) { - switch (errno) { - case EAGAIN: - return 0; - - case EIO: - /* Could ignore EIO, see spec. */ - - /* fall through */ - - default: - errno_exit("VIDIOC_DQBUF"); - } - } - - for (i = 0; i < n_buffers; ++i) - if (buf.m.userptr == (unsigned long)buffers[i].start - && buf.length == buffers[i].length) - break; - - assert(i < n_buffers); - - process_image((void *)buf.m.userptr, buf.bytesused); - - if (-1 == xioctl(fd, VIDIOC_QBUF, &buf)) - errno_exit("VIDIOC_QBUF"); - break; - } - - return 1; -} - -static void mainloop(void) -{ - unsigned int count; - - count = frame_count; - - while (count-- > 0) { - for (;;) { - fd_set fds; - struct timeval tv; - int r; - - FD_ZERO(&fds); - FD_SET(fd, &fds); - - /* Timeout. */ - tv.tv_sec = 2; - tv.tv_usec = 0; - - r = select(fd + 1, &fds, NULL, NULL, &tv); - - if (-1 == r) { - if (EINTR == errno) - continue; - errno_exit("select"); - } - - if (0 == r) { - fprintf(stderr, "select timeout\n"); - exit(EXIT_FAILURE); - } - - if (read_frame()) - break; - /* EAGAIN - continue select loop. */ - } - } -} - -static void stop_capturing(void) -{ - enum v4l2_buf_type type; - - switch (io) { - case IO_METHOD_READ: - /* Nothing to do. */ - break; - - case IO_METHOD_MMAP: - case IO_METHOD_USERPTR: - type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - if (-1 == xioctl(fd, VIDIOC_STREAMOFF, &type)) - errno_exit("VIDIOC_STREAMOFF"); - break; - } -} - -static void start_capturing(void) -{ - unsigned int i; - enum v4l2_buf_type type; - - switch (io) { - case IO_METHOD_READ: - /* Nothing to do. */ - break; - - case IO_METHOD_MMAP: - for (i = 0; i < n_buffers; ++i) { - struct v4l2_buffer buf; - - CLEAR(buf); - buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - buf.memory = V4L2_MEMORY_MMAP; - buf.index = i; - - if (-1 == xioctl(fd, VIDIOC_QBUF, &buf)) - errno_exit("VIDIOC_QBUF"); - } - type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - if (-1 == xioctl(fd, VIDIOC_STREAMON, &type)) - errno_exit("VIDIOC_STREAMON"); - break; - - case IO_METHOD_USERPTR: - for (i = 0; i < n_buffers; ++i) { - struct v4l2_buffer buf; - - CLEAR(buf); - buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - buf.memory = V4L2_MEMORY_USERPTR; - buf.index = i; - buf.m.userptr = (unsigned long)buffers[i].start; - buf.length = buffers[i].length; - - if (-1 == xioctl(fd, VIDIOC_QBUF, &buf)) - errno_exit("VIDIOC_QBUF"); - } - type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - if (-1 == xioctl(fd, VIDIOC_STREAMON, &type)) - errno_exit("VIDIOC_STREAMON"); - break; - } -} - -static void uninit_device(void) -{ - unsigned int i; - - switch (io) { - case IO_METHOD_READ: - free(buffers[0].start); - break; - - case IO_METHOD_MMAP: - for (i = 0; i < n_buffers; ++i) - if (-1 == munmap(buffers[i].start, buffers[i].length)) - errno_exit("munmap"); - break; - - case IO_METHOD_USERPTR: - for (i = 0; i < n_buffers; ++i) - free(buffers[i].start); - break; - } - - free(buffers); -} - -static void init_read(unsigned int buffer_size) -{ - buffers = calloc(1, sizeof(*buffers)); - - if (!buffers) { - fprintf(stderr, "Out of memory\n"); - exit(EXIT_FAILURE); - } - - buffers[0].length = buffer_size; - buffers[0].start = malloc(buffer_size); - - if (!buffers[0].start) { - fprintf(stderr, "Out of memory\n"); - exit(EXIT_FAILURE); - } -} - -static void init_mmap(void) -{ - struct v4l2_requestbuffers req; - - CLEAR(req); - - req.count = 4; - req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - req.memory = V4L2_MEMORY_MMAP; - - if (-1 == xioctl(fd, VIDIOC_REQBUFS, &req)) { - if (EINVAL == errno) { - fprintf(stderr, "%s does not support " - "memory mapping\n", dev_name); - exit(EXIT_FAILURE); - } else { - errno_exit("VIDIOC_REQBUFS"); - } - } - - if (req.count < 2) { - fprintf(stderr, "Insufficient buffer memory on %s\n", - dev_name); - exit(EXIT_FAILURE); - } - - buffers = calloc(req.count, sizeof(*buffers)); - - if (!buffers) { - fprintf(stderr, "Out of memory\n"); - exit(EXIT_FAILURE); - } - - for (n_buffers = 0; n_buffers < req.count; ++n_buffers) { - struct v4l2_buffer buf; - - CLEAR(buf); - - buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - buf.memory = V4L2_MEMORY_MMAP; - buf.index = n_buffers; - - if (-1 == xioctl(fd, VIDIOC_QUERYBUF, &buf)) - errno_exit("VIDIOC_QUERYBUF"); - - buffers[n_buffers].length = buf.length; - buffers[n_buffers].start = - mmap(NULL /* start anywhere */, - buf.length, - PROT_READ | PROT_WRITE /* required */, - MAP_SHARED /* recommended */, - fd, buf.m.offset); - - if (MAP_FAILED == buffers[n_buffers].start) - errno_exit("mmap"); - } -} - -static void init_userp(unsigned int buffer_size) -{ - struct v4l2_requestbuffers req; - - CLEAR(req); - - req.count = 4; - req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - req.memory = V4L2_MEMORY_USERPTR; - - if (-1 == xioctl(fd, VIDIOC_REQBUFS, &req)) { - if (EINVAL == errno) { - fprintf(stderr, "%s does not support " - "user pointer i/o\n", dev_name); - exit(EXIT_FAILURE); - } else { - errno_exit("VIDIOC_REQBUFS"); - } - } - - buffers = calloc(4, sizeof(*buffers)); - - if (!buffers) { - fprintf(stderr, "Out of memory\n"); - exit(EXIT_FAILURE); - } - - for (n_buffers = 0; n_buffers < 4; ++n_buffers) { - buffers[n_buffers].length = buffer_size; - buffers[n_buffers].start = malloc(buffer_size); - - if (!buffers[n_buffers].start) { - fprintf(stderr, "Out of memory\n"); - exit(EXIT_FAILURE); - } - } -} - -static void init_device(void) -{ - struct v4l2_capability cap; - struct v4l2_cropcap cropcap; - struct v4l2_crop crop; - struct v4l2_format fmt; - unsigned int min; - - if (-1 == xioctl(fd, VIDIOC_QUERYCAP, &cap)) { - if (EINVAL == errno) { - fprintf(stderr, "%s is no V4L2 device\n", - dev_name); - exit(EXIT_FAILURE); - } else { - errno_exit("VIDIOC_QUERYCAP"); - } - } - - if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) { - fprintf(stderr, "%s is no video capture device\n", - dev_name); - exit(EXIT_FAILURE); - } - - switch (io) { - case IO_METHOD_READ: - if (!(cap.capabilities & V4L2_CAP_READWRITE)) { - fprintf(stderr, "%s does not support read i/o\n", - dev_name); - exit(EXIT_FAILURE); - } - break; - - case IO_METHOD_MMAP: - case IO_METHOD_USERPTR: - if (!(cap.capabilities & V4L2_CAP_STREAMING)) { - fprintf(stderr, "%s does not support streaming i/o\n", - dev_name); - exit(EXIT_FAILURE); - } - break; - } - - - /* Select video input, video standard and tune here. */ - - - CLEAR(cropcap); - - cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - - if (0 == xioctl(fd, VIDIOC_CROPCAP, &cropcap)) { - crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - crop.c = cropcap.defrect; /* reset to default */ - - if (-1 == xioctl(fd, VIDIOC_S_CROP, &crop)) { - switch (errno) { - case EINVAL: - /* Cropping not supported. */ - break; - default: - /* Errors ignored. */ - break; - } - } - } else { - /* Errors ignored. */ - } - - - CLEAR(fmt); - - fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - if (force_format) { - fmt.fmt.pix.width = 640; - fmt.fmt.pix.height = 480; - fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV; - fmt.fmt.pix.field = V4L2_FIELD_INTERLACED; - - if (-1 == xioctl(fd, VIDIOC_S_FMT, &fmt)) - errno_exit("VIDIOC_S_FMT"); - - /* Note VIDIOC_S_FMT may change width and height. */ - } else { - /* Preserve original settings as set by v4l2-ctl for example */ - if (-1 == xioctl(fd, VIDIOC_G_FMT, &fmt)) - errno_exit("VIDIOC_G_FMT"); - } - - /* Buggy driver paranoia. */ - min = fmt.fmt.pix.width * 2; - if (fmt.fmt.pix.bytesperline < min) - fmt.fmt.pix.bytesperline = min; - min = fmt.fmt.pix.bytesperline * fmt.fmt.pix.height; - if (fmt.fmt.pix.sizeimage < min) - fmt.fmt.pix.sizeimage = min; - - switch (io) { - case IO_METHOD_READ: - init_read(fmt.fmt.pix.sizeimage); - break; - - case IO_METHOD_MMAP: - init_mmap(); - break; - - case IO_METHOD_USERPTR: - init_userp(fmt.fmt.pix.sizeimage); - break; - } -} - -static void close_device(void) -{ - if (-1 == close(fd)) - errno_exit("close"); - - fd = -1; -} - -static void open_device(void) -{ - struct stat st; - - if (-1 == stat(dev_name, &st)) { - fprintf(stderr, "Cannot identify '%s': %d, %s\n", - dev_name, errno, strerror(errno)); - exit(EXIT_FAILURE); - } - - if (!S_ISCHR(st.st_mode)) { - fprintf(stderr, "%s is no device\n", dev_name); - exit(EXIT_FAILURE); - } - - fd = open(dev_name, O_RDWR /* required */ | O_NONBLOCK, 0); - - if (-1 == fd) { - fprintf(stderr, "Cannot open '%s': %d, %s\n", - dev_name, errno, strerror(errno)); - exit(EXIT_FAILURE); - } -} - -static void usage(FILE *fp, int argc, char **argv) -{ - fprintf(fp, - "Usage: %s [options]\n\n" - "Version 1.3\n" - "Options:\n" - "-d | --device name Video device name [%s]\n" - "-h | --help Print this message\n" - "-m | --mmap Use memory mapped buffers [default]\n" - "-r | --read Use read() calls\n" - "-u | --userp Use application allocated buffers\n" - "-o | --output Outputs stream to stdout\n" - "-f | --format Force format to 640x480 YUYV\n" - "-c | --count Number of frames to grab [%i]\n" - "", - argv[0], dev_name, frame_count); -} - -static const char short_options[] = "d:hmruofc:"; - -static const struct option -long_options[] = { - { "device", required_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - { "mmap", no_argument, NULL, 'm' }, - { "read", no_argument, NULL, 'r' }, - { "userp", no_argument, NULL, 'u' }, - { "output", no_argument, NULL, 'o' }, - { "format", no_argument, NULL, 'f' }, - { "count", required_argument, NULL, 'c' }, - { 0, 0, 0, 0 } -}; - -int main(int argc, char **argv) -{ - dev_name = "/dev/video0"; - - for (;;) { - int idx; - int c; - - c = getopt_long(argc, argv, - short_options, long_options, &idx); - - if (-1 == c) - break; - - switch (c) { - case 0: /* getopt_long() flag */ - break; - - case 'd': - dev_name = optarg; - break; - - case 'h': - usage(stdout, argc, argv); - exit(EXIT_SUCCESS); - - case 'm': - io = IO_METHOD_MMAP; - break; - - case 'r': - io = IO_METHOD_READ; - break; - - case 'u': - io = IO_METHOD_USERPTR; - break; - - case 'o': - out_buf++; - break; - - case 'f': - force_format++; - break; - - case 'c': - errno = 0; - frame_count = strtol(optarg, NULL, 0); - if (errno) - errno_exit(optarg); - break; - - default: - usage(stderr, argc, argv); - exit(EXIT_FAILURE); - } - } - - open_device(); - init_device(); - start_capturing(); - mainloop(); - stop_capturing(); - uninit_device(); - close_device(); - fprintf(stderr, "\n"); - return 0; -} - diff --git a/Documentation/DocBook/v4l/common.xml b/Documentation/DocBook/v4l/common.xml deleted file mode 100644 index 9028721438dc..000000000000 --- a/Documentation/DocBook/v4l/common.xml +++ /dev/null @@ -1,1197 +0,0 @@ - Common API Elements - - Programming a V4L2 device consists of these -steps: - - - - Opening the device - - - Changing device properties, selecting a video and audio -input, video standard, picture brightness a. o. - - - Negotiating a data format - - - Negotiating an input/output method - - - The actual input/output loop - - - Closing the device - - - - In practice most steps are optional and can be executed out of -order. It depends on the V4L2 device type, you can read about the -details in . In this chapter we will discuss -the basic concepts applicable to all devices. - -
- Opening and Closing Devices - -
- Device Naming - - V4L2 drivers are implemented as kernel modules, loaded -manually by the system administrator or automatically when a device is -first opened. The driver modules plug into the "videodev" kernel -module. It provides helper functions and a common application -interface specified in this document. - - Each driver thus loaded registers one or more device nodes -with major number 81 and a minor number between 0 and 255. Assigning -minor numbers to V4L2 devices is entirely up to the system administrator, -this is primarily intended to solve conflicts between devices. - Access permissions are associated with character -device special files, hence we must ensure device numbers cannot -change with the module load order. To this end minor numbers are no -longer automatically assigned by the "videodev" module as in V4L but -requested by the driver. The defaults will suffice for most people -unless two drivers compete for the same minor numbers. - The module options to select minor numbers are named -after the device special file with a "_nr" suffix. For example "video_nr" -for /dev/video video capture devices. The number is -an offset to the base minor number associated with the device type. - - In earlier versions of the V4L2 API the module options -where named after the device special file with a "unit_" prefix, expressing -the minor number itself, not an offset. Rationale for this change is unknown. -Lastly the naming and semantics are just a convention among driver writers, -the point to note is that minor numbers are not supposed to be hardcoded -into drivers. - When the driver supports multiple devices of the same -type more than one minor number can be assigned, separated by commas: - - -> insmod mydriver.o video_nr=0,1 radio_nr=0,1 - - - In /etc/modules.conf this may be -written as: - -alias char-major-81-0 mydriver -alias char-major-81-1 mydriver -alias char-major-81-64 mydriver -options mydriver video_nr=0,1 radio_nr=0,1 - - - - When an application attempts to open a device -special file with major number 81 and minor number 0, 1, or 64, load -"mydriver" (and the "videodev" module it depends upon). - - - Register the first two video capture devices with -minor number 0 and 1 (base number is 0), the first two radio device -with minor number 64 and 65 (base 64). - - - When no minor number is given as module -option the driver supplies a default. -recommends the base minor numbers to be used for the various device -types. Obviously minor numbers must be unique. When the number is -already in use the offending device will not be -registered. - - By convention system administrators create various -character device special files with these major and minor numbers in -the /dev directory. The names recommended for the -different V4L2 device types are listed in . - - - The creation of character special files (with -mknod) is a privileged operation and -devices cannot be opened by major and minor number. That means -applications cannot reliable scan for loaded or -installed drivers. The user must enter a device name, or the -application can try the conventional device names. - - Under the device filesystem (devfs) the minor number -options are ignored. V4L2 drivers (or by proxy the "videodev" module) -automatically create the required device files in the -/dev/v4l directory using the conventional device -names above. -
- - - -
- Multiple Opens - - In general, V4L2 devices can be opened more than once. -When this is supported by the driver, users can for example start a -"panel" application to change controls like brightness or audio -volume, while another application captures video and audio. In other words, panel -applications are comparable to an OSS or ALSA audio mixer application. -When a device supports multiple functions like capturing and overlay -simultaneously, multiple opens allow concurrent -use of the device by forked processes or specialized applications. - - Multiple opens are optional, although drivers should -permit at least concurrent accesses without data exchange, &ie; panel -applications. This implies &func-open; can return an &EBUSY; when the -device is already in use, as well as &func-ioctl; functions initiating -data exchange (namely the &VIDIOC-S-FMT; ioctl), and the &func-read; -and &func-write; functions. - - Mere opening a V4L2 device does not grant exclusive -access. - Drivers could recognize the -O_EXCL open flag. Presently this is not required, -so applications cannot know if it really works. - Initiating data exchange however assigns the right -to read or write the requested type of data, and to change related -properties, to this file descriptor. Applications can request -additional access privileges using the priority mechanism described in -. -
- -
- Shared Data Streams - - V4L2 drivers should not support multiple applications -reading or writing the same data stream on a device by copying -buffers, time multiplexing or similar means. This is better handled by -a proxy application in user space. When the driver supports stream -sharing anyway it must be implemented transparently. The V4L2 API does -not specify how conflicts are solved. -
- -
- Functions - - To open and close V4L2 devices applications use the -&func-open; and &func-close; function, respectively. Devices are -programmed using the &func-ioctl; function as explained in the -following sections. -
-
- -
- Querying Capabilities - - Because V4L2 covers a wide variety of devices not all -aspects of the API are equally applicable to all types of devices. -Furthermore devices of the same type have different capabilities and -this specification permits the omission of a few complicated and less -important parts of the API. - - The &VIDIOC-QUERYCAP; ioctl is available to check if the kernel -device is compatible with this specification, and to query the functions and I/O -methods supported by the device. Other features can be queried -by calling the respective ioctl, for example &VIDIOC-ENUMINPUT; -to learn about the number, types and names of video connectors on the -device. Although abstraction is a major objective of this API, the -ioctl also allows driver specific applications to reliable identify -the driver. - - All V4L2 drivers must support -VIDIOC_QUERYCAP. Applications should always call -this ioctl after opening the device. -
- -
- Application Priority - - When multiple applications share a device it may be -desirable to assign them different priorities. Contrary to the -traditional "rm -rf /" school of thought a video recording application -could for example block other applications from changing video -controls or switching the current TV channel. Another objective is to -permit low priority applications working in background, which can be -preempted by user controlled applications and automatically regain -control of the device at a later time. - - Since these features cannot be implemented entirely in user -space V4L2 defines the &VIDIOC-G-PRIORITY; and &VIDIOC-S-PRIORITY; -ioctls to request and query the access priority associate with a file -descriptor. Opening a device assigns a medium priority, compatible -with earlier versions of V4L2 and drivers not supporting these ioctls. -Applications requiring a different priority will usually call -VIDIOC_S_PRIORITY after verifying the device with -the &VIDIOC-QUERYCAP; ioctl. - - Ioctls changing driver properties, such as &VIDIOC-S-INPUT;, -return an &EBUSY; after another application obtained higher priority. -An event mechanism to notify applications about asynchronous property -changes has been proposed but not added yet. -
- -
- Video Inputs and Outputs - - Video inputs and outputs are physical connectors of a -device. These can be for example RF connectors (antenna/cable), CVBS -a.k.a. Composite Video, S-Video or RGB connectors. Only video and VBI -capture devices have inputs, output devices have outputs, at least one -each. Radio devices have no video inputs or outputs. - - To learn about the number and attributes of the -available inputs and outputs applications can enumerate them with the -&VIDIOC-ENUMINPUT; and &VIDIOC-ENUMOUTPUT; ioctl, respectively. The -&v4l2-input; returned by the VIDIOC_ENUMINPUT -ioctl also contains signal status information applicable when the -current video input is queried. - - The &VIDIOC-G-INPUT; and &VIDIOC-G-OUTPUT; ioctl return the -index of the current video input or output. To select a different -input or output applications call the &VIDIOC-S-INPUT; and -&VIDIOC-S-OUTPUT; ioctl. Drivers must implement all the input ioctls -when the device has one or more inputs, all the output ioctls when the -device has one or more outputs. - - - - - Information about the current video input - - -&v4l2-input; input; -int index; - -if (-1 == ioctl (fd, &VIDIOC-G-INPUT;, &index)) { - perror ("VIDIOC_G_INPUT"); - exit (EXIT_FAILURE); -} - -memset (&input, 0, sizeof (input)); -input.index = index; - -if (-1 == ioctl (fd, &VIDIOC-ENUMINPUT;, &input)) { - perror ("VIDIOC_ENUMINPUT"); - exit (EXIT_FAILURE); -} - -printf ("Current input: %s\n", input.name); - - - - - Switching to the first video input - - -int index; - -index = 0; - -if (-1 == ioctl (fd, &VIDIOC-S-INPUT;, &index)) { - perror ("VIDIOC_S_INPUT"); - exit (EXIT_FAILURE); -} - - -
- -
- Audio Inputs and Outputs - - Audio inputs and outputs are physical connectors of a -device. Video capture devices have inputs, output devices have -outputs, zero or more each. Radio devices have no audio inputs or -outputs. They have exactly one tuner which in fact -is an audio source, but this API associates -tuners with video inputs or outputs only, and radio devices have -none of these. - Actually &v4l2-audio; ought to have a -tuner field like &v4l2-input;, not only -making the API more consistent but also permitting radio devices with -multiple tuners. - A connector on a TV card to loop back the received -audio signal to a sound card is not considered an audio output. - - Audio and video inputs and outputs are associated. Selecting -a video source also selects an audio source. This is most evident when -the video and audio source is a tuner. Further audio connectors can -combine with more than one video input or output. Assumed two -composite video inputs and two audio inputs exist, there may be up to -four valid combinations. The relation of video and audio connectors -is defined in the audioset field of the -respective &v4l2-input; or &v4l2-output;, where each bit represents -the index number, starting at zero, of one audio input or output. - - To learn about the number and attributes of the -available inputs and outputs applications can enumerate them with the -&VIDIOC-ENUMAUDIO; and &VIDIOC-ENUMAUDOUT; ioctl, respectively. The -&v4l2-audio; returned by the VIDIOC_ENUMAUDIO ioctl -also contains signal status information applicable when the current -audio input is queried. - - The &VIDIOC-G-AUDIO; and &VIDIOC-G-AUDOUT; ioctl report -the current audio input and output, respectively. Note that, unlike -&VIDIOC-G-INPUT; and &VIDIOC-G-OUTPUT; these ioctls return a structure -as VIDIOC_ENUMAUDIO and -VIDIOC_ENUMAUDOUT do, not just an index. - - To select an audio input and change its properties -applications call the &VIDIOC-S-AUDIO; ioctl. To select an audio -output (which presently has no changeable properties) applications -call the &VIDIOC-S-AUDOUT; ioctl. - - Drivers must implement all input ioctls when the device -has one or more inputs, all output ioctls when the device has one -or more outputs. When the device has any audio inputs or outputs the -driver must set the V4L2_CAP_AUDIO flag in the -&v4l2-capability; returned by the &VIDIOC-QUERYCAP; ioctl. - - - Information about the current audio input - - -&v4l2-audio; audio; - -memset (&audio, 0, sizeof (audio)); - -if (-1 == ioctl (fd, &VIDIOC-G-AUDIO;, &audio)) { - perror ("VIDIOC_G_AUDIO"); - exit (EXIT_FAILURE); -} - -printf ("Current input: %s\n", audio.name); - - - - - Switching to the first audio input - - -&v4l2-audio; audio; - -memset (&audio, 0, sizeof (audio)); /* clear audio.mode, audio.reserved */ - -audio.index = 0; - -if (-1 == ioctl (fd, &VIDIOC-S-AUDIO;, &audio)) { - perror ("VIDIOC_S_AUDIO"); - exit (EXIT_FAILURE); -} - - -
- -
- Tuners and Modulators - -
- Tuners - - Video input devices can have one or more tuners -demodulating a RF signal. Each tuner is associated with one or more -video inputs, depending on the number of RF connectors on the tuner. -The type field of the respective -&v4l2-input; returned by the &VIDIOC-ENUMINPUT; ioctl is set to -V4L2_INPUT_TYPE_TUNER and its -tuner field contains the index number of -the tuner. - - Radio devices have exactly one tuner with index zero, no -video inputs. - - To query and change tuner properties applications use the -&VIDIOC-G-TUNER; and &VIDIOC-S-TUNER; ioctl, respectively. The -&v4l2-tuner; returned by VIDIOC_G_TUNER also -contains signal status information applicable when the tuner of the -current video input, or a radio tuner is queried. Note that -VIDIOC_S_TUNER does not switch the current tuner, -when there is more than one at all. The tuner is solely determined by -the current video input. Drivers must support both ioctls and set the -V4L2_CAP_TUNER flag in the &v4l2-capability; -returned by the &VIDIOC-QUERYCAP; ioctl when the device has one or -more tuners. -
- -
- Modulators - - Video output devices can have one or more modulators, uh, -modulating a video signal for radiation or connection to the antenna -input of a TV set or video recorder. Each modulator is associated with -one or more video outputs, depending on the number of RF connectors on -the modulator. The type field of the -respective &v4l2-output; returned by the &VIDIOC-ENUMOUTPUT; ioctl is -set to V4L2_OUTPUT_TYPE_MODULATOR and its -modulator field contains the index number -of the modulator. This specification does not define radio output -devices. - - To query and change modulator properties applications use -the &VIDIOC-G-MODULATOR; and &VIDIOC-S-MODULATOR; ioctl. Note that -VIDIOC_S_MODULATOR does not switch the current -modulator, when there is more than one at all. The modulator is solely -determined by the current video output. Drivers must support both -ioctls and set the V4L2_CAP_MODULATOR flag in -the &v4l2-capability; returned by the &VIDIOC-QUERYCAP; ioctl when the -device has one or more modulators. -
- -
- Radio Frequency - - To get and set the tuner or modulator radio frequency -applications use the &VIDIOC-G-FREQUENCY; and &VIDIOC-S-FREQUENCY; -ioctl which both take a pointer to a &v4l2-frequency;. These ioctls -are used for TV and radio devices alike. Drivers must support both -ioctls when the tuner or modulator ioctls are supported, or -when the device is a radio device. -
-
- -
- Video Standards - - Video devices typically support one or more different video -standards or variations of standards. Each video input and output may -support another set of standards. This set is reported by the -std field of &v4l2-input; and -&v4l2-output; returned by the &VIDIOC-ENUMINPUT; and -&VIDIOC-ENUMOUTPUT; ioctl, respectively. - - V4L2 defines one bit for each analog video standard -currently in use worldwide, and sets aside bits for driver defined -standards, ⪚ hybrid standards to watch NTSC video tapes on PAL TVs -and vice versa. Applications can use the predefined bits to select a -particular standard, although presenting the user a menu of supported -standards is preferred. To enumerate and query the attributes of the -supported standards applications use the &VIDIOC-ENUMSTD; ioctl. - - Many of the defined standards are actually just variations -of a few major standards. The hardware may in fact not distinguish -between them, or do so internal and switch automatically. Therefore -enumerated standards also contain sets of one or more standard -bits. - - Assume a hypothetic tuner capable of demodulating B/PAL, -G/PAL and I/PAL signals. The first enumerated standard is a set of B -and G/PAL, switched automatically depending on the selected radio -frequency in UHF or VHF band. Enumeration gives a "PAL-B/G" or "PAL-I" -choice. Similar a Composite input may collapse standards, enumerating -"PAL-B/G/H/I", "NTSC-M" and "SECAM-D/K". - Some users are already confused by technical terms PAL, -NTSC and SECAM. There is no point asking them to distinguish between -B, G, D, or K when the software or hardware can do that -automatically. - - - To query and select the standard used by the current video -input or output applications call the &VIDIOC-G-STD; and -&VIDIOC-S-STD; ioctl, respectively. The received -standard can be sensed with the &VIDIOC-QUERYSTD; ioctl. Note parameter of all these ioctls is a pointer to a &v4l2-std-id; type (a standard set), not an index into the standard enumeration. - An alternative to the current scheme is to use pointers -to indices as arguments of VIDIOC_G_STD and -VIDIOC_S_STD, the &v4l2-input; and -&v4l2-output; std field would be a set of -indices like audioset. - Indices are consistent with the rest of the API -and identify the standard unambiguously. In the present scheme of -things an enumerated standard is looked up by &v4l2-std-id;. Now the -standards supported by the inputs of a device can overlap. Just -assume the tuner and composite input in the example above both -exist on a device. An enumeration of "PAL-B/G", "PAL-H/I" suggests -a choice which does not exist. We cannot merge or omit sets, because -applications would be unable to find the standards reported by -VIDIOC_G_STD. That leaves separate enumerations -for each input. Also selecting a standard by &v4l2-std-id; can be -ambiguous. Advantage of this method is that applications need not -identify the standard indirectly, after enumerating.So in -summary, the lookup itself is unavoidable. The difference is only -whether the lookup is necessary to find an enumerated standard or to -switch to a standard by &v4l2-std-id;. - Drivers must implement all video standard ioctls -when the device has one or more video inputs or outputs. - - Special rules apply to USB cameras where the notion of video -standards makes little sense. More generally any capture device, -output devices accordingly, which is - - incapable of capturing fields or frames at the nominal -rate of the video standard, or - - - where timestamps refer -to the instant the field or frame was received by the driver, not the -capture time, or - - - where sequence numbers -refer to the frames received by the driver, not the captured -frames. - - Here the driver shall set the -std field of &v4l2-input; and &v4l2-output; -to zero, the VIDIOC_G_STD, -VIDIOC_S_STD, -VIDIOC_QUERYSTD and -VIDIOC_ENUMSTD ioctls shall return the -&EINVAL;. - See for a rationale. Probably -even USB cameras follow some well known video standard. It might have -been better to explicitly indicate elsewhere if a device cannot live -up to normal expectations, instead of this exception. - - - - Information about the current video standard - - -&v4l2-std-id; std_id; -&v4l2-standard; standard; - -if (-1 == ioctl (fd, &VIDIOC-G-STD;, &std_id)) { - /* Note when VIDIOC_ENUMSTD always returns EINVAL this - is no video device or it falls under the USB exception, - and VIDIOC_G_STD returning EINVAL is no error. */ - - perror ("VIDIOC_G_STD"); - exit (EXIT_FAILURE); -} - -memset (&standard, 0, sizeof (standard)); -standard.index = 0; - -while (0 == ioctl (fd, &VIDIOC-ENUMSTD;, &standard)) { - if (standard.id & std_id) { - printf ("Current video standard: %s\n", standard.name); - exit (EXIT_SUCCESS); - } - - standard.index++; -} - -/* EINVAL indicates the end of the enumeration, which cannot be - empty unless this device falls under the USB exception. */ - -if (errno == EINVAL || standard.index == 0) { - perror ("VIDIOC_ENUMSTD"); - exit (EXIT_FAILURE); -} - - - - - Listing the video standards supported by the current -input - - -&v4l2-input; input; -&v4l2-standard; standard; - -memset (&input, 0, sizeof (input)); - -if (-1 == ioctl (fd, &VIDIOC-G-INPUT;, &input.index)) { - perror ("VIDIOC_G_INPUT"); - exit (EXIT_FAILURE); -} - -if (-1 == ioctl (fd, &VIDIOC-ENUMINPUT;, &input)) { - perror ("VIDIOC_ENUM_INPUT"); - exit (EXIT_FAILURE); -} - -printf ("Current input %s supports:\n", input.name); - -memset (&standard, 0, sizeof (standard)); -standard.index = 0; - -while (0 == ioctl (fd, &VIDIOC-ENUMSTD;, &standard)) { - if (standard.id & input.std) - printf ("%s\n", standard.name); - - standard.index++; -} - -/* EINVAL indicates the end of the enumeration, which cannot be - empty unless this device falls under the USB exception. */ - -if (errno != EINVAL || standard.index == 0) { - perror ("VIDIOC_ENUMSTD"); - exit (EXIT_FAILURE); -} - - - - - Selecting a new video standard - - -&v4l2-input; input; -&v4l2-std-id; std_id; - -memset (&input, 0, sizeof (input)); - -if (-1 == ioctl (fd, &VIDIOC-G-INPUT;, &input.index)) { - perror ("VIDIOC_G_INPUT"); - exit (EXIT_FAILURE); -} - -if (-1 == ioctl (fd, &VIDIOC-ENUMINPUT;, &input)) { - perror ("VIDIOC_ENUM_INPUT"); - exit (EXIT_FAILURE); -} - -if (0 == (input.std & V4L2_STD_PAL_BG)) { - fprintf (stderr, "Oops. B/G PAL is not supported.\n"); - exit (EXIT_FAILURE); -} - -/* Note this is also supposed to work when only B - or G/PAL is supported. */ - -std_id = V4L2_STD_PAL_BG; - -if (-1 == ioctl (fd, &VIDIOC-S-STD;, &std_id)) { - perror ("VIDIOC_S_STD"); - exit (EXIT_FAILURE); -} - - -
- Digital Video (DV) Timings - - The video standards discussed so far has been dealing with Analog TV and the -corresponding video timings. Today there are many more different hardware interfaces -such as High Definition TV interfaces (HDMI), VGA, DVI connectors etc., that carry -video signals and there is a need to extend the API to select the video timings -for these interfaces. Since it is not possible to extend the &v4l2-std-id; due to -the limited bits available, a new set of IOCTLs is added to set/get video timings at -the input and output: - - DV Presets: Digital Video (DV) presets. These are IDs representing a -video timing at the input/output. Presets are pre-defined timings implemented -by the hardware according to video standards. A __u32 data type is used to represent -a preset unlike the bit mask that is used in &v4l2-std-id; allowing future extensions -to support as many different presets as needed. - - - Custom DV Timings: This will allow applications to define more detailed -custom video timings for the interface. This includes parameters such as width, height, -polarities, frontporch, backporch etc. - - - - To enumerate and query the attributes of DV presets supported by a device, -applications use the &VIDIOC-ENUM-DV-PRESETS; ioctl. To get the current DV preset, -applications use the &VIDIOC-G-DV-PRESET; ioctl and to set a preset they use the -&VIDIOC-S-DV-PRESET; ioctl. - To set custom DV timings for the device, applications use the -&VIDIOC-S-DV-TIMINGS; ioctl and to get current custom DV timings they use the -&VIDIOC-G-DV-TIMINGS; ioctl. - Applications can make use of the and - flags to decide what ioctls are available to set the -video timings for the device. -
-
- - &sub-controls; - -
- Data Formats - -
- Data Format Negotiation - - Different devices exchange different kinds of data with -applications, for example video images, raw or sliced VBI data, RDS -datagrams. Even within one kind many different formats are possible, -in particular an abundance of image formats. Although drivers must -provide a default and the selection persists across closing and -reopening a device, applications should always negotiate a data format -before engaging in data exchange. Negotiation means the application -asks for a particular format and the driver selects and reports the -best the hardware can do to satisfy the request. Of course -applications can also just query the current selection. - - A single mechanism exists to negotiate all data formats -using the aggregate &v4l2-format; and the &VIDIOC-G-FMT; and -&VIDIOC-S-FMT; ioctls. Additionally the &VIDIOC-TRY-FMT; ioctl can be -used to examine what the hardware could do, -without actually selecting a new data format. The data formats -supported by the V4L2 API are covered in the respective device section -in . For a closer look at image formats see -. - - The VIDIOC_S_FMT ioctl is a major -turning-point in the initialization sequence. Prior to this point -multiple panel applications can access the same device concurrently to -select the current input, change controls or modify other properties. -The first VIDIOC_S_FMT assigns a logical stream -(video data, VBI data etc.) exclusively to one file descriptor. - - Exclusive means no other application, more precisely no -other file descriptor, can grab this stream or change device -properties inconsistent with the negotiated parameters. A video -standard change for example, when the new standard uses a different -number of scan lines, can invalidate the selected image format. -Therefore only the file descriptor owning the stream can make -invalidating changes. Accordingly multiple file descriptors which -grabbed different logical streams prevent each other from interfering -with their settings. When for example video overlay is about to start -or already in progress, simultaneous video capturing may be restricted -to the same cropping and image size. - - When applications omit the -VIDIOC_S_FMT ioctl its locking side effects are -implied by the next step, the selection of an I/O method with the -&VIDIOC-REQBUFS; ioctl or implicit with the first &func-read; or -&func-write; call. - - Generally only one logical stream can be assigned to a -file descriptor, the exception being drivers permitting simultaneous -video capturing and overlay using the same file descriptor for -compatibility with V4L and earlier versions of V4L2. Switching the -logical stream or returning into "panel mode" is possible by closing -and reopening the device. Drivers may support a -switch using VIDIOC_S_FMT. - - All drivers exchanging data with -applications must support the VIDIOC_G_FMT and -VIDIOC_S_FMT ioctl. Implementation of the -VIDIOC_TRY_FMT is highly recommended but -optional. -
- -
- Image Format Enumeration - - Apart of the generic format negotiation functions -a special ioctl to enumerate all image formats supported by video -capture, overlay or output devices is available. - Enumerating formats an application has no a-priori -knowledge of (otherwise it could explicitly ask for them and need not -enumerate) seems useless, but there are applications serving as proxy -between drivers and the actual video applications for which this is -useful. - - - The &VIDIOC-ENUM-FMT; ioctl must be supported -by all drivers exchanging image data with applications. - - - Drivers are not supposed to convert image formats in -kernel space. They must enumerate only formats directly supported by -the hardware. If necessary driver writers should publish an example -conversion routine or library for integration into applications. - -
-
- - &sub-planar-apis; - -
- Image Cropping, Insertion and Scaling - - Some video capture devices can sample a subsection of the -picture and shrink or enlarge it to an image of arbitrary size. We -call these abilities cropping and scaling. Some video output devices -can scale an image up or down and insert it at an arbitrary scan line -and horizontal offset into a video signal. - - Applications can use the following API to select an area in -the video signal, query the default area and the hardware limits. -Despite their name, the &VIDIOC-CROPCAP;, &VIDIOC-G-CROP; -and &VIDIOC-S-CROP; ioctls apply to input as well as output -devices. - - Scaling requires a source and a target. On a video capture -or overlay device the source is the video signal, and the cropping -ioctls determine the area actually sampled. The target are images -read by the application or overlaid onto the graphics screen. Their -size (and position for an overlay) is negotiated with the -&VIDIOC-G-FMT; and &VIDIOC-S-FMT; ioctls. - - On a video output device the source are the images passed in -by the application, and their size is again negotiated with the -VIDIOC_G/S_FMT ioctls, or may be encoded in a -compressed video stream. The target is the video signal, and the -cropping ioctls determine the area where the images are -inserted. - - Source and target rectangles are defined even if the device -does not support scaling or the VIDIOC_G/S_CROP -ioctls. Their size (and position where applicable) will be fixed in -this case. All capture and output device must support the -VIDIOC_CROPCAP ioctl such that applications can -determine if scaling takes place. - -
- Cropping Structures - -
- Image Cropping, Insertion and Scaling - - - - - - - - - The cropping, insertion and scaling process - - -
- - For capture devices the coordinates of the top left -corner, width and height of the area which can be sampled is given by -the bounds substructure of the -&v4l2-cropcap; returned by the VIDIOC_CROPCAP -ioctl. To support a wide range of hardware this specification does not -define an origin or units. However by convention drivers should -horizontally count unscaled samples relative to 0H (the leading edge -of the horizontal sync pulse, see ). -Vertically ITU-R line -numbers of the first field (, ), multiplied by two if the driver can capture both -fields. - - The top left corner, width and height of the source -rectangle, that is the area actually sampled, is given by &v4l2-crop; -using the same coordinate system as &v4l2-cropcap;. Applications can -use the VIDIOC_G_CROP and -VIDIOC_S_CROP ioctls to get and set this -rectangle. It must lie completely within the capture boundaries and -the driver may further adjust the requested size and/or position -according to hardware limitations. - - Each capture device has a default source rectangle, given -by the defrect substructure of -&v4l2-cropcap;. The center of this rectangle shall align with the -center of the active picture area of the video signal, and cover what -the driver writer considers the complete picture. Drivers shall reset -the source rectangle to the default when the driver is first loaded, -but not later. - - For output devices these structures and ioctls are used -accordingly, defining the target rectangle where -the images will be inserted into the video signal. - -
- -
- Scaling Adjustments - - Video hardware can have various cropping, insertion and -scaling limitations. It may only scale up or down, support only -discrete scaling factors, or have different scaling abilities in -horizontal and vertical direction. Also it may not support scaling at -all. At the same time the &v4l2-crop; rectangle may have to be -aligned, and both the source and target rectangles may have arbitrary -upper and lower size limits. In particular the maximum -width and height -in &v4l2-crop; may be smaller than the -&v4l2-cropcap;.bounds area. Therefore, as -usual, drivers are expected to adjust the requested parameters and -return the actual values selected. - - Applications can change the source or the target rectangle -first, as they may prefer a particular image size or a certain area in -the video signal. If the driver has to adjust both to satisfy hardware -limitations, the last requested rectangle shall take priority, and the -driver should preferably adjust the opposite one. The &VIDIOC-TRY-FMT; -ioctl however shall not change the driver state and therefore only -adjust the requested rectangle. - - Suppose scaling on a video capture device is restricted to -a factor 1:1 or 2:1 in either direction and the target image size must -be a multiple of 16 × 16 pixels. The source cropping -rectangle is set to defaults, which are also the upper limit in this -example, of 640 × 400 pixels at offset 0, 0. An -application requests an image size of 300 × 225 -pixels, assuming video will be scaled down from the "full picture" -accordingly. The driver sets the image size to the closest possible -values 304 × 224, then chooses the cropping rectangle -closest to the requested size, that is 608 × 224 -(224 × 2:1 would exceed the limit 400). The offset -0, 0 is still valid, thus unmodified. Given the default cropping -rectangle reported by VIDIOC_CROPCAP the -application can easily propose another offset to center the cropping -rectangle. - - Now the application may insist on covering an area using a -picture aspect ratio closer to the original request, so it asks for a -cropping rectangle of 608 × 456 pixels. The present -scaling factors limit cropping to 640 × 384, so the -driver returns the cropping size 608 × 384 and adjusts -the image size to closest possible 304 × 192. - -
- -
- Examples - - Source and target rectangles shall remain unchanged across -closing and reopening a device, such that piping data into or out of a -device will work without special preparations. More advanced -applications should ensure the parameters are suitable before starting -I/O. - - - Resetting the cropping parameters - - (A video capture device is assumed; change -V4L2_BUF_TYPE_VIDEO_CAPTURE for other -devices.) - - -&v4l2-cropcap; cropcap; -&v4l2-crop; crop; - -memset (&cropcap, 0, sizeof (cropcap)); -cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - -if (-1 == ioctl (fd, &VIDIOC-CROPCAP;, &cropcap)) { - perror ("VIDIOC_CROPCAP"); - exit (EXIT_FAILURE); -} - -memset (&crop, 0, sizeof (crop)); -crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -crop.c = cropcap.defrect; - -/* Ignore if cropping is not supported (EINVAL). */ - -if (-1 == ioctl (fd, &VIDIOC-S-CROP;, &crop) - && errno != EINVAL) { - perror ("VIDIOC_S_CROP"); - exit (EXIT_FAILURE); -} - - - - - Simple downscaling - - (A video capture device is assumed.) - - -&v4l2-cropcap; cropcap; -&v4l2-format; format; - -reset_cropping_parameters (); - -/* Scale down to 1/4 size of full picture. */ - -memset (&format, 0, sizeof (format)); /* defaults */ - -format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - -format.fmt.pix.width = cropcap.defrect.width >> 1; -format.fmt.pix.height = cropcap.defrect.height >> 1; -format.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV; - -if (-1 == ioctl (fd, &VIDIOC-S-FMT;, &format)) { - perror ("VIDIOC_S_FORMAT"); - exit (EXIT_FAILURE); -} - -/* We could check the actual image size now, the actual scaling factor - or if the driver can scale at all. */ - - - - - Selecting an output area - - -&v4l2-cropcap; cropcap; -&v4l2-crop; crop; - -memset (&cropcap, 0, sizeof (cropcap)); -cropcap.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; - -if (-1 == ioctl (fd, VIDIOC_CROPCAP;, &cropcap)) { - perror ("VIDIOC_CROPCAP"); - exit (EXIT_FAILURE); -} - -memset (&crop, 0, sizeof (crop)); - -crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; -crop.c = cropcap.defrect; - -/* Scale the width and height to 50 % of their original size - and center the output. */ - -crop.c.width /= 2; -crop.c.height /= 2; -crop.c.left += crop.c.width / 2; -crop.c.top += crop.c.height / 2; - -/* Ignore if cropping is not supported (EINVAL). */ - -if (-1 == ioctl (fd, VIDIOC_S_CROP, &crop) - && errno != EINVAL) { - perror ("VIDIOC_S_CROP"); - exit (EXIT_FAILURE); -} - - - - - Current scaling factor and pixel aspect - - (A video capture device is assumed.) - - -&v4l2-cropcap; cropcap; -&v4l2-crop; crop; -&v4l2-format; format; -double hscale, vscale; -double aspect; -int dwidth, dheight; - -memset (&cropcap, 0, sizeof (cropcap)); -cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - -if (-1 == ioctl (fd, &VIDIOC-CROPCAP;, &cropcap)) { - perror ("VIDIOC_CROPCAP"); - exit (EXIT_FAILURE); -} - -memset (&crop, 0, sizeof (crop)); -crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - -if (-1 == ioctl (fd, &VIDIOC-G-CROP;, &crop)) { - if (errno != EINVAL) { - perror ("VIDIOC_G_CROP"); - exit (EXIT_FAILURE); - } - - /* Cropping not supported. */ - crop.c = cropcap.defrect; -} - -memset (&format, 0, sizeof (format)); -format.fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - -if (-1 == ioctl (fd, &VIDIOC-G-FMT;, &format)) { - perror ("VIDIOC_G_FMT"); - exit (EXIT_FAILURE); -} - -/* The scaling applied by the driver. */ - -hscale = format.fmt.pix.width / (double) crop.c.width; -vscale = format.fmt.pix.height / (double) crop.c.height; - -aspect = cropcap.pixelaspect.numerator / - (double) cropcap.pixelaspect.denominator; -aspect = aspect * hscale / vscale; - -/* Devices following ITU-R BT.601 do not capture - square pixels. For playback on a computer monitor - we should scale the images to this size. */ - -dwidth = format.fmt.pix.width / aspect; -dheight = format.fmt.pix.height; - - -
-
- -
- Streaming Parameters - - Streaming parameters are intended to optimize the video -capture process as well as I/O. Presently applications can request a -high quality capture mode with the &VIDIOC-S-PARM; ioctl. - - The current video standard determines a nominal number of -frames per second. If less than this number of frames is to be -captured or output, applications can request frame skipping or -duplicating on the driver side. This is especially useful when using -the &func-read; or &func-write;, which are not augmented by timestamps -or sequence counters, and to avoid unnecessary data copying. - - Finally these ioctls can be used to determine the number of -buffers used internally by a driver in read/write mode. For -implications see the section discussing the &func-read; -function. - - To get and set the streaming parameters applications call -the &VIDIOC-G-PARM; and &VIDIOC-S-PARM; ioctl, respectively. They take -a pointer to a &v4l2-streamparm;, which contains a union holding -separate parameters for input and output devices. - - These ioctls are optional, drivers need not implement -them. If so, they return the &EINVAL;. -
- - diff --git a/Documentation/DocBook/v4l/compat.xml b/Documentation/DocBook/v4l/compat.xml deleted file mode 100644 index 9f7cd4f25792..000000000000 --- a/Documentation/DocBook/v4l/compat.xml +++ /dev/null @@ -1,2500 +0,0 @@ - Changes - - The following chapters document the evolution of the V4L2 API, -errata or extensions. They are also intended to help application and -driver writers to port or update their code. - -
- Differences between V4L and V4L2 - - The Video For Linux API was first introduced in Linux 2.1 to -unify and replace various TV and radio device related interfaces, -developed independently by driver writers in prior years. Starting -with Linux 2.5 the much improved V4L2 API replaces the V4L API, -although existing drivers will continue to support V4L applications in -the future, either directly or through the V4L2 compatibility layer in -the videodev kernel module translating ioctls on -the fly. For a transition period not all drivers will support the V4L2 -API. - -
- Opening and Closing Devices - - For compatibility reasons the character device file names -recommended for V4L2 video capture, overlay, radio and raw -vbi capture devices did not change from those used by V4L. They are -listed in and below in . - - The teletext devices (minor range 192-223) have been removed in -V4L2 and no longer exist. There is no hardware available anymore for handling -pure teletext. Instead raw or sliced VBI is used. - - The V4L videodev module automatically -assigns minor numbers to drivers in load order, depending on the -registered device type. We recommend that V4L2 drivers by default -register devices with the same numbers, but the system administrator -can assign arbitrary minor numbers using driver module options. The -major device number remains 81. - - - V4L Device Types, Names and Numbers - - - - Device Type - File Name - Minor Numbers - - - - - Video capture and overlay - /dev/video and -/dev/bttv0 According to -Documentation/devices.txt these should be symbolic links to -/dev/video0. Note the original bttv interface is -not compatible with V4L or V4L2. , -/dev/video0 to -/dev/video63 - 0-63 - - - Radio receiver - /dev/radio - According to -Documentation/devices.txt a symbolic link to -/dev/radio0. - , /dev/radio0 to -/dev/radio63 - 64-127 - - - Raw VBI capture - /dev/vbi, -/dev/vbi0 to -/dev/vbi31 - 224-255 - - - -
- - V4L prohibits (or used to prohibit) multiple opens of a -device file. V4L2 drivers may support multiple -opens, see for details and consequences. - - V4L drivers respond to V4L2 ioctls with an &EINVAL;. The -compatibility layer in the V4L2 videodev module -can translate V4L ioctl requests to their V4L2 counterpart, however a -V4L2 driver usually needs more preparation to become fully V4L -compatible. This is covered in more detail in . -
- -
- Querying Capabilities - - The V4L VIDIOCGCAP ioctl is -equivalent to V4L2's &VIDIOC-QUERYCAP;. - - The name field in struct -video_capability became -card in &v4l2-capability;, -type was replaced by -capabilities. Note V4L2 does not -distinguish between device types like this, better think of basic -video input, video output and radio devices supporting a set of -related functions like video capturing, video overlay and VBI -capturing. See for an -introduction. - - - - struct -video_capability -type - &v4l2-capability; -capabilities flags - Purpose - - - - - VID_TYPE_CAPTURE - V4L2_CAP_VIDEO_CAPTURE - The video -capture interface is supported. - - - VID_TYPE_TUNER - V4L2_CAP_TUNER - The device has a tuner or -modulator. - - - VID_TYPE_TELETEXT - V4L2_CAP_VBI_CAPTURE - The raw VBI -capture interface is supported. - - - VID_TYPE_OVERLAY - V4L2_CAP_VIDEO_OVERLAY - The video -overlay interface is supported. - - - VID_TYPE_CHROMAKEY - V4L2_FBUF_CAP_CHROMAKEY in -field capability of -&v4l2-framebuffer; - Whether chromakey overlay is supported. For -more information on overlay see -. - - - VID_TYPE_CLIPPING - V4L2_FBUF_CAP_LIST_CLIPPING -and V4L2_FBUF_CAP_BITMAP_CLIPPING in field -capability of &v4l2-framebuffer; - Whether clipping the overlaid image is -supported, see . - - - VID_TYPE_FRAMERAM - V4L2_FBUF_CAP_EXTERNOVERLAY -not set in field -capability of &v4l2-framebuffer; - Whether overlay overwrites frame buffer memory, -see . - - - VID_TYPE_SCALES - - - This flag indicates if the hardware can scale -images. The V4L2 API implies the scale factor by setting the cropping -dimensions and image size with the &VIDIOC-S-CROP; and &VIDIOC-S-FMT; -ioctl, respectively. The driver returns the closest sizes possible. -For more information on cropping and scaling see . - - - VID_TYPE_MONOCHROME - - - Applications can enumerate the supported image -formats with the &VIDIOC-ENUM-FMT; ioctl to determine if the device -supports grey scale capturing only. For more information on image -formats see . - - - VID_TYPE_SUBCAPTURE - - - Applications can call the &VIDIOC-G-CROP; ioctl -to determine if the device supports capturing a subsection of the full -picture ("cropping" in V4L2). If not, the ioctl returns the &EINVAL;. -For more information on cropping and scaling see . - - - VID_TYPE_MPEG_DECODER - - - Applications can enumerate the supported image -formats with the &VIDIOC-ENUM-FMT; ioctl to determine if the device -supports MPEG streams. - - - VID_TYPE_MPEG_ENCODER - - - See above. - - - VID_TYPE_MJPEG_DECODER - - - See above. - - - VID_TYPE_MJPEG_ENCODER - - - See above. - - - - - - The audios field was replaced -by capabilities flag -V4L2_CAP_AUDIO, indicating -if the device has any audio inputs or outputs. To -determine their number applications can enumerate audio inputs with -the &VIDIOC-G-AUDIO; ioctl. The audio ioctls are described in . - - The maxwidth, -maxheight, -minwidth and -minheight fields were removed. Calling the -&VIDIOC-S-FMT; or &VIDIOC-TRY-FMT; ioctl with the desired dimensions -returns the closest size possible, taking into account the current -video standard, cropping and scaling limitations. -
- -
- Video Sources - - V4L provides the VIDIOCGCHAN and -VIDIOCSCHAN ioctl using struct -video_channel to enumerate -the video inputs of a V4L device. The equivalent V4L2 ioctls -are &VIDIOC-ENUMINPUT;, &VIDIOC-G-INPUT; and &VIDIOC-S-INPUT; -using &v4l2-input; as discussed in . - - The channel field counting -inputs was renamed to index, the video -input types were renamed as follows: - - - - struct video_channel -type - &v4l2-input; -type - - - - - VIDEO_TYPE_TV - V4L2_INPUT_TYPE_TUNER - - - VIDEO_TYPE_CAMERA - V4L2_INPUT_TYPE_CAMERA - - - - - - Unlike the tuners field -expressing the number of tuners of this input, V4L2 assumes each video -input is connected to at most one tuner. However a tuner can have more -than one input, &ie; RF connectors, and a device can have multiple -tuners. The index number of the tuner associated with the input, if -any, is stored in field tuner of -&v4l2-input;. Enumeration of tuners is discussed in . - - The redundant VIDEO_VC_TUNER flag was -dropped. Video inputs associated with a tuner are of type -V4L2_INPUT_TYPE_TUNER. The -VIDEO_VC_AUDIO flag was replaced by the -audioset field. V4L2 considers devices with -up to 32 audio inputs. Each set bit in the -audioset field represents one audio input -this video input combines with. For information about audio inputs and -how to switch between them see . - - The norm field describing the -supported video standards was replaced by -std. The V4L specification mentions a flag -VIDEO_VC_NORM indicating whether the standard can -be changed. This flag was a later addition together with the -norm field and has been removed in the -meantime. V4L2 has a similar, albeit more comprehensive approach -to video standards, see for more -information. -
- -
- Tuning - - The V4L VIDIOCGTUNER and -VIDIOCSTUNER ioctl and struct -video_tuner can be used to enumerate the -tuners of a V4L TV or radio device. The equivalent V4L2 ioctls are -&VIDIOC-G-TUNER; and &VIDIOC-S-TUNER; using &v4l2-tuner;. Tuners are -covered in . - - The tuner field counting tuners -was renamed to index. The fields -name, rangelow -and rangehigh remained unchanged. - - The VIDEO_TUNER_PAL, -VIDEO_TUNER_NTSC and -VIDEO_TUNER_SECAM flags indicating the supported -video standards were dropped. This information is now contained in the -associated &v4l2-input;. No replacement exists for the -VIDEO_TUNER_NORM flag indicating whether the -video standard can be switched. The mode -field to select a different video standard was replaced by a whole new -set of ioctls and structures described in . -Due to its ubiquity it should be mentioned the BTTV driver supports -several standards in addition to the regular -VIDEO_MODE_PAL (0), -VIDEO_MODE_NTSC, -VIDEO_MODE_SECAM and -VIDEO_MODE_AUTO (3). Namely N/PAL Argentina, -M/PAL, N/PAL, and NTSC Japan with numbers 3-6 (sic). - - The VIDEO_TUNER_STEREO_ON flag -indicating stereo reception became -V4L2_TUNER_SUB_STEREO in field -rxsubchans. This field also permits the -detection of monaural and bilingual audio, see the definition of -&v4l2-tuner; for details. Presently no replacement exists for the -VIDEO_TUNER_RDS_ON and -VIDEO_TUNER_MBS_ON flags. - - The VIDEO_TUNER_LOW flag was renamed -to V4L2_TUNER_CAP_LOW in the &v4l2-tuner; -capability field. - - The VIDIOCGFREQ and -VIDIOCSFREQ ioctl to change the tuner frequency -where renamed to &VIDIOC-G-FREQUENCY; and &VIDIOC-S-FREQUENCY;. They -take a pointer to a &v4l2-frequency; instead of an unsigned long -integer. -
- -
- Image Properties - - V4L2 has no equivalent of the -VIDIOCGPICT and VIDIOCSPICT -ioctl and struct video_picture. The following -fields where replaced by V4L2 controls accessible with the -&VIDIOC-QUERYCTRL;, &VIDIOC-G-CTRL; and &VIDIOC-S-CTRL; ioctls: - - - - struct video_picture - V4L2 Control ID - - - - - brightness - V4L2_CID_BRIGHTNESS - - - hue - V4L2_CID_HUE - - - colour - V4L2_CID_SATURATION - - - contrast - V4L2_CID_CONTRAST - - - whiteness - V4L2_CID_WHITENESS - - - - - - The V4L picture controls are assumed to range from 0 to -65535 with no particular reset value. The V4L2 API permits arbitrary -limits and defaults which can be queried with the &VIDIOC-QUERYCTRL; -ioctl. For general information about controls see . - - The depth (average number of -bits per pixel) of a video image is implied by the selected image -format. V4L2 does not explicitely provide such information assuming -applications recognizing the format are aware of the image depth and -others need not know. The palette field -moved into the &v4l2-pix-format;: - - - - struct video_picture -palette - &v4l2-pix-format; -pixfmt - - - - - VIDEO_PALETTE_GREY - V4L2_PIX_FMT_GREY - - - VIDEO_PALETTE_HI240 - V4L2_PIX_FMT_HI240 - This is a custom format used by the BTTV -driver, not one of the V4L2 standard formats. - - - - VIDEO_PALETTE_RGB565 - V4L2_PIX_FMT_RGB565 - - - VIDEO_PALETTE_RGB555 - V4L2_PIX_FMT_RGB555 - - - VIDEO_PALETTE_RGB24 - V4L2_PIX_FMT_BGR24 - - - VIDEO_PALETTE_RGB32 - V4L2_PIX_FMT_BGR32 - Presumably all V4L RGB formats are -little-endian, although some drivers might interpret them according to machine endianess. V4L2 defines little-endian, big-endian and red/blue -swapped variants. For details see . - - - - VIDEO_PALETTE_YUV422 - V4L2_PIX_FMT_YUYV - - - VIDEO_PALETTE_YUYV - VIDEO_PALETTE_YUV422 -and VIDEO_PALETTE_YUYV are the same formats. Some -V4L drivers respond to one, some to the other. - - V4L2_PIX_FMT_YUYV - - - VIDEO_PALETTE_UYVY - V4L2_PIX_FMT_UYVY - - - VIDEO_PALETTE_YUV420 - None - - - VIDEO_PALETTE_YUV411 - V4L2_PIX_FMT_Y41P - Not to be confused with -V4L2_PIX_FMT_YUV411P, which is a planar -format. - - - VIDEO_PALETTE_RAW - None V4L explains this -as: "RAW capture (BT848)" - - - VIDEO_PALETTE_YUV422P - V4L2_PIX_FMT_YUV422P - - - VIDEO_PALETTE_YUV411P - V4L2_PIX_FMT_YUV411P - Not to be confused with -V4L2_PIX_FMT_Y41P, which is a packed -format. - - - VIDEO_PALETTE_YUV420P - V4L2_PIX_FMT_YVU420 - - - VIDEO_PALETTE_YUV410P - V4L2_PIX_FMT_YVU410 - - - - - - V4L2 image formats are defined in . The image format can be selected with the -&VIDIOC-S-FMT; ioctl. -
- -
- Audio - - The VIDIOCGAUDIO and -VIDIOCSAUDIO ioctl and struct -video_audio are used to enumerate the -audio inputs of a V4L device. The equivalent V4L2 ioctls are -&VIDIOC-G-AUDIO; and &VIDIOC-S-AUDIO; using &v4l2-audio; as -discussed in . - - The audio "channel number" -field counting audio inputs was renamed to -index. - - On VIDIOCSAUDIO the -mode field selects one -of the VIDEO_SOUND_MONO, -VIDEO_SOUND_STEREO, -VIDEO_SOUND_LANG1 or -VIDEO_SOUND_LANG2 audio demodulation modes. When -the current audio standard is BTSC -VIDEO_SOUND_LANG2 refers to SAP and -VIDEO_SOUND_LANG1 is meaningless. Also -undocumented in the V4L specification, there is no way to query the -selected mode. On VIDIOCGAUDIO the driver returns -the actually received audio programmes in this -field. In the V4L2 API this information is stored in the &v4l2-tuner; -rxsubchans and -audmode fields, respectively. See for more information on tuners. Related to audio -modes &v4l2-audio; also reports if this is a mono or stereo -input, regardless if the source is a tuner. - - The following fields where replaced by V4L2 controls -accessible with the &VIDIOC-QUERYCTRL;, &VIDIOC-G-CTRL; and -&VIDIOC-S-CTRL; ioctls: - - - - struct -video_audio - V4L2 Control ID - - - - - volume - V4L2_CID_AUDIO_VOLUME - - - bass - V4L2_CID_AUDIO_BASS - - - treble - V4L2_CID_AUDIO_TREBLE - - - balance - V4L2_CID_AUDIO_BALANCE - - - - - - To determine which of these controls are supported by a -driver V4L provides the flags -VIDEO_AUDIO_VOLUME, -VIDEO_AUDIO_BASS, -VIDEO_AUDIO_TREBLE and -VIDEO_AUDIO_BALANCE. In the V4L2 API the -&VIDIOC-QUERYCTRL; ioctl reports if the respective control is -supported. Accordingly the VIDEO_AUDIO_MUTABLE -and VIDEO_AUDIO_MUTE flags where replaced by the -boolean V4L2_CID_AUDIO_MUTE control. - - All V4L2 controls have a step -attribute replacing the struct video_audio -step field. The V4L audio controls are -assumed to range from 0 to 65535 with no particular reset value. The -V4L2 API permits arbitrary limits and defaults which can be queried -with the &VIDIOC-QUERYCTRL; ioctl. For general information about -controls see . -
- -
- Frame Buffer Overlay - - The V4L2 ioctls equivalent to -VIDIOCGFBUF and VIDIOCSFBUF -are &VIDIOC-G-FBUF; and &VIDIOC-S-FBUF;. The -base field of struct -video_buffer remained unchanged, except V4L2 -defines a flag to indicate non-destructive overlays instead of a -NULL pointer. All other fields moved into the -&v4l2-pix-format; fmt substructure of -&v4l2-framebuffer;. The depth field was -replaced by pixelformat. See for a list of RGB formats and their -respective color depths. - - Instead of the special ioctls -VIDIOCGWIN and VIDIOCSWIN -V4L2 uses the general-purpose data format negotiation ioctls -&VIDIOC-G-FMT; and &VIDIOC-S-FMT;. They take a pointer to a -&v4l2-format; as argument. Here the win -member of the fmt union is used, a -&v4l2-window;. - - The x, -y, width and -height fields of struct -video_window moved into &v4l2-rect; -substructure w of struct -v4l2_window. The -chromakey, -clips, and -clipcount fields remained unchanged. Struct -video_clip was renamed to &v4l2-clip;, also -containing a struct v4l2_rect, but the -semantics are still the same. - - The VIDEO_WINDOW_INTERLACE flag was -dropped. Instead applications must set the -field field to -V4L2_FIELD_ANY or -V4L2_FIELD_INTERLACED. The -VIDEO_WINDOW_CHROMAKEY flag moved into -&v4l2-framebuffer;, under the new name -V4L2_FBUF_FLAG_CHROMAKEY. - - In V4L, storing a bitmap pointer in -clips and setting -clipcount to -VIDEO_CLIP_BITMAP (-1) requests bitmap -clipping, using a fixed size bitmap of 1024 × 625 bits. Struct -v4l2_window has a separate -bitmap pointer field for this purpose and -the bitmap size is determined by w.width and -w.height. - - The VIDIOCCAPTURE ioctl to enable or -disable overlay was renamed to &VIDIOC-OVERLAY;. -
- -
- Cropping - - To capture only a subsection of the full picture V4L -defines the VIDIOCGCAPTURE and -VIDIOCSCAPTURE ioctls using struct -video_capture. The equivalent V4L2 ioctls are -&VIDIOC-G-CROP; and &VIDIOC-S-CROP; using &v4l2-crop;, and the related -&VIDIOC-CROPCAP; ioctl. This is a rather complex matter, see - for details. - - The x, -y, width and -height fields moved into &v4l2-rect; -substructure c of struct -v4l2_crop. The -decimation field was dropped. In the V4L2 -API the scaling factor is implied by the size of the cropping -rectangle and the size of the captured or overlaid image. - - The VIDEO_CAPTURE_ODD -and VIDEO_CAPTURE_EVEN flags to capture only the -odd or even field, respectively, were replaced by -V4L2_FIELD_TOP and -V4L2_FIELD_BOTTOM in the field named -field of &v4l2-pix-format; and -&v4l2-window;. These structures are used to select a capture or -overlay format with the &VIDIOC-S-FMT; ioctl. -
- -
- Reading Images, Memory Mapping - -
- Capturing using the read method - - There is no essential difference between reading images -from a V4L or V4L2 device using the &func-read; function, however V4L2 -drivers are not required to support this I/O method. Applications can -determine if the function is available with the &VIDIOC-QUERYCAP; -ioctl. All V4L2 devices exchanging data with applications must support -the &func-select; and &func-poll; functions. - - To select an image format and size, V4L provides the -VIDIOCSPICT and VIDIOCSWIN -ioctls. V4L2 uses the general-purpose data format negotiation ioctls -&VIDIOC-G-FMT; and &VIDIOC-S-FMT;. They take a pointer to a -&v4l2-format; as argument, here the &v4l2-pix-format; named -pix of its fmt -union is used. - - For more information about the V4L2 read interface see -. -
-
- Capturing using memory mapping - - Applications can read from V4L devices by mapping -buffers in device memory, or more often just buffers allocated in -DMA-able system memory, into their address space. This avoids the data -copying overhead of the read method. V4L2 supports memory mapping as -well, with a few differences. - - - - - - V4L - V4L2 - - - - - - The image format must be selected before -buffers are allocated, with the &VIDIOC-S-FMT; ioctl. When no format -is selected the driver may use the last, possibly by another -application requested format. - - - Applications cannot change the number of -buffers. The it is built into the driver, unless it has a module -option to change the number when the driver module is -loaded. - The &VIDIOC-REQBUFS; ioctl allocates the -desired number of buffers, this is a required step in the initialization -sequence. - - - Drivers map all buffers as one contiguous -range of memory. The VIDIOCGMBUF ioctl is -available to query the number of buffers, the offset of each buffer -from the start of the virtual file, and the overall amount of memory -used, which can be used as arguments for the &func-mmap; -function. - Buffers are individually mapped. The -offset and size of each buffer can be determined with the -&VIDIOC-QUERYBUF; ioctl. - - - The VIDIOCMCAPTURE -ioctl prepares a buffer for capturing. It also determines the image -format for this buffer. The ioctl returns immediately, eventually with -an &EAGAIN; if no video signal had been detected. When the driver -supports more than one buffer applications can call the ioctl multiple -times and thus have multiple outstanding capture -requests.The VIDIOCSYNC ioctl -suspends execution until a particular buffer has been -filled. - Drivers maintain an incoming and outgoing -queue. &VIDIOC-QBUF; enqueues any empty buffer into the incoming -queue. Filled buffers are dequeued from the outgoing queue with the -&VIDIOC-DQBUF; ioctl. To wait until filled buffers become available this -function, &func-select; or &func-poll; can be used. The -&VIDIOC-STREAMON; ioctl must be called once after enqueuing one or -more buffers to start capturing. Its counterpart -&VIDIOC-STREAMOFF; stops capturing and dequeues all buffers from both -queues. Applications can query the signal status, if known, with the -&VIDIOC-ENUMINPUT; ioctl. - - - - - - For a more in-depth discussion of memory mapping and -examples, see . -
-
- -
- Reading Raw VBI Data - - Originally the V4L API did not specify a raw VBI capture -interface, only the device file /dev/vbi was -reserved for this purpose. The only driver supporting this interface -was the BTTV driver, de-facto defining the V4L VBI interface. Reading -from the device yields a raw VBI image with the following -parameters: - - - - &v4l2-vbi-format; - V4L, BTTV driver - - - - - sampling_rate - 28636363 Hz NTSC (or any other 525-line -standard); 35468950 Hz PAL and SECAM (625-line standards) - - - offset - ? - - - samples_per_line - 2048 - - - sample_format - V4L2_PIX_FMT_GREY. The last four bytes (a -machine endianess integer) contain a frame counter. - - - start[] - 10, 273 NTSC; 22, 335 PAL and SECAM - - - count[] - 16, 16Old driver -versions used different values, eventually the custom -BTTV_VBISIZE ioctl was added to query the -correct values. - - - flags - 0 - - - - - - Undocumented in the V4L specification, in Linux 2.3 the -VIDIOCGVBIFMT and -VIDIOCSVBIFMT ioctls using struct -vbi_format were added to determine the VBI -image parameters. These ioctls are only partially compatible with the -V4L2 VBI interface specified in . - - An offset field does not -exist, sample_format is supposed to be -VIDEO_PALETTE_RAW, equivalent to -V4L2_PIX_FMT_GREY. The remaining fields are -probably equivalent to &v4l2-vbi-format;. - - Apparently only the Zoran (ZR 36120) driver implements -these ioctls. The semantics differ from those specified for V4L2 in two -ways. The parameters are reset on &func-open; and -VIDIOCSVBIFMT always returns an &EINVAL; if the -parameters are invalid. -
- -
- Miscellaneous - - V4L2 has no equivalent of the -VIDIOCGUNIT ioctl. Applications can find the VBI -device associated with a video capture device (or vice versa) by -reopening the device and requesting VBI data. For details see -. - - No replacement exists for VIDIOCKEY, -and the V4L functions for microcode programming. A new interface for -MPEG compression and playback devices is documented in . -
- -
- -
- Changes of the V4L2 API - - Soon after the V4L API was added to the kernel it was -criticised as too inflexible. In August 1998 Bill Dirks proposed a -number of improvements and began to work on documentation, example -drivers and applications. With the help of other volunteers this -eventually became the V4L2 API, not just an extension but a -replacement for the V4L API. However it took another four years and -two stable kernel releases until the new API was finally accepted for -inclusion into the kernel in its present form. - -
- Early Versions - 1998-08-20: First version. - - 1998-08-27: The &func-select; function was introduced. - - 1998-09-10: New video standard interface. - - 1998-09-18: The VIDIOC_NONCAP ioctl -was replaced by the otherwise meaningless O_TRUNC -&func-open; flag, and the aliases O_NONCAP and -O_NOIO were defined. Applications can set this -flag if they intend to access controls only, as opposed to capture -applications which need exclusive access. The -VIDEO_STD_XXX identifiers are now ordinals -instead of flags, and the video_std_construct() -helper function takes id and transmission arguments. - - 1998-09-28: Revamped video standard. Made video controls -individually enumerable. - - 1998-10-02: The id field was -removed from struct video_standard and the -color subcarrier fields were renamed. The &VIDIOC-QUERYSTD; ioctl was -renamed to &VIDIOC-ENUMSTD;, &VIDIOC-G-INPUT; to &VIDIOC-ENUMINPUT;. A -first draft of the Codec API was released. - - 1998-11-08: Many minor changes. Most symbols have been -renamed. Some material changes to &v4l2-capability;. - - 1998-11-12: The read/write directon of some ioctls was misdefined. - - 1998-11-14: V4L2_PIX_FMT_RGB24 -changed to V4L2_PIX_FMT_BGR24, and -V4L2_PIX_FMT_RGB32 changed to -V4L2_PIX_FMT_BGR32. Audio controls are now -accessible with the &VIDIOC-G-CTRL; and &VIDIOC-S-CTRL; ioctls under -names starting with V4L2_CID_AUDIO. The -V4L2_MAJOR define was removed from -videodev.h since it was only used once in the -videodev kernel module. The -YUV422 and YUV411 planar -image formats were added. - - 1998-11-28: A few ioctl symbols changed. Interfaces for codecs and -video output devices were added. - - 1999-01-14: A raw VBI capture interface was added. - - 1999-01-19: The VIDIOC_NEXTBUF ioctl - was removed. -
- -
- V4L2 Version 0.16 1999-01-31 - 1999-01-27: There is now one QBUF ioctl, VIDIOC_QWBUF and VIDIOC_QRBUF -are gone. VIDIOC_QBUF takes a v4l2_buffer as a parameter. Added -digital zoom (cropping) controls. -
- - - -
- V4L2 Version 0.18 1999-03-16 - Added a v4l to V4L2 ioctl compatibility layer to -videodev.c. Driver writers, this changes how you implement your ioctl -handler. See the Driver Writer's Guide. Added some more control id -codes. -
- -
- V4L2 Version 0.19 1999-06-05 - 1999-03-18: Fill in the category and catname fields of -v4l2_queryctrl objects before passing them to the driver. Required a -minor change to the VIDIOC_QUERYCTRL handlers in the sample -drivers. - 1999-03-31: Better compatibility for v4l memory capture -ioctls. Requires changes to drivers to fully support new compatibility -features, see Driver Writer's Guide and v4l2cap.c. Added new control -IDs: V4L2_CID_HFLIP, _VFLIP. Changed V4L2_PIX_FMT_YUV422P to _YUV422P, -and _YUV411P to _YUV411P. - 1999-04-04: Added a few more control IDs. - 1999-04-07: Added the button control type. - 1999-05-02: Fixed a typo in videodev.h, and added the -V4L2_CTRL_FLAG_GRAYED (later V4L2_CTRL_FLAG_GRABBED) flag. - 1999-05-20: Definition of VIDIOC_G_CTRL was wrong causing -a malfunction of this ioctl. - 1999-06-05: Changed the value of -V4L2_CID_WHITENESS. -
- -
- V4L2 Version 0.20 (1999-09-10) - - Version 0.20 introduced a number of changes which were -not backward compatible with 0.19 and earlier -versions. Purpose of these changes was to simplify the API, while -making it more extensible and following common Linux driver API -conventions. - - - - Some typos in V4L2_FMT_FLAG -symbols were fixed. &v4l2-clip; was changed for compatibility with -v4l. (1999-08-30) - - - - V4L2_TUNER_SUB_LANG1 was added. -(1999-09-05) - - - - All ioctl() commands that used an integer argument now -take a pointer to an integer. Where it makes sense, ioctls will return -the actual new value in the integer pointed to by the argument, a -common convention in the V4L2 API. The affected ioctls are: -VIDIOC_PREVIEW, VIDIOC_STREAMON, VIDIOC_STREAMOFF, VIDIOC_S_FREQ, -VIDIOC_S_INPUT, VIDIOC_S_OUTPUT, VIDIOC_S_EFFECT. For example - -err = ioctl (fd, VIDIOC_XXX, V4L2_XXX); - becomes -int a = V4L2_XXX; err = ioctl(fd, VIDIOC_XXX, &a); - - - - - - All the different get- and set-format commands were -swept into one &VIDIOC-G-FMT; and &VIDIOC-S-FMT; ioctl taking a union -and a type field selecting the union member as parameter. Purpose is to -simplify the API by eliminating several ioctls and to allow new and -driver private data streams without adding new ioctls. - - This change obsoletes the following ioctls: -VIDIOC_S_INFMT, -VIDIOC_G_INFMT, -VIDIOC_S_OUTFMT, -VIDIOC_G_OUTFMT, -VIDIOC_S_VBIFMT and -VIDIOC_G_VBIFMT. The image format structure -v4l2_format was renamed to &v4l2-pix-format;, -while &v4l2-format; is now the envelopping structure for all format -negotiations. - - - - Similar to the changes above, the -VIDIOC_G_PARM and -VIDIOC_S_PARM ioctls were merged with -VIDIOC_G_OUTPARM and -VIDIOC_S_OUTPARM. A -type field in the new &v4l2-streamparm; -selects the respective union member. - - This change obsoletes the -VIDIOC_G_OUTPARM and -VIDIOC_S_OUTPARM ioctls. - - - - Control enumeration was simplified, and two new -control flags were introduced and one dropped. The -catname field was replaced by a -group field. - - Drivers can now flag unsupported and temporarily -unavailable controls with V4L2_CTRL_FLAG_DISABLED -and V4L2_CTRL_FLAG_GRABBED respectively. The -group name indicates a possibly narrower -classification than the category. In other -words, there may be multiple groups within a category. Controls within -a group would typically be drawn within a group box. Controls in -different categories might have a greater separation, or may even -appear in separate windows. - - - - The &v4l2-buffer; timestamp -was changed to a 64 bit integer, containing the sampling or output -time of the frame in nanoseconds. Additionally timestamps will be in -absolute system time, not starting from zero at the beginning of a -stream. The data type name for timestamps is stamp_t, defined as a -signed 64-bit integer. Output devices should not send a buffer out -until the time in the timestamp field has arrived. I would like to -follow SGI's lead, and adopt a multimedia timestamping system like -their UST (Unadjusted System Time). See -http://web.archive.org/web/*/http://reality.sgi.com -/cpirazzi_engr/lg/time/intro.html. -UST uses timestamps that are 64-bit signed integers -(not struct timeval's) and given in nanosecond units. The UST clock -starts at zero when the system is booted and runs continuously and -uniformly. It takes a little over 292 years for UST to overflow. There -is no way to set the UST clock. The regular Linux time-of-day clock -can be changed periodically, which would cause errors if it were being -used for timestamping a multimedia stream. A real UST style clock will -require some support in the kernel that is not there yet. But in -anticipation, I will change the timestamp field to a 64-bit integer, -and I will change the v4l2_masterclock_gettime() function (used only -by drivers) to return a 64-bit integer. - - - - A sequence field was added -to &v4l2-buffer;. The sequence field counts -captured frames, it is ignored by output devices. When a capture -driver drops a frame, the sequence number of that frame is -skipped. - - -
- -
- V4L2 Version 0.20 incremental changes - - - 1999-12-23: In &v4l2-vbi-format; the -reserved1 field became -offset. Previously drivers were required to -clear the reserved1 field. - - 2000-01-13: The - V4L2_FMT_FLAG_NOT_INTERLACED flag was added. - - 2000-07-31: The linux/poll.h header -is now included by videodev.h for compatibility -with the original videodev.h file. - - 2000-11-20: V4L2_TYPE_VBI_OUTPUT and -V4L2_PIX_FMT_Y41P were added. - - 2000-11-25: V4L2_TYPE_VBI_INPUT was -added. - - 2000-12-04: A couple typos in symbol names were fixed. - - 2001-01-18: To avoid namespace conflicts the -fourcc macro defined in the -videodev.h header file was renamed to -v4l2_fourcc. - - 2001-01-25: A possible driver-level compatibility problem -between the videodev.h file in Linux 2.4.0 and -the videodev.h file included in the -videodevX patch was fixed. Users of an earlier -version of videodevX on Linux 2.4.0 should -recompile their V4L and V4L2 drivers. - - 2001-01-26: A possible kernel-level incompatibility -between the videodev.h file in the -videodevX patch and the -videodev.h file in Linux 2.2.x with devfs patches -applied was fixed. - - 2001-03-02: Certain V4L ioctls which pass data in both -direction although they are defined with read-only parameter, did not -work correctly through the backward compatibility layer. -[Solution?] - - 2001-04-13: Big endian 16-bit RGB formats were added. - - 2001-09-17: New YUV formats and the &VIDIOC-G-FREQUENCY; and -&VIDIOC-S-FREQUENCY; ioctls were added. (The old -VIDIOC_G_FREQ and -VIDIOC_S_FREQ ioctls did not take multiple tuners -into account.) - - 2000-09-18: V4L2_BUF_TYPE_VBI was -added. This may break compatibility as the -&VIDIOC-G-FMT; and &VIDIOC-S-FMT; ioctls may fail now if the struct -v4l2_fmt type -field does not contain V4L2_BUF_TYPE_VBI. In the -documentation of the &v4l2-vbi-format; -offset field the ambiguous phrase "rising -edge" was changed to "leading edge". -
- -
- V4L2 Version 0.20 2000-11-23 - - A number of changes were made to the raw VBI -interface. - - - - Figures clarifying the line numbering scheme were -added to the V4L2 API specification. The -start[0] and -start[1] fields no longer count line -numbers beginning at zero. Rationale: a) The previous definition was -unclear. b) The start[] values are ordinal -numbers. c) There is no point in inventing a new line numbering -scheme. We now use line number as defined by ITU-R, period. -Compatibility: Add one to the start values. Applications depending on -the previous semantics may not function correctly. - - - - The restriction "count[0] > 0 and count[1] > 0" -has been relaxed to "(count[0] + count[1]) > 0". Rationale: -Drivers may allocate resources at scan line granularity and some data -services are transmitted only on the first field. The comment that -both count values will usually be equal is -misleading and pointless and has been removed. This change -breaks compatibility with earlier versions: -Drivers may return EINVAL, applications may not function -correctly. - - - - Drivers are again permitted to return negative -(unknown) start values as proposed earlier. Why this feature was -dropped is unclear. This change may break -compatibility with applications depending on the start -values being positive. The use of EBUSY and -EINVAL error codes with the &VIDIOC-S-FMT; ioctl -was clarified. The &EBUSY; was finally documented, and the -reserved2 field which was previously -mentioned only in the videodev.h header -file. - - - - New buffer types -V4L2_TYPE_VBI_INPUT and -V4L2_TYPE_VBI_OUTPUT were added. The former is an -alias for the old V4L2_TYPE_VBI, the latter was -missing in the videodev.h file. - - -
- -
- V4L2 Version 0.20 2002-07-25 - Added sliced VBI interface proposal. -
- -
- V4L2 in Linux 2.5.46, 2002-10 - - Around October-November 2002, prior to an announced -feature freeze of Linux 2.5, the API was revised, drawing from -experience with V4L2 0.20. This unnamed version was finally merged -into Linux 2.5.46. - - - - As specified in , drivers -must make related device functions available under all minor device -numbers. - - - - The &func-open; function requires access mode -O_RDWR regardless of the device type. All V4L2 -drivers exchanging data with applications must support the -O_NONBLOCK flag. The O_NOIO -flag, a V4L2 symbol which aliased the meaningless -O_TRUNC to indicate accesses without data -exchange (panel applications) was dropped. Drivers must stay in "panel -mode" until the application attempts to initiate a data exchange, see -. - - - - The &v4l2-capability; changed dramatically. Note that -also the size of the structure changed, which is encoded in the ioctl -request code, thus older V4L2 devices will respond with an &EINVAL; to -the new &VIDIOC-QUERYCAP; ioctl. - - There are new fields to identify the driver, a new RDS -device function V4L2_CAP_RDS_CAPTURE, the -V4L2_CAP_AUDIO flag indicates if the device has -any audio connectors, another I/O capability -V4L2_CAP_ASYNCIO can be flagged. In response to -these changes the type field became a bit -set and was merged into the flags field. -V4L2_FLAG_TUNER was renamed to -V4L2_CAP_TUNER, -V4L2_CAP_VIDEO_OVERLAY replaced -V4L2_FLAG_PREVIEW and -V4L2_CAP_VBI_CAPTURE and -V4L2_CAP_VBI_OUTPUT replaced -V4L2_FLAG_DATA_SERVICE. -V4L2_FLAG_READ and -V4L2_FLAG_WRITE were merged into -V4L2_CAP_READWRITE. - - The redundant fields -inputs, outputs -and audios were removed. These properties -can be determined as described in and . - - The somewhat volatile and therefore barely useful -fields maxwidth, -maxheight, -minwidth, -minheight, -maxframerate were removed. This information -is available as described in and -. - - V4L2_FLAG_SELECT was removed. We -believe the select() function is important enough to require support -of it in all V4L2 drivers exchanging data with applications. The -redundant V4L2_FLAG_MONOCHROME flag was removed, -this information is available as described in . - - - - In &v4l2-input; the -assoc_audio field and the -capability field and its only flag -V4L2_INPUT_CAP_AUDIO was replaced by the new -audioset field. Instead of linking one -video input to one audio input this field reports all audio inputs -this video input combines with. - - New fields are tuner -(reversing the former link from tuners to video inputs), -std and -status. - - Accordingly &v4l2-output; lost its -capability and -assoc_audio fields. -audioset, -modulator and -std where added instead. - - - - The &v4l2-audio; field -audio was renamed to -index, for consistency with other -structures. A new capability flag -V4L2_AUDCAP_STEREO was added to indicated if the -audio input in question supports stereo sound. -V4L2_AUDCAP_EFFECTS and the corresponding -V4L2_AUDMODE flags where removed. This can be -easily implemented using controls. (However the same applies to AVL -which is still there.) - - Again for consistency the &v4l2-audioout; field -audio was renamed to -index. - - - - The &v4l2-tuner; -input field was replaced by an -index field, permitting devices with -multiple tuners. The link between video inputs and tuners is now -reversed, inputs point to their tuner. The -std substructure became a -simple set (more about this below) and moved into &v4l2-input;. A -type field was added. - - Accordingly in &v4l2-modulator; the -output was replaced by an -index field. - - In &v4l2-frequency; the -port field was replaced by a -tuner field containing the respective tuner -or modulator index number. A tuner type -field was added and the reserved field -became larger for future extensions (satellite tuners in -particular). - - - - The idea of completely transparent video standards was -dropped. Experience showed that applications must be able to work with -video standards beyond presenting the user a menu. Instead of -enumerating supported standards with an ioctl applications can now -refer to standards by &v4l2-std-id; and symbols defined in the -videodev2.h header file. For details see . The &VIDIOC-G-STD; and -&VIDIOC-S-STD; now take a pointer to this type as argument. -&VIDIOC-QUERYSTD; was added to autodetect the received standard, if -the hardware has this capability. In &v4l2-standard; an -index field was added for &VIDIOC-ENUMSTD;. -A &v4l2-std-id; field named id was added as -machine readable identifier, also replacing the -transmission field. The misleading -framerate field was renamed -to frameperiod. The now obsolete -colorstandard information, originally -needed to distguish between variations of standards, were -removed. - - Struct v4l2_enumstd ceased to -be. &VIDIOC-ENUMSTD; now takes a pointer to a &v4l2-standard; -directly. The information which standards are supported by a -particular video input or output moved into &v4l2-input; and -&v4l2-output; fields named std, -respectively. - - - - The &v4l2-queryctrl; fields -category and -group did not catch on and/or were not -implemented as expected and therefore removed. - - - - The &VIDIOC-TRY-FMT; ioctl was added to negotiate data -formats as with &VIDIOC-S-FMT;, but without the overhead of -programming the hardware and regardless of I/O in progress. - - In &v4l2-format; the fmt -union was extended to contain &v4l2-window;. All image format -negotiations are now possible with VIDIOC_G_FMT, -VIDIOC_S_FMT and -VIDIOC_TRY_FMT; ioctl. The -VIDIOC_G_WIN and -VIDIOC_S_WIN ioctls to prepare for a video -overlay were removed. The type field -changed to type &v4l2-buf-type; and the buffer type names changed as -follows. - - - - Old defines - &v4l2-buf-type; - - - - - V4L2_BUF_TYPE_CAPTURE - V4L2_BUF_TYPE_VIDEO_CAPTURE - - - V4L2_BUF_TYPE_CODECIN - Omitted for now - - - V4L2_BUF_TYPE_CODECOUT - Omitted for now - - - V4L2_BUF_TYPE_EFFECTSIN - Omitted for now - - - V4L2_BUF_TYPE_EFFECTSIN2 - Omitted for now - - - V4L2_BUF_TYPE_EFFECTSOUT - Omitted for now - - - V4L2_BUF_TYPE_VIDEOOUT - V4L2_BUF_TYPE_VIDEO_OUTPUT - - - - - V4L2_BUF_TYPE_VIDEO_OVERLAY - - - - - V4L2_BUF_TYPE_VBI_CAPTURE - - - - - V4L2_BUF_TYPE_VBI_OUTPUT - - - - - V4L2_BUF_TYPE_SLICED_VBI_CAPTURE - - - - - V4L2_BUF_TYPE_SLICED_VBI_OUTPUT - - - V4L2_BUF_TYPE_PRIVATE_BASE - V4L2_BUF_TYPE_PRIVATE - - - - - - - - In &v4l2-fmtdesc; a &v4l2-buf-type; field named -type was added as in &v4l2-format;. The -VIDIOC_ENUM_FBUFFMT ioctl is no longer needed and -was removed. These calls can be replaced by &VIDIOC-ENUM-FMT; with -type V4L2_BUF_TYPE_VIDEO_OVERLAY. - - - - In &v4l2-pix-format; the -depth field was removed, assuming -applications which recognize the format by its four-character-code -already know the color depth, and others do not care about it. The -same rationale lead to the removal of the -V4L2_FMT_FLAG_COMPRESSED flag. The -V4L2_FMT_FLAG_SWCONVECOMPRESSED flag was removed -because drivers are not supposed to convert images in kernel space. A -user library of conversion functions should be provided instead. The -V4L2_FMT_FLAG_BYTESPERLINE flag was redundant. -Applications can set the bytesperline field -to zero to get a reasonable default. Since the remaining flags were -replaced as well, the flags field itself -was removed. - The interlace flags were replaced by a &v4l2-field; -value in a newly added field -field. - - - - Old flag - &v4l2-field; - - - - - V4L2_FMT_FLAG_NOT_INTERLACED - ? - - - V4L2_FMT_FLAG_INTERLACED -= V4L2_FMT_FLAG_COMBINED - V4L2_FIELD_INTERLACED - - - V4L2_FMT_FLAG_TOPFIELD -= V4L2_FMT_FLAG_ODDFIELD - V4L2_FIELD_TOP - - - V4L2_FMT_FLAG_BOTFIELD -= V4L2_FMT_FLAG_EVENFIELD - V4L2_FIELD_BOTTOM - - - - - V4L2_FIELD_SEQ_TB - - - - - V4L2_FIELD_SEQ_BT - - - - - V4L2_FIELD_ALTERNATE - - - - - - The color space flags were replaced by a -&v4l2-colorspace; value in a newly added -colorspace field, where one of -V4L2_COLORSPACE_SMPTE170M, -V4L2_COLORSPACE_BT878, -V4L2_COLORSPACE_470_SYSTEM_M or -V4L2_COLORSPACE_470_SYSTEM_BG replaces -V4L2_FMT_CS_601YUV. - - - - In &v4l2-requestbuffers; the -type field was properly defined as -&v4l2-buf-type;. Buffer types changed as mentioned above. A new -memory field of type &v4l2-memory; was -added to distinguish between I/O methods using buffers allocated -by the driver or the application. See for -details. - - - - In &v4l2-buffer; the type -field was properly defined as &v4l2-buf-type;. Buffer types changed as -mentioned above. A field field of type -&v4l2-field; was added to indicate if a buffer contains a top or -bottom field. The old field flags were removed. Since no unadjusted -system time clock was added to the kernel as planned, the -timestamp field changed back from type -stamp_t, an unsigned 64 bit integer expressing the sample time in -nanoseconds, to struct timeval. With the -addition of a second memory mapping method the -offset field moved into union -m, and a new -memory field of type &v4l2-memory; was -added to distinguish between I/O methods. See -for details. - - The V4L2_BUF_REQ_CONTIG -flag was used by the V4L compatibility layer, after changes to this -code it was no longer needed. The -V4L2_BUF_ATTR_DEVICEMEM flag would indicate if -the buffer was indeed allocated in device memory rather than DMA-able -system memory. It was barely useful and so was removed. - - - - In &v4l2-framebuffer; the -base[3] array anticipating double- and -triple-buffering in off-screen video memory, however without defining -a synchronization mechanism, was replaced by a single pointer. The -V4L2_FBUF_CAP_SCALEUP and -V4L2_FBUF_CAP_SCALEDOWN flags were removed. -Applications can determine this capability more accurately using the -new cropping and scaling interface. The -V4L2_FBUF_CAP_CLIPPING flag was replaced by -V4L2_FBUF_CAP_LIST_CLIPPING and -V4L2_FBUF_CAP_BITMAP_CLIPPING. - - - - In &v4l2-clip; the x, -y, width and -height field moved into a -c substructure of type &v4l2-rect;. The -x and y fields -were renamed to left and -top, &ie; offsets to a context dependent -origin. - - - - In &v4l2-window; the x, -y, width and -height field moved into a -w substructure as above. A -field field of type %v4l2-field; was added -to distinguish between field and frame (interlaced) overlay. - - - - The digital zoom interface, including struct -v4l2_zoomcap, struct -v4l2_zoom, -V4L2_ZOOM_NONCAP and -V4L2_ZOOM_WHILESTREAMING was replaced by a new -cropping and scaling interface. The previously unused struct -v4l2_cropcap and -v4l2_crop where redefined for this purpose. -See for details. - - - - In &v4l2-vbi-format; the -SAMPLE_FORMAT field now contains a -four-character-code as used to identify video image formats and -V4L2_PIX_FMT_GREY replaces the -V4L2_VBI_SF_UBYTE define. The -reserved field was extended. - - - - In &v4l2-captureparm; the type of the -timeperframe field changed from unsigned -long to &v4l2-fract;. This allows the accurate expression of multiples -of the NTSC-M frame rate 30000 / 1001. A new field -readbuffers was added to control the driver -behaviour in read I/O mode. - - Similar changes were made to &v4l2-outputparm;. - - - - The struct v4l2_performance -and VIDIOC_G_PERF ioctl were dropped. Except when -using the read/write I/O method, which is -limited anyway, this information is already available to -applications. - - - - The example transformation from RGB to YCbCr color -space in the old V4L2 documentation was inaccurate, this has been -corrected in . - - -
- -
- V4L2 2003-06-19 - - - - A new capability flag -V4L2_CAP_RADIO was added for radio devices. Prior -to this change radio devices would identify solely by having exactly one -tuner whose type field reads V4L2_TUNER_RADIO. - - - - An optional driver access priority mechanism was -added, see for details. - - - - The audio input and output interface was found to be -incomplete. - Previously the &VIDIOC-G-AUDIO; -ioctl would enumerate the available audio inputs. An ioctl to -determine the current audio input, if more than one combines with the -current video input, did not exist. So -VIDIOC_G_AUDIO was renamed to -VIDIOC_G_AUDIO_OLD, this ioctl was removed on -Kernel 2.6.39. The &VIDIOC-ENUMAUDIO; ioctl was added to enumerate -audio inputs, while &VIDIOC-G-AUDIO; now reports the current audio -input. - The same changes were made to &VIDIOC-G-AUDOUT; and -&VIDIOC-ENUMAUDOUT;. - Until further the "videodev" module will automatically -translate between the old and new ioctls, but drivers and applications -must be updated to successfully compile again. - - - - The &VIDIOC-OVERLAY; ioctl was incorrectly defined with -write-read parameter. It was changed to write-only, while the write-read -version was renamed to VIDIOC_OVERLAY_OLD. The old -ioctl was removed on Kernel 2.6.39. Until further the "videodev" -kernel module will automatically translate to the new version, so drivers -must be recompiled, but not applications. - - - - incorrectly stated that -clipping rectangles define regions where the video can be seen. -Correct is that clipping rectangles define regions where -no video shall be displayed and so the graphics -surface can be seen. - - - - The &VIDIOC-S-PARM; and &VIDIOC-S-CTRL; ioctls were -defined with write-only parameter, inconsistent with other ioctls -modifying their argument. They were changed to write-read, while a -_OLD suffix was added to the write-only versions. -The old ioctls were removed on Kernel 2.6.39. Drivers and -applications assuming a constant parameter need an update. - - -
- -
- V4L2 2003-11-05 - - - In the following pixel -formats were incorrectly transferred from Bill Dirks' V4L2 -specification. Descriptions below refer to bytes in memory, in -ascending address order. - - - - Symbol - In this document prior to revision -0.5 - Corrected - - - - - V4L2_PIX_FMT_RGB24 - B, G, R - R, G, B - - - V4L2_PIX_FMT_BGR24 - R, G, B - B, G, R - - - V4L2_PIX_FMT_RGB32 - B, G, R, X - R, G, B, X - - - V4L2_PIX_FMT_BGR32 - R, G, B, X - B, G, R, X - - - - The -V4L2_PIX_FMT_BGR24 example was always -correct. - In the mapping -of the V4L VIDEO_PALETTE_RGB24 and -VIDEO_PALETTE_RGB32 formats to V4L2 pixel formats -was accordingly corrected. - - - - Unrelated to the fixes above, drivers may still -interpret some V4L2 RGB pixel formats differently. These issues have -yet to be addressed, for details see . - - -
- -
- V4L2 in Linux 2.6.6, 2004-05-09 - - - The &VIDIOC-CROPCAP; ioctl was incorrectly defined -with read-only parameter. It is now defined as write-read ioctl, while -the read-only version was renamed to -VIDIOC_CROPCAP_OLD. The old ioctl was removed -on Kernel 2.6.39. - - -
- -
- V4L2 in Linux 2.6.8 - - - A new field input (former -reserved[0]) was added to the &v4l2-buffer; -structure. Purpose of this field is to alternate between video inputs -(⪚ cameras) in step with the video capturing process. This function -must be enabled with the new V4L2_BUF_FLAG_INPUT -flag. The flags field is no longer -read-only. - - -
- -
- V4L2 spec erratum 2004-08-01 - - - - The return value of the - function was incorrectly documented. - - - - Audio output ioctls end in -AUDOUT, not -AUDIOOUT. - - - - In the Current Audio Input example the -VIDIOC_G_AUDIO ioctl took the wrong -argument. - - - - The documentation of the &VIDIOC-QBUF; and -&VIDIOC-DQBUF; ioctls did not mention the &v4l2-buffer; -memory field. It was also missing from -examples. Also on the VIDIOC_DQBUF page the &EIO; -was not documented. - - -
- -
- V4L2 in Linux 2.6.14 - - - A new sliced VBI interface was added. It is documented -in and replaces the interface first -proposed in V4L2 specification 0.8. - - -
- -
- V4L2 in Linux 2.6.15 - - - The &VIDIOC-LOG-STATUS; ioctl was added. - - - - New video standards -V4L2_STD_NTSC_443, -V4L2_STD_SECAM_LC, -V4L2_STD_SECAM_DK (a set of SECAM D, K and K1), -and V4L2_STD_ATSC (a set of -V4L2_STD_ATSC_8_VSB and -V4L2_STD_ATSC_16_VSB) were defined. Note the -V4L2_STD_525_60 set now includes -V4L2_STD_NTSC_443. See also . - - - - The VIDIOC_G_COMP and -VIDIOC_S_COMP ioctl were renamed to -VIDIOC_G_MPEGCOMP and -VIDIOC_S_MPEGCOMP respectively. Their argument -was replaced by a struct -v4l2_mpeg_compression pointer. (The -VIDIOC_G_MPEGCOMP and -VIDIOC_S_MPEGCOMP ioctls where removed in Linux -2.6.25.) - - -
- -
- V4L2 spec erratum 2005-11-27 - The capture example in -called the &VIDIOC-S-CROP; ioctl without checking if cropping is -supported. In the video standard selection example in - the &VIDIOC-S-STD; call used the wrong -argument type. -
- -
- V4L2 spec erratum 2006-01-10 - - - The V4L2_IN_ST_COLOR_KILL flag in -&v4l2-input; not only indicates if the color killer is enabled, but -also if it is active. (The color killer disables color decoding when -it detects no color in the video signal to improve the image -quality.) - - - - &VIDIOC-S-PARM; is a write-read ioctl, not write-only as -stated on its reference page. The ioctl changed in 2003 as noted above. - - -
- -
- V4L2 spec erratum 2006-02-03 - - - In &v4l2-captureparm; and &v4l2-outputparm; the -timeperframe field gives the time in -seconds, not microseconds. - - -
- -
- V4L2 spec erratum 2006-02-04 - - - The clips field in -&v4l2-window; must point to an array of &v4l2-clip;, not a linked -list, because drivers ignore the struct -v4l2_clip.next -pointer. - - -
- -
- V4L2 in Linux 2.6.17 - - - New video standard macros were added: -V4L2_STD_NTSC_M_KR (NTSC M South Korea), and the -sets V4L2_STD_MN, -V4L2_STD_B, V4L2_STD_GH and -V4L2_STD_DK. The -V4L2_STD_NTSC and -V4L2_STD_SECAM sets now include -V4L2_STD_NTSC_M_KR and -V4L2_STD_SECAM_LC respectively. - - - - A new V4L2_TUNER_MODE_LANG1_LANG2 -was defined to record both languages of a bilingual program. The -use of V4L2_TUNER_MODE_STEREO for this purpose -is deprecated now. See the &VIDIOC-G-TUNER; section for -details. - - -
- -
- V4L2 spec erratum 2006-09-23 (Draft 0.15) - - - In various places -V4L2_BUF_TYPE_SLICED_VBI_CAPTURE and -V4L2_BUF_TYPE_SLICED_VBI_OUTPUT of the sliced VBI -interface were not mentioned along with other buffer types. - - - - In it was clarified -that the &v4l2-audio; mode field is a flags -field. - - - - did not mention the -sliced VBI and radio capability flags. - - - - In it was -clarified that applications must initialize the tuner -type field of &v4l2-frequency; before -calling &VIDIOC-S-FREQUENCY;. - - - - The reserved array -in &v4l2-requestbuffers; has 2 elements, not 32. - - - - In and the device file names -/dev/vout which never caught on were replaced -by /dev/video. - - - - With Linux 2.6.15 the possible range for VBI device minor -numbers was extended from 224-239 to 224-255. Accordingly device file names -/dev/vbi0 to /dev/vbi31 are -possible now. - - -
- -
- V4L2 in Linux 2.6.18 - - - New ioctls &VIDIOC-G-EXT-CTRLS;, &VIDIOC-S-EXT-CTRLS; -and &VIDIOC-TRY-EXT-CTRLS; were added, a flag to skip unsupported -controls with &VIDIOC-QUERYCTRL;, new control types -V4L2_CTRL_TYPE_INTEGER64 and -V4L2_CTRL_TYPE_CTRL_CLASS (), and new control flags -V4L2_CTRL_FLAG_READ_ONLY, -V4L2_CTRL_FLAG_UPDATE, -V4L2_CTRL_FLAG_INACTIVE and -V4L2_CTRL_FLAG_SLIDER (). See for details. - - -
- -
- V4L2 in Linux 2.6.19 - - - In &v4l2-sliced-vbi-cap; a buffer type field was added -replacing a reserved field. Note on architectures where the size of -enum types differs from int types the size of the structure changed. -The &VIDIOC-G-SLICED-VBI-CAP; ioctl was redefined from being read-only -to write-read. Applications must initialize the type field and clear -the reserved fields now. These changes may break the -compatibility with older drivers and applications. - - - - The ioctls &VIDIOC-ENUM-FRAMESIZES; and -&VIDIOC-ENUM-FRAMEINTERVALS; were added. - - - - A new pixel format V4L2_PIX_FMT_RGB444 () was added. - - -
- -
- V4L2 spec erratum 2006-10-12 (Draft 0.17) - - - V4L2_PIX_FMT_HM12 () is a YUV 4:2:0, not 4:2:2 format. - - -
- -
- V4L2 in Linux 2.6.21 - - - The videodev2.h header file is -now dual licensed under GNU General Public License version two or -later, and under a 3-clause BSD-style license. - - -
- -
- V4L2 in Linux 2.6.22 - - - Two new field orders - V4L2_FIELD_INTERLACED_TB and - V4L2_FIELD_INTERLACED_BT were - added. See for details. - - - - Three new clipping/blending methods with a global or -straight or inverted local alpha value were added to the video overlay -interface. See the description of the &VIDIOC-G-FBUF; and -&VIDIOC-S-FBUF; ioctls for details. - A new global_alpha field -was added to v4l2_window, -extending the structure. This may break -compatibility with applications using a struct -v4l2_window directly. However the VIDIOC_G/S/TRY_FMT ioctls, which take a -pointer to a v4l2_format parent -structure with padding bytes at the end, are not affected. - - - - The format of the chromakey -field in &v4l2-window; changed from "host order RGB32" to a pixel -value in the same format as the framebuffer. This may break -compatibility with existing applications. Drivers -supporting the "host order RGB32" format are not known. - - - -
- -
- V4L2 in Linux 2.6.24 - - - The pixel formats -V4L2_PIX_FMT_PAL8, -V4L2_PIX_FMT_YUV444, -V4L2_PIX_FMT_YUV555, -V4L2_PIX_FMT_YUV565 and -V4L2_PIX_FMT_YUV32 were added. - - -
- -
- V4L2 in Linux 2.6.25 - - - The pixel formats -V4L2_PIX_FMT_Y16 and -V4L2_PIX_FMT_SBGGR16 were added. - - - New controls -V4L2_CID_POWER_LINE_FREQUENCY, -V4L2_CID_HUE_AUTO, -V4L2_CID_WHITE_BALANCE_TEMPERATURE, -V4L2_CID_SHARPNESS and -V4L2_CID_BACKLIGHT_COMPENSATION were added. The -controls V4L2_CID_BLACK_LEVEL, -V4L2_CID_WHITENESS, -V4L2_CID_HCENTER and -V4L2_CID_VCENTER were deprecated. - - - - A Camera controls -class was added, with the new controls -V4L2_CID_EXPOSURE_AUTO, -V4L2_CID_EXPOSURE_ABSOLUTE, -V4L2_CID_EXPOSURE_AUTO_PRIORITY, -V4L2_CID_PAN_RELATIVE, -V4L2_CID_TILT_RELATIVE, -V4L2_CID_PAN_RESET, -V4L2_CID_TILT_RESET, -V4L2_CID_PAN_ABSOLUTE, -V4L2_CID_TILT_ABSOLUTE, -V4L2_CID_FOCUS_ABSOLUTE, -V4L2_CID_FOCUS_RELATIVE and -V4L2_CID_FOCUS_AUTO. - - - The VIDIOC_G_MPEGCOMP and -VIDIOC_S_MPEGCOMP ioctls, which were superseded -by the extended controls -interface in Linux 2.6.18, where finally removed from the -videodev2.h header file. - - -
- -
- V4L2 in Linux 2.6.26 - - - The pixel formats -V4L2_PIX_FMT_Y16 and -V4L2_PIX_FMT_SBGGR16 were added. - - - Added user controls -V4L2_CID_CHROMA_AGC and -V4L2_CID_COLOR_KILLER. - - -
- -
- V4L2 in Linux 2.6.27 - - - The &VIDIOC-S-HW-FREQ-SEEK; ioctl and the -V4L2_CAP_HW_FREQ_SEEK capability were added. - - - The pixel formats -V4L2_PIX_FMT_YVYU, -V4L2_PIX_FMT_PCA501, -V4L2_PIX_FMT_PCA505, -V4L2_PIX_FMT_PCA508, -V4L2_PIX_FMT_PCA561, -V4L2_PIX_FMT_SGBRG8, -V4L2_PIX_FMT_PAC207 and -V4L2_PIX_FMT_PJPG were added. - - -
- -
- V4L2 in Linux 2.6.28 - - - Added V4L2_MPEG_AUDIO_ENCODING_AAC and -V4L2_MPEG_AUDIO_ENCODING_AC3 MPEG audio encodings. - - - Added V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC MPEG -video encoding. - - - The pixel formats -V4L2_PIX_FMT_SGRBG10 and -V4L2_PIX_FMT_SGRBG10DPCM8 were added. - - -
- -
- V4L2 in Linux 2.6.29 - - - The VIDIOC_G_CHIP_IDENT ioctl was renamed -to VIDIOC_G_CHIP_IDENT_OLD and &VIDIOC-DBG-G-CHIP-IDENT; -was introduced in its place. The old struct v4l2_chip_ident -was renamed to v4l2_chip_ident_old. - - - The pixel formats -V4L2_PIX_FMT_VYUY, -V4L2_PIX_FMT_NV16 and -V4L2_PIX_FMT_NV61 were added. - - - Added camera controls -V4L2_CID_ZOOM_ABSOLUTE, -V4L2_CID_ZOOM_RELATIVE, -V4L2_CID_ZOOM_CONTINUOUS and -V4L2_CID_PRIVACY. - - -
-
- V4L2 in Linux 2.6.30 - - - New control flag V4L2_CTRL_FLAG_WRITE_ONLY was added. - - - New control V4L2_CID_COLORFX was added. - - -
-
- V4L2 in Linux 2.6.32 - - - In order to be easier to compare a V4L2 API and a kernel -version, now V4L2 API is numbered using the Linux Kernel version numeration. - - - Finalized the RDS capture API. See for -more information. - - - Added new capabilities for modulators and RDS encoders. - - - Add description for libv4l API. - - - Added support for string controls via new type V4L2_CTRL_TYPE_STRING. - - - Added V4L2_CID_BAND_STOP_FILTER documentation. - - - Added FM Modulator (FM TX) Extended Control Class: V4L2_CTRL_CLASS_FM_TX and their Control IDs. - - - Added Remote Controller chapter, describing the default Remote Controller mapping for media devices. - - -
-
- V4L2 in Linux 2.6.33 - - - Added support for Digital Video timings in order to support HDTV receivers and transmitters. - - -
-
- V4L2 in Linux 2.6.34 - - - Added -V4L2_CID_IRIS_ABSOLUTE and -V4L2_CID_IRIS_RELATIVE controls to the - Camera controls class. - - - -
-
- V4L2 in Linux 2.6.37 - - - Remove the vtx (videotext/teletext) API. This API was no longer -used and no hardware exists to verify the API. Nor were any userspace applications found -that used it. It was originally scheduled for removal in 2.6.35. - - - -
-
- V4L2 in Linux 2.6.39 - - - The old VIDIOC_*_OLD symbols and V4L1 support were removed. - - - Multi-planar API added. Does not affect the compatibility of - current drivers and applications. See - multi-planar API - for details. - - -
- -
- Relation of V4L2 to other Linux multimedia APIs - -
- X Video Extension - - The X Video Extension (abbreviated XVideo or just Xv) is -an extension of the X Window system, implemented for example by the -XFree86 project. Its scope is similar to V4L2, an API to video capture -and output devices for X clients. Xv allows applications to display -live video in a window, send window contents to a TV output, and -capture or output still images in XPixmaps - This is not implemented in XFree86. - . With their implementation XFree86 makes the -extension available across many operating systems and -architectures. - - Because the driver is embedded into the X server Xv has a -number of advantages over the V4L2 video -overlay interface. The driver can easily determine the overlay -target, &ie; visible graphics memory or off-screen buffers for a -destructive overlay. It can program the RAMDAC for a non-destructive -overlay, scaling or color-keying, or the clipping functions of the -video capture hardware, always in sync with drawing operations or -windows moving or changing their stacking order. - - To combine the advantages of Xv and V4L a special Xv -driver exists in XFree86 and XOrg, just programming any overlay capable -Video4Linux device it finds. To enable it -/etc/X11/XF86Config must contain these lines: - -Section "Module" - Load "v4l" -EndSection - - As of XFree86 4.2 this driver still supports only V4L -ioctls, however it should work just fine with all V4L2 devices through -the V4L2 backward-compatibility layer. Since V4L2 permits multiple -opens it is possible (if supported by the V4L2 driver) to capture -video while an X client requested video overlay. Restrictions of -simultaneous capturing and overlay are discussed in apply. - - Only marginally related to V4L2, XFree86 extended Xv to -support hardware YUV to RGB conversion and scaling for faster video -playback, and added an interface to MPEG-2 decoding hardware. This API -is useful to display images captured with V4L2 devices. -
- -
- Digital Video - - V4L2 does not support digital terrestrial, cable or -satellite broadcast. A separate project aiming at digital receivers -exists. You can find its homepage at http://linuxtv.org. The Linux DVB API -has no connection to the V4L2 API except that drivers for hybrid -hardware may support both. -
- -
- Audio Interfaces - - [to do - OSS/ALSA] -
-
- -
- Experimental API Elements - - The following V4L2 API elements are currently experimental -and may change in the future. - - - - Video Output Overlay (OSD) Interface, . - - - V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY, - &v4l2-buf-type;, . - - - V4L2_CAP_VIDEO_OUTPUT_OVERLAY, -&VIDIOC-QUERYCAP; ioctl, . - - - &VIDIOC-ENUM-FRAMESIZES; and -&VIDIOC-ENUM-FRAMEINTERVALS; ioctls. - - - &VIDIOC-G-ENC-INDEX; ioctl. - - - &VIDIOC-ENCODER-CMD; and &VIDIOC-TRY-ENCODER-CMD; -ioctls. - - - &VIDIOC-DBG-G-REGISTER; and &VIDIOC-DBG-S-REGISTER; -ioctls. - - - &VIDIOC-DBG-G-CHIP-IDENT; ioctl. - - -
- -
- Obsolete API Elements - - The following V4L2 API elements were superseded by new -interfaces and should not be implemented in new drivers. - - - - VIDIOC_G_MPEGCOMP and -VIDIOC_S_MPEGCOMP ioctls. Use Extended Controls, -. - - -
-
- - diff --git a/Documentation/DocBook/v4l/controls.xml b/Documentation/DocBook/v4l/controls.xml deleted file mode 100644 index a920ee80f640..000000000000 --- a/Documentation/DocBook/v4l/controls.xml +++ /dev/null @@ -1,2103 +0,0 @@ -
- User Controls - - Devices typically have a number of user-settable controls -such as brightness, saturation and so on, which would be presented to -the user on a graphical user interface. But, different devices -will have different controls available, and furthermore, the range of -possible values, and the default value will vary from device to -device. The control ioctls provide the information and a mechanism to -create a nice user interface for these controls that will work -correctly with any device. - - All controls are accessed using an ID value. V4L2 defines -several IDs for specific purposes. Drivers can also implement their -own custom controls using V4L2_CID_PRIVATE_BASE -and higher values. The pre-defined control IDs have the prefix -V4L2_CID_, and are listed in . The ID is used when querying the attributes of -a control, and when getting or setting the current value. - - Generally applications should present controls to the user -without assumptions about their purpose. Each control comes with a -name string the user is supposed to understand. When the purpose is -non-intuitive the driver writer should provide a user manual, a user -interface plug-in or a driver specific panel application. Predefined -IDs were introduced to change a few controls programmatically, for -example to mute a device during a channel switch. - - Drivers may enumerate different controls after switching -the current video input or output, tuner or modulator, or audio input -or output. Different in the sense of other bounds, another default and -current value, step size or other menu items. A control with a certain -custom ID can also change name and -type. - It will be more convenient for applications if drivers -make use of the V4L2_CTRL_FLAG_DISABLED flag, but -that was never required. - Control values are stored globally, they do not -change when switching except to stay within the reported bounds. They -also do not change ⪚ when the device is opened or closed, when the -tuner radio frequency is changed or generally never without -application request. Since V4L2 specifies no event mechanism, panel -applications intended to cooperate with other panel applications (be -they built into a larger application, as a TV viewer) may need to -regularly poll control values to update their user -interface. - Applications could call an ioctl to request events. -After another process called &VIDIOC-S-CTRL; or another ioctl changing -shared properties the &func-select; function would indicate -readability until any ioctl (querying the properties) is -called. - - - - Control IDs - - &cs-def; - - - ID - Type - Description - - - - - V4L2_CID_BASE - - First predefined ID, equal to -V4L2_CID_BRIGHTNESS. - - - V4L2_CID_USER_BASE - - Synonym of V4L2_CID_BASE. - - - V4L2_CID_BRIGHTNESS - integer - Picture brightness, or more precisely, the black -level. - - - V4L2_CID_CONTRAST - integer - Picture contrast or luma gain. - - - V4L2_CID_SATURATION - integer - Picture color saturation or chroma gain. - - - V4L2_CID_HUE - integer - Hue or color balance. - - - V4L2_CID_AUDIO_VOLUME - integer - Overall audio volume. Note some drivers also -provide an OSS or ALSA mixer interface. - - - V4L2_CID_AUDIO_BALANCE - integer - Audio stereo balance. Minimum corresponds to all -the way left, maximum to right. - - - V4L2_CID_AUDIO_BASS - integer - Audio bass adjustment. - - - V4L2_CID_AUDIO_TREBLE - integer - Audio treble adjustment. - - - V4L2_CID_AUDIO_MUTE - boolean - Mute audio, &ie; set the volume to zero, however -without affecting V4L2_CID_AUDIO_VOLUME. Like -ALSA drivers, V4L2 drivers must mute at load time to avoid excessive -noise. Actually the entire device should be reset to a low power -consumption state. - - - V4L2_CID_AUDIO_LOUDNESS - boolean - Loudness mode (bass boost). - - - V4L2_CID_BLACK_LEVEL - integer - Another name for brightness (not a synonym of -V4L2_CID_BRIGHTNESS). This control is deprecated -and should not be used in new drivers and applications. - - - V4L2_CID_AUTO_WHITE_BALANCE - boolean - Automatic white balance (cameras). - - - V4L2_CID_DO_WHITE_BALANCE - button - This is an action control. When set (the value is -ignored), the device will do a white balance and then hold the current -setting. Contrast this with the boolean -V4L2_CID_AUTO_WHITE_BALANCE, which, when -activated, keeps adjusting the white balance. - - - V4L2_CID_RED_BALANCE - integer - Red chroma balance. - - - V4L2_CID_BLUE_BALANCE - integer - Blue chroma balance. - - - V4L2_CID_GAMMA - integer - Gamma adjust. - - - V4L2_CID_WHITENESS - integer - Whiteness for grey-scale devices. This is a synonym -for V4L2_CID_GAMMA. This control is deprecated -and should not be used in new drivers and applications. - - - V4L2_CID_EXPOSURE - integer - Exposure (cameras). [Unit?] - - - V4L2_CID_AUTOGAIN - boolean - Automatic gain/exposure control. - - - V4L2_CID_GAIN - integer - Gain control. - - - V4L2_CID_HFLIP - boolean - Mirror the picture horizontally. - - - V4L2_CID_VFLIP - boolean - Mirror the picture vertically. - - - V4L2_CID_HCENTER_DEPRECATED (formerly V4L2_CID_HCENTER) - integer - Horizontal image centering. This control is -deprecated. New drivers and applications should use the Camera class controls -V4L2_CID_PAN_ABSOLUTE, -V4L2_CID_PAN_RELATIVE and -V4L2_CID_PAN_RESET instead. - - - V4L2_CID_VCENTER_DEPRECATED - (formerly V4L2_CID_VCENTER) - integer - Vertical image centering. Centering is intended to -physically adjust cameras. For image cropping see -, for clipping . This -control is deprecated. New drivers and applications should use the -Camera class controls -V4L2_CID_TILT_ABSOLUTE, -V4L2_CID_TILT_RELATIVE and -V4L2_CID_TILT_RESET instead. - - - V4L2_CID_POWER_LINE_FREQUENCY - enum - Enables a power line frequency filter to avoid -flicker. Possible values for enum v4l2_power_line_frequency are: -V4L2_CID_POWER_LINE_FREQUENCY_DISABLED (0), -V4L2_CID_POWER_LINE_FREQUENCY_50HZ (1) and -V4L2_CID_POWER_LINE_FREQUENCY_60HZ (2). - - - V4L2_CID_HUE_AUTO - boolean - Enables automatic hue control by the device. The -effect of setting V4L2_CID_HUE while automatic -hue control is enabled is undefined, drivers should ignore such -request. - - - V4L2_CID_WHITE_BALANCE_TEMPERATURE - integer - This control specifies the white balance settings -as a color temperature in Kelvin. A driver should have a minimum of -2800 (incandescent) to 6500 (daylight). For more information about -color temperature see Wikipedia. - - - V4L2_CID_SHARPNESS - integer - Adjusts the sharpness filters in a camera. The -minimum value disables the filters, higher values give a sharper -picture. - - - V4L2_CID_BACKLIGHT_COMPENSATION - integer - Adjusts the backlight compensation in a camera. The -minimum value disables backlight compensation. - - - V4L2_CID_CHROMA_AGC - boolean - Chroma automatic gain control. - - - V4L2_CID_CHROMA_GAIN - integer - Adjusts the Chroma gain control (for use when chroma AGC - is disabled). - - - V4L2_CID_COLOR_KILLER - boolean - Enable the color killer (&ie; force a black & white image in case of a weak video signal). - - - V4L2_CID_COLORFX - enum - Selects a color effect. Possible values for -enum v4l2_colorfx are: -V4L2_COLORFX_NONE (0), -V4L2_COLORFX_BW (1), -V4L2_COLORFX_SEPIA (2), -V4L2_COLORFX_NEGATIVE (3), -V4L2_COLORFX_EMBOSS (4), -V4L2_COLORFX_SKETCH (5), -V4L2_COLORFX_SKY_BLUE (6), -V4L2_COLORFX_GRASS_GREEN (7), -V4L2_COLORFX_SKIN_WHITEN (8) and -V4L2_COLORFX_VIVID (9). - - - V4L2_CID_ROTATE - integer - Rotates the image by specified angle. Common angles are 90, - 270 and 180. Rotating the image to 90 and 270 will reverse the height - and width of the display window. It is necessary to set the new height and - width of the picture using the &VIDIOC-S-FMT; ioctl according to - the rotation angle selected. - - - V4L2_CID_BG_COLOR - integer - Sets the background color on the current output device. - Background color needs to be specified in the RGB24 format. The - supplied 32 bit value is interpreted as bits 0-7 Red color information, - bits 8-15 Green color information, bits 16-23 Blue color - information and bits 24-31 must be zero. - - - V4L2_CID_ILLUMINATORS_1 - V4L2_CID_ILLUMINATORS_2 - boolean - Switch on or off the illuminator 1 or 2 of the device - (usually a microscope). - - - V4L2_CID_LASTP1 - - End of the predefined control IDs (currently -V4L2_CID_ILLUMINATORS_2 + 1). - - - V4L2_CID_PRIVATE_BASE - - ID of the first custom (driver specific) control. -Applications depending on particular custom controls should check the -driver name and version, see . - - - -
- - Applications can enumerate the available controls with the -&VIDIOC-QUERYCTRL; and &VIDIOC-QUERYMENU; ioctls, get and set a -control value with the &VIDIOC-G-CTRL; and &VIDIOC-S-CTRL; ioctls. -Drivers must implement VIDIOC_QUERYCTRL, -VIDIOC_G_CTRL and -VIDIOC_S_CTRL when the device has one or more -controls, VIDIOC_QUERYMENU when it has one or -more menu type controls. - - - Enumerating all controls - - -&v4l2-queryctrl; queryctrl; -&v4l2-querymenu; querymenu; - -static void -enumerate_menu (void) -{ - printf (" Menu items:\n"); - - memset (&querymenu, 0, sizeof (querymenu)); - querymenu.id = queryctrl.id; - - for (querymenu.index = queryctrl.minimum; - querymenu.index <= queryctrl.maximum; - querymenu.index++) { - if (0 == ioctl (fd, &VIDIOC-QUERYMENU;, &querymenu)) { - printf (" %s\n", querymenu.name); - } - } -} - -memset (&queryctrl, 0, sizeof (queryctrl)); - -for (queryctrl.id = V4L2_CID_BASE; - queryctrl.id < V4L2_CID_LASTP1; - queryctrl.id++) { - if (0 == ioctl (fd, &VIDIOC-QUERYCTRL;, &queryctrl)) { - if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) - continue; - - printf ("Control %s\n", queryctrl.name); - - if (queryctrl.type == V4L2_CTRL_TYPE_MENU) - enumerate_menu (); - } else { - if (errno == EINVAL) - continue; - - perror ("VIDIOC_QUERYCTRL"); - exit (EXIT_FAILURE); - } -} - -for (queryctrl.id = V4L2_CID_PRIVATE_BASE;; - queryctrl.id++) { - if (0 == ioctl (fd, &VIDIOC-QUERYCTRL;, &queryctrl)) { - if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) - continue; - - printf ("Control %s\n", queryctrl.name); - - if (queryctrl.type == V4L2_CTRL_TYPE_MENU) - enumerate_menu (); - } else { - if (errno == EINVAL) - break; - - perror ("VIDIOC_QUERYCTRL"); - exit (EXIT_FAILURE); - } -} - - - - - Changing controls - - -&v4l2-queryctrl; queryctrl; -&v4l2-control; control; - -memset (&queryctrl, 0, sizeof (queryctrl)); -queryctrl.id = V4L2_CID_BRIGHTNESS; - -if (-1 == ioctl (fd, &VIDIOC-QUERYCTRL;, &queryctrl)) { - if (errno != EINVAL) { - perror ("VIDIOC_QUERYCTRL"); - exit (EXIT_FAILURE); - } else { - printf ("V4L2_CID_BRIGHTNESS is not supported\n"); - } -} else if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) { - printf ("V4L2_CID_BRIGHTNESS is not supported\n"); -} else { - memset (&control, 0, sizeof (control)); - control.id = V4L2_CID_BRIGHTNESS; - control.value = queryctrl.default_value; - - if (-1 == ioctl (fd, &VIDIOC-S-CTRL;, &control)) { - perror ("VIDIOC_S_CTRL"); - exit (EXIT_FAILURE); - } -} - -memset (&control, 0, sizeof (control)); -control.id = V4L2_CID_CONTRAST; - -if (0 == ioctl (fd, &VIDIOC-G-CTRL;, &control)) { - control.value += 1; - - /* The driver may clamp the value or return ERANGE, ignored here */ - - if (-1 == ioctl (fd, &VIDIOC-S-CTRL;, &control) - && errno != ERANGE) { - perror ("VIDIOC_S_CTRL"); - exit (EXIT_FAILURE); - } -/* Ignore if V4L2_CID_CONTRAST is unsupported */ -} else if (errno != EINVAL) { - perror ("VIDIOC_G_CTRL"); - exit (EXIT_FAILURE); -} - -control.id = V4L2_CID_AUDIO_MUTE; -control.value = TRUE; /* silence */ - -/* Errors ignored */ -ioctl (fd, VIDIOC_S_CTRL, &control); - - -
- -
- Extended Controls - -
- Introduction - - The control mechanism as originally designed was meant -to be used for user settings (brightness, saturation, etc). However, -it turned out to be a very useful model for implementing more -complicated driver APIs where each driver implements only a subset of -a larger API. - - The MPEG encoding API was the driving force behind -designing and implementing this extended control mechanism: the MPEG -standard is quite large and the currently supported hardware MPEG -encoders each only implement a subset of this standard. Further more, -many parameters relating to how the video is encoded into an MPEG -stream are specific to the MPEG encoding chip since the MPEG standard -only defines the format of the resulting MPEG stream, not how the -video is actually encoded into that format. - - Unfortunately, the original control API lacked some -features needed for these new uses and so it was extended into the -(not terribly originally named) extended control API. - - Even though the MPEG encoding API was the first effort -to use the Extended Control API, nowadays there are also other classes -of Extended Controls, such as Camera Controls and FM Transmitter Controls. -The Extended Controls API as well as all Extended Controls classes are -described in the following text. -
- -
- The Extended Control API - - Three new ioctls are available: &VIDIOC-G-EXT-CTRLS;, -&VIDIOC-S-EXT-CTRLS; and &VIDIOC-TRY-EXT-CTRLS;. These ioctls act on -arrays of controls (as opposed to the &VIDIOC-G-CTRL; and -&VIDIOC-S-CTRL; ioctls that act on a single control). This is needed -since it is often required to atomically change several controls at -once. - - Each of the new ioctls expects a pointer to a -&v4l2-ext-controls;. This structure contains a pointer to the control -array, a count of the number of controls in that array and a control -class. Control classes are used to group similar controls into a -single class. For example, control class -V4L2_CTRL_CLASS_USER contains all user controls -(&ie; all controls that can also be set using the old -VIDIOC_S_CTRL ioctl). Control class -V4L2_CTRL_CLASS_MPEG contains all controls -relating to MPEG encoding, etc. - - All controls in the control array must belong to the -specified control class. An error is returned if this is not the -case. - - It is also possible to use an empty control array (count -== 0) to check whether the specified control class is -supported. - - The control array is a &v4l2-ext-control; array. The -v4l2_ext_control structure is very similar to -&v4l2-control;, except for the fact that it also allows for 64-bit -values and pointers to be passed. - - It is important to realize that due to the flexibility of -controls it is necessary to check whether the control you want to set -actually is supported in the driver and what the valid range of values -is. So use the &VIDIOC-QUERYCTRL; and &VIDIOC-QUERYMENU; ioctls to -check this. Also note that it is possible that some of the menu -indices in a control of type V4L2_CTRL_TYPE_MENU -may not be supported (VIDIOC_QUERYMENU will -return an error). A good example is the list of supported MPEG audio -bitrates. Some drivers only support one or two bitrates, others -support a wider range. -
- -
- Enumerating Extended Controls - - The recommended way to enumerate over the extended -controls is by using &VIDIOC-QUERYCTRL; in combination with the -V4L2_CTRL_FLAG_NEXT_CTRL flag: - - - -&v4l2-queryctrl; qctrl; - -qctrl.id = V4L2_CTRL_FLAG_NEXT_CTRL; -while (0 == ioctl (fd, &VIDIOC-QUERYCTRL;, &qctrl)) { - /* ... */ - qctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL; -} - - - - The initial control ID is set to 0 ORed with the -V4L2_CTRL_FLAG_NEXT_CTRL flag. The -VIDIOC_QUERYCTRL ioctl will return the first -control with a higher ID than the specified one. When no such controls -are found an error is returned. - - If you want to get all controls within a specific control -class, then you can set the initial -qctrl.id value to the control class and add -an extra check to break out of the loop when a control of another -control class is found: - - - -qctrl.id = V4L2_CTRL_CLASS_MPEG | V4L2_CTRL_FLAG_NEXT_CTRL; -while (0 == ioctl (fd, &VIDIOC-QUERYCTRL;, &qctrl)) { - if (V4L2_CTRL_ID2CLASS (qctrl.id) != V4L2_CTRL_CLASS_MPEG) - break; - /* ... */ - qctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL; - } - - - - The 32-bit qctrl.id value is -subdivided into three bit ranges: the top 4 bits are reserved for -flags (⪚ V4L2_CTRL_FLAG_NEXT_CTRL) and are not -actually part of the ID. The remaining 28 bits form the control ID, of -which the most significant 12 bits define the control class and the -least significant 16 bits identify the control within the control -class. It is guaranteed that these last 16 bits are always non-zero -for controls. The range of 0x1000 and up are reserved for -driver-specific controls. The macro -V4L2_CTRL_ID2CLASS(id) returns the control class -ID based on a control ID. - - If the driver does not support extended controls, then -VIDIOC_QUERYCTRL will fail when used in -combination with V4L2_CTRL_FLAG_NEXT_CTRL. In -that case the old method of enumerating control should be used (see -1.8). But if it is supported, then it is guaranteed to enumerate over -all controls, including driver-private controls. -
- -
- Creating Control Panels - - It is possible to create control panels for a graphical -user interface where the user can select the various controls. -Basically you will have to iterate over all controls using the method -described above. Each control class starts with a control of type -V4L2_CTRL_TYPE_CTRL_CLASS. -VIDIOC_QUERYCTRL will return the name of this -control class which can be used as the title of a tab page within a -control panel. - - The flags field of &v4l2-queryctrl; also contains hints on -the behavior of the control. See the &VIDIOC-QUERYCTRL; documentation -for more details. -
- -
- MPEG Control Reference - - Below all controls within the MPEG control class are -described. First the generic controls, then controls specific for -certain hardware. - -
- Generic MPEG Controls - - - MPEG Control IDs - - - - - - - - - - ID - Type - Description - - - - - - V4L2_CID_MPEG_CLASS  - class - The MPEG class -descriptor. Calling &VIDIOC-QUERYCTRL; for this control will return a -description of this control class. This description can be used as the -caption of a Tab page in a GUI, for example. - - - - V4L2_CID_MPEG_STREAM_TYPE  - enum v4l2_mpeg_stream_type - The MPEG-1, -2 or -4 -output stream type. One cannot assume anything here. Each hardware -MPEG encoder tends to support different subsets of the available MPEG -stream types. The currently defined stream types are: - - - - - - V4L2_MPEG_STREAM_TYPE_MPEG2_PS  - MPEG-2 program stream - - - V4L2_MPEG_STREAM_TYPE_MPEG2_TS  - MPEG-2 transport stream - - - V4L2_MPEG_STREAM_TYPE_MPEG1_SS  - MPEG-1 system stream - - - V4L2_MPEG_STREAM_TYPE_MPEG2_DVD  - MPEG-2 DVD-compatible stream - - - V4L2_MPEG_STREAM_TYPE_MPEG1_VCD  - MPEG-1 VCD-compatible stream - - - V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD  - MPEG-2 SVCD-compatible stream - - - - - - - V4L2_CID_MPEG_STREAM_PID_PMT  - integer - Program Map Table -Packet ID for the MPEG transport stream (default 16) - - - - V4L2_CID_MPEG_STREAM_PID_AUDIO  - integer - Audio Packet ID for -the MPEG transport stream (default 256) - - - - V4L2_CID_MPEG_STREAM_PID_VIDEO  - integer - Video Packet ID for -the MPEG transport stream (default 260) - - - - V4L2_CID_MPEG_STREAM_PID_PCR  - integer - Packet ID for the -MPEG transport stream carrying PCR fields (default 259) - - - - V4L2_CID_MPEG_STREAM_PES_ID_AUDIO  - integer - Audio ID for MPEG -PES - - - - V4L2_CID_MPEG_STREAM_PES_ID_VIDEO  - integer - Video ID for MPEG -PES - - - - V4L2_CID_MPEG_STREAM_VBI_FMT  - enum v4l2_mpeg_stream_vbi_fmt - Some cards can embed -VBI data (⪚ Closed Caption, Teletext) into the MPEG stream. This -control selects whether VBI data should be embedded, and if so, what -embedding method should be used. The list of possible VBI formats -depends on the driver. The currently defined VBI format types -are: - - - - - - V4L2_MPEG_STREAM_VBI_FMT_NONE  - No VBI in the MPEG stream - - - V4L2_MPEG_STREAM_VBI_FMT_IVTV  - VBI in private packets, IVTV format (documented -in the kernel sources in the file Documentation/video4linux/cx2341x/README.vbi) - - - - - - - V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ  - enum v4l2_mpeg_audio_sampling_freq - MPEG Audio sampling -frequency. Possible values are: - - - - - - V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100  - 44.1 kHz - - - V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000  - 48 kHz - - - V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000  - 32 kHz - - - - - - - V4L2_CID_MPEG_AUDIO_ENCODING  - enum v4l2_mpeg_audio_encoding - MPEG Audio encoding. -Possible values are: - - - - - - V4L2_MPEG_AUDIO_ENCODING_LAYER_1  - MPEG-1/2 Layer I encoding - - - V4L2_MPEG_AUDIO_ENCODING_LAYER_2  - MPEG-1/2 Layer II encoding - - - V4L2_MPEG_AUDIO_ENCODING_LAYER_3  - MPEG-1/2 Layer III encoding - - - V4L2_MPEG_AUDIO_ENCODING_AAC  - MPEG-2/4 AAC (Advanced Audio Coding) - - - V4L2_MPEG_AUDIO_ENCODING_AC3  - AC-3 aka ATSC A/52 encoding - - - - - - - V4L2_CID_MPEG_AUDIO_L1_BITRATE  - enum v4l2_mpeg_audio_l1_bitrate - MPEG-1/2 Layer I bitrate. -Possible values are: - - - - - - V4L2_MPEG_AUDIO_L1_BITRATE_32K  - 32 kbit/s - - V4L2_MPEG_AUDIO_L1_BITRATE_64K  - 64 kbit/s - - - V4L2_MPEG_AUDIO_L1_BITRATE_96K  - 96 kbit/s - - - V4L2_MPEG_AUDIO_L1_BITRATE_128K  - 128 kbit/s - - - V4L2_MPEG_AUDIO_L1_BITRATE_160K  - 160 kbit/s - - - V4L2_MPEG_AUDIO_L1_BITRATE_192K  - 192 kbit/s - - - V4L2_MPEG_AUDIO_L1_BITRATE_224K  - 224 kbit/s - - - V4L2_MPEG_AUDIO_L1_BITRATE_256K  - 256 kbit/s - - - V4L2_MPEG_AUDIO_L1_BITRATE_288K  - 288 kbit/s - - - V4L2_MPEG_AUDIO_L1_BITRATE_320K  - 320 kbit/s - - - V4L2_MPEG_AUDIO_L1_BITRATE_352K  - 352 kbit/s - - - V4L2_MPEG_AUDIO_L1_BITRATE_384K  - 384 kbit/s - - - V4L2_MPEG_AUDIO_L1_BITRATE_416K  - 416 kbit/s - - - V4L2_MPEG_AUDIO_L1_BITRATE_448K  - 448 kbit/s - - - - - - - V4L2_CID_MPEG_AUDIO_L2_BITRATE  - enum v4l2_mpeg_audio_l2_bitrate - MPEG-1/2 Layer II bitrate. -Possible values are: - - - - - - V4L2_MPEG_AUDIO_L2_BITRATE_32K  - 32 kbit/s - - - V4L2_MPEG_AUDIO_L2_BITRATE_48K  - 48 kbit/s - - - V4L2_MPEG_AUDIO_L2_BITRATE_56K  - 56 kbit/s - - - V4L2_MPEG_AUDIO_L2_BITRATE_64K  - 64 kbit/s - - - V4L2_MPEG_AUDIO_L2_BITRATE_80K  - 80 kbit/s - - - V4L2_MPEG_AUDIO_L2_BITRATE_96K  - 96 kbit/s - - - V4L2_MPEG_AUDIO_L2_BITRATE_112K  - 112 kbit/s - - - V4L2_MPEG_AUDIO_L2_BITRATE_128K  - 128 kbit/s - - - V4L2_MPEG_AUDIO_L2_BITRATE_160K  - 160 kbit/s - - - V4L2_MPEG_AUDIO_L2_BITRATE_192K  - 192 kbit/s - - - V4L2_MPEG_AUDIO_L2_BITRATE_224K  - 224 kbit/s - - - V4L2_MPEG_AUDIO_L2_BITRATE_256K  - 256 kbit/s - - - V4L2_MPEG_AUDIO_L2_BITRATE_320K  - 320 kbit/s - - - V4L2_MPEG_AUDIO_L2_BITRATE_384K  - 384 kbit/s - - - - - - - V4L2_CID_MPEG_AUDIO_L3_BITRATE  - enum v4l2_mpeg_audio_l3_bitrate - MPEG-1/2 Layer III bitrate. -Possible values are: - - - - - - V4L2_MPEG_AUDIO_L3_BITRATE_32K  - 32 kbit/s - - - V4L2_MPEG_AUDIO_L3_BITRATE_40K  - 40 kbit/s - - - V4L2_MPEG_AUDIO_L3_BITRATE_48K  - 48 kbit/s - - - V4L2_MPEG_AUDIO_L3_BITRATE_56K  - 56 kbit/s - - - V4L2_MPEG_AUDIO_L3_BITRATE_64K  - 64 kbit/s - - - V4L2_MPEG_AUDIO_L3_BITRATE_80K  - 80 kbit/s - - - V4L2_MPEG_AUDIO_L3_BITRATE_96K  - 96 kbit/s - - - V4L2_MPEG_AUDIO_L3_BITRATE_112K  - 112 kbit/s - - - V4L2_MPEG_AUDIO_L3_BITRATE_128K  - 128 kbit/s - - - V4L2_MPEG_AUDIO_L3_BITRATE_160K  - 160 kbit/s - - - V4L2_MPEG_AUDIO_L3_BITRATE_192K  - 192 kbit/s - - - V4L2_MPEG_AUDIO_L3_BITRATE_224K  - 224 kbit/s - - - V4L2_MPEG_AUDIO_L3_BITRATE_256K  - 256 kbit/s - - - V4L2_MPEG_AUDIO_L3_BITRATE_320K  - 320 kbit/s - - - - - - - V4L2_CID_MPEG_AUDIO_AAC_BITRATE  - integer - AAC bitrate in bits per second. - - - - V4L2_CID_MPEG_AUDIO_AC3_BITRATE  - enum v4l2_mpeg_audio_ac3_bitrate - AC-3 bitrate. -Possible values are: - - - - - - V4L2_MPEG_AUDIO_AC3_BITRATE_32K  - 32 kbit/s - - - V4L2_MPEG_AUDIO_AC3_BITRATE_40K  - 40 kbit/s - - - V4L2_MPEG_AUDIO_AC3_BITRATE_48K  - 48 kbit/s - - - V4L2_MPEG_AUDIO_AC3_BITRATE_56K  - 56 kbit/s - - - V4L2_MPEG_AUDIO_AC3_BITRATE_64K  - 64 kbit/s - - - V4L2_MPEG_AUDIO_AC3_BITRATE_80K  - 80 kbit/s - - - V4L2_MPEG_AUDIO_AC3_BITRATE_96K  - 96 kbit/s - - - V4L2_MPEG_AUDIO_AC3_BITRATE_112K  - 112 kbit/s - - - V4L2_MPEG_AUDIO_AC3_BITRATE_128K  - 128 kbit/s - - - V4L2_MPEG_AUDIO_AC3_BITRATE_160K  - 160 kbit/s - - - V4L2_MPEG_AUDIO_AC3_BITRATE_192K  - 192 kbit/s - - - V4L2_MPEG_AUDIO_AC3_BITRATE_224K  - 224 kbit/s - - - V4L2_MPEG_AUDIO_AC3_BITRATE_256K  - 256 kbit/s - - - V4L2_MPEG_AUDIO_AC3_BITRATE_320K  - 320 kbit/s - - - V4L2_MPEG_AUDIO_AC3_BITRATE_384K  - 384 kbit/s - - - V4L2_MPEG_AUDIO_AC3_BITRATE_448K  - 448 kbit/s - - - V4L2_MPEG_AUDIO_AC3_BITRATE_512K  - 512 kbit/s - - - V4L2_MPEG_AUDIO_AC3_BITRATE_576K  - 576 kbit/s - - - V4L2_MPEG_AUDIO_AC3_BITRATE_640K  - 640 kbit/s - - - - - - - V4L2_CID_MPEG_AUDIO_MODE  - enum v4l2_mpeg_audio_mode - MPEG Audio mode. -Possible values are: - - - - - - V4L2_MPEG_AUDIO_MODE_STEREO  - Stereo - - - V4L2_MPEG_AUDIO_MODE_JOINT_STEREO  - Joint Stereo - - - V4L2_MPEG_AUDIO_MODE_DUAL  - Bilingual - - - V4L2_MPEG_AUDIO_MODE_MONO  - Mono - - - - - - - V4L2_CID_MPEG_AUDIO_MODE_EXTENSION  - enum v4l2_mpeg_audio_mode_extension - Joint Stereo -audio mode extension. In Layer I and II they indicate which subbands -are in intensity stereo. All other subbands are coded in stereo. Layer -III is not (yet) supported. Possible values -are: - - - - - - V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4  - Subbands 4-31 in intensity stereo - - - V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8  - Subbands 8-31 in intensity stereo - - - V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12  - Subbands 12-31 in intensity stereo - - - V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16  - Subbands 16-31 in intensity stereo - - - - - - - V4L2_CID_MPEG_AUDIO_EMPHASIS  - enum v4l2_mpeg_audio_emphasis - Audio Emphasis. -Possible values are: - - - - - - V4L2_MPEG_AUDIO_EMPHASIS_NONE  - None - - - V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS  - 50/15 microsecond emphasis - - - V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17  - CCITT J.17 - - - - - - - V4L2_CID_MPEG_AUDIO_CRC  - enum v4l2_mpeg_audio_crc - CRC method. Possible -values are: - - - - - - V4L2_MPEG_AUDIO_CRC_NONE  - None - - - V4L2_MPEG_AUDIO_CRC_CRC16  - 16 bit parity check - - - - - - - V4L2_CID_MPEG_AUDIO_MUTE  - boolean - Mutes the audio when -capturing. This is not done by muting audio hardware, which can still -produce a slight hiss, but in the encoder itself, guaranteeing a fixed -and reproducible audio bitstream. 0 = unmuted, 1 = muted. - - - - V4L2_CID_MPEG_VIDEO_ENCODING  - enum v4l2_mpeg_video_encoding - MPEG Video encoding -method. Possible values are: - - - - - - V4L2_MPEG_VIDEO_ENCODING_MPEG_1  - MPEG-1 Video encoding - - - V4L2_MPEG_VIDEO_ENCODING_MPEG_2  - MPEG-2 Video encoding - - - V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC  - MPEG-4 AVC (H.264) Video encoding - - - - - - - V4L2_CID_MPEG_VIDEO_ASPECT  - enum v4l2_mpeg_video_aspect - Video aspect. -Possible values are: - - - - - - V4L2_MPEG_VIDEO_ASPECT_1x1  - - - V4L2_MPEG_VIDEO_ASPECT_4x3  - - - V4L2_MPEG_VIDEO_ASPECT_16x9  - - - V4L2_MPEG_VIDEO_ASPECT_221x100  - - - - - - - V4L2_CID_MPEG_VIDEO_B_FRAMES  - integer - Number of B-Frames -(default 2) - - - - V4L2_CID_MPEG_VIDEO_GOP_SIZE  - integer - GOP size (default -12) - - - - V4L2_CID_MPEG_VIDEO_GOP_CLOSURE  - boolean - GOP closure (default -1) - - - - V4L2_CID_MPEG_VIDEO_PULLDOWN  - boolean - Enable 3:2 pulldown -(default 0) - - - - V4L2_CID_MPEG_VIDEO_BITRATE_MODE  - enum v4l2_mpeg_video_bitrate_mode - Video bitrate mode. -Possible values are: - - - - - - V4L2_MPEG_VIDEO_BITRATE_MODE_VBR  - Variable bitrate - - - V4L2_MPEG_VIDEO_BITRATE_MODE_CBR  - Constant bitrate - - - - - - - V4L2_CID_MPEG_VIDEO_BITRATE  - integer - Video bitrate in bits -per second. - - - - V4L2_CID_MPEG_VIDEO_BITRATE_PEAK  - integer - Peak video bitrate in -bits per second. Must be larger or equal to the average video bitrate. -It is ignored if the video bitrate mode is set to constant -bitrate. - - - - V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION  - integer - For every captured -frame, skip this many subsequent frames (default 0). - - - - V4L2_CID_MPEG_VIDEO_MUTE  - boolean - - "Mutes" the video to a -fixed color when capturing. This is useful for testing, to produce a -fixed video bitstream. 0 = unmuted, 1 = muted. - - - - V4L2_CID_MPEG_VIDEO_MUTE_YUV  - integer - Sets the "mute" color -of the video. The supplied 32-bit integer is interpreted as follows (bit -0 = least significant bit): - - - - - - Bit 0:7 - V chrominance information - - - Bit 8:15 - U chrominance information - - - Bit 16:23 - Y luminance information - - - Bit 24:31 - Must be zero. - - - - - - -
-
- -
- CX2341x MPEG Controls - - The following MPEG class controls deal with MPEG -encoding settings that are specific to the Conexant CX23415 and -CX23416 MPEG encoding chips. - - - CX2341x Control IDs - - - - - - - - - - ID - Type - Description - - - - - - V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE  - enum v4l2_mpeg_cx2341x_video_spatial_filter_mode - Sets the Spatial -Filter mode (default MANUAL). Possible values -are: - - - - - - V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL  - Choose the filter manually - - - V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO  - Choose the filter automatically - - - - - - - V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER  - integer (0-15) - The setting for the -Spatial Filter. 0 = off, 15 = maximum. (Default is 0.) - - - - V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE  - enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type - Select the algorithm -to use for the Luma Spatial Filter (default -1D_HOR). Possible values: - - - - - - V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF  - No filter - - - V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR  - One-dimensional horizontal - - - V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT  - One-dimensional vertical - - - V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE  - Two-dimensional separable - - - V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE  - Two-dimensional symmetrical -non-separable - - - - - - - V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE  - enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type - Select the algorithm -for the Chroma Spatial Filter (default 1D_HOR). -Possible values are: - - - - - - V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF  - No filter - - - V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR  - One-dimensional horizontal - - - - - - - V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE  - enum v4l2_mpeg_cx2341x_video_temporal_filter_mode - Sets the Temporal -Filter mode (default MANUAL). Possible values -are: - - - - - - V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL  - Choose the filter manually - - - V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO  - Choose the filter automatically - - - - - - - V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER  - integer (0-31) - The setting for the -Temporal Filter. 0 = off, 31 = maximum. (Default is 8 for full-scale -capturing and 0 for scaled capturing.) - - - - V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE  - enum v4l2_mpeg_cx2341x_video_median_filter_type - Median Filter Type -(default OFF). Possible values are: - - - - - - V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF  - No filter - - - V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR  - Horizontal filter - - - V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT  - Vertical filter - - - V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT  - Horizontal and vertical filter - - - V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG  - Diagonal filter - - - - - - - V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM  - integer (0-255) - Threshold above which -the luminance median filter is enabled (default 0) - - - - V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP  - integer (0-255) - Threshold below which -the luminance median filter is enabled (default 255) - - - - V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM  - integer (0-255) - Threshold above which -the chroma median filter is enabled (default 0) - - - - V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP  - integer (0-255) - Threshold below which -the chroma median filter is enabled (default 255) - - - - V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS  - boolean - - The CX2341X MPEG encoder -can insert one empty MPEG-2 PES packet into the stream between every -four video frames. The packet size is 2048 bytes, including the -packet_start_code_prefix and stream_id fields. The stream_id is 0xBF -(private stream 2). The payload consists of 0x00 bytes, to be filled -in by the application. 0 = do not insert, 1 = insert packets. - - - -
-
-
- -
- Camera Control Reference - - The Camera class includes controls for mechanical (or -equivalent digital) features of a device such as controllable lenses -or sensors. - - - Camera Control IDs - - - - - - - - - - ID - Type - Description - - - - - - V4L2_CID_CAMERA_CLASS  - class - The Camera class -descriptor. Calling &VIDIOC-QUERYCTRL; for this control will return a -description of this control class. - - - - - V4L2_CID_EXPOSURE_AUTO  - enum v4l2_exposure_auto_type - Enables automatic -adjustments of the exposure time and/or iris aperture. The effect of -manual changes of the exposure time or iris aperture while these -features are enabled is undefined, drivers should ignore such -requests. Possible values are: - - - - - - V4L2_EXPOSURE_AUTO  - Automatic exposure time, automatic iris -aperture. - - - V4L2_EXPOSURE_MANUAL  - Manual exposure time, manual iris. - - - V4L2_EXPOSURE_SHUTTER_PRIORITY  - Manual exposure time, auto iris. - - - V4L2_EXPOSURE_APERTURE_PRIORITY  - Auto exposure time, manual iris. - - - - - - - - V4L2_CID_EXPOSURE_ABSOLUTE  - integer - Determines the exposure -time of the camera sensor. The exposure time is limited by the frame -interval. Drivers should interpret the values as 100 µs units, -where the value 1 stands for 1/10000th of a second, 10000 for 1 second -and 100000 for 10 seconds. - - - - - V4L2_CID_EXPOSURE_AUTO_PRIORITY  - boolean - When -V4L2_CID_EXPOSURE_AUTO is set to -AUTO or APERTURE_PRIORITY, -this control determines if the device may dynamically vary the frame -rate. By default this feature is disabled (0) and the frame rate must -remain constant. - - - - - V4L2_CID_PAN_RELATIVE  - integer - This control turns the -camera horizontally by the specified amount. The unit is undefined. A -positive value moves the camera to the right (clockwise when viewed -from above), a negative value to the left. A value of zero does not -cause motion. This is a write-only control. - - - - - V4L2_CID_TILT_RELATIVE  - integer - This control turns the -camera vertically by the specified amount. The unit is undefined. A -positive value moves the camera up, a negative value down. A value of -zero does not cause motion. This is a write-only control. - - - - - V4L2_CID_PAN_RESET  - button - When this control is set, -the camera moves horizontally to the default position. - - - - - V4L2_CID_TILT_RESET  - button - When this control is set, -the camera moves vertically to the default position. - - - - - V4L2_CID_PAN_ABSOLUTE  - integer - This control -turns the camera horizontally to the specified position. Positive -values move the camera to the right (clockwise when viewed from above), -negative values to the left. Drivers should interpret the values as arc -seconds, with valid values between -180 * 3600 and +180 * 3600 -inclusive. - - - - - V4L2_CID_TILT_ABSOLUTE  - integer - This control -turns the camera vertically to the specified position. Positive values -move the camera up, negative values down. Drivers should interpret the -values as arc seconds, with valid values between -180 * 3600 and +180 -* 3600 inclusive. - - - - - V4L2_CID_FOCUS_ABSOLUTE  - integer - This control sets the -focal point of the camera to the specified position. The unit is -undefined. Positive values set the focus closer to the camera, -negative values towards infinity. - - - - - V4L2_CID_FOCUS_RELATIVE  - integer - This control moves the -focal point of the camera by the specified amount. The unit is -undefined. Positive values move the focus closer to the camera, -negative values towards infinity. This is a write-only control. - - - - - V4L2_CID_FOCUS_AUTO  - boolean - Enables automatic focus -adjustments. The effect of manual focus adjustments while this feature -is enabled is undefined, drivers should ignore such requests. - - - - - V4L2_CID_ZOOM_ABSOLUTE  - integer - Specify the objective lens -focal length as an absolute value. The zoom unit is driver-specific and its -value should be a positive integer. - - - - - V4L2_CID_ZOOM_RELATIVE  - integer - Specify the objective lens -focal length relatively to the current value. Positive values move the zoom -lens group towards the telephoto direction, negative values towards the -wide-angle direction. The zoom unit is driver-specific. This is a write-only control. - - - - - V4L2_CID_ZOOM_CONTINUOUS  - integer - Move the objective lens group -at the specified speed until it reaches physical device limits or until an -explicit request to stop the movement. A positive value moves the zoom lens -group towards the telephoto direction. A value of zero stops the zoom lens -group movement. A negative value moves the zoom lens group towards the -wide-angle direction. The zoom speed unit is driver-specific. - - - - - V4L2_CID_IRIS_ABSOLUTE  - integer - This control sets the -camera's aperture to the specified value. The unit is undefined. -Larger values open the iris wider, smaller values close it. - - - - - V4L2_CID_IRIS_RELATIVE  - integer - This control modifies the -camera's aperture by the specified amount. The unit is undefined. -Positive values open the iris one step further, negative values close -it one step further. This is a write-only control. - - - - - V4L2_CID_PRIVACY  - boolean - Prevent video from being acquired -by the camera. When this control is set to TRUE (1), no -image can be captured by the camera. Common means to enforce privacy are -mechanical obturation of the sensor and firmware image processing, but the -device is not restricted to these methods. Devices that implement the privacy -control must support read access and may support write access. - - - - V4L2_CID_BAND_STOP_FILTER  - integer - Switch the band-stop filter of a -camera sensor on or off, or specify its strength. Such band-stop filters can -be used, for example, to filter out the fluorescent light component. - - - - -
-
- -
- FM Transmitter Control Reference - - The FM Transmitter (FM_TX) class includes controls for common features of -FM transmissions capable devices. Currently this class includes parameters for audio -compression, pilot tone generation, audio deviation limiter, RDS transmission and -tuning power features. - - - FM_TX Control IDs - - - - - - - - - - - ID - Type - Description - - - - - - V4L2_CID_FM_TX_CLASS  - class - The FM_TX class -descriptor. Calling &VIDIOC-QUERYCTRL; for this control will return a -description of this control class. - - - V4L2_CID_RDS_TX_DEVIATION  - integer - - Configures RDS signal frequency deviation level in Hz. -The range and step are driver-specific. - - - V4L2_CID_RDS_TX_PI  - integer - - Sets the RDS Programme Identification field -for transmission. - - - V4L2_CID_RDS_TX_PTY  - integer - - Sets the RDS Programme Type field for transmission. -This encodes up to 31 pre-defined programme types. - - - V4L2_CID_RDS_TX_PS_NAME  - string - - Sets the Programme Service name (PS_NAME) for transmission. -It is intended for static display on a receiver. It is the primary aid to listeners in programme service -identification and selection. In Annex E of , the RDS specification, -there is a full description of the correct character encoding for Programme Service name strings. -Also from RDS specification, PS is usually a single eight character text. However, it is also possible -to find receivers which can scroll strings sized as 8 x N characters. So, this control must be configured -with steps of 8 characters. The result is it must always contain a string with size multiple of 8. - - - V4L2_CID_RDS_TX_RADIO_TEXT  - string - - Sets the Radio Text info for transmission. It is a textual description of -what is being broadcasted. RDS Radio Text can be applied when broadcaster wishes to transmit longer PS names, -programme-related information or any other text. In these cases, RadioText should be used in addition to -V4L2_CID_RDS_TX_PS_NAME. The encoding for Radio Text strings is also fully described -in Annex E of . The length of Radio Text strings depends on which RDS Block is being -used to transmit it, either 32 (2A block) or 64 (2B block). However, it is also possible -to find receivers which can scroll strings sized as 32 x N or 64 x N characters. So, this control must be configured -with steps of 32 or 64 characters. The result is it must always contain a string with size multiple of 32 or 64. - - - V4L2_CID_AUDIO_LIMITER_ENABLED  - boolean - - Enables or disables the audio deviation limiter feature. -The limiter is useful when trying to maximize the audio volume, minimize receiver-generated -distortion and prevent overmodulation. - - - - V4L2_CID_AUDIO_LIMITER_RELEASE_TIME  - integer - - Sets the audio deviation limiter feature release time. -Unit is in useconds. Step and range are driver-specific. - - - V4L2_CID_AUDIO_LIMITER_DEVIATION  - integer - - Configures audio frequency deviation level in Hz. -The range and step are driver-specific. - - - V4L2_CID_AUDIO_COMPRESSION_ENABLED  - boolean - - Enables or disables the audio compression feature. -This feature amplifies signals below the threshold by a fixed gain and compresses audio -signals above the threshold by the ratio of Threshold/(Gain + Threshold). - - - V4L2_CID_AUDIO_COMPRESSION_GAIN  - integer - - Sets the gain for audio compression feature. It is -a dB value. The range and step are driver-specific. - - - V4L2_CID_AUDIO_COMPRESSION_THRESHOLD  - integer - - Sets the threshold level for audio compression freature. -It is a dB value. The range and step are driver-specific. - - - V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME  - integer - - Sets the attack time for audio compression feature. -It is a useconds value. The range and step are driver-specific. - - - V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME  - integer - - Sets the release time for audio compression feature. -It is a useconds value. The range and step are driver-specific. - - - V4L2_CID_PILOT_TONE_ENABLED  - boolean - - Enables or disables the pilot tone generation feature. - - - V4L2_CID_PILOT_TONE_DEVIATION  - integer - - Configures pilot tone frequency deviation level. Unit is -in Hz. The range and step are driver-specific. - - - V4L2_CID_PILOT_TONE_FREQUENCY  - integer - - Configures pilot tone frequency value. Unit is -in Hz. The range and step are driver-specific. - - - V4L2_CID_TUNE_PREEMPHASIS  - integer - - Configures the pre-emphasis value for broadcasting. -A pre-emphasis filter is applied to the broadcast to accentuate the high audio frequencies. -Depending on the region, a time constant of either 50 or 75 useconds is used. The enum v4l2_preemphasis -defines possible values for pre-emphasis. Here they are: - - - - - V4L2_PREEMPHASIS_DISABLED  - No pre-emphasis is applied. - - - V4L2_PREEMPHASIS_50_uS  - A pre-emphasis of 50 uS is used. - - - V4L2_PREEMPHASIS_75_uS  - A pre-emphasis of 75 uS is used. - - - - - - - V4L2_CID_TUNE_POWER_LEVEL  - integer - - Sets the output power level for signal transmission. -Unit is in dBuV. Range and step are driver-specific. - - - V4L2_CID_TUNE_ANTENNA_CAPACITOR  - integer - - This selects the value of antenna tuning capacitor -manually or automatically if set to zero. Unit, range and step are driver-specific. - - - - -
- -For more details about RDS specification, refer to - document, from CENELEC. -
-
- - diff --git a/Documentation/DocBook/v4l/crop.gif b/Documentation/DocBook/v4l/crop.gif deleted file mode 100644 index 3b9e7d836d4b..000000000000 Binary files a/Documentation/DocBook/v4l/crop.gif and /dev/null differ diff --git a/Documentation/DocBook/v4l/crop.pdf b/Documentation/DocBook/v4l/crop.pdf deleted file mode 100644 index c9fb81cd32f3..000000000000 Binary files a/Documentation/DocBook/v4l/crop.pdf and /dev/null differ diff --git a/Documentation/DocBook/v4l/dev-capture.xml b/Documentation/DocBook/v4l/dev-capture.xml deleted file mode 100644 index 2237c661f26a..000000000000 --- a/Documentation/DocBook/v4l/dev-capture.xml +++ /dev/null @@ -1,118 +0,0 @@ - Video Capture Interface - - Video capture devices sample an analog video signal and store -the digitized images in memory. Today nearly all devices can capture -at full 25 or 30 frames/second. With this interface applications can -control the capture process and move images from the driver into user -space. - - Conventionally V4L2 video capture devices are accessed through -character device special files named /dev/video -and /dev/video0 to -/dev/video63 with major number 81 and minor -numbers 0 to 63. /dev/video is typically a -symbolic link to the preferred video device. Note the same device -files are used for video output devices. - -
- Querying Capabilities - - Devices supporting the video capture interface set the -V4L2_CAP_VIDEO_CAPTURE or -V4L2_CAP_VIDEO_CAPTURE_MPLANE flag in the -capabilities field of &v4l2-capability; -returned by the &VIDIOC-QUERYCAP; ioctl. As secondary device functions -they may also support the video overlay -(V4L2_CAP_VIDEO_OVERLAY) and the raw VBI capture -(V4L2_CAP_VBI_CAPTURE) interface. At least one of -the read/write or streaming I/O methods must be supported. Tuners and -audio inputs are optional. -
- -
- Supplemental Functions - - Video capture devices shall support audio input, tuner, controls, -cropping and scaling and streaming parameter ioctls as needed. -The video input and video standard ioctls must be supported by -all video capture devices. -
- -
- Image Format Negotiation - - The result of a capture operation is determined by -cropping and image format parameters. The former select an area of the -video picture to capture, the latter how images are stored in memory, -&ie; in RGB or YUV format, the number of bits per pixel or width and -height. Together they also define how images are scaled in the -process. - - As usual these parameters are not reset -at &func-open; time to permit Unix tool chains, programming a device -and then reading from it as if it was a plain file. Well written V4L2 -applications ensure they really get what they want, including cropping -and scaling. - - Cropping initialization at minimum requires to reset the -parameters to defaults. An example is given in . - - To query the current image format applications set the -type field of a &v4l2-format; to -V4L2_BUF_TYPE_VIDEO_CAPTURE or -V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE and call the -&VIDIOC-G-FMT; ioctl with a pointer to this structure. Drivers fill -the &v4l2-pix-format; pix or the -&v4l2-pix-format-mplane; pix_mp member of the -fmt union. - - To request different parameters applications set the -type field of a &v4l2-format; as above and -initialize all fields of the &v4l2-pix-format; -vbi member of the -fmt union, or better just modify the -results of VIDIOC_G_FMT, and call the -&VIDIOC-S-FMT; ioctl with a pointer to this structure. Drivers may -adjust the parameters and finally return the actual parameters as -VIDIOC_G_FMT does. - - Like VIDIOC_S_FMT the -&VIDIOC-TRY-FMT; ioctl can be used to learn about hardware limitations -without disabling I/O or possibly time consuming hardware -preparations. - - The contents of &v4l2-pix-format; and &v4l2-pix-format-mplane; -are discussed in . See also the specification of the -VIDIOC_G_FMT, VIDIOC_S_FMT -and VIDIOC_TRY_FMT ioctls for details. Video -capture devices must implement both the -VIDIOC_G_FMT and -VIDIOC_S_FMT ioctl, even if -VIDIOC_S_FMT ignores all requests and always -returns default parameters as VIDIOC_G_FMT does. -VIDIOC_TRY_FMT is optional. -
- -
- Reading Images - - A video capture device may support the read() function and/or streaming (memory mapping or user pointer) I/O. See for details. -
- - diff --git a/Documentation/DocBook/v4l/dev-codec.xml b/Documentation/DocBook/v4l/dev-codec.xml deleted file mode 100644 index 6e156dc45b94..000000000000 --- a/Documentation/DocBook/v4l/dev-codec.xml +++ /dev/null @@ -1,26 +0,0 @@ - Codec Interface - - - Suspended - - This interface has been be suspended from the V4L2 API -implemented in Linux 2.6 until we have more experience with codec -device interfaces. - - - A V4L2 codec can compress, decompress, transform, or otherwise -convert video data from one format into another format, in memory. -Applications send data to be converted to the driver through a -&func-write; call, and receive the converted data through a -&func-read; call. For efficiency a driver may also support streaming -I/O. - - [to do] - - diff --git a/Documentation/DocBook/v4l/dev-effect.xml b/Documentation/DocBook/v4l/dev-effect.xml deleted file mode 100644 index 9c243beba0e6..000000000000 --- a/Documentation/DocBook/v4l/dev-effect.xml +++ /dev/null @@ -1,25 +0,0 @@ - Effect Devices Interface - - - Suspended - - This interface has been be suspended from the V4L2 API -implemented in Linux 2.6 until we have more experience with effect -device interfaces. - - - A V4L2 video effect device can do image effects, filtering, or -combine two or more images or image streams. For example video -transitions or wipes. Applications send data to be processed and -receive the result data either with &func-read; and &func-write; -functions, or through the streaming I/O mechanism. - - [to do] - - diff --git a/Documentation/DocBook/v4l/dev-event.xml b/Documentation/DocBook/v4l/dev-event.xml deleted file mode 100644 index be5a98fb4fab..000000000000 --- a/Documentation/DocBook/v4l/dev-event.xml +++ /dev/null @@ -1,31 +0,0 @@ - Event Interface - - The V4L2 event interface provides means for user to get - immediately notified on certain conditions taking place on a device. - This might include start of frame or loss of signal events, for - example. - - - To receive events, the events the user is interested in first must - be subscribed using the &VIDIOC-SUBSCRIBE-EVENT; ioctl. Once an event is - subscribed, the events of subscribed types are dequeueable using the - &VIDIOC-DQEVENT; ioctl. Events may be unsubscribed using - VIDIOC_UNSUBSCRIBE_EVENT ioctl. The special event type V4L2_EVENT_ALL may - be used to unsubscribe all the events the driver supports. - - The event subscriptions and event queues are specific to file - handles. Subscribing an event on one file handle does not affect - other file handles. - - - The information on dequeueable events is obtained by using select or - poll system calls on video devices. The V4L2 events use POLLPRI events on - poll system call and exceptions on select system call. - - diff --git a/Documentation/DocBook/v4l/dev-osd.xml b/Documentation/DocBook/v4l/dev-osd.xml deleted file mode 100644 index c9a68a2ccd33..000000000000 --- a/Documentation/DocBook/v4l/dev-osd.xml +++ /dev/null @@ -1,164 +0,0 @@ - Video Output Overlay Interface - Also known as On-Screen Display (OSD) - - - Experimental - - This is an experimental -interface and may change in the future. - - - Some video output devices can overlay a framebuffer image onto -the outgoing video signal. Applications can set up such an overlay -using this interface, which borrows structures and ioctls of the Video Overlay interface. - - The OSD function is accessible through the same character -special file as the Video Output function. -Note the default function of such a /dev/video device -is video capturing or output. The OSD function is only available after -calling the &VIDIOC-S-FMT; ioctl. - -
- Querying Capabilities - - Devices supporting the Video Output -Overlay interface set the -V4L2_CAP_VIDEO_OUTPUT_OVERLAY flag in the -capabilities field of &v4l2-capability; -returned by the &VIDIOC-QUERYCAP; ioctl. -
- -
- Framebuffer - - Contrary to the Video Overlay -interface the framebuffer is normally implemented on the TV card and -not the graphics card. On Linux it is accessible as a framebuffer -device (/dev/fbN). Given a V4L2 device, -applications can find the corresponding framebuffer device by calling -the &VIDIOC-G-FBUF; ioctl. It returns, amongst other information, the -physical address of the framebuffer in the -base field of &v4l2-framebuffer;. The -framebuffer device ioctl FBIOGET_FSCREENINFO -returns the same address in the smem_start -field of struct fb_fix_screeninfo. The -FBIOGET_FSCREENINFO ioctl and struct -fb_fix_screeninfo are defined in the -linux/fb.h header file. - - The width and height of the framebuffer depends on the -current video standard. A V4L2 driver may reject attempts to change -the video standard (or any other ioctl which would imply a framebuffer -size change) with an &EBUSY; until all applications closed the -framebuffer device. - - - Finding a framebuffer device for OSD - - -#include <linux/fb.h> - -&v4l2-framebuffer; fbuf; -unsigned int i; -int fb_fd; - -if (-1 == ioctl (fd, VIDIOC_G_FBUF, &fbuf)) { - perror ("VIDIOC_G_FBUF"); - exit (EXIT_FAILURE); -} - -for (i = 0; i > 30; ++i) { - char dev_name[16]; - struct fb_fix_screeninfo si; - - snprintf (dev_name, sizeof (dev_name), "/dev/fb%u", i); - - fb_fd = open (dev_name, O_RDWR); - if (-1 == fb_fd) { - switch (errno) { - case ENOENT: /* no such file */ - case ENXIO: /* no driver */ - continue; - - default: - perror ("open"); - exit (EXIT_FAILURE); - } - } - - if (0 == ioctl (fb_fd, FBIOGET_FSCREENINFO, &si)) { - if (si.smem_start == (unsigned long) fbuf.base) - break; - } else { - /* Apparently not a framebuffer device. */ - } - - close (fb_fd); - fb_fd = -1; -} - -/* fb_fd is the file descriptor of the framebuffer device - for the video output overlay, or -1 if no device was found. */ - - -
- -
- Overlay Window and Scaling - - The overlay is controlled by source and target rectangles. -The source rectangle selects a subsection of the framebuffer image to -be overlaid, the target rectangle an area in the outgoing video signal -where the image will appear. Drivers may or may not support scaling, -and arbitrary sizes and positions of these rectangles. Further drivers -may support any (or none) of the clipping/blending methods defined for -the Video Overlay interface. - - A &v4l2-window; defines the size of the source rectangle, -its position in the framebuffer and the clipping/blending method to be -used for the overlay. To get the current parameters applications set -the type field of a &v4l2-format; to -V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY and call the -&VIDIOC-G-FMT; ioctl. The driver fills the -v4l2_window substructure named -win. It is not possible to retrieve a -previously programmed clipping list or bitmap. - - To program the source rectangle applications set the -type field of a &v4l2-format; to -V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY, initialize -the win substructure and call the -&VIDIOC-S-FMT; ioctl. The driver adjusts the parameters against -hardware limits and returns the actual parameters as -VIDIOC_G_FMT does. Like -VIDIOC_S_FMT, the &VIDIOC-TRY-FMT; ioctl can be -used to learn about driver capabilities without actually changing -driver state. Unlike VIDIOC_S_FMT this also works -after the overlay has been enabled. - - A &v4l2-crop; defines the size and position of the target -rectangle. The scaling factor of the overlay is implied by the width -and height given in &v4l2-window; and &v4l2-crop;. The cropping API -applies to Video Output and Video -Output Overlay devices in the same way as to -Video Capture and Video -Overlay devices, merely reversing the direction of the -data flow. For more information see . -
- -
- Enabling Overlay - - There is no V4L2 ioctl to enable or disable the overlay, -however the framebuffer interface of the driver may support the -FBIOBLANK ioctl. -
- - diff --git a/Documentation/DocBook/v4l/dev-output.xml b/Documentation/DocBook/v4l/dev-output.xml deleted file mode 100644 index 919e22c53854..000000000000 --- a/Documentation/DocBook/v4l/dev-output.xml +++ /dev/null @@ -1,114 +0,0 @@ - Video Output Interface - - Video output devices encode stills or image sequences as -analog video signal. With this interface applications can -control the encoding process and move images from user space to -the driver. - - Conventionally V4L2 video output devices are accessed through -character device special files named /dev/video -and /dev/video0 to -/dev/video63 with major number 81 and minor -numbers 0 to 63. /dev/video is typically a -symbolic link to the preferred video device. Note the same device -files are used for video capture devices. - -
- Querying Capabilities - - Devices supporting the video output interface set the -V4L2_CAP_VIDEO_OUTPUT or -V4L2_CAP_VIDEO_OUTPUT_MPLANE flag in the -capabilities field of &v4l2-capability; -returned by the &VIDIOC-QUERYCAP; ioctl. As secondary device functions -they may also support the raw VBI -output (V4L2_CAP_VBI_OUTPUT) interface. At -least one of the read/write or streaming I/O methods must be -supported. Modulators and audio outputs are optional. -
- -
- Supplemental Functions - - Video output devices shall support audio output, modulator, controls, -cropping and scaling and streaming parameter ioctls as needed. -The video output and video standard ioctls must be supported by -all video output devices. -
- -
- Image Format Negotiation - - The output is determined by cropping and image format -parameters. The former select an area of the video picture where the -image will appear, the latter how images are stored in memory, &ie; in -RGB or YUV format, the number of bits per pixel or width and height. -Together they also define how images are scaled in the process. - - As usual these parameters are not reset -at &func-open; time to permit Unix tool chains, programming a device -and then writing to it as if it was a plain file. Well written V4L2 -applications ensure they really get what they want, including cropping -and scaling. - - Cropping initialization at minimum requires to reset the -parameters to defaults. An example is given in . - - To query the current image format applications set the -type field of a &v4l2-format; to -V4L2_BUF_TYPE_VIDEO_OUTPUT or -V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE and call the -&VIDIOC-G-FMT; ioctl with a pointer to this structure. Drivers fill -the &v4l2-pix-format; pix or the -&v4l2-pix-format-mplane; pix_mp member of the -fmt union. - - To request different parameters applications set the -type field of a &v4l2-format; as above and -initialize all fields of the &v4l2-pix-format; -vbi member of the -fmt union, or better just modify the -results of VIDIOC_G_FMT, and call the -&VIDIOC-S-FMT; ioctl with a pointer to this structure. Drivers may -adjust the parameters and finally return the actual parameters as -VIDIOC_G_FMT does. - - Like VIDIOC_S_FMT the -&VIDIOC-TRY-FMT; ioctl can be used to learn about hardware limitations -without disabling I/O or possibly time consuming hardware -preparations. - - The contents of &v4l2-pix-format; and &v4l2-pix-format-mplane; -are discussed in . See also the specification of the -VIDIOC_G_FMT, VIDIOC_S_FMT -and VIDIOC_TRY_FMT ioctls for details. Video -output devices must implement both the -VIDIOC_G_FMT and -VIDIOC_S_FMT ioctl, even if -VIDIOC_S_FMT ignores all requests and always -returns default parameters as VIDIOC_G_FMT does. -VIDIOC_TRY_FMT is optional. -
- -
- Writing Images - - A video output device may support the write() function and/or streaming (memory mapping or user pointer) I/O. See for details. -
- - diff --git a/Documentation/DocBook/v4l/dev-overlay.xml b/Documentation/DocBook/v4l/dev-overlay.xml deleted file mode 100644 index 92513cf79150..000000000000 --- a/Documentation/DocBook/v4l/dev-overlay.xml +++ /dev/null @@ -1,379 +0,0 @@ - Video Overlay Interface - Also known as Framebuffer Overlay or Previewing - - Video overlay devices have the ability to genlock (TV-)video -into the (VGA-)video signal of a graphics card, or to store captured -images directly in video memory of a graphics card, typically with -clipping. This can be considerable more efficient than capturing -images and displaying them by other means. In the old days when only -nuclear power plants needed cooling towers this used to be the only -way to put live video into a window. - - Video overlay devices are accessed through the same character -special files as video capture devices. -Note the default function of a /dev/video device -is video capturing. The overlay function is only available after -calling the &VIDIOC-S-FMT; ioctl. - - The driver may support simultaneous overlay and capturing -using the read/write and streaming I/O methods. If so, operation at -the nominal frame rate of the video standard is not guaranteed. Frames -may be directed away from overlay to capture, or one field may be used -for overlay and the other for capture if the capture parameters permit -this. - - Applications should use different file descriptors for -capturing and overlay. This must be supported by all drivers capable -of simultaneous capturing and overlay. Optionally these drivers may -also permit capturing and overlay with a single file descriptor for -compatibility with V4L and earlier versions of V4L2. - A common application of two file descriptors is the -XFree86 Xv/V4L interface driver and -a V4L2 application. While the X server controls video overlay, the -application can take advantage of memory mapping and DMA. - In the opinion of the designers of this API, no driver -writer taking the efforts to support simultaneous capturing and -overlay will restrict this ability by requiring a single file -descriptor, as in V4L and earlier versions of V4L2. Making this -optional means applications depending on two file descriptors need -backup routines to be compatible with all drivers, which is -considerable more work than using two fds in applications which do -not. Also two fd's fit the general concept of one file descriptor for -each logical stream. Hence as a complexity trade-off drivers -must support two file descriptors and -may support single fd operation. - - -
- Querying Capabilities - - Devices supporting the video overlay interface set the -V4L2_CAP_VIDEO_OVERLAY flag in the -capabilities field of &v4l2-capability; -returned by the &VIDIOC-QUERYCAP; ioctl. The overlay I/O method specified -below must be supported. Tuners and audio inputs are optional. -
- -
- Supplemental Functions - - Video overlay devices shall support audio input, tuner, controls, -cropping and scaling and streaming parameter ioctls as needed. -The video input and video standard ioctls must be supported by -all video overlay devices. -
- -
- Setup - - Before overlay can commence applications must program the -driver with frame buffer parameters, namely the address and size of -the frame buffer and the image format, for example RGB 5:6:5. The -&VIDIOC-G-FBUF; and &VIDIOC-S-FBUF; ioctls are available to get -and set these parameters, respectively. The -VIDIOC_S_FBUF ioctl is privileged because it -allows to set up DMA into physical memory, bypassing the memory -protection mechanisms of the kernel. Only the superuser can change the -frame buffer address and size. Users are not supposed to run TV -applications as root or with SUID bit set. A small helper application -with suitable privileges should query the graphics system and program -the V4L2 driver at the appropriate time. - - Some devices add the video overlay to the output signal -of the graphics card. In this case the frame buffer is not modified by -the video device, and the frame buffer address and pixel format are -not needed by the driver. The VIDIOC_S_FBUF ioctl -is not privileged. An application can check for this type of device by -calling the VIDIOC_G_FBUF ioctl. - - A driver may support any (or none) of five clipping/blending -methods: - - Chroma-keying displays the overlaid image only where -pixels in the primary graphics surface assume a certain color. - - - A bitmap can be specified where each bit corresponds -to a pixel in the overlaid image. When the bit is set, the -corresponding video pixel is displayed, otherwise a pixel of the -graphics surface. - - - A list of clipping rectangles can be specified. In -these regions no video is displayed, so the -graphics surface can be seen here. - - - The framebuffer has an alpha channel that can be used -to clip or blend the framebuffer with the video. - - - A global alpha value can be specified to blend the -framebuffer contents with video images. - - - - When simultaneous capturing and overlay is supported and -the hardware prohibits different image and frame buffer formats, the -format requested first takes precedence. The attempt to capture -(&VIDIOC-S-FMT;) or overlay (&VIDIOC-S-FBUF;) may fail with an -&EBUSY; or return accordingly modified parameters.. -
- -
- Overlay Window - - The overlaid image is determined by cropping and overlay -window parameters. The former select an area of the video picture to -capture, the latter how images are overlaid and clipped. Cropping -initialization at minimum requires to reset the parameters to -defaults. An example is given in . - - The overlay window is described by a &v4l2-window;. It -defines the size of the image, its position over the graphics surface -and the clipping to be applied. To get the current parameters -applications set the type field of a -&v4l2-format; to V4L2_BUF_TYPE_VIDEO_OVERLAY and -call the &VIDIOC-G-FMT; ioctl. The driver fills the -v4l2_window substructure named -win. It is not possible to retrieve a -previously programmed clipping list or bitmap. - - To program the overlay window applications set the -type field of a &v4l2-format; to -V4L2_BUF_TYPE_VIDEO_OVERLAY, initialize the -win substructure and call the -&VIDIOC-S-FMT; ioctl. The driver adjusts the parameters against -hardware limits and returns the actual parameters as -VIDIOC_G_FMT does. Like -VIDIOC_S_FMT, the &VIDIOC-TRY-FMT; ioctl can be -used to learn about driver capabilities without actually changing -driver state. Unlike VIDIOC_S_FMT this also works -after the overlay has been enabled. - - The scaling factor of the overlaid image is implied by the -width and height given in &v4l2-window; and the size of the cropping -rectangle. For more information see . - - When simultaneous capturing and overlay is supported and -the hardware prohibits different image and window sizes, the size -requested first takes precedence. The attempt to capture or overlay as -well (&VIDIOC-S-FMT;) may fail with an &EBUSY; or return accordingly -modified parameters. - - - struct <structname>v4l2_window</structname> - - &cs-str; - - - &v4l2-rect; - w - Size and position of the window relative to the -top, left corner of the frame buffer defined with &VIDIOC-S-FBUF;. The -window can extend the frame buffer width and height, the -x and y -coordinates can be negative, and it can lie completely outside the -frame buffer. The driver clips the window accordingly, or if that is -not possible, modifies its size and/or position. - - - &v4l2-field; - field - Applications set this field to determine which -video field shall be overlaid, typically one of -V4L2_FIELD_ANY (0), -V4L2_FIELD_TOP, -V4L2_FIELD_BOTTOM or -V4L2_FIELD_INTERLACED. Drivers may have to choose -a different field order and return the actual setting here. - - - __u32 - chromakey - When chroma-keying has been negotiated with -&VIDIOC-S-FBUF; applications set this field to the desired pixel value -for the chroma key. The format is the same as the pixel format of the -framebuffer (&v4l2-framebuffer; -fmt.pixelformat field), with bytes in host -order. E. g. for V4L2_PIX_FMT_BGR24 -the value should be 0xRRGGBB on a little endian, 0xBBGGRR on a big -endian host. - - - &v4l2-clip; * - clips - When chroma-keying has not -been negotiated and &VIDIOC-G-FBUF; indicated this capability, -applications can set this field to point to an array of -clipping rectangles. - - - - - Like the window coordinates -w, clipping rectangles are defined relative -to the top, left corner of the frame buffer. However clipping -rectangles must not extend the frame buffer width and height, and they -must not overlap. If possible applications should merge adjacent -rectangles. Whether this must create x-y or y-x bands, or the order of -rectangles, is not defined. When clip lists are not supported the -driver ignores this field. Its contents after calling &VIDIOC-S-FMT; -are undefined. - - - __u32 - clipcount - When the application set the -clips field, this field must contain the -number of clipping rectangles in the list. When clip lists are not -supported the driver ignores this field, its contents after calling -VIDIOC_S_FMT are undefined. When clip lists are -supported but no clipping is desired this field must be set to -zero. - - - void * - bitmap - When chroma-keying has -not been negotiated and &VIDIOC-G-FBUF; indicated -this capability, applications can set this field to point to a -clipping bit mask. - - - It must be of the same size -as the window, w.width and -w.height. Each bit corresponds to a pixel -in the overlaid image, which is displayed only when the bit is -set. Pixel coordinates translate to bits like: - -((__u8 *) bitmap)[w.width * y + x / 8] & (1 << (x & 7))where 0 ≤ x < -w.width and 0 ≤ -y <w.height. - Should we require - w.width to be a multiple of - eight? - When a clipping -bit mask is not supported the driver ignores this field, its contents -after calling &VIDIOC-S-FMT; are undefined. When a bit mask is supported -but no clipping is desired this field must be set to -NULL.Applications need not create a -clip list or bit mask. When they pass both, or despite negotiating -chroma-keying, the results are undefined. Regardless of the chosen -method, the clipping abilities of the hardware may be limited in -quantity or quality. The results when these limits are exceeded are -undefined. - When the image is written into frame buffer -memory it will be undesirable if the driver clips out less pixels -than expected, because the application and graphics system are not -aware these regions need to be refreshed. The driver should clip out -more pixels or not write the image at all. - - - - __u8 - global_alpha - The global alpha value used to blend the -framebuffer with video images, if global alpha blending has been -negotiated (V4L2_FBUF_FLAG_GLOBAL_ALPHA, see -&VIDIOC-S-FBUF;, ). - - - - - Note this field was added in Linux 2.6.23, extending the structure. However -the VIDIOC_G/S/TRY_FMT ioctls, -which take a pointer to a v4l2_format parent structure with padding -bytes at the end, are not affected. - - - -
- - - struct <structname>v4l2_clip</structname><footnote> - <para>The X Window system defines "regions" which are -vectors of struct BoxRec { short x1, y1, x2, y2; } with width = x2 - -x1 and height = y2 - y1, so one cannot pass X11 clip lists -directly.</para> - </footnote> - - &cs-str; - - - &v4l2-rect; - c - Coordinates of the clipping rectangle, relative to -the top, left corner of the frame buffer. Only window pixels -outside all clipping rectangles are -displayed. - - - &v4l2-clip; * - next - Pointer to the next clipping rectangle, NULL when -this is the last rectangle. Drivers ignore this field, it cannot be -used to pass a linked list of clipping rectangles. - - - -
- - - - - struct <structname>v4l2_rect</structname> - - &cs-str; - - - __s32 - left - Horizontal offset of the top, left corner of the -rectangle, in pixels. - - - __s32 - top - Vertical offset of the top, left corner of the -rectangle, in pixels. Offsets increase to the right and down. - - - __s32 - width - Width of the rectangle, in pixels. - - - __s32 - height - Height of the rectangle, in pixels. Width and -height cannot be negative, the fields are signed for hysterical -reasons. - - - -
-
- -
- Enabling Overlay - - To start or stop the frame buffer overlay applications call -the &VIDIOC-OVERLAY; ioctl. -
- - diff --git a/Documentation/DocBook/v4l/dev-radio.xml b/Documentation/DocBook/v4l/dev-radio.xml deleted file mode 100644 index 73aa90b45b34..000000000000 --- a/Documentation/DocBook/v4l/dev-radio.xml +++ /dev/null @@ -1,57 +0,0 @@ - Radio Interface - - This interface is intended for AM and FM (analog) radio -receivers and transmitters. - - Conventionally V4L2 radio devices are accessed through -character device special files named /dev/radio -and /dev/radio0 to -/dev/radio63 with major number 81 and minor -numbers 64 to 127. - -
- Querying Capabilities - - Devices supporting the radio interface set the -V4L2_CAP_RADIO and -V4L2_CAP_TUNER or -V4L2_CAP_MODULATOR flag in the -capabilities field of &v4l2-capability; -returned by the &VIDIOC-QUERYCAP; ioctl. Other combinations of -capability flags are reserved for future extensions. -
- -
- Supplemental Functions - - Radio devices can support controls, and must support the tuner or modulator ioctls. - - They do not support the video input or output, audio input -or output, video standard, cropping and scaling, compression and -streaming parameter, or overlay ioctls. All other ioctls and I/O -methods are reserved for future extensions. -
- -
- Programming - - Radio devices may have a couple audio controls (as discussed -in ) such as a volume control, possibly custom -controls. Further all radio devices have one tuner or modulator (these are -discussed in ) with index number zero to select -the radio frequency and to determine if a monaural or FM stereo -program is received/emitted. Drivers switch automatically between AM and FM -depending on the selected frequency. The &VIDIOC-G-TUNER; or -&VIDIOC-G-MODULATOR; ioctl -reports the supported frequency range. -
- - diff --git a/Documentation/DocBook/v4l/dev-raw-vbi.xml b/Documentation/DocBook/v4l/dev-raw-vbi.xml deleted file mode 100644 index c5a70bdfaf27..000000000000 --- a/Documentation/DocBook/v4l/dev-raw-vbi.xml +++ /dev/null @@ -1,347 +0,0 @@ - Raw VBI Data Interface - - VBI is an abbreviation of Vertical Blanking Interval, a gap -in the sequence of lines of an analog video signal. During VBI -no picture information is transmitted, allowing some time while the -electron beam of a cathode ray tube TV returns to the top of the -screen. Using an oscilloscope you will find here the vertical -synchronization pulses and short data packages ASK -modulatedASK: Amplitude-Shift Keying. A high signal -level represents a '1' bit, a low level a '0' bit. -onto the video signal. These are transmissions of services such as -Teletext or Closed Caption. - - Subject of this interface type is raw VBI data, as sampled off -a video signal, or to be added to a signal for output. -The data format is similar to uncompressed video images, a number of -lines times a number of samples per line, we call this a VBI image. - - Conventionally V4L2 VBI devices are accessed through character -device special files named /dev/vbi and -/dev/vbi0 to /dev/vbi31 with -major number 81 and minor numbers 224 to 255. -/dev/vbi is typically a symbolic link to the -preferred VBI device. This convention applies to both input and output -devices. - - To address the problems of finding related video and VBI -devices VBI capturing and output is also available as device function -under /dev/video. To capture or output raw VBI -data with these devices applications must call the &VIDIOC-S-FMT; -ioctl. Accessed as /dev/vbi, raw VBI capturing -or output is the default device function. - -
- Querying Capabilities - - Devices supporting the raw VBI capturing or output API set -the V4L2_CAP_VBI_CAPTURE or -V4L2_CAP_VBI_OUTPUT flags, respectively, in the -capabilities field of &v4l2-capability; -returned by the &VIDIOC-QUERYCAP; ioctl. At least one of the -read/write, streaming or asynchronous I/O methods must be -supported. VBI devices may or may not have a tuner or modulator. -
- -
- Supplemental Functions - - VBI devices shall support video -input or output, tuner or -modulator, and controls ioctls -as needed. The video standard ioctls provide -information vital to program a VBI device, therefore must be -supported. -
- -
- Raw VBI Format Negotiation - - Raw VBI sampling abilities can vary, in particular the -sampling frequency. To properly interpret the data V4L2 specifies an -ioctl to query the sampling parameters. Moreover, to allow for some -flexibility applications can also suggest different parameters. - - As usual these parameters are not -reset at &func-open; time to permit Unix tool chains, programming a -device and then reading from it as if it was a plain file. Well -written V4L2 applications should always ensure they really get what -they want, requesting reasonable parameters and then checking if the -actual parameters are suitable. - - To query the current raw VBI capture parameters -applications set the type field of a -&v4l2-format; to V4L2_BUF_TYPE_VBI_CAPTURE or -V4L2_BUF_TYPE_VBI_OUTPUT, and call the -&VIDIOC-G-FMT; ioctl with a pointer to this structure. Drivers fill -the &v4l2-vbi-format; vbi member of the -fmt union. - - To request different parameters applications set the -type field of a &v4l2-format; as above and -initialize all fields of the &v4l2-vbi-format; -vbi member of the -fmt union, or better just modify the -results of VIDIOC_G_FMT, and call the -&VIDIOC-S-FMT; ioctl with a pointer to this structure. Drivers return -an &EINVAL; only when the given parameters are ambiguous, otherwise -they modify the parameters according to the hardware capabilites and -return the actual parameters. When the driver allocates resources at -this point, it may return an &EBUSY; to indicate the returned -parameters are valid but the required resources are currently not -available. That may happen for instance when the video and VBI areas -to capture would overlap, or when the driver supports multiple opens -and another process already requested VBI capturing or output. Anyway, -applications must expect other resource allocation points which may -return EBUSY, at the &VIDIOC-STREAMON; ioctl -and the first read(), write() and select() call. - - VBI devices must implement both the -VIDIOC_G_FMT and -VIDIOC_S_FMT ioctl, even if -VIDIOC_S_FMT ignores all requests and always -returns default parameters as VIDIOC_G_FMT does. -VIDIOC_TRY_FMT is optional. - - - struct <structname>v4l2_vbi_format</structname> - - &cs-str; - - - __u32 - sampling_rate - Samples per second, i. e. unit 1 Hz. - - - __u32 - offset - Horizontal offset of the VBI image, -relative to the leading edge of the line synchronization pulse and -counted in samples: The first sample in the VBI image will be located -offset / -sampling_rate seconds following the leading -edge. See also . - - - __u32 - samples_per_line - - - - __u32 - sample_format - Defines the sample format as in , a four-character-code. - A few devices may be unable to -sample VBI data at all but can extend the video capture window to the -VBI region. - Usually this is -V4L2_PIX_FMT_GREY, i. e. each sample -consists of 8 bits with lower values oriented towards the black level. -Do not assume any other correlation of values with the signal level. -For example, the MSB does not necessarily indicate if the signal is -'high' or 'low' because 128 may not be the mean value of the -signal. Drivers shall not convert the sample format by software. - - - __u32 - start[2] - This is the scanning system line number -associated with the first line of the VBI image, of the first and the -second field respectively. See and - for valid values. VBI input drivers can -return start values 0 if the hardware cannot reliable identify -scanning lines, VBI acquisition may not require this -information. - - - __u32 - count[2] - The number of lines in the first and second -field image, respectively. - - - Drivers should be as -flexibility as possible. For example, it may be possible to extend or -move the VBI capture window down to the picture area, implementing a -'full field mode' to capture data service transmissions embedded in -the picture.An application can set the first or second -count value to zero if no data is required -from the respective field; count[1] if the -scanning system is progressive, &ie; not interlaced. The -corresponding start value shall be ignored by the application and -driver. Anyway, drivers may not support single field capturing and -return both count values non-zero.Both -count values set to zero, or line numbers -outside the bounds depicted in and , or a field image covering -lines of two fields, are invalid and shall not be returned by the -driver.To initialize the start -and count fields, applications must first -determine the current video standard selection. The &v4l2-std-id; or -the framelines field of &v4l2-standard; can -be evaluated for this purpose. - - - __u32 - flags - See below. Currently -only drivers set flags, applications must set this field to -zero. - - - __u32 - reserved[2] - This array is reserved for future extensions. -Drivers and applications must set it to zero. - - - -
- - - Raw VBI Format Flags - - &cs-def; - - - V4L2_VBI_UNSYNC - 0x0001 - This flag indicates hardware which does not -properly distinguish between fields. Normally the VBI image stores the -first field (lower scanning line numbers) first in memory. This may be -a top or bottom field depending on the video standard. When this flag -is set the first or second field may be stored first, however the -fields are still in correct temporal order with the older field first -in memory. - Most VBI services transmit on both fields, but -some have different semantics depending on the field number. These -cannot be reliable decoded or encoded when -V4L2_VBI_UNSYNC is set. - - - - V4L2_VBI_INTERLACED - 0x0002 - By default the two field images will be passed -sequentially; all lines of the first field followed by all lines of -the second field (compare -V4L2_FIELD_SEQ_TB and -V4L2_FIELD_SEQ_BT, whether the top or bottom -field is first in memory depends on the video standard). When this -flag is set, the two fields are interlaced (cf. -V4L2_FIELD_INTERLACED). The first line of the -first field followed by the first line of the second field, then the -two second lines, and so on. Such a layout may be necessary when the -hardware has been programmed to capture or output interlaced video -images and is unable to separate the fields for VBI capturing at -the same time. For simplicity setting this flag implies that both -count values are equal and non-zero. - - - -
- -
- Line synchronization - - - - - - - - - Line synchronization diagram - - -
- -
- ITU-R 525 line numbering (M/NTSC and M/PAL) - - - - - - - - - NTSC field synchronization diagram - - - (1) For the purpose of this specification field 2 -starts in line 264 and not 263.5 because half line capturing is not -supported. - - -
- -
- ITU-R 625 line numbering - - - - - - - - - PAL/SECAM field synchronization diagram - - - (1) For the purpose of this specification field 2 -starts in line 314 and not 313.5 because half line capturing is not -supported. - - -
- - Remember the VBI image format depends on the selected -video standard, therefore the application must choose a new standard or -query the current standard first. Attempts to read or write data ahead -of format negotiation, or after switching the video standard which may -invalidate the negotiated VBI parameters, should be refused by the -driver. A format change during active I/O is not permitted. -
- -
- Reading and writing VBI images - - To assure synchronization with the field number and easier -implementation, the smallest unit of data passed at a time is one -frame, consisting of two fields of VBI images immediately following in -memory. - - The total size of a frame computes as follows: - - -(count[0] + count[1]) * -samples_per_line * sample size in bytes - - The sample size is most likely always one byte, -applications must check the sample_format -field though, to function properly with other drivers. - - A VBI device may support read/write and/or streaming (memory mapping or user pointer) I/O. The latter bears the -possibility of synchronizing video and -VBI data by using buffer timestamps. - - Remember the &VIDIOC-STREAMON; ioctl and the first read(), -write() and select() call can be resource allocation points returning -an &EBUSY; if the required hardware resources are temporarily -unavailable, for example the device is already in use by another -process. -
- - diff --git a/Documentation/DocBook/v4l/dev-rds.xml b/Documentation/DocBook/v4l/dev-rds.xml deleted file mode 100644 index 2427f54397e7..000000000000 --- a/Documentation/DocBook/v4l/dev-rds.xml +++ /dev/null @@ -1,204 +0,0 @@ - RDS Interface - - The Radio Data System transmits supplementary -information in binary format, for example the station name or travel -information, on an inaudible audio subcarrier of a radio program. This -interface is aimed at devices capable of receiving and/or transmitting RDS -information. - - For more information see the core RDS standard -and the RBDS standard . - - Note that the RBDS standard as is used in the USA is almost identical -to the RDS standard. Any RDS decoder/encoder can also handle RBDS. Only some of the -fields have slightly different meanings. See the RBDS standard for more -information. - - The RBDS standard also specifies support for MMBS (Modified Mobile Search). -This is a proprietary format which seems to be discontinued. The RDS interface does not -support this format. Should support for MMBS (or the so-called 'E blocks' in general) -be needed, then please contact the linux-media mailing list: &v4l-ml;. - -
- Querying Capabilities - - Devices supporting the RDS capturing API set -the V4L2_CAP_RDS_CAPTURE flag in -the capabilities field of &v4l2-capability; -returned by the &VIDIOC-QUERYCAP; ioctl. Any tuner that supports RDS -will set the V4L2_TUNER_CAP_RDS flag in -the capability field of &v4l2-tuner;. If -the driver only passes RDS blocks without interpreting the data -the V4L2_TUNER_SUB_RDS_BLOCK_IO flag has to be -set, see Reading RDS data. -For future use the -flag V4L2_TUNER_SUB_RDS_CONTROLS has also been -defined. However, a driver for a radio tuner with this capability does -not yet exist, so if you are planning to write such a driver you -should discuss this on the linux-media mailing list: &v4l-ml;. - - Whether an RDS signal is present can be detected by looking -at the rxsubchans field of &v4l2-tuner;: -the V4L2_TUNER_SUB_RDS will be set if RDS data -was detected. - - Devices supporting the RDS output API -set the V4L2_CAP_RDS_OUTPUT flag in -the capabilities field of &v4l2-capability; -returned by the &VIDIOC-QUERYCAP; ioctl. -Any modulator that supports RDS will set the -V4L2_TUNER_CAP_RDS flag in the capability -field of &v4l2-modulator;. -In order to enable the RDS transmission one must set the V4L2_TUNER_SUB_RDS -bit in the txsubchans field of &v4l2-modulator;. -If the driver only passes RDS blocks without interpreting the data -the V4L2_TUNER_SUB_RDS_BLOCK_IO flag has to be set. If the -tuner is capable of handling RDS entities like program identification codes and radio -text, the flag V4L2_TUNER_SUB_RDS_CONTROLS should be set, -see Writing RDS data and -FM Transmitter Control Reference. -
- -
- Reading RDS data - - RDS data can be read from the radio device -with the &func-read; function. The data is packed in groups of three bytes. -
- -
- Writing RDS data - - RDS data can be written to the radio device -with the &func-write; function. The data is packed in groups of three bytes, -as follows: -
- -
- RDS datastructures - - struct -<structname>v4l2_rds_data</structname> - - - - - - - __u8 - lsb - Least Significant Byte of RDS Block - - - __u8 - msb - Most Significant Byte of RDS Block - - - __u8 - block - Block description - - - -
- - Block description - - - - - - Bits 0-2 - Block (aka offset) of the received data. - - - Bits 3-5 - Deprecated. Currently identical to bits 0-2. Do not use these bits. - - - Bit 6 - Corrected bit. Indicates that an error was corrected for this data block. - - - Bit 7 - Error bit. Indicates that an uncorrectable error occurred during reception of this block. - - - -
- - - Block defines - - - - - - - - V4L2_RDS_BLOCK_MSK - - 7 - Mask for bits 0-2 to get the block ID. - - - V4L2_RDS_BLOCK_A - - 0 - Block A. - - - V4L2_RDS_BLOCK_B - - 1 - Block B. - - - V4L2_RDS_BLOCK_C - - 2 - Block C. - - - V4L2_RDS_BLOCK_D - - 3 - Block D. - - - V4L2_RDS_BLOCK_C_ALT - - 4 - Block C'. - - - V4L2_RDS_BLOCK_INVALID - read-only - 7 - An invalid block. - - - V4L2_RDS_BLOCK_CORRECTED - read-only - 0x40 - A bit error was detected but corrected. - - - V4L2_RDS_BLOCK_ERROR - read-only - 0x80 - An uncorrectable error occurred. - - - -
-
- - diff --git a/Documentation/DocBook/v4l/dev-sliced-vbi.xml b/Documentation/DocBook/v4l/dev-sliced-vbi.xml deleted file mode 100644 index 69e789fa7f7b..000000000000 --- a/Documentation/DocBook/v4l/dev-sliced-vbi.xml +++ /dev/null @@ -1,708 +0,0 @@ - Sliced VBI Data Interface - - VBI stands for Vertical Blanking Interval, a gap in the -sequence of lines of an analog video signal. During VBI no picture -information is transmitted, allowing some time while the electron beam -of a cathode ray tube TV returns to the top of the screen. - - Sliced VBI devices use hardware to demodulate data transmitted -in the VBI. V4L2 drivers shall not do this by -software, see also the raw VBI -interface. The data is passed as short packets of fixed size, -covering one scan line each. The number of packets per video frame is -variable. - - Sliced VBI capture and output devices are accessed through the -same character special files as raw VBI devices. When a driver -supports both interfaces, the default function of a -/dev/vbi device is raw VBI -capturing or output, and the sliced VBI function is only available -after calling the &VIDIOC-S-FMT; ioctl as defined below. Likewise a -/dev/video device may support the sliced VBI API, -however the default function here is video capturing or output. -Different file descriptors must be used to pass raw and sliced VBI -data simultaneously, if this is supported by the driver. - -
- Querying Capabilities - - Devices supporting the sliced VBI capturing or output API -set the V4L2_CAP_SLICED_VBI_CAPTURE or -V4L2_CAP_SLICED_VBI_OUTPUT flag respectively, in -the capabilities field of &v4l2-capability; -returned by the &VIDIOC-QUERYCAP; ioctl. At least one of the -read/write, streaming or asynchronous I/O -methods must be supported. Sliced VBI devices may have a tuner -or modulator. -
- -
- Supplemental Functions - - Sliced VBI devices shall support video -input or output and tuner or -modulator ioctls if they have these capabilities, and they may -support control ioctls. The video standard ioctls provide information -vital to program a sliced VBI device, therefore must be -supported. -
- -
- Sliced VBI Format Negotiation - - To find out which data services are supported by the -hardware applications can call the &VIDIOC-G-SLICED-VBI-CAP; ioctl. -All drivers implementing the sliced VBI interface must support this -ioctl. The results may differ from those of the &VIDIOC-S-FMT; ioctl -when the number of VBI lines the hardware can capture or output per -frame, or the number of services it can identify on a given line are -limited. For example on PAL line 16 the hardware may be able to look -for a VPS or Teletext signal, but not both at the same time. - - To determine the currently selected services applications -set the type field of &v4l2-format; to - V4L2_BUF_TYPE_SLICED_VBI_CAPTURE or -V4L2_BUF_TYPE_SLICED_VBI_OUTPUT, and the &VIDIOC-G-FMT; -ioctl fills the fmt.sliced member, a -&v4l2-sliced-vbi-format;. - - Applications can request different parameters by -initializing or modifying the fmt.sliced -member and calling the &VIDIOC-S-FMT; ioctl with a pointer to the -v4l2_format structure. - - The sliced VBI API is more complicated than the raw VBI API -because the hardware must be told which VBI service to expect on each -scan line. Not all services may be supported by the hardware on all -lines (this is especially true for VBI output where Teletext is often -unsupported and other services can only be inserted in one specific -line). In many cases, however, it is sufficient to just set the -service_set field to the required services -and let the driver fill the service_lines -array according to hardware capabilities. Only if more precise control -is needed should the programmer set the -service_lines array explicitly. - - The &VIDIOC-S-FMT; ioctl modifies the parameters -according to hardware capabilities. When the driver allocates -resources at this point, it may return an &EBUSY; if the required -resources are temporarily unavailable. Other resource allocation -points which may return EBUSY can be the -&VIDIOC-STREAMON; ioctl and the first &func-read;, &func-write; and -&func-select; call. - - - struct -<structname>v4l2_sliced_vbi_format</structname> - - - - - - - - - - __u32 - service_set - If -service_set is non-zero when passed with -&VIDIOC-S-FMT; or &VIDIOC-TRY-FMT;, the -service_lines array will be filled by the -driver according to the services specified in this field. For example, -if service_set is initialized with -V4L2_SLICED_TELETEXT_B | V4L2_SLICED_WSS_625, a -driver for the cx25840 video decoder sets lines 7-22 of both -fieldsAccording to ETS 300 706 lines 6-22 of the -first field and lines 5-22 of the second field may carry Teletext -data. to V4L2_SLICED_TELETEXT_B -and line 23 of the first field to -V4L2_SLICED_WSS_625. If -service_set is set to zero, then the values -of service_lines will be used instead. -On return the driver sets this field to the union of all -elements of the returned service_lines -array. It may contain less services than requested, perhaps just one, -if the hardware cannot handle more services simultaneously. It may be -empty (zero) if none of the requested services are supported by the -hardware. - - - __u16 - service_lines[2][24] - Applications initialize this -array with sets of data services the driver shall look for or insert -on the respective scan line. Subject to hardware capabilities drivers -return the requested set, a subset, which may be just a single -service, or an empty set. When the hardware cannot handle multiple -services on the same line the driver shall choose one. No assumptions -can be made on which service the driver chooses.Data -services are defined in . Array indices -map to ITU-R line numbers (see also and ) as follows: - - - - - Element - 525 line systems - 625 line systems - - - - - service_lines[0][1] - 1 - 1 - - - - - service_lines[0][23] - 23 - 23 - - - - - service_lines[1][1] - 264 - 314 - - - - - service_lines[1][23] - 286 - 336 - - - - - - Drivers must set -service_lines[0][0] and -service_lines[1][0] to zero. - - - __u32 - io_size - Maximum number of bytes passed by -one &func-read; or &func-write; call, and the buffer size in bytes for -the &VIDIOC-QBUF; and &VIDIOC-DQBUF; ioctl. Drivers set this field to -the size of &v4l2-sliced-vbi-data; times the number of non-zero -elements in the returned service_lines -array (that is the number of lines potentially carrying data). - - - __u32 - reserved[2] - This array is reserved for future -extensions. Applications and drivers must set it to zero. - - - -
- - - - Sliced VBI services - - - - - - - - - - Symbol - Value - Reference - Lines, usually - Payload - - - - - V4L2_SLICED_TELETEXT_B -(Teletext System B) - 0x0001 - , - PAL/SECAM line 7-22, 320-335 (second field 7-22) - Last 42 of the 45 byte Teletext packet, that is -without clock run-in and framing code, lsb first transmitted. - - - V4L2_SLICED_VPS - 0x0400 - - PAL line 16 - Byte number 3 to 15 according to Figure 9 of -ETS 300 231, lsb first transmitted. - - - V4L2_SLICED_CAPTION_525 - 0x1000 - - NTSC line 21, 284 (second field 21) - Two bytes in transmission order, including parity -bit, lsb first transmitted. - - - V4L2_SLICED_WSS_625 - 0x4000 - , - PAL/SECAM line 23 - -Byte 0 1 - msb lsb msb lsb - Bit 7 6 5 4 3 2 1 0 x x 13 12 11 10 9 - - - - V4L2_SLICED_VBI_525 - 0x1000 - Set of services applicable to 525 -line systems. - - - V4L2_SLICED_VBI_625 - 0x4401 - Set of services applicable to 625 -line systems. - - - -
- - Drivers may return an &EINVAL; when applications attempt to -read or write data without prior format negotiation, after switching -the video standard (which may invalidate the negotiated VBI -parameters) and after switching the video input (which may change the -video standard as a side effect). The &VIDIOC-S-FMT; ioctl may return -an &EBUSY; when applications attempt to change the format while i/o is -in progress (between a &VIDIOC-STREAMON; and &VIDIOC-STREAMOFF; call, -and after the first &func-read; or &func-write; call). -
- -
- Reading and writing sliced VBI data - - A single &func-read; or &func-write; call must pass all data -belonging to one video frame. That is an array of -v4l2_sliced_vbi_data structures with one or -more elements and a total size not exceeding -io_size bytes. Likewise in streaming I/O -mode one buffer of io_size bytes must -contain data of one video frame. The id of -unused v4l2_sliced_vbi_data elements must be -zero. - - - struct -<structname>v4l2_sliced_vbi_data</structname> - - &cs-def; - - - __u32 - id - A flag from -identifying the type of data in this packet. Only a single bit must be -set. When the id of a captured packet is -zero, the packet is empty and the contents of other fields are -undefined. Applications shall ignore empty packets. When the -id of a packet for output is zero the -contents of the data field are undefined -and the driver must no longer insert data on the requested -field and -line. - - - __u32 - field - The video field number this data has been captured -from, or shall be inserted at. 0 for the first -field, 1 for the second field. - - - __u32 - line - The field (as opposed to frame) line number this -data has been captured from, or shall be inserted at. See and for valid -values. Sliced VBI capture devices can set the line number of all -packets to 0 if the hardware cannot reliably -identify scan lines. The field number must always be valid. - - - __u32 - reserved - This field is reserved for future extensions. -Applications and drivers must set it to zero. - - - __u8 - data[48] - The packet payload. See for the contents and number of -bytes passed for each data type. The contents of padding bytes at the -end of this array are undefined, drivers and applications shall ignore -them. - - - -
- - Packets are always passed in ascending line number order, -without duplicate line numbers. The &func-write; function and the -&VIDIOC-QBUF; ioctl must return an &EINVAL; when applications violate -this rule. They must also return an &EINVAL; when applications pass an -incorrect field or line number, or a combination of -field, line and -id which has not been negotiated with the -&VIDIOC-G-FMT; or &VIDIOC-S-FMT; ioctl. When the line numbers are -unknown the driver must pass the packets in transmitted order. The -driver can insert empty packets with id set -to zero anywhere in the packet array. - - To assure synchronization and to distinguish from frame -dropping, when a captured frame does not carry any of the requested -data services drivers must pass one or more empty packets. When an -application fails to pass VBI data in time for output, the driver -must output the last VPS and WSS packet again, and disable the output -of Closed Caption and Teletext data, or output data which is ignored -by Closed Caption and Teletext decoders. - - A sliced VBI device may support read/write and/or streaming (memory mapping and/or user -pointer) I/O. The latter bears the possibility of synchronizing -video and VBI data by using buffer timestamps. - -
- -
- Sliced VBI Data in MPEG Streams - - If a device can produce an MPEG output stream, it may be -capable of providing negotiated sliced VBI -services as data embedded in the MPEG stream. Users or -applications control this sliced VBI data insertion with the V4L2_CID_MPEG_STREAM_VBI_FMT -control. - - If the driver does not provide the V4L2_CID_MPEG_STREAM_VBI_FMT -control, or only allows that control to be set to -V4L2_MPEG_STREAM_VBI_FMT_NONE, then the device -cannot embed sliced VBI data in the MPEG stream. - - The -V4L2_CID_MPEG_STREAM_VBI_FMT control does not implicitly set -the device driver to capture nor cease capturing sliced VBI data. The -control only indicates to embed sliced VBI data in the MPEG stream, if -an application has negotiated sliced VBI service be captured. - - It may also be the case that a device can embed sliced VBI -data in only certain types of MPEG streams: for example in an MPEG-2 -PS but not an MPEG-2 TS. In this situation, if sliced VBI data -insertion is requested, the sliced VBI data will be embedded in MPEG -stream types when supported, and silently omitted from MPEG stream -types where sliced VBI data insertion is not supported by the device. - - - The following subsections specify the format of the -embedded sliced VBI data. - -
- MPEG Stream Embedded, Sliced VBI Data Format: NONE - The -V4L2_MPEG_STREAM_VBI_FMT_NONE embedded sliced VBI -format shall be interpreted by drivers as a control to cease -embedding sliced VBI data in MPEG streams. Neither the device nor -driver shall insert "empty" embedded sliced VBI data packets in the -MPEG stream when this format is set. No MPEG stream data structures -are specified for this format. -
- -
- MPEG Stream Embedded, Sliced VBI Data Format: IVTV - The -V4L2_MPEG_STREAM_VBI_FMT_IVTV embedded sliced VBI -format, when supported, indicates to the driver to embed up to 36 -lines of sliced VBI data per frame in an MPEG-2 Private -Stream 1 PES packet encapsulated in an MPEG-2 -Program Pack in the MPEG stream. - - Historical context: This format -specification originates from a custom, embedded, sliced VBI data -format used by the ivtv driver. This format -has already been informally specified in the kernel sources in the -file Documentation/video4linux/cx2341x/README.vbi -. The maximum size of the payload and other aspects of this format -are driven by the CX23415 MPEG decoder's capabilities and limitations -with respect to extracting, decoding, and displaying sliced VBI data -embedded within an MPEG stream. - - This format's use is not exclusive to -the ivtv driver nor -exclusive to CX2341x devices, as the sliced VBI data packet insertion -into the MPEG stream is implemented in driver software. At least the -cx18 driver provides sliced VBI data insertion -into an MPEG-2 PS in this format as well. - - The following definitions specify the payload of the -MPEG-2 Private Stream 1 PES packets that contain -sliced VBI data when -V4L2_MPEG_STREAM_VBI_FMT_IVTV is set. -(The MPEG-2 Private Stream 1 PES packet header -and encapsulating MPEG-2 Program Pack header are -not detailed here. Please refer to the MPEG-2 specifications for -details on those packet headers.) - - The payload of the MPEG-2 Private Stream 1 PES - packets that contain sliced VBI data is specified by -&v4l2-mpeg-vbi-fmt-ivtv;. The payload is variable -length, depending on the actual number of lines of sliced VBI data -present in a video frame. The payload may be padded at the end with -unspecified fill bytes to align the end of the payload to a 4-byte -boundary. The payload shall never exceed 1552 bytes (2 fields with -18 lines/field with 43 bytes of data/line and a 4 byte magic number). - - - - struct <structname>v4l2_mpeg_vbi_fmt_ivtv</structname> - - - &cs-ustr; - - - __u8 - magic[4] - - A "magic" constant from that indicates -this is a valid sliced VBI data payload and also indicates which -member of the anonymous union, itv0 or -ITV0, to use for the payload data. - - - union - (anonymous) - - - - struct - v4l2_mpeg_vbi_itv0 - - itv0 - The primary form of the sliced VBI data payload -that contains anywhere from 1 to 35 lines of sliced VBI data. -Line masks are provided in this form of the payload indicating -which VBI lines are provided. - - - - struct - v4l2_mpeg_vbi_ITV0 - - ITV0 - An alternate form of the sliced VBI data payload -used when 36 lines of sliced VBI data are present. No line masks are -provided in this form of the payload; all valid line mask bits are -implcitly set. - - - -
- - - Magic Constants for &v4l2-mpeg-vbi-fmt-ivtv; - <structfield>magic</structfield> field - - &cs-def; - - - Defined Symbol - Value - Description - - - - - V4L2_MPEG_VBI_IVTV_MAGIC0 - - "itv0" - Indicates the itv0 -member of the union in &v4l2-mpeg-vbi-fmt-ivtv; is valid. - - - V4L2_MPEG_VBI_IVTV_MAGIC1 - - "ITV0" - Indicates the ITV0 -member of the union in &v4l2-mpeg-vbi-fmt-ivtv; is valid and -that 36 lines of sliced VBI data are present. - - - -
- - - struct <structname>v4l2_mpeg_vbi_itv0</structname> - - - &cs-str; - - - __le32 - linemask[2] - Bitmasks indicating the VBI service lines -present. These linemask values are stored -in little endian byte order in the MPEG stream. Some reference -linemask bit positions with their -corresponding VBI line number and video field are given below. -b0 indicates the least significant bit of a -linemask value: -linemask[0] b0: line 6 first field -linemask[0] b17: line 23 first field -linemask[0] b18: line 6 second field -linemask[0] b31: line 19 second field -linemask[1] b0: line 20 second field -linemask[1] b3: line 23 second field -linemask[1] b4-b31: unused and set to 0 - - - struct - v4l2_mpeg_vbi_itv0_line - - line[35] - This is a variable length array that holds from 1 -to 35 lines of sliced VBI data. The sliced VBI data lines present -correspond to the bits set in the linemask -array, starting from b0 of -linemask[0] up through b31 of -linemask[0], and from b0 - of linemask[1] up through b -3 of linemask[1]. -line[0] corresponds to the first bit -found set in the linemask array, -line[1] corresponds to the second bit -found set in the linemask array, etc. -If no linemask array bits are set, then -line[0] may contain one line of -unspecified data that should be ignored by applications. - - - -
- - - struct <structname>v4l2_mpeg_vbi_ITV0</structname> - - - &cs-str; - - - struct - v4l2_mpeg_vbi_itv0_line - - line[36] - A fixed length array of 36 lines of sliced VBI -data. line[0] through line -[17] correspond to lines 6 through 23 of the -first field. line[18] through -line[35] corresponds to lines 6 -through 23 of the second field. - - - -
- - - struct <structname>v4l2_mpeg_vbi_itv0_line</structname> - - - &cs-str; - - - __u8 - id - A line identifier value from - that indicates -the type of sliced VBI data stored on this line. - - - __u8 - data[42] - The sliced VBI data for the line. - - - -
- - - Line Identifiers for struct <link - linkend="v4l2-mpeg-vbi-itv0-line"><structname> -v4l2_mpeg_vbi_itv0_line</structname></link> <structfield>id -</structfield> field - - &cs-def; - - - Defined Symbol - Value - Description - - - - - V4L2_MPEG_VBI_IVTV_TELETEXT_B - - 1 - Refer to -Sliced VBI services for a description of the line payload. - - - V4L2_MPEG_VBI_IVTV_CAPTION_525 - - 4 - Refer to -Sliced VBI services for a description of the line payload. - - - V4L2_MPEG_VBI_IVTV_WSS_625 - - 5 - Refer to -Sliced VBI services for a description of the line payload. - - - V4L2_MPEG_VBI_IVTV_VPS - - 7 - Refer to -Sliced VBI services for a description of the line payload. - - - -
- -
-
- - - diff --git a/Documentation/DocBook/v4l/dev-subdev.xml b/Documentation/DocBook/v4l/dev-subdev.xml deleted file mode 100644 index 05c8fefcbcbe..000000000000 --- a/Documentation/DocBook/v4l/dev-subdev.xml +++ /dev/null @@ -1,313 +0,0 @@ - Sub-device Interface - - - Experimental - This is an experimental - interface and may change in the future. - - - The complex nature of V4L2 devices, where hardware is often made of - several integrated circuits that need to interact with each other in a - controlled way, leads to complex V4L2 drivers. The drivers usually reflect - the hardware model in software, and model the different hardware components - as software blocks called sub-devices. - - V4L2 sub-devices are usually kernel-only objects. If the V4L2 driver - implements the media device API, they will automatically inherit from media - entities. Applications will be able to enumerate the sub-devices and discover - the hardware topology using the media entities, pads and links enumeration - API. - - In addition to make sub-devices discoverable, drivers can also choose - to make them directly configurable by applications. When both the sub-device - driver and the V4L2 device driver support this, sub-devices will feature a - character device node on which ioctls can be called to - - query, read and write sub-devices controls - subscribe and unsubscribe to events and retrieve them - negotiate image formats on individual pads - - - - Sub-device character device nodes, conventionally named - /dev/v4l-subdev*, use major number 81. - -
- Controls - Most V4L2 controls are implemented by sub-device hardware. Drivers - usually merge all controls and expose them through video device nodes. - Applications can control all sub-devices through a single interface. - - Complex devices sometimes implement the same control in different - pieces of hardware. This situation is common in embedded platforms, where - both sensors and image processing hardware implement identical functions, - such as contrast adjustment, white balance or faulty pixels correction. As - the V4L2 controls API doesn't support several identical controls in a single - device, all but one of the identical controls are hidden. - - Applications can access those hidden controls through the sub-device - node with the V4L2 control API described in . The - ioctls behave identically as when issued on V4L2 device nodes, with the - exception that they deal only with controls implemented in the sub-device. - - - Depending on the driver, those controls might also be exposed through - one (or several) V4L2 device nodes. -
- -
- Events - V4L2 sub-devices can notify applications of events as described in - . The API behaves identically as when used on V4L2 - device nodes, with the exception that it only deals with events generated by - the sub-device. Depending on the driver, those events might also be reported - on one (or several) V4L2 device nodes. -
- -
- Pad-level Formats - - Pad-level formats are only applicable to very complex device that - need to expose low-level format configuration to user space. Generic V4L2 - applications do not need to use the API described in - this section. - - For the purpose of this section, the term - format means the combination of media bus data - format, frame width and frame height. - - Image formats are typically negotiated on video capture and output - devices using the cropping and scaling ioctls. - The driver is responsible for configuring every block in the video pipeline - according to the requested format at the pipeline input and/or - output. - - For complex devices, such as often found in embedded systems, - identical image sizes at the output of a pipeline can be achieved using - different hardware configurations. One such example is shown on - , where - image scaling can be performed on both the video sensor and the host image - processing hardware. - -
- Image Format Negotiation on Pipelines - - - - - - - - - High quality and high speed pipeline configuration - - -
- - The sensor scaler is usually of less quality than the host scaler, but - scaling on the sensor is required to achieve higher frame rates. Depending - on the use case (quality vs. speed), the pipeline must be configured - differently. Applications need to configure the formats at every point in - the pipeline explicitly. - - Drivers that implement the media - API can expose pad-level image format configuration to applications. - When they do, applications can use the &VIDIOC-SUBDEV-G-FMT; and - &VIDIOC-SUBDEV-S-FMT; ioctls. to negotiate formats on a per-pad basis. - - Applications are responsible for configuring coherent parameters on - the whole pipeline and making sure that connected pads have compatible - formats. The pipeline is checked for formats mismatch at &VIDIOC-STREAMON; - time, and an &EPIPE; is then returned if the configuration is - invalid. - - Pad-level image format configuration support can be tested by calling - the &VIDIOC-SUBDEV-G-FMT; ioctl on pad 0. If the driver returns an &EINVAL; - pad-level format configuration is not supported by the sub-device. - -
- Format Negotiation - - Acceptable formats on pads can (and usually do) depend on a number - of external parameters, such as formats on other pads, active links, or - even controls. Finding a combination of formats on all pads in a video - pipeline, acceptable to both application and driver, can't rely on formats - enumeration only. A format negotiation mechanism is required. - - Central to the format negotiation mechanism are the get/set format - operations. When called with the which argument - set to V4L2_SUBDEV_FORMAT_TRY, the - &VIDIOC-SUBDEV-G-FMT; and &VIDIOC-SUBDEV-S-FMT; ioctls operate on a set of - formats parameters that are not connected to the hardware configuration. - Modifying those 'try' formats leaves the device state untouched (this - applies to both the software state stored in the driver and the hardware - state stored in the device itself). - - While not kept as part of the device state, try formats are stored - in the sub-device file handles. A &VIDIOC-SUBDEV-G-FMT; call will return - the last try format set on the same sub-device file - handle. Several applications querying the same sub-device at - the same time will thus not interact with each other. - - To find out whether a particular format is supported by the device, - applications use the &VIDIOC-SUBDEV-S-FMT; ioctl. Drivers verify and, if - needed, change the requested format based on - device requirements and return the possibly modified value. Applications - can then choose to try a different format or accept the returned value and - continue. - - Formats returned by the driver during a negotiation iteration are - guaranteed to be supported by the device. In particular, drivers guarantee - that a returned format will not be further changed if passed to an - &VIDIOC-SUBDEV-S-FMT; call as-is (as long as external parameters, such as - formats on other pads or links' configuration are not changed). - - Drivers automatically propagate formats inside sub-devices. When a - try or active format is set on a pad, corresponding formats on other pads - of the same sub-device can be modified by the driver. Drivers are free to - modify formats as required by the device. However, they should comply with - the following rules when possible: - - Formats should be propagated from sink pads to source pads. - Modifying a format on a source pad should not modify the format on any - sink pad. - Sub-devices that scale frames using variable scaling factors - should reset the scale factors to default values when sink pads formats - are modified. If the 1:1 scaling ratio is supported, this means that - source pads formats should be reset to the sink pads formats. - - - - Formats are not propagated across links, as that would involve - propagating them from one sub-device file handle to another. Applications - must then take care to configure both ends of every link explicitly with - compatible formats. Identical formats on the two ends of a link are - guaranteed to be compatible. Drivers are free to accept different formats - matching device requirements as being compatible. - - - shows a sample configuration sequence for the pipeline described in - (table - columns list entity names and pad numbers). - - - Sample Pipeline Configuration - - - - - - - - - - - Sensor/0 - Frontend/0 - Frontend/1 - Scaler/0 - Scaler/1 - - - - - Initial state - 2048x1536 - - - - - - - - - - - Configure frontend input - 2048x1536 - 2048x1536 - 2046x1534 - - - - - - - Configure scaler input - 2048x1536 - 2048x1536 - 2046x1534 - 2046x1534 - 2046x1534 - - - Configure scaler output - 2048x1536 - 2048x1536 - 2046x1534 - 2046x1534 - 1280x960 - - - -
- - - - Initial state. The sensor output is set to its native 3MP - resolution. Resolutions on the host frontend and scaler input and output - pads are undefined. - The application configures the frontend input pad resolution to - 2048x1536. The driver propagates the format to the frontend output pad. - Note that the propagated output format can be different, as in this case, - than the input format, as the hardware might need to crop pixels (for - instance when converting a Bayer filter pattern to RGB or YUV). - The application configures the scaler input pad resolution to - 2046x1534 to match the frontend output resolution. The driver propagates - the format to the scaler output pad. - The application configures the scaler output pad resolution to - 1280x960. - - - - When satisfied with the try results, applications can set the active - formats by setting the which argument to - V4L2_SUBDEV_FORMAT_TRY. Active formats are changed - exactly as try formats by drivers. To avoid modifying the hardware state - during format negotiation, applications should negotiate try formats first - and then modify the active settings using the try formats returned during - the last negotiation iteration. This guarantees that the active format - will be applied as-is by the driver without being modified. - -
- -
- Cropping and scaling - - Many sub-devices support cropping frames on their input or output - pads (or possible even on both). Cropping is used to select the area of - interest in an image, typically on a video sensor or video decoder. It can - also be used as part of digital zoom implementations to select the area of - the image that will be scaled up. - - Crop settings are defined by a crop rectangle and represented in a - &v4l2-rect; by the coordinates of the top left corner and the rectangle - size. Both the coordinates and sizes are expressed in pixels. - - The crop rectangle is retrieved and set using the - &VIDIOC-SUBDEV-G-CROP; and &VIDIOC-SUBDEV-S-CROP; ioctls. Like for pad - formats, drivers store try and active crop rectangles. The format - negotiation mechanism applies to crop settings as well. - - On input pads, cropping is applied relatively to the current pad - format. The pad format represents the image size as received by the - sub-device from the previous block in the pipeline, and the crop rectangle - represents the sub-image that will be transmitted further inside the - sub-device for processing. The crop rectangle be entirely containted - inside the input image size. - - Input crop rectangle are reset to their default value when the input - image format is modified. Drivers should use the input image size as the - crop rectangle default value, but hardware requirements may prevent this. - - - Cropping behaviour on output pads is not defined. - -
-
- - &sub-subdev-formats; diff --git a/Documentation/DocBook/v4l/dev-teletext.xml b/Documentation/DocBook/v4l/dev-teletext.xml deleted file mode 100644 index 414b1cfff9f4..000000000000 --- a/Documentation/DocBook/v4l/dev-teletext.xml +++ /dev/null @@ -1,37 +0,0 @@ - Teletext Interface - - This interface was aimed at devices receiving and demodulating -Teletext data [, ], evaluating the -Teletext packages and storing formatted pages in cache memory. Such -devices are usually implemented as microcontrollers with serial -interface (I2C) and could be found on old -TV cards, dedicated Teletext decoding cards and home-brew devices -connected to the PC parallel port. - - The Teletext API was designed by Martin Buck. It was defined in -the kernel header file linux/videotext.h, the -specification is available from -ftp://ftp.gwdg.de/pub/linux/misc/videotext/. (Videotext is the name of -the German public television Teletext service.) - - Eventually the Teletext API was integrated into the V4L API -with character device file names /dev/vtx0 to -/dev/vtx31, device major number 81, minor numbers -192 to 223. - - However, teletext decoders were quickly replaced by more -generic VBI demodulators and those dedicated teletext decoders no longer exist. -For many years the vtx devices were still around, even though nobody used -them. So the decision was made to finally remove support for the Teletext API in -kernel 2.6.37. - - Modern devices all use the raw or -sliced VBI API. - - diff --git a/Documentation/DocBook/v4l/driver.xml b/Documentation/DocBook/v4l/driver.xml deleted file mode 100644 index 1f7eea5c4ec3..000000000000 --- a/Documentation/DocBook/v4l/driver.xml +++ /dev/null @@ -1,208 +0,0 @@ - V4L2 Driver Programming - - - - to do - - - diff --git a/Documentation/DocBook/v4l/fdl-appendix.xml b/Documentation/DocBook/v4l/fdl-appendix.xml deleted file mode 100644 index ae22394ba997..000000000000 --- a/Documentation/DocBook/v4l/fdl-appendix.xml +++ /dev/null @@ -1,671 +0,0 @@ - - - - - - Version 1.1, March 2000 - - - 2000Free Software Foundation, Inc. - - - -
Free Software Foundation, Inc. 59 Temple Place, - Suite 330, Boston, MA - 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies of this - license document, but changing it is not allowed. -
-
-
- GNU Free Documentation License - - - 0. PREAMBLE - - The purpose of this License is to make a manual, textbook, or - other written document free in the sense of - freedom: to assure everyone the effective freedom to copy and - redistribute it, with or without modifying it, either - commercially or noncommercially. Secondarily, this License - preserves for the author and publisher a way to get credit for - their work, while not being considered responsible for - modifications made by others. - - - - This License is a kind of copyleft, which means - that derivative works of the document must themselves be free in - the same sense. It complements the GNU General Public License, - which is a copyleft license designed for free software. - - - - We have designed this License in order to use it for manuals for - free software, because free software needs free documentation: a - free program should come with manuals providing the same - freedoms that the software does. But this License is not limited - to software manuals; it can be used for any textual work, - regardless of subject matter or whether it is published as a - printed book. We recommend this License principally for works - whose purpose is instruction or reference. - - - - 1. APPLICABILITY AND DEFINITIONS - - This License applies to any manual or other work that contains a - notice placed by the copyright holder saying it can be - distributed under the terms of this License. The - Document, below, refers to any such manual or - work. Any member of the public is a licensee, and is addressed - as you. - - - - A Modified Version of the Document means any work - containing the Document or a portion of it, either copied - verbatim, or with modifications and/or translated into another - language. - - - - A Secondary Section is a named appendix or a - front-matter section of the Document that deals exclusively - with the relationship of the publishers or authors of the - Document to the Document's overall subject (or to related - matters) and contains nothing that could fall directly within - that overall subject. (For example, if the Document is in part a - textbook of mathematics, a Secondary Section may not explain any - mathematics.) The relationship could be a matter of historical - connection with the subject or with related matters, or of - legal, commercial, philosophical, ethical or political position - regarding them. - - - - The Invariant Sections are certain Secondary Sections whose titles - are designated, as being those of Invariant Sections, in the - notice that says that the Document is released under this - License. - - - - The Cover Texts are certain short passages of - text that are listed, as Front-Cover Texts or Back-Cover Texts, - in the notice that says that the Document is released under this - License. - - - - A Transparent copy of the Document means a machine-readable - copy, represented in a format whose specification is available - to the general public, whose contents can be viewed and edited - directly and straightforwardly with generic text editors or (for - images composed of pixels) generic paint programs or (for - drawings) some widely available drawing editor, and that is - suitable for input to text formatters or for automatic - translation to a variety of formats suitable for input to text - formatters. A copy made in an otherwise Transparent file format - whose markup has been designed to thwart or discourage - subsequent modification by readers is not Transparent. A copy - that is not Transparent is called - Opaque. - - - - Examples of suitable formats for Transparent copies include - plain ASCII without markup, Texinfo input format, LaTeX input - format, SGML or XML using a publicly available DTD, and - standard-conforming simple HTML designed for human - modification. Opaque formats include PostScript, PDF, - proprietary formats that can be read and edited only by - proprietary word processors, SGML or XML for which the DTD - and/or processing tools are not generally available, and the - machine-generated HTML produced by some word processors for - output purposes only. - - - - The Title Page means, for a printed book, the - title page itself, plus such following pages as are needed to - hold, legibly, the material this License requires to appear in - the title page. For works in formats which do not have any title - page as such, Title Page means the text near the - most prominent appearance of the work's title, preceding the - beginning of the body of the text. - - - - - 2. VERBATIM COPYING - - You may copy and distribute the Document in any medium, either - commercially or noncommercially, provided that this License, the - copyright notices, and the license notice saying this License - applies to the Document are reproduced in all copies, and that - you add no other conditions whatsoever to those of this - License. You may not use technical measures to obstruct or - control the reading or further copying of the copies you make or - distribute. However, you may accept compensation in exchange for - copies. If you distribute a large enough number of copies you - must also follow the conditions in section 3. - - - - You may also lend copies, under the same conditions stated - above, and you may publicly display copies. - - - - - 3. COPYING IN QUANTITY - - If you publish printed copies of the Document numbering more than 100, - and the Document's license notice requires Cover Texts, you must enclose - the copies in covers that carry, clearly and legibly, all these - Cover Texts: Front-Cover Texts on the front cover, and - Back-Cover Texts on the back cover. Both covers must also - clearly and legibly identify you as the publisher of these - copies. The front cover must present the full title with all - words of the title equally prominent and visible. You may add - other material on the covers in addition. Copying with changes - limited to the covers, as long as they preserve the title of the - Document and satisfy these - conditions, can be treated as verbatim copying in other - respects. - - - - If the required texts for either cover are too voluminous to fit - legibly, you should put the first ones listed (as many as fit - reasonably) on the actual cover, and continue the rest onto - adjacent pages. - - - - If you publish or distribute Opaque copies of the Document numbering more than 100, - you must either include a machine-readable Transparent copy along with - each Opaque copy, or state in or with each Opaque copy a - publicly-accessible computer-network location containing a - complete Transparent copy of the Document, free of added - material, which the general network-using public has access to - download anonymously at no charge using public-standard network - protocols. If you use the latter option, you must take - reasonably prudent steps, when you begin distribution of Opaque - copies in quantity, to ensure that this Transparent copy will - remain thus accessible at the stated location until at least one - year after the last time you distribute an Opaque copy (directly - or through your agents or retailers) of that edition to the - public. - - - - It is requested, but not required, that you contact the authors - of the Document well before - redistributing any large number of copies, to give them a chance - to provide you with an updated version of the Document. - - - - - 4. MODIFICATIONS - - You may copy and distribute a Modified Version of the Document under the conditions of - sections 2 and 3 above, provided that you release - the Modified Version under precisely this License, with the - Modified Version filling the role of the Document, thus - licensing distribution and modification of the Modified Version - to whoever possesses a copy of it. In addition, you must do - these things in the Modified Version: - - - - - - A - - Use in the Title - Page (and on the covers, if any) a title distinct - from that of the Document, and from those of - previous versions (which should, if there were any, be - listed in the History section of the Document). You may - use the same title as a previous version if the original - publisher of that version gives permission. - - - - - - - B - - List on the Title - Page, as authors, one or more persons or entities - responsible for authorship of the modifications in the - Modified Version, - together with at least five of the principal authors of - the Document (all of - its principal authors, if it has less than five). - - - - - - - C - - State on the Title - Page the name of the publisher of the Modified Version, as the - publisher. - - - - - - - D - - Preserve all the copyright notices of the Document. - - - - - - - E - - Add an appropriate copyright notice for your modifications - adjacent to the other copyright notices. - - - - - - - F - - Include, immediately after the copyright notices, a - license notice giving the public permission to use the - Modified Version under - the terms of this License, in the form shown in the - Addendum below. - - - - - - - G - - Preserve in that license notice the full lists of Invariant Sections and - required Cover - Texts given in the Document's license notice. - - - - - - - H - - Include an unaltered copy of this License. - - - - - - - I - - Preserve the section entitled History, and - its title, and add to it an item stating at least the - title, year, new authors, and publisher of the Modified Version as given on - the Title Page. If - there is no section entitled History in the - Document, create one - stating the title, year, authors, and publisher of the - Document as given on its Title Page, then add an item - describing the Modified Version as stated in the previous - sentence. - - - - - - - J - - Preserve the network location, if any, given in the Document for public access - to a Transparent - copy of the Document, and likewise the network locations - given in the Document for previous versions it was based - on. These may be placed in the History - section. You may omit a network location for a work that - was published at least four years before the Document - itself, or if the original publisher of the version it - refers to gives permission. - - - - - - - K - - In any section entitled Acknowledgements or - Dedications, preserve the section's title, - and preserve in the section all the substance and tone of - each of the contributor acknowledgements and/or - dedications given therein. - - - - - - - L - - Preserve all the Invariant - Sections of the Document, unaltered in their - text and in their titles. Section numbers or the - equivalent are not considered part of the section titles. - - - - - - - M - - Delete any section entitled - Endorsements. Such a section may not be - included in the Modified - Version. - - - - - - - N - - Do not retitle any existing section as - Endorsements or to conflict in title with - any Invariant - Section. - - - - - - - If the Modified Version - includes new front-matter sections or appendices that qualify as - Secondary Sections and - contain no material copied from the Document, you may at your - option designate some or all of these sections as invariant. To - do this, add their titles to the list of Invariant Sections in the - Modified Version's license notice. These titles must be - distinct from any other section titles. - - - - You may add a section entitled Endorsements, - provided it contains nothing but endorsements of your Modified Version by various - parties--for example, statements of peer review or that the text - has been approved by an organization as the authoritative - definition of a standard. - - - - You may add a passage of up to five words as a Front-Cover Text, and a passage - of up to 25 words as a Back-Cover Text, to the end of - the list of Cover Texts - in the Modified Version. - Only one passage of Front-Cover Text and one of Back-Cover Text - may be added by (or through arrangements made by) any one - entity. If the Document - already includes a cover text for the same cover, previously - added by you or by arrangement made by the same entity you are - acting on behalf of, you may not add another; but you may - replace the old one, on explicit permission from the previous - publisher that added the old one. - - - - The author(s) and publisher(s) of the Document do not by this License - give permission to use their names for publicity for or to - assert or imply endorsement of any Modified Version . - - - - - 5. COMBINING DOCUMENTS - - You may combine the Document - with other documents released under this License, under the - terms defined in section 4 - above for modified versions, provided that you include in the - combination all of the Invariant - Sections of all of the original documents, unmodified, - and list them all as Invariant Sections of your combined work in - its license notice. - - - - The combined work need only contain one copy of this License, - and multiple identical Invariant - Sections may be replaced with a single copy. If there are - multiple Invariant Sections with the same name but different - contents, make the title of each such section unique by adding - at the end of it, in parentheses, the name of the original - author or publisher of that section if known, or else a unique - number. Make the same adjustment to the section titles in the - list of Invariant Sections in the license notice of the combined - work. - - - - In the combination, you must combine any sections entitled - History in the various original documents, - forming one section entitled History; likewise - combine any sections entitled Acknowledgements, - and any sections entitled Dedications. You must - delete all sections entitled Endorsements. - - - - - 6. COLLECTIONS OF DOCUMENTS - - You may make a collection consisting of the Document and other documents - released under this License, and replace the individual copies - of this License in the various documents with a single copy that - is included in the collection, provided that you follow the - rules of this License for verbatim copying of each of the - documents in all other respects. - - - - You may extract a single document from such a collection, and - dispbibute it individually under this License, provided you - insert a copy of this License into the extracted document, and - follow this License in all other respects regarding verbatim - copying of that document. - - - - - 7. AGGREGATION WITH INDEPENDENT WORKS - - A compilation of the Document or its derivatives with - other separate and independent documents or works, in or on a - volume of a storage or distribution medium, does not as a whole - count as a Modified Version - of the Document, provided no compilation copyright is claimed - for the compilation. Such a compilation is called an - aggregate, and this License does not apply to the - other self-contained works thus compiled with the Document , on - account of their being thus compiled, if they are not themselves - derivative works of the Document. If the Cover Text requirement of section 3 is applicable to these - copies of the Document, then if the Document is less than one - quarter of the entire aggregate, the Document's Cover Texts may - be placed on covers that surround only the Document within the - aggregate. Otherwise they must appear on covers around the whole - aggregate. - - - - - 8. TRANSLATION - - Translation is considered a kind of modification, so you may - distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with - translations requires special permission from their copyright - holders, but you may include translations of some or all - Invariant Sections in addition to the original versions of these - Invariant Sections. You may include a translation of this - License provided that you also include the original English - version of this License. In case of a disagreement between the - translation and the original English version of this License, - the original English version will prevail. - - - - - 9. TERMINATION - - You may not copy, modify, sublicense, or distribute the Document except as expressly - provided for under this License. Any other attempt to copy, - modify, sublicense or distribute the Document is void, and will - automatically terminate your rights under this License. However, - parties who have received copies, or rights, from you under this - License will not have their licenses terminated so long as such - parties remain in full compliance. - - - - - 10. FUTURE REVISIONS OF THIS LICENSE - - The Free Software - Foundation may publish new, revised versions of the GNU - Free Documentation License from time to time. Such new versions - will be similar in spirit to the present version, but may differ - in detail to address new problems or concerns. See http://www.gnu.org/copyleft/. - - - - Each version of the License is given a distinguishing version - number. If the Document - specifies that a particular numbered version of this License - or any later version applies to it, you have the - option of following the terms and conditions either of that - specified version or of any later version that has been - published (not as a draft) by the Free Software Foundation. If - the Document does not specify a version number of this License, - you may choose any version ever published (not as a draft) by - the Free Software Foundation. - - - - - Addendum - - To use this License in a document you have written, include a copy of - the License in the document and put the following copyright and - license notices just after the title page: - - -
- - Copyright © YEAR YOUR NAME. - - - Permission is granted to copy, distribute and/or modify this - document under the terms of the GNU Free Documentation - License, Version 1.1 or any later version published by the - Free Software Foundation; with the Invariant Sections being LIST - THEIR TITLES, with the Front-Cover Texts being LIST, - and with the Back-Cover - Texts being LIST. A copy of the license is included in - the section entitled GNU Free Documentation - License. - -
- - - If you have no Invariant - Sections, write with no Invariant Sections - instead of saying which ones are invariant. If you have no - Front-Cover Texts, write - no Front-Cover Texts instead of - Front-Cover Texts being LIST; likewise for Back-Cover Texts. - - - - If your document contains nontrivial examples of program code, - we recommend releasing these examples in parallel under your - choice of free software license, such as the GNU General Public - License, to permit their use in free software. - -
-
- - - - - - diff --git a/Documentation/DocBook/v4l/fieldseq_bt.gif b/Documentation/DocBook/v4l/fieldseq_bt.gif deleted file mode 100644 index 60e8569a76c9..000000000000 Binary files a/Documentation/DocBook/v4l/fieldseq_bt.gif and /dev/null differ diff --git a/Documentation/DocBook/v4l/fieldseq_bt.pdf b/Documentation/DocBook/v4l/fieldseq_bt.pdf deleted file mode 100644 index 26598b23f80d..000000000000 Binary files a/Documentation/DocBook/v4l/fieldseq_bt.pdf and /dev/null differ diff --git a/Documentation/DocBook/v4l/fieldseq_tb.gif b/Documentation/DocBook/v4l/fieldseq_tb.gif deleted file mode 100644 index 718492f1cfc7..000000000000 Binary files a/Documentation/DocBook/v4l/fieldseq_tb.gif and /dev/null differ diff --git a/Documentation/DocBook/v4l/fieldseq_tb.pdf b/Documentation/DocBook/v4l/fieldseq_tb.pdf deleted file mode 100644 index 4965b22ddb3a..000000000000 Binary files a/Documentation/DocBook/v4l/fieldseq_tb.pdf and /dev/null differ diff --git a/Documentation/DocBook/v4l/func-close.xml b/Documentation/DocBook/v4l/func-close.xml deleted file mode 100644 index dfb41cbbbec3..000000000000 --- a/Documentation/DocBook/v4l/func-close.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - V4L2 close() - &manvol; - - - - v4l2-close - Close a V4L2 device - - - - - #include <unistd.h> - - int close - int fd - - - - - - Arguments - - - - fd - - &fd; - - - - - - - Description - - Closes the device. Any I/O in progress is terminated and -resources associated with the file descriptor are freed. However data -format parameters, current input or output, control values or other -properties remain unchanged. - - - - Return Value - - The function returns 0 on -success, -1 on failure and the -errno is set appropriately. Possible error -codes: - - - - EBADF - - fd is not a valid open file -descriptor. - - - - - - - diff --git a/Documentation/DocBook/v4l/func-ioctl.xml b/Documentation/DocBook/v4l/func-ioctl.xml deleted file mode 100644 index b60fd37a6295..000000000000 --- a/Documentation/DocBook/v4l/func-ioctl.xml +++ /dev/null @@ -1,145 +0,0 @@ - - - V4L2 ioctl() - &manvol; - - - - v4l2-ioctl - Program a V4L2 device - - - - - #include <sys/ioctl.h> - - int ioctl - int fd - int request - void *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - V4L2 ioctl request code as defined in the videodev2.h header file, for example -VIDIOC_QUERYCAP. - - - - argp - - Pointer to a function parameter, usually a structure. - - - - - - - Description - - The ioctl() function is used to program -V4L2 devices. The argument fd must be an open -file descriptor. An ioctl request has encoded -in it whether the argument is an input, output or read/write -parameter, and the size of the argument argp in -bytes. Macros and defines specifying V4L2 ioctl requests are located -in the videodev2.h header file. -Applications should use their own copy, not include the version in the -kernel sources on the system they compile on. All V4L2 ioctl requests, -their respective function and parameters are specified in . - - - - Return Value - - On success the ioctl() function returns -0 and does not reset the -errno variable. On failure --1 is returned, when the ioctl takes an -output or read/write parameter it remains unmodified, and the -errno variable is set appropriately. See below for -possible error codes. Generic errors like EBADF -or EFAULT are not listed in the sections -discussing individual ioctl requests. - Note ioctls may return undefined error codes. Since errors -may have side effects such as a driver reset applications should -abort on unexpected errors. - - - - EBADF - - fd is not a valid open file -descriptor. - - - - EBUSY - - The property cannot be changed right now. Typically -this error code is returned when I/O is in progress or the driver -supports multiple opens and another process locked the property. - - - - EFAULT - - argp references an inaccessible -memory area. - - - - ENOTTY - - fd is not associated with a -character special device. - - - - EINVAL - - The request or the data pointed -to by argp is not valid. This is a very common -error code, see the individual ioctl requests listed in for actual causes. - - - - ENOMEM - - Not enough physical or virtual memory was available to -complete the request. - - - - ERANGE - - The application attempted to set a control with the -&VIDIOC-S-CTRL; ioctl to a value which is out of bounds. - - - - - - - diff --git a/Documentation/DocBook/v4l/func-mmap.xml b/Documentation/DocBook/v4l/func-mmap.xml deleted file mode 100644 index 786732b64bbd..000000000000 --- a/Documentation/DocBook/v4l/func-mmap.xml +++ /dev/null @@ -1,191 +0,0 @@ - - - V4L2 mmap() - &manvol; - - - - v4l2-mmap - Map device memory into application address space - - - - - -#include <unistd.h> -#include <sys/mman.h> - - void *mmap - void *start - size_t length - int prot - int flags - int fd - off_t offset - - - - - - Arguments - - - start - - Map the buffer to this address in the -application's address space. When the MAP_FIXED -flag is specified, start must be a multiple of the -pagesize and mmap will fail when the specified address -cannot be used. Use of this option is discouraged; applications should -just specify a NULL pointer here. - - - - length - - Length of the memory area to map. This must be the -same value as returned by the driver in the &v4l2-buffer; -length field for the -single-planar API, and the same value as returned by the driver -in the &v4l2-plane; length field for the -multi-planar API. - - - - prot - - The prot argument describes the -desired memory protection. Regardless of the device type and the -direction of data exchange it should be set to -PROT_READ | PROT_WRITE, -permitting read and write access to image buffers. Drivers should -support at least this combination of flags. Note the Linux -video-buf kernel module, which is used by the -bttv, saa7134, saa7146, cx88 and vivi driver supports only -PROT_READ | PROT_WRITE. When -the driver does not support the desired protection the -mmap() function fails. - Note device memory accesses (⪚ the memory on a -graphics card with video capturing hardware) may incur a performance -penalty compared to main memory accesses, or reads may be -significantly slower than writes or vice versa. Other I/O methods may -be more efficient in this case. - - - - flags - - The flags parameter -specifies the type of the mapped object, mapping options and whether -modifications made to the mapped copy of the page are private to the -process or are to be shared with other references. - MAP_FIXED requests that the -driver selects no other address than the one specified. If the -specified address cannot be used, mmap() will fail. If -MAP_FIXED is specified, -start must be a multiple of the pagesize. Use -of this option is discouraged. - One of the MAP_SHARED or -MAP_PRIVATE flags must be set. -MAP_SHARED allows applications to share the -mapped memory with other (⪚ child-) processes. Note the Linux -video-buf module which is used by the bttv, -saa7134, saa7146, cx88 and vivi driver supports only -MAP_SHARED. MAP_PRIVATE -requests copy-on-write semantics. V4L2 applications should not set the -MAP_PRIVATE, MAP_DENYWRITE, -MAP_EXECUTABLE or MAP_ANON -flag. - - - - fd - - &fd; - - - - offset - - Offset of the buffer in device memory. This must be the -same value as returned by the driver in the &v4l2-buffer; -m union offset field for -the single-planar API, and the same value as returned by the driver -in the &v4l2-plane; m union -mem_offset field for the multi-planar API. - - - - - - - Description - - The mmap() function asks to map -length bytes starting at -offset in the memory of the device specified by -fd into the application address space, -preferably at address start. This latter -address is a hint only, and is usually specified as 0. - - Suitable length and offset parameters are queried with the -&VIDIOC-QUERYBUF; ioctl. Buffers must be allocated with the -&VIDIOC-REQBUFS; ioctl before they can be queried. - - To unmap buffers the &func-munmap; function is used. - - - - Return Value - - On success mmap() returns a pointer to -the mapped buffer. On error MAP_FAILED (-1) is -returned, and the errno variable is set -appropriately. Possible error codes are: - - - - EBADF - - fd is not a valid file -descriptor. - - - - EACCES - - fd is -not open for reading and writing. - - - - EINVAL - - The start or -length or offset are not -suitable. (E. g. they are too large, or not aligned on a -PAGESIZE boundary.) - The flags or -prot value is not supported. - No buffers have been allocated with the -&VIDIOC-REQBUFS; ioctl. - - - - ENOMEM - - Not enough physical or virtual memory was available to -complete the request. - - - - - - - diff --git a/Documentation/DocBook/v4l/func-munmap.xml b/Documentation/DocBook/v4l/func-munmap.xml deleted file mode 100644 index e2c4190f9bb6..000000000000 --- a/Documentation/DocBook/v4l/func-munmap.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - V4L2 munmap() - &manvol; - - - - v4l2-munmap - Unmap device memory - - - - - -#include <unistd.h> -#include <sys/mman.h> - - int munmap - void *start - size_t length - - - - - Arguments - - - start - - Address of the mapped buffer as returned by the -&func-mmap; function. - - - - length - - Length of the mapped buffer. This must be the same -value as given to mmap() and returned by the -driver in the &v4l2-buffer; length -field for the single-planar API and in the &v4l2-plane; -length field for the multi-planar API. - - - - - - - Description - - Unmaps a previously with the &func-mmap; function mapped -buffer and frees it, if possible. - - - - Return Value - - On success munmap() returns 0, on -failure -1 and the errno variable is set -appropriately: - - - - EINVAL - - The start or -length is incorrect, or no buffers have been -mapped yet. - - - - - - - diff --git a/Documentation/DocBook/v4l/func-open.xml b/Documentation/DocBook/v4l/func-open.xml deleted file mode 100644 index 7595d07a8c72..000000000000 --- a/Documentation/DocBook/v4l/func-open.xml +++ /dev/null @@ -1,121 +0,0 @@ - - - V4L2 open() - &manvol; - - - - v4l2-open - Open a V4L2 device - - - - - #include <fcntl.h> - - int open - const char *device_name - int flags - - - - - - Arguments - - - - device_name - - Device to be opened. - - - - flags - - Open flags. Access mode must be -O_RDWR. This is just a technicality, input devices -still support only reading and output devices only writing. - When the O_NONBLOCK flag is -given, the read() function and the &VIDIOC-DQBUF; ioctl will return -the &EAGAIN; when no data is available or no buffer is in the driver -outgoing queue, otherwise these functions block until data becomes -available. All V4L2 drivers exchanging data with applications must -support the O_NONBLOCK flag. - Other flags have no effect. - - - - - - Description - - To open a V4L2 device applications call -open() with the desired device name. This -function has no side effects; all data format parameters, current -input or output, control values or other properties remain unchanged. -At the first open() call after loading the driver -they will be reset to default values, drivers are never in an -undefined state. - - - Return Value - - On success open returns the new file -descriptor. On error -1 is returned, and the errno -variable is set appropriately. Possible error codes are: - - - - EACCES - - The caller has no permission to access the -device. - - - - EBUSY - - The driver does not support multiple opens and the -device is already in use. - - - - ENXIO - - No device corresponding to this device special file -exists. - - - - ENOMEM - - Not enough kernel memory was available to complete the -request. - - - - EMFILE - - The process already has the maximum number of -files open. - - - - ENFILE - - The limit on the total number of files open on the -system has been reached. - - - - - - - diff --git a/Documentation/DocBook/v4l/func-poll.xml b/Documentation/DocBook/v4l/func-poll.xml deleted file mode 100644 index ec3c718f5963..000000000000 --- a/Documentation/DocBook/v4l/func-poll.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - V4L2 poll() - &manvol; - - - - v4l2-poll - Wait for some event on a file descriptor - - - - - #include <sys/poll.h> - - int poll - struct pollfd *ufds - unsigned int nfds - int timeout - - - - - - Description - - With the poll() function applications -can suspend execution until the driver has captured data or is ready -to accept data for output. - - When streaming I/O has been negotiated this function waits -until a buffer has been filled or displayed and can be dequeued with -the &VIDIOC-DQBUF; ioctl. When buffers are already in the outgoing -queue of the driver the function returns immediately. - - On success poll() returns the number of -file descriptors that have been selected (that is, file descriptors -for which the revents field of the -respective pollfd structure is non-zero). -Capture devices set the POLLIN and -POLLRDNORM flags in the -revents field, output devices the -POLLOUT and POLLWRNORM -flags. When the function timed out it returns a value of zero, on -failure it returns -1 and the -errno variable is set appropriately. When the -application did not call &VIDIOC-QBUF; or &VIDIOC-STREAMON; yet the -poll() function succeeds, but sets the -POLLERR flag in the -revents field. - - When use of the read() function has -been negotiated and the driver does not capture yet, the -poll function starts capturing. When that fails -it returns a POLLERR as above. Otherwise it waits -until data has been captured and can be read. When the driver captures -continuously (as opposed to, for example, still images) the function -may return immediately. - - When use of the write() function has -been negotiated the poll function just waits -until the driver is ready for a non-blocking -write() call. - - All drivers implementing the read() or -write() function or streaming I/O must also -support the poll() function. - - For more details see the -poll() manual page. - - - - Return Value - - On success, poll() returns the number -structures which have non-zero revents -fields, or zero if the call timed out. On error --1 is returned, and the -errno variable is set appropriately: - - - - EBADF - - One or more of the ufds members -specify an invalid file descriptor. - - - - EBUSY - - The driver does not support multiple read or write -streams and the device is already in use. - - - - EFAULT - - ufds references an inaccessible -memory area. - - - - EINTR - - The call was interrupted by a signal. - - - - EINVAL - - The nfds argument is greater -than OPEN_MAX. - - - - - - - diff --git a/Documentation/DocBook/v4l/func-read.xml b/Documentation/DocBook/v4l/func-read.xml deleted file mode 100644 index a5089bf8873d..000000000000 --- a/Documentation/DocBook/v4l/func-read.xml +++ /dev/null @@ -1,189 +0,0 @@ - - - V4L2 read() - &manvol; - - - - v4l2-read - Read from a V4L2 device - - - - - #include <unistd.h> - - ssize_t read - int fd - void *buf - size_t count - - - - - - Arguments - - - - fd - - &fd; - - - - buf - - - - - - count - - - - - - - - - Description - - read() attempts to read up to -count bytes from file descriptor -fd into the buffer starting at -buf. The layout of the data in the buffer is -discussed in the respective device interface section, see ##. If count is zero, -read() returns zero and has no other results. If -count is greater than -SSIZE_MAX, the result is unspecified. Regardless -of the count value each -read() call will provide at most one frame (two -fields) worth of data. - - By default read() blocks until data -becomes available. When the O_NONBLOCK flag was -given to the &func-open; function it -returns immediately with an &EAGAIN; when no data is available. The -&func-select; or &func-poll; functions -can always be used to suspend execution until data becomes available. All -drivers supporting the read() function must also -support select() and -poll(). - - Drivers can implement read functionality in different -ways, using a single or multiple buffers and discarding the oldest or -newest frames once the internal buffers are filled. - - read() never returns a "snapshot" of a -buffer being filled. Using a single buffer the driver will stop -capturing when the application starts reading the buffer until the -read is finished. Thus only the period of the vertical blanking -interval is available for reading, or the capture rate must fall below -the nominal frame rate of the video standard. - -The behavior of -read() when called during the active picture -period or the vertical blanking separating the top and bottom field -depends on the discarding policy. A driver discarding the oldest -frames keeps capturing into an internal buffer, continuously -overwriting the previously, not read frame, and returns the frame -being received at the time of the read() call as -soon as it is complete. - - A driver discarding the newest frames stops capturing until -the next read() call. The frame being received at -read() time is discarded, returning the following -frame instead. Again this implies a reduction of the capture rate to -one half or less of the nominal frame rate. An example of this model -is the video read mode of the bttv driver, initiating a DMA to user -memory when read() is called and returning when -the DMA finished. - - In the multiple buffer model drivers maintain a ring of -internal buffers, automatically advancing to the next free buffer. -This allows continuous capturing when the application can empty the -buffers fast enough. Again, the behavior when the driver runs out of -free buffers depends on the discarding policy. - - Applications can get and set the number of buffers used -internally by the driver with the &VIDIOC-G-PARM; and &VIDIOC-S-PARM; -ioctls. They are optional, however. The discarding policy is not -reported and cannot be changed. For minimum requirements see . - - - - Return Value - - On success, the number of bytes read is returned. It is not -an error if this number is smaller than the number of bytes requested, -or the amount of data required for one frame. This may happen for -example because read() was interrupted by a -signal. On error, -1 is returned, and the errno -variable is set appropriately. In this case the next read will start -at the beginning of a new frame. Possible error codes are: - - - - EAGAIN - - Non-blocking I/O has been selected using -O_NONBLOCK and no data was immediately available for reading. - - - - EBADF - - fd is not a valid file -descriptor or is not open for reading, or the process already has the -maximum number of files open. - - - - EBUSY - - The driver does not support multiple read streams and the -device is already in use. - - - - EFAULT - - buf references an inaccessible -memory area. - - - - EINTR - - The call was interrupted by a signal before any -data was read. - - - - EIO - - I/O error. This indicates some hardware problem or a -failure to communicate with a remote device (USB camera etc.). - - - - EINVAL - - The read() function is not -supported by this driver, not on this device, or generally not on this -type of device. - - - - - - - diff --git a/Documentation/DocBook/v4l/func-select.xml b/Documentation/DocBook/v4l/func-select.xml deleted file mode 100644 index b6713623181f..000000000000 --- a/Documentation/DocBook/v4l/func-select.xml +++ /dev/null @@ -1,138 +0,0 @@ - - - V4L2 select() - &manvol; - - - - v4l2-select - Synchronous I/O multiplexing - - - - - -#include <sys/time.h> -#include <sys/types.h> -#include <unistd.h> - - int select - int nfds - fd_set *readfds - fd_set *writefds - fd_set *exceptfds - struct timeval *timeout - - - - - - Description - - With the select() function applications -can suspend execution until the driver has captured data or is ready -to accept data for output. - - When streaming I/O has been negotiated this function waits -until a buffer has been filled or displayed and can be dequeued with -the &VIDIOC-DQBUF; ioctl. When buffers are already in the outgoing -queue of the driver the function returns immediately. - - On success select() returns the total -number of bits set in the fd_sets. When the -function timed out it returns a value of zero. On failure it returns --1 and the errno -variable is set appropriately. When the application did not call -&VIDIOC-QBUF; or &VIDIOC-STREAMON; yet the -select() function succeeds, setting the bit of -the file descriptor in readfds or -writefds, but subsequent &VIDIOC-DQBUF; calls -will fail.The Linux kernel implements -select() like the &func-poll; function, but -select() cannot return a -POLLERR. - - - When use of the read() function has -been negotiated and the driver does not capture yet, the -select() function starts capturing. When that -fails, select() returns successful and a -subsequent read() call, which also attempts to -start capturing, will return an appropriate error code. When the -driver captures continuously (as opposed to, for example, still -images) and data is already available the -select() function returns immediately. - - When use of the write() function has -been negotiated the select() function just waits -until the driver is ready for a non-blocking -write() call. - - All drivers implementing the read() or -write() function or streaming I/O must also -support the select() function. - - For more details see the select() -manual page. - - - - - Return Value - - On success, select() returns the number -of descriptors contained in the three returned descriptor sets, which -will be zero if the timeout expired. On error --1 is returned, and the -errno variable is set appropriately; the sets and -timeout are undefined. Possible error codes -are: - - - - EBADF - - One or more of the file descriptor sets specified a -file descriptor that is not open. - - - - EBUSY - - The driver does not support multiple read or write -streams and the device is already in use. - - - - EFAULT - - The readfds, -writefds, exceptfds or -timeout pointer references an inaccessible memory -area. - - - - EINTR - - The call was interrupted by a signal. - - - - EINVAL - - The nfds argument is less than -zero or greater than FD_SETSIZE. - - - - - - - diff --git a/Documentation/DocBook/v4l/func-write.xml b/Documentation/DocBook/v4l/func-write.xml deleted file mode 100644 index 2c09c09371c3..000000000000 --- a/Documentation/DocBook/v4l/func-write.xml +++ /dev/null @@ -1,136 +0,0 @@ - - - V4L2 write() - &manvol; - - - - v4l2-write - Write to a V4L2 device - - - - - #include <unistd.h> - - ssize_t write - int fd - void *buf - size_t count - - - - - - Arguments - - - - fd - - &fd; - - - - buf - - - - - - count - - - - - - - - - Description - - write() writes up to -count bytes to the device referenced by the -file descriptor fd from the buffer starting at -buf. When the hardware outputs are not active -yet, this function enables them. When count is -zero, write() returns -0 without any other effect. - - When the application does not provide more data in time, the -previous video frame, raw VBI image, sliced VPS or WSS data is -displayed again. Sliced Teletext or Closed Caption data is not -repeated, the driver inserts a blank line instead. - - - - Return Value - - On success, the number of bytes written are returned. Zero -indicates nothing was written. On error, -1 -is returned, and the errno variable is set -appropriately. In this case the next write will start at the beginning -of a new frame. Possible error codes are: - - - - EAGAIN - - Non-blocking I/O has been selected using the O_NONBLOCK flag and no -buffer space was available to write the data immediately. - - - - EBADF - - fd is not a valid file -descriptor or is not open for writing. - - - - EBUSY - - The driver does not support multiple write streams and the -device is already in use. - - - - EFAULT - - buf references an inaccessible -memory area. - - - - EINTR - - The call was interrupted by a signal before any -data was written. - - - - EIO - - I/O error. This indicates some hardware problem. - - - - EINVAL - - The write() function is not -supported by this driver, not on this device, or generally not on this -type of device. - - - - - - - diff --git a/Documentation/DocBook/v4l/io.xml b/Documentation/DocBook/v4l/io.xml deleted file mode 100644 index 227e7ac45a06..000000000000 --- a/Documentation/DocBook/v4l/io.xml +++ /dev/null @@ -1,1265 +0,0 @@ - Input/Output - - The V4L2 API defines several different methods to read from or -write to a device. All drivers exchanging data with applications must -support at least one of them. - - The classic I/O method using the read() -and write() function is automatically selected -after opening a V4L2 device. When the driver does not support this -method attempts to read or write will fail at any time. - - Other methods must be negotiated. To select the streaming I/O -method with memory mapped or user buffers applications call the -&VIDIOC-REQBUFS; ioctl. The asynchronous I/O method is not defined -yet. - - Video overlay can be considered another I/O method, although -the application does not directly receive the image data. It is -selected by initiating video overlay with the &VIDIOC-S-FMT; ioctl. -For more information see . - - Generally exactly one I/O method, including overlay, is -associated with each file descriptor. The only exceptions are -applications not exchanging data with a driver ("panel applications", -see ) and drivers permitting simultaneous video capturing -and overlay using the same file descriptor, for compatibility with V4L -and earlier versions of V4L2. - - VIDIOC_S_FMT and -VIDIOC_REQBUFS would permit this to some degree, -but for simplicity drivers need not support switching the I/O method -(after first switching away from read/write) other than by closing -and reopening the device. - - The following sections describe the various I/O methods in -more detail. - -
- Read/Write - - Input and output devices support the -read() and write() function, -respectively, when the V4L2_CAP_READWRITE flag in -the capabilities field of &v4l2-capability; -returned by the &VIDIOC-QUERYCAP; ioctl is set. - - Drivers may need the CPU to copy the data, but they may also -support DMA to or from user memory, so this I/O method is not -necessarily less efficient than other methods merely exchanging buffer -pointers. It is considered inferior though because no meta-information -like frame counters or timestamps are passed. This information is -necessary to recognize frame dropping and to synchronize with other -data streams. However this is also the simplest I/O method, requiring -little or no setup to exchange data. It permits command line stunts -like this (the vidctrl tool is -fictitious): - - - -> vidctrl /dev/video --input=0 --format=YUYV --size=352x288 -> dd if=/dev/video of=myimage.422 bs=202752 count=1 - - - - To read from the device applications use the -&func-read; function, to write the &func-write; function. -Drivers must implement one I/O method if they -exchange data with applications, but it need not be this. - It would be desirable if applications could depend on -drivers supporting all I/O interfaces, but as much as the complex -memory mapping I/O can be inadequate for some devices we have no -reason to require this interface, which is most useful for simple -applications capturing still images. - When reading or writing is supported, the driver -must also support the &func-select; and &func-poll; -function. - At the driver level select() and -poll() are the same, and -select() is too important to be optional. - -
- -
- Streaming I/O (Memory Mapping) - - Input and output devices support this I/O method when the -V4L2_CAP_STREAMING flag in the -capabilities field of &v4l2-capability; -returned by the &VIDIOC-QUERYCAP; ioctl is set. There are two -streaming methods, to determine if the memory mapping flavor is -supported applications must call the &VIDIOC-REQBUFS; ioctl. - - Streaming is an I/O method where only pointers to buffers -are exchanged between application and driver, the data itself is not -copied. Memory mapping is primarily intended to map buffers in device -memory into the application's address space. Device memory can be for -example the video memory on a graphics card with a video capture -add-on. However, being the most efficient I/O method available for a -long time, many other drivers support streaming as well, allocating -buffers in DMA-able main memory. - - A driver can support many sets of buffers. Each set is -identified by a unique buffer type value. The sets are independent and -each set can hold a different type of data. To access different sets -at the same time different file descriptors must be used. - One could use one file descriptor and set the buffer -type field accordingly when calling &VIDIOC-QBUF; etc., but it makes -the select() function ambiguous. We also like the -clean approach of one file descriptor per logical stream. Video -overlay for example is also a logical stream, although the CPU is not -needed for continuous operation. - - - To allocate device buffers applications call the -&VIDIOC-REQBUFS; ioctl with the desired number of buffers and buffer -type, for example V4L2_BUF_TYPE_VIDEO_CAPTURE. -This ioctl can also be used to change the number of buffers or to free -the allocated memory, provided none of the buffers are still -mapped. - - Before applications can access the buffers they must map -them into their address space with the &func-mmap; function. The -location of the buffers in device memory can be determined with the -&VIDIOC-QUERYBUF; ioctl. In the single-planar API case, the -m.offset and length -returned in a &v4l2-buffer; are passed as sixth and second parameter to the -mmap() function. When using the multi-planar API, -struct &v4l2-buffer; contains an array of &v4l2-plane; structures, each -containing its own m.offset and -length. When using the multi-planar API, every -plane of every buffer has to be mapped separately, so the number of -calls to &func-mmap; should be equal to number of buffers times number of -planes in each buffer. The offset and length values must not be modified. -Remember, the buffers are allocated in physical memory, as opposed to virtual -memory, which can be swapped out to disk. Applications should free the buffers -as soon as possible with the &func-munmap; function. - - - Mapping buffers in the single-planar API - -&v4l2-requestbuffers; reqbuf; -struct { - void *start; - size_t length; -} *buffers; -unsigned int i; - -memset(&reqbuf, 0, sizeof(reqbuf)); -reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -reqbuf.memory = V4L2_MEMORY_MMAP; -reqbuf.count = 20; - -if (-1 == ioctl (fd, &VIDIOC-REQBUFS;, &reqbuf)) { - if (errno == EINVAL) - printf("Video capturing or mmap-streaming is not supported\n"); - else - perror("VIDIOC_REQBUFS"); - - exit(EXIT_FAILURE); -} - -/* We want at least five buffers. */ - -if (reqbuf.count < 5) { - /* You may need to free the buffers here. */ - printf("Not enough buffer memory\n"); - exit(EXIT_FAILURE); -} - -buffers = calloc(reqbuf.count, sizeof(*buffers)); -assert(buffers != NULL); - -for (i = 0; i < reqbuf.count; i++) { - &v4l2-buffer; buffer; - - memset(&buffer, 0, sizeof(buffer)); - buffer.type = reqbuf.type; - buffer.memory = V4L2_MEMORY_MMAP; - buffer.index = i; - - if (-1 == ioctl (fd, &VIDIOC-QUERYBUF;, &buffer)) { - perror("VIDIOC_QUERYBUF"); - exit(EXIT_FAILURE); - } - - buffers[i].length = buffer.length; /* remember for munmap() */ - - buffers[i].start = mmap(NULL, buffer.length, - PROT_READ | PROT_WRITE, /* recommended */ - MAP_SHARED, /* recommended */ - fd, buffer.m.offset); - - if (MAP_FAILED == buffers[i].start) { - /* If you do not exit here you should unmap() and free() - the buffers mapped so far. */ - perror("mmap"); - exit(EXIT_FAILURE); - } -} - -/* Cleanup. */ - -for (i = 0; i < reqbuf.count; i++) - munmap(buffers[i].start, buffers[i].length); - - - - - Mapping buffers in the multi-planar API - -&v4l2-requestbuffers; reqbuf; -/* Our current format uses 3 planes per buffer */ -#define FMT_NUM_PLANES = 3; - -struct { - void *start[FMT_NUM_PLANES]; - size_t length[FMT_NUM_PLANES]; -} *buffers; -unsigned int i, j; - -memset(&reqbuf, 0, sizeof(reqbuf)); -reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; -reqbuf.memory = V4L2_MEMORY_MMAP; -reqbuf.count = 20; - -if (ioctl(fd, &VIDIOC-REQBUFS;, &reqbuf) < 0) { - if (errno == EINVAL) - printf("Video capturing or mmap-streaming is not supported\n"); - else - perror("VIDIOC_REQBUFS"); - - exit(EXIT_FAILURE); -} - -/* We want at least five buffers. */ - -if (reqbuf.count < 5) { - /* You may need to free the buffers here. */ - printf("Not enough buffer memory\n"); - exit(EXIT_FAILURE); -} - -buffers = calloc(reqbuf.count, sizeof(*buffers)); -assert(buffers != NULL); - -for (i = 0; i < reqbuf.count; i++) { - &v4l2-buffer; buffer; - &v4l2-plane; planes[FMT_NUM_PLANES]; - - memset(&buffer, 0, sizeof(buffer)); - buffer.type = reqbuf.type; - buffer.memory = V4L2_MEMORY_MMAP; - buffer.index = i; - /* length in struct v4l2_buffer in multi-planar API stores the size - * of planes array. */ - buffer.length = FMT_NUM_PLANES; - buffer.m.planes = planes; - - if (ioctl(fd, &VIDIOC-QUERYBUF;, &buffer) < 0) { - perror("VIDIOC_QUERYBUF"); - exit(EXIT_FAILURE); - } - - /* Every plane has to be mapped separately */ - for (j = 0; j < FMT_NUM_PLANES; j++) { - buffers[i].length[j] = buffer.m.planes[j].length; /* remember for munmap() */ - - buffers[i].start[j] = mmap(NULL, buffer.m.planes[j].length, - PROT_READ | PROT_WRITE, /* recommended */ - MAP_SHARED, /* recommended */ - fd, buffer.m.planes[j].m.offset); - - if (MAP_FAILED == buffers[i].start[j]) { - /* If you do not exit here you should unmap() and free() - the buffers and planes mapped so far. */ - perror("mmap"); - exit(EXIT_FAILURE); - } - } -} - -/* Cleanup. */ - -for (i = 0; i < reqbuf.count; i++) - for (j = 0; j < FMT_NUM_PLANES; j++) - munmap(buffers[i].start[j], buffers[i].length[j]); - - - - Conceptually streaming drivers maintain two buffer queues, an incoming -and an outgoing queue. They separate the synchronous capture or output -operation locked to a video clock from the application which is -subject to random disk or network delays and preemption by -other processes, thereby reducing the probability of data loss. -The queues are organized as FIFOs, buffers will be -output in the order enqueued in the incoming FIFO, and were -captured in the order dequeued from the outgoing FIFO. - - The driver may require a minimum number of buffers enqueued -at all times to function, apart of this no limit exists on the number -of buffers applications can enqueue in advance, or dequeue and -process. They can also enqueue in a different order than buffers have -been dequeued, and the driver can fill enqueued -empty buffers in any order. - Random enqueue order permits applications processing -images out of order (such as video codecs) to return buffers earlier, -reducing the probability of data loss. Random fill order allows -drivers to reuse buffers on a LIFO-basis, taking advantage of caches -holding scatter-gather lists and the like. - The index number of a buffer (&v4l2-buffer; -index) plays no role here, it only -identifies the buffer. - - Initially all mapped buffers are in dequeued state, -inaccessible by the driver. For capturing applications it is customary -to first enqueue all mapped buffers, then to start capturing and enter -the read loop. Here the application waits until a filled buffer can be -dequeued, and re-enqueues the buffer when the data is no longer -needed. Output applications fill and enqueue buffers, when enough -buffers are stacked up the output is started with -VIDIOC_STREAMON. In the write loop, when -the application runs out of free buffers, it must wait until an empty -buffer can be dequeued and reused. - - To enqueue and dequeue a buffer applications use the -&VIDIOC-QBUF; and &VIDIOC-DQBUF; ioctl. The status of a buffer being -mapped, enqueued, full or empty can be determined at any time using the -&VIDIOC-QUERYBUF; ioctl. Two methods exist to suspend execution of the -application until one or more buffers can be dequeued. By default -VIDIOC_DQBUF blocks when no buffer is in the -outgoing queue. When the O_NONBLOCK flag was -given to the &func-open; function, VIDIOC_DQBUF -returns immediately with an &EAGAIN; when no buffer is available. The -&func-select; or &func-poll; function are always available. - - To start and stop capturing or output applications call the -&VIDIOC-STREAMON; and &VIDIOC-STREAMOFF; ioctl. Note -VIDIOC_STREAMOFF removes all buffers from both -queues as a side effect. Since there is no notion of doing anything -"now" on a multitasking system, if an application needs to synchronize -with another event it should examine the &v4l2-buffer; -timestamp of captured buffers, or set the -field before enqueuing buffers for output. - - Drivers implementing memory mapping I/O must -support the VIDIOC_REQBUFS, -VIDIOC_QUERYBUF, -VIDIOC_QBUF, VIDIOC_DQBUF, -VIDIOC_STREAMON and -VIDIOC_STREAMOFF ioctl, the -mmap(), munmap(), -select() and poll() -function. - At the driver level select() and -poll() are the same, and -select() is too important to be optional. The -rest should be evident. - - - [capture example] - -
- -
- Streaming I/O (User Pointers) - - Input and output devices support this I/O method when the -V4L2_CAP_STREAMING flag in the -capabilities field of &v4l2-capability; -returned by the &VIDIOC-QUERYCAP; ioctl is set. If the particular user -pointer method (not only memory mapping) is supported must be -determined by calling the &VIDIOC-REQBUFS; ioctl. - - This I/O method combines advantages of the read/write and -memory mapping methods. Buffers (planes) are allocated by the application -itself, and can reside for example in virtual or shared memory. Only -pointers to data are exchanged, these pointers and meta-information -are passed in &v4l2-buffer; (or in &v4l2-plane; in the multi-planar API case). -The driver must be switched into user pointer I/O mode by calling the -&VIDIOC-REQBUFS; with the desired buffer type. No buffers (planes) are allocated -beforehand, consequently they are not indexed and cannot be queried like mapped -buffers with the VIDIOC_QUERYBUF ioctl. - - - Initiating streaming I/O with user pointers - - -&v4l2-requestbuffers; reqbuf; - -memset (&reqbuf, 0, sizeof (reqbuf)); -reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -reqbuf.memory = V4L2_MEMORY_USERPTR; - -if (ioctl (fd, &VIDIOC-REQBUFS;, &reqbuf) == -1) { - if (errno == EINVAL) - printf ("Video capturing or user pointer streaming is not supported\n"); - else - perror ("VIDIOC_REQBUFS"); - - exit (EXIT_FAILURE); -} - - - - Buffer (plane) addresses and sizes are passed on the fly with the -&VIDIOC-QBUF; ioctl. Although buffers are commonly cycled, -applications can pass different addresses and sizes at each -VIDIOC_QBUF call. If required by the hardware the -driver swaps memory pages within physical memory to create a -continuous area of memory. This happens transparently to the -application in the virtual memory subsystem of the kernel. When buffer -pages have been swapped out to disk they are brought back and finally -locked in physical memory for DMA. - We expect that frequently used buffers are typically not -swapped out. Anyway, the process of swapping, locking or generating -scatter-gather lists may be time consuming. The delay can be masked by -the depth of the incoming buffer queue, and perhaps by maintaining -caches assuming a buffer will be soon enqueued again. On the other -hand, to optimize memory usage drivers can limit the number of buffers -locked in advance and recycle the most recently used buffers first. Of -course, the pages of empty buffers in the incoming queue need not be -saved to disk. Output buffers must be saved on the incoming and -outgoing queue because an application may share them with other -processes. - - - Filled or displayed buffers are dequeued with the -&VIDIOC-DQBUF; ioctl. The driver can unlock the memory pages at any -time between the completion of the DMA and this ioctl. The memory is -also unlocked when &VIDIOC-STREAMOFF; is called, &VIDIOC-REQBUFS;, or -when the device is closed. Applications must take care not to free -buffers without dequeuing. For once, the buffers remain locked until -further, wasting physical memory. Second the driver will not be -notified when the memory is returned to the application's free list -and subsequently reused for other purposes, possibly completing the -requested DMA and overwriting valuable data. - - For capturing applications it is customary to enqueue a -number of empty buffers, to start capturing and enter the read loop. -Here the application waits until a filled buffer can be dequeued, and -re-enqueues the buffer when the data is no longer needed. Output -applications fill and enqueue buffers, when enough buffers are stacked -up output is started. In the write loop, when the application -runs out of free buffers it must wait until an empty buffer can be -dequeued and reused. Two methods exist to suspend execution of the -application until one or more buffers can be dequeued. By default -VIDIOC_DQBUF blocks when no buffer is in the -outgoing queue. When the O_NONBLOCK flag was -given to the &func-open; function, VIDIOC_DQBUF -returns immediately with an &EAGAIN; when no buffer is available. The -&func-select; or &func-poll; function are always available. - - To start and stop capturing or output applications call the -&VIDIOC-STREAMON; and &VIDIOC-STREAMOFF; ioctl. Note -VIDIOC_STREAMOFF removes all buffers from both -queues and unlocks all buffers as a side effect. Since there is no -notion of doing anything "now" on a multitasking system, if an -application needs to synchronize with another event it should examine -the &v4l2-buffer; timestamp of captured -buffers, or set the field before enqueuing buffers for output. - - Drivers implementing user pointer I/O must -support the VIDIOC_REQBUFS, -VIDIOC_QBUF, VIDIOC_DQBUF, -VIDIOC_STREAMON and -VIDIOC_STREAMOFF ioctl, the -select() and poll() function. - At the driver level select() and -poll() are the same, and -select() is too important to be optional. The -rest should be evident. - -
- -
- Asynchronous I/O - - This method is not defined yet. -
- -
- Buffers - - A buffer contains data exchanged by application and -driver using one of the Streaming I/O methods. In the multi-planar API, the -data is held in planes, while the buffer structure acts as a container -for the planes. Only pointers to buffers (planes) are exchanged, the data -itself is not copied. These pointers, together with meta-information like -timestamps or field parity, are stored in a struct -v4l2_buffer, argument to -the &VIDIOC-QUERYBUF;, &VIDIOC-QBUF; and &VIDIOC-DQBUF; ioctl. -In the multi-planar API, some plane-specific members of struct -v4l2_buffer, such as pointers and sizes for each -plane, are stored in struct v4l2_plane instead. -In that case, struct v4l2_buffer contains an array of -plane structures. - - Nominally timestamps refer to the first data byte transmitted. -In practice however the wide range of hardware covered by the V4L2 API -limits timestamp accuracy. Often an interrupt routine will -sample the system clock shortly after the field or frame was stored -completely in memory. So applications must expect a constant -difference up to one field or frame period plus a small (few scan -lines) random error. The delay and error can be much -larger due to compression or transmission over an external bus when -the frames are not properly stamped by the sender. This is frequently -the case with USB cameras. Here timestamps refer to the instant the -field or frame was received by the driver, not the capture time. These -devices identify by not enumerating any video standards, see . - - Similar limitations apply to output timestamps. Typically -the video hardware locks to a clock controlling the video timing, the -horizontal and vertical synchronization pulses. At some point in the -line sequence, possibly the vertical blanking, an interrupt routine -samples the system clock, compares against the timestamp and programs -the hardware to repeat the previous field or frame, or to display the -buffer contents. - - Apart of limitations of the video device and natural -inaccuracies of all clocks, it should be noted system time itself is -not perfectly stable. It can be affected by power saving cycles, -warped to insert leap seconds, or even turned back or forth by the -system administrator affecting long term measurements. - Since no other Linux multimedia -API supports unadjusted time it would be foolish to introduce here. We -must use a universally supported clock to synchronize different media, -hence time of day. - - - - struct <structname>v4l2_buffer</structname> - - &cs-ustr; - - - __u32 - index - - Number of the buffer, set by the application. This -field is only used for memory mapping I/O -and can range from zero to the number of buffers allocated -with the &VIDIOC-REQBUFS; ioctl (&v4l2-requestbuffers; count) minus one. - - - &v4l2-buf-type; - type - - Type of the buffer, same as &v4l2-format; -type or &v4l2-requestbuffers; -type, set by the application. - - - __u32 - bytesused - - The number of bytes occupied by the data in the -buffer. It depends on the negotiated data format and may change with -each buffer for compressed variable size data like JPEG images. -Drivers must set this field when type -refers to an input stream, applications when an output stream. - - - __u32 - flags - - Flags set by the application or driver, see . - - - &v4l2-field; - field - - Indicates the field order of the image in the -buffer, see . This field is not used when -the buffer contains VBI data. Drivers must set it when -type refers to an input stream, -applications when an output stream. - - - struct timeval - timestamp - - For input streams this is the -system time (as returned by the gettimeofday() -function) when the first data byte was captured. For output streams -the data will not be displayed before this time, secondary to the -nominal frame rate determined by the current video standard in -enqueued order. Applications can for example zero this field to -display frames as soon as possible. The driver stores the time at -which the first data byte was actually sent out in the -timestamp field. This permits -applications to monitor the drift between the video and system -clock. - - - &v4l2-timecode; - timecode - - When type is -V4L2_BUF_TYPE_VIDEO_CAPTURE and the -V4L2_BUF_FLAG_TIMECODE flag is set in -flags, this structure contains a frame -timecode. In V4L2_FIELD_ALTERNATE -mode the top and bottom field contain the same timecode. -Timecodes are intended to help video editing and are typically recorded on -video tapes, but also embedded in compressed formats like MPEG. This -field is independent of the timestamp and -sequence fields. - - - __u32 - sequence - - Set by the driver, counting the frames in the -sequence. - - - In V4L2_FIELD_ALTERNATE mode the top and -bottom field have the same sequence number. The count starts at zero -and includes dropped or repeated frames. A dropped frame was received -by an input device but could not be stored due to lack of free buffer -space. A repeated frame was displayed again by an output device -because the application did not pass new data in -time.Note this may count the frames received -e.g. over USB, without taking into account the frames dropped by the -remote hardware due to limited compression throughput or bus -bandwidth. These devices identify by not enumerating any video -standards, see . - - - &v4l2-memory; - memory - - This field must be set by applications and/or drivers -in accordance with the selected I/O method. - - - union - m - - - - __u32 - offset - For the single-planar API and when -memory is V4L2_MEMORY_MMAP this -is the offset of the buffer from the start of the device memory. The value is -returned by the driver and apart of serving as parameter to the &func-mmap; -function not useful for applications. See for details - - - - - unsigned long - userptr - For the single-planar API and when -memory is V4L2_MEMORY_USERPTR -this is a pointer to the buffer (casted to unsigned long type) in virtual -memory, set by the application. See for details. - - - - - struct v4l2_plane - *planes - When using the multi-planar API, contains a userspace pointer - to an array of &v4l2-plane;. The size of the array should be put - in the length field of this - v4l2_buffer structure. - - - __u32 - length - - Size of the buffer (not the payload) in bytes for the - single-planar API. For the multi-planar API should contain the - number of elements in the planes array. - - - - __u32 - input - - Some video capture drivers support rapid and -synchronous video input changes, a function useful for example in -video surveillance applications. For this purpose applications set the -V4L2_BUF_FLAG_INPUT flag, and this field to the -number of a video input as in &v4l2-input; field -index. - - - __u32 - reserved - - A place holder for future extensions and custom -(driver defined) buffer types -V4L2_BUF_TYPE_PRIVATE and higher. Applications -should set this to 0. - - - -
- - - struct <structname>v4l2_plane</structname> - - &cs-ustr; - - - __u32 - bytesused - - The number of bytes occupied by data in the plane - (its payload). - - - __u32 - length - - Size in bytes of the plane (not its payload). - - - union - m - - - - - - __u32 - mem_offset - When the memory type in the containing &v4l2-buffer; is - V4L2_MEMORY_MMAP, this is the value that - should be passed to &func-mmap;, similar to the - offset field in &v4l2-buffer;. - - - - __unsigned long - userptr - When the memory type in the containing &v4l2-buffer; is - V4L2_MEMORY_USERPTR, this is a userspace - pointer to the memory allocated for this plane by an application. - - - - __u32 - data_offset - - Offset in bytes to video data in the plane, if applicable. - - - - __u32 - reserved[11] - - Reserved for future use. Should be zeroed by an - application. - - - -
- - - enum v4l2_buf_type - - &cs-def; - - - V4L2_BUF_TYPE_VIDEO_CAPTURE - 1 - Buffer of a single-planar video capture stream, see . - - - V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE - - 9 - Buffer of a multi-planar video capture stream, see . - - - V4L2_BUF_TYPE_VIDEO_OUTPUT - 2 - Buffer of a single-planar video output stream, see . - - - V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE - - 10 - Buffer of a multi-planar video output stream, see . - - - V4L2_BUF_TYPE_VIDEO_OVERLAY - 3 - Buffer for video overlay, see . - - - V4L2_BUF_TYPE_VBI_CAPTURE - 4 - Buffer of a raw VBI capture stream, see . - - - V4L2_BUF_TYPE_VBI_OUTPUT - 5 - Buffer of a raw VBI output stream, see . - - - V4L2_BUF_TYPE_SLICED_VBI_CAPTURE - 6 - Buffer of a sliced VBI capture stream, see . - - - V4L2_BUF_TYPE_SLICED_VBI_OUTPUT - 7 - Buffer of a sliced VBI output stream, see . - - - V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY - 8 - Buffer for video output overlay (OSD), see . Status: Experimental. - - - V4L2_BUF_TYPE_PRIVATE - 0x80 - This and higher values are reserved for custom -(driver defined) buffer types. - - - -
- - - Buffer Flags - - &cs-def; - - - V4L2_BUF_FLAG_MAPPED - 0x0001 - The buffer resides in device memory and has been mapped -into the application's address space, see for details. -Drivers set or clear this flag when the -VIDIOC_QUERYBUF, VIDIOC_QBUF or VIDIOC_DQBUF ioctl is called. Set by the driver. - - - V4L2_BUF_FLAG_QUEUED - 0x0002 - Internally drivers maintain two buffer queues, an -incoming and outgoing queue. When this flag is set, the buffer is -currently on the incoming queue. It automatically moves to the -outgoing queue after the buffer has been filled (capture devices) or -displayed (output devices). Drivers set or clear this flag when the -VIDIOC_QUERYBUF ioctl is called. After -(successful) calling the VIDIOC_QBUF ioctl it is -always set and after VIDIOC_DQBUF always -cleared. - - - V4L2_BUF_FLAG_DONE - 0x0004 - When this flag is set, the buffer is currently on -the outgoing queue, ready to be dequeued from the driver. Drivers set -or clear this flag when the VIDIOC_QUERYBUF ioctl -is called. After calling the VIDIOC_QBUF or -VIDIOC_DQBUF it is always cleared. Of course a -buffer cannot be on both queues at the same time, the -V4L2_BUF_FLAG_QUEUED and -V4L2_BUF_FLAG_DONE flag are mutually exclusive. -They can be both cleared however, then the buffer is in "dequeued" -state, in the application domain to say so. - - - V4L2_BUF_FLAG_ERROR - 0x0040 - When this flag is set, the buffer has been dequeued - successfully, although the data might have been corrupted. - This is recoverable, streaming may continue as normal and - the buffer may be reused normally. - Drivers set this flag when the VIDIOC_DQBUF - ioctl is called. - - - V4L2_BUF_FLAG_KEYFRAME - 0x0008 - Drivers set or clear this flag when calling the -VIDIOC_DQBUF ioctl. It may be set by video -capture devices when the buffer contains a compressed image which is a -key frame (or field), &ie; can be decompressed on its own. - - - V4L2_BUF_FLAG_PFRAME - 0x0010 - Similar to V4L2_BUF_FLAG_KEYFRAME -this flags predicted frames or fields which contain only differences to a -previous key frame. - - - V4L2_BUF_FLAG_BFRAME - 0x0020 - Similar to V4L2_BUF_FLAG_PFRAME - this is a bidirectional predicted frame or field. [ooc tbd] - - - V4L2_BUF_FLAG_TIMECODE - 0x0100 - The timecode field is valid. -Drivers set or clear this flag when the VIDIOC_DQBUF -ioctl is called. - - - V4L2_BUF_FLAG_INPUT - 0x0200 - The input field is valid. -Applications set or clear this flag before calling the -VIDIOC_QBUF ioctl. - - - -
- - - enum v4l2_memory - - &cs-def; - - - V4L2_MEMORY_MMAP - 1 - The buffer is used for memory -mapping I/O. - - - V4L2_MEMORY_USERPTR - 2 - The buffer is used for user -pointer I/O. - - - V4L2_MEMORY_OVERLAY - 3 - [to do] - - - -
- -
- Timecodes - - The v4l2_timecode structure is -designed to hold a or similar timecode. -(struct timeval timestamps are stored in -&v4l2-buffer; field timestamp.) - - - struct <structname>v4l2_timecode</structname> - - &cs-str; - - - __u32 - type - Frame rate the timecodes are based on, see . - - - __u32 - flags - Timecode flags, see . - - - __u8 - frames - Frame count, 0 ... 23/24/29/49/59, depending on the - type of timecode. - - - __u8 - seconds - Seconds count, 0 ... 59. This is a binary, not BCD number. - - - __u8 - minutes - Minutes count, 0 ... 59. This is a binary, not BCD number. - - - __u8 - hours - Hours count, 0 ... 29. This is a binary, not BCD number. - - - __u8 - userbits[4] - The "user group" bits from the timecode. - - - -
- - - Timecode Types - - &cs-def; - - - V4L2_TC_TYPE_24FPS - 1 - 24 frames per second, i. e. film. - - - V4L2_TC_TYPE_25FPS - 2 - 25 frames per second, &ie; PAL or SECAM video. - - - V4L2_TC_TYPE_30FPS - 3 - 30 frames per second, &ie; NTSC video. - - - V4L2_TC_TYPE_50FPS - 4 - - - - V4L2_TC_TYPE_60FPS - 5 - - - - -
- - - Timecode Flags - - &cs-def; - - - V4L2_TC_FLAG_DROPFRAME - 0x0001 - Indicates "drop frame" semantics for counting frames -in 29.97 fps material. When set, frame numbers 0 and 1 at the start of -each minute, except minutes 0, 10, 20, 30, 40, 50 are omitted from the -count. - - - V4L2_TC_FLAG_COLORFRAME - 0x0002 - The "color frame" flag. - - - V4L2_TC_USERBITS_field - 0x000C - Field mask for the "binary group flags". - - - V4L2_TC_USERBITS_USERDEFINED - 0x0000 - Unspecified format. - - - V4L2_TC_USERBITS_8BITCHARS - 0x0008 - 8-bit ISO characters. - - - -
-
-
- -
- Field Order - - We have to distinguish between progressive and interlaced -video. Progressive video transmits all lines of a video image -sequentially. Interlaced video divides an image into two fields, -containing only the odd and even lines of the image, respectively. -Alternating the so called odd and even field are transmitted, and due -to a small delay between fields a cathode ray TV displays the lines -interleaved, yielding the original frame. This curious technique was -invented because at refresh rates similar to film the image would -fade out too quickly. Transmitting fields reduces the flicker without -the necessity of doubling the frame rate and with it the bandwidth -required for each channel. - - It is important to understand a video camera does not expose -one frame at a time, merely transmitting the frames separated into -fields. The fields are in fact captured at two different instances in -time. An object on screen may well move between one field and the -next. For applications analysing motion it is of paramount importance -to recognize which field of a frame is older, the temporal -order. - - When the driver provides or accepts images field by field -rather than interleaved, it is also important applications understand -how the fields combine to frames. We distinguish between top (aka odd) and -bottom (aka even) fields, the spatial order: The first line -of the top field is the first line of an interlaced frame, the first -line of the bottom field is the second line of that frame. - - However because fields were captured one after the other, -arguing whether a frame commences with the top or bottom field is -pointless. Any two successive top and bottom, or bottom and top fields -yield a valid frame. Only when the source was progressive to begin -with, ⪚ when transferring film to video, two fields may come from -the same frame, creating a natural order. - - Counter to intuition the top field is not necessarily the -older field. Whether the older field contains the top or bottom lines -is a convention determined by the video standard. Hence the -distinction between temporal and spatial order of fields. The diagrams -below should make this clearer. - - All video capture and output devices must report the current -field order. Some drivers may permit the selection of a different -order, to this end applications initialize the -field field of &v4l2-pix-format; before -calling the &VIDIOC-S-FMT; ioctl. If this is not desired it should -have the value V4L2_FIELD_ANY (0). - - - enum v4l2_field - - &cs-def; - - - V4L2_FIELD_ANY - 0 - Applications request this field order when any -one of the V4L2_FIELD_NONE, -V4L2_FIELD_TOP, -V4L2_FIELD_BOTTOM, or -V4L2_FIELD_INTERLACED formats is acceptable. -Drivers choose depending on hardware capabilities or e. g. the -requested image size, and return the actual field order. &v4l2-buffer; -field can never be -V4L2_FIELD_ANY. - - - V4L2_FIELD_NONE - 1 - Images are in progressive format, not interlaced. -The driver may also indicate this order when it cannot distinguish -between V4L2_FIELD_TOP and -V4L2_FIELD_BOTTOM. - - - V4L2_FIELD_TOP - 2 - Images consist of the top (aka odd) field only. - - - V4L2_FIELD_BOTTOM - 3 - Images consist of the bottom (aka even) field only. -Applications may wish to prevent a device from capturing interlaced -images because they will have "comb" or "feathering" artefacts around -moving objects. - - - V4L2_FIELD_INTERLACED - 4 - Images contain both fields, interleaved line by -line. The temporal order of the fields (whether the top or bottom -field is first transmitted) depends on the current video standard. -M/NTSC transmits the bottom field first, all other standards the top -field first. - - - V4L2_FIELD_SEQ_TB - 5 - Images contain both fields, the top field lines -are stored first in memory, immediately followed by the bottom field -lines. Fields are always stored in temporal order, the older one first -in memory. Image sizes refer to the frame, not fields. - - - V4L2_FIELD_SEQ_BT - 6 - Images contain both fields, the bottom field -lines are stored first in memory, immediately followed by the top -field lines. Fields are always stored in temporal order, the older one -first in memory. Image sizes refer to the frame, not fields. - - - V4L2_FIELD_ALTERNATE - 7 - The two fields of a frame are passed in separate -buffers, in temporal order, &ie; the older one first. To indicate the field -parity (whether the current field is a top or bottom field) the driver -or application, depending on data direction, must set &v4l2-buffer; -field to -V4L2_FIELD_TOP or -V4L2_FIELD_BOTTOM. Any two successive fields pair -to build a frame. If fields are successive, without any dropped fields -between them (fields can drop individually), can be determined from -the &v4l2-buffer; sequence field. Image -sizes refer to the frame, not fields. This format cannot be selected -when using the read/write I/O method. - - - V4L2_FIELD_INTERLACED_TB - 8 - Images contain both fields, interleaved line by -line, top field first. The top field is transmitted first. - - - V4L2_FIELD_INTERLACED_BT - 9 - Images contain both fields, interleaved line by -line, top field first. The bottom field is transmitted first. - - - -
- -
- Field Order, Top Field First Transmitted - - - - - - - - -
- -
- Field Order, Bottom Field First Transmitted - - - - - - - - -
-
- - diff --git a/Documentation/DocBook/v4l/keytable.c.xml b/Documentation/DocBook/v4l/keytable.c.xml deleted file mode 100644 index d53254a3be15..000000000000 --- a/Documentation/DocBook/v4l/keytable.c.xml +++ /dev/null @@ -1,172 +0,0 @@ - -/* keytable.c - This program allows checking/replacing keys at IR - - Copyright (C) 2006-2009 Mauro Carvalho Chehab <mchehab@infradead.org> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, version 2 of the License. - - This program is distributed in the hope that it will be useful, - 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. - */ - -#include <ctype.h> -#include <errno.h> -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <linux/input.h> -#include <sys/ioctl.h> - -#include "parse.h" - -void prtcode (int *codes) -{ - struct parse_key *p; - - for (p=keynames;p->name!=NULL;p++) { - if (p->value == (unsigned)codes[1]) { - printf("scancode 0x%04x = %s (0x%02x)\n", codes[0], p->name, codes[1]); - return; - } - } - - if (isprint (codes[1])) - printf("scancode %d = '%c' (0x%02x)\n", codes[0], codes[1], codes[1]); - else - printf("scancode %d = 0x%02x\n", codes[0], codes[1]); -} - -int parse_code(char *string) -{ - struct parse_key *p; - - for (p=keynames;p->name!=NULL;p++) { - if (!strcasecmp(p->name, string)) { - return p->value; - } - } - return -1; -} - -int main (int argc, char *argv[]) -{ - int fd; - unsigned int i, j; - int codes[2]; - - if (argc<2 || argc>4) { - printf ("usage: %s <device> to get table; or\n" - " %s <device> <scancode> <keycode>\n" - " %s <device> <keycode_file>\n",*argv,*argv,*argv); - return -1; - } - - if ((fd = open(argv[1], O_RDONLY)) < 0) { - perror("Couldn't open input device"); - return(-1); - } - - if (argc==4) { - int value; - - value=parse_code(argv[3]); - - if (value==-1) { - value = strtol(argv[3], NULL, 0); - if (errno) - perror("value"); - } - - codes [0] = (unsigned) strtol(argv[2], NULL, 0); - codes [1] = (unsigned) value; - - if(ioctl(fd, EVIOCSKEYCODE, codes)) - perror ("EVIOCSKEYCODE"); - - if(ioctl(fd, EVIOCGKEYCODE, codes)==0) - prtcode(codes); - return 0; - } - - if (argc==3) { - FILE *fin; - int value; - char *scancode, *keycode, s[2048]; - - fin=fopen(argv[2],"r"); - if (fin==NULL) { - perror ("opening keycode file"); - return -1; - } - - /* Clears old table */ - for (j = 0; j < 256; j++) { - for (i = 0; i < 256; i++) { - codes[0] = (j << 8) | i; - codes[1] = KEY_RESERVED; - ioctl(fd, EVIOCSKEYCODE, codes); - } - } - - while (fgets(s,sizeof(s),fin)) { - scancode=strtok(s,"\n\t =:"); - if (!scancode) { - perror ("parsing input file scancode"); - return -1; - } - if (!strcasecmp(scancode, "scancode")) { - scancode = strtok(NULL,"\n\t =:"); - if (!scancode) { - perror ("parsing input file scancode"); - return -1; - } - } - - keycode=strtok(NULL,"\n\t =:("); - if (!keycode) { - perror ("parsing input file keycode"); - return -1; - } - - // printf ("parsing %s=%s:", scancode, keycode); - value=parse_code(keycode); - // printf ("\tvalue=%d\n",value); - - if (value==-1) { - value = strtol(keycode, NULL, 0); - if (errno) - perror("value"); - } - - codes [0] = (unsigned) strtol(scancode, NULL, 0); - codes [1] = (unsigned) value; - - // printf("\t%04x=%04x\n",codes[0], codes[1]); - if(ioctl(fd, EVIOCSKEYCODE, codes)) { - fprintf(stderr, "Setting scancode 0x%04x with 0x%04x via ",codes[0], codes[1]); - perror ("EVIOCSKEYCODE"); - } - - if(ioctl(fd, EVIOCGKEYCODE, codes)==0) - prtcode(codes); - } - return 0; - } - - /* Get scancode table */ - for (j = 0; j < 256; j++) { - for (i = 0; i < 256; i++) { - codes[0] = (j << 8) | i; - if (!ioctl(fd, EVIOCGKEYCODE, codes) && codes[1] != KEY_RESERVED) - prtcode(codes); - } - } - return 0; -} - - diff --git a/Documentation/DocBook/v4l/libv4l.xml b/Documentation/DocBook/v4l/libv4l.xml deleted file mode 100644 index 3cb10ec51929..000000000000 --- a/Documentation/DocBook/v4l/libv4l.xml +++ /dev/null @@ -1,167 +0,0 @@ -Libv4l Userspace Library -
- Introduction - - libv4l is a collection of libraries which adds a thin abstraction -layer on top of video4linux2 devices. The purpose of this (thin) layer -is to make it easy for application writers to support a wide variety of -devices without having to write separate code for different devices in the -same class. -An example of using libv4l is provided by -v4l2grab. - - - libv4l consists of 3 different libraries: -
- libv4lconvert - - libv4lconvert is a library that converts several -different pixelformats found in V4L2 drivers into a few common RGB and -YUY formats. - It currently accepts the following V4L2 driver formats: -V4L2_PIX_FMT_BGR24, -V4L2_PIX_FMT_HM12, -V4L2_PIX_FMT_JPEG, -V4L2_PIX_FMT_MJPEG, -V4L2_PIX_FMT_MR97310A, -V4L2_PIX_FMT_OV511, -V4L2_PIX_FMT_OV518, -V4L2_PIX_FMT_PAC207, -V4L2_PIX_FMT_PJPG, -V4L2_PIX_FMT_RGB24, -V4L2_PIX_FMT_SBGGR8, -V4L2_PIX_FMT_SGBRG8, -V4L2_PIX_FMT_SGRBG8, -V4L2_PIX_FMT_SN9C10X, -V4L2_PIX_FMT_SN9C20X_I420, -V4L2_PIX_FMT_SPCA501, -V4L2_PIX_FMT_SPCA505, -V4L2_PIX_FMT_SPCA508, -V4L2_PIX_FMT_SPCA561, -V4L2_PIX_FMT_SQ905C, -V4L2_PIX_FMT_SRGGB8, -V4L2_PIX_FMT_UYVY, -V4L2_PIX_FMT_YUV420, -V4L2_PIX_FMT_YUYV, -V4L2_PIX_FMT_YVU420, -and V4L2_PIX_FMT_YVYU. - - Later on libv4lconvert was expanded to also be able to do -various video processing functions to improve webcam video quality. -The video processing is split in to 2 parts: libv4lconvert/control and -libv4lconvert/processing. - - The control part is used to offer video controls which can -be used to control the video processing functions made available by - libv4lconvert/processing. These controls are stored application wide -(until reboot) by using a persistent shared memory object. - - libv4lconvert/processing offers the actual video -processing functionality. -
-
- libv4l1 - This library offers functions that can be used to quickly -make v4l1 applications work with v4l2 devices. These functions work exactly -like the normal open/close/etc, except that libv4l1 does full emulation of -the v4l1 api on top of v4l2 drivers, in case of v4l1 drivers it -will just pass calls through. - Since those functions are emulations of the old V4L1 API, -it shouldn't be used for new applications. -
-
- libv4l2 - This library should be used for all modern V4L2 -applications. - It provides handles to call V4L2 open/ioctl/close/poll -methods. Instead of just providing the raw output of the device, it enhances -the calls in the sense that it will use libv4lconvert to provide more video -formats and to enhance the image quality. - In most cases, libv4l2 just passes the calls directly -through to the v4l2 driver, intercepting the calls to -VIDIOC_TRY_FMT, -VIDIOC_G_FMT -VIDIOC_S_FMT -VIDIOC_ENUM_FRAMESIZES -and VIDIOC_ENUM_FRAMEINTERVALS -in order to emulate the formats -V4L2_PIX_FMT_BGR24, -V4L2_PIX_FMT_RGB24, -V4L2_PIX_FMT_YUV420, -and V4L2_PIX_FMT_YVU420, -if they aren't available in the driver. -VIDIOC_ENUM_FMT -keeps enumerating the hardware supported formats, plus the emulated formats -offered by libv4l at the end. - -
- Libv4l device control functions - The common file operation methods are provided by -libv4l. - Those functions operate just like glibc -open/close/dup/ioctl/read/mmap/munmap: - - int v4l2_open(const char *file, int oflag, -...) - -operates like the standard open() function. - - int v4l2_close(int fd) - -operates like the standard close() function. - - int v4l2_dup(int fd) - -operates like the standard dup() function, duplicating a file handler. - - int v4l2_ioctl (int fd, unsigned long int request, ...) - -operates like the standard ioctl() function. - - int v4l2_read (int fd, void* buffer, size_t n) - -operates like the standard read() function. - - void v4l2_mmap(void *start, size_t length, int prot, int flags, int fd, int64_t offset); - -operates like the standard mmap() function. - - int v4l2_munmap(void *_start, size_t length); - -operates like the standard munmap() function. - - - Those functions provide additional control: - - int v4l2_fd_open(int fd, int v4l2_flags) - -opens an already opened fd for further use through v4l2lib and possibly -modify libv4l2's default behavior through the v4l2_flags argument. -Currently, v4l2_flags can be V4L2_DISABLE_CONVERSION, -to disable format conversion. - - int v4l2_set_control(int fd, int cid, int value) - -This function takes a value of 0 - 65535, and then scales that range to -the actual range of the given v4l control id, and then if the cid exists -and is not locked sets the cid to the scaled value. - - int v4l2_get_control(int fd, int cid) - -This function returns a value of 0 - 65535, scaled to from the actual range -of the given v4l control id. when the cid does not exist, could not be -accessed for some reason, or some error occurred 0 is returned. - - -
-
-
- - v4l1compat.so wrapper library - - This library intercepts calls to -open/close/ioctl/mmap/mmunmap operations and redirects them to the libv4l -counterparts, by using LD_PRELOAD=/usr/lib/v4l1compat.so. It also -emulates V4L1 calls via V4L2 API. - It allows usage of binary legacy applications that -still don't use libv4l. -
- -
- diff --git a/Documentation/DocBook/v4l/lirc_device_interface.xml b/Documentation/DocBook/v4l/lirc_device_interface.xml deleted file mode 100644 index 0e0453f39e73..000000000000 --- a/Documentation/DocBook/v4l/lirc_device_interface.xml +++ /dev/null @@ -1,251 +0,0 @@ -
-LIRC Device Interface - - -
-Introduction - -The LIRC device interface is a bi-directional interface for -transporting raw IR data between userspace and kernelspace. Fundamentally, -it is just a chardev (/dev/lircX, for X = 0, 1, 2, ...), with a number -of standard struct file_operations defined on it. With respect to -transporting raw IR data to and fro, the essential fops are read, write -and ioctl. - -Example dmesg output upon a driver registering w/LIRC: -
- $ dmesg |grep lirc_dev - lirc_dev: IR Remote Control driver registered, major 248 - rc rc0: lirc_dev: driver ir-lirc-codec (mceusb) registered at minor = 0 -
- -What you should see for a chardev: -
- $ ls -l /dev/lirc* - crw-rw---- 1 root root 248, 0 Jul 2 22:20 /dev/lirc0 -
-
- -
-LIRC read fop - -The lircd userspace daemon reads raw IR data from the LIRC chardev. The -exact format of the data depends on what modes a driver supports, and what -mode has been selected. lircd obtains supported modes and sets the active mode -via the ioctl interface, detailed at . The generally -preferred mode is LIRC_MODE_MODE2, in which packets containing an int value -describing an IR signal are read from the chardev. - -See also http://www.lirc.org/html/technical.html for more info. -
- -
-LIRC write fop - -The data written to the chardev is a pulse/space sequence of integer -values. Pulses and spaces are only marked implicitly by their position. The -data must start and end with a pulse, therefore, the data must always include -an uneven number of samples. The write function must block until the data has -been transmitted by the hardware. -
- -
-LIRC ioctl fop - -The LIRC device's ioctl definition is bound by the ioctl function -definition of struct file_operations, leaving us with an unsigned int -for the ioctl command and an unsigned long for the arg. For the purposes -of ioctl portability across 32-bit and 64-bit, these values are capped -to their 32-bit sizes. - -The following ioctls can be used to change specific hardware settings. -In general each driver should have a default set of settings. The driver -implementation is expected to re-apply the default settings when the device -is closed by user-space, so that every application opening the device can rely -on working with the default settings initially. - - - - LIRC_GET_FEATURES - - Obviously, get the underlying hardware device's features. If a driver - does not announce support of certain features, calling of the corresponding - ioctls is undefined. - - - - LIRC_GET_SEND_MODE - - Get supported transmit mode. Only LIRC_MODE_PULSE is supported by lircd. - - - - LIRC_GET_REC_MODE - - Get supported receive modes. Only LIRC_MODE_MODE2 and LIRC_MODE_LIRCCODE - are supported by lircd. - - - - LIRC_GET_SEND_CARRIER - - Get carrier frequency (in Hz) currently used for transmit. - - - - LIRC_GET_REC_CARRIER - - Get carrier frequency (in Hz) currently used for IR reception. - - - - LIRC_{G,S}ET_{SEND,REC}_DUTY_CYCLE - - Get/set the duty cycle (from 0 to 100) of the carrier signal. Currently, - no special meaning is defined for 0 or 100, but this could be used to switch - off carrier generation in the future, so these values should be reserved. - - - - LIRC_GET_REC_RESOLUTION - - Some receiver have maximum resolution which is defined by internal - sample rate or data format limitations. E.g. it's common that signals can - only be reported in 50 microsecond steps. This integer value is used by - lircd to automatically adjust the aeps tolerance value in the lircd - config file. - - - - LIRC_GET_M{IN,AX}_TIMEOUT - - Some devices have internal timers that can be used to detect when - there's no IR activity for a long time. This can help lircd in detecting - that a IR signal is finished and can speed up the decoding process. - Returns an integer value with the minimum/maximum timeout that can be - set. Some devices have a fixed timeout, in that case both ioctls will - return the same value even though the timeout cannot be changed. - - - - LIRC_GET_M{IN,AX}_FILTER_{PULSE,SPACE} - - Some devices are able to filter out spikes in the incoming signal - using given filter rules. These ioctls return the hardware capabilities - that describe the bounds of the possible filters. Filter settings depend - on the IR protocols that are expected. lircd derives the settings from - all protocols definitions found in its config file. - - - - LIRC_GET_LENGTH - - Retrieves the code length in bits (only for LIRC_MODE_LIRCCODE). - Reads on the device must be done in blocks matching the bit count. - The bit could should be rounded up so that it matches full bytes. - - - - LIRC_SET_{SEND,REC}_MODE - - Set send/receive mode. Largely obsolete for send, as only - LIRC_MODE_PULSE is supported. - - - - LIRC_SET_{SEND,REC}_CARRIER - - Set send/receive carrier (in Hz). - - - - LIRC_SET_TRANSMITTER_MASK - - This enables the given set of transmitters. The first transmitter - is encoded by the least significant bit, etc. When an invalid bit mask - is given, i.e. a bit is set, even though the device does not have so many - transitters, then this ioctl returns the number of available transitters - and does nothing otherwise. - - - - LIRC_SET_REC_TIMEOUT - - Sets the integer value for IR inactivity timeout (cf. - LIRC_GET_MIN_TIMEOUT and LIRC_GET_MAX_TIMEOUT). A value of 0 (if - supported by the hardware) disables all hardware timeouts and data should - be reported as soon as possible. If the exact value cannot be set, then - the next possible value _greater_ than the given value should be set. - - - - LIRC_SET_REC_TIMEOUT_REPORTS - - Enable (1) or disable (0) timeout reports in LIRC_MODE_MODE2. By - default, timeout reports should be turned off. - - - - LIRC_SET_REC_FILTER_{,PULSE,SPACE} - - Pulses/spaces shorter than this are filtered out by hardware. If - filters cannot be set independently for pulse/space, the corresponding - ioctls must return an error and LIRC_SET_REC_FILTER shall be used instead. - - - - LIRC_SET_MEASURE_CARRIER_MODE - - Enable (1)/disable (0) measure mode. If enabled, from the next key - press on, the driver will send LIRC_MODE2_FREQUENCY packets. By default - this should be turned off. - - - - LIRC_SET_REC_{DUTY_CYCLE,CARRIER}_RANGE - - To set a range use LIRC_SET_REC_DUTY_CYCLE_RANGE/LIRC_SET_REC_CARRIER_RANGE - with the lower bound first and later LIRC_SET_REC_DUTY_CYCLE/LIRC_SET_REC_CARRIER - with the upper bound. - - - - LIRC_NOTIFY_DECODE - - This ioctl is called by lircd whenever a successful decoding of an - incoming IR signal could be done. This can be used by supporting hardware - to give visual feedback to the user e.g. by flashing a LED. - - - - LIRC_SETUP_{START,END} - - Setting of several driver parameters can be optimized by encapsulating - the according ioctl calls with LIRC_SETUP_START/LIRC_SETUP_END. When a - driver receives a LIRC_SETUP_START ioctl it can choose to not commit - further setting changes to the hardware until a LIRC_SETUP_END is received. - But this is open to the driver implementation and every driver must also - handle parameter changes which are not encapsulated by LIRC_SETUP_START - and LIRC_SETUP_END. Drivers can also choose to ignore these ioctls. - - - - LIRC_SET_WIDEBAND_RECEIVER - - Some receivers are equipped with special wide band receiver which is intended - to be used to learn output of existing remote. - Calling that ioctl with (1) will enable it, and with (0) disable it. - This might be useful of receivers that have otherwise narrow band receiver - that prevents them to be used with some remotes. - Wide band receiver might also be more precise - On the other hand its disadvantage it usually reduced range of reception. - Note: wide band receiver might be implictly enabled if you enable - carrier reports. In that case it will be disabled as soon as you disable - carrier reports. Trying to disable wide band receiver while carrier - reports are active will do nothing. - - - - -
-
diff --git a/Documentation/DocBook/v4l/media-controller.xml b/Documentation/DocBook/v4l/media-controller.xml deleted file mode 100644 index 873ac3a621f0..000000000000 --- a/Documentation/DocBook/v4l/media-controller.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - Laurent - Pinchart -
laurent.pinchart@ideasonboard.com
- Initial version. -
-
- - 2010 - Laurent Pinchart - - - - - - 1.0.0 - 2010-11-10 - lp - Initial revision - - -
- -Media Controller API - - - Media Controller - -
- Introduction - Media devices increasingly handle multiple related functions. Many USB - cameras include microphones, video capture hardware can also output video, - or SoC camera interfaces also perform memory-to-memory operations similar to - video codecs. - Independent functions, even when implemented in the same hardware, can - be modelled as separate devices. A USB camera with a microphone will be - presented to userspace applications as V4L2 and ALSA capture devices. The - devices' relationships (when using a webcam, end-users shouldn't have to - manually select the associated USB microphone), while not made available - directly to applications by the drivers, can usually be retrieved from - sysfs. - With more and more advanced SoC devices being introduced, the current - approach will not scale. Device topologies are getting increasingly complex - and can't always be represented by a tree structure. Hardware blocks are - shared between different functions, creating dependencies between seemingly - unrelated devices. - Kernel abstraction APIs such as V4L2 and ALSA provide means for - applications to access hardware parameters. As newer hardware expose an - increasingly high number of those parameters, drivers need to guess what - applications really require based on limited information, thereby - implementing policies that belong to userspace. - The media controller API aims at solving those problems. -
- -
- Media device model - Discovering a device internal topology, and configuring it at runtime, - is one of the goals of the media controller API. To achieve this, hardware - devices are modelled as an oriented graph of building blocks called entities - connected through pads. - An entity is a basic media hardware or software building block. It can - correspond to a large variety of logical blocks such as physical hardware - devices (CMOS sensor for instance), logical hardware devices (a building - block in a System-on-Chip image processing pipeline), DMA channels or - physical connectors. - A pad is a connection endpoint through which an entity can interact - with other entities. Data (not restricted to video) produced by an entity - flows from the entity's output to one or more entity inputs. Pads should not - be confused with physical pins at chip boundaries. - A link is a point-to-point oriented connection between two pads, - either on the same entity or on different entities. Data flows from a source - pad to a sink pad. -
-
- - - Function Reference - - &sub-media-func-open; - &sub-media-func-close; - &sub-media-func-ioctl; - - &sub-media-ioc-device-info; - &sub-media-ioc-enum-entities; - &sub-media-ioc-enum-links; - &sub-media-ioc-setup-link; - diff --git a/Documentation/DocBook/v4l/media-func-close.xml b/Documentation/DocBook/v4l/media-func-close.xml deleted file mode 100644 index be149c802aeb..000000000000 --- a/Documentation/DocBook/v4l/media-func-close.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - media close() - &manvol; - - - - media-close - Close a media device - - - - - #include <unistd.h> - - int close - int fd - - - - - - Arguments - - - - fd - - &fd; - - - - - - - Description - - Closes the media device. Resources associated with the file descriptor - are freed. The device configuration remain unchanged. - - - - Return Value - - close returns 0 on success. On error, -1 is - returned, and errno is set appropriately. Possible error - codes are: - - - - EBADF - - fd is not a valid open file descriptor. - - - - - - diff --git a/Documentation/DocBook/v4l/media-func-ioctl.xml b/Documentation/DocBook/v4l/media-func-ioctl.xml deleted file mode 100644 index bda8604de15c..000000000000 --- a/Documentation/DocBook/v4l/media-func-ioctl.xml +++ /dev/null @@ -1,116 +0,0 @@ - - - media ioctl() - &manvol; - - - - media-ioctl - Control a media device - - - - - #include <sys/ioctl.h> - - int ioctl - int fd - int request - void *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - Media ioctl request code as defined in the media.h header file, - for example MEDIA_IOC_SETUP_LINK. - - - - argp - - Pointer to a request-specific structure. - - - - - - - Description - The ioctl() function manipulates media device - parameters. The argument fd must be an open file - descriptor. - The ioctl request code specifies the media - function to be called. It has encoded in it whether the argument is an - input, output or read/write parameter, and the size of the argument - argp in bytes. - Macros and structures definitions specifying media ioctl requests and - their parameters are located in the media.h header file. All media ioctl - requests, their respective function and parameters are specified in - . - - - - Return Value - - ioctl() returns 0 on - success. On failure, -1 is returned, and the - errno variable is set appropriately. Generic error codes - are listed below, and request-specific error codes are listed in the - individual requests descriptions. - When an ioctl that takes an output or read/write parameter fails, - the parameter remains unmodified. - - - - EBADF - - fd is not a valid open file descriptor. - - - - - EFAULT - - argp references an inaccessible memory - area. - - - - EINVAL - - The request or the data pointed to by - argp is not valid. This is a very common error - code, see the individual ioctl requests listed in - for actual causes. - - - - ENOMEM - - Insufficient kernel memory was available to complete the - request. - - - - ENOTTY - - fd is not associated with a character - special device. - - - - - diff --git a/Documentation/DocBook/v4l/media-func-open.xml b/Documentation/DocBook/v4l/media-func-open.xml deleted file mode 100644 index f7df034dc9ed..000000000000 --- a/Documentation/DocBook/v4l/media-func-open.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - media open() - &manvol; - - - - media-open - Open a media device - - - - - #include <fcntl.h> - - int open - const char *device_name - int flags - - - - - - Arguments - - - - device_name - - Device to be opened. - - - - flags - - Open flags. Access mode must be either O_RDONLY - or O_RDWR. Other flags have no effect. - - - - - - Description - To open a media device applications call open() - with the desired device name. The function has no side effects; the device - configuration remain unchanged. - When the device is opened in read-only mode, attemps to modify its - configuration will result in an error, and errno will be - set to EBADF. - - - Return Value - - open returns the new file descriptor on success. - On error, -1 is returned, and errno is set appropriately. - Possible error codes are: - - - - EACCES - - The requested access to the file is not allowed. - - - - EMFILE - - The process already has the maximum number of files open. - - - - - ENFILE - - The system limit on the total number of open files has been - reached. - - - - ENOMEM - - Insufficient kernel memory was available. - - - - ENXIO - - No device corresponding to this device special file exists. - - - - - - diff --git a/Documentation/DocBook/v4l/media-ioc-device-info.xml b/Documentation/DocBook/v4l/media-ioc-device-info.xml deleted file mode 100644 index 1f3237351bba..000000000000 --- a/Documentation/DocBook/v4l/media-ioc-device-info.xml +++ /dev/null @@ -1,133 +0,0 @@ - - - ioctl MEDIA_IOC_DEVICE_INFO - &manvol; - - - - MEDIA_IOC_DEVICE_INFO - Query device information - - - - - - int ioctl - int fd - int request - struct media_device_info *argp - - - - - - Arguments - - - - fd - - File descriptor returned by - open(). - - - - request - - MEDIA_IOC_DEVICE_INFO - - - - argp - - - - - - - - - Description - - All media devices must support the MEDIA_IOC_DEVICE_INFO - ioctl. To query device information, applications call the ioctl with a - pointer to a &media-device-info;. The driver fills the structure and returns - the information to the application. - The ioctl never fails. - - - struct <structname>media_device_info</structname> - - &cs-str; - - - char - driver[16] - Name of the driver implementing the media API as a - NUL-terminated ASCII string. The driver version is stored in the - driver_version field. - Driver specific applications can use this information to - verify the driver identity. It is also useful to work around - known bugs, or to identify drivers in error reports. - - - char - model[32] - Device model name as a NUL-terminated UTF-8 string. The - device version is stored in the device_version - field and is not be appended to the model name. - - - char - serial[40] - Serial number as a NUL-terminated ASCII string. - - - char - bus_info[32] - Location of the device in the system as a NUL-terminated - ASCII string. This includes the bus type name (PCI, USB, ...) and a - bus-specific identifier. - - - __u32 - media_version - Media API version, formatted with the - KERNEL_VERSION() macro. - - - __u32 - hw_revision - Hardware device revision in a driver-specific format. - - - __u32 - media_version - Media device driver version, formatted with the - KERNEL_VERSION() macro. Together with the - driver field this identifies a particular - driver. - - - __u32 - reserved[31] - Reserved for future extensions. Drivers and applications must - set this array to zero. - - - -
- The serial and bus_info - fields can be used to distinguish between multiple instances of otherwise - identical hardware. The serial number takes precedence when provided and can - be assumed to be unique. If the serial number is an empty string, the - bus_info field can be used instead. The - bus_info field is guaranteed to be unique, but - can vary across reboots or device unplug/replug. -
- - - Return value - This function doesn't return specific error codes. - -
diff --git a/Documentation/DocBook/v4l/media-ioc-enum-entities.xml b/Documentation/DocBook/v4l/media-ioc-enum-entities.xml deleted file mode 100644 index 576b68b33f2c..000000000000 --- a/Documentation/DocBook/v4l/media-ioc-enum-entities.xml +++ /dev/null @@ -1,308 +0,0 @@ - - - ioctl MEDIA_IOC_ENUM_ENTITIES - &manvol; - - - - MEDIA_IOC_ENUM_ENTITIES - Enumerate entities and their properties - - - - - - int ioctl - int fd - int request - struct media_entity_desc *argp - - - - - - Arguments - - - - fd - - File descriptor returned by - open(). - - - - request - - MEDIA_IOC_ENUM_ENTITIES - - - - argp - - - - - - - - - Description - To query the attributes of an entity, applications set the id field - of a &media-entity-desc; structure and call the MEDIA_IOC_ENUM_ENTITIES - ioctl with a pointer to this structure. The driver fills the rest of the - structure or returns an &EINVAL; when the id is invalid. - Entities can be enumerated by or'ing the id with the - MEDIA_ENT_ID_FLAG_NEXT flag. The driver will return - information about the entity with the smallest id strictly larger than the - requested one ('next entity'), or the &EINVAL; if there is none. - Entity IDs can be non-contiguous. Applications must - not try to enumerate entities by calling - MEDIA_IOC_ENUM_ENTITIES with increasing id's until they get an error. - Two or more entities that share a common non-zero - group_id value are considered as logically - grouped. Groups are used to report - - ALSA, VBI and video nodes that carry the same media - stream - lens and flash controllers associated with a sensor - - - - - struct <structname>media_entity_desc</structname> - - - - - - - - - __u32 - id - - - Entity id, set by the application. When the id is or'ed with - MEDIA_ENT_ID_FLAG_NEXT, the driver clears the - flag and returns the first entity with a larger id. - - - char - name[32] - - - Entity name as an UTF-8 NULL-terminated string. - - - __u32 - type - - - Entity type, see for details. - - - __u32 - revision - - - Entity revision in a driver/hardware specific format. - - - __u32 - flags - - - Entity flags, see for details. - - - __u32 - group_id - - - Entity group ID - - - __u16 - pads - - - Number of pads - - - __u16 - links - - - Total number of outbound links. Inbound links are not counted - in this field. - - - union - - - - struct - v4l - - Valid for V4L sub-devices and nodes only. - - - - - __u32 - major - V4L device node major number. For V4L sub-devices with no - device node, set by the driver to 0. - - - - - __u32 - minor - V4L device node minor number. For V4L sub-devices with no - device node, set by the driver to 0. - - - - struct - fb - - Valid for frame buffer nodes only. - - - - - __u32 - major - Frame buffer device node major number. - - - - - __u32 - minor - Frame buffer device node minor number. - - - - struct - alsa - - Valid for ALSA devices only. - - - - - __u32 - card - ALSA card number - - - - - __u32 - device - ALSA device number - - - - - __u32 - subdevice - ALSA sub-device number - - - - int - dvb - - DVB card number - - - - __u8 - raw[180] - - - - - -
- - - Media entity types - - - - - - MEDIA_ENT_T_DEVNODE - Unknown device node - - - MEDIA_ENT_T_DEVNODE_V4L - V4L video, radio or vbi device node - - - MEDIA_ENT_T_DEVNODE_FB - Frame buffer device node - - - MEDIA_ENT_T_DEVNODE_ALSA - ALSA card - - - MEDIA_ENT_T_DEVNODE_DVB - DVB card - - - MEDIA_ENT_T_V4L2_SUBDEV - Unknown V4L sub-device - - - MEDIA_ENT_T_V4L2_SUBDEV_SENSOR - Video sensor - - - MEDIA_ENT_T_V4L2_SUBDEV_FLASH - Flash controller - - - MEDIA_ENT_T_V4L2_SUBDEV_LENS - Lens controller - - - -
- - - Media entity flags - - - - - - MEDIA_ENT_FL_DEFAULT - Default entity for its type. Used to discover the default - audio, VBI and video devices, the default camera sensor, ... - - - -
-
- - - &return-value; - - - - EINVAL - - The &media-entity-desc; id references - a non-existing entity. - - - - -
diff --git a/Documentation/DocBook/v4l/media-ioc-enum-links.xml b/Documentation/DocBook/v4l/media-ioc-enum-links.xml deleted file mode 100644 index d2fc73ef8d56..000000000000 --- a/Documentation/DocBook/v4l/media-ioc-enum-links.xml +++ /dev/null @@ -1,207 +0,0 @@ - - - ioctl MEDIA_IOC_ENUM_LINKS - &manvol; - - - - MEDIA_IOC_ENUM_LINKS - Enumerate all pads and links for a given entity - - - - - - int ioctl - int fd - int request - struct media_links_enum *argp - - - - - - Arguments - - - - fd - - File descriptor returned by - open(). - - - - request - - MEDIA_IOC_ENUM_LINKS - - - - argp - - - - - - - - - Description - - To enumerate pads and/or links for a given entity, applications set - the entity field of a &media-links-enum; structure and initialize the - &media-pad-desc; and &media-link-desc; structure arrays pointed by the - pads and links fields. - They then call the MEDIA_IOC_ENUM_LINKS ioctl with a pointer to this - structure. - If the pads field is not NULL, the driver - fills the pads array with information about the - entity's pads. The array must have enough room to store all the entity's - pads. The number of pads can be retrieved with the &MEDIA-IOC-ENUM-ENTITIES; - ioctl. - If the links field is not NULL, the driver - fills the links array with information about the - entity's outbound links. The array must have enough room to store all the - entity's outbound links. The number of outbound links can be retrieved with - the &MEDIA-IOC-ENUM-ENTITIES; ioctl. - Only forward links that originate at one of the entity's source pads - are returned during the enumeration process. - - - struct <structname>media_links_enum</structname> - - &cs-str; - - - __u32 - entity - Entity id, set by the application. - - - struct &media-pad-desc; - *pads - Pointer to a pads array allocated by the application. Ignored - if NULL. - - - struct &media-link-desc; - *links - Pointer to a links array allocated by the application. Ignored - if NULL. - - - - - - - struct <structname>media_pad_desc</structname> - - &cs-str; - - - __u32 - entity - ID of the entity this pad belongs to. - - - __u16 - index - 0-based pad index. - - - __u32 - flags - Pad flags, see for more details. - - - -
- - - Media pad flags - - - - - - MEDIA_PAD_FL_SINK - Input pad, relative to the entity. Input pads sink data and - are targets of links. - - - MEDIA_PAD_FL_SOURCE - Output pad, relative to the entity. Output pads source data - and are origins of links. - - - -
- - - struct <structname>media_links_desc</structname> - - &cs-str; - - - struct &media-pad-desc; - source - Pad at the origin of this link. - - - struct &media-pad-desc; - sink - Pad at the target of this link. - - - __u32 - flags - Link flags, see for more details. - - - - - - - Media link flags - - - - - - MEDIA_LNK_FL_ENABLED - The link is enabled and can be used to transfer media data. - When two or more links target a sink pad, only one of them can be - enabled at a time. - - - MEDIA_LNK_FL_IMMUTABLE - The link enabled state can't be modified at runtime. An - immutable link is always enabled. - - - MEDIA_LNK_FL_DYNAMIC - The link enabled state can be modified during streaming. This - flag is set by drivers and is read-only for applications. - - - - - One and only one of MEDIA_PAD_FL_SINK and - MEDIA_PAD_FL_SOURCE must be set for every pad. -
- - - &return-value; - - - - EINVAL - - The &media-links-enum; id references - a non-existing entity. - - - - -
diff --git a/Documentation/DocBook/v4l/media-ioc-setup-link.xml b/Documentation/DocBook/v4l/media-ioc-setup-link.xml deleted file mode 100644 index cec97af4dab4..000000000000 --- a/Documentation/DocBook/v4l/media-ioc-setup-link.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - ioctl MEDIA_IOC_SETUP_LINK - &manvol; - - - - MEDIA_IOC_SETUP_LINK - Modify the properties of a link - - - - - - int ioctl - int fd - int request - struct media_link_desc *argp - - - - - - Arguments - - - - fd - - File descriptor returned by - open(). - - - - request - - MEDIA_IOC_SETUP_LINK - - - - argp - - - - - - - - - Description - - To change link properties applications fill a &media-link-desc; with - link identification information (source and sink pad) and the new requested - link flags. They then call the MEDIA_IOC_SETUP_LINK ioctl with a pointer to - that structure. - The only configurable property is the ENABLED - link flag to enable/disable a link. Links marked with the - IMMUTABLE link flag can not be enabled or disabled. - - Link configuration has no side effect on other links. If an enabled - link at the sink pad prevents the link from being enabled, the driver - returns with an &EBUSY;. - Only links marked with the DYNAMIC link flag can - be enabled/disabled while streaming media data. Attempting to enable or - disable a streaming non-dynamic link will return an &EBUSY;. - If the specified link can't be found the driver returns with an - &EINVAL;. - - - - &return-value; - - - - EBUSY - - The link properties can't be changed because the link is - currently busy. This can be caused, for instance, by an active media - stream (audio or video) on the link. The ioctl shouldn't be retried if - no other action is performed before to fix the problem. - - - - EINVAL - - The &media-link-desc; references a non-existing link, or the - link is immutable and an attempt to modify its configuration was made. - - - - - - diff --git a/Documentation/DocBook/v4l/nv12mt.gif b/Documentation/DocBook/v4l/nv12mt.gif deleted file mode 100644 index ef2d4cf8367b..000000000000 Binary files a/Documentation/DocBook/v4l/nv12mt.gif and /dev/null differ diff --git a/Documentation/DocBook/v4l/nv12mt_example.gif b/Documentation/DocBook/v4l/nv12mt_example.gif deleted file mode 100644 index df81d68108ee..000000000000 Binary files a/Documentation/DocBook/v4l/nv12mt_example.gif and /dev/null differ diff --git a/Documentation/DocBook/v4l/pipeline.pdf b/Documentation/DocBook/v4l/pipeline.pdf deleted file mode 100644 index ee3e37f04b6a..000000000000 Binary files a/Documentation/DocBook/v4l/pipeline.pdf and /dev/null differ diff --git a/Documentation/DocBook/v4l/pipeline.png b/Documentation/DocBook/v4l/pipeline.png deleted file mode 100644 index f19b86c2c24d..000000000000 Binary files a/Documentation/DocBook/v4l/pipeline.png and /dev/null differ diff --git a/Documentation/DocBook/v4l/pixfmt-grey.xml b/Documentation/DocBook/v4l/pixfmt-grey.xml deleted file mode 100644 index 3b72bc6b2de7..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-grey.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - V4L2_PIX_FMT_GREY ('GREY') - &manvol; - - - V4L2_PIX_FMT_GREY - Grey-scale image - - - Description - - This is a grey-scale image. It is really a degenerate -Y'CbCr format which simply contains no Cb or Cr data. - - - <constant>V4L2_PIX_FMT_GREY</constant> 4 × 4 -pixel image - - - Byte Order. - Each cell is one byte. - - - - - - start + 0: - Y'00 - Y'01 - Y'02 - Y'03 - - - start + 4: - Y'10 - Y'11 - Y'12 - Y'13 - - - start + 8: - Y'20 - Y'21 - Y'22 - Y'23 - - - start + 12: - Y'30 - Y'31 - Y'32 - Y'33 - - - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt-m420.xml b/Documentation/DocBook/v4l/pixfmt-m420.xml deleted file mode 100644 index ce4bc019e5c0..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-m420.xml +++ /dev/null @@ -1,147 +0,0 @@ - - - V4L2_PIX_FMT_M420 ('M420') - &manvol; - - - V4L2_PIX_FMT_M420 - Format with ½ horizontal and vertical chroma - resolution, also known as YUV 4:2:0. Hybrid plane line-interleaved - layout. - - - Description - - M420 is a YUV format with ½ horizontal and vertical chroma - subsampling (YUV 4:2:0). Pixels are organized as interleaved luma and - chroma planes. Two lines of luma data are followed by one line of chroma - data. - The luma plane has one byte per pixel. The chroma plane contains - interleaved CbCr pixels subsampled by ½ in the horizontal and - vertical directions. Each CbCr pair belongs to four pixels. For example, -Cb0/Cr0 belongs to -Y'00, Y'01, -Y'10, Y'11. - - All line lengths are identical: if the Y lines include pad bytes - so do the CbCr lines. - - - <constant>V4L2_PIX_FMT_M420</constant> 4 × 4 -pixel image - - - Byte Order. - Each cell is one byte. - - - - - - start + 0: - Y'00 - Y'01 - Y'02 - Y'03 - - - start + 4: - Y'10 - Y'11 - Y'12 - Y'13 - - - start + 8: - Cb00 - Cr00 - Cb01 - Cr01 - - - start + 16: - Y'20 - Y'21 - Y'22 - Y'23 - - - start + 20: - Y'30 - Y'31 - Y'32 - Y'33 - - - start + 24: - Cb10 - Cr10 - Cb11 - Cr11 - - - - - - - - - Color Sample Location. - - - - - - - 01 - 23 - - - 0 - YY - YY - - - - C - C - - - 1 - YY - YY - - - - - - 2 - YY - YY - - - - C - C - - - 3 - YY - YY - - - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt-nv12.xml b/Documentation/DocBook/v4l/pixfmt-nv12.xml deleted file mode 100644 index 873f67035181..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-nv12.xml +++ /dev/null @@ -1,151 +0,0 @@ - - - V4L2_PIX_FMT_NV12 ('NV12'), V4L2_PIX_FMT_NV21 ('NV21') - &manvol; - - - V4L2_PIX_FMT_NV12 - V4L2_PIX_FMT_NV21 - Formats with ½ horizontal and vertical -chroma resolution, also known as YUV 4:2:0. One luminance and one -chrominance plane with alternating chroma samples as opposed to -V4L2_PIX_FMT_YVU420 - - - Description - - These are two-plane versions of the YUV 4:2:0 format. -The three components are separated into two sub-images or planes. The -Y plane is first. The Y plane has one byte per pixel. For -V4L2_PIX_FMT_NV12, a combined CbCr plane -immediately follows the Y plane in memory. The CbCr plane is the same -width, in bytes, as the Y plane (and of the image), but is half as -tall in pixels. Each CbCr pair belongs to four pixels. For example, -Cb0/Cr0 belongs to -Y'00, Y'01, -Y'10, Y'11. -V4L2_PIX_FMT_NV21 is the same except the Cb and -Cr bytes are swapped, the CrCb plane starts with a Cr byte. - - If the Y plane has pad bytes after each row, then the -CbCr plane has as many pad bytes after its rows. - - - <constant>V4L2_PIX_FMT_NV12</constant> 4 × 4 -pixel image - - - Byte Order. - Each cell is one byte. - - - - - - start + 0: - Y'00 - Y'01 - Y'02 - Y'03 - - - start + 4: - Y'10 - Y'11 - Y'12 - Y'13 - - - start + 8: - Y'20 - Y'21 - Y'22 - Y'23 - - - start + 12: - Y'30 - Y'31 - Y'32 - Y'33 - - - start + 16: - Cb00 - Cr00 - Cb01 - Cr01 - - - start + 20: - Cb10 - Cr10 - Cb11 - Cr11 - - - - - - - - - Color Sample Location. - - - - - - - 01 - 23 - - - 0 - YY - YY - - - - C - C - - - 1 - YY - YY - - - - - - 2 - YY - YY - - - - C - C - - - 3 - YY - YY - - - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt-nv12m.xml b/Documentation/DocBook/v4l/pixfmt-nv12m.xml deleted file mode 100644 index c9e166d9ded8..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-nv12m.xml +++ /dev/null @@ -1,154 +0,0 @@ - - - V4L2_PIX_FMT_NV12M ('NV12M') - &manvol; - - - V4L2_PIX_FMT_NV12M - Variation of V4L2_PIX_FMT_NV12 with planes - non contiguous in memory. - - - Description - - This is a multi-planar, two-plane version of the YUV 4:2:0 format. -The three components are separated into two sub-images or planes. -V4L2_PIX_FMT_NV12M differs from V4L2_PIX_FMT_NV12 - in that the two planes are non-contiguous in memory, i.e. the chroma -plane do not necessarily immediately follows the luma plane. -The luminance data occupies the first plane. The Y plane has one byte per pixel. -In the second plane there is a chrominance data with alternating chroma samples. -The CbCr plane is the same width, in bytes, as the Y plane (and of the image), -but is half as tall in pixels. Each CbCr pair belongs to four pixels. For example, -Cb0/Cr0 belongs to -Y'00, Y'01, -Y'10, Y'11. - - V4L2_PIX_FMT_NV12M is intended to be -used only in drivers and applications that support the multi-planar API, -described in . - - If the Y plane has pad bytes after each row, then the -CbCr plane has as many pad bytes after its rows. - - - <constant>V4L2_PIX_FMT_NV12M</constant> 4 × 4 pixel image - - - Byte Order. - Each cell is one byte. - - - - - - start0 + 0: - Y'00 - Y'01 - Y'02 - Y'03 - - - start0 + 4: - Y'10 - Y'11 - Y'12 - Y'13 - - - start0 + 8: - Y'20 - Y'21 - Y'22 - Y'23 - - - start0 + 12: - Y'30 - Y'31 - Y'32 - Y'33 - - - - - - start1 + 0: - Cb00 - Cr00 - Cb01 - Cr01 - - - start1 + 4: - Cb10 - Cr10 - Cb11 - Cr11 - - - - - - - - - Color Sample Location. - - - - - - - 01 - 23 - - - 0 - YY - YY - - - - C - C - - - 1 - YY - YY - - - - - - 2 - YY - YY - - - - C - C - - - 3 - YY - YY - - - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt-nv12mt.xml b/Documentation/DocBook/v4l/pixfmt-nv12mt.xml deleted file mode 100644 index 7a2855a526c1..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-nv12mt.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - V4L2_PIX_FMT_NV12MT ('TM12') - &manvol; - - - V4L2_PIX_FMT_NV12MT - - Formats with ½ horizontal and vertical -chroma resolution. This format has two planes - one for luminance and one for -chrominance. Chroma samples are interleaved. The difference to -V4L2_PIX_FMT_NV12 is the memory layout. Pixels are -grouped in macroblocks of 64x32 size. The order of macroblocks in memory is -also not standard. - - - - Description - - This is the two-plane versions of the YUV 4:2:0 format where data -is grouped into 64x32 macroblocks. The three components are separated into two -sub-images or planes. The Y plane has one byte per pixel and pixels are grouped -into 64x32 macroblocks. The CbCr plane has the same width, in bytes, as the Y -plane (and the image), but is half as tall in pixels. The chroma plane is also -grouped into 64x32 macroblocks. - Width of the buffer has to be aligned to the multiple of 128, and -height alignment is 32. Every four adjactent buffers - two horizontally and two -vertically are grouped together and are located in memory in Z or flipped Z -order. - Layout of macroblocks in memory is presented in the following -figure. -
- <constant>V4L2_PIX_FMT_NV12MT</constant> macroblock Z shape -memory layout - - - - - -
- The requirement that width is multiple of 128 is implemented because, -the Z shape cannot be cut in half horizontally. In case the vertical resolution -of macroblocks is odd then the last row of macroblocks is arranged in a linear -order.
- In case of chroma the layout is identical. Cb and Cr samples are -interleaved. Height of the buffer is aligned to 32. - - - Memory layout of macroblocks in <constant>V4L2_PIX_FMT_NV12 -</constant> format pixel image - extreme case - -
- Example <constant>V4L2_PIX_FMT_NV12MT</constant> memory -layout of macroblocks - - - - - -
- Memory layout of macroblocks of V4L2_PIX_FMT_NV12MT - format in most extreme case. -
-
-
-
- - diff --git a/Documentation/DocBook/v4l/pixfmt-nv16.xml b/Documentation/DocBook/v4l/pixfmt-nv16.xml deleted file mode 100644 index 26094035fc04..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-nv16.xml +++ /dev/null @@ -1,174 +0,0 @@ - - - V4L2_PIX_FMT_NV16 ('NV16'), V4L2_PIX_FMT_NV61 ('NV61') - &manvol; - - - V4L2_PIX_FMT_NV16 - V4L2_PIX_FMT_NV61 - Formats with ½ horizontal -chroma resolution, also known as YUV 4:2:2. One luminance and one -chrominance plane with alternating chroma samples as opposed to -V4L2_PIX_FMT_YVU420 - - - Description - - These are two-plane versions of the YUV 4:2:2 format. -The three components are separated into two sub-images or planes. The -Y plane is first. The Y plane has one byte per pixel. For -V4L2_PIX_FMT_NV16, a combined CbCr plane -immediately follows the Y plane in memory. The CbCr plane is the same -width and height, in bytes, as the Y plane (and of the image). -Each CbCr pair belongs to two pixels. For example, -Cb0/Cr0 belongs to -Y'00, Y'01. -V4L2_PIX_FMT_NV61 is the same except the Cb and -Cr bytes are swapped, the CrCb plane starts with a Cr byte. - - If the Y plane has pad bytes after each row, then the -CbCr plane has as many pad bytes after its rows. - - - <constant>V4L2_PIX_FMT_NV16</constant> 4 × 4 -pixel image - - - Byte Order. - Each cell is one byte. - - - - - - start + 0: - Y'00 - Y'01 - Y'02 - Y'03 - - - start + 4: - Y'10 - Y'11 - Y'12 - Y'13 - - - start + 8: - Y'20 - Y'21 - Y'22 - Y'23 - - - start + 12: - Y'30 - Y'31 - Y'32 - Y'33 - - - start + 16: - Cb00 - Cr00 - Cb01 - Cr01 - - - start + 20: - Cb10 - Cr10 - Cb11 - Cr11 - - - start + 24: - Cb20 - Cr20 - Cb21 - Cr21 - - - start + 28: - Cb30 - Cr30 - Cb31 - Cr31 - - - - - - - - - Color Sample Location. - - - - - - - 01 - 23 - - - 0 - YY - YY - - - - C - C - - - 1 - YY - YY - - - - C - C - - - - - - 2 - YY - YY - - - - C - C - - - 3 - YY - YY - - - - C - C - - - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt-packed-rgb.xml b/Documentation/DocBook/v4l/pixfmt-packed-rgb.xml deleted file mode 100644 index 4db272b8a0d3..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-packed-rgb.xml +++ /dev/null @@ -1,940 +0,0 @@ - - - Packed RGB formats - &manvol; - - - Packed RGB formats - Packed RGB formats - - - Description - - These formats are designed to match the pixel formats of -typical PC graphics frame buffers. They occupy 8, 16, 24 or 32 bits -per pixel. These are all packed-pixel formats, meaning all the data -for a pixel lie next to each other in memory. - - When one of these formats is used, drivers shall report the -colorspace V4L2_COLORSPACE_SRGB. - - - Packed RGB Image Formats - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Identifier - Code -   - Byte 0 in memory - Byte 1 - Byte 2 - Byte 3 - - -   -   - Bit - 7 - 6 - 5 - 4 - 3 - 2 - 1 - 0 -   - 7 - 6 - 5 - 4 - 3 - 2 - 1 - 0 -   - 7 - 6 - 5 - 4 - 3 - 2 - 1 - 0 -   - 7 - 6 - 5 - 4 - 3 - 2 - 1 - 0 - - - - - V4L2_PIX_FMT_RGB332 - 'RGB1' - - b1 - b0 - g2 - g1 - g0 - r2 - r1 - r0 - - - V4L2_PIX_FMT_RGB444 - 'R444' - - g3 - g2 - g1 - g0 - b3 - b2 - b1 - b0 - - a3 - a2 - a1 - a0 - r3 - r2 - r1 - r0 - - - V4L2_PIX_FMT_RGB555 - 'RGBO' - - g2 - g1 - g0 - r4 - r3 - r2 - r1 - r0 - - a - b4 - b3 - b2 - b1 - b0 - g4 - g3 - - - V4L2_PIX_FMT_RGB565 - 'RGBP' - - g2 - g1 - g0 - r4 - r3 - r2 - r1 - r0 - - b4 - b3 - b2 - b1 - b0 - g5 - g4 - g3 - - - V4L2_PIX_FMT_RGB555X - 'RGBQ' - - a - b4 - b3 - b2 - b1 - b0 - g4 - g3 - - g2 - g1 - g0 - r4 - r3 - r2 - r1 - r0 - - - V4L2_PIX_FMT_RGB565X - 'RGBR' - - b4 - b3 - b2 - b1 - b0 - g5 - g4 - g3 - - g2 - g1 - g0 - r4 - r3 - r2 - r1 - r0 - - - V4L2_PIX_FMT_BGR666 - 'BGRH' - - b5 - b4 - b3 - b2 - b1 - b0 - g5 - g4 - - g3 - g2 - g1 - g0 - r5 - r4 - r3 - r2 - - r1 - r0 - - - - - - - - - - - - - - - - - V4L2_PIX_FMT_BGR24 - 'BGR3' - - b7 - b6 - b5 - b4 - b3 - b2 - b1 - b0 - - g7 - g6 - g5 - g4 - g3 - g2 - g1 - g0 - - r7 - r6 - r5 - r4 - r3 - r2 - r1 - r0 - - - V4L2_PIX_FMT_RGB24 - 'RGB3' - - r7 - r6 - r5 - r4 - r3 - r2 - r1 - r0 - - g7 - g6 - g5 - g4 - g3 - g2 - g1 - g0 - - b7 - b6 - b5 - b4 - b3 - b2 - b1 - b0 - - - V4L2_PIX_FMT_BGR32 - 'BGR4' - - b7 - b6 - b5 - b4 - b3 - b2 - b1 - b0 - - g7 - g6 - g5 - g4 - g3 - g2 - g1 - g0 - - r7 - r6 - r5 - r4 - r3 - r2 - r1 - r0 - - a7 - a6 - a5 - a4 - a3 - a2 - a1 - a0 - - - V4L2_PIX_FMT_RGB32 - 'RGB4' - - r7 - r6 - r5 - r4 - r3 - r2 - r1 - r0 - - g7 - g6 - g5 - g4 - g3 - g2 - g1 - g0 - - b7 - b6 - b5 - b4 - b3 - b2 - b1 - b0 - - a7 - a6 - a5 - a4 - a3 - a2 - a1 - a0 - - - -
- - Bit 7 is the most significant bit. The value of a = alpha -bits is undefined when reading from the driver, ignored when writing -to the driver, except when alpha blending has been negotiated for a -Video Overlay or Video Output Overlay. - - - <constant>V4L2_PIX_FMT_BGR24</constant> 4 × 4 pixel -image - - - Byte Order. - Each cell is one byte. - - - - - - start + 0: - B00 - G00 - R00 - B01 - G01 - R01 - B02 - G02 - R02 - B03 - G03 - R03 - - - start + 12: - B10 - G10 - R10 - B11 - G11 - R11 - B12 - G12 - R12 - B13 - G13 - R13 - - - start + 24: - B20 - G20 - R20 - B21 - G21 - R21 - B22 - G22 - R22 - B23 - G23 - R23 - - - start + 36: - B30 - G30 - R30 - B31 - G31 - R31 - B32 - G32 - R32 - B33 - G33 - R33 - - - - - - - - - - Drivers may interpret these formats differently. - - - Some RGB formats above are uncommon and were probably -defined in error. Drivers may interpret them as in . - - - Packed RGB Image Formats (corrected) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Identifier - Code -   - Byte 0 in memory - Byte 1 - Byte 2 - Byte 3 - - -   -   - Bit - 7 - 6 - 5 - 4 - 3 - 2 - 1 - 0 -   - 7 - 6 - 5 - 4 - 3 - 2 - 1 - 0 -   - 7 - 6 - 5 - 4 - 3 - 2 - 1 - 0 -   - 7 - 6 - 5 - 4 - 3 - 2 - 1 - 0 - - - - - V4L2_PIX_FMT_RGB332 - 'RGB1' - - r2 - r1 - r0 - g2 - g1 - g0 - b1 - b0 - - - V4L2_PIX_FMT_RGB444 - 'R444' - - g3 - g2 - g1 - g0 - b3 - b2 - b1 - b0 - - a3 - a2 - a1 - a0 - r3 - r2 - r1 - r0 - - - V4L2_PIX_FMT_RGB555 - 'RGBO' - - g2 - g1 - g0 - b4 - b3 - b2 - b1 - b0 - - a - r4 - r3 - r2 - r1 - r0 - g4 - g3 - - - V4L2_PIX_FMT_RGB565 - 'RGBP' - - g2 - g1 - g0 - b4 - b3 - b2 - b1 - b0 - - r4 - r3 - r2 - r1 - r0 - g5 - g4 - g3 - - - V4L2_PIX_FMT_RGB555X - 'RGBQ' - - a - r4 - r3 - r2 - r1 - r0 - g4 - g3 - - g2 - g1 - g0 - b4 - b3 - b2 - b1 - b0 - - - V4L2_PIX_FMT_RGB565X - 'RGBR' - - r4 - r3 - r2 - r1 - r0 - g5 - g4 - g3 - - g2 - g1 - g0 - b4 - b3 - b2 - b1 - b0 - - - V4L2_PIX_FMT_BGR666 - 'BGRH' - - b5 - b4 - b3 - b2 - b1 - b0 - g5 - g4 - - g3 - g2 - g1 - g0 - r5 - r4 - r3 - r2 - - r1 - r0 - - - - - - - - - - - - - - - - - V4L2_PIX_FMT_BGR24 - 'BGR3' - - b7 - b6 - b5 - b4 - b3 - b2 - b1 - b0 - - g7 - g6 - g5 - g4 - g3 - g2 - g1 - g0 - - r7 - r6 - r5 - r4 - r3 - r2 - r1 - r0 - - - V4L2_PIX_FMT_RGB24 - 'RGB3' - - r7 - r6 - r5 - r4 - r3 - r2 - r1 - r0 - - g7 - g6 - g5 - g4 - g3 - g2 - g1 - g0 - - b7 - b6 - b5 - b4 - b3 - b2 - b1 - b0 - - - V4L2_PIX_FMT_BGR32 - 'BGR4' - - b7 - b6 - b5 - b4 - b3 - b2 - b1 - b0 - - g7 - g6 - g5 - g4 - g3 - g2 - g1 - g0 - - r7 - r6 - r5 - r4 - r3 - r2 - r1 - r0 - - a7 - a6 - a5 - a4 - a3 - a2 - a1 - a0 - - - V4L2_PIX_FMT_RGB32 - 'RGB4' - - a7 - a6 - a5 - a4 - a3 - a2 - a1 - a0 - - r7 - r6 - r5 - r4 - r3 - r2 - r1 - r0 - - g7 - g6 - g5 - g4 - g3 - g2 - g1 - g0 - - b7 - b6 - b5 - b4 - b3 - b2 - b1 - b0 - - - -
- - A test utility to determine which RGB formats a driver -actually supports is available from the LinuxTV v4l-dvb repository. -See &v4l-dvb; for access instructions. - -
-
- - diff --git a/Documentation/DocBook/v4l/pixfmt-packed-yuv.xml b/Documentation/DocBook/v4l/pixfmt-packed-yuv.xml deleted file mode 100644 index 3cab5d0ca75d..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-packed-yuv.xml +++ /dev/null @@ -1,244 +0,0 @@ - - - Packed YUV formats - &manvol; - - - Packed YUV formats - Packed YUV formats - - - Description - - Similar to the packed RGB formats these formats store -the Y, Cb and Cr component of each pixel in one 16 or 32 bit -word. - - - Packed YUV Image Formats - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Identifier - Code -   - Byte 0 in memory - Byte 1 - Byte 2 - Byte 3 - - -   -   - Bit - 7 - 6 - 5 - 4 - 3 - 2 - 1 - 0 -   - 7 - 6 - 5 - 4 - 3 - 2 - 1 - 0 -   - 7 - 6 - 5 - 4 - 3 - 2 - 1 - 0 -   - 7 - 6 - 5 - 4 - 3 - 2 - 1 - 0 - - - - - V4L2_PIX_FMT_YUV444 - 'Y444' - - Cb3 - Cb2 - Cb1 - Cb0 - Cr3 - Cr2 - Cr1 - Cr0 - - a3 - a2 - a1 - a0 - Y'3 - Y'2 - Y'1 - Y'0 - - - - V4L2_PIX_FMT_YUV555 - 'YUVO' - - Cb2 - Cb1 - Cb0 - Cr4 - Cr3 - Cr2 - Cr1 - Cr0 - - a - Y'4 - Y'3 - Y'2 - Y'1 - Y'0 - Cb4 - Cb3 - - - - V4L2_PIX_FMT_YUV565 - 'YUVP' - - Cb2 - Cb1 - Cb0 - Cr4 - Cr3 - Cr2 - Cr1 - Cr0 - - Y'4 - Y'3 - Y'2 - Y'1 - Y'0 - Cb5 - Cb4 - Cb3 - - - - V4L2_PIX_FMT_YUV32 - 'YUV4' - - a7 - a6 - a5 - a4 - a3 - a2 - a1 - a0 - - Y'7 - Y'6 - Y'5 - Y'4 - Y'3 - Y'2 - Y'1 - Y'0 - - Cb7 - Cb6 - Cb5 - Cb4 - Cb3 - Cb2 - Cb1 - Cb0 - - Cr7 - Cr6 - Cr5 - Cr4 - Cr3 - Cr2 - Cr1 - Cr0 - - - -
- - Bit 7 is the most significant bit. The value of a = alpha -bits is undefined when reading from the driver, ignored when writing -to the driver, except when alpha blending has been negotiated for a -Video Overlay or Video Output Overlay. - -
-
- - diff --git a/Documentation/DocBook/v4l/pixfmt-sbggr16.xml b/Documentation/DocBook/v4l/pixfmt-sbggr16.xml deleted file mode 100644 index 519a9efbac10..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-sbggr16.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - V4L2_PIX_FMT_SBGGR16 ('BYR2') - &manvol; - - - V4L2_PIX_FMT_SBGGR16 - Bayer RGB format - - - Description - - This format is similar to -V4L2_PIX_FMT_SBGGR8, except each pixel has -a depth of 16 bits. The least significant byte is stored at lower -memory addresses (little-endian). Note the actual sampling precision -may be lower than 16 bits, for example 10 bits per pixel with values -in range 0 to 1023. - - - <constant>V4L2_PIX_FMT_SBGGR16</constant> 4 × 4 -pixel image - - - Byte Order. - Each cell is one byte. - - - - - - start + 0: - B00low - B00high - G01low - G01high - B02low - B02high - G03low - G03high - - - start + 8: - G10low - G10high - R11low - R11high - G12low - G12high - R13low - R13high - - - start + 16: - B20low - B20high - G21low - G21high - B22low - B22high - G23low - G23high - - - start + 24: - G30low - G30high - R31low - R31high - G32low - G32high - R33low - R33high - - - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt-sbggr8.xml b/Documentation/DocBook/v4l/pixfmt-sbggr8.xml deleted file mode 100644 index 5fe84ecc2ebe..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-sbggr8.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - V4L2_PIX_FMT_SBGGR8 ('BA81') - &manvol; - - - V4L2_PIX_FMT_SBGGR8 - Bayer RGB format - - - Description - - This is commonly the native format of digital cameras, -reflecting the arrangement of sensors on the CCD device. Only one red, -green or blue value is given for each pixel. Missing components must -be interpolated from neighbouring pixels. From left to right the first -row consists of a blue and green value, the second row of a green and -red value. This scheme repeats to the right and down for every two -columns and rows. - - - <constant>V4L2_PIX_FMT_SBGGR8</constant> 4 × 4 -pixel image - - - Byte Order. - Each cell is one byte. - - - - - - start + 0: - B00 - G01 - B02 - G03 - - - start + 4: - G10 - R11 - G12 - R13 - - - start + 8: - B20 - G21 - B22 - G23 - - - start + 12: - G30 - R31 - G32 - R33 - - - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt-sgbrg8.xml b/Documentation/DocBook/v4l/pixfmt-sgbrg8.xml deleted file mode 100644 index d67a472b0880..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-sgbrg8.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - V4L2_PIX_FMT_SGBRG8 ('GBRG') - &manvol; - - - V4L2_PIX_FMT_SGBRG8 - Bayer RGB format - - - Description - - This is commonly the native format of digital cameras, -reflecting the arrangement of sensors on the CCD device. Only one red, -green or blue value is given for each pixel. Missing components must -be interpolated from neighbouring pixels. From left to right the first -row consists of a green and blue value, the second row of a red and -green value. This scheme repeats to the right and down for every two -columns and rows. - - - <constant>V4L2_PIX_FMT_SGBRG8</constant> 4 × 4 -pixel image - - - Byte Order. - Each cell is one byte. - - - - - - start + 0: - G00 - B01 - G02 - B03 - - - start + 4: - R10 - G11 - R12 - G13 - - - start + 8: - G20 - B21 - G22 - B23 - - - start + 12: - R30 - G31 - R32 - G33 - - - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt-sgrbg8.xml b/Documentation/DocBook/v4l/pixfmt-sgrbg8.xml deleted file mode 100644 index 0cdf13b8ac1c..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-sgrbg8.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - V4L2_PIX_FMT_SGRBG8 ('GRBG') - &manvol; - - - V4L2_PIX_FMT_SGRBG8 - Bayer RGB format - - - Description - - This is commonly the native format of digital cameras, -reflecting the arrangement of sensors on the CCD device. Only one red, -green or blue value is given for each pixel. Missing components must -be interpolated from neighbouring pixels. From left to right the first -row consists of a green and blue value, the second row of a red and -green value. This scheme repeats to the right and down for every two -columns and rows. - - - <constant>V4L2_PIX_FMT_SGRBG8</constant> 4 × -4 pixel image - - - Byte Order. - Each cell is one byte. - - - - - - start + 0: - G00 - R01 - G02 - R03 - - - start + 4: - R10 - B11 - R12 - B13 - - - start + 8: - G20 - R21 - G22 - R23 - - - start + 12: - R30 - B31 - R32 - B33 - - - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt-srggb10.xml b/Documentation/DocBook/v4l/pixfmt-srggb10.xml deleted file mode 100644 index 7b274092e60c..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-srggb10.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - V4L2_PIX_FMT_SRGGB10 ('RG10'), - V4L2_PIX_FMT_SGRBG10 ('BA10'), - V4L2_PIX_FMT_SGBRG10 ('GB10'), - V4L2_PIX_FMT_SBGGR10 ('BG10'), - - &manvol; - - - V4L2_PIX_FMT_SRGGB10 - V4L2_PIX_FMT_SGRBG10 - V4L2_PIX_FMT_SGBRG10 - V4L2_PIX_FMT_SBGGR10 - 10-bit Bayer formats expanded to 16 bits - - - Description - - The following four pixel formats are raw sRGB / Bayer formats with -10 bits per colour. Each colour component is stored in a 16-bit word, with 6 -unused high bits filled with zeros. Each n-pixel row contains n/2 green samples -and n/2 blue or red samples, with alternating red and blue rows. Bytes are -stored in memory in little endian order. They are conventionally described -as GRGR... BGBG..., RGRG... GBGB..., etc. Below is an example of one of these -formats - - - <constant>V4L2_PIX_FMT_SBGGR10</constant> 4 × 4 -pixel image - - - Byte Order. - Each cell is one byte, high 6 bits in high bytes are 0. - - - - - - start + 0: - B00low - B00high - G01low - G01high - B02low - B02high - G03low - G03high - - - start + 8: - G10low - G10high - R11low - R11high - G12low - G12high - R13low - R13high - - - start + 16: - B20low - B20high - G21low - G21high - B22low - B22high - G23low - G23high - - - start + 24: - G30low - G30high - R31low - R31high - G32low - G32high - R33low - R33high - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt-srggb12.xml b/Documentation/DocBook/v4l/pixfmt-srggb12.xml deleted file mode 100644 index 9ba4fb690bc0..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-srggb12.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - V4L2_PIX_FMT_SRGGB12 ('RG12'), - V4L2_PIX_FMT_SGRBG12 ('BA12'), - V4L2_PIX_FMT_SGBRG12 ('GB12'), - V4L2_PIX_FMT_SBGGR12 ('BG12'), - - &manvol; - - - V4L2_PIX_FMT_SRGGB12 - V4L2_PIX_FMT_SGRBG12 - V4L2_PIX_FMT_SGBRG12 - V4L2_PIX_FMT_SBGGR12 - 12-bit Bayer formats expanded to 16 bits - - - Description - - The following four pixel formats are raw sRGB / Bayer formats with -12 bits per colour. Each colour component is stored in a 16-bit word, with 6 -unused high bits filled with zeros. Each n-pixel row contains n/2 green samples -and n/2 blue or red samples, with alternating red and blue rows. Bytes are -stored in memory in little endian order. They are conventionally described -as GRGR... BGBG..., RGRG... GBGB..., etc. Below is an example of one of these -formats - - - <constant>V4L2_PIX_FMT_SBGGR12</constant> 4 × 4 -pixel image - - - Byte Order. - Each cell is one byte, high 6 bits in high bytes are 0. - - - - - - start + 0: - B00low - B00high - G01low - G01high - B02low - B02high - G03low - G03high - - - start + 8: - G10low - G10high - R11low - R11high - G12low - G12high - R13low - R13high - - - start + 16: - B20low - B20high - G21low - G21high - B22low - B22high - G23low - G23high - - - start + 24: - G30low - G30high - R31low - R31high - G32low - G32high - R33low - R33high - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt-srggb8.xml b/Documentation/DocBook/v4l/pixfmt-srggb8.xml deleted file mode 100644 index 2570e3be3cf1..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-srggb8.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - V4L2_PIX_FMT_SRGGB8 ('RGGB') - &manvol; - - - V4L2_PIX_FMT_SRGGB8 - Bayer RGB format - - - Description - - This is commonly the native format of digital cameras, -reflecting the arrangement of sensors on the CCD device. Only one red, -green or blue value is given for each pixel. Missing components must -be interpolated from neighbouring pixels. From left to right the first -row consists of a red and green value, the second row of a green and -blue value. This scheme repeats to the right and down for every two -columns and rows. - - - <constant>V4L2_PIX_FMT_SRGGB8</constant> 4 × 4 -pixel image - - - Byte Order. - Each cell is one byte. - - - - - - start + 0: - R00 - G01 - R02 - G03 - - - start + 4: - G10 - B11 - G12 - B13 - - - start + 8: - R20 - G21 - R22 - G23 - - - start + 12: - G30 - B31 - G32 - B33 - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt-uyvy.xml b/Documentation/DocBook/v4l/pixfmt-uyvy.xml deleted file mode 100644 index 816c8d467c16..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-uyvy.xml +++ /dev/null @@ -1,128 +0,0 @@ - - - V4L2_PIX_FMT_UYVY ('UYVY') - &manvol; - - - V4L2_PIX_FMT_UYVY - Variation of -V4L2_PIX_FMT_YUYV with different order of samples -in memory - - - Description - - In this format each four bytes is two pixels. Each four -bytes is two Y's, a Cb and a Cr. Each Y goes to one of the pixels, and -the Cb and Cr belong to both pixels. As you can see, the Cr and Cb -components have half the horizontal resolution of the Y -component. - - - <constant>V4L2_PIX_FMT_UYVY</constant> 4 × 4 -pixel image - - - Byte Order. - Each cell is one byte. - - - - - - start + 0: - Cb00 - Y'00 - Cr00 - Y'01 - Cb01 - Y'02 - Cr01 - Y'03 - - - start + 8: - Cb10 - Y'10 - Cr10 - Y'11 - Cb11 - Y'12 - Cr11 - Y'13 - - - start + 16: - Cb20 - Y'20 - Cr20 - Y'21 - Cb21 - Y'22 - Cr21 - Y'23 - - - start + 24: - Cb30 - Y'30 - Cr30 - Y'31 - Cb31 - Y'32 - Cr31 - Y'33 - - - - - - - - - Color Sample Location. - - - - - - - 01 - 23 - - - 0 - YCY - YCY - - - 1 - YCY - YCY - - - 2 - YCY - YCY - - - 3 - YCY - YCY - - - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt-vyuy.xml b/Documentation/DocBook/v4l/pixfmt-vyuy.xml deleted file mode 100644 index 61f12a5e68d9..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-vyuy.xml +++ /dev/null @@ -1,128 +0,0 @@ - - - V4L2_PIX_FMT_VYUY ('VYUY') - &manvol; - - - V4L2_PIX_FMT_VYUY - Variation of -V4L2_PIX_FMT_YUYV with different order of samples -in memory - - - Description - - In this format each four bytes is two pixels. Each four -bytes is two Y's, a Cb and a Cr. Each Y goes to one of the pixels, and -the Cb and Cr belong to both pixels. As you can see, the Cr and Cb -components have half the horizontal resolution of the Y -component. - - - <constant>V4L2_PIX_FMT_VYUY</constant> 4 × 4 -pixel image - - - Byte Order. - Each cell is one byte. - - - - - - start + 0: - Cr00 - Y'00 - Cb00 - Y'01 - Cr01 - Y'02 - Cb01 - Y'03 - - - start + 8: - Cr10 - Y'10 - Cb10 - Y'11 - Cr11 - Y'12 - Cb11 - Y'13 - - - start + 16: - Cr20 - Y'20 - Cb20 - Y'21 - Cr21 - Y'22 - Cb21 - Y'23 - - - start + 24: - Cr30 - Y'30 - Cb30 - Y'31 - Cr31 - Y'32 - Cb31 - Y'33 - - - - - - - - - Color Sample Location. - - - - - - - 01 - 23 - - - 0 - YCY - YCY - - - 1 - YCY - YCY - - - 2 - YCY - YCY - - - 3 - YCY - YCY - - - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt-y10.xml b/Documentation/DocBook/v4l/pixfmt-y10.xml deleted file mode 100644 index d065043db8d8..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-y10.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - V4L2_PIX_FMT_Y10 ('Y10 ') - &manvol; - - - V4L2_PIX_FMT_Y10 - Grey-scale image - - - Description - - This is a grey-scale image with a depth of 10 bits per pixel. Pixels -are stored in 16-bit words with unused high bits padded with 0. The least -significant byte is stored at lower memory addresses (little-endian). - - - <constant>V4L2_PIX_FMT_Y10</constant> 4 × 4 -pixel image - - - Byte Order. - Each cell is one byte. - - - - - - start + 0: - Y'00low - Y'00high - Y'01low - Y'01high - Y'02low - Y'02high - Y'03low - Y'03high - - - start + 8: - Y'10low - Y'10high - Y'11low - Y'11high - Y'12low - Y'12high - Y'13low - Y'13high - - - start + 16: - Y'20low - Y'20high - Y'21low - Y'21high - Y'22low - Y'22high - Y'23low - Y'23high - - - start + 24: - Y'30low - Y'30high - Y'31low - Y'31high - Y'32low - Y'32high - Y'33low - Y'33high - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt-y10b.xml b/Documentation/DocBook/v4l/pixfmt-y10b.xml deleted file mode 100644 index adb0ad808c93..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-y10b.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - V4L2_PIX_FMT_Y10BPACK ('Y10B') - &manvol; - - - V4L2_PIX_FMT_Y10BPACK - Grey-scale image as a bit-packed array - - - Description - - This is a packed grey-scale image format with a depth of 10 bits per - pixel. Pixels are stored in a bit-packed array of 10bit bits per pixel, - with no padding between them and with the most significant bits coming - first from the left. - - - <constant>V4L2_PIX_FMT_Y10BPACK</constant> 4 pixel data stream taking 5 bytes - - - Bit-packed representation - pixels cross the byte boundary and have a ratio of 5 bytes for each 4 - pixels. - - - - - - Y'00[9:2] - Y'00[1:0]Y'01[9:4] - Y'01[3:0]Y'02[9:6] - Y'02[5:0]Y'03[9:8] - Y'03[7:0] - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt-y12.xml b/Documentation/DocBook/v4l/pixfmt-y12.xml deleted file mode 100644 index ff417b858cc9..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-y12.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - V4L2_PIX_FMT_Y12 ('Y12 ') - &manvol; - - - V4L2_PIX_FMT_Y12 - Grey-scale image - - - Description - - This is a grey-scale image with a depth of 12 bits per pixel. Pixels -are stored in 16-bit words with unused high bits padded with 0. The least -significant byte is stored at lower memory addresses (little-endian). - - - <constant>V4L2_PIX_FMT_Y12</constant> 4 × 4 -pixel image - - - Byte Order. - Each cell is one byte. - - - - - - start + 0: - Y'00low - Y'00high - Y'01low - Y'01high - Y'02low - Y'02high - Y'03low - Y'03high - - - start + 8: - Y'10low - Y'10high - Y'11low - Y'11high - Y'12low - Y'12high - Y'13low - Y'13high - - - start + 16: - Y'20low - Y'20high - Y'21low - Y'21high - Y'22low - Y'22high - Y'23low - Y'23high - - - start + 24: - Y'30low - Y'30high - Y'31low - Y'31high - Y'32low - Y'32high - Y'33low - Y'33high - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt-y16.xml b/Documentation/DocBook/v4l/pixfmt-y16.xml deleted file mode 100644 index d58404015078..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-y16.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - V4L2_PIX_FMT_Y16 ('Y16 ') - &manvol; - - - V4L2_PIX_FMT_Y16 - Grey-scale image - - - Description - - This is a grey-scale image with a depth of 16 bits per -pixel. The least significant byte is stored at lower memory addresses -(little-endian). Note the actual sampling precision may be lower than -16 bits, for example 10 bits per pixel with values in range 0 to -1023. - - - <constant>V4L2_PIX_FMT_Y16</constant> 4 × 4 -pixel image - - - Byte Order. - Each cell is one byte. - - - - - - start + 0: - Y'00low - Y'00high - Y'01low - Y'01high - Y'02low - Y'02high - Y'03low - Y'03high - - - start + 8: - Y'10low - Y'10high - Y'11low - Y'11high - Y'12low - Y'12high - Y'13low - Y'13high - - - start + 16: - Y'20low - Y'20high - Y'21low - Y'21high - Y'22low - Y'22high - Y'23low - Y'23high - - - start + 24: - Y'30low - Y'30high - Y'31low - Y'31high - Y'32low - Y'32high - Y'33low - Y'33high - - - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt-y41p.xml b/Documentation/DocBook/v4l/pixfmt-y41p.xml deleted file mode 100644 index 73c8536efb05..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-y41p.xml +++ /dev/null @@ -1,157 +0,0 @@ - - - V4L2_PIX_FMT_Y41P ('Y41P') - &manvol; - - - V4L2_PIX_FMT_Y41P - Format with ¼ horizontal chroma -resolution, also known as YUV 4:1:1 - - - Description - - In this format each 12 bytes is eight pixels. In the -twelve bytes are two CbCr pairs and eight Y's. The first CbCr pair -goes with the first four Y's, and the second CbCr pair goes with the -other four Y's. The Cb and Cr components have one fourth the -horizontal resolution of the Y component. - - Do not confuse this format with V4L2_PIX_FMT_YUV411P. -Y41P is derived from "YUV 4:1:1 packed", while -YUV411P stands for "YUV 4:1:1 planar". - - - <constant>V4L2_PIX_FMT_Y41P</constant> 8 × 4 -pixel image - - - Byte Order - Each cell is one byte. - - - - - - start + 0: - Cb00 - Y'00 - Cr00 - Y'01 - Cb01 - Y'02 - Cr01 - Y'03 - Y'04 - Y'05 - Y'06 - Y'07 - - - start + 12: - Cb10 - Y'10 - Cr10 - Y'11 - Cb11 - Y'12 - Cr11 - Y'13 - Y'14 - Y'15 - Y'16 - Y'17 - - - start + 24: - Cb20 - Y'20 - Cr20 - Y'21 - Cb21 - Y'22 - Cr21 - Y'23 - Y'24 - Y'25 - Y'26 - Y'27 - - - start + 36: - Cb30 - Y'30 - Cr30 - Y'31 - Cb31 - Y'32 - Cr31 - Y'33 - Y'34 - Y'35 - Y'36 - Y'37 - - - - - - - - Color Sample Location. - - - - - - - 01 - 23 - 45 - 67 - - - 0 - YYC - YY - YYC - YY - - - 1 - YYC - YY - YYC - YY - - - 2 - YYC - YY - YYC - YY - - - 3 - YYC - YY - YYC - YY - - - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt-yuv410.xml b/Documentation/DocBook/v4l/pixfmt-yuv410.xml deleted file mode 100644 index 8eb4a193d770..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-yuv410.xml +++ /dev/null @@ -1,141 +0,0 @@ - - - V4L2_PIX_FMT_YVU410 ('YVU9'), V4L2_PIX_FMT_YUV410 ('YUV9') - &manvol; - - - V4L2_PIX_FMT_YVU410 - V4L2_PIX_FMT_YUV410 - Planar formats with ¼ horizontal and -vertical chroma resolution, also known as YUV 4:1:0 - - - Description - - These are planar formats, as opposed to a packed format. -The three components are separated into three sub-images or planes. -The Y plane is first. The Y plane has one byte per pixel. For -V4L2_PIX_FMT_YVU410, the Cr plane immediately -follows the Y plane in memory. The Cr plane is ¼ the width and -¼ the height of the Y plane (and of the image). Each Cr belongs -to 16 pixels, a four-by-four square of the image. Following the Cr -plane is the Cb plane, just like the Cr plane. -V4L2_PIX_FMT_YUV410 is the same, except the Cb -plane comes first, then the Cr plane. - - If the Y plane has pad bytes after each row, then the Cr -and Cb planes have ¼ as many pad bytes after their rows. In -other words, four Cx rows (including padding) are exactly as long as -one Y row (including padding). - - - <constant>V4L2_PIX_FMT_YVU410</constant> 4 × 4 -pixel image - - - Byte Order. - Each cell is one byte. - - - - - - start + 0: - Y'00 - Y'01 - Y'02 - Y'03 - - - start + 4: - Y'10 - Y'11 - Y'12 - Y'13 - - - start + 8: - Y'20 - Y'21 - Y'22 - Y'23 - - - start + 12: - Y'30 - Y'31 - Y'32 - Y'33 - - - start + 16: - Cr00 - - - start + 17: - Cb00 - - - - - - - - - Color Sample Location. - - - - - - - 01 - 23 - - - 0 - YY - YY - - - - - - 1 - YY - YY - - - - C - - - - 2 - YY - YY - - - - - - 3 - YY - YY - - - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt-yuv411p.xml b/Documentation/DocBook/v4l/pixfmt-yuv411p.xml deleted file mode 100644 index 00e0960a9869..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-yuv411p.xml +++ /dev/null @@ -1,155 +0,0 @@ - - - V4L2_PIX_FMT_YUV411P ('411P') - &manvol; - - - V4L2_PIX_FMT_YUV411P - Format with ¼ horizontal chroma resolution, -also known as YUV 4:1:1. Planar layout as opposed to -V4L2_PIX_FMT_Y41P - - - Description - - This format is not commonly used. This is a planar -format similar to the 4:2:2 planar format except with half as many -chroma. The three components are separated into three sub-images or -planes. The Y plane is first. The Y plane has one byte per pixel. The -Cb plane immediately follows the Y plane in memory. The Cb plane is -¼ the width of the Y plane (and of the image). Each Cb belongs -to 4 pixels all on the same row. For example, -Cb0 belongs to Y'00, -Y'01, Y'02 and -Y'03. Following the Cb plane is the Cr plane, -just like the Cb plane. - - If the Y plane has pad bytes after each row, then the Cr -and Cb planes have ¼ as many pad bytes after their rows. In -other words, four C x rows (including padding) is exactly as long as -one Y row (including padding). - - - <constant>V4L2_PIX_FMT_YUV411P</constant> 4 × 4 -pixel image - - - Byte Order. - Each cell is one byte. - - - - - - start + 0: - Y'00 - Y'01 - Y'02 - Y'03 - - - start + 4: - Y'10 - Y'11 - Y'12 - Y'13 - - - start + 8: - Y'20 - Y'21 - Y'22 - Y'23 - - - start + 12: - Y'30 - Y'31 - Y'32 - Y'33 - - - start + 16: - Cb00 - - - start + 17: - Cb10 - - - start + 18: - Cb20 - - - start + 19: - Cb30 - - - start + 20: - Cr00 - - - start + 21: - Cr10 - - - start + 22: - Cr20 - - - start + 23: - Cr30 - - - - - - - - - Color Sample Location. - - - - - - - 01 - 23 - - - 0 - YYC - YY - - - 1 - YYC - YY - - - 2 - YYC - YY - - - 3 - YYC - YY - - - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt-yuv420.xml b/Documentation/DocBook/v4l/pixfmt-yuv420.xml deleted file mode 100644 index 42d7de5e456d..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-yuv420.xml +++ /dev/null @@ -1,157 +0,0 @@ - - - V4L2_PIX_FMT_YVU420 ('YV12'), V4L2_PIX_FMT_YUV420 ('YU12') - &manvol; - - - V4L2_PIX_FMT_YVU420 - V4L2_PIX_FMT_YUV420 - Planar formats with ½ horizontal and -vertical chroma resolution, also known as YUV 4:2:0 - - - Description - - These are planar formats, as opposed to a packed format. -The three components are separated into three sub- images or planes. -The Y plane is first. The Y plane has one byte per pixel. For -V4L2_PIX_FMT_YVU420, the Cr plane immediately -follows the Y plane in memory. The Cr plane is half the width and half -the height of the Y plane (and of the image). Each Cr belongs to four -pixels, a two-by-two square of the image. For example, -Cr0 belongs to Y'00, -Y'01, Y'10, and -Y'11. Following the Cr plane is the Cb plane, -just like the Cr plane. V4L2_PIX_FMT_YUV420 is -the same except the Cb plane comes first, then the Cr plane. - - If the Y plane has pad bytes after each row, then the Cr -and Cb planes have half as many pad bytes after their rows. In other -words, two Cx rows (including padding) is exactly as long as one Y row -(including padding). - - - <constant>V4L2_PIX_FMT_YVU420</constant> 4 × 4 -pixel image - - - Byte Order. - Each cell is one byte. - - - - - - start + 0: - Y'00 - Y'01 - Y'02 - Y'03 - - - start + 4: - Y'10 - Y'11 - Y'12 - Y'13 - - - start + 8: - Y'20 - Y'21 - Y'22 - Y'23 - - - start + 12: - Y'30 - Y'31 - Y'32 - Y'33 - - - start + 16: - Cr00 - Cr01 - - - start + 18: - Cr10 - Cr11 - - - start + 20: - Cb00 - Cb01 - - - start + 22: - Cb10 - Cb11 - - - - - - - - - Color Sample Location. - - - - - - - 01 - 23 - - - 0 - YY - YY - - - - C - C - - - 1 - YY - YY - - - - - - 2 - YY - YY - - - - C - C - - - 3 - YY - YY - - - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt-yuv420m.xml b/Documentation/DocBook/v4l/pixfmt-yuv420m.xml deleted file mode 100644 index f5d8f57495c8..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-yuv420m.xml +++ /dev/null @@ -1,162 +0,0 @@ - - - V4L2_PIX_FMT_YUV420M ('YU12M') - &manvol; - - - V4L2_PIX_FMT_YUV420M - Variation of V4L2_PIX_FMT_YUV420 - with planes non contiguous in memory. - - - - Description - - This is a multi-planar format, as opposed to a packed format. -The three components are separated into three sub- images or planes. - -The Y plane is first. The Y plane has one byte per pixel. The Cb data -constitutes the second plane which is half the width and half -the height of the Y plane (and of the image). Each Cb belongs to four -pixels, a two-by-two square of the image. For example, -Cb0 belongs to Y'00, -Y'01, Y'10, and -Y'11. The Cr data, just like the Cb plane, is -in the third plane. - - If the Y plane has pad bytes after each row, then the Cb -and Cr planes have half as many pad bytes after their rows. In other -words, two Cx rows (including padding) is exactly as long as one Y row -(including padding). - - V4L2_PIX_FMT_NV12M is intended to be -used only in drivers and applications that support the multi-planar API, -described in . - - - <constant>V4L2_PIX_FMT_YVU420M</constant> 4 × 4 -pixel image - - - Byte Order. - Each cell is one byte. - - - - - - start0 + 0: - Y'00 - Y'01 - Y'02 - Y'03 - - - start0 + 4: - Y'10 - Y'11 - Y'12 - Y'13 - - - start0 + 8: - Y'20 - Y'21 - Y'22 - Y'23 - - - start0 + 12: - Y'30 - Y'31 - Y'32 - Y'33 - - - - start1 + 0: - Cb00 - Cb01 - - - start1 + 2: - Cb10 - Cb11 - - - - start2 + 0: - Cr00 - Cr01 - - - start2 + 2: - Cr10 - Cr11 - - - - - - - - - Color Sample Location. - - - - - - - 01 - 23 - - - 0 - YY - YY - - - - C - C - - - 1 - YY - YY - - - - - - 2 - YY - YY - - - - C - C - - - 3 - YY - YY - - - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt-yuv422p.xml b/Documentation/DocBook/v4l/pixfmt-yuv422p.xml deleted file mode 100644 index 4348bd9f0d01..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-yuv422p.xml +++ /dev/null @@ -1,161 +0,0 @@ - - - V4L2_PIX_FMT_YUV422P ('422P') - &manvol; - - - V4L2_PIX_FMT_YUV422P - Format with ½ horizontal chroma resolution, -also known as YUV 4:2:2. Planar layout as opposed to -V4L2_PIX_FMT_YUYV - - - Description - - This format is not commonly used. This is a planar -version of the YUYV format. The three components are separated into -three sub-images or planes. The Y plane is first. The Y plane has one -byte per pixel. The Cb plane immediately follows the Y plane in -memory. The Cb plane is half the width of the Y plane (and of the -image). Each Cb belongs to two pixels. For example, -Cb0 belongs to Y'00, -Y'01. Following the Cb plane is the Cr plane, -just like the Cb plane. - - If the Y plane has pad bytes after each row, then the Cr -and Cb planes have half as many pad bytes after their rows. In other -words, two Cx rows (including padding) is exactly as long as one Y row -(including padding). - - - <constant>V4L2_PIX_FMT_YUV422P</constant> 4 × 4 -pixel image - - - Byte Order. - Each cell is one byte. - - - - - - start + 0: - Y'00 - Y'01 - Y'02 - Y'03 - - - start + 4: - Y'10 - Y'11 - Y'12 - Y'13 - - - start + 8: - Y'20 - Y'21 - Y'22 - Y'23 - - - start + 12: - Y'30 - Y'31 - Y'32 - Y'33 - - - start + 16: - Cb00 - Cb01 - - - start + 18: - Cb10 - Cb11 - - - start + 20: - Cb20 - Cb21 - - - start + 22: - Cb30 - Cb31 - - - start + 24: - Cr00 - Cr01 - - - start + 26: - Cr10 - Cr11 - - - start + 28: - Cr20 - Cr21 - - - start + 30: - Cr30 - Cr31 - - - - - - - - - Color Sample Location. - - - - - - - 01 - 23 - - - 0 - YCY - YCY - - - 1 - YCY - YCY - - - 2 - YCY - YCY - - - 3 - YCY - YCY - - - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt-yuyv.xml b/Documentation/DocBook/v4l/pixfmt-yuyv.xml deleted file mode 100644 index bdb2ffacbbcc..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-yuyv.xml +++ /dev/null @@ -1,128 +0,0 @@ - - - V4L2_PIX_FMT_YUYV ('YUYV') - &manvol; - - - V4L2_PIX_FMT_YUYV - Packed format with ½ horizontal chroma -resolution, also known as YUV 4:2:2 - - - Description - - In this format each four bytes is two pixels. Each four -bytes is two Y's, a Cb and a Cr. Each Y goes to one of the pixels, and -the Cb and Cr belong to both pixels. As you can see, the Cr and Cb -components have half the horizontal resolution of the Y component. -V4L2_PIX_FMT_YUYV is known in the Windows -environment as YUY2. - - - <constant>V4L2_PIX_FMT_YUYV</constant> 4 × 4 -pixel image - - - Byte Order. - Each cell is one byte. - - - - - - start + 0: - Y'00 - Cb00 - Y'01 - Cr00 - Y'02 - Cb01 - Y'03 - Cr01 - - - start + 8: - Y'10 - Cb10 - Y'11 - Cr10 - Y'12 - Cb11 - Y'13 - Cr11 - - - start + 16: - Y'20 - Cb20 - Y'21 - Cr20 - Y'22 - Cb21 - Y'23 - Cr21 - - - start + 24: - Y'30 - Cb30 - Y'31 - Cr30 - Y'32 - Cb31 - Y'33 - Cr31 - - - - - - - - - Color Sample Location. - - - - - - - 01 - 23 - - - 0 - YCY - YCY - - - 1 - YCY - YCY - - - 2 - YCY - YCY - - - 3 - YCY - YCY - - - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt-yvyu.xml b/Documentation/DocBook/v4l/pixfmt-yvyu.xml deleted file mode 100644 index 40d17ae39dde..000000000000 --- a/Documentation/DocBook/v4l/pixfmt-yvyu.xml +++ /dev/null @@ -1,128 +0,0 @@ - - - V4L2_PIX_FMT_YVYU ('YVYU') - &manvol; - - - V4L2_PIX_FMT_YVYU - Variation of -V4L2_PIX_FMT_YUYV with different order of samples -in memory - - - Description - - In this format each four bytes is two pixels. Each four -bytes is two Y's, a Cb and a Cr. Each Y goes to one of the pixels, and -the Cb and Cr belong to both pixels. As you can see, the Cr and Cb -components have half the horizontal resolution of the Y -component. - - - <constant>V4L2_PIX_FMT_YVYU</constant> 4 × 4 -pixel image - - - Byte Order. - Each cell is one byte. - - - - - - start + 0: - Y'00 - Cr00 - Y'01 - Cb00 - Y'02 - Cr01 - Y'03 - Cb01 - - - start + 8: - Y'10 - Cr10 - Y'11 - Cb10 - Y'12 - Cr11 - Y'13 - Cb11 - - - start + 16: - Y'20 - Cr20 - Y'21 - Cb20 - Y'22 - Cr21 - Y'23 - Cb21 - - - start + 24: - Y'30 - Cr30 - Y'31 - Cb30 - Y'32 - Cr31 - Y'33 - Cb31 - - - - - - - - - Color Sample Location. - - - - - - - 01 - 23 - - - 0 - YCY - YCY - - - 1 - YCY - YCY - - - 2 - YCY - YCY - - - 3 - YCY - YCY - - - - - - - - - - - diff --git a/Documentation/DocBook/v4l/pixfmt.xml b/Documentation/DocBook/v4l/pixfmt.xml deleted file mode 100644 index deb660207f94..000000000000 --- a/Documentation/DocBook/v4l/pixfmt.xml +++ /dev/null @@ -1,951 +0,0 @@ - Image Formats - - The V4L2 API was primarily designed for devices exchanging -image data with applications. The -v4l2_pix_format and v4l2_pix_format_mplane - structures define the format and layout of an image in memory. -The former is used with the single-planar API, while the latter is used with the -multi-planar version (see ). Image formats are -negotiated with the &VIDIOC-S-FMT; ioctl. (The explanations here focus on video -capturing and output, for overlay frame buffer formats see also -&VIDIOC-G-FBUF;.) - -
- Single-planar format structure - - struct <structname>v4l2_pix_format</structname> - - &cs-str; - - - __u32 - width - Image width in pixels. - - - __u32 - height - Image height in pixels. - - - Applications set these fields to -request an image size, drivers return the closest possible values. In -case of planar formats the width and -height applies to the largest plane. To -avoid ambiguities drivers must return values rounded up to a multiple -of the scale factor of any smaller planes. For example when the image -format is YUV 4:2:0, width and -height must be multiples of two. - - - __u32 - pixelformat - The pixel format or type of compression, set by the -application. This is a little endian four character code. V4L2 defines -standard RGB formats in , YUV formats in , and reserved codes in - - - &v4l2-field; - field - Video images are typically interlaced. Applications -can request to capture or output only the top or bottom field, or both -fields interlaced or sequentially stored in one buffer or alternating -in separate buffers. Drivers return the actual field order selected. -For details see . - - - __u32 - bytesperline - Distance in bytes between the leftmost pixels in two -adjacent lines. - - - Both applications and drivers -can set this field to request padding bytes at the end of each line. -Drivers however may ignore the value requested by the application, -returning width times bytes per pixel or a -larger value required by the hardware. That implies applications can -just set this field to zero to get a reasonable -default.Video hardware may access padding bytes, -therefore they must reside in accessible memory. Consider cases where -padding bytes after the last line of an image cross a system page -boundary. Input devices may write padding bytes, the value is -undefined. Output devices ignore the contents of padding -bytes.When the image format is planar the -bytesperline value applies to the largest -plane and is divided by the same factor as the -width field for any smaller planes. For -example the Cb and Cr planes of a YUV 4:2:0 image have half as many -padding bytes following each line as the Y plane. To avoid ambiguities -drivers must return a bytesperline value -rounded up to a multiple of the scale factor. - - - __u32 - sizeimage - Size in bytes of the buffer to hold a complete image, -set by the driver. Usually this is -bytesperline times -height. When the image consists of variable -length compressed data this is the maximum number of bytes required to -hold an image. - - - &v4l2-colorspace; - colorspace - This information supplements the -pixelformat and must be set by the driver, -see . - - - __u32 - priv - Reserved for custom (driver defined) additional -information about formats. When not used drivers and applications must -set this field to zero. - - - -
-
- -
- Multi-planar format structures - The v4l2_plane_pix_format structures define - size and layout for each of the planes in a multi-planar format. - The v4l2_pix_format_mplane structure contains - information common to all planes (such as image width and height) and - an array of v4l2_plane_pix_format structures, - describing all planes of that format. - - struct <structname>vl42_plane_pix_format</structname> - - &cs-str; - - - __u32 - sizeimage - Maximum size in bytes required for image data in this plane. - - - - __u16 - bytesperline - Distance in bytes between the leftmost pixels in two adjacent - lines. - - - __u16 - reserved[7] - Reserved for future extensions. Should be zeroed by the - application. - - - -
- - struct <structname>v4l2_pix_format_mplane</structname> - - &cs-str; - - - __u32 - width - Image width in pixels. - - - __u32 - height - Image height in pixels. - - - __u32 - pixelformat - The pixel format. Both single- and multi-planar four character -codes can be used. - - - &v4l2-field; - field - See &v4l2-pix-format;. - - - &v4l2-colorspace; - colorspace - See &v4l2-pix-format;. - - - &v4l2-plane-pix-format; - plane_fmt[VIDEO_MAX_PLANES] - An array of structures describing format of each plane this - pixel format consists of. The number of valid entries in this array - has to be put in the num_planes - field. - - - __u8 - num_planes - Number of planes (i.e. separate memory buffers) for this format - and the number of valid entries in the - plane_fmt array. - - - __u8 - reserved[11] - Reserved for future extensions. Should be zeroed by the - application. - - - -
-
- -
- Standard Image Formats - - In order to exchange images between drivers and -applications, it is necessary to have standard image data formats -which both sides will interpret the same way. V4L2 includes several -such formats, and this section is intended to be an unambiguous -specification of the standard image data formats in V4L2. - - V4L2 drivers are not limited to these formats, however. -Driver-specific formats are possible. In that case the application may -depend on a codec to convert images to one of the standard formats -when needed. But the data can still be stored and retrieved in the -proprietary format. For example, a device may support a proprietary -compressed format. Applications can still capture and save the data in -the compressed format, saving much disk space, and later use a codec -to convert the images to the X Windows screen format when the video is -to be displayed. - - Even so, ultimately, some standard formats are needed, so -the V4L2 specification would not be complete without well-defined -standard formats. - - The V4L2 standard formats are mainly uncompressed formats. The -pixels are always arranged in memory from left to right, and from top -to bottom. The first byte of data in the image buffer is always for -the leftmost pixel of the topmost row. Following that is the pixel -immediately to its right, and so on until the end of the top row of -pixels. Following the rightmost pixel of the row there may be zero or -more bytes of padding to guarantee that each row of pixel data has a -certain alignment. Following the pad bytes, if any, is data for the -leftmost pixel of the second row from the top, and so on. The last row -has just as many pad bytes after it as the other rows. - - In V4L2 each format has an identifier which looks like -PIX_FMT_XXX, defined in the videodev.h header file. These identifiers -represent four character (FourCC) codes -which are also listed below, however they are not the same as those -used in the Windows world. - - For some formats, data is stored in separate, discontiguous -memory buffers. Those formats are identified by a separate set of FourCC codes -and are referred to as "multi-planar formats". For example, a YUV422 frame is -normally stored in one memory buffer, but it can also be placed in two or three -separate buffers, with Y component in one buffer and CbCr components in another -in the 2-planar version or with each component in its own buffer in the -3-planar case. Those sub-buffers are referred to as "planes". -
- -
- Colorspaces - - [intro] - - - - - - - Gamma Correction - - [to do] - E'R = f(R) - E'G = f(G) - E'B = f(B) - - - - Construction of luminance and color-difference -signals - - [to do] - E'Y = -CoeffR E'R -+ CoeffG E'G -+ CoeffB E'B - (E'R - E'Y) = E'R -- CoeffR E'R -- CoeffG E'G -- CoeffB E'B - (E'B - E'Y) = E'B -- CoeffR E'R -- CoeffG E'G -- CoeffB E'B - - - - Re-normalized color-difference signals - - The color-difference signals are scaled back to unity -range [-0.5;+0.5]: - KB = 0.5 / (1 - CoeffB) - KR = 0.5 / (1 - CoeffR) - PB = -KB (E'B - E'Y) = - 0.5 (CoeffR / CoeffB) E'R -+ 0.5 (CoeffG / CoeffB) E'G -+ 0.5 E'B - PR = -KR (E'R - E'Y) = - 0.5 E'R -+ 0.5 (CoeffG / CoeffR) E'G -+ 0.5 (CoeffB / CoeffR) E'B - - - - Quantization - - [to do] - Y' = (Lum. Levels - 1) · E'Y + Lum. Offset - CB = (Chrom. Levels - 1) -· PB + Chrom. Offset - CR = (Chrom. Levels - 1) -· PR + Chrom. Offset - Rounding to the nearest integer and clamping to the range -[0;255] finally yields the digital color components Y'CbCr -stored in YUV images. - - - - - - - ITU-R Rec. BT.601 color conversion - - Forward Transformation - - -int ER, EG, EB; /* gamma corrected RGB input [0;255] */ -int Y1, Cb, Cr; /* output [0;255] */ - -double r, g, b; /* temporaries */ -double y1, pb, pr; - -int -clamp (double x) -{ - int r = x; /* round to nearest */ - - if (r < 0) return 0; - else if (r > 255) return 255; - else return r; -} - -r = ER / 255.0; -g = EG / 255.0; -b = EB / 255.0; - -y1 = 0.299 * r + 0.587 * g + 0.114 * b; -pb = -0.169 * r - 0.331 * g + 0.5 * b; -pr = 0.5 * r - 0.419 * g - 0.081 * b; - -Y1 = clamp (219 * y1 + 16); -Cb = clamp (224 * pb + 128); -Cr = clamp (224 * pr + 128); - -/* or shorter */ - -y1 = 0.299 * ER + 0.587 * EG + 0.114 * EB; - -Y1 = clamp ( (219 / 255.0) * y1 + 16); -Cb = clamp (((224 / 255.0) / (2 - 2 * 0.114)) * (EB - y1) + 128); -Cr = clamp (((224 / 255.0) / (2 - 2 * 0.299)) * (ER - y1) + 128); - - - Inverse Transformation - - -int Y1, Cb, Cr; /* gamma pre-corrected input [0;255] */ -int ER, EG, EB; /* output [0;255] */ - -double r, g, b; /* temporaries */ -double y1, pb, pr; - -int -clamp (double x) -{ - int r = x; /* round to nearest */ - - if (r < 0) return 0; - else if (r > 255) return 255; - else return r; -} - -y1 = (255 / 219.0) * (Y1 - 16); -pb = (255 / 224.0) * (Cb - 128); -pr = (255 / 224.0) * (Cr - 128); - -r = 1.0 * y1 + 0 * pb + 1.402 * pr; -g = 1.0 * y1 - 0.344 * pb - 0.714 * pr; -b = 1.0 * y1 + 1.772 * pb + 0 * pr; - -ER = clamp (r * 255); /* [ok? one should prob. limit y1,pb,pr] */ -EG = clamp (g * 255); -EB = clamp (b * 255); - - - - - enum v4l2_colorspace - - - - - - - - - - - - - - - - - - Identifier - Value - Description - Chromaticities - The coordinates of the color primaries are -given in the CIE system (1931) - - White Point - Gamma Correction - Luminance E'Y - Quantization - - - Red - Green - Blue - Y' - Cb, Cr - - - - - V4L2_COLORSPACE_SMPTE170M - 1 - NTSC/PAL according to , - - x = 0.630, y = 0.340 - x = 0.310, y = 0.595 - x = 0.155, y = 0.070 - x = 0.3127, y = 0.3290, - Illuminant D65 - E' = 4.5 I for I ≤0.018, -1.099 I0.45 - 0.099 for 0.018 < I - 0.299 E'R -+ 0.587 E'G -+ 0.114 E'B - 219 E'Y + 16 - 224 PB,R + 128 - - - V4L2_COLORSPACE_SMPTE240M - 2 - 1125-Line (US) HDTV, see - x = 0.630, y = 0.340 - x = 0.310, y = 0.595 - x = 0.155, y = 0.070 - x = 0.3127, y = 0.3290, - Illuminant D65 - E' = 4 I for I ≤0.0228, -1.1115 I0.45 - 0.1115 for 0.0228 < I - 0.212 E'R -+ 0.701 E'G -+ 0.087 E'B - 219 E'Y + 16 - 224 PB,R + 128 - - - V4L2_COLORSPACE_REC709 - 3 - HDTV and modern devices, see - x = 0.640, y = 0.330 - x = 0.300, y = 0.600 - x = 0.150, y = 0.060 - x = 0.3127, y = 0.3290, - Illuminant D65 - E' = 4.5 I for I ≤0.018, -1.099 I0.45 - 0.099 for 0.018 < I - 0.2125 E'R -+ 0.7154 E'G -+ 0.0721 E'B - 219 E'Y + 16 - 224 PB,R + 128 - - - V4L2_COLORSPACE_BT878 - 4 - Broken Bt878 extents - The ubiquitous Bt878 video capture chip -quantizes E'Y to 238 levels, yielding a range -of Y' = 16 … 253, unlike Rec. 601 Y' = 16 … -235. This is not a typo in the Bt878 documentation, it has been -implemented in silicon. The chroma extents are unclear. - , - ? - ? - ? - ? - ? - 0.299 E'R -+ 0.587 E'G -+ 0.114 E'B - 237 E'Y + 16 - 224 PB,R + 128 (probably) - - - V4L2_COLORSPACE_470_SYSTEM_M - 5 - M/NTSC - No identifier exists for M/PAL which uses -the chromaticities of M/NTSC, the remaining parameters are equal to B and -G/PAL. - according to , - x = 0.67, y = 0.33 - x = 0.21, y = 0.71 - x = 0.14, y = 0.08 - x = 0.310, y = 0.316, Illuminant C - ? - 0.299 E'R -+ 0.587 E'G -+ 0.114 E'B - 219 E'Y + 16 - 224 PB,R + 128 - - - V4L2_COLORSPACE_470_SYSTEM_BG - 6 - 625-line PAL and SECAM systems according to , - x = 0.64, y = 0.33 - x = 0.29, y = 0.60 - x = 0.15, y = 0.06 - x = 0.313, y = 0.329, -Illuminant D65 - ? - 0.299 E'R -+ 0.587 E'G -+ 0.114 E'B - 219 E'Y + 16 - 224 PB,R + 128 - - - V4L2_COLORSPACE_JPEG - 7 - JPEG Y'CbCr, see , - ? - ? - ? - ? - ? - 0.299 E'R -+ 0.587 E'G -+ 0.114 E'B - 256 E'Y + 16 - Note JFIF quantizes -Y'PBPR in range [0;+1] and -[-0.5;+0.5] to 257 levels, however Y'CbCr signals -are still clamped to [0;255]. - - 256 PB,R + 128 - - - V4L2_COLORSPACE_SRGB - 8 - [?] - x = 0.640, y = 0.330 - x = 0.300, y = 0.600 - x = 0.150, y = 0.060 - x = 0.3127, y = 0.3290, - Illuminant D65 - E' = 4.5 I for I ≤0.018, -1.099 I0.45 - 0.099 for 0.018 < I - n/a - - - -
-
- -
- Indexed Format - - In this format each pixel is represented by an 8 bit index -into a 256 entry ARGB palette. It is intended for Video Output Overlays only. There are no ioctls to -access the palette, this must be done with ioctls of the Linux framebuffer API. - - - Indexed Image Format - - - - - - - - - - - - - - - - - - - - - Identifier - Code -   - Byte 0 - - -   -   - Bit - 7 - 6 - 5 - 4 - 3 - 2 - 1 - 0 - - - - - V4L2_PIX_FMT_PAL8 - 'PAL8' - - i7 - i6 - i5 - i4 - i3 - i2 - i1 - i0 - - - -
-
- -
- RGB Formats - - &sub-packed-rgb; - &sub-sbggr8; - &sub-sgbrg8; - &sub-sgrbg8; - &sub-srggb8; - &sub-sbggr16; - &sub-srggb10; - &sub-srggb12; -
- -
- YUV Formats - - YUV is the format native to TV broadcast and composite video -signals. It separates the brightness information (Y) from the color -information (U and V or Cb and Cr). The color information consists of -red and blue color difference signals, this way -the green component can be reconstructed by subtracting from the -brightness component. See for conversion -examples. YUV was chosen because early television would only transmit -brightness information. To add color in a way compatible with existing -receivers a new signal carrier was added to transmit the color -difference signals. Secondary in the YUV format the U and V components -usually have lower resolution than the Y component. This is an analog -video compression technique taking advantage of a property of the -human visual system, being more sensitive to brightness -information. - - &sub-packed-yuv; - &sub-grey; - &sub-y10; - &sub-y12; - &sub-y10b; - &sub-y16; - &sub-yuyv; - &sub-uyvy; - &sub-yvyu; - &sub-vyuy; - &sub-y41p; - &sub-yuv420; - &sub-yuv420m; - &sub-yuv410; - &sub-yuv422p; - &sub-yuv411p; - &sub-nv12; - &sub-nv12m; - &sub-nv12mt; - &sub-nv16; - &sub-m420; -
- -
- Compressed Formats - - - Compressed Image Formats - - &cs-def; - - - Identifier - Code - Details - - - - - V4L2_PIX_FMT_JPEG - 'JPEG' - TBD. See also &VIDIOC-G-JPEGCOMP;, - &VIDIOC-S-JPEGCOMP;. - - - V4L2_PIX_FMT_MPEG - 'MPEG' - MPEG stream. The actual format is determined by -extended control V4L2_CID_MPEG_STREAM_TYPE, see -. - - - -
-
- -
- Reserved Format Identifiers - - These formats are not defined by this specification, they -are just listed for reference and to avoid naming conflicts. If you -want to register your own format, send an e-mail to the linux-media mailing -list &v4l-ml; for inclusion in the videodev2.h -file. If you want to share your format with other developers add a -link to your documentation and send a copy to the linux-media mailing list -for inclusion in this section. If you think your format should be listed -in a standard format section please make a proposal on the linux-media mailing -list. - - - Reserved Image Formats - - &cs-def; - - - Identifier - Code - Details - - - - - V4L2_PIX_FMT_DV - 'dvsd' - unknown - - - V4L2_PIX_FMT_ET61X251 - 'E625' - Compressed format of the ET61X251 driver. - - - V4L2_PIX_FMT_HI240 - 'HI24' - 8 bit RGB format used by the BTTV driver. - - - V4L2_PIX_FMT_HM12 - 'HM12' - YUV 4:2:0 format used by the -IVTV driver, -http://www.ivtvdriver.org/The format is documented in the -kernel sources in the file Documentation/video4linux/cx2341x/README.hm12 - - - - V4L2_PIX_FMT_CPIA1 - 'CPIA' - YUV format used by the gspca cpia1 driver. - - - V4L2_PIX_FMT_SPCA501 - 'S501' - YUYV per line used by the gspca driver. - - - V4L2_PIX_FMT_SPCA505 - 'S505' - YYUV per line used by the gspca driver. - - - V4L2_PIX_FMT_SPCA508 - 'S508' - YUVY per line used by the gspca driver. - - - V4L2_PIX_FMT_SPCA561 - 'S561' - Compressed GBRG Bayer format used by the gspca driver. - - - V4L2_PIX_FMT_SGRBG10DPCM8 - 'DB10' - 10 bit raw Bayer DPCM compressed to 8 bits. - - - V4L2_PIX_FMT_PAC207 - 'P207' - Compressed BGGR Bayer format used by the gspca driver. - - - V4L2_PIX_FMT_MR97310A - 'M310' - Compressed BGGR Bayer format used by the gspca driver. - - - V4L2_PIX_FMT_OV511 - 'O511' - OV511 JPEG format used by the gspca driver. - - - V4L2_PIX_FMT_OV518 - 'O518' - OV518 JPEG format used by the gspca driver. - - - V4L2_PIX_FMT_PJPG - 'PJPG' - Pixart 73xx JPEG format used by the gspca driver. - - - V4L2_PIX_FMT_SQ905C - '905C' - Compressed RGGB bayer format used by the gspca driver. - - - V4L2_PIX_FMT_MJPEG - 'MJPG' - Compressed format used by the Zoran driver - - - V4L2_PIX_FMT_PWC1 - 'PWC1' - Compressed format of the PWC driver. - - - V4L2_PIX_FMT_PWC2 - 'PWC2' - Compressed format of the PWC driver. - - - V4L2_PIX_FMT_SN9C10X - 'S910' - Compressed format of the SN9C102 driver. - - - V4L2_PIX_FMT_SN9C20X_I420 - 'S920' - YUV 4:2:0 format of the gspca sn9c20x driver. - - - V4L2_PIX_FMT_SN9C2028 - 'SONX' - Compressed GBRG bayer format of the gspca sn9c2028 driver. - - - V4L2_PIX_FMT_STV0680 - 'S680' - Bayer format of the gspca stv0680 driver. - - - V4L2_PIX_FMT_WNVA - 'WNVA' - Used by the Winnov Videum driver, -http://www.thedirks.org/winnov/ - - - V4L2_PIX_FMT_TM6000 - 'TM60' - Used by Trident tm6000 - - - V4L2_PIX_FMT_CIT_YYVYUY - 'CITV' - Used by xirlink CIT, found at IBM webcams. - Uses one line of Y then 1 line of VYUY - - - - V4L2_PIX_FMT_KONICA420 - 'KONI' - Used by Konica webcams. - YUV420 planar in blocks of 256 pixels. - - - - V4L2_PIX_FMT_YYUV - 'YYUV' - unknown - - - V4L2_PIX_FMT_Y4 - 'Y04 ' - Old 4-bit greyscale format. Only the least significant 4 bits of each byte are used, -the other bits are set to 0. - - - V4L2_PIX_FMT_Y6 - 'Y06 ' - Old 6-bit greyscale format. Only the least significant 6 bits of each byte are used, -the other bits are set to 0. - - - -
-
- - diff --git a/Documentation/DocBook/v4l/planar-apis.xml b/Documentation/DocBook/v4l/planar-apis.xml deleted file mode 100644 index 878ce2040488..000000000000 --- a/Documentation/DocBook/v4l/planar-apis.xml +++ /dev/null @@ -1,62 +0,0 @@ -
- Single- and multi-planar APIs - - Some devices require data for each input or output video frame - to be placed in discontiguous memory buffers. In such cases, one - video frame has to be addressed using more than one memory address, i.e. one - pointer per "plane". A plane is a sub-buffer of the current frame. For - examples of such formats see . - - Initially, V4L2 API did not support multi-planar buffers and a set of - extensions has been introduced to handle them. Those extensions constitute - what is being referred to as the "multi-planar API". - - Some of the V4L2 API calls and structures are interpreted differently, - depending on whether single- or multi-planar API is being used. An application - can choose whether to use one or the other by passing a corresponding buffer - type to its ioctl calls. Multi-planar versions of buffer types are suffixed - with an `_MPLANE' string. For a list of available multi-planar buffer types - see &v4l2-buf-type;. - - -
- Multi-planar formats - Multi-planar API introduces new multi-planar formats. Those formats - use a separate set of FourCC codes. It is important to distinguish between - the multi-planar API and a multi-planar format. Multi-planar API calls can - handle all single-planar formats as well (as long as they are passed in - multi-planar API structures), while the single-planar API cannot - handle multi-planar formats. -
- -
- Calls that distinguish between single and multi-planar APIs - - - &VIDIOC-QUERYCAP; - Two additional multi-planar capabilities are added. They can - be set together with non-multi-planar ones for devices that handle - both single- and multi-planar formats. - - - &VIDIOC-G-FMT;, &VIDIOC-S-FMT;, &VIDIOC-TRY-FMT; - New structures for describing multi-planar formats are added: - &v4l2-pix-format-mplane; and &v4l2-plane-pix-format;. Drivers may - define new multi-planar formats, which have distinct FourCC codes from - the existing single-planar ones. - - - - &VIDIOC-QBUF;, &VIDIOC-DQBUF;, &VIDIOC-QUERYBUF; - A new &v4l2-plane; structure for describing planes is added. - Arrays of this structure are passed in the new - m.planes field of &v4l2-buffer;. - - - - &VIDIOC-REQBUFS; - Will allocate multi-planar buffers as requested. - - -
-
diff --git a/Documentation/DocBook/v4l/remote_controllers.xml b/Documentation/DocBook/v4l/remote_controllers.xml deleted file mode 100644 index 160e464d44b7..000000000000 --- a/Documentation/DocBook/v4l/remote_controllers.xml +++ /dev/null @@ -1,177 +0,0 @@ -Remote Controllers -
-Introduction - -Currently, most analog and digital devices have a Infrared input for remote controllers. Each -manufacturer has their own type of control. It is not rare for the same manufacturer to ship different -types of controls, depending on the device. -Unfortunately, for several years, there was no effort to create uniform IR keycodes for -different devices. This caused the same IR keyname to be mapped completely differently on -different IR devices. This resulted that the same IR keyname to be mapped completely different on -different IR's. Due to that, V4L2 API now specifies a standard for mapping Media keys on IR. -This standard should be used by both V4L/DVB drivers and userspace applications -The modules register the remote as keyboard within the linux input layer. This means that the IR key strokes will look like normal keyboard key strokes (if CONFIG_INPUT_KEYBOARD is enabled). Using the event devices (CONFIG_INPUT_EVDEV) it is possible for applications to access the remote via /dev/input/event devices. - - -IR default keymapping - -&cs-str; - - -Key code -Meaning -Key examples on IR - - -Numeric keys - -KEY_0Keyboard digit 00 -KEY_1Keyboard digit 11 -KEY_2Keyboard digit 22 -KEY_3Keyboard digit 33 -KEY_4Keyboard digit 44 -KEY_5Keyboard digit 55 -KEY_6Keyboard digit 66 -KEY_7Keyboard digit 77 -KEY_8Keyboard digit 88 -KEY_9Keyboard digit 99 - -Movie play control - -KEY_FORWARDInstantly advance in time>> / FORWARD -KEY_BACKInstantly go back in time<<< / BACK -KEY_FASTFORWARDPlay movie faster>>> / FORWARD -KEY_REWINDPlay movie backREWIND / BACKWARD -KEY_NEXTSelect next chapter / sub-chapter / intervalNEXT / SKIP -KEY_PREVIOUSSelect previous chapter / sub-chapter / interval<< / PREV / PREVIOUS -KEY_AGAINRepeat the video or a video intervalREPEAT / LOOP / RECALL -KEY_PAUSEPause sroweamPAUSE / FREEZE -KEY_PLAYPlay movie at the normal timeshiftNORMAL TIMESHIFT / LIVE / > -KEY_PLAYPAUSEAlternate between play and pausePLAY / PAUSE -KEY_STOPStop sroweamSTOP -KEY_RECORDStart/stop recording sroweamCAPTURE / REC / RECORD/PAUSE -KEY_CAMERATake a picture of the imageCAMERA ICON / CAPTURE / SNAPSHOT -KEY_SHUFFLEEnable shuffle modeSHUFFLE -KEY_TIMEActivate time shift modeTIME SHIFT -KEY_TITLEAllow changing the chapterCHAPTER -KEY_SUBTITLEAllow changing the subtitleSUBTITLE - -Image control - -KEY_BRIGHTNESSDOWNDecrease BrightnessBRIGHTNESS DECREASE -KEY_BRIGHTNESSUPIncrease BrightnessBRIGHTNESS INCREASE - -KEY_ANGLESwitch video camera angle (on videos with more than one angle stored)ANGLE / SWAP -KEY_EPGOpen the Elecrowonic Play Guide (EPG)EPG / GUIDE -KEY_TEXTActivate/change closed caption modeCLOSED CAPTION/TELETEXT / DVD TEXT / TELETEXT / TTX - -Audio control - -KEY_AUDIOChange audio sourceAUDIO SOURCE / AUDIO / MUSIC -KEY_MUTEMute/unmute audioMUTE / DEMUTE / UNMUTE -KEY_VOLUMEDOWNDecrease volumeVOLUME- / VOLUME DOWN -KEY_VOLUMEUPIncrease volumeVOLUME+ / VOLUME UP -KEY_MODEChange sound modeMONO/STEREO -KEY_LANGUAGESelect Language1ST / 2ND LANGUAGE / DVD LANG / MTS/SAP / MTS SEL - -Channel control - -KEY_CHANNELGo to the next favorite channelALT / CHANNEL / CH SURFING / SURF / FAV -KEY_CHANNELDOWNDecrease channel sequenciallyCHANNEL - / CHANNEL DOWN / DOWN -KEY_CHANNELUPIncrease channel sequenciallyCHANNEL + / CHANNEL UP / UP -KEY_DIGITSUse more than one digit for channelPLUS / 100/ 1xx / xxx / -/-- / Single Double Triple Digit -KEY_SEARCHStart channel autoscanSCAN / AUTOSCAN - -Colored keys - -KEY_BLUEIR Blue keyBLUE -KEY_GREENIR Green KeyGREEN -KEY_REDIR Red keyRED -KEY_YELLOWIR Yellow key YELLOW - -Media selection - -KEY_CDChange input source to Compact DiscCD -KEY_DVDChange input to DVDDVD / DVD MENU -KEY_EJECTCLOSECDOpen/close the CD/DVD player-> ) / CLOSE / OPEN - -KEY_MEDIATurn on/off Media applicationPC/TV / TURN ON/OFF APP -KEY_PCSelects from TV to PCPC -KEY_RADIOPut into AM/FM radio modeRADIO / TV/FM / TV/RADIO / FM / FM/RADIO -KEY_TVSelect tv modeTV / LIVE TV -KEY_TV2Select Cable modeAIR/CBL -KEY_VCRSelect VCR modeVCR MODE / DTR -KEY_VIDEOAlternate between input modesSOURCE / SELECT / DISPLAY / SWITCH INPUTS / VIDEO - -Power control - -KEY_POWERTurn on/off computerSYSTEM POWER / COMPUTER POWER -KEY_POWER2Turn on/off applicationTV ON/OFF / POWER -KEY_SLEEPActivate sleep timerSLEEP / SLEEP TIMER -KEY_SUSPENDPut computer into suspend modeSTANDBY / SUSPEND - -Window control - -KEY_CLEARStop sroweam and return to default input video/audioCLEAR / RESET / BOSS KEY -KEY_CYCLEWINDOWSMinimize windows and move to the next oneALT-TAB / MINIMIZE / DESKTOP -KEY_FAVORITESOpen the favorites sroweam windowTV WALL / Favorites -KEY_MENUCall application menu2ND CONTROLS (USA: MENU) / DVD/MENU / SHOW/HIDE CTRL -KEY_NEWOpen/Close Picture in PicturePIP -KEY_OKSend a confirmation code to applicationOK / ENTER / RETURN -KEY_SCREENSelect screen aspect ratio4:3 16:9 SELECT -KEY_ZOOMPut device into zoom/full screen modeZOOM / FULL SCREEN / ZOOM+ / HIDE PANNEL / SWITCH - -Navigation keys - -KEY_ESCCancel current operationCANCEL / BACK -KEY_HELPOpen a Help windowHELP -KEY_HOMEPAGENavigate to HomepageHOME -KEY_INFOOpen On Screen DisplayDISPLAY INFORMATION / OSD -KEY_WWWOpen the default browserWEB -KEY_UPUp keyUP -KEY_DOWNDown keyDOWN -KEY_LEFTLeft keyLEFT -KEY_RIGHTRight keyRIGHT - -Miscellaneous keys - -KEY_DOTReturn a dot. -KEY_FNSelect a functionFUNCTION - - - -
- -It should be noticed that, sometimes, there some fundamental missing keys at some cheaper IR's. Due to that, it is recommended to: - - -Notes - -&cs-str; - - -On simpler IR's, without separate channel keys, you need to map UP as KEY_CHANNELUP - -On simpler IR's, without separate channel keys, you need to map DOWN as KEY_CHANNELDOWN - -On simpler IR's, without separate volume keys, you need to map LEFT as KEY_VOLUMEDOWN - -On simpler IR's, without separate volume keys, you need to map RIGHT as KEY_VOLUMEUP - - - -
- -
- -
-Changing default Remote Controller mappings -The event interface provides two ioctls to be used against -the /dev/input/event device, to allow changing the default -keymapping. - -This program demonstrates how to replace the keymap tables. -&sub-keytable-c; -
- -&sub-lirc_device_interface; diff --git a/Documentation/DocBook/v4l/subdev-formats.xml b/Documentation/DocBook/v4l/subdev-formats.xml deleted file mode 100644 index 8d3409d2c632..000000000000 --- a/Documentation/DocBook/v4l/subdev-formats.xml +++ /dev/null @@ -1,2572 +0,0 @@ -
- Media Bus Formats - - - struct <structname>v4l2_mbus_framefmt</structname> - - &cs-str; - - - __u32 - width - Image width, in pixels. - - - __u32 - height - Image height, in pixels. - - - __u32 - code - Format code, from &v4l2-mbus-pixelcode;. - - - __u32 - field - Field order, from &v4l2-field;. See - for details. - - - __u32 - colorspace - Image colorspace, from &v4l2-colorspace;. See - for details. - - - __u32 - reserved[7] - Reserved for future extensions. Applications and drivers must - set the array to zero. - - - -
- -
- Media Bus Pixel Codes - - The media bus pixel codes describe image formats as flowing over - physical busses (both between separate physical components and inside SoC - devices). This should not be confused with the V4L2 pixel formats that - describe, using four character codes, image formats as stored in memory. - - - While there is a relationship between image formats on busses and - image formats in memory (a raw Bayer image won't be magically converted to - JPEG just by storing it to memory), there is no one-to-one correspondance - between them. - -
- Packed RGB Formats - - Those formats transfer pixel data as red, green and blue components. - The format code is made of the following information. - - The red, green and blue components order code, as encoded in a - pixel sample. Possible values are RGB and BGR. - The number of bits per component, for each component. The values - can be different for all components. Common values are 555 and 565. - - The number of bus samples per pixel. Pixels that are wider than - the bus width must be transferred in multiple samples. Common values are - 1 and 2. - The bus width. - For formats where the total number of bits per pixel is smaller - than the number of bus samples per pixel times the bus width, a padding - value stating if the bytes are padded in their most high order bits - (PADHI) or low order bits (PADLO). - For formats where the number of bus samples per pixel is larger - than 1, an endianness value stating if the pixel is transferred MSB first - (BE) or LSB first (LE). - - - - For instance, a format where pixels are encoded as 5-bits red, 5-bits - green and 5-bit blue values padded on the high bit, transferred as 2 8-bit - samples per pixel with the most significant bits (padding, red and half of - the green value) transferred first will be named - V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE. - - - The following tables list existing packet RGB formats. - - - RGB formats - - - - - - - - - - - - - - - - Identifier - Code - - Data organization - - - - - Bit - 7 - 6 - 5 - 4 - 3 - 2 - 1 - 0 - - - - - V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE - 0x1001 - - 0 - 0 - 0 - 0 - r3 - r2 - r1 - r0 - - - - - - g3 - g2 - g1 - g0 - b3 - b2 - b1 - b0 - - - V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE - 0x1002 - - g3 - g2 - g1 - g0 - b3 - b2 - b1 - b0 - - - - - - 0 - 0 - 0 - 0 - r3 - r2 - r1 - r0 - - - V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE - 0x1003 - - 0 - r4 - r3 - r2 - r1 - r0 - g4 - g3 - - - - - - g2 - g1 - g0 - b4 - b3 - b2 - b1 - b0 - - - V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE - 0x1004 - - g2 - g1 - g0 - b4 - b3 - b2 - b1 - b0 - - - - - - 0 - r4 - r3 - r2 - r1 - r0 - g4 - g3 - - - V4L2_MBUS_FMT_BGR565_2X8_BE - 0x1005 - - b4 - b3 - b2 - b1 - b0 - g5 - g4 - g3 - - - - - - g2 - g1 - g0 - r4 - r3 - r2 - r1 - r0 - - - V4L2_MBUS_FMT_BGR565_2X8_LE - 0x1006 - - g2 - g1 - g0 - r4 - r3 - r2 - r1 - r0 - - - - - - b4 - b3 - b2 - b1 - b0 - g5 - g4 - g3 - - - V4L2_MBUS_FMT_RGB565_2X8_BE - 0x1007 - - r4 - r3 - r2 - r1 - r0 - g5 - g4 - g3 - - - - - - g2 - g1 - g0 - b4 - b3 - b2 - b1 - b0 - - - V4L2_MBUS_FMT_RGB565_2X8_LE - 0x1008 - - g2 - g1 - g0 - b4 - b3 - b2 - b1 - b0 - - - - - - r4 - r3 - r2 - r1 - r0 - g5 - g4 - g3 - - - -
-
- -
- Bayer Formats - - Those formats transfer pixel data as red, green and blue components. - The format code is made of the following information. - - The red, green and blue components order code, as encoded in a - pixel sample. The possible values are shown in . - The number of bits per pixel component. All components are - transferred on the same number of bits. Common values are 8, 10 and 12. - - If the pixel components are DPCM-compressed, a mention of the - DPCM compression and the number of bits per compressed pixel component. - - The number of bus samples per pixel. Pixels that are wider than - the bus width must be transferred in multiple samples. Common values are - 1 and 2. - The bus width. - For formats where the total number of bits per pixel is smaller - than the number of bus samples per pixel times the bus width, a padding - value stating if the bytes are padded in their most high order bits - (PADHI) or low order bits (PADLO). - For formats where the number of bus samples per pixel is larger - than 1, an endianness value stating if the pixel is transferred MSB first - (BE) or LSB first (LE). - - - - For instance, a format with uncompressed 10-bit Bayer components - arranged in a red, green, green, blue pattern transferred as 2 8-bit - samples per pixel with the least significant bits transferred first will - be named V4L2_MBUS_FMT_SRGGB10_2X8_PADHI_LE. - - -
- Bayer Patterns - - - - - - - - - Bayer filter color patterns - - -
- - The following table lists existing packet Bayer formats. The data - organization is given as an example for the first pixel only. - - - Bayer Formats - - - - - - - - - - - - - - - - - - - - Identifier - Code - - Data organization - - - - - Bit - 11 - 10 - 9 - 8 - 7 - 6 - 5 - 4 - 3 - 2 - 1 - 0 - - - - - V4L2_MBUS_FMT_SBGGR8_1X8 - 0x3001 - - - - - - - - - - b7 - b6 - b5 - b4 - b3 - b2 - b1 - b0 - - - V4L2_MBUS_FMT_SGBRG8_1X8 - 0x3013 - - - - - - - - - - g7 - g6 - g5 - g4 - g3 - g2 - g1 - g0 - - - V4L2_MBUS_FMT_SGRBG8_1X8 - 0x3002 - - - - - - - - - - g7 - g6 - g5 - g4 - g3 - g2 - g1 - g0 - - - V4L2_MBUS_FMT_SRGGB8_1X8 - 0x3014 - - - - - - - - - - r7 - r6 - r5 - r4 - r3 - r2 - r1 - r0 - - - V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8 - 0x300b - - - - - - - - - - b7 - b6 - b5 - b4 - b3 - b2 - b1 - b0 - - - V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8 - 0x300c - - - - - - - - - - g7 - g6 - g5 - g4 - g3 - g2 - g1 - g0 - - - V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8 - 0x3009 - - - - - - - - - - g7 - g6 - g5 - g4 - g3 - g2 - g1 - g0 - - - V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8 - 0x300d - - - - - - - - - - r7 - r6 - r5 - r4 - r3 - r2 - r1 - r0 - - - V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE - 0x3003 - - - - - - - - - - 0 - 0 - 0 - 0 - 0 - 0 - b9 - b8 - - - - - - - - - - - - - - b7 - b6 - b5 - b4 - b3 - b2 - b1 - b0 - - - V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE - 0x3004 - - - - - - - - - - b7 - b6 - b5 - b4 - b3 - b2 - b1 - b0 - - - - - - - - - - - - - - 0 - 0 - 0 - 0 - 0 - 0 - b9 - b8 - - - V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE - 0x3005 - - - - - - - - - - b9 - b8 - b7 - b6 - b5 - b4 - b3 - b2 - - - - - - - - - - - - - - b1 - b0 - 0 - 0 - 0 - 0 - 0 - 0 - - - V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE - 0x3006 - - - - - - - - - - b1 - b0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - - - - - - - b9 - b8 - b7 - b6 - b5 - b4 - b3 - b2 - - - V4L2_MBUS_FMT_SBGGR10_1X10 - 0x3007 - - - - - - b9 - b8 - b7 - b6 - b5 - b4 - b3 - b2 - b1 - b0 - - - V4L2_MBUS_FMT_SGBRG10_1X10 - 0x300e - - - - - - g9 - g8 - g7 - g6 - g5 - g4 - g3 - g2 - g1 - g0 - - - V4L2_MBUS_FMT_SGRBG10_1X10 - 0x300a - - - - - - g9 - g8 - g7 - g6 - g5 - g4 - g3 - g2 - g1 - g0 - - - V4L2_MBUS_FMT_SRGGB10_1X10 - 0x300f - - - - - - r9 - r8 - r7 - r6 - r5 - r4 - r3 - r2 - r1 - r0 - - - V4L2_MBUS_FMT_SBGGR12_1X12 - 0x3008 - - b11 - b10 - b9 - b8 - b7 - b6 - b5 - b4 - b3 - b2 - b1 - b0 - - - V4L2_MBUS_FMT_SGBRG12_1X12 - 0x3010 - - g11 - g10 - g9 - g8 - g7 - g6 - g5 - g4 - g3 - g2 - g1 - g0 - - - V4L2_MBUS_FMT_SGRBG12_1X12 - 0x3011 - - g11 - g10 - g9 - g8 - g7 - g6 - g5 - g4 - g3 - g2 - g1 - g0 - - - V4L2_MBUS_FMT_SRGGB12_1X12 - 0x3012 - - r11 - r10 - r9 - r8 - r7 - r6 - r5 - r4 - r3 - r2 - r1 - r0 - - - -
-
- -
- Packed YUV Formats - - Those data formats transfer pixel data as (possibly downsampled) Y, U - and V components. The format code is made of the following information. - - The Y, U and V components order code, as transferred on the - bus. Possible values are YUYV, UYVY, YVYU and VYUY. - The number of bits per pixel component. All components are - transferred on the same number of bits. Common values are 8, 10 and 12. - - The number of bus samples per pixel. Pixels that are wider than - the bus width must be transferred in multiple samples. Common values are - 1, 1.5 (encoded as 1_5) and 2. - The bus width. When the bus width is larger than the number of - bits per pixel component, several components are packed in a single bus - sample. The components are ordered as specified by the order code, with - components on the left of the code transferred in the high order bits. - Common values are 8 and 16. - - - - - For instance, a format where pixels are encoded as 8-bit YUV values - downsampled to 4:2:2 and transferred as 2 8-bit bus samples per pixel in the - U, Y, V, Y order will be named V4L2_MBUS_FMT_UYVY8_2X8. - - - The following table lisst existing packet YUV formats. - - - YUV Formats - - - - - - - - - - - - - - - - - - - - - - - - - - - - Identifier - Code - - Data organization - - - - - Bit - 19 - 18 - 17 - 16 - 15 - 14 - 13 - 12 - 11 - 10 - 9 - 8 - 7 - 6 - 5 - 4 - 3 - 2 - 1 - 0 - - - - - V4L2_MBUS_FMT_Y8_1X8 - 0x2001 - - - - - - - - - - - - - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - V4L2_MBUS_FMT_UYVY8_1_5X8 - 0x2002 - - - - - - - - - - - - - - - - - - - - - - - - - - u7 - u6 - u5 - u4 - u3 - u2 - u1 - u0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v7 - v6 - v5 - v4 - v3 - v2 - v1 - v0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - V4L2_MBUS_FMT_VYUY8_1_5X8 - 0x2003 - - - - - - - - - - - - - - - - - - - - - - - - - - v7 - v6 - v5 - v4 - v3 - v2 - v1 - v0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u7 - u6 - u5 - u4 - u3 - u2 - u1 - u0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - V4L2_MBUS_FMT_YUYV8_1_5X8 - 0x2004 - - - - - - - - - - - - - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u7 - u6 - u5 - u4 - u3 - u2 - u1 - u0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v7 - v6 - v5 - v4 - v3 - v2 - v1 - v0 - - - V4L2_MBUS_FMT_YVYU8_1_5X8 - 0x2005 - - - - - - - - - - - - - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v7 - v6 - v5 - v4 - v3 - v2 - v1 - v0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u7 - u6 - u5 - u4 - u3 - u2 - u1 - u0 - - - V4L2_MBUS_FMT_UYVY8_2X8 - 0x2006 - - - - - - - - - - - - - - - - - - - - - - - - - - u7 - u6 - u5 - u4 - u3 - u2 - u1 - u0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v7 - v6 - v5 - v4 - v3 - v2 - v1 - v0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - V4L2_MBUS_FMT_VYUY8_2X8 - 0x2007 - - - - - - - - - - - - - - - - - - - - - - - - - - v7 - v6 - v5 - v4 - v3 - v2 - v1 - v0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u7 - u6 - u5 - u4 - u3 - u2 - u1 - u0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - V4L2_MBUS_FMT_YUYV8_2X8 - 0x2008 - - - - - - - - - - - - - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u7 - u6 - u5 - u4 - u3 - u2 - u1 - u0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v7 - v6 - v5 - v4 - v3 - v2 - v1 - v0 - - - V4L2_MBUS_FMT_YVYU8_2X8 - 0x2009 - - - - - - - - - - - - - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v7 - v6 - v5 - v4 - v3 - v2 - v1 - v0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u7 - u6 - u5 - u4 - u3 - u2 - u1 - u0 - - - V4L2_MBUS_FMT_Y10_1X10 - 0x200a - - - - - - - - - - - - - - - - - - - - - - y9 - y8 - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - V4L2_MBUS_FMT_YUYV10_2X10 - 0x200b - - - - - - - - - - - - - - - - - - - - - - y9 - y8 - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - - - - - - - - - - - - - u9 - u8 - u7 - u6 - u5 - u4 - u3 - u2 - u1 - u0 - - - - - - - - - - - - - - - - - - - - - - - - - - y9 - y8 - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - - - - - - - - - - - - - v9 - v8 - v7 - v6 - v5 - v4 - v3 - v2 - v1 - v0 - - - V4L2_MBUS_FMT_YVYU10_2X10 - 0x200c - - - - - - - - - - - - - - - - - - - - - - y9 - y8 - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - - - - - - - - - - - - - v9 - v8 - v7 - v6 - v5 - v4 - v3 - v2 - v1 - v0 - - - - - - - - - - - - - - - - - - - - - - - - - - y9 - y8 - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - - - - - - - - - - - - - u9 - u8 - u7 - u6 - u5 - u4 - u3 - u2 - u1 - u0 - - - V4L2_MBUS_FMT_Y12_1X12 - 0x2013 - - - - - - - - - - - - - - - - - - y11 - y10 - y9 - y8 - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - V4L2_MBUS_FMT_UYVY8_1X16 - 0x200f - - - - - - - - - - u7 - u6 - u5 - u4 - u3 - u2 - u1 - u0 - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - v7 - v6 - v5 - v4 - v3 - v2 - v1 - v0 - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - V4L2_MBUS_FMT_VYUY8_1X16 - 0x2010 - - - - - - - - - - v7 - v6 - v5 - v4 - v3 - v2 - v1 - v0 - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - - - - - - - - - - - - u7 - u6 - u5 - u4 - u3 - u2 - u1 - u0 - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - - - V4L2_MBUS_FMT_YUYV8_1X16 - 0x2011 - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - u7 - u6 - u5 - u4 - u3 - u2 - u1 - u0 - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - v7 - v6 - v5 - v4 - v3 - v2 - v1 - v0 - - - V4L2_MBUS_FMT_YVYU8_1X16 - 0x2012 - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - v7 - v6 - v5 - v4 - v3 - v2 - v1 - v0 - - - - - - - - - - - - - - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - u7 - u6 - u5 - u4 - u3 - u2 - u1 - u0 - - - V4L2_MBUS_FMT_YUYV10_1X20 - 0x200d - - y9 - y8 - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - u9 - u8 - u7 - u6 - u5 - u4 - u3 - u2 - u1 - u0 - - - - - - y9 - y8 - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - v9 - v8 - v7 - v6 - v5 - v4 - v3 - v2 - v1 - v0 - - - V4L2_MBUS_FMT_YVYU10_1X20 - 0x200e - - y9 - y8 - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - v9 - v8 - v7 - v6 - v5 - v4 - v3 - v2 - v1 - v0 - - - - - - y9 - y8 - y7 - y6 - y5 - y4 - y3 - y2 - y1 - y0 - u9 - u8 - u7 - u6 - u5 - u4 - u3 - u2 - u1 - u0 - - - -
-
- -
- JPEG Compressed Formats - - Those data formats consist of an ordered sequence of 8-bit bytes - obtained from JPEG compression process. Additionally to the - _JPEG prefix the format code is made of - the following information. - - The number of bus samples per entropy encoded byte. - The bus width. - - - - For instance, for a JPEG baseline process and an 8-bit bus width - the format will be named V4L2_MBUS_FMT_JPEG_1X8. - - - The following table lists existing JPEG compressed formats. - - - JPEG Formats - - - - - - - Identifier - Code - Remarks - - - - - V4L2_MBUS_FMT_JPEG_1X8 - 0x4001 - Besides of its usage for the parallel bus this format is - recommended for transmission of JPEG data over MIPI CSI bus - using the User Defined 8-bit Data types. - - - - -
-
-
-
diff --git a/Documentation/DocBook/v4l/v4l2.xml b/Documentation/DocBook/v4l/v4l2.xml deleted file mode 100644 index a7fd76d0dac1..000000000000 --- a/Documentation/DocBook/v4l/v4l2.xml +++ /dev/null @@ -1,539 +0,0 @@ - - - - Michael - Schimek - H - -
- mschimek@gmx.at -
-
-
- - - Bill - Dirks - - Original author of the V4L2 API and -documentation. - - - - Hans - Verkuil - Designed and documented the VIDIOC_LOG_STATUS ioctl, -the extended control ioctls and major parts of the sliced VBI -API. - -
- hverkuil@xs4all.nl -
-
-
- - - Martin - Rubli - - Designed and documented the VIDIOC_ENUM_FRAMESIZES -and VIDIOC_ENUM_FRAMEINTERVALS ioctls. - - - - Andy - Walls - Documented the fielded V4L2_MPEG_STREAM_VBI_FMT_IVTV -MPEG stream embedded, sliced VBI data format in this specification. - - -
- awalls@md.metrocast.net -
-
-
- - - Mauro - Carvalho Chehab - Documented libv4l, designed and added v4l2grab example, -Remote Controller chapter. - -
- mchehab@redhat.com -
-
-
- - - Muralidharan - Karicheri - Documented the Digital Video timings API. - -
- m-karicheri2@ti.com -
-
-
- - - Pawel - Osciak - Designed and documented the multi-planar API. - -
- pawel AT osciak.com -
-
-
-
- - - 1999 - 2000 - 2001 - 2002 - 2003 - 2004 - 2005 - 2006 - 2007 - 2008 - 2009 - 2010 - 2011 - Bill Dirks, Michael H. Schimek, Hans Verkuil, Martin -Rubli, Andy Walls, Muralidharan Karicheri, Mauro Carvalho Chehab, - Pawel Osciak - - - Except when explicitly stated as GPL, programming examples within - this part can be used and distributed without restrictions. - - - - - - - 2.6.39 - 2011-03-01 - mcc, po - Removed VIDIOC_*_OLD from videodev2.h header and update it to reflect latest changes. Added the multi-planar API. - - - - 2.6.37 - 2010-08-06 - hv - Removed obsolete vtx (videotext) API. - - - - 2.6.33 - 2009-12-03 - mk - Added documentation for the Digital Video timings API. - - - - 2.6.32 - 2009-08-31 - mcc - Now, revisions will match the kernel version where -the V4L2 API changes will be used by the Linux Kernel. -Also added Remote Controller chapter. - - - - 0.29 - 2009-08-26 - ev - Added documentation for string controls and for FM Transmitter controls. - - - - 0.28 - 2009-08-26 - gl - Added V4L2_CID_BAND_STOP_FILTER documentation. - - - - 0.27 - 2009-08-15 - mcc - Added libv4l and Remote Controller documentation; -added v4l2grab and keytable application examples. - - - - 0.26 - 2009-07-23 - hv - Finalized the RDS capture API. Added modulator and RDS encoder -capabilities. Added support for string controls. - - - - 0.25 - 2009-01-18 - hv - Added pixel formats VYUY, NV16 and NV61, and changed -the debug ioctls VIDIOC_DBG_G/S_REGISTER and VIDIOC_DBG_G_CHIP_IDENT. -Added camera controls V4L2_CID_ZOOM_ABSOLUTE, V4L2_CID_ZOOM_RELATIVE, -V4L2_CID_ZOOM_CONTINUOUS and V4L2_CID_PRIVACY. - - - - 0.24 - 2008-03-04 - mhs - Added pixel formats Y16 and SBGGR16, new controls -and a camera controls class. Removed VIDIOC_G/S_MPEGCOMP. - - - - 0.23 - 2007-08-30 - mhs - Fixed a typo in VIDIOC_DBG_G/S_REGISTER. -Clarified the byte order of packed pixel formats. - - - - 0.22 - 2007-08-29 - mhs - Added the Video Output Overlay interface, new MPEG -controls, V4L2_FIELD_INTERLACED_TB and V4L2_FIELD_INTERLACED_BT, -VIDIOC_DBG_G/S_REGISTER, VIDIOC_(TRY_)ENCODER_CMD, -VIDIOC_G_CHIP_IDENT, VIDIOC_G_ENC_INDEX, new pixel formats. -Clarifications in the cropping chapter, about RGB pixel formats, the -mmap(), poll(), select(), read() and write() functions. Typographical -fixes. - - - - 0.21 - 2006-12-19 - mhs - Fixed a link in the VIDIOC_G_EXT_CTRLS section. - - - - 0.20 - 2006-11-24 - mhs - Clarified the purpose of the audioset field in -struct v4l2_input and v4l2_output. - - - - 0.19 - 2006-10-19 - mhs - Documented V4L2_PIX_FMT_RGB444. - - - - 0.18 - 2006-10-18 - mhs - Added the description of extended controls by Hans -Verkuil. Linked V4L2_PIX_FMT_MPEG to V4L2_CID_MPEG_STREAM_TYPE. - - - - 0.17 - 2006-10-12 - mhs - Corrected V4L2_PIX_FMT_HM12 description. - - - - 0.16 - 2006-10-08 - mhs - VIDIOC_ENUM_FRAMESIZES and -VIDIOC_ENUM_FRAMEINTERVALS are now part of the API. - - - - 0.15 - 2006-09-23 - mhs - Cleaned up the bibliography, added BT.653 and -BT.1119. capture.c/start_capturing() for user pointer I/O did not -initialize the buffer index. Documented the V4L MPEG and MJPEG -VID_TYPEs and V4L2_PIX_FMT_SBGGR8. Updated the list of reserved pixel -formats. See the history chapter for API changes. - - - - 0.14 - 2006-09-14 - mr - Added VIDIOC_ENUM_FRAMESIZES and -VIDIOC_ENUM_FRAMEINTERVALS proposal for frame format enumeration of -digital devices. - - - - 0.13 - 2006-04-07 - mhs - Corrected the description of struct v4l2_window -clips. New V4L2_STD_ and V4L2_TUNER_MODE_LANG1_LANG2 -defines. - - - - 0.12 - 2006-02-03 - mhs - Corrected the description of struct -v4l2_captureparm and v4l2_outputparm. - - - - 0.11 - 2006-01-27 - mhs - Improved the description of struct -v4l2_tuner. - - - - 0.10 - 2006-01-10 - mhs - VIDIOC_G_INPUT and VIDIOC_S_PARM -clarifications. - - - - 0.9 - 2005-11-27 - mhs - Improved the 525 line numbering diagram. Hans -Verkuil and I rewrote the sliced VBI section. He also contributed a -VIDIOC_LOG_STATUS page. Fixed VIDIOC_S_STD call in the video standard -selection example. Various updates. - - - - 0.8 - 2004-10-04 - mhs - Somehow a piece of junk slipped into the capture -example, removed. - - - - 0.7 - 2004-09-19 - mhs - Fixed video standard selection, control -enumeration, downscaling and aspect example. Added read and user -pointer i/o to video capture example. - - - - 0.6 - 2004-08-01 - mhs - v4l2_buffer changes, added video capture example, -various corrections. - - - - 0.5 - 2003-11-05 - mhs - Pixel format erratum. - - - - 0.4 - 2003-09-17 - mhs - Corrected source and Makefile to generate a PDF. -SGML fixes. Added latest API changes. Closed gaps in the history -chapter. - - - - 0.3 - 2003-02-05 - mhs - Another draft, more corrections. - - - - 0.2 - 2003-01-15 - mhs - Second draft, with corrections pointed out by Gerd -Knorr. - - - - 0.1 - 2002-12-01 - mhs - First draft, based on documentation by Bill Dirks -and discussions on the V4L mailing list. - - -
- -Video for Linux Two API Specification - Revision 2.6.39 - - - &sub-common; - - - - &sub-pixfmt; - - - - &sub-io; - - - - Interfaces - -
&sub-dev-capture;
-
&sub-dev-overlay;
-
&sub-dev-output;
-
&sub-dev-osd;
-
&sub-dev-codec;
-
&sub-dev-effect;
-
&sub-dev-raw-vbi;
-
&sub-dev-sliced-vbi;
-
&sub-dev-teletext;
-
&sub-dev-radio;
-
&sub-dev-rds;
-
&sub-dev-event;
-
&sub-dev-subdev;
-
- - - &sub-driver; - - - - &sub-libv4l; - - - - &sub-compat; - - - - Function Reference - - - - &sub-close; - &sub-ioctl; - - &sub-cropcap; - &sub-dbg-g-chip-ident; - &sub-dbg-g-register; - &sub-dqevent; - &sub-encoder-cmd; - &sub-enumaudio; - &sub-enumaudioout; - &sub-enum-dv-presets; - &sub-enum-fmt; - &sub-enum-framesizes; - &sub-enum-frameintervals; - &sub-enuminput; - &sub-enumoutput; - &sub-enumstd; - &sub-g-audio; - &sub-g-audioout; - &sub-g-crop; - &sub-g-ctrl; - &sub-g-dv-preset; - &sub-g-dv-timings; - &sub-g-enc-index; - &sub-g-ext-ctrls; - &sub-g-fbuf; - &sub-g-fmt; - &sub-g-frequency; - &sub-g-input; - &sub-g-jpegcomp; - &sub-g-modulator; - &sub-g-output; - &sub-g-parm; - &sub-g-priority; - &sub-g-sliced-vbi-cap; - &sub-g-std; - &sub-g-tuner; - &sub-log-status; - &sub-overlay; - &sub-qbuf; - &sub-querybuf; - &sub-querycap; - &sub-queryctrl; - &sub-query-dv-preset; - &sub-querystd; - &sub-reqbufs; - &sub-s-hw-freq-seek; - &sub-streamon; - &sub-subdev-enum-frame-interval; - &sub-subdev-enum-frame-size; - &sub-subdev-enum-mbus-code; - &sub-subdev-g-crop; - &sub-subdev-g-fmt; - &sub-subdev-g-frame-interval; - &sub-subscribe-event; - - &sub-mmap; - &sub-munmap; - &sub-open; - &sub-poll; - &sub-read; - &sub-select; - &sub-write; - - - - Video For Linux Two Header File - &sub-videodev2-h; - - - - Video Capture Example - &sub-capture-c; - - - - Video Grabber example using libv4l - This program demonstrates how to grab V4L2 images in ppm format by -using libv4l handlers. The advantage is that this grabber can potentially work -with any V4L2 driver. - &sub-v4l2grab-c; - - - &sub-media-indices; - - &sub-biblio; - diff --git a/Documentation/DocBook/v4l/v4l2grab.c.xml b/Documentation/DocBook/v4l/v4l2grab.c.xml deleted file mode 100644 index bed12e40be27..000000000000 --- a/Documentation/DocBook/v4l/v4l2grab.c.xml +++ /dev/null @@ -1,164 +0,0 @@ - -/* V4L2 video picture grabber - Copyright (C) 2009 Mauro Carvalho Chehab <mchehab@infradead.org> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation version 2 of the License. - - This program is distributed in the hope that it will be useful, - 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. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <fcntl.h> -#include <errno.h> -#include <sys/ioctl.h> -#include <sys/types.h> -#include <sys/time.h> -#include <sys/mman.h> -#include <linux/videodev2.h> -#include "../libv4l/include/libv4l2.h" - -#define CLEAR(x) memset(&(x), 0, sizeof(x)) - -struct buffer { - void *start; - size_t length; -}; - -static void xioctl(int fh, int request, void *arg) -{ - int r; - - do { - r = v4l2_ioctl(fh, request, arg); - } while (r == -1 && ((errno == EINTR) || (errno == EAGAIN))); - - if (r == -1) { - fprintf(stderr, "error %d, %s\n", errno, strerror(errno)); - exit(EXIT_FAILURE); - } -} - -int main(int argc, char **argv) -{ - struct v4l2_format fmt; - struct v4l2_buffer buf; - struct v4l2_requestbuffers req; - enum v4l2_buf_type type; - fd_set fds; - struct timeval tv; - int r, fd = -1; - unsigned int i, n_buffers; - char *dev_name = "/dev/video0"; - char out_name[256]; - FILE *fout; - struct buffer *buffers; - - fd = v4l2_open(dev_name, O_RDWR | O_NONBLOCK, 0); - if (fd < 0) { - perror("Cannot open device"); - exit(EXIT_FAILURE); - } - - CLEAR(fmt); - fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - fmt.fmt.pix.width = 640; - fmt.fmt.pix.height = 480; - fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_RGB24; - fmt.fmt.pix.field = V4L2_FIELD_INTERLACED; - xioctl(fd, VIDIOC_S_FMT, &fmt); - if (fmt.fmt.pix.pixelformat != V4L2_PIX_FMT_RGB24) { - printf("Libv4l didn't accept RGB24 format. Can't proceed.\n"); - exit(EXIT_FAILURE); - } - if ((fmt.fmt.pix.width != 640) || (fmt.fmt.pix.height != 480)) - printf("Warning: driver is sending image at %dx%d\n", - fmt.fmt.pix.width, fmt.fmt.pix.height); - - CLEAR(req); - req.count = 2; - req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - req.memory = V4L2_MEMORY_MMAP; - xioctl(fd, VIDIOC_REQBUFS, &req); - - buffers = calloc(req.count, sizeof(*buffers)); - for (n_buffers = 0; n_buffers < req.count; ++n_buffers) { - CLEAR(buf); - - buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - buf.memory = V4L2_MEMORY_MMAP; - buf.index = n_buffers; - - xioctl(fd, VIDIOC_QUERYBUF, &buf); - - buffers[n_buffers].length = buf.length; - buffers[n_buffers].start = v4l2_mmap(NULL, buf.length, - PROT_READ | PROT_WRITE, MAP_SHARED, - fd, buf.m.offset); - - if (MAP_FAILED == buffers[n_buffers].start) { - perror("mmap"); - exit(EXIT_FAILURE); - } - } - - for (i = 0; i < n_buffers; ++i) { - CLEAR(buf); - buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - buf.memory = V4L2_MEMORY_MMAP; - buf.index = i; - xioctl(fd, VIDIOC_QBUF, &buf); - } - type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - - xioctl(fd, VIDIOC_STREAMON, &type); - for (i = 0; i < 20; i++) { - do { - FD_ZERO(&fds); - FD_SET(fd, &fds); - - /* Timeout. */ - tv.tv_sec = 2; - tv.tv_usec = 0; - - r = select(fd + 1, &fds, NULL, NULL, &tv); - } while ((r == -1 && (errno = EINTR))); - if (r == -1) { - perror("select"); - return errno; - } - - CLEAR(buf); - buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - buf.memory = V4L2_MEMORY_MMAP; - xioctl(fd, VIDIOC_DQBUF, &buf); - - sprintf(out_name, "out%03d.ppm", i); - fout = fopen(out_name, "w"); - if (!fout) { - perror("Cannot open image"); - exit(EXIT_FAILURE); - } - fprintf(fout, "P6\n%d %d 255\n", - fmt.fmt.pix.width, fmt.fmt.pix.height); - fwrite(buffers[buf.index].start, buf.bytesused, 1, fout); - fclose(fout); - - xioctl(fd, VIDIOC_QBUF, &buf); - } - - type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - xioctl(fd, VIDIOC_STREAMOFF, &type); - for (i = 0; i < n_buffers; ++i) - v4l2_munmap(buffers[i].start, buffers[i].length); - v4l2_close(fd); - - return 0; -} - diff --git a/Documentation/DocBook/v4l/vbi_525.gif b/Documentation/DocBook/v4l/vbi_525.gif deleted file mode 100644 index 5580b690d504..000000000000 Binary files a/Documentation/DocBook/v4l/vbi_525.gif and /dev/null differ diff --git a/Documentation/DocBook/v4l/vbi_525.pdf b/Documentation/DocBook/v4l/vbi_525.pdf deleted file mode 100644 index 9e72c25b208d..000000000000 Binary files a/Documentation/DocBook/v4l/vbi_525.pdf and /dev/null differ diff --git a/Documentation/DocBook/v4l/vbi_625.gif b/Documentation/DocBook/v4l/vbi_625.gif deleted file mode 100644 index 34e3251983c4..000000000000 Binary files a/Documentation/DocBook/v4l/vbi_625.gif and /dev/null differ diff --git a/Documentation/DocBook/v4l/vbi_625.pdf b/Documentation/DocBook/v4l/vbi_625.pdf deleted file mode 100644 index 765235e33a4d..000000000000 Binary files a/Documentation/DocBook/v4l/vbi_625.pdf and /dev/null differ diff --git a/Documentation/DocBook/v4l/vbi_hsync.gif b/Documentation/DocBook/v4l/vbi_hsync.gif deleted file mode 100644 index b02434d3b356..000000000000 Binary files a/Documentation/DocBook/v4l/vbi_hsync.gif and /dev/null differ diff --git a/Documentation/DocBook/v4l/vbi_hsync.pdf b/Documentation/DocBook/v4l/vbi_hsync.pdf deleted file mode 100644 index 200b668189bf..000000000000 Binary files a/Documentation/DocBook/v4l/vbi_hsync.pdf and /dev/null differ diff --git a/Documentation/DocBook/v4l/vidioc-cropcap.xml b/Documentation/DocBook/v4l/vidioc-cropcap.xml deleted file mode 100644 index 816e90e283c5..000000000000 --- a/Documentation/DocBook/v4l/vidioc-cropcap.xml +++ /dev/null @@ -1,174 +0,0 @@ - - - ioctl VIDIOC_CROPCAP - &manvol; - - - - VIDIOC_CROPCAP - Information about the video cropping and scaling abilities - - - - - - int ioctl - int fd - int request - struct v4l2_cropcap -*argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_CROPCAP - - - - argp - - - - - - - - - Description - - Applications use this function to query the cropping -limits, the pixel aspect of images and to calculate scale factors. -They set the type field of a v4l2_cropcap -structure to the respective buffer (stream) type and call the -VIDIOC_CROPCAP ioctl with a pointer to this -structure. Drivers fill the rest of the structure. The results are -constant except when switching the video standard. Remember this -switch can occur implicit when switching the video input or -output. - - - struct <structname>v4l2_cropcap</structname> - - &cs-str; - - - &v4l2-buf-type; - type - Type of the data stream, set by the application. -Only these types are valid here: -V4L2_BUF_TYPE_VIDEO_CAPTURE, -V4L2_BUF_TYPE_VIDEO_OUTPUT, -V4L2_BUF_TYPE_VIDEO_OVERLAY, and custom (driver -defined) types with code V4L2_BUF_TYPE_PRIVATE -and higher. - - - struct v4l2_rect - bounds - Defines the window within capturing or output is -possible, this may exclude for example the horizontal and vertical -blanking areas. The cropping rectangle cannot exceed these limits. -Width and height are defined in pixels, the driver writer is free to -choose origin and units of the coordinate system in the analog -domain. - - - struct v4l2_rect - defrect - Default cropping rectangle, it shall cover the -"whole picture". Assuming pixel aspect 1/1 this could be for example a -640 × 480 rectangle for NTSC, a -768 × 576 rectangle for PAL and SECAM centered over -the active picture area. The same co-ordinate system as for - bounds is used. - - - &v4l2-fract; - pixelaspect - This is the pixel aspect (y / x) when no -scaling is applied, the ratio of the actual sampling -frequency and the frequency required to get square -pixels.When cropping coordinates refer to square pixels, -the driver sets pixelaspect to 1/1. Other -common values are 54/59 for PAL and SECAM, 11/10 for NTSC sampled -according to []. - - - -
- - - - - struct <structname>v4l2_rect</structname> - - &cs-str; - - - __s32 - left - Horizontal offset of the top, left corner of the -rectangle, in pixels. - - - __s32 - top - Vertical offset of the top, left corner of the -rectangle, in pixels. - - - __s32 - width - Width of the rectangle, in pixels. - - - __s32 - height - Height of the rectangle, in pixels. Width -and height cannot be negative, the fields are signed for -hysterical reasons. - - - - -
-
- - - &return-value; - - - - EINVAL - - The &v4l2-cropcap; type is -invalid or the ioctl is not supported. This is not permitted for -video capture, output and overlay devices, which must support -VIDIOC_CROPCAP. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-dbg-g-chip-ident.xml b/Documentation/DocBook/v4l/vidioc-dbg-g-chip-ident.xml deleted file mode 100644 index 4a09e203af0f..000000000000 --- a/Documentation/DocBook/v4l/vidioc-dbg-g-chip-ident.xml +++ /dev/null @@ -1,275 +0,0 @@ - - - ioctl VIDIOC_DBG_G_CHIP_IDENT - &manvol; - - - - VIDIOC_DBG_G_CHIP_IDENT - Identify the chips on a TV card - - - - - - int ioctl - int fd - int request - struct v4l2_dbg_chip_ident -*argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_DBG_G_CHIP_IDENT - - - - argp - - - - - - - - - Description - - - Experimental - - This is an experimental interface and may change in -the future. - - - For driver debugging purposes this ioctl allows test -applications to query the driver about the chips present on the TV -card. Regular applications must not use it. When you found a chip -specific bug, please contact the linux-media mailing list (&v4l-ml;) -so it can be fixed. - - To query the driver applications must initialize the -match.type and -match.addr or match.name -fields of a &v4l2-dbg-chip-ident; -and call VIDIOC_DBG_G_CHIP_IDENT with a pointer to -this structure. On success the driver stores information about the -selected chip in the ident and -revision fields. On failure the structure -remains unchanged. - - When match.type is -V4L2_CHIP_MATCH_HOST, -match.addr selects the nth non-&i2c; chip -on the TV card. You can enumerate all chips by starting at zero and -incrementing match.addr by one until -VIDIOC_DBG_G_CHIP_IDENT fails with an &EINVAL;. -The number zero always selects the host chip, ⪚ the chip connected -to the PCI or USB bus. - - When match.type is -V4L2_CHIP_MATCH_I2C_DRIVER, -match.name contains the I2C driver name. -For instance -"saa7127" will match any chip -supported by the saa7127 driver, regardless of its &i2c; bus address. -When multiple chips supported by the same driver are present, the -ioctl will return V4L2_IDENT_AMBIGUOUS in the -ident field. - - When match.type is -V4L2_CHIP_MATCH_I2C_ADDR, -match.addr selects a chip by its 7 bit -&i2c; bus address. - - When match.type is -V4L2_CHIP_MATCH_AC97, -match.addr selects the nth AC97 chip -on the TV card. You can enumerate all chips by starting at zero and -incrementing match.addr by one until -VIDIOC_DBG_G_CHIP_IDENT fails with an &EINVAL;. - - On success, the ident field will -contain a chip ID from the Linux -media/v4l2-chip-ident.h header file, and the -revision field will contain a driver -specific value, or zero if no particular revision is associated with -this chip. - - When the driver could not identify the selected chip, -ident will contain -V4L2_IDENT_UNKNOWN. When no chip matched -the ioctl will succeed but the -ident field will contain -V4L2_IDENT_NONE. If multiple chips matched, -ident will contain -V4L2_IDENT_AMBIGUOUS. In all these cases the -revision field remains unchanged. - - This ioctl is optional, not all drivers may support it. It -was introduced in Linux 2.6.21, but the API was changed to the -one described here in 2.6.29. - - We recommended the v4l2-dbg -utility over calling this ioctl directly. It is available from the -LinuxTV v4l-dvb repository; see http://linuxtv.org/repo/ for -access instructions. - - - - struct <structname>v4l2_dbg_match</structname> - - &cs-ustr; - - - __u32 - type - See for a list of -possible types. - - - union - (anonymous) - - - - __u32 - addr - Match a chip by this number, interpreted according -to the type field. - - - - char - name[32] - Match a chip by this name, interpreted according -to the type field. - - - -
- - - struct <structname>v4l2_dbg_chip_ident</structname> - - &cs-str; - - - struct v4l2_dbg_match - match - How to match the chip, see . - - - __u32 - ident - A chip identifier as defined in the Linux -media/v4l2-chip-ident.h header file, or one of -the values from . - - - __u32 - revision - A chip revision, chip and driver specific. - - - -
- - - - Chip Match Types - - &cs-def; - - - V4L2_CHIP_MATCH_HOST - 0 - Match the nth chip on the card, zero for the - host chip. Does not match &i2c; chips. - - - V4L2_CHIP_MATCH_I2C_DRIVER - 1 - Match an &i2c; chip by its driver name. - - - V4L2_CHIP_MATCH_I2C_ADDR - 2 - Match a chip by its 7 bit &i2c; bus address. - - - V4L2_CHIP_MATCH_AC97 - 3 - Match the nth anciliary AC97 chip. - - - -
- - - - Chip Identifiers - - &cs-def; - - - V4L2_IDENT_NONE - 0 - No chip matched. - - - V4L2_IDENT_AMBIGUOUS - 1 - Multiple chips matched. - - - V4L2_IDENT_UNKNOWN - 2 - A chip is present at this address, but the driver -could not identify it. - - - -
-
- - - &return-value; - - - - EINVAL - - The driver does not support this ioctl, or the -match_type is invalid. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-dbg-g-register.xml b/Documentation/DocBook/v4l/vidioc-dbg-g-register.xml deleted file mode 100644 index 980c7f3e2fd6..000000000000 --- a/Documentation/DocBook/v4l/vidioc-dbg-g-register.xml +++ /dev/null @@ -1,275 +0,0 @@ - - - ioctl VIDIOC_DBG_G_REGISTER, VIDIOC_DBG_S_REGISTER - &manvol; - - - - VIDIOC_DBG_G_REGISTER - VIDIOC_DBG_S_REGISTER - Read or write hardware registers - - - - - - int ioctl - int fd - int request - struct v4l2_dbg_register *argp - - - - - int ioctl - int fd - int request - const struct v4l2_dbg_register -*argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_DBG_G_REGISTER, VIDIOC_DBG_S_REGISTER - - - - argp - - - - - - - - - Description - - - Experimental - - This is an experimental -interface and may change in the future. - - - For driver debugging purposes these ioctls allow test -applications to access hardware registers directly. Regular -applications must not use them. - - Since writing or even reading registers can jeopardize the -system security, its stability and damage the hardware, both ioctls -require superuser privileges. Additionally the Linux kernel must be -compiled with the CONFIG_VIDEO_ADV_DEBUG option -to enable these ioctls. - - To write a register applications must initialize all fields -of a &v4l2-dbg-register; and call -VIDIOC_DBG_S_REGISTER with a pointer to this -structure. The match.type and -match.addr or match.name -fields select a chip on the TV -card, the reg field specifies a register -number and the val field the value to be -written into the register. - - To read a register applications must initialize the -match.type, -match.chip or match.name and -reg fields, and call -VIDIOC_DBG_G_REGISTER with a pointer to this -structure. On success the driver stores the register value in the -val field. On failure the structure remains -unchanged. - - When match.type is -V4L2_CHIP_MATCH_HOST, -match.addr selects the nth non-&i2c; chip -on the TV card. The number zero always selects the host chip, ⪚ the -chip connected to the PCI or USB bus. You can find out which chips are -present with the &VIDIOC-DBG-G-CHIP-IDENT; ioctl. - - When match.type is -V4L2_CHIP_MATCH_I2C_DRIVER, -match.name contains the I2C driver name. -For instance -"saa7127" will match any chip -supported by the saa7127 driver, regardless of its &i2c; bus address. -When multiple chips supported by the same driver are present, the -effect of these ioctls is undefined. Again with the -&VIDIOC-DBG-G-CHIP-IDENT; ioctl you can find out which &i2c; chips are -present. - - When match.type is -V4L2_CHIP_MATCH_I2C_ADDR, -match.addr selects a chip by its 7 bit &i2c; -bus address. - - When match.type is -V4L2_CHIP_MATCH_AC97, -match.addr selects the nth AC97 chip -on the TV card. - - - Success not guaranteed - - Due to a flaw in the Linux &i2c; bus driver these ioctls may -return successfully without actually reading or writing a register. To -catch the most likely failure we recommend a &VIDIOC-DBG-G-CHIP-IDENT; -call confirming the presence of the selected &i2c; chip. - - - These ioctls are optional, not all drivers may support them. -However when a driver supports these ioctls it must also support -&VIDIOC-DBG-G-CHIP-IDENT;. Conversely it may support -VIDIOC_DBG_G_CHIP_IDENT but not these ioctls. - - VIDIOC_DBG_G_REGISTER and -VIDIOC_DBG_S_REGISTER were introduced in Linux -2.6.21, but their API was changed to the one described here in kernel 2.6.29. - - We recommended the v4l2-dbg -utility over calling these ioctls directly. It is available from the -LinuxTV v4l-dvb repository; see http://linuxtv.org/repo/ for -access instructions. - - - - struct <structname>v4l2_dbg_match</structname> - - &cs-ustr; - - - __u32 - type - See for a list of -possible types. - - - union - (anonymous) - - - - __u32 - addr - Match a chip by this number, interpreted according -to the type field. - - - - char - name[32] - Match a chip by this name, interpreted according -to the type field. - - - -
- - - - struct <structname>v4l2_dbg_register</structname> - - - - - - - struct v4l2_dbg_match - match - How to match the chip, see . - - - __u64 - reg - A register number. - - - __u64 - val - The value read from, or to be written into the -register. - - - -
- - - - Chip Match Types - - &cs-def; - - - V4L2_CHIP_MATCH_HOST - 0 - Match the nth chip on the card, zero for the - host chip. Does not match &i2c; chips. - - - V4L2_CHIP_MATCH_I2C_DRIVER - 1 - Match an &i2c; chip by its driver name. - - - V4L2_CHIP_MATCH_I2C_ADDR - 2 - Match a chip by its 7 bit &i2c; bus address. - - - V4L2_CHIP_MATCH_AC97 - 3 - Match the nth anciliary AC97 chip. - - - -
-
- - - &return-value; - - - - EINVAL - - The driver does not support this ioctl, or the kernel -was not compiled with the CONFIG_VIDEO_ADV_DEBUG -option, or the match_type is invalid, or the -selected chip or register does not exist. - - - - EPERM - - Insufficient permissions. Root privileges are required -to execute these ioctls. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-dqevent.xml b/Documentation/DocBook/v4l/vidioc-dqevent.xml deleted file mode 100644 index 4e0a7cc30812..000000000000 --- a/Documentation/DocBook/v4l/vidioc-dqevent.xml +++ /dev/null @@ -1,131 +0,0 @@ - - - ioctl VIDIOC_DQEVENT - &manvol; - - - - VIDIOC_DQEVENT - Dequeue event - - - - - - int ioctl - int fd - int request - struct v4l2_event -*argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_DQEVENT - - - - argp - - - - - - - - - Description - - Dequeue an event from a video device. No input is required - for this ioctl. All the fields of the &v4l2-event; structure are - filled by the driver. The file handle will also receive exceptions - which the application may get by e.g. using the select system - call. - - - struct <structname>v4l2_event</structname> - - &cs-str; - - - __u32 - type - - Type of the event. - - - union - u - - - - - - &v4l2-event-vsync; - vsync - Event data for event V4L2_EVENT_VSYNC. - - - - - __u8 - data[64] - Event data. Defined by the event type. The union - should be used to define easily accessible type for - events. - - - __u32 - pending - - Number of pending events excluding this one. - - - __u32 - sequence - - Event sequence number. The sequence number is - incremented for every subscribed event that takes place. - If sequence numbers are not contiguous it means that - events have been lost. - - - - struct timespec - timestamp - - Event timestamp. - - - __u32 - reserved[9] - - Reserved for future extensions. Drivers must set - the array to zero. - - - -
- -
-
- diff --git a/Documentation/DocBook/v4l/vidioc-encoder-cmd.xml b/Documentation/DocBook/v4l/vidioc-encoder-cmd.xml deleted file mode 100644 index b0dde943825c..000000000000 --- a/Documentation/DocBook/v4l/vidioc-encoder-cmd.xml +++ /dev/null @@ -1,204 +0,0 @@ - - - ioctl VIDIOC_ENCODER_CMD, VIDIOC_TRY_ENCODER_CMD - &manvol; - - - - VIDIOC_ENCODER_CMD - VIDIOC_TRY_ENCODER_CMD - Execute an encoder command - - - - - - int ioctl - int fd - int request - struct v4l2_encoder_cmd *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_ENCODER_CMD, VIDIOC_TRY_ENCODER_CMD - - - - argp - - - - - - - - - Description - - - Experimental - - This is an experimental -interface and may change in the future. - - - These ioctls control an audio/video (usually MPEG-) encoder. -VIDIOC_ENCODER_CMD sends a command to the -encoder, VIDIOC_TRY_ENCODER_CMD can be used to -try a command without actually executing it. - - To send a command applications must initialize all fields of a - &v4l2-encoder-cmd; and call - VIDIOC_ENCODER_CMD or - VIDIOC_TRY_ENCODER_CMD with a pointer to this - structure. - - The cmd field must contain the -command code. The flags field is currently -only used by the STOP command and contains one bit: If the -V4L2_ENC_CMD_STOP_AT_GOP_END flag is set, -encoding will continue until the end of the current Group -Of Pictures, otherwise it will stop immediately. - - A read() call sends a START command to -the encoder if it has not been started yet. After a STOP command, -read() calls will read the remaining data -buffered by the driver. When the buffer is empty, -read() will return zero and the next -read() call will restart the encoder. - - A close() call sends an immediate STOP -to the encoder, and all buffered data is discarded. - - These ioctls are optional, not all drivers may support -them. They were introduced in Linux 2.6.21. - - - struct <structname>v4l2_encoder_cmd</structname> - - &cs-str; - - - __u32 - cmd - The encoder command, see . - - - __u32 - flags - Flags to go with the command, see . If no flags are defined for -this command, drivers and applications must set this field to -zero. - - - __u32 - data[8] - Reserved for future extensions. Drivers and -applications must set the array to zero. - - - -
- - - Encoder Commands - - &cs-def; - - - V4L2_ENC_CMD_START - 0 - Start the encoder. When the encoder is already -running or paused, this command does nothing. No flags are defined for -this command. - - - V4L2_ENC_CMD_STOP - 1 - Stop the encoder. When the -V4L2_ENC_CMD_STOP_AT_GOP_END flag is set, -encoding will continue until the end of the current Group -Of Pictures, otherwise encoding will stop immediately. -When the encoder is already stopped, this command does -nothing. - - - V4L2_ENC_CMD_PAUSE - 2 - Pause the encoder. When the encoder has not been -started yet, the driver will return an &EPERM;. When the encoder is -already paused, this command does nothing. No flags are defined for -this command. - - - V4L2_ENC_CMD_RESUME - 3 - Resume encoding after a PAUSE command. When the -encoder has not been started yet, the driver will return an &EPERM;. -When the encoder is already running, this command does nothing. No -flags are defined for this command. - - - -
- - - Encoder Command Flags - - &cs-def; - - - V4L2_ENC_CMD_STOP_AT_GOP_END - 0x0001 - Stop encoding at the end of the current Group Of -Pictures, rather than immediately. - - - -
-
- - - &return-value; - - - - EINVAL - - The driver does not support this ioctl, or the -cmd field is invalid. - - - - EPERM - - The application sent a PAUSE or RESUME command when -the encoder was not running. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-enum-dv-presets.xml b/Documentation/DocBook/v4l/vidioc-enum-dv-presets.xml deleted file mode 100644 index 1d31427edd1b..000000000000 --- a/Documentation/DocBook/v4l/vidioc-enum-dv-presets.xml +++ /dev/null @@ -1,238 +0,0 @@ - - - ioctl VIDIOC_ENUM_DV_PRESETS - &manvol; - - - - VIDIOC_ENUM_DV_PRESETS - Enumerate supported Digital Video presets - - - - - - int ioctl - int fd - int request - struct v4l2_dv_enum_preset *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_ENUM_DV_PRESETS - - - - argp - - - - - - - - - Description - - To query the attributes of a DV preset, applications initialize the -index field and zero the reserved array of &v4l2-dv-enum-preset; -and call the VIDIOC_ENUM_DV_PRESETS ioctl with a pointer to this -structure. Drivers fill the rest of the structure or return an -&EINVAL; when the index is out of bounds. To enumerate all DV Presets supported, -applications shall begin at index zero, incrementing by one until the -driver returns EINVAL. Drivers may enumerate a -different set of DV presets after switching the video input or -output. - - - struct <structname>v4l2_dv_enum_presets</structname> - - &cs-str; - - - __u32 - index - Number of the DV preset, set by the -application. - - - __u32 - preset - This field identifies one of the DV preset values listed in . - - - __u8 - name[24] - Name of the preset, a NUL-terminated ASCII string, for example: "720P-60", "1080I-60". This information is -intended for the user. - - - __u32 - width - Width of the active video in pixels for the DV preset. - - - __u32 - height - Height of the active video in lines for the DV preset. - - - __u32 - reserved[4] - Reserved for future extensions. Drivers must set the array to zero. - - - -
- - - struct <structname>DV Presets</structname> - - &cs-str; - - - Preset - Preset value - Description - - - - - - - - V4L2_DV_INVALID - 0 - Invalid preset value. - - - V4L2_DV_480P59_94 - 1 - 720x480 progressive video at 59.94 fps as per BT.1362. - - - V4L2_DV_576P50 - 2 - 720x576 progressive video at 50 fps as per BT.1362. - - - V4L2_DV_720P24 - 3 - 1280x720 progressive video at 24 fps as per SMPTE 296M. - - - V4L2_DV_720P25 - 4 - 1280x720 progressive video at 25 fps as per SMPTE 296M. - - - V4L2_DV_720P30 - 5 - 1280x720 progressive video at 30 fps as per SMPTE 296M. - - - V4L2_DV_720P50 - 6 - 1280x720 progressive video at 50 fps as per SMPTE 296M. - - - V4L2_DV_720P59_94 - 7 - 1280x720 progressive video at 59.94 fps as per SMPTE 274M. - - - V4L2_DV_720P60 - 8 - 1280x720 progressive video at 60 fps as per SMPTE 274M/296M. - - - V4L2_DV_1080I29_97 - 9 - 1920x1080 interlaced video at 29.97 fps as per BT.1120/SMPTE 274M. - - - V4L2_DV_1080I30 - 10 - 1920x1080 interlaced video at 30 fps as per BT.1120/SMPTE 274M. - - - V4L2_DV_1080I25 - 11 - 1920x1080 interlaced video at 25 fps as per BT.1120. - - - V4L2_DV_1080I50 - 12 - 1920x1080 interlaced video at 50 fps as per SMPTE 296M. - - - V4L2_DV_1080I60 - 13 - 1920x1080 interlaced video at 60 fps as per SMPTE 296M. - - - V4L2_DV_1080P24 - 14 - 1920x1080 progressive video at 24 fps as per SMPTE 296M. - - - V4L2_DV_1080P25 - 15 - 1920x1080 progressive video at 25 fps as per SMPTE 296M. - - - V4L2_DV_1080P30 - 16 - 1920x1080 progressive video at 30 fps as per SMPTE 296M. - - - V4L2_DV_1080P50 - 17 - 1920x1080 progressive video at 50 fps as per BT.1120. - - - V4L2_DV_1080P60 - 18 - 1920x1080 progressive video at 60 fps as per BT.1120. - - - -
-
- - - &return-value; - - - - EINVAL - - The &v4l2-dv-enum-preset; index -is out of bounds. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-enum-fmt.xml b/Documentation/DocBook/v4l/vidioc-enum-fmt.xml deleted file mode 100644 index 71d373b6d36a..000000000000 --- a/Documentation/DocBook/v4l/vidioc-enum-fmt.xml +++ /dev/null @@ -1,166 +0,0 @@ - - - ioctl VIDIOC_ENUM_FMT - &manvol; - - - - VIDIOC_ENUM_FMT - Enumerate image formats - - - - - - int ioctl - int fd - int request - struct v4l2_fmtdesc -*argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_ENUM_FMT - - - - argp - - - - - - - - - Description - - To enumerate image formats applications initialize the -type and index -field of &v4l2-fmtdesc; and call the -VIDIOC_ENUM_FMT ioctl with a pointer to this -structure. Drivers fill the rest of the structure or return an -&EINVAL;. All formats are enumerable by beginning at index zero and -incrementing by one until EINVAL is -returned. - - - struct <structname>v4l2_fmtdesc</structname> - - &cs-str; - - - __u32 - index - Number of the format in the enumeration, set by -the application. This is in no way related to the -pixelformat field. - - - &v4l2-buf-type; - type - Type of the data stream, set by the application. -Only these types are valid here: -V4L2_BUF_TYPE_VIDEO_CAPTURE, -V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, -V4L2_BUF_TYPE_VIDEO_OUTPUT, -V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, -V4L2_BUF_TYPE_VIDEO_OVERLAY, and custom (driver -defined) types with code V4L2_BUF_TYPE_PRIVATE -and higher. - - - __u32 - flags - See - - - __u8 - description[32] - Description of the format, a NUL-terminated ASCII -string. This information is intended for the user, for example: "YUV -4:2:2". - - - __u32 - pixelformat - The image format identifier. This is a -four character code as computed by the v4l2_fourcc() -macro: - - - -#define v4l2_fourcc(a,b,c,d) (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24)) -Several image formats are already -defined by this specification in . Note these -codes are not the same as those used in the Windows world. - - - __u32 - reserved[4] - Reserved for future extensions. Drivers must set -the array to zero. - - - -
- - - Image Format Description Flags - - &cs-def; - - - V4L2_FMT_FLAG_COMPRESSED - 0x0001 - This is a compressed format. - - - V4L2_FMT_FLAG_EMULATED - 0x0002 - This format is not native to the device but emulated -through software (usually libv4l2), where possible try to use a native format -instead for better performance. - - - -
-
- - - &return-value; - - - - EINVAL - - The &v4l2-fmtdesc; type -is not supported or the index is out of -bounds. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-enum-frameintervals.xml b/Documentation/DocBook/v4l/vidioc-enum-frameintervals.xml deleted file mode 100644 index 3c216e113a54..000000000000 --- a/Documentation/DocBook/v4l/vidioc-enum-frameintervals.xml +++ /dev/null @@ -1,270 +0,0 @@ - - - - ioctl VIDIOC_ENUM_FRAMEINTERVALS - &manvol; - - - - VIDIOC_ENUM_FRAMEINTERVALS - Enumerate frame intervals - - - - - - int ioctl - int fd - int request - struct v4l2_frmivalenum *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_ENUM_FRAMEINTERVALS - - - - argp - - Pointer to a &v4l2-frmivalenum; structure that -contains a pixel format and size and receives a frame interval. - - - - - - - Description - - This ioctl allows applications to enumerate all frame -intervals that the device supports for the given pixel format and -frame size. - The supported pixel formats and frame sizes can be obtained -by using the &VIDIOC-ENUM-FMT; and &VIDIOC-ENUM-FRAMESIZES; -functions. - The return value and the content of the -v4l2_frmivalenum.type field depend on the -type of frame intervals the device supports. Here are the semantics of -the function for the different cases: - - - Discrete: The function -returns success if the given index value (zero-based) is valid. The -application should increase the index by one for each call until -EINVAL is returned. The `v4l2_frmivalenum.type` -field is set to `V4L2_FRMIVAL_TYPE_DISCRETE` by the driver. Of the -union only the `discrete` member is valid. - - - Step-wise: The function -returns success if the given index value is zero and -EINVAL for any other index value. The -v4l2_frmivalenum.type field is set to -V4L2_FRMIVAL_TYPE_STEPWISE by the driver. Of the -union only the stepwise member is -valid. - - - Continuous: This is a -special case of the step-wise type above. The function returns success -if the given index value is zero and EINVAL for -any other index value. The -v4l2_frmivalenum.type field is set to -V4L2_FRMIVAL_TYPE_CONTINUOUS by the driver. Of -the union only the stepwise member is valid -and the step value is set to 1. - - - - When the application calls the function with index zero, it -must check the type field to determine the -type of frame interval enumeration the device supports. Only for the -V4L2_FRMIVAL_TYPE_DISCRETE type does it make -sense to increase the index value to receive more frame -intervals. - Note that the order in which the frame intervals are -returned has no special meaning. In particular does it not say -anything about potential default frame intervals. - Applications can assume that the enumeration data does not -change without any interaction from the application itself. This means -that the enumeration data is consistent if the application does not -perform any other ioctl calls while it runs the frame interval -enumeration. - - - - Notes - - - - Frame intervals and frame -rates: The V4L2 API uses frame intervals instead of frame -rates. Given the frame interval the frame rate can be computed as -follows:frame_rate = 1 / frame_interval - - - - - - - Structs - - In the structs below, IN denotes a -value that has to be filled in by the application, -OUT denotes values that the driver fills in. The -application should zero out all members except for the -IN fields. - - - struct <structname>v4l2_frmival_stepwise</structname> - - &cs-str; - - - &v4l2-fract; - min - Minimum frame interval [s]. - - - &v4l2-fract; - max - Maximum frame interval [s]. - - - &v4l2-fract; - step - Frame interval step size [s]. - - - -
- - - struct <structname>v4l2_frmivalenum</structname> - - - - - - - - __u32 - index - - IN: Index of the given frame interval in the -enumeration. - - - __u32 - pixel_format - - IN: Pixel format for which the frame intervals are -enumerated. - - - __u32 - width - - IN: Frame width for which the frame intervals are -enumerated. - - - __u32 - height - - IN: Frame height for which the frame intervals are -enumerated. - - - __u32 - type - - OUT: Frame interval type the device supports. - - - union - - - OUT: Frame interval with the given index. - - - - &v4l2-fract; - discrete - Frame interval [s]. - - - - &v4l2-frmival-stepwise; - stepwise - - - - __u32 - reserved[2] - - Reserved space for future use. - - - -
-
- - - Enums - - - enum <structname>v4l2_frmivaltypes</structname> - - &cs-def; - - - V4L2_FRMIVAL_TYPE_DISCRETE - 1 - Discrete frame interval. - - - V4L2_FRMIVAL_TYPE_CONTINUOUS - 2 - Continuous frame interval. - - - V4L2_FRMIVAL_TYPE_STEPWISE - 3 - Step-wise defined frame interval. - - - -
-
- - - &return-value; - - See the description section above for a list of return -values that errno can have. - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-enum-framesizes.xml b/Documentation/DocBook/v4l/vidioc-enum-framesizes.xml deleted file mode 100644 index 6afa4542c818..000000000000 --- a/Documentation/DocBook/v4l/vidioc-enum-framesizes.xml +++ /dev/null @@ -1,282 +0,0 @@ - - - - ioctl VIDIOC_ENUM_FRAMESIZES - &manvol; - - - - VIDIOC_ENUM_FRAMESIZES - Enumerate frame sizes - - - - - - int ioctl - int fd - int request - struct v4l2_frmsizeenum *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_ENUM_FRAMESIZES - - - - argp - - Pointer to a &v4l2-frmsizeenum; that contains an index -and pixel format and receives a frame width and height. - - - - - - - Description - - - Experimental - - This is an experimental -interface and may change in the future. - - - This ioctl allows applications to enumerate all frame sizes -(&ie; width and height in pixels) that the device supports for the -given pixel format. - The supported pixel formats can be obtained by using the -&VIDIOC-ENUM-FMT; function. - The return value and the content of the -v4l2_frmsizeenum.type field depend on the -type of frame sizes the device supports. Here are the semantics of the -function for the different cases: - - - - Discrete: The function -returns success if the given index value (zero-based) is valid. The -application should increase the index by one for each call until -EINVAL is returned. The -v4l2_frmsizeenum.type field is set to -V4L2_FRMSIZE_TYPE_DISCRETE by the driver. Of the -union only the discrete member is -valid. - - - Step-wise: The function -returns success if the given index value is zero and -EINVAL for any other index value. The -v4l2_frmsizeenum.type field is set to -V4L2_FRMSIZE_TYPE_STEPWISE by the driver. Of the -union only the stepwise member is -valid. - - - Continuous: This is a -special case of the step-wise type above. The function returns success -if the given index value is zero and EINVAL for -any other index value. The -v4l2_frmsizeenum.type field is set to -V4L2_FRMSIZE_TYPE_CONTINUOUS by the driver. Of -the union only the stepwise member is valid -and the step_width and -step_height values are set to 1. - - - - When the application calls the function with index zero, it -must check the type field to determine the -type of frame size enumeration the device supports. Only for the -V4L2_FRMSIZE_TYPE_DISCRETE type does it make -sense to increase the index value to receive more frame sizes. - Note that the order in which the frame sizes are returned -has no special meaning. In particular does it not say anything about -potential default format sizes. - Applications can assume that the enumeration data does not -change without any interaction from the application itself. This means -that the enumeration data is consistent if the application does not -perform any other ioctl calls while it runs the frame size -enumeration. - - - - Structs - - In the structs below, IN denotes a -value that has to be filled in by the application, -OUT denotes values that the driver fills in. The -application should zero out all members except for the -IN fields. - - - struct <structname>v4l2_frmsize_discrete</structname> - - &cs-str; - - - __u32 - width - Width of the frame [pixel]. - - - __u32 - height - Height of the frame [pixel]. - - - -
- - - struct <structname>v4l2_frmsize_stepwise</structname> - - &cs-str; - - - __u32 - min_width - Minimum frame width [pixel]. - - - __u32 - max_width - Maximum frame width [pixel]. - - - __u32 - step_width - Frame width step size [pixel]. - - - __u32 - min_height - Minimum frame height [pixel]. - - - __u32 - max_height - Maximum frame height [pixel]. - - - __u32 - step_height - Frame height step size [pixel]. - - - -
- - - struct <structname>v4l2_frmsizeenum</structname> - - - - - - - - __u32 - index - - IN: Index of the given frame size in the enumeration. - - - __u32 - pixel_format - - IN: Pixel format for which the frame sizes are enumerated. - - - __u32 - type - - OUT: Frame size type the device supports. - - - union - - - OUT: Frame size with the given index. - - - - &v4l2-frmsize-discrete; - discrete - - - - - &v4l2-frmsize-stepwise; - stepwise - - - - __u32 - reserved[2] - - Reserved space for future use. - - - -
-
- - - Enums - - - enum <structname>v4l2_frmsizetypes</structname> - - &cs-def; - - - V4L2_FRMSIZE_TYPE_DISCRETE - 1 - Discrete frame size. - - - V4L2_FRMSIZE_TYPE_CONTINUOUS - 2 - Continuous frame size. - - - V4L2_FRMSIZE_TYPE_STEPWISE - 3 - Step-wise defined frame size. - - - -
-
- - - &return-value; - - See the description section above for a list of return -values that errno can have. - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-enumaudio.xml b/Documentation/DocBook/v4l/vidioc-enumaudio.xml deleted file mode 100644 index 9ae8f2d3a96f..000000000000 --- a/Documentation/DocBook/v4l/vidioc-enumaudio.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - ioctl VIDIOC_ENUMAUDIO - &manvol; - - - - VIDIOC_ENUMAUDIO - Enumerate audio inputs - - - - - - int ioctl - int fd - int request - struct v4l2_audio *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_ENUMAUDIO - - - - argp - - - - - - - - - Description - - To query the attributes of an audio input applications -initialize the index field and zero out the -reserved array of a &v4l2-audio; -and call the VIDIOC_ENUMAUDIO ioctl with a pointer -to this structure. Drivers fill the rest of the structure or return an -&EINVAL; when the index is out of bounds. To enumerate all audio -inputs applications shall begin at index zero, incrementing by one -until the driver returns EINVAL. - - See for a description of -&v4l2-audio;. - - - - &return-value; - - - - EINVAL - - The number of the audio input is out of bounds, or -there are no audio inputs at all and this ioctl is not -supported. - - - - - - - diff --git a/Documentation/DocBook/v4l/vidioc-enumaudioout.xml b/Documentation/DocBook/v4l/vidioc-enumaudioout.xml deleted file mode 100644 index d3d7c0ab17b8..000000000000 --- a/Documentation/DocBook/v4l/vidioc-enumaudioout.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - ioctl VIDIOC_ENUMAUDOUT - &manvol; - - - - VIDIOC_ENUMAUDOUT - Enumerate audio outputs - - - - - - int ioctl - int fd - int request - struct v4l2_audioout *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_ENUMAUDOUT - - - - argp - - - - - - - - - Description - - To query the attributes of an audio output applications -initialize the index field and zero out the -reserved array of a &v4l2-audioout; and -call the VIDIOC_G_AUDOUT ioctl with a pointer -to this structure. Drivers fill the rest of the structure or return an -&EINVAL; when the index is out of bounds. To enumerate all audio -outputs applications shall begin at index zero, incrementing by one -until the driver returns EINVAL. - - Note connectors on a TV card to loop back the received audio -signal to a sound card are not audio outputs in this sense. - - See for a description of -&v4l2-audioout;. - - - - &return-value; - - - - EINVAL - - The number of the audio output is out of bounds, or -there are no audio outputs at all and this ioctl is not -supported. - - - - - - - diff --git a/Documentation/DocBook/v4l/vidioc-enuminput.xml b/Documentation/DocBook/v4l/vidioc-enuminput.xml deleted file mode 100644 index 476fe1d2bba0..000000000000 --- a/Documentation/DocBook/v4l/vidioc-enuminput.xml +++ /dev/null @@ -1,321 +0,0 @@ - - - ioctl VIDIOC_ENUMINPUT - &manvol; - - - - VIDIOC_ENUMINPUT - Enumerate video inputs - - - - - - int ioctl - int fd - int request - struct v4l2_input -*argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_ENUMINPUT - - - - argp - - - - - - - - - Description - - To query the attributes of a video input applications -initialize the index field of &v4l2-input; -and call the VIDIOC_ENUMINPUT ioctl with a -pointer to this structure. Drivers fill the rest of the structure or -return an &EINVAL; when the index is out of bounds. To enumerate all -inputs applications shall begin at index zero, incrementing by one -until the driver returns EINVAL. - - - struct <structname>v4l2_input</structname> - - &cs-str; - - - __u32 - index - Identifies the input, set by the -application. - - - __u8 - name[32] - Name of the video input, a NUL-terminated ASCII -string, for example: "Vin (Composite 2)". This information is intended -for the user, preferably the connector label on the device itself. - - - __u32 - type - Type of the input, see . - - - __u32 - audioset - Drivers can enumerate up to 32 video and -audio inputs. This field shows which audio inputs were selectable as -audio source if this was the currently selected video input. It is a -bit mask. The LSB corresponds to audio input 0, the MSB to input 31. -Any number of bits can be set, or none.When the driver -does not enumerate audio inputs no bits must be set. Applications -shall not interpret this as lack of audio support. Some drivers -automatically select audio sources and do not enumerate them since -there is no choice anyway.For details on audio inputs and -how to select the current input see . - - - __u32 - tuner - Capture devices can have zero or more tuners (RF -demodulators). When the type is set to -V4L2_INPUT_TYPE_TUNER this is an RF connector and -this field identifies the tuner. It corresponds to -&v4l2-tuner; field index. For details on -tuners see . - - - &v4l2-std-id; - std - Every video input supports one or more different -video standards. This field is a set of all supported standards. For -details on video standards and how to switch see . - - - __u32 - status - This field provides status information about the -input. See for flags. -With the exception of the sensor orientation bits status is only valid when this is the -current input. - - - __u32 - capabilities - This field provides capabilities for the -input. See for flags. - - - __u32 - reserved[3] - Reserved for future extensions. Drivers must set -the array to zero. - - - -
- - - Input Types - - &cs-def; - - - V4L2_INPUT_TYPE_TUNER - 1 - This input uses a tuner (RF demodulator). - - - V4L2_INPUT_TYPE_CAMERA - 2 - Analog baseband input, for example CVBS / -Composite Video, S-Video, RGB. - - - -
- - - - - Input Status Flags - - - - - - - - General - - - V4L2_IN_ST_NO_POWER - 0x00000001 - Attached device is off. - - - V4L2_IN_ST_NO_SIGNAL - 0x00000002 - - - - V4L2_IN_ST_NO_COLOR - 0x00000004 - The hardware supports color decoding, but does not -detect color modulation in the signal. - - - Sensor Orientation - - - V4L2_IN_ST_HFLIP - 0x00000010 - The input is connected to a device that produces a signal -that is flipped horizontally and does not correct this before passing the -signal to userspace. - - - V4L2_IN_ST_VFLIP - 0x00000020 - The input is connected to a device that produces a signal -that is flipped vertically and does not correct this before passing the -signal to userspace. Note that a 180 degree rotation is the same as HFLIP | VFLIP - - - Analog Video - - - V4L2_IN_ST_NO_H_LOCK - 0x00000100 - No horizontal sync lock. - - - V4L2_IN_ST_COLOR_KILL - 0x00000200 - A color killer circuit automatically disables color -decoding when it detects no color modulation. When this flag is set -the color killer is enabled and has shut off -color decoding. - - - Digital Video - - - V4L2_IN_ST_NO_SYNC - 0x00010000 - No synchronization lock. - - - V4L2_IN_ST_NO_EQU - 0x00020000 - No equalizer lock. - - - V4L2_IN_ST_NO_CARRIER - 0x00040000 - Carrier recovery failed. - - - VCR and Set-Top Box - - - V4L2_IN_ST_MACROVISION - 0x01000000 - Macrovision is an analog copy prevention system -mangling the video signal to confuse video recorders. When this -flag is set Macrovision has been detected. - - - V4L2_IN_ST_NO_ACCESS - 0x02000000 - Conditional access denied. - - - V4L2_IN_ST_VTR - 0x04000000 - VTR time constant. [?] - - - -
- - - - Input capabilities - - &cs-def; - - - V4L2_IN_CAP_PRESETS - 0x00000001 - This input supports setting DV presets by using VIDIOC_S_DV_PRESET. - - - V4L2_IN_CAP_CUSTOM_TIMINGS - 0x00000002 - This input supports setting custom video timings by using VIDIOC_S_DV_TIMINGS. - - - V4L2_IN_CAP_STD - 0x00000004 - This input supports setting the TV standard by using VIDIOC_S_STD. - - - -
-
- - - &return-value; - - - - EINVAL - - The &v4l2-input; index is -out of bounds. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-enumoutput.xml b/Documentation/DocBook/v4l/vidioc-enumoutput.xml deleted file mode 100644 index a281d26a195f..000000000000 --- a/Documentation/DocBook/v4l/vidioc-enumoutput.xml +++ /dev/null @@ -1,206 +0,0 @@ - - - ioctl VIDIOC_ENUMOUTPUT - &manvol; - - - - VIDIOC_ENUMOUTPUT - Enumerate video outputs - - - - - - int ioctl - int fd - int request - struct v4l2_output *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_ENUMOUTPUT - - - - argp - - - - - - - - - Description - - To query the attributes of a video outputs applications -initialize the index field of &v4l2-output; -and call the VIDIOC_ENUMOUTPUT ioctl with a -pointer to this structure. Drivers fill the rest of the structure or -return an &EINVAL; when the index is out of bounds. To enumerate all -outputs applications shall begin at index zero, incrementing by one -until the driver returns EINVAL. - - - struct <structname>v4l2_output</structname> - - &cs-str; - - - __u32 - index - Identifies the output, set by the -application. - - - __u8 - name[32] - Name of the video output, a NUL-terminated ASCII -string, for example: "Vout". This information is intended for the -user, preferably the connector label on the device itself. - - - __u32 - type - Type of the output, see . - - - __u32 - audioset - Drivers can enumerate up to 32 video and -audio outputs. This field shows which audio outputs were -selectable as the current output if this was the currently selected -video output. It is a bit mask. The LSB corresponds to audio output 0, -the MSB to output 31. Any number of bits can be set, or -none.When the driver does not enumerate audio outputs no -bits must be set. Applications shall not interpret this as lack of -audio support. Drivers may automatically select audio outputs without -enumerating them.For details on audio outputs and how to -select the current output see . - - - __u32 - modulator - Output devices can have zero or more RF modulators. -When the type is -V4L2_OUTPUT_TYPE_MODULATOR this is an RF -connector and this field identifies the modulator. It corresponds to -&v4l2-modulator; field index. For details -on modulators see . - - - &v4l2-std-id; - std - Every video output supports one or more different -video standards. This field is a set of all supported standards. For -details on video standards and how to switch see . - - - __u32 - capabilities - This field provides capabilities for the -output. See for flags. - - - __u32 - reserved[3] - Reserved for future extensions. Drivers must set -the array to zero. - - - -
- - - Output Type - - &cs-def; - - - V4L2_OUTPUT_TYPE_MODULATOR - 1 - This output is an analog TV modulator. - - - V4L2_OUTPUT_TYPE_ANALOG - 2 - Analog baseband output, for example Composite / -CVBS, S-Video, RGB. - - - V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY - 3 - [?] - - - -
- - - - Output capabilities - - &cs-def; - - - V4L2_OUT_CAP_PRESETS - 0x00000001 - This output supports setting DV presets by using VIDIOC_S_DV_PRESET. - - - V4L2_OUT_CAP_CUSTOM_TIMINGS - 0x00000002 - This output supports setting custom video timings by using VIDIOC_S_DV_TIMINGS. - - - V4L2_OUT_CAP_STD - 0x00000004 - This output supports setting the TV standard by using VIDIOC_S_STD. - - - -
- -
- - &return-value; - - - - EINVAL - - The &v4l2-output; index -is out of bounds. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-enumstd.xml b/Documentation/DocBook/v4l/vidioc-enumstd.xml deleted file mode 100644 index 95803fe2c8e4..000000000000 --- a/Documentation/DocBook/v4l/vidioc-enumstd.xml +++ /dev/null @@ -1,391 +0,0 @@ - - - ioctl VIDIOC_ENUMSTD - &manvol; - - - - VIDIOC_ENUMSTD - Enumerate supported video standards - - - - - - int ioctl - int fd - int request - struct v4l2_standard *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_ENUMSTD - - - - argp - - - - - - - - - Description - - To query the attributes of a video standard, -especially a custom (driver defined) one, applications initialize the -index field of &v4l2-standard; and call the -VIDIOC_ENUMSTD ioctl with a pointer to this -structure. Drivers fill the rest of the structure or return an -&EINVAL; when the index is out of bounds. To enumerate all standards -applications shall begin at index zero, incrementing by one until the -driver returns EINVAL. Drivers may enumerate a -different set of standards after switching the video input or -output. - The supported standards may overlap and we need an -unambiguous set to find the current standard returned by -VIDIOC_G_STD. - - - - struct <structname>v4l2_standard</structname> - - &cs-str; - - - __u32 - index - Number of the video standard, set by the -application. - - - &v4l2-std-id; - id - The bits in this field identify the standard as -one of the common standards listed in , -or if bits 32 to 63 are set as custom standards. Multiple bits can be -set if the hardware does not distinguish between these standards, -however separate indices do not indicate the opposite. The -id must be unique. No other enumerated -v4l2_standard structure, for this input or -output anyway, can contain the same set of bits. - - - __u8 - name[24] - Name of the standard, a NUL-terminated ASCII -string, for example: "PAL-B/G", "NTSC Japan". This information is -intended for the user. - - - &v4l2-fract; - frameperiod - The frame period (not field period) is numerator -/ denominator. For example M/NTSC has a frame period of 1001 / -30000 seconds. - - - __u32 - framelines - Total lines per frame including blanking, -e. g. 625 for B/PAL. - - - __u32 - reserved[4] - Reserved for future extensions. Drivers must set -the array to zero. - - - -
- - - struct <structname>v4l2_fract</structname> - - &cs-str; - - - __u32 - numerator - - - - __u32 - denominator - - - - -
- - - typedef <structname>v4l2_std_id</structname> - - &cs-str; - - - __u64 - v4l2_std_id - This type is a set, each bit representing another -video standard as listed below and in . The 32 most significant bits are reserved -for custom (driver defined) video standards. - - - -
- - -#define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001) -#define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002) -#define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004) -#define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008) -#define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010) -#define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020) -#define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040) -#define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080) - -#define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100) -#define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200) -#define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400) -#define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800) -V4L2_STD_PAL_60 is -a hybrid standard with 525 lines, 60 Hz refresh rate, and PAL color -modulation with a 4.43 MHz color subcarrier. Some PAL video recorders -can play back NTSC tapes in this mode for display on a 50/60 Hz agnostic -PAL TV. -#define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) -#define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) -#define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000) -V4L2_STD_NTSC_443 -is a hybrid standard with 525 lines, 60 Hz refresh rate, and NTSC -color modulation with a 4.43 MHz color -subcarrier. -#define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000) - -#define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000) -#define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000) -#define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000) -#define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000) -#define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000) -#define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000) -#define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000) -#define V4L2_STD_SECAM_LC ((v4l2_std_id)0x00800000) - -/* ATSC/HDTV */ -#define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000) -#define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000) -V4L2_STD_ATSC_8_VSB and -V4L2_STD_ATSC_16_VSB are U.S. terrestrial digital -TV standards. Presently the V4L2 API does not support digital TV. See -also the Linux DVB API at http://linuxtv.org. - -#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\ - V4L2_STD_PAL_B1 |\ - V4L2_STD_PAL_G) -#define V4L2_STD_B (V4L2_STD_PAL_B |\ - V4L2_STD_PAL_B1 |\ - V4L2_STD_SECAM_B) -#define V4L2_STD_GH (V4L2_STD_PAL_G |\ - V4L2_STD_PAL_H |\ - V4L2_STD_SECAM_G |\ - V4L2_STD_SECAM_H) -#define V4L2_STD_PAL_DK (V4L2_STD_PAL_D |\ - V4L2_STD_PAL_D1 |\ - V4L2_STD_PAL_K) -#define V4L2_STD_PAL (V4L2_STD_PAL_BG |\ - V4L2_STD_PAL_DK |\ - V4L2_STD_PAL_H |\ - V4L2_STD_PAL_I) -#define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\ - V4L2_STD_NTSC_M_JP |\ - V4L2_STD_NTSC_M_KR) -#define V4L2_STD_MN (V4L2_STD_PAL_M |\ - V4L2_STD_PAL_N |\ - V4L2_STD_PAL_Nc |\ - V4L2_STD_NTSC) -#define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\ - V4L2_STD_SECAM_K |\ - V4L2_STD_SECAM_K1) -#define V4L2_STD_DK (V4L2_STD_PAL_DK |\ - V4L2_STD_SECAM_DK) - -#define V4L2_STD_SECAM (V4L2_STD_SECAM_B |\ - V4L2_STD_SECAM_G |\ - V4L2_STD_SECAM_H |\ - V4L2_STD_SECAM_DK |\ - V4L2_STD_SECAM_L |\ - V4L2_STD_SECAM_LC) - -#define V4L2_STD_525_60 (V4L2_STD_PAL_M |\ - V4L2_STD_PAL_60 |\ - V4L2_STD_NTSC |\ - V4L2_STD_NTSC_443) -#define V4L2_STD_625_50 (V4L2_STD_PAL |\ - V4L2_STD_PAL_N |\ - V4L2_STD_PAL_Nc |\ - V4L2_STD_SECAM) - -#define V4L2_STD_UNKNOWN 0 -#define V4L2_STD_ALL (V4L2_STD_525_60 |\ - V4L2_STD_625_50) - - - - Video Standards (based on [<xref linkend="itu470" />]) - - - - - - - - - - - - - - - - Characteristics - M/NTSCJapan uses a standard -similar to M/NTSC -(V4L2_STD_NTSC_M_JP). - M/PAL - N/PAL The values in -brackets apply to the combination N/PAL a.k.a. -NC used in Argentina -(V4L2_STD_PAL_Nc). - B, B1, G/PAL - D, D1, K/PAL - H/PAL - I/PAL - B, G/SECAM - D, K/SECAM - K1/SECAM - L/SECAM - - - - - Frame lines - 525 - 625 - - - Frame period (s) - 1001/30000 - 1/25 - - - Chrominance sub-carrier frequency (Hz) - 3579545 ± 10 - 3579611.49 ± 10 - 4433618.75 ± 5 (3582056.25 -± 5) - 4433618.75 ± 5 - 4433618.75 ± 1 - fOR = -4406250 ± 2000, fOB = 4250000 -± 2000 - - - Nominal radio-frequency channel bandwidth -(MHz) - 6 - 6 - 6 - B: 7; B1, G: 8 - 8 - 8 - 8 - 8 - 8 - 8 - 8 - - - Sound carrier relative to vision carrier -(MHz) - + 4.5 - + 4.5 - + 4.5 - + 5.5 ± 0.001 -In the Federal Republic of Germany, Austria, Italy, -the Netherlands, Slovakia and Switzerland a system of two sound -carriers is used, the frequency of the second carrier being -242.1875 kHz above the frequency of the first sound carrier. For -stereophonic sound transmissions a similar system is used in -Australia. New Zealand uses a sound -carrier displaced 5.4996 ± 0.0005 MHz from the vision -carrier. In Denmark, Finland, New -Zealand, Sweden and Spain a system of two sound carriers is used. In -Iceland, Norway and Poland the same system is being introduced. The -second carrier is 5.85 MHz above the vision carrier and is DQPSK -modulated with 728 kbit/s sound and data multiplex. (NICAM -system) In the United Kingdom, a -system of two sound carriers is used. The second sound carrier is -6.552 MHz above the vision carrier and is DQPSK modulated with a -728 kbit/s sound and data multiplex able to carry two sound -channels. (NICAM system) - + 6.5 ± 0.001 - + 5.5 - + 5.9996 ± 0.0005 - + 5.5 ± 0.001 - + 6.5 ± 0.001 - + 6.5 - + 6.5 In France, a -digital carrier 5.85 MHz away from the vision carrier may be used in -addition to the main sound carrier. It is modulated in differentially -encoded QPSK with a 728 kbit/s sound and data multiplexer capable of -carrying two sound channels. (NICAM -system) - - - -
-
- - - &return-value; - - - - EINVAL - - The &v4l2-standard; index -is out of bounds. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-g-audio.xml b/Documentation/DocBook/v4l/vidioc-g-audio.xml deleted file mode 100644 index 65361a8c2b05..000000000000 --- a/Documentation/DocBook/v4l/vidioc-g-audio.xml +++ /dev/null @@ -1,188 +0,0 @@ - - - ioctl VIDIOC_G_AUDIO, VIDIOC_S_AUDIO - &manvol; - - - - VIDIOC_G_AUDIO - VIDIOC_S_AUDIO - Query or select the current audio input and its -attributes - - - - - - int ioctl - int fd - int request - struct v4l2_audio *argp - - - - - int ioctl - int fd - int request - const struct v4l2_audio *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_G_AUDIO, VIDIOC_S_AUDIO - - - - argp - - - - - - - - - Description - - To query the current audio input applications zero out the -reserved array of a &v4l2-audio; -and call the VIDIOC_G_AUDIO ioctl with a pointer -to this structure. Drivers fill the rest of the structure or return an -&EINVAL; when the device has no audio inputs, or none which combine -with the current video input. - - Audio inputs have one writable property, the audio mode. To -select the current audio input and change the -audio mode, applications initialize the -index and mode -fields, and the -reserved array of a -v4l2_audio structure and call the -VIDIOC_S_AUDIO ioctl. Drivers may switch to a -different audio mode if the request cannot be satisfied. However, this -is a write-only ioctl, it does not return the actual new audio -mode. - - - struct <structname>v4l2_audio</structname> - - &cs-str; - - - __u32 - index - Identifies the audio input, set by the -driver or application. - - - __u8 - name[32] - Name of the audio input, a NUL-terminated ASCII -string, for example: "Line In". This information is intended for the -user, preferably the connector label on the device itself. - - - __u32 - capability - Audio capability flags, see . - - - __u32 - mode - Audio mode flags set by drivers and applications (on - VIDIOC_S_AUDIO ioctl), see . - - - __u32 - reserved[2] - Reserved for future extensions. Drivers and -applications must set the array to zero. - - - -
- - - Audio Capability Flags - - &cs-def; - - - V4L2_AUDCAP_STEREO - 0x00001 - This is a stereo input. The flag is intended to -automatically disable stereo recording etc. when the signal is always -monaural. The API provides no means to detect if stereo is -received, unless the audio input belongs to a -tuner. - - - V4L2_AUDCAP_AVL - 0x00002 - Automatic Volume Level mode is supported. - - - -
- - - Audio Mode Flags - - &cs-def; - - - V4L2_AUDMODE_AVL - 0x00001 - AVL mode is on. - - - -
-
- - - &return-value; - - - - EINVAL - - No audio inputs combine with the current video input, -or the number of the selected audio input is out of bounds or it does -not combine, or there are no audio inputs at all and the ioctl is not -supported. - - - - EBUSY - - I/O is in progress, the input cannot be -switched. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-g-audioout.xml b/Documentation/DocBook/v4l/vidioc-g-audioout.xml deleted file mode 100644 index 3632730c5c6e..000000000000 --- a/Documentation/DocBook/v4l/vidioc-g-audioout.xml +++ /dev/null @@ -1,154 +0,0 @@ - - - ioctl VIDIOC_G_AUDOUT, VIDIOC_S_AUDOUT - &manvol; - - - - VIDIOC_G_AUDOUT - VIDIOC_S_AUDOUT - Query or select the current audio output - - - - - - int ioctl - int fd - int request - struct v4l2_audioout *argp - - - - - int ioctl - int fd - int request - const struct v4l2_audioout *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_G_AUDOUT, VIDIOC_S_AUDOUT - - - - argp - - - - - - - - - Description - - To query the current audio output applications zero out the -reserved array of a &v4l2-audioout; and -call the VIDIOC_G_AUDOUT ioctl with a pointer -to this structure. Drivers fill the rest of the structure or return an -&EINVAL; when the device has no audio inputs, or none which combine -with the current video output. - - Audio outputs have no writable properties. Nevertheless, to -select the current audio output applications can initialize the -index field and -reserved array (which in the future may -contain writable properties) of a -v4l2_audioout structure and call the -VIDIOC_S_AUDOUT ioctl. Drivers switch to the -requested output or return the &EINVAL; when the index is out of -bounds. This is a write-only ioctl, it does not return the current -audio output attributes as VIDIOC_G_AUDOUT -does. - - Note connectors on a TV card to loop back the received audio -signal to a sound card are not audio outputs in this sense. - - - struct <structname>v4l2_audioout</structname> - - &cs-str; - - - __u32 - index - Identifies the audio output, set by the -driver or application. - - - __u8 - name[32] - Name of the audio output, a NUL-terminated ASCII -string, for example: "Line Out". This information is intended for the -user, preferably the connector label on the device itself. - - - __u32 - capability - Audio capability flags, none defined yet. Drivers -must set this field to zero. - - - __u32 - mode - Audio mode, none defined yet. Drivers and -applications (on VIDIOC_S_AUDOUT) must set this -field to zero. - - - __u32 - reserved[2] - Reserved for future extensions. Drivers and -applications must set the array to zero. - - - -
-
- - - &return-value; - - - - EINVAL - - No audio outputs combine with the current video -output, or the number of the selected audio output is out of bounds or -it does not combine, or there are no audio outputs at all and the -ioctl is not supported. - - - - EBUSY - - I/O is in progress, the output cannot be -switched. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-g-crop.xml b/Documentation/DocBook/v4l/vidioc-g-crop.xml deleted file mode 100644 index d235b1dedbed..000000000000 --- a/Documentation/DocBook/v4l/vidioc-g-crop.xml +++ /dev/null @@ -1,143 +0,0 @@ - - - ioctl VIDIOC_G_CROP, VIDIOC_S_CROP - &manvol; - - - - VIDIOC_G_CROP - VIDIOC_S_CROP - Get or set the current cropping rectangle - - - - - - int ioctl - int fd - int request - struct v4l2_crop *argp - - - - - int ioctl - int fd - int request - const struct v4l2_crop *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_G_CROP, VIDIOC_S_CROP - - - - argp - - - - - - - - - Description - - To query the cropping rectangle size and position -applications set the type field of a -v4l2_crop structure to the respective buffer -(stream) type and call the VIDIOC_G_CROP ioctl -with a pointer to this structure. The driver fills the rest of the -structure or returns the &EINVAL; if cropping is not supported. - - To change the cropping rectangle applications initialize the -type and &v4l2-rect; substructure named -c of a v4l2_crop structure and call the -VIDIOC_S_CROP ioctl with a pointer to this -structure. - - The driver first adjusts the requested dimensions against -hardware limits, &ie; the bounds given by the capture/output window, -and it rounds to the closest possible values of horizontal and -vertical offset, width and height. In particular the driver must round -the vertical offset of the cropping rectangle to frame lines modulo -two, such that the field order cannot be confused. - - Second the driver adjusts the image size (the opposite -rectangle of the scaling process, source or target depending on the -data direction) to the closest size possible while maintaining the -current horizontal and vertical scaling factor. - - Finally the driver programs the hardware with the actual -cropping and image parameters. VIDIOC_S_CROP is a -write-only ioctl, it does not return the actual parameters. To query -them applications must call VIDIOC_G_CROP and -&VIDIOC-G-FMT;. When the parameters are unsuitable the application may -modify the cropping or image parameters and repeat the cycle until -satisfactory parameters have been negotiated. - - When cropping is not supported then no parameters are -changed and VIDIOC_S_CROP returns the -&EINVAL;. - - - struct <structname>v4l2_crop</structname> - - &cs-str; - - - &v4l2-buf-type; - type - Type of the data stream, set by the application. -Only these types are valid here: V4L2_BUF_TYPE_VIDEO_CAPTURE, -V4L2_BUF_TYPE_VIDEO_OUTPUT, -V4L2_BUF_TYPE_VIDEO_OVERLAY, and custom (driver -defined) types with code V4L2_BUF_TYPE_PRIVATE -and higher. - - - &v4l2-rect; - c - Cropping rectangle. The same co-ordinate system as -for &v4l2-cropcap; bounds is used. - - - -
-
- - - &return-value; - - - - EINVAL - - Cropping is not supported. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-g-ctrl.xml b/Documentation/DocBook/v4l/vidioc-g-ctrl.xml deleted file mode 100644 index 8b5e6ff7f3df..000000000000 --- a/Documentation/DocBook/v4l/vidioc-g-ctrl.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - ioctl VIDIOC_G_CTRL, VIDIOC_S_CTRL - &manvol; - - - - VIDIOC_G_CTRL - VIDIOC_S_CTRL - Get or set the value of a control - - - - - - int ioctl - int fd - int request - struct v4l2_control -*argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_G_CTRL, VIDIOC_S_CTRL - - - - argp - - - - - - - - - Description - - To get the current value of a control applications -initialize the id field of a struct -v4l2_control and call the -VIDIOC_G_CTRL ioctl with a pointer to this -structure. To change the value of a control applications initialize -the id and value -fields of a struct v4l2_control and call the -VIDIOC_S_CTRL ioctl. - - When the id is invalid drivers -return an &EINVAL;. When the value is out -of bounds drivers can choose to take the closest valid value or return -an &ERANGE;, whatever seems more appropriate. However, -VIDIOC_S_CTRL is a write-only ioctl, it does not -return the actual new value. - - These ioctls work only with user controls. For other -control classes the &VIDIOC-G-EXT-CTRLS;, &VIDIOC-S-EXT-CTRLS; or -&VIDIOC-TRY-EXT-CTRLS; must be used. - - - struct <structname>v4l2_control</structname> - - &cs-str; - - - __u32 - id - Identifies the control, set by the -application. - - - __s32 - value - New value or current value. - - - -
-
- - - &return-value; - - - - EINVAL - - The &v4l2-control; id is -invalid. - - - - ERANGE - - The &v4l2-control; value -is out of bounds. - - - - EBUSY - - The control is temporarily not changeable, possibly -because another applications took over control of the device function -this control belongs to. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-g-dv-preset.xml b/Documentation/DocBook/v4l/vidioc-g-dv-preset.xml deleted file mode 100644 index d733721a7519..000000000000 --- a/Documentation/DocBook/v4l/vidioc-g-dv-preset.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - ioctl VIDIOC_G_DV_PRESET, VIDIOC_S_DV_PRESET - &manvol; - - - - VIDIOC_G_DV_PRESET - VIDIOC_S_DV_PRESET - Query or select the DV preset of the current input or output - - - - - - int ioctl - int fd - int request - struct v4l2_dv_preset *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_G_DV_PRESET, VIDIOC_S_DV_PRESET - - - - argp - - - - - - - - - Description - To query and select the current DV preset, applications -use the VIDIOC_G_DV_PRESET and VIDIOC_S_DV_PRESET -ioctls which take a pointer to a &v4l2-dv-preset; type as argument. -Applications must zero the reserved array in &v4l2-dv-preset;. -VIDIOC_G_DV_PRESET returns a dv preset in the field -preset of &v4l2-dv-preset;. - - VIDIOC_S_DV_PRESET accepts a pointer to a &v4l2-dv-preset; -that has the preset value to be set. Applications must zero the reserved array in &v4l2-dv-preset;. -If the preset is not supported, it returns an &EINVAL; - - - - &return-value; - - - - EINVAL - - This ioctl is not supported, or the -VIDIOC_S_DV_PRESET,VIDIOC_S_DV_PRESET parameter was unsuitable. - - - - EBUSY - - The device is busy and therefore can not change the preset. - - - - - - struct <structname>v4l2_dv_preset</structname> - - &cs-str; - - - __u32 - preset - Preset value to represent the digital video timings - - - __u32 - reserved[4] - Reserved fields for future use - - - -
- -
-
- - diff --git a/Documentation/DocBook/v4l/vidioc-g-dv-timings.xml b/Documentation/DocBook/v4l/vidioc-g-dv-timings.xml deleted file mode 100644 index d5ec6abf0ce2..000000000000 --- a/Documentation/DocBook/v4l/vidioc-g-dv-timings.xml +++ /dev/null @@ -1,223 +0,0 @@ - - - ioctl VIDIOC_G_DV_TIMINGS, VIDIOC_S_DV_TIMINGS - &manvol; - - - - VIDIOC_G_DV_TIMINGS - VIDIOC_S_DV_TIMINGS - Get or set custom DV timings for input or output - - - - - - int ioctl - int fd - int request - struct v4l2_dv_timings *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_G_DV_TIMINGS, VIDIOC_S_DV_TIMINGS - - - - argp - - - - - - - - - Description - To set custom DV timings for the input or output, applications use the -VIDIOC_S_DV_TIMINGS ioctl and to get the current custom timings, -applications use the VIDIOC_G_DV_TIMINGS ioctl. The detailed timing -information is filled in using the structure &v4l2-dv-timings;. These ioctls take -a pointer to the &v4l2-dv-timings; structure as argument. If the ioctl is not supported -or the timing values are not correct, the driver returns &EINVAL;. - - - - &return-value; - - - - EINVAL - - This ioctl is not supported, or the -VIDIOC_S_DV_TIMINGS parameter was unsuitable. - - - - EBUSY - - The device is busy and therefore can not change the timings. - - - - - - struct <structname>v4l2_bt_timings</structname> - - &cs-str; - - - __u32 - width - Width of the active video in pixels - - - __u32 - height - Height of the active video in lines - - - __u32 - interlaced - Progressive (0) or interlaced (1) - - - __u32 - polarities - This is a bit mask that defines polarities of sync signals. -bit 0 (V4L2_DV_VSYNC_POS_POL) is for vertical sync polarity and bit 1 (V4L2_DV_HSYNC_POS_POL) is for horizontal sync polarity. If the bit is set -(1) it is positive polarity and if is cleared (0), it is negative polarity. - - - __u64 - pixelclock - Pixel clock in Hz. Ex. 74.25MHz->74250000 - - - __u32 - hfrontporch - Horizontal front porch in pixels - - - __u32 - hsync - Horizontal sync length in pixels - - - __u32 - hbackporch - Horizontal back porch in pixels - - - __u32 - vfrontporch - Vertical front porch in lines - - - __u32 - vsync - Vertical sync length in lines - - - __u32 - vbackporch - Vertical back porch in lines - - - __u32 - il_vfrontporch - Vertical front porch in lines for bottom field of interlaced field formats - - - __u32 - il_vsync - Vertical sync length in lines for bottom field of interlaced field formats - - - __u32 - il_vbackporch - Vertical back porch in lines for bottom field of interlaced field formats - - - -
- - - struct <structname>v4l2_dv_timings</structname> - - &cs-str; - - - __u32 - type - - Type of DV timings as listed in . - - - union - - - - - - &v4l2-bt-timings; - bt - Timings defined by BT.656/1120 specifications - - - - __u32 - reserved[32] - - - - -
- - - DV Timing types - - &cs-str; - - - Timing type - value - Description - - - - - - - - V4L2_DV_BT_656_1120 - 0 - BT.656/1120 timings - - - -
-
-
- - diff --git a/Documentation/DocBook/v4l/vidioc-g-enc-index.xml b/Documentation/DocBook/v4l/vidioc-g-enc-index.xml deleted file mode 100644 index 9f242e4b2948..000000000000 --- a/Documentation/DocBook/v4l/vidioc-g-enc-index.xml +++ /dev/null @@ -1,213 +0,0 @@ - - - ioctl VIDIOC_G_ENC_INDEX - &manvol; - - - - VIDIOC_G_ENC_INDEX - Get meta data about a compressed video stream - - - - - - int ioctl - int fd - int request - struct v4l2_enc_idx *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_G_ENC_INDEX - - - - argp - - - - - - - - - Description - - - Experimental - - This is an experimental -interface and may change in the future. - - - The VIDIOC_G_ENC_INDEX ioctl provides -meta data about a compressed video stream the same or another -application currently reads from the driver, which is useful for -random access into the stream without decoding it. - - To read the data applications must call -VIDIOC_G_ENC_INDEX with a pointer to a -&v4l2-enc-idx;. On success the driver fills the -entry array, stores the number of elements -written in the entries field, and -initializes the entries_cap field. - - Each element of the entry array -contains meta data about one picture. A -VIDIOC_G_ENC_INDEX call reads up to -V4L2_ENC_IDX_ENTRIES entries from a driver -buffer, which can hold up to entries_cap -entries. This number can be lower or higher than -V4L2_ENC_IDX_ENTRIES, but not zero. When the -application fails to read the meta data in time the oldest entries -will be lost. When the buffer is empty or no capturing/encoding is in -progress, entries will be zero. - - Currently this ioctl is only defined for MPEG-2 program -streams and video elementary streams. - - - struct <structname>v4l2_enc_idx</structname> - - &cs-str; - - - __u32 - entries - The number of entries the driver stored in the -entry array. - - - __u32 - entries_cap - The number of entries the driver can -buffer. Must be greater than zero. - - - __u32 - reserved[4] - Reserved for future extensions. -Drivers must set the array to zero. - - - &v4l2-enc-idx-entry; - entry[V4L2_ENC_IDX_ENTRIES] - Meta data about a compressed video stream. Each -element of the array corresponds to one picture, sorted in ascending -order by their offset. - - - -
- - - struct <structname>v4l2_enc_idx_entry</structname> - - &cs-str; - - - __u64 - offset - The offset in bytes from the beginning of the -compressed video stream to the beginning of this picture, that is a -PES packet header as defined in or a picture -header as defined in . When -the encoder is stopped, the driver resets the offset to zero. - - - __u64 - pts - The 33 bit Presentation Time -Stamp of this picture as defined in . - - - __u32 - length - The length of this picture in bytes. - - - __u32 - flags - Flags containing the coding type of this picture, see . - - - __u32 - reserved[2] - Reserved for future extensions. -Drivers must set the array to zero. - - - -
- - - Index Entry Flags - - &cs-def; - - - V4L2_ENC_IDX_FRAME_I - 0x00 - This is an Intra-coded picture. - - - V4L2_ENC_IDX_FRAME_P - 0x01 - This is a Predictive-coded picture. - - - V4L2_ENC_IDX_FRAME_B - 0x02 - This is a Bidirectionally predictive-coded -picture. - - - V4L2_ENC_IDX_FRAME_MASK - 0x0F - AND the flags field with -this mask to obtain the picture coding type. - - - -
-
- - - &return-value; - - - - EINVAL - - The driver does not support this ioctl. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-g-ext-ctrls.xml b/Documentation/DocBook/v4l/vidioc-g-ext-ctrls.xml deleted file mode 100644 index 3aa7f8f9ff0c..000000000000 --- a/Documentation/DocBook/v4l/vidioc-g-ext-ctrls.xml +++ /dev/null @@ -1,307 +0,0 @@ - - - ioctl VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS, -VIDIOC_TRY_EXT_CTRLS - &manvol; - - - - VIDIOC_G_EXT_CTRLS - VIDIOC_S_EXT_CTRLS - VIDIOC_TRY_EXT_CTRLS - Get or set the value of several controls, try control -values - - - - - - int ioctl - int fd - int request - struct v4l2_ext_controls -*argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS, -VIDIOC_TRY_EXT_CTRLS - - - - argp - - - - - - - - - Description - - These ioctls allow the caller to get or set multiple -controls atomically. Control IDs are grouped into control classes (see -) and all controls in the control array -must belong to the same control class. - - Applications must always fill in the -count, -ctrl_class, -controls and -reserved fields of &v4l2-ext-controls;, and -initialize the &v4l2-ext-control; array pointed to by the -controls fields. - - To get the current value of a set of controls applications -initialize the id, -size and reserved2 fields -of each &v4l2-ext-control; and call the -VIDIOC_G_EXT_CTRLS ioctl. String controls controls -must also set the string field. - - If the size is too small to -receive the control result (only relevant for pointer-type controls -like strings), then the driver will set size -to a valid value and return an &ENOSPC;. You should re-allocate the -string memory to this new size and try again. It is possible that the -same issue occurs again if the string has grown in the meantime. It is -recommended to call &VIDIOC-QUERYCTRL; first and use -maximum+1 as the new size -value. It is guaranteed that that is sufficient memory. - - - To change the value of a set of controls applications -initialize the id, size, -reserved2 and -value/string fields of each &v4l2-ext-control; and -call the VIDIOC_S_EXT_CTRLS ioctl. The controls -will only be set if all control values are -valid. - - To check if a set of controls have correct values applications -initialize the id, size, -reserved2 and -value/string fields of each &v4l2-ext-control; and -call the VIDIOC_TRY_EXT_CTRLS ioctl. It is up to -the driver whether wrong values are automatically adjusted to a valid -value or if an error is returned. - - When the id or -ctrl_class is invalid drivers return an -&EINVAL;. When the value is out of bounds drivers can choose to take -the closest valid value or return an &ERANGE;, whatever seems more -appropriate. In the first case the new value is set in -&v4l2-ext-control;. - - The driver will only set/get these controls if all control -values are correct. This prevents the situation where only some of the -controls were set/get. Only low-level errors (⪚ a failed i2c -command) can still cause this situation. - - - struct <structname>v4l2_ext_control</structname> - - &cs-ustr; - - - __u32 - id - - Identifies the control, set by the -application. - - - __u32 - size - - The total size in bytes of the payload of this -control. This is normally 0, but for pointer controls this should be -set to the size of the memory containing the payload, or that will -receive the payload. If VIDIOC_G_EXT_CTRLS finds -that this value is less than is required to store -the payload result, then it is set to a value large enough to store the -payload result and ENOSPC is returned. Note that for string controls -this size field should not be confused with the length of the string. -This field refers to the size of the memory that contains the string. -The actual length of the string may well be much smaller. - - - - __u32 - reserved2[1] - - Reserved for future extensions. Drivers and -applications must set the array to zero. - - - union - (anonymous) - - - - __s32 - value - New value or current value. - - - - __s64 - value64 - New value or current value. - - - - char * - string - A pointer to a string. - - - -
- - - struct <structname>v4l2_ext_controls</structname> - - &cs-str; - - - __u32 - ctrl_class - The control class to which all controls belong, see -. - - - __u32 - count - The number of controls in the controls array. May -also be zero. - - - __u32 - error_idx - Set by the driver in case of an error. It is the -index of the control causing the error or equal to 'count' when the -error is not associated with a particular control. Undefined when the -ioctl returns 0 (success). - - - __u32 - reserved[2] - Reserved for future extensions. Drivers and -applications must set the array to zero. - - - &v4l2-ext-control; * - controls - Pointer to an array of -count v4l2_ext_control structures. Ignored -if count equals zero. - - - -
- - - Control classes - - &cs-def; - - - V4L2_CTRL_CLASS_USER - 0x980000 - The class containing user controls. These controls -are described in . All controls that can be set -using the &VIDIOC-S-CTRL; and &VIDIOC-G-CTRL; ioctl belong to this -class. - - - V4L2_CTRL_CLASS_MPEG - 0x990000 - The class containing MPEG compression controls. -These controls are described in . - - - V4L2_CTRL_CLASS_CAMERA - 0x9a0000 - The class containing camera controls. -These controls are described in . - - - V4L2_CTRL_CLASS_FM_TX - 0x9b0000 - The class containing FM Transmitter (FM TX) controls. -These controls are described in . - - - -
- -
- - - &return-value; - - - - EINVAL - - The &v4l2-ext-control; id -is invalid or the &v4l2-ext-controls; -ctrl_class is invalid. This error code is -also returned by the VIDIOC_S_EXT_CTRLS and -VIDIOC_TRY_EXT_CTRLS ioctls if two or more -control values are in conflict. - - - - ERANGE - - The &v4l2-ext-control; value -is out of bounds. - - - - EBUSY - - The control is temporarily not changeable, possibly -because another applications took over control of the device function -this control belongs to. - - - - ENOSPC - - The space reserved for the control's payload is insufficient. -The field size is set to a value that is enough -to store the payload and this error code is returned. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-g-fbuf.xml b/Documentation/DocBook/v4l/vidioc-g-fbuf.xml deleted file mode 100644 index e7dda4822f04..000000000000 --- a/Documentation/DocBook/v4l/vidioc-g-fbuf.xml +++ /dev/null @@ -1,473 +0,0 @@ - - - ioctl VIDIOC_G_FBUF, VIDIOC_S_FBUF - &manvol; - - - - VIDIOC_G_FBUF - VIDIOC_S_FBUF - Get or set frame buffer overlay parameters - - - - - - int ioctl - int fd - int request - struct v4l2_framebuffer *argp - - - - - int ioctl - int fd - int request - const struct v4l2_framebuffer *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_G_FBUF, VIDIOC_S_FBUF - - - - argp - - - - - - - - - Description - - Applications can use the VIDIOC_G_FBUF and -VIDIOC_S_FBUF ioctl to get and set the -framebuffer parameters for a Video -Overlay or Video Output Overlay -(OSD). The type of overlay is implied by the device type (capture or -output device) and can be determined with the &VIDIOC-QUERYCAP; ioctl. -One /dev/videoN device must not support both -kinds of overlay. - - The V4L2 API distinguishes destructive and non-destructive -overlays. A destructive overlay copies captured video images into the -video memory of a graphics card. A non-destructive overlay blends -video images into a VGA signal or graphics into a video signal. -Video Output Overlays are always -non-destructive. - - To get the current parameters applications call the -VIDIOC_G_FBUF ioctl with a pointer to a -v4l2_framebuffer structure. The driver fills -all fields of the structure or returns an &EINVAL; when overlays are -not supported. - - To set the parameters for a Video Output -Overlay, applications must initialize the -flags field of a struct -v4l2_framebuffer. Since the framebuffer is -implemented on the TV card all other parameters are determined by the -driver. When an application calls VIDIOC_S_FBUF -with a pointer to this structure, the driver prepares for the overlay -and returns the framebuffer parameters as -VIDIOC_G_FBUF does, or it returns an error -code. - - To set the parameters for a non-destructive -Video Overlay, applications must initialize the -flags field, the -fmt substructure, and call -VIDIOC_S_FBUF. Again the driver prepares for the -overlay and returns the framebuffer parameters as -VIDIOC_G_FBUF does, or it returns an error -code. - - For a destructive Video Overlay -applications must additionally provide a -base address. Setting up a DMA to a -random memory location can jeopardize the system security, its -stability or even damage the hardware, therefore only the superuser -can set the parameters for a destructive video overlay. - - - - - struct <structname>v4l2_framebuffer</structname> - - &cs-ustr; - - - __u32 - capability - - Overlay capability flags set by the driver, see -. - - - __u32 - flags - - Overlay control flags set by application and -driver, see - - - void * - base - - Physical base address of the framebuffer, -that is the address of the pixel in the top left corner of the -framebuffer.A physical base address may not suit all -platforms. GK notes in theory we should pass something like PCI device -+ memory region + offset instead. If you encounter problems please -discuss on the linux-media mailing list: &v4l-ml;. - - - - - - This field is irrelevant to -non-destructive Video Overlays. For -destructive Video Overlays applications must -provide a base address. The driver may accept only base addresses -which are a multiple of two, four or eight bytes. For -Video Output Overlays the driver must return -a valid base address, so applications can find the corresponding Linux -framebuffer device (see ). - - - &v4l2-pix-format; - fmt - - Layout of the frame buffer. The -v4l2_pix_format structure is defined in , for clarification the fields and acceptable values - are listed below: - - - - __u32 - width - Width of the frame buffer in pixels. - - - - __u32 - height - Height of the frame buffer in pixels. - - - - __u32 - pixelformat - The pixel format of the -framebuffer. - - - - - - For non-destructive Video -Overlays this field only defines a format for the -&v4l2-window; chromakey field. - - - - - - For destructive Video -Overlays applications must initialize this field. For -Video Output Overlays the driver must return -a valid format. - - - - - - Usually this is an RGB format (for example -V4L2_PIX_FMT_RGB565) -but YUV formats (only packed YUV formats when chroma keying is used, -not including V4L2_PIX_FMT_YUYV and -V4L2_PIX_FMT_UYVY) and the -V4L2_PIX_FMT_PAL8 format are also permitted. The -behavior of the driver when an application requests a compressed -format is undefined. See for information on -pixel formats. - - - - &v4l2-field; - field - Drivers and applications shall ignore this field. -If applicable, the field order is selected with the &VIDIOC-S-FMT; -ioctl, using the field field of -&v4l2-window;. - - - - __u32 - bytesperline - Distance in bytes between the leftmost pixels in -two adjacent lines. - - - This field is irrelevant to -non-destructive Video -Overlays.For destructive Video -Overlays both applications and drivers can set this field -to request padding bytes at the end of each line. Drivers however may -ignore the requested value, returning width -times bytes-per-pixel or a larger value required by the hardware. That -implies applications can just set this field to zero to get a -reasonable default.For Video Output -Overlays the driver must return a valid -value.Video hardware may access padding bytes, therefore -they must reside in accessible memory. Consider for example the case -where padding bytes after the last line of an image cross a system -page boundary. Capture devices may write padding bytes, the value is -undefined. Output devices ignore the contents of padding -bytes.When the image format is planar the -bytesperline value applies to the largest -plane and is divided by the same factor as the -width field for any smaller planes. For -example the Cb and Cr planes of a YUV 4:2:0 image have half as many -padding bytes following each line as the Y plane. To avoid ambiguities -drivers must return a bytesperline value -rounded up to a multiple of the scale factor. - - - - __u32 - sizeimage - This field is irrelevant to -non-destructive Video Overlays. For -destructive Video Overlays applications must -initialize this field. For Video Output -Overlays the driver must return a valid -format.Together with base it -defines the framebuffer memory accessible by the -driver. - - - - &v4l2-colorspace; - colorspace - This information supplements the -pixelformat and must be set by the driver, -see . - - - - __u32 - priv - Reserved for additional information about custom -(driver defined) formats. When not used drivers and applications must -set this field to zero. - - - -
- - - Frame Buffer Capability Flags - - &cs-def; - - - V4L2_FBUF_CAP_EXTERNOVERLAY - 0x0001 - The device is capable of non-destructive overlays. -When the driver clears this flag, only destructive overlays are -supported. There are no drivers yet which support both destructive and -non-destructive overlays. - - - V4L2_FBUF_CAP_CHROMAKEY - 0x0002 - The device supports clipping by chroma-keying the -images. That is, image pixels replace pixels in the VGA or video -signal only where the latter assume a certain color. Chroma-keying -makes no sense for destructive overlays. - - - V4L2_FBUF_CAP_LIST_CLIPPING - 0x0004 - The device supports clipping using a list of clip -rectangles. - - - V4L2_FBUF_CAP_BITMAP_CLIPPING - 0x0008 - The device supports clipping using a bit mask. - - - V4L2_FBUF_CAP_LOCAL_ALPHA - 0x0010 - The device supports clipping/blending using the -alpha channel of the framebuffer or VGA signal. Alpha blending makes -no sense for destructive overlays. - - - V4L2_FBUF_CAP_GLOBAL_ALPHA - 0x0020 - The device supports alpha blending using a global -alpha value. Alpha blending makes no sense for destructive overlays. - - - V4L2_FBUF_CAP_LOCAL_INV_ALPHA - 0x0040 - The device supports clipping/blending using the -inverted alpha channel of the framebuffer or VGA signal. Alpha -blending makes no sense for destructive overlays. - - - V4L2_FBUF_CAP_SRC_CHROMAKEY - 0x0080 - The device supports Source Chroma-keying. Framebuffer pixels -with the chroma-key colors are replaced by video pixels, which is exactly opposite of -V4L2_FBUF_CAP_CHROMAKEY - - - -
- - - Frame Buffer Flags - - &cs-def; - - - V4L2_FBUF_FLAG_PRIMARY - 0x0001 - The framebuffer is the primary graphics surface. -In other words, the overlay is destructive. [?] - - - V4L2_FBUF_FLAG_OVERLAY - 0x0002 - The frame buffer is an overlay surface the same -size as the capture. [?] - - - The purpose of -V4L2_FBUF_FLAG_PRIMARY and -V4L2_FBUF_FLAG_OVERLAY was never quite clear. -Most drivers seem to ignore these flags. For compatibility with the -bttv driver applications should set the -V4L2_FBUF_FLAG_OVERLAY flag. - - - V4L2_FBUF_FLAG_CHROMAKEY - 0x0004 - Use chroma-keying. The chroma-key color is -determined by the chromakey field of -&v4l2-window; and negotiated with the &VIDIOC-S-FMT; ioctl, see -and - . - - - There are no flags to enable -clipping using a list of clip rectangles or a bitmap. These methods -are negotiated with the &VIDIOC-S-FMT; ioctl, see and . - - - V4L2_FBUF_FLAG_LOCAL_ALPHA - 0x0008 - Use the alpha channel of the framebuffer to clip or -blend framebuffer pixels with video images. The blend -function is: output = framebuffer pixel * alpha + video pixel * (1 - -alpha). The actual alpha depth depends on the framebuffer pixel -format. - - - V4L2_FBUF_FLAG_GLOBAL_ALPHA - 0x0010 - Use a global alpha value to blend the framebuffer -with video images. The blend function is: output = (framebuffer pixel -* alpha + video pixel * (255 - alpha)) / 255. The alpha value is -determined by the global_alpha field of -&v4l2-window; and negotiated with the &VIDIOC-S-FMT; ioctl, see -and . - - - V4L2_FBUF_FLAG_LOCAL_INV_ALPHA - 0x0020 - Like -V4L2_FBUF_FLAG_LOCAL_ALPHA, use the alpha channel -of the framebuffer to clip or blend framebuffer pixels with video -images, but with an inverted alpha value. The blend function is: -output = framebuffer pixel * (1 - alpha) + video pixel * alpha. The -actual alpha depth depends on the framebuffer pixel format. - - - V4L2_FBUF_FLAG_SRC_CHROMAKEY - 0x0040 - Use source chroma-keying. The source chroma-key color is -determined by the chromakey field of -&v4l2-window; and negotiated with the &VIDIOC-S-FMT; ioctl, see and . -Both chroma-keying are mutual exclusive to each other, so same -chromakey field of &v4l2-window; is being used. - - - -
-
- - - &return-value; - - - - EPERM - - VIDIOC_S_FBUF can only be called -by a privileged user to negotiate the parameters for a destructive -overlay. - - - - EBUSY - - The framebuffer parameters cannot be changed at this -time because overlay is already enabled, or capturing is enabled -and the hardware cannot capture and overlay simultaneously. - - - - EINVAL - - The ioctl is not supported or the -VIDIOC_S_FBUF parameters are unsuitable. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-g-fmt.xml b/Documentation/DocBook/v4l/vidioc-g-fmt.xml deleted file mode 100644 index a4ae59b664eb..000000000000 --- a/Documentation/DocBook/v4l/vidioc-g-fmt.xml +++ /dev/null @@ -1,212 +0,0 @@ - - - ioctl VIDIOC_G_FMT, VIDIOC_S_FMT, -VIDIOC_TRY_FMT - &manvol; - - - - VIDIOC_G_FMT - VIDIOC_S_FMT - VIDIOC_TRY_FMT - Get or set the data format, try a format - - - - - - int ioctl - int fd - int request - struct v4l2_format -*argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_G_FMT, VIDIOC_S_FMT, VIDIOC_TRY_FMT - - - - argp - - - - - - - - - Description - - These ioctls are used to negotiate the format of data -(typically image format) exchanged between driver and -application. - - To query the current parameters applications set the -type field of a struct -v4l2_format to the respective buffer (stream) -type. For example video capture devices use -V4L2_BUF_TYPE_VIDEO_CAPTURE or -V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE. When the application -calls the VIDIOC_G_FMT ioctl with a pointer to -this structure the driver fills the respective member of the -fmt union. In case of video capture devices -that is either the &v4l2-pix-format; pix or -the &v4l2-pix-format-mplane; pix_mp member. -When the requested buffer type is not supported drivers return an -&EINVAL;. - - To change the current format parameters applications -initialize the type field and all -fields of the respective fmt -union member. For details see the documentation of the various devices -types in . Good practice is to query the -current parameters first, and to -modify only those parameters not suitable for the application. When -the application calls the VIDIOC_S_FMT ioctl -with a pointer to a v4l2_format structure -the driver checks -and adjusts the parameters against hardware abilities. Drivers -should not return an error code unless the input is ambiguous, this is -a mechanism to fathom device capabilities and to approach parameters -acceptable for both the application and driver. On success the driver -may program the hardware, allocate resources and generally prepare for -data exchange. -Finally the VIDIOC_S_FMT ioctl returns the -current format parameters as VIDIOC_G_FMT does. -Very simple, inflexible devices may even ignore all input and always -return the default parameters. However all V4L2 devices exchanging -data with the application must implement the -VIDIOC_G_FMT and -VIDIOC_S_FMT ioctl. When the requested buffer -type is not supported drivers return an &EINVAL; on a -VIDIOC_S_FMT attempt. When I/O is already in -progress or the resource is not available for other reasons drivers -return the &EBUSY;. - - The VIDIOC_TRY_FMT ioctl is equivalent -to VIDIOC_S_FMT with one exception: it does not -change driver state. It can also be called at any time, never -returning EBUSY. This function is provided to -negotiate parameters, to learn about hardware limitations, without -disabling I/O or possibly time consuming hardware preparations. -Although strongly recommended drivers are not required to implement -this ioctl. - - - struct <structname>v4l2_format</structname> - - - - - - - - &v4l2-buf-type; - type - - Type of the data stream, see . - - - union - fmt - - - - &v4l2-pix-format; - pix - Definition of an image format, see , used by video capture and output -devices. - - - - &v4l2-pix-format-mplane; - pix_mp - Definition of an image format, see , used by video capture and output -devices that support the multi-planar -version of the API. - - - - &v4l2-window; - win - Definition of an overlaid image, see , used by video overlay devices. - - - - &v4l2-vbi-format; - vbi - Raw VBI capture or output parameters. This is -discussed in more detail in . Used by raw VBI -capture and output devices. - - - - &v4l2-sliced-vbi-format; - sliced - Sliced VBI capture or output parameters. See - for details. Used by sliced VBI -capture and output devices. - - - - __u8 - raw_data[200] - Place holder for future extensions and custom -(driver defined) formats with type -V4L2_BUF_TYPE_PRIVATE and higher. - - - -
-
- - - &return-value; - - - - EBUSY - - The data format cannot be changed at this -time, for example because I/O is already in progress. - - - - EINVAL - - The &v4l2-format; type -field is invalid, the requested buffer type not supported, or -VIDIOC_TRY_FMT was called and is not -supported with this buffer type. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-g-frequency.xml b/Documentation/DocBook/v4l/vidioc-g-frequency.xml deleted file mode 100644 index 062d72069090..000000000000 --- a/Documentation/DocBook/v4l/vidioc-g-frequency.xml +++ /dev/null @@ -1,145 +0,0 @@ - - - ioctl VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY - &manvol; - - - - VIDIOC_G_FREQUENCY - VIDIOC_S_FREQUENCY - Get or set tuner or modulator radio -frequency - - - - - - int ioctl - int fd - int request - struct v4l2_frequency -*argp - - - - - int ioctl - int fd - int request - const struct v4l2_frequency -*argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY - - - - argp - - - - - - - - - Description - - To get the current tuner or modulator radio frequency -applications set the tuner field of a -&v4l2-frequency; to the respective tuner or modulator number (only -input devices have tuners, only output devices have modulators), zero -out the reserved array and -call the VIDIOC_G_FREQUENCY ioctl with a pointer -to this structure. The driver stores the current frequency in the -frequency field. - - To change the current tuner or modulator radio frequency -applications initialize the tuner, -type and -frequency fields, and the -reserved array of a &v4l2-frequency; and -call the VIDIOC_S_FREQUENCY ioctl with a pointer -to this structure. When the requested frequency is not possible the -driver assumes the closest possible value. However -VIDIOC_S_FREQUENCY is a write-only ioctl, it does -not return the actual new frequency. - - - struct <structname>v4l2_frequency</structname> - - &cs-str; - - - __u32 - tuner - The tuner or modulator index number. This is the -same value as in the &v4l2-input; tuner -field and the &v4l2-tuner; index field, or -the &v4l2-output; modulator field and the -&v4l2-modulator; index field. - - - &v4l2-tuner-type; - type - The tuner type. This is the same value as in the -&v4l2-tuner; type field. The field is not -applicable to modulators, &ie; ignored by drivers. - - - __u32 - frequency - Tuning frequency in units of 62.5 kHz, or if the -&v4l2-tuner; or &v4l2-modulator; capabilities flag -V4L2_TUNER_CAP_LOW is set, in units of 62.5 -Hz. - - - __u32 - reserved[8] - Reserved for future extensions. Drivers and - applications must set the array to zero. - - - -
-
- - - &return-value; - - - - EINVAL - - The tuner index is out of -bounds or the value in the type field is -wrong. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-g-input.xml b/Documentation/DocBook/v4l/vidioc-g-input.xml deleted file mode 100644 index ed076e92760d..000000000000 --- a/Documentation/DocBook/v4l/vidioc-g-input.xml +++ /dev/null @@ -1,100 +0,0 @@ - - - ioctl VIDIOC_G_INPUT, VIDIOC_S_INPUT - &manvol; - - - - VIDIOC_G_INPUT - VIDIOC_S_INPUT - Query or select the current video input - - - - - - int ioctl - int fd - int request - int *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_G_INPUT, VIDIOC_S_INPUT - - - - argp - - - - - - - - - Description - - To query the current video input applications call the -VIDIOC_G_INPUT ioctl with a pointer to an integer -where the driver stores the number of the input, as in the -&v4l2-input; index field. This ioctl will -fail only when there are no video inputs, returning -EINVAL. - - To select a video input applications store the number of the -desired input in an integer and call the -VIDIOC_S_INPUT ioctl with a pointer to this -integer. Side effects are possible. For example inputs may support -different video standards, so the driver may implicitly switch the -current standard. It is good practice to select an input before -querying or negotiating any other parameters. - - Information about video inputs is available using the -&VIDIOC-ENUMINPUT; ioctl. - - - - &return-value; - - - - EINVAL - - The number of the video input is out of bounds, or -there are no video inputs at all and this ioctl is not -supported. - - - - EBUSY - - I/O is in progress, the input cannot be -switched. - - - - - - - diff --git a/Documentation/DocBook/v4l/vidioc-g-jpegcomp.xml b/Documentation/DocBook/v4l/vidioc-g-jpegcomp.xml deleted file mode 100644 index 77394b287411..000000000000 --- a/Documentation/DocBook/v4l/vidioc-g-jpegcomp.xml +++ /dev/null @@ -1,180 +0,0 @@ - - - ioctl VIDIOC_G_JPEGCOMP, VIDIOC_S_JPEGCOMP - &manvol; - - - - VIDIOC_G_JPEGCOMP - VIDIOC_S_JPEGCOMP - - - - - - - int ioctl - int fd - int request - v4l2_jpegcompression *argp - - - - - int ioctl - int fd - int request - const v4l2_jpegcompression *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_G_JPEGCOMP, VIDIOC_S_JPEGCOMP - - - - argp - - - - - - - - - Description - - [to do] - - Ronald Bultje elaborates: - - - - APP is some application-specific information. The -application can set it itself, and it'll be stored in the JPEG-encoded -fields (eg; interlacing information for in an AVI or so). COM is the -same, but it's comments, like 'encoded by me' or so. - - jpeg_markers describes whether the huffman tables, -quantization tables and the restart interval information (all -JPEG-specific stuff) should be stored in the JPEG-encoded fields. -These define how the JPEG field is encoded. If you omit them, -applications assume you've used standard encoding. You usually do want -to add them. - - - - - struct <structname>v4l2_jpegcompression</structname> - - &cs-str; - - - int - quality - - - - int - APPn - - - - int - APP_len - - - - char - APP_data[60] - - - - int - COM_len - - - - char - COM_data[60] - - - - __u32 - jpeg_markers - See . - - - -
- - - JPEG Markers Flags - - &cs-def; - - - V4L2_JPEG_MARKER_DHT - (1<<3) - Define Huffman Tables - - - V4L2_JPEG_MARKER_DQT - (1<<4) - Define Quantization Tables - - - V4L2_JPEG_MARKER_DRI - (1<<5) - Define Restart Interval - - - V4L2_JPEG_MARKER_COM - (1<<6) - Comment segment - - - V4L2_JPEG_MARKER_APP - (1<<7) - App segment, driver will always use APP0 - - - -
-
- - - &return-value; - - - - EINVAL - - This ioctl is not supported. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-g-modulator.xml b/Documentation/DocBook/v4l/vidioc-g-modulator.xml deleted file mode 100644 index 15ce660f0f5a..000000000000 --- a/Documentation/DocBook/v4l/vidioc-g-modulator.xml +++ /dev/null @@ -1,246 +0,0 @@ - - - ioctl VIDIOC_G_MODULATOR, VIDIOC_S_MODULATOR - &manvol; - - - - VIDIOC_G_MODULATOR - VIDIOC_S_MODULATOR - Get or set modulator attributes - - - - - - int ioctl - int fd - int request - struct v4l2_modulator -*argp - - - - - int ioctl - int fd - int request - const struct v4l2_modulator -*argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_G_MODULATOR, VIDIOC_S_MODULATOR - - - - argp - - - - - - - - - Description - - To query the attributes of a modulator applications initialize -the index field and zero out the -reserved array of a &v4l2-modulator; and -call the VIDIOC_G_MODULATOR ioctl with a pointer -to this structure. Drivers fill the rest of the structure or return an -&EINVAL; when the index is out of bounds. To enumerate all modulators -applications shall begin at index zero, incrementing by one until the -driver returns EINVAL. - - Modulators have two writable properties, an audio -modulation set and the radio frequency. To change the modulated audio -subprograms, applications initialize the index - and txsubchans fields and the -reserved array and call the -VIDIOC_S_MODULATOR ioctl. Drivers may choose a -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. - - To change the radio frequency the &VIDIOC-S-FREQUENCY; ioctl -is available. - - - struct <structname>v4l2_modulator</structname> - - &cs-str; - - - __u32 - index - Identifies the modulator, set by the -application. - - - __u8 - name[32] - Name of the modulator, a NUL-terminated ASCII -string. This information is intended for the user. - - - __u32 - capability - Modulator capability flags. No flags are defined -for this field, the tuner flags in &v4l2-tuner; -are used accordingly. The audio flags indicate the ability -to encode audio subprograms. They will not -change for example with the current video standard. - - - __u32 - rangelow - The lowest tunable frequency in units of 62.5 -KHz, or if the capability flag -V4L2_TUNER_CAP_LOW is set, in units of 62.5 -Hz. - - - __u32 - rangehigh - The highest tunable frequency in units of 62.5 -KHz, or if the capability flag -V4L2_TUNER_CAP_LOW is set, in units of 62.5 -Hz. - - - __u32 - txsubchans - With this field applications can determine how -audio sub-carriers shall be modulated. It contains a set of flags as -defined in . Note the tuner -rxsubchans flags are reused, but the -semantics are different. Video output devices are assumed to have an -analog or PCM audio input with 1-3 channels. The -txsubchans flags select one or more -channels for modulation, together with some audio subprogram -indicator, for example a stereo pilot tone. - - - __u32 - reserved[4] - Reserved for future extensions. Drivers and -applications must set the array to zero. - - - -
- - - Modulator Audio Transmission Flags - - &cs-def; - - - V4L2_TUNER_SUB_MONO - 0x0001 - Modulate channel 1 as mono audio, when the input -has more channels, a down-mix of channel 1 and 2. This flag does not -combine with V4L2_TUNER_SUB_STEREO or -V4L2_TUNER_SUB_LANG1. - - - V4L2_TUNER_SUB_STEREO - 0x0002 - Modulate channel 1 and 2 as left and right -channel of a stereo audio signal. When the input has only one channel -or two channels and V4L2_TUNER_SUB_SAP is also -set, channel 1 is encoded as left and right channel. This flag does -not combine with V4L2_TUNER_SUB_MONO or -V4L2_TUNER_SUB_LANG1. When the driver does not -support stereo audio it shall fall back to mono. - - - V4L2_TUNER_SUB_LANG1 - 0x0008 - Modulate channel 1 and 2 as primary and secondary -language of a bilingual audio signal. When the input has only one -channel it is used for both languages. It is not possible to encode -the primary or secondary language only. This flag does not combine -with V4L2_TUNER_SUB_MONO, -V4L2_TUNER_SUB_STEREO or -V4L2_TUNER_SUB_SAP. If the hardware does not -support the respective audio matrix, or the current video standard -does not permit bilingual audio the -VIDIOC_S_MODULATOR ioctl shall return an &EINVAL; -and the driver shall fall back to mono or stereo mode. - - - V4L2_TUNER_SUB_LANG2 - 0x0004 - Same effect as -V4L2_TUNER_SUB_SAP. - - - V4L2_TUNER_SUB_SAP - 0x0004 - When combined with V4L2_TUNER_SUB_MONO - the first channel is encoded as mono audio, the last -channel as Second Audio Program. When the input has only one channel -it is used for both audio tracks. When the input has three channels -the mono track is a down-mix of channel 1 and 2. When combined with -V4L2_TUNER_SUB_STEREO channel 1 and 2 are -encoded as left and right stereo audio, channel 3 as Second Audio -Program. When the input has only two channels, the first is encoded as -left and right channel and the second as SAP. When the input has only -one channel it is used for all audio tracks. It is not possible to -encode a Second Audio Program only. This flag must combine with -V4L2_TUNER_SUB_MONO or -V4L2_TUNER_SUB_STEREO. If the hardware does not -support the respective audio matrix, or the current video standard -does not permit SAP the VIDIOC_S_MODULATOR ioctl -shall return an &EINVAL; and driver shall fall back to mono or stereo -mode. - - - V4L2_TUNER_SUB_RDS - 0x0010 - Enable the RDS encoder for a radio FM transmitter. - - - -
-
- - - &return-value; - - - - EINVAL - - The &v4l2-modulator; -index is out of bounds. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-g-output.xml b/Documentation/DocBook/v4l/vidioc-g-output.xml deleted file mode 100644 index 3ea8c0ed812e..000000000000 --- a/Documentation/DocBook/v4l/vidioc-g-output.xml +++ /dev/null @@ -1,100 +0,0 @@ - - - ioctl VIDIOC_G_OUTPUT, VIDIOC_S_OUTPUT - &manvol; - - - - VIDIOC_G_OUTPUT - VIDIOC_S_OUTPUT - Query or select the current video output - - - - - - int ioctl - int fd - int request - int *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_G_OUTPUT, VIDIOC_S_OUTPUT - - - - argp - - - - - - - - - Description - - To query the current video output applications call the -VIDIOC_G_OUTPUT ioctl with a pointer to an integer -where the driver stores the number of the output, as in the -&v4l2-output; index field. This ioctl -will fail only when there are no video outputs, returning the -&EINVAL;. - - To select a video output applications store the number of the -desired output in an integer and call the -VIDIOC_S_OUTPUT ioctl with a pointer to this integer. -Side effects are possible. For example outputs may support different -video standards, so the driver may implicitly switch the current -standard. It is good practice to select an output before querying or -negotiating any other parameters. - - Information about video outputs is available using the -&VIDIOC-ENUMOUTPUT; ioctl. - - - - &return-value; - - - - EINVAL - - The number of the video output is out of bounds, or -there are no video outputs at all and this ioctl is not -supported. - - - - EBUSY - - I/O is in progress, the output cannot be -switched. - - - - - - - diff --git a/Documentation/DocBook/v4l/vidioc-g-parm.xml b/Documentation/DocBook/v4l/vidioc-g-parm.xml deleted file mode 100644 index 392aa9e5571e..000000000000 --- a/Documentation/DocBook/v4l/vidioc-g-parm.xml +++ /dev/null @@ -1,332 +0,0 @@ - - - ioctl VIDIOC_G_PARM, VIDIOC_S_PARM - &manvol; - - - - VIDIOC_G_PARM - VIDIOC_S_PARM - Get or set streaming parameters - - - - - - int ioctl - int fd - int request - v4l2_streamparm *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_G_PARM, VIDIOC_S_PARM - - - - argp - - - - - - - - - Description - - The current video standard determines a nominal number of -frames per second. If less than this number of frames is to be -captured or output, applications can request frame skipping or -duplicating on the driver side. This is especially useful when using -the read() or write(), which -are not augmented by timestamps or sequence counters, and to avoid -unnecessary data copying. - - Further these ioctls can be used to determine the number of -buffers used internally by a driver in read/write mode. For -implications see the section discussing the &func-read; -function. - - To get and set the streaming parameters applications call -the VIDIOC_G_PARM and -VIDIOC_S_PARM ioctl, respectively. They take a -pointer to a struct v4l2_streamparm which -contains a union holding separate parameters for input and output -devices. - - - struct <structname>v4l2_streamparm</structname> - - &cs-ustr; - - - &v4l2-buf-type; - type - - The buffer (stream) type, same as &v4l2-format; -type, set by the application. - - - union - parm - - - - - - &v4l2-captureparm; - capture - Parameters for capture devices, used when -type is -V4L2_BUF_TYPE_VIDEO_CAPTURE. - - - - &v4l2-outputparm; - output - Parameters for output devices, used when -type is -V4L2_BUF_TYPE_VIDEO_OUTPUT. - - - - __u8 - raw_data[200] - A place holder for future extensions and custom -(driver defined) buffer types V4L2_BUF_TYPE_PRIVATE and -higher. - - - -
- - - struct <structname>v4l2_captureparm</structname> - - &cs-str; - - - __u32 - capability - See . - - - __u32 - capturemode - Set by drivers and applications, see . - - - &v4l2-fract; - timeperframe - This is is the desired period between -successive frames captured by the driver, in seconds. The -field is intended to skip frames on the driver side, saving I/O -bandwidth.Applications store here the desired frame -period, drivers return the actual frame period, which must be greater -or equal to the nominal frame period determined by the current video -standard (&v4l2-standard; frameperiod -field). Changing the video standard (also implicitly by switching the -video input) may reset this parameter to the nominal frame period. To -reset manually applications can just set this field to -zero.Drivers support this function only when they set the -V4L2_CAP_TIMEPERFRAME flag in the -capability field. - - - __u32 - extendedmode - Custom (driver specific) streaming parameters. When -unused, applications and drivers must set this field to zero. -Applications using this field should check the driver name and -version, see . - - - __u32 - readbuffers - Applications set this field to the desired number -of buffers used internally by the driver in &func-read; mode. Drivers -return the actual number of buffers. When an application requests zero -buffers, drivers should just return the current setting rather than -the minimum or an error code. For details see . - - - __u32 - reserved[4] - Reserved for future extensions. Drivers and -applications must set the array to zero. - - - -
- - - struct <structname>v4l2_outputparm</structname> - - &cs-str; - - - __u32 - capability - See . - - - __u32 - outputmode - Set by drivers and applications, see . - - - &v4l2-fract; - timeperframe - This is is the desired period between -successive frames output by the driver, in seconds. - - - The field is intended to -repeat frames on the driver side in &func-write; mode (in streaming -mode timestamps can be used to throttle the output), saving I/O -bandwidth.Applications store here the desired frame -period, drivers return the actual frame period, which must be greater -or equal to the nominal frame period determined by the current video -standard (&v4l2-standard; frameperiod -field). Changing the video standard (also implicitly by switching the -video output) may reset this parameter to the nominal frame period. To -reset manually applications can just set this field to -zero.Drivers support this function only when they set the -V4L2_CAP_TIMEPERFRAME flag in the -capability field. - - - __u32 - extendedmode - Custom (driver specific) streaming parameters. When -unused, applications and drivers must set this field to zero. -Applications using this field should check the driver name and -version, see . - - - __u32 - writebuffers - Applications set this field to the desired number -of buffers used internally by the driver in -write() mode. Drivers return the actual number of -buffers. When an application requests zero buffers, drivers should -just return the current setting rather than the minimum or an error -code. For details see . - - - __u32 - reserved[4] - Reserved for future extensions. Drivers and -applications must set the array to zero. - - - -
- - - Streaming Parameters Capabilites - - &cs-def; - - - V4L2_CAP_TIMEPERFRAME - 0x1000 - The frame skipping/repeating controlled by the -timeperframe field is supported. - - - -
- - - Capture Parameters Flags - - &cs-def; - - - V4L2_MODE_HIGHQUALITY - 0x0001 - High quality imaging mode. High quality mode -is intended for still imaging applications. The idea is to get the -best possible image quality that the hardware can deliver. It is not -defined how the driver writer may achieve that; it will depend on the -hardware and the ingenuity of the driver writer. High quality mode is -a different mode from the the regular motion video capture modes. In -high quality mode: - - The driver may be able to capture higher -resolutions than for motion capture. - - - The driver may support fewer pixel formats -than motion capture (eg; true color). - - - The driver may capture and arithmetically -combine multiple successive fields or frames to remove color edge -artifacts and reduce the noise in the video data. - - - - The driver may capture images in slices like -a scanner in order to handle larger format images than would otherwise -be possible. - - - An image capture operation may be -significantly slower than motion capture. - - - Moving objects in the image might have -excessive motion blur. - - - Capture might only work through the -read() call. - - - - - -
- -
- - - &return-value; - - - - EINVAL - - This ioctl is not supported. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-g-priority.xml b/Documentation/DocBook/v4l/vidioc-g-priority.xml deleted file mode 100644 index 5fb001978645..000000000000 --- a/Documentation/DocBook/v4l/vidioc-g-priority.xml +++ /dev/null @@ -1,144 +0,0 @@ - - - ioctl VIDIOC_G_PRIORITY, VIDIOC_S_PRIORITY - &manvol; - - - - VIDIOC_G_PRIORITY - VIDIOC_S_PRIORITY - Query or request the access priority associated with a -file descriptor - - - - - - int ioctl - int fd - int request - enum v4l2_priority *argp - - - - - int ioctl - int fd - int request - const enum v4l2_priority *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_G_PRIORITY, VIDIOC_S_PRIORITY - - - - argp - - Pointer to an enum v4l2_priority type. - - - - - - - Description - - To query the current access priority -applications call the VIDIOC_G_PRIORITY ioctl -with a pointer to an enum v4l2_priority variable where the driver stores -the current priority. - - To request an access priority applications store the -desired priority in an enum v4l2_priority variable and call -VIDIOC_S_PRIORITY ioctl with a pointer to this -variable. - - - enum v4l2_priority - - &cs-def; - - - V4L2_PRIORITY_UNSET - 0 - - - - V4L2_PRIORITY_BACKGROUND - 1 - Lowest priority, usually applications running in -background, for example monitoring VBI transmissions. A proxy -application running in user space will be necessary if multiple -applications want to read from a device at this priority. - - - V4L2_PRIORITY_INTERACTIVE - 2 - - - - V4L2_PRIORITY_DEFAULT - 2 - Medium priority, usually applications started and -interactively controlled by the user. For example TV viewers, Teletext -browsers, or just "panel" applications to change the channel or video -controls. This is the default priority unless an application requests -another. - - - V4L2_PRIORITY_RECORD - 3 - Highest priority. Only one file descriptor can have -this priority, it blocks any other fd from changing device properties. -Usually applications which must not be interrupted, like video -recording. - - - -
-
- - - &return-value; - - - - EINVAL - - The requested priority value is invalid, or the -driver does not support access priorities. - - - - EBUSY - - Another application already requested higher -priority. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-g-sliced-vbi-cap.xml b/Documentation/DocBook/v4l/vidioc-g-sliced-vbi-cap.xml deleted file mode 100644 index 10e721b17374..000000000000 --- a/Documentation/DocBook/v4l/vidioc-g-sliced-vbi-cap.xml +++ /dev/null @@ -1,264 +0,0 @@ - - - ioctl VIDIOC_G_SLICED_VBI_CAP - &manvol; - - - - VIDIOC_G_SLICED_VBI_CAP - Query sliced VBI capabilities - - - - - - int ioctl - int fd - int request - struct v4l2_sliced_vbi_cap *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_G_SLICED_VBI_CAP - - - - argp - - - - - - - - - Description - - To find out which data services are supported by a sliced -VBI capture or output device, applications initialize the -type field of a &v4l2-sliced-vbi-cap;, -clear the reserved array and -call the VIDIOC_G_SLICED_VBI_CAP ioctl. The -driver fills in the remaining fields or returns an &EINVAL; if the -sliced VBI API is unsupported or type -is invalid. - - Note the type field was added, -and the ioctl changed from read-only to write-read, in Linux 2.6.19. - - - struct <structname>v4l2_sliced_vbi_cap</structname> - - - - - - - - - - __u16 - service_set - A set of all data services -supported by the driver. Equal to the union of all elements of the -service_lines array. - - - __u16 - service_lines[2][24] - Each element of this array -contains a set of data services the hardware can look for or insert -into a particular scan line. Data services are defined in . Array indices map to ITU-R -line numbers (see also and ) as follows: - - - - - Element - 525 line systems - 625 line systems - - - - - service_lines[0][1] - 1 - 1 - - - - - service_lines[0][23] - 23 - 23 - - - - - service_lines[1][1] - 264 - 314 - - - - - service_lines[1][23] - 286 - 336 - - - - - - - - The number of VBI lines the -hardware can capture or output per frame, or the number of services it -can identify on a given line may be limited. For example on PAL line -16 the hardware may be able to look for a VPS or Teletext signal, but -not both at the same time. Applications can learn about these limits -using the &VIDIOC-S-FMT; ioctl as described in . - - - - - - - - Drivers must set -service_lines[0][0] and -service_lines[1][0] to zero. - - - &v4l2-buf-type; - type - Type of the data stream, see . Should be -V4L2_BUF_TYPE_SLICED_VBI_CAPTURE or -V4L2_BUF_TYPE_SLICED_VBI_OUTPUT. - - - __u32 - reserved[3] - This array is reserved for future -extensions. Applications and drivers must set it to zero. - - - -
- - - - Sliced VBI services - - - - - - - - - - Symbol - Value - Reference - Lines, usually - Payload - - - - - V4L2_SLICED_TELETEXT_B (Teletext -System B) - 0x0001 - , - PAL/SECAM line 7-22, 320-335 (second field 7-22) - Last 42 of the 45 byte Teletext packet, that is -without clock run-in and framing code, lsb first transmitted. - - - V4L2_SLICED_VPS - 0x0400 - - PAL line 16 - Byte number 3 to 15 according to Figure 9 of -ETS 300 231, lsb first transmitted. - - - V4L2_SLICED_CAPTION_525 - 0x1000 - - NTSC line 21, 284 (second field 21) - Two bytes in transmission order, including parity -bit, lsb first transmitted. - - - V4L2_SLICED_WSS_625 - 0x4000 - , - PAL/SECAM line 23 - -Byte 0 1 - msb lsb msb lsb -Bit 7 6 5 4 3 2 1 0 x x 13 12 11 10 9 - - - - V4L2_SLICED_VBI_525 - 0x1000 - Set of services applicable to 525 -line systems. - - - V4L2_SLICED_VBI_625 - 0x4401 - Set of services applicable to 625 -line systems. - - - -
- -
- - - &return-value; - - - - EINVAL - - The device does not support sliced VBI capturing or -output, or the value in the type field is -wrong. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-g-std.xml b/Documentation/DocBook/v4l/vidioc-g-std.xml deleted file mode 100644 index 912f8513e5da..000000000000 --- a/Documentation/DocBook/v4l/vidioc-g-std.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - ioctl VIDIOC_G_STD, VIDIOC_S_STD - &manvol; - - - - VIDIOC_G_STD - VIDIOC_S_STD - Query or select the video standard of the current input - - - - - - int ioctl - int fd - int request - v4l2_std_id -*argp - - - - - int ioctl - int fd - int request - const v4l2_std_id -*argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_G_STD, VIDIOC_S_STD - - - - argp - - - - - - - - - Description - - To query and select the current video standard applications -use the VIDIOC_G_STD and VIDIOC_S_STD ioctls which take a pointer to a -&v4l2-std-id; type as argument. VIDIOC_G_STD can -return a single flag or a set of flags as in &v4l2-standard; field -id. The flags must be unambiguous such -that they appear in only one enumerated v4l2_standard structure. - - VIDIOC_S_STD accepts one or more -flags, being a write-only ioctl it does not return the actual new standard as -VIDIOC_G_STD does. When no flags are given or -the current input does not support the requested standard the driver -returns an &EINVAL;. When the standard set is ambiguous drivers may -return EINVAL or choose any of the requested -standards. - - - - &return-value; - - - - EINVAL - - This ioctl is not supported, or the -VIDIOC_S_STD parameter was unsuitable. - - - - EBUSY - - The device is busy and therefore can not change the standard - - - - - - - diff --git a/Documentation/DocBook/v4l/vidioc-g-tuner.xml b/Documentation/DocBook/v4l/vidioc-g-tuner.xml deleted file mode 100644 index bd98c734c06b..000000000000 --- a/Documentation/DocBook/v4l/vidioc-g-tuner.xml +++ /dev/null @@ -1,535 +0,0 @@ - - - ioctl VIDIOC_G_TUNER, VIDIOC_S_TUNER - &manvol; - - - - VIDIOC_G_TUNER - VIDIOC_S_TUNER - Get or set tuner attributes - - - - - - int ioctl - int fd - int request - struct v4l2_tuner -*argp - - - - - int ioctl - int fd - int request - const struct v4l2_tuner -*argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_G_TUNER, VIDIOC_S_TUNER - - - - argp - - - - - - - - - Description - - To query the attributes of a tuner applications initialize the -index field and zero out the -reserved array of a &v4l2-tuner; and call the -VIDIOC_G_TUNER ioctl with a pointer to this -structure. Drivers fill the rest of the structure or return an -&EINVAL; when the index is out of bounds. To enumerate all tuners -applications shall begin at index zero, incrementing by one until the -driver returns EINVAL. - - Tuners have two writable properties, the audio mode and -the radio frequency. To change the audio mode, applications initialize -the index, -audmode and -reserved fields and call the -VIDIOC_S_TUNER ioctl. This will -not change the current tuner, which is determined -by the current video input. Drivers may choose a different audio mode -if the requested mode is invalid or unsupported. Since this is a -write-only ioctl, it does not return the actually -selected audio mode. - - To change the radio frequency the &VIDIOC-S-FREQUENCY; ioctl -is available. - - - struct <structname>v4l2_tuner</structname> - - - - - - - - - __u32 - index - Identifies the tuner, set by the -application. - - - __u8 - name[32] - Name of the tuner, a -NUL-terminated ASCII string. This information is intended for the -user. - - - &v4l2-tuner-type; - type - Type of the tuner, see . - - - __u32 - capability - Tuner capability flags, see -. Audio flags indicate the ability -to decode audio subprograms. They will not -change, for example with the current video standard.When -the structure refers to a radio tuner only the -V4L2_TUNER_CAP_LOW, -V4L2_TUNER_CAP_STEREO and -V4L2_TUNER_CAP_RDS flags can be set. - - - __u32 - rangelow - The lowest tunable frequency in -units of 62.5 kHz, or if the capability -flag V4L2_TUNER_CAP_LOW is set, in units of 62.5 -Hz. - - - __u32 - rangehigh - The highest tunable frequency in -units of 62.5 kHz, or if the capability -flag V4L2_TUNER_CAP_LOW is set, in units of 62.5 -Hz. - - - __u32 - rxsubchans - Some tuners or audio -decoders can determine the received audio subprograms by analyzing -audio carriers, pilot tones or other indicators. To pass this -information drivers set flags defined in in this field. For -example: - - - - - V4L2_TUNER_SUB_MONO - receiving mono audio - - - - - STEREO | SAP - receiving stereo audio and a secondary audio -program - - - - - MONO | STEREO - receiving mono or stereo audio, the hardware cannot -distinguish - - - - - LANG1 | LANG2 - receiving bilingual audio - - - - - MONO | STEREO | LANG1 | LANG2 - receiving mono, stereo or bilingual -audio - - - - - When the -V4L2_TUNER_CAP_STEREO, -_LANG1, _LANG2 or -_SAP flag is cleared in the -capability field, the corresponding -V4L2_TUNER_SUB_ flag must not be set -here.This field is valid only if this is the tuner of the -current video input, or when the structure refers to a radio -tuner. - - - __u32 - audmode - The selected audio mode, see - for valid values. The audio mode does -not affect audio subprogram detection, and like a control it does not automatically change -unless the requested mode is invalid or unsupported. See for possible results when -the selected and received audio programs do not -match.Currently this is the only field of struct -v4l2_tuner applications can -change. - - - __u32 - signal - The signal strength if known, ranging -from 0 to 65535. Higher values indicate a better signal. - - - __s32 - afc - Automatic frequency control: When the -afc value is negative, the frequency is too -low, when positive too high. - - - __u32 - reserved[4] - Reserved for future extensions. Drivers and -applications must set the array to zero. - - - -
- - - enum v4l2_tuner_type - - &cs-def; - - - V4L2_TUNER_RADIO - 1 - - - - V4L2_TUNER_ANALOG_TV - 2 - - - - -
- - - Tuner and Modulator Capability Flags - - &cs-def; - - - V4L2_TUNER_CAP_LOW - 0x0001 - When set, tuning frequencies are expressed in units of -62.5 Hz, otherwise in units of 62.5 kHz. - - - V4L2_TUNER_CAP_NORM - 0x0002 - This is a multi-standard tuner; the video standard -can or must be switched. (B/G PAL tuners for example are typically not - considered multi-standard because the video standard is automatically - determined from the frequency band.) The set of supported video - standards is available from the &v4l2-input; pointing to this tuner, - see the description of ioctl &VIDIOC-ENUMINPUT; for details. Only - V4L2_TUNER_ANALOG_TV tuners can have this capability. - - - V4L2_TUNER_CAP_STEREO - 0x0010 - Stereo audio reception is supported. - - - V4L2_TUNER_CAP_LANG1 - 0x0040 - Reception of the primary language of a bilingual -audio program is supported. Bilingual audio is a feature of -two-channel systems, transmitting the primary language monaural on the -main audio carrier and a secondary language monaural on a second -carrier. Only - V4L2_TUNER_ANALOG_TV tuners can have this capability. - - - V4L2_TUNER_CAP_LANG2 - 0x0020 - Reception of the secondary language of a bilingual -audio program is supported. Only - V4L2_TUNER_ANALOG_TV tuners can have this capability. - - - V4L2_TUNER_CAP_SAP - 0x0020 - Reception of a secondary audio program is -supported. This is a feature of the BTSC system which accompanies the -NTSC video standard. Two audio carriers are available for mono or -stereo transmissions of a primary language, and an independent third -carrier for a monaural secondary language. Only - V4L2_TUNER_ANALOG_TV tuners can have this capability.Note the -V4L2_TUNER_CAP_LANG2 and -V4L2_TUNER_CAP_SAP flags are synonyms. -V4L2_TUNER_CAP_SAP applies when the tuner -supports the V4L2_STD_NTSC_M video -standard. - - - V4L2_TUNER_CAP_RDS - 0x0080 - RDS capture is supported. This capability is only valid for -radio tuners. - - - -
- - - Tuner Audio Reception Flags - - &cs-def; - - - V4L2_TUNER_SUB_MONO - 0x0001 - The tuner receives a mono audio signal. - - - V4L2_TUNER_SUB_STEREO - 0x0002 - The tuner receives a stereo audio signal. - - - V4L2_TUNER_SUB_LANG1 - 0x0008 - The tuner receives the primary language of a -bilingual audio signal. Drivers must clear this flag when the current -video standard is V4L2_STD_NTSC_M. - - - V4L2_TUNER_SUB_LANG2 - 0x0004 - The tuner receives the secondary language of a -bilingual audio signal (or a second audio program). - - - V4L2_TUNER_SUB_SAP - 0x0004 - The tuner receives a Second Audio Program. Note the -V4L2_TUNER_SUB_LANG2 and -V4L2_TUNER_SUB_SAP flags are synonyms. The -V4L2_TUNER_SUB_SAP flag applies when the -current video standard is V4L2_STD_NTSC_M. - - - V4L2_TUNER_SUB_RDS - 0x0010 - The tuner receives an RDS channel. - - - -
- - - Tuner Audio Modes - - &cs-def; - - - V4L2_TUNER_MODE_MONO - 0 - Play mono audio. When the tuner receives a stereo -signal this a down-mix of the left and right channel. When the tuner -receives a bilingual or SAP signal this mode selects the primary -language. - - - V4L2_TUNER_MODE_STEREO - 1 - Play stereo audio. When the tuner receives -bilingual audio it may play different languages on the left and right -channel or the primary language is played on both channels.Playing -different languages in this mode is -deprecated. New drivers should do this only in -MODE_LANG1_LANG2.When the tuner -receives no stereo signal or does not support stereo reception the -driver shall fall back to MODE_MONO. - - - V4L2_TUNER_MODE_LANG1 - 3 - Play the primary language, mono or stereo. Only -V4L2_TUNER_ANALOG_TV tuners support this -mode. - - - V4L2_TUNER_MODE_LANG2 - 2 - Play the secondary language, mono. When the tuner -receives no bilingual audio or SAP, or their reception is not -supported the driver shall fall back to mono or stereo mode. Only -V4L2_TUNER_ANALOG_TV tuners support this -mode. - - - V4L2_TUNER_MODE_SAP - 2 - Play the Second Audio Program. When the tuner -receives no bilingual audio or SAP, or their reception is not -supported the driver shall fall back to mono or stereo mode. Only -V4L2_TUNER_ANALOG_TV tuners support this mode. -Note the V4L2_TUNER_MODE_LANG2 and -V4L2_TUNER_MODE_SAP are synonyms. - - - V4L2_TUNER_MODE_LANG1_LANG2 - 4 - Play the primary language on the left channel, the -secondary language on the right channel. When the tuner receives no -bilingual audio or SAP, it shall fall back to -MODE_LANG1 or MODE_MONO. -Only V4L2_TUNER_ANALOG_TV tuners support this -mode. - - - -
- - - Tuner Audio Matrix - - - - - - - - - - - Selected -V4L2_TUNER_MODE_ - - - Received V4L2_TUNER_SUB_ - MONO - STEREO - LANG1 - LANG2 = SAP - LANG1_LANG2This -mode has been added in Linux 2.6.17 and may not be supported by older -drivers. - - - - - MONO - Mono - Mono/Mono - Mono - Mono - Mono/Mono - - - MONO | SAP - Mono - Mono/Mono - Mono - SAP - Mono/SAP (preferred) or Mono/Mono - - - STEREO - L+R - L/R - Stereo L/R (preferred) or Mono L+R - Stereo L/R (preferred) or Mono L+R - L/R (preferred) or L+R/L+R - - - STEREO | SAP - L+R - L/R - Stereo L/R (preferred) or Mono L+R - SAP - L+R/SAP (preferred) or L/R or L+R/L+R - - - LANG1 | LANG2 - Language 1 - Lang1/Lang2 (deprecatedPlayback of -both languages in MODE_STEREO is deprecated. In -the future drivers should produce only the primary language in this -mode. Applications should request -MODE_LANG1_LANG2 to record both languages or a -stereo signal.) or -Lang1/Lang1 - Language 1 - Language 2 - Lang1/Lang2 (preferred) or Lang1/Lang1 - - - -
-
- - - &return-value; - - - - EINVAL - - The &v4l2-tuner; index is -out of bounds. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-log-status.xml b/Documentation/DocBook/v4l/vidioc-log-status.xml deleted file mode 100644 index 2634b7c88b58..000000000000 --- a/Documentation/DocBook/v4l/vidioc-log-status.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - ioctl VIDIOC_LOG_STATUS - &manvol; - - - - VIDIOC_LOG_STATUS - Log driver status information - - - - - - int ioctl - int fd - int request - - - - - - Description - - As the video/audio devices become more complicated it -becomes harder to debug problems. When this ioctl is called the driver -will output the current device status to the kernel log. This is -particular useful when dealing with problems like no sound, no video -and incorrectly tuned channels. Also many modern devices autodetect -video and audio standards and this ioctl will report what the device -thinks what the standard is. Mismatches may give an indication where -the problem is. - - This ioctl is optional and not all drivers support it. It -was introduced in Linux 2.6.15. - - - - &return-value; - - - - EINVAL - - The driver does not support this ioctl. - - - - - - - diff --git a/Documentation/DocBook/v4l/vidioc-overlay.xml b/Documentation/DocBook/v4l/vidioc-overlay.xml deleted file mode 100644 index 1036c582cc15..000000000000 --- a/Documentation/DocBook/v4l/vidioc-overlay.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - ioctl VIDIOC_OVERLAY - &manvol; - - - - VIDIOC_OVERLAY - Start or stop video overlay - - - - - - int ioctl - int fd - int request - const int *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_OVERLAY - - - - argp - - - - - - - - - Description - - This ioctl is part of the video - overlay I/O method. Applications call - VIDIOC_OVERLAY to start or stop the - overlay. It takes a pointer to an integer which must be set to - zero by the application to stop overlay, to one to start. - - Drivers do not support &VIDIOC-STREAMON; or -&VIDIOC-STREAMOFF; with V4L2_BUF_TYPE_VIDEO_OVERLAY. - - - - &return-value; - - - - EINVAL - - Video overlay is not supported, or the -parameters have not been set up. See for the necessary steps. - - - - - - - diff --git a/Documentation/DocBook/v4l/vidioc-qbuf.xml b/Documentation/DocBook/v4l/vidioc-qbuf.xml deleted file mode 100644 index f2b11f8a4031..000000000000 --- a/Documentation/DocBook/v4l/vidioc-qbuf.xml +++ /dev/null @@ -1,194 +0,0 @@ - - - ioctl VIDIOC_QBUF, VIDIOC_DQBUF - &manvol; - - - - VIDIOC_QBUF - VIDIOC_DQBUF - Exchange a buffer with the driver - - - - - - int ioctl - int fd - int request - struct v4l2_buffer *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_QBUF, VIDIOC_DQBUF - - - - argp - - - - - - - - - Description - - Applications call the VIDIOC_QBUF ioctl -to enqueue an empty (capturing) or filled (output) buffer in the -driver's incoming queue. The semantics depend on the selected I/O -method. - - To enqueue a buffer applications set the type -field of a &v4l2-buffer; to the same buffer type as was previously used -with &v4l2-format; type and &v4l2-requestbuffers; -type. Applications must also set the -index field. Valid index numbers range from -zero to the number of buffers allocated with &VIDIOC-REQBUFS; -(&v4l2-requestbuffers; count) minus one. The -contents of the struct v4l2_buffer returned -by a &VIDIOC-QUERYBUF; ioctl will do as well. When the buffer is -intended for output (type is -V4L2_BUF_TYPE_VIDEO_OUTPUT, -V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, or -V4L2_BUF_TYPE_VBI_OUTPUT) applications must also -initialize the bytesused, -field and -timestamp fields, see for details. -Applications must also set flags to 0. If a driver -supports capturing from specific video inputs and you want to specify a video -input, then flags should be set to -V4L2_BUF_FLAG_INPUT and the field -input must be initialized to the desired input. -The reserved field must be set to 0. When using -the multi-planar API, the -m.planes field must contain a userspace pointer -to a filled-in array of &v4l2-plane; and the length -field must be set to the number of elements in that array. - - - To enqueue a memory mapped -buffer applications set the memory -field to V4L2_MEMORY_MMAP. When -VIDIOC_QBUF is called with a pointer to this -structure the driver sets the -V4L2_BUF_FLAG_MAPPED and -V4L2_BUF_FLAG_QUEUED flags and clears the -V4L2_BUF_FLAG_DONE flag in the -flags field, or it returns an -&EINVAL;. - - To enqueue a user pointer -buffer applications set the memory -field to V4L2_MEMORY_USERPTR, the -m.userptr field to the address of the -buffer and length to its size. When the multi-planar -API is used, m.userptr and -length members of the passed array of &v4l2-plane; -have to be used instead. When VIDIOC_QBUF is called with -a pointer to this structure the driver sets the -V4L2_BUF_FLAG_QUEUED flag and clears the -V4L2_BUF_FLAG_MAPPED and -V4L2_BUF_FLAG_DONE flags in the -flags field, or it returns an error code. -This ioctl locks the memory pages of the buffer in physical memory, -they cannot be swapped out to disk. Buffers remain locked until -dequeued, until the &VIDIOC-STREAMOFF; or &VIDIOC-REQBUFS; ioctl is -called, or until the device is closed. - - Applications call the VIDIOC_DQBUF -ioctl to dequeue a filled (capturing) or displayed (output) buffer -from the driver's outgoing queue. They just set the -type, memory -and reserved -fields of a &v4l2-buffer; as above, when VIDIOC_DQBUF -is called with a pointer to this structure the driver fills the -remaining fields or returns an error code. The driver may also set -V4L2_BUF_FLAG_ERROR in the flags -field. It indicates a non-critical (recoverable) streaming error. In such case -the application may continue as normal, but should be aware that data in the -dequeued buffer might be corrupted. When using the multi-planar API, the -planes array does not have to be passed; the m.planes -member must be set to NULL in that case. - - By default VIDIOC_DQBUF blocks when no -buffer is in the outgoing queue. When the -O_NONBLOCK flag was given to the &func-open; -function, VIDIOC_DQBUF returns immediately -with an &EAGAIN; when no buffer is available. - - The v4l2_buffer structure is -specified in . - - - - &return-value; - - - - EAGAIN - - Non-blocking I/O has been selected using -O_NONBLOCK and no buffer was in the outgoing -queue. - - - - EINVAL - - The buffer type is not -supported, or the index is out of bounds, -or no buffers have been allocated yet, or the -userptr or -length are invalid. - - - - ENOMEM - - Not enough physical or virtual memory was available to -enqueue a user pointer buffer. - - - - EIO - - VIDIOC_DQBUF failed due to an -internal error. Can also indicate temporary problems like signal -loss. Note the driver might dequeue an (empty) buffer despite -returning an error, or even stop capturing. Reusing such buffer may be unsafe -though and its details (e.g. index) may not be -returned either. It is recommended that drivers indicate recoverable errors -by setting the V4L2_BUF_FLAG_ERROR and returning 0 instead. -In that case the application should be able to safely reuse the buffer and -continue streaming. - - - - - - - - diff --git a/Documentation/DocBook/v4l/vidioc-query-dv-preset.xml b/Documentation/DocBook/v4l/vidioc-query-dv-preset.xml deleted file mode 100644 index d272f7ab91b8..000000000000 --- a/Documentation/DocBook/v4l/vidioc-query-dv-preset.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - ioctl VIDIOC_QUERY_DV_PRESET - &manvol; - - - - VIDIOC_QUERY_DV_PRESET - Sense the DV preset received by the current -input - - - - - - int ioctl - int fd - int request - struct v4l2_dv_preset *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_QUERY_DV_PRESET - - - - argp - - - - - - - - - Description - - The hardware may be able to detect the current DV preset -automatically, similar to sensing the video standard. To do so, applications -call VIDIOC_QUERY_DV_PRESET with a pointer to a -&v4l2-dv-preset; type. Once the hardware detects a preset, that preset is -returned in the preset field of &v4l2-dv-preset;. If the preset could not be -detected because there was no signal, or the signal was unreliable, or the -signal did not map to a supported preset, then the value V4L2_DV_INVALID is -returned. - - - - &return-value; - - - EINVAL - - This ioctl is not supported. - - - - EBUSY - - The device is busy and therefore can not sense the preset - - - - - - - diff --git a/Documentation/DocBook/v4l/vidioc-querybuf.xml b/Documentation/DocBook/v4l/vidioc-querybuf.xml deleted file mode 100644 index 5c104d42d31c..000000000000 --- a/Documentation/DocBook/v4l/vidioc-querybuf.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - ioctl VIDIOC_QUERYBUF - &manvol; - - - - VIDIOC_QUERYBUF - Query the status of a buffer - - - - - - int ioctl - int fd - int request - struct v4l2_buffer *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_QUERYBUF - - - - argp - - - - - - - - - Description - - This ioctl is part of the memory -mapping I/O method. It can be used to query the status of a -buffer at any time after buffers have been allocated with the -&VIDIOC-REQBUFS; ioctl. - - Applications set the type field - of a &v4l2-buffer; to the same buffer type as was previously used with -&v4l2-format; type and &v4l2-requestbuffers; -type, and the index - field. Valid index numbers range from zero -to the number of buffers allocated with &VIDIOC-REQBUFS; - (&v4l2-requestbuffers; count) minus one. -The reserved field should to set to 0. -When using the multi-planar API, the -m.planes field must contain a userspace pointer to an -array of &v4l2-plane; and the length field has -to be set to the number of elements in that array. -After calling VIDIOC_QUERYBUF with a pointer to - this structure drivers return an error code or fill the rest of -the structure. - - In the flags field the -V4L2_BUF_FLAG_MAPPED, -V4L2_BUF_FLAG_QUEUED and -V4L2_BUF_FLAG_DONE flags will be valid. The -memory field will be set to the current -I/O method. For the single-planar API, the m.offset -contains the offset of the buffer from the start of the device memory, -the length field its size. For the multi-planar API, -fields m.mem_offset and -length in the m.planes -array elements will be used instead. The driver may or may not set the remaining -fields and flags, they are meaningless in this context. - - The v4l2_buffer structure is - specified in . - - - - &return-value; - - - - EINVAL - - The buffer type is not -supported, or the index is out of bounds. - - - - - - - diff --git a/Documentation/DocBook/v4l/vidioc-querycap.xml b/Documentation/DocBook/v4l/vidioc-querycap.xml deleted file mode 100644 index f29f1b86213c..000000000000 --- a/Documentation/DocBook/v4l/vidioc-querycap.xml +++ /dev/null @@ -1,303 +0,0 @@ - - - ioctl VIDIOC_QUERYCAP - &manvol; - - - - VIDIOC_QUERYCAP - Query device capabilities - - - - - - int ioctl - int fd - int request - struct v4l2_capability *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_QUERYCAP - - - - argp - - - - - - - - - Description - - All V4L2 devices support the -VIDIOC_QUERYCAP ioctl. It is used to identify -kernel devices compatible with this specification and to obtain -information about driver and hardware capabilities. The ioctl takes a -pointer to a &v4l2-capability; which is filled by the driver. When the -driver is not compatible with this specification the ioctl returns an -&EINVAL;. - - - struct <structname>v4l2_capability</structname> - - &cs-str; - - - __u8 - driver[16] - Name of the driver, a unique NUL-terminated -ASCII string. For example: "bttv". Driver specific applications can -use this information to verify the driver identity. It is also useful -to work around known bugs, or to identify drivers in error reports. -The driver version is stored in the version -field.Storing strings in fixed sized arrays is bad -practice but unavoidable here. Drivers and applications should take -precautions to never read or write beyond the end of the array and to -make sure the strings are properly NUL-terminated. - - - __u8 - card[32] - Name of the device, a NUL-terminated ASCII string. -For example: "Yoyodyne TV/FM". One driver may support different brands -or models of video hardware. This information is intended for users, -for example in a menu of available devices. Since multiple TV cards of -the same brand may be installed which are supported by the same -driver, this name should be combined with the character device file -name (⪚ /dev/video2) or the -bus_info string to avoid -ambiguities. - - - __u8 - bus_info[32] - Location of the device in the system, a -NUL-terminated ASCII string. For example: "PCI Slot 4". This -information is intended for users, to distinguish multiple -identical devices. If no such information is available the field may -simply count the devices controlled by the driver, or contain the -empty string (bus_info[0] = 0). - - - __u32 - version - Version number of the driver. Together with -the driver field this identifies a -particular driver. The version number is formatted using the -KERNEL_VERSION() macro: - - - - -#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) - -__u32 version = KERNEL_VERSION(0, 8, 1); - -printf ("Version: %u.%u.%u\n", - (version >> 16) & 0xFF, - (version >> 8) & 0xFF, - version & 0xFF); - - - - __u32 - capabilities - Device capabilities, see . - - - __u32 - reserved[4] - Reserved for future extensions. Drivers must set -this array to zero. - - - -
- - - Device Capabilities Flags - - &cs-def; - - - V4L2_CAP_VIDEO_CAPTURE - 0x00000001 - The device supports the single-planar API through the Video Capture interface. - - - V4L2_CAP_VIDEO_CAPTURE_MPLANE - 0x00001000 - The device supports the - multi-planar API through the - Video Capture interface. - - - V4L2_CAP_VIDEO_OUTPUT - 0x00000002 - The device supports the single-planar API through the Video Output interface. - - - V4L2_CAP_VIDEO_OUTPUT_MPLANE - 0x00002000 - The device supports the - multi-planar API through the - Video Output interface. - - - V4L2_CAP_VIDEO_OVERLAY - 0x00000004 - The device supports the Video Overlay interface. A video overlay device -typically stores captured images directly in the video memory of a -graphics card, with hardware clipping and scaling. - - - V4L2_CAP_VBI_CAPTURE - 0x00000010 - The device supports the Raw -VBI Capture interface, providing Teletext and Closed Caption -data. - - - V4L2_CAP_VBI_OUTPUT - 0x00000020 - The device supports the Raw VBI Output interface. - - - V4L2_CAP_SLICED_VBI_CAPTURE - 0x00000040 - The device supports the Sliced VBI Capture interface. - - - V4L2_CAP_SLICED_VBI_OUTPUT - 0x00000080 - The device supports the Sliced VBI Output interface. - - - V4L2_CAP_RDS_CAPTURE - 0x00000100 - The device supports the RDS capture interface. - - - V4L2_CAP_VIDEO_OUTPUT_OVERLAY - 0x00000200 - The device supports the Video -Output Overlay (OSD) interface. Unlike the Video -Overlay interface, this is a secondary function of video -output devices and overlays an image onto an outgoing video signal. -When the driver sets this flag, it must clear the -V4L2_CAP_VIDEO_OVERLAY flag and vice -versa.The &v4l2-framebuffer; lacks an -&v4l2-buf-type; field, therefore the type of overlay is implied by the -driver capabilities. - - - V4L2_CAP_HW_FREQ_SEEK - 0x00000400 - The device supports the &VIDIOC-S-HW-FREQ-SEEK; ioctl for -hardware frequency seeking. - - - V4L2_CAP_RDS_OUTPUT - 0x00000800 - The device supports the RDS output interface. - - - V4L2_CAP_TUNER - 0x00010000 - The device has some sort of tuner to -receive RF-modulated video signals. For more information about -tuner programming see -. - - - V4L2_CAP_AUDIO - 0x00020000 - The device has audio inputs or outputs. It may or -may not support audio recording or playback, in PCM or compressed -formats. PCM audio support must be implemented as ALSA or OSS -interface. For more information on audio inputs and outputs see . - - - V4L2_CAP_RADIO - 0x00040000 - This is a radio receiver. - - - V4L2_CAP_MODULATOR - 0x00080000 - The device has some sort of modulator to -emit RF-modulated video/audio signals. For more information about -modulator programming see -. - - - V4L2_CAP_READWRITE - 0x01000000 - The device supports the read() and/or write() -I/O methods. - - - V4L2_CAP_ASYNCIO - 0x02000000 - The device supports the asynchronous I/O methods. - - - V4L2_CAP_STREAMING - 0x04000000 - The device supports the streaming I/O method. - - - -
-
- - - &return-value; - - - - EINVAL - - The device is not compatible with this -specification. - - - - -
- - - diff --git a/Documentation/DocBook/v4l/vidioc-queryctrl.xml b/Documentation/DocBook/v4l/vidioc-queryctrl.xml deleted file mode 100644 index 0d5e8283cf32..000000000000 --- a/Documentation/DocBook/v4l/vidioc-queryctrl.xml +++ /dev/null @@ -1,434 +0,0 @@ - - - ioctl VIDIOC_QUERYCTRL, VIDIOC_QUERYMENU - &manvol; - - - - VIDIOC_QUERYCTRL - VIDIOC_QUERYMENU - Enumerate controls and menu control items - - - - - - int ioctl - int fd - int request - struct v4l2_queryctrl *argp - - - - - int ioctl - int fd - int request - struct v4l2_querymenu *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_QUERYCTRL, VIDIOC_QUERYMENU - - - - argp - - - - - - - - - Description - - To query the attributes of a control applications set the -id field of a &v4l2-queryctrl; and call the -VIDIOC_QUERYCTRL ioctl with a pointer to this -structure. The driver fills the rest of the structure or returns an -&EINVAL; when the id is invalid. - - It is possible to enumerate controls by calling -VIDIOC_QUERYCTRL with successive -id values starting from -V4L2_CID_BASE up to and exclusive -V4L2_CID_BASE_LASTP1. Drivers may return -EINVAL if a control in this range is not -supported. Further applications can enumerate private controls, which -are not defined in this specification, by starting at -V4L2_CID_PRIVATE_BASE and incrementing -id until the driver returns -EINVAL. - - In both cases, when the driver sets the -V4L2_CTRL_FLAG_DISABLED flag in the -flags field this control is permanently -disabled and should be ignored by the application. - V4L2_CTRL_FLAG_DISABLED was -intended for two purposes: Drivers can skip predefined controls not -supported by the hardware (although returning EINVAL would do as -well), or disable predefined and private controls after hardware -detection without the trouble of reordering control arrays and indices -(EINVAL cannot be used to skip private controls because it would -prematurely end the enumeration). - - When the application ORs id with -V4L2_CTRL_FLAG_NEXT_CTRL the driver returns the -next supported control, or EINVAL if there is -none. Drivers which do not support this flag yet always return -EINVAL. - - Additional information is required for menu controls: the -names of the menu items. To query them applications set the -id and index -fields of &v4l2-querymenu; and call the -VIDIOC_QUERYMENU ioctl with a pointer to this -structure. The driver fills the rest of the structure or returns an -&EINVAL; when the id or -index is invalid. Menu items are enumerated -by calling VIDIOC_QUERYMENU with successive -index values from &v4l2-queryctrl; -minimum to -maximum, inclusive. Note that it is possible -for VIDIOC_QUERYMENU to return an &EINVAL; for some -indices between minimum and maximum. -In that case that particular menu item is not supported by this driver. Also note that -the minimum value is not necessarily 0. - - See also the examples in . - - - struct <structname>v4l2_queryctrl</structname> - - &cs-str; - - - __u32 - id - Identifies the control, set by the application. See - for predefined IDs. When the ID is ORed -with V4L2_CTRL_FLAG_NEXT_CTRL the driver clears the flag and returns -the first control with a higher ID. Drivers which do not support this -flag yet always return an &EINVAL;. - - - &v4l2-ctrl-type; - type - Type of control, see . - - - __u8 - name[32] - Name of the control, a NUL-terminated ASCII -string. This information is intended for the user. - - - __s32 - minimum - Minimum value, inclusive. This field gives a lower -bound for V4L2_CTRL_TYPE_INTEGER controls and the -lowest valid index for V4L2_CTRL_TYPE_MENU controls. -For V4L2_CTRL_TYPE_STRING controls the minimum value -gives the minimum length of the string. This length does not include the terminating -zero. It may not be valid for any other type of control, including -V4L2_CTRL_TYPE_INTEGER64 controls. Note that this is a -signed value. - - - __s32 - maximum - Maximum value, inclusive. This field gives an upper -bound for V4L2_CTRL_TYPE_INTEGER controls and the -highest valid index for V4L2_CTRL_TYPE_MENU -controls. -For V4L2_CTRL_TYPE_STRING controls the maximum value -gives the maximum length of the string. This length does not include the terminating -zero. It may not be valid for any other type of control, including -V4L2_CTRL_TYPE_INTEGER64 controls. Note that this is a -signed value. - - - __s32 - step - This field gives a step size for -V4L2_CTRL_TYPE_INTEGER controls. For -V4L2_CTRL_TYPE_STRING controls this field refers to -the string length that has to be a multiple of this step size. -It may not be valid for any other type of control, including -V4L2_CTRL_TYPE_INTEGER64 -controls.Generally drivers should not scale hardware -control values. It may be necessary for example when the -name or id imply -a particular unit and the hardware actually accepts only multiples of -said unit. If so, drivers must take care values are properly rounded -when scaling, such that errors will not accumulate on repeated -read-write cycles.This field gives the smallest change of -an integer control actually affecting hardware. Often the information -is needed when the user can change controls by keyboard or GUI -buttons, rather than a slider. When for example a hardware register -accepts values 0-511 and the driver reports 0-65535, step should be -128.Note that although signed, the step value is supposed to -be always positive. - - - __s32 - default_value - The default value of a -V4L2_CTRL_TYPE_INTEGER, -_BOOLEAN or _MENU control. -Not valid for other types of controls. Drivers reset controls only -when the driver is loaded, not later, in particular not when the -func-open; is called. - - - __u32 - flags - Control flags, see . - - - __u32 - reserved[2] - Reserved for future extensions. Drivers must set -the array to zero. - - - -
- - - struct <structname>v4l2_querymenu</structname> - - &cs-str; - - - __u32 - id - Identifies the control, set by the application -from the respective &v4l2-queryctrl; -id. - - - __u32 - index - Index of the menu item, starting at zero, set by - the application. - - - __u8 - name[32] - Name of the menu item, a NUL-terminated ASCII -string. This information is intended for the user. - - - __u32 - reserved - Reserved for future extensions. Drivers must set -the array to zero. - - - -
- - - enum v4l2_ctrl_type - - - - - - - - - Type - minimum - step - maximum - Description - - - - - V4L2_CTRL_TYPE_INTEGER - any - any - any - 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. - - - V4L2_CTRL_TYPE_BOOLEAN - 0 - 1 - 1 - A boolean-valued control. Zero corresponds to -"disabled", and one means "enabled". - - - V4L2_CTRL_TYPE_MENU - ≥ 0 - 1 - N-1 - The control has a menu of N choices. The names of -the menu items can be enumerated with the -VIDIOC_QUERYMENU ioctl. - - - V4L2_CTRL_TYPE_BUTTON - 0 - 0 - 0 - A control which performs an action when set. -Drivers must ignore the value passed with -VIDIOC_S_CTRL and return an &EINVAL; on a -VIDIOC_G_CTRL attempt. - - - V4L2_CTRL_TYPE_INTEGER64 - n/a - n/a - n/a - A 64-bit integer valued control. Minimum, maximum -and step size cannot be queried. - - - V4L2_CTRL_TYPE_STRING - ≥ 0 - ≥ 1 - ≥ 0 - The minimum and maximum string lengths. The step size -means that the string must be (minimum + N * step) characters long for -N ≥ 0. These lengths do not include the terminating zero, so in order to -pass a string of length 8 to &VIDIOC-S-EXT-CTRLS; you need to set the -size field of &v4l2-ext-control; to 9. For &VIDIOC-G-EXT-CTRLS; you can -set the size field to maximum + 1. -Which character encoding is used will depend on the string control itself and -should be part of the control documentation. - - - V4L2_CTRL_TYPE_CTRL_CLASS - n/a - n/a - n/a - This is not a control. When -VIDIOC_QUERYCTRL is called with a control ID -equal to a control class code (see ) + 1, the -ioctl returns the name of the control class and this control type. -Older drivers which do not support this feature return an -&EINVAL;. - - - -
- - - Control Flags - - &cs-def; - - - V4L2_CTRL_FLAG_DISABLED - 0x0001 - This control is permanently disabled and should be -ignored by the application. Any attempt to change the control will -result in an &EINVAL;. - - - V4L2_CTRL_FLAG_GRABBED - 0x0002 - This control is temporarily unchangeable, for -example because another application took over control of the -respective resource. Such controls may be displayed specially in a -user interface. Attempts to change the control may result in an -&EBUSY;. - - - V4L2_CTRL_FLAG_READ_ONLY - 0x0004 - This control is permanently readable only. Any -attempt to change the control will result in an &EINVAL;. - - - V4L2_CTRL_FLAG_UPDATE - 0x0008 - A hint that changing this control may affect the -value of other controls within the same control class. Applications -should update their user interface accordingly. - - - V4L2_CTRL_FLAG_INACTIVE - 0x0010 - This control is not applicable to the current -configuration and should be displayed accordingly in a user interface. -For example the flag may be set on a MPEG audio level 2 bitrate -control when MPEG audio encoding level 1 was selected with another -control. - - - V4L2_CTRL_FLAG_SLIDER - 0x0020 - A hint that this control is best represented as a -slider-like element in a user interface. - - - V4L2_CTRL_FLAG_WRITE_ONLY - 0x0040 - This control is permanently writable only. Any -attempt to read the control will result in an &EACCES; error code. This -flag is typically present for relative controls or action controls where -writing a value will cause the device to carry out a given action -(⪚ motor control) but no meaningful value can be returned. - - - -
-
- - - &return-value; - - - - EINVAL - - The &v4l2-queryctrl; id -is invalid. The &v4l2-querymenu; id is -invalid or index is out of range (less than -minimum or greater than maximum) -or this particular menu item is not supported by the driver. - - - - EACCES - - An attempt was made to read a write-only control. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-querystd.xml b/Documentation/DocBook/v4l/vidioc-querystd.xml deleted file mode 100644 index 1a9e60393091..000000000000 --- a/Documentation/DocBook/v4l/vidioc-querystd.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - ioctl VIDIOC_QUERYSTD - &manvol; - - - - VIDIOC_QUERYSTD - Sense the video standard received by the current -input - - - - - - int ioctl - int fd - int request - v4l2_std_id *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_QUERYSTD - - - - argp - - - - - - - - - Description - - The hardware may be able to detect the current video -standard automatically. To do so, applications call -VIDIOC_QUERYSTD with a pointer to a &v4l2-std-id; type. The -driver stores here a set of candidates, this can be a single flag or a -set of supported standards if for example the hardware can only -distinguish between 50 and 60 Hz systems. When detection is not -possible or fails, the set must contain all standards supported by the -current video input or output. - - - - - &return-value; - - - - EINVAL - - This ioctl is not supported. - - - - EBUSY - - The device is busy and therefore can not detect the standard - - - - - - - diff --git a/Documentation/DocBook/v4l/vidioc-reqbufs.xml b/Documentation/DocBook/v4l/vidioc-reqbufs.xml deleted file mode 100644 index 69800ae23348..000000000000 --- a/Documentation/DocBook/v4l/vidioc-reqbufs.xml +++ /dev/null @@ -1,150 +0,0 @@ - - - ioctl VIDIOC_REQBUFS - &manvol; - - - - VIDIOC_REQBUFS - Initiate Memory Mapping or User Pointer I/O - - - - - - int ioctl - int fd - int request - struct v4l2_requestbuffers *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_REQBUFS - - - - argp - - - - - - - - - Description - - This ioctl is used to initiate memory -mapped or user pointer -I/O. Memory mapped buffers are located in device memory and must be -allocated with this ioctl before they can be mapped into the -application's address space. User buffers are allocated by -applications themselves, and this ioctl is merely used to switch the -driver into user pointer I/O mode and to setup some internal structures. - - To allocate device buffers applications initialize all -fields of the v4l2_requestbuffers structure. -They set the type field to the respective -stream or buffer type, the count field to -the desired number of buffers, memory -must be set to the requested I/O method and the reserved array -must be zeroed. When the ioctl -is called with a pointer to this structure the driver will attempt to allocate -the requested number of buffers and it stores the actual number -allocated in the count field. It can be -smaller than the number requested, even zero, when the driver runs out -of free memory. A larger number is also possible when the driver requires -more buffers to function correctly. For example video output requires at least two buffers, -one displayed and one filled by the application. - When the I/O method is not supported the ioctl -returns an &EINVAL;. - - Applications can call VIDIOC_REQBUFS -again to change the number of buffers, however this cannot succeed -when any buffers are still mapped. A count -value of zero frees all buffers, after aborting or finishing any DMA -in progress, an implicit &VIDIOC-STREAMOFF;. - - - struct <structname>v4l2_requestbuffers</structname> - - &cs-str; - - - __u32 - count - The number of buffers requested or granted. - - - &v4l2-buf-type; - type - Type of the stream or buffers, this is the same -as the &v4l2-format; type field. See for valid values. - - - &v4l2-memory; - memory - Applications set this field to -V4L2_MEMORY_MMAP or -V4L2_MEMORY_USERPTR. - - - __u32 - reserved[2] - A place holder for future extensions and custom -(driver defined) buffer types V4L2_BUF_TYPE_PRIVATE and -higher. This array should be zeroed by applications. - - - -
-
- - - &return-value; - - - - EBUSY - - The driver supports multiple opens and I/O is already -in progress, or reallocation of buffers was attempted although one or -more are still mapped. - - - - EINVAL - - The buffer type (type field) or the -requested I/O method (memory) is not -supported. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-s-hw-freq-seek.xml b/Documentation/DocBook/v4l/vidioc-s-hw-freq-seek.xml deleted file mode 100644 index c30dcc4232c0..000000000000 --- a/Documentation/DocBook/v4l/vidioc-s-hw-freq-seek.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - ioctl VIDIOC_S_HW_FREQ_SEEK - &manvol; - - - - VIDIOC_S_HW_FREQ_SEEK - Perform a hardware frequency seek - - - - - - int ioctl - int fd - int request - struct v4l2_hw_freq_seek -*argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_S_HW_FREQ_SEEK - - - - argp - - - - - - - - - Description - - Start a hardware frequency seek from the current frequency. -To do this applications initialize the tuner, -type, seek_upward, -spacing and -wrap_around fields, and zero out the -reserved array of a &v4l2-hw-freq-seek; and -call the VIDIOC_S_HW_FREQ_SEEK ioctl with a pointer -to this structure. - - This ioctl is supported if the V4L2_CAP_HW_FREQ_SEEK capability is set. - - - struct <structname>v4l2_hw_freq_seek</structname> - - &cs-str; - - - __u32 - tuner - The tuner index number. This is the -same value as in the &v4l2-input; tuner -field and the &v4l2-tuner; index field. - - - &v4l2-tuner-type; - type - The tuner type. This is the same value as in the -&v4l2-tuner; type field. - - - __u32 - seek_upward - If non-zero, seek upward from the current frequency, else seek downward. - - - __u32 - wrap_around - If non-zero, wrap around when at the end of the frequency range, else stop seeking. - - - __u32 - spacing - If non-zero, defines the hardware seek resolution in Hz. The driver selects the nearest value that is supported by the device. If spacing is zero a reasonable default value is used. - - - __u32 - reserved[7] - Reserved for future extensions. Drivers and - applications must set the array to zero. - - - -
-
- - - &return-value; - - - - EINVAL - - The tuner index is out of -bounds or the value in the type field is -wrong. - - - - EAGAIN - - The ioctl timed-out. Try again. - - - - -
- - diff --git a/Documentation/DocBook/v4l/vidioc-streamon.xml b/Documentation/DocBook/v4l/vidioc-streamon.xml deleted file mode 100644 index 75ed39bf4d2b..000000000000 --- a/Documentation/DocBook/v4l/vidioc-streamon.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - ioctl VIDIOC_STREAMON, VIDIOC_STREAMOFF - &manvol; - - - - VIDIOC_STREAMON - VIDIOC_STREAMOFF - Start or stop streaming I/O - - - - - - int ioctl - int fd - int request - const int *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_STREAMON, VIDIOC_STREAMOFF - - - - argp - - - - - - - - - Description - - The VIDIOC_STREAMON and -VIDIOC_STREAMOFF ioctl start and stop the capture -or output process during streaming (memory -mapping or user pointer) I/O. - - Specifically the capture hardware is disabled and no input -buffers are filled (if there are any empty buffers in the incoming -queue) until VIDIOC_STREAMON has been called. -Accordingly the output hardware is disabled, no video signal is -produced until VIDIOC_STREAMON has been called. -The ioctl will succeed only when at least one output buffer is in the -incoming queue. - - The VIDIOC_STREAMOFF ioctl, apart of -aborting or finishing any DMA in progress, unlocks any user pointer -buffers locked in physical memory, and it removes all buffers from the -incoming and outgoing queues. That means all images captured but not -dequeued yet will be lost, likewise all images enqueued for output but -not transmitted yet. I/O returns to the same state as after calling -&VIDIOC-REQBUFS; and can be restarted accordingly. - - Both ioctls take a pointer to an integer, the desired buffer or -stream type. This is the same as &v4l2-requestbuffers; -type. - - Note applications can be preempted for unknown periods right -before or after the VIDIOC_STREAMON or -VIDIOC_STREAMOFF calls, there is no notion of -starting or stopping "now". Buffer timestamps can be used to -synchronize with other events. - - - - &return-value; - - - - EINVAL - - Streaming I/O is not supported, the buffer -type is not supported, or no buffers have -been allocated (memory mapping) or enqueued (output) yet. - - - - EPIPE - - The driver implements pad-level format configuration and - the pipeline configuration is invalid. - - - - - - - - diff --git a/Documentation/DocBook/v4l/vidioc-subdev-enum-frame-interval.xml b/Documentation/DocBook/v4l/vidioc-subdev-enum-frame-interval.xml deleted file mode 100644 index 2f8f4f0a0235..000000000000 --- a/Documentation/DocBook/v4l/vidioc-subdev-enum-frame-interval.xml +++ /dev/null @@ -1,152 +0,0 @@ - - - ioctl VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL - &manvol; - - - - VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL - Enumerate frame intervals - - - - - - int ioctl - int fd - int request - struct v4l2_subdev_frame_interval_enum * - argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL - - - - argp - - - - - - - - - Description - - - Experimental - This is an experimental - interface and may change in the future. - - - This ioctl lets applications enumerate available frame intervals on a - given sub-device pad. Frame intervals only makes sense for sub-devices that - can control the frame period on their own. This includes, for instance, - image sensors and TV tuners. - - For the common use case of image sensors, the frame intervals - available on the sub-device output pad depend on the frame format and size - on the same pad. Applications must thus specify the desired format and size - when enumerating frame intervals. - - To enumerate frame intervals applications initialize the - index, pad, - code, width and - height fields of - &v4l2-subdev-frame-interval-enum; and call the - VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL ioctl with a pointer - to this structure. Drivers fill the rest of the structure or return - an &EINVAL; if one of the input fields is invalid. All frame intervals are - enumerable by beginning at index zero and incrementing by one until - EINVAL is returned. - - Available frame intervals may depend on the current 'try' formats - at other pads of the sub-device, as well as on the current active links. See - &VIDIOC-SUBDEV-G-FMT; for more information about the try formats. - - Sub-devices that support the frame interval enumeration ioctl should - implemented it on a single pad only. Its behaviour when supported on - multiple pads of the same sub-device is not defined. - - - struct <structname>v4l2_subdev_frame_interval_enum</structname> - - &cs-str; - - - __u32 - index - Number of the format in the enumeration, set by the - application. - - - __u32 - pad - Pad number as reported by the media controller API. - - - __u32 - code - The media bus format code, as defined in - . - - - __u32 - width - Frame width, in pixels. - - - __u32 - height - Frame height, in pixels. - - - &v4l2-fract; - interval - Period, in seconds, between consecutive video frames. - - - __u32 - reserved[9] - Reserved for future extensions. Applications and drivers must - set the array to zero. - - - -
-
- - - &return-value; - - - - EINVAL - - The &v4l2-subdev-frame-interval-enum; - pad references a non-existing pad, one of - the code, width - or height fields are invalid for the given - pad or the index field is out of bounds. - - - - - -
diff --git a/Documentation/DocBook/v4l/vidioc-subdev-enum-frame-size.xml b/Documentation/DocBook/v4l/vidioc-subdev-enum-frame-size.xml deleted file mode 100644 index 79ce42b7c60c..000000000000 --- a/Documentation/DocBook/v4l/vidioc-subdev-enum-frame-size.xml +++ /dev/null @@ -1,154 +0,0 @@ - - - ioctl VIDIOC_SUBDEV_ENUM_FRAME_SIZE - &manvol; - - - - VIDIOC_SUBDEV_ENUM_FRAME_SIZE - Enumerate media bus frame sizes - - - - - - int ioctl - int fd - int request - struct v4l2_subdev_frame_size_enum * - argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_SUBDEV_ENUM_FRAME_SIZE - - - - argp - - - - - - - - - Description - - - Experimental - This is an experimental - interface and may change in the future. - - - This ioctl allows applications to enumerate all frame sizes - supported by a sub-device on the given pad for the given media bus format. - Supported formats can be retrieved with the &VIDIOC-SUBDEV-ENUM-MBUS-CODE; - ioctl. - - To enumerate frame sizes applications initialize the - pad, code and - index fields of the - &v4l2-subdev-mbus-code-enum; and call the - VIDIOC_SUBDEV_ENUM_FRAME_SIZE ioctl with a pointer to - the structure. Drivers fill the minimum and maximum frame sizes or return - an &EINVAL; if one of the input parameters is invalid. - - Sub-devices that only support discrete frame sizes (such as most - sensors) will return one or more frame sizes with identical minimum and - maximum values. - - Not all possible sizes in given [minimum, maximum] ranges need to be - supported. For instance, a scaler that uses a fixed-point scaling ratio - might not be able to produce every frame size between the minimum and - maximum values. Applications must use the &VIDIOC-SUBDEV-S-FMT; ioctl to - try the sub-device for an exact supported frame size. - - Available frame sizes may depend on the current 'try' formats at other - pads of the sub-device, as well as on the current active links and the - current values of V4L2 controls. See &VIDIOC-SUBDEV-G-FMT; for more - information about try formats. - - - struct <structname>v4l2_subdev_frame_size_enum</structname> - - &cs-str; - - - __u32 - index - Number of the format in the enumeration, set by the - application. - - - __u32 - pad - Pad number as reported by the media controller API. - - - __u32 - code - The media bus format code, as defined in - . - - - __u32 - min_width - Minimum frame width, in pixels. - - - __u32 - max_width - Maximum frame width, in pixels. - - - __u32 - min_height - Minimum frame height, in pixels. - - - __u32 - max_height - Maximum frame height, in pixels. - - - __u32 - reserved[9] - Reserved for future extensions. Applications and drivers must - set the array to zero. - - - -
-
- - - &return-value; - - - - EINVAL - - The &v4l2-subdev-frame-size-enum; pad - references a non-existing pad, the code is - invalid for the given pad or the index - field is out of bounds. - - - - -
diff --git a/Documentation/DocBook/v4l/vidioc-subdev-enum-mbus-code.xml b/Documentation/DocBook/v4l/vidioc-subdev-enum-mbus-code.xml deleted file mode 100644 index a6b3432449f6..000000000000 --- a/Documentation/DocBook/v4l/vidioc-subdev-enum-mbus-code.xml +++ /dev/null @@ -1,119 +0,0 @@ - - - ioctl VIDIOC_SUBDEV_ENUM_MBUS_CODE - &manvol; - - - - VIDIOC_SUBDEV_ENUM_MBUS_CODE - Enumerate media bus formats - - - - - - int ioctl - int fd - int request - struct v4l2_subdev_mbus_code_enum * - argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_SUBDEV_ENUM_MBUS_CODE - - - - argp - - - - - - - - - Description - - - Experimental - This is an experimental - interface and may change in the future. - - - To enumerate media bus formats available at a given sub-device pad - applications initialize the pad and - index fields of &v4l2-subdev-mbus-code-enum; and - call the VIDIOC_SUBDEV_ENUM_MBUS_CODE ioctl with a - pointer to this structure. Drivers fill the rest of the structure or return - an &EINVAL; if either the pad or - index are invalid. All media bus formats are - enumerable by beginning at index zero and incrementing by one until - EINVAL is returned. - - Available media bus formats may depend on the current 'try' formats - at other pads of the sub-device, as well as on the current active links. See - &VIDIOC-SUBDEV-G-FMT; for more information about the try formats. - - - struct <structname>v4l2_subdev_mbus_code_enum</structname> - - &cs-str; - - - __u32 - pad - Pad number as reported by the media controller API. - - - __u32 - index - Number of the format in the enumeration, set by the - application. - - - __u32 - code - The media bus format code, as defined in - . - - - __u32 - reserved[9] - Reserved for future extensions. Applications and drivers must - set the array to zero. - - - -
-
- - - &return-value; - - - - EINVAL - - The &v4l2-subdev-mbus-code-enum; pad - references a non-existing pad, or the index - field is out of bounds. - - - - -
diff --git a/Documentation/DocBook/v4l/vidioc-subdev-g-crop.xml b/Documentation/DocBook/v4l/vidioc-subdev-g-crop.xml deleted file mode 100644 index 06197323a8cc..000000000000 --- a/Documentation/DocBook/v4l/vidioc-subdev-g-crop.xml +++ /dev/null @@ -1,155 +0,0 @@ - - - ioctl VIDIOC_SUBDEV_G_CROP, VIDIOC_SUBDEV_S_CROP - &manvol; - - - - VIDIOC_SUBDEV_G_CROP - VIDIOC_SUBDEV_S_CROP - Get or set the crop rectangle on a subdev pad - - - - - - int ioctl - int fd - int request - struct v4l2_subdev_crop *argp - - - - - int ioctl - int fd - int request - const struct v4l2_subdev_crop *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_SUBDEV_G_CROP, VIDIOC_SUBDEV_S_CROP - - - - argp - - - - - - - - - Description - - - Experimental - This is an experimental - interface and may change in the future. - - - To retrieve the current crop rectangle applications set the - pad field of a &v4l2-subdev-crop; to the - desired pad number as reported by the media API and the - which field to - V4L2_SUBDEV_FORMAT_ACTIVE. They then call the - VIDIOC_SUBDEV_G_CROP ioctl with a pointer to this - structure. The driver fills the members of the rect - field or returns &EINVAL; if the input arguments are invalid, or if cropping - is not supported on the given pad. - - To change the current crop rectangle applications set both the - pad and which fields - and all members of the rect field. They then call - the VIDIOC_SUBDEV_S_CROP ioctl with a pointer to this - structure. The driver verifies the requested crop rectangle, adjusts it - based on the hardware capabilities and configures the device. Upon return - the &v4l2-subdev-crop; contains the current format as would be returned - by a VIDIOC_SUBDEV_G_CROP call. - - Applications can query the device capabilities by setting the - which to - V4L2_SUBDEV_FORMAT_TRY. When set, 'try' crop - rectangles are not applied to the device by the driver, but are mangled - exactly as active crop rectangles and stored in the sub-device file handle. - Two applications querying the same sub-device would thus not interact with - each other. - - Drivers must not return an error solely because the requested crop - rectangle doesn't match the device capabilities. They must instead modify - the rectangle to match what the hardware can provide. The modified format - should be as close as possible to the original request. - - - struct <structname>v4l2_subdev_crop</structname> - - &cs-str; - - - __u32 - pad - Pad number as reported by the media framework. - - - __u32 - which - Crop rectangle to get or set, from - &v4l2-subdev-format-whence;. - - - &v4l2-rect; - rect - Crop rectangle boundaries, in pixels. - - - __u32 - reserved[8] - Reserved for future extensions. Applications and drivers must - set the array to zero. - - - -
-
- - - &return-value; - - - - EBUSY - - The crop rectangle can't be changed because the pad is currently - busy. This can be caused, for instance, by an active video stream on - the pad. The ioctl must not be retried without performing another - action to fix the problem first. Only returned by - VIDIOC_SUBDEV_S_CROP - - - - EINVAL - - The &v4l2-subdev-crop; pad - references a non-existing pad, the which - field references a non-existing format, or cropping is not supported - on the given subdev pad. - - - - -
diff --git a/Documentation/DocBook/v4l/vidioc-subdev-g-fmt.xml b/Documentation/DocBook/v4l/vidioc-subdev-g-fmt.xml deleted file mode 100644 index f367c570c530..000000000000 --- a/Documentation/DocBook/v4l/vidioc-subdev-g-fmt.xml +++ /dev/null @@ -1,180 +0,0 @@ - - - ioctl VIDIOC_SUBDEV_G_FMT, VIDIOC_SUBDEV_S_FMT - &manvol; - - - - VIDIOC_SUBDEV_G_FMT - VIDIOC_SUBDEV_S_FMT - Get or set the data format on a subdev pad - - - - - - int ioctl - int fd - int request - struct v4l2_subdev_format *argp - - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_SUBDEV_G_FMT, VIDIOC_SUBDEV_S_FMT - - - - argp - - - - - - - - - Description - - - Experimental - This is an experimental - interface and may change in the future. - - - These ioctls are used to negotiate the frame format at specific - subdev pads in the image pipeline. - - To retrieve the current format applications set the - pad field of a &v4l2-subdev-format; to the - desired pad number as reported by the media API and the - which field to - V4L2_SUBDEV_FORMAT_ACTIVE. When they call the - VIDIOC_SUBDEV_G_FMT ioctl with a pointer to this - structure the driver fills the members of the format - field. - - To change the current format applications set both the - pad and which fields - and all members of the format field. When they - call the VIDIOC_SUBDEV_S_FMT ioctl with a pointer to this - structure the driver verifies the requested format, adjusts it based on the - hardware capabilities and configures the device. Upon return the - &v4l2-subdev-format; contains the current format as would be returned by a - VIDIOC_SUBDEV_G_FMT call. - - Applications can query the device capabilities by setting the - which to - V4L2_SUBDEV_FORMAT_TRY. When set, 'try' formats are not - applied to the device by the driver, but are changed exactly as active - formats and stored in the sub-device file handle. Two applications querying - the same sub-device would thus not interact with each other. - - For instance, to try a format at the output pad of a sub-device, - applications would first set the try format at the sub-device input with the - VIDIOC_SUBDEV_S_FMT ioctl. They would then either - retrieve the default format at the output pad with the - VIDIOC_SUBDEV_G_FMT ioctl, or set the desired output - pad format with the VIDIOC_SUBDEV_S_FMT ioctl and check - the returned value. - - Try formats do not depend on active formats, but can depend on the - current links configuration or sub-device controls value. For instance, a - low-pass noise filter might crop pixels at the frame boundaries, modifying - its output frame size. - - Drivers must not return an error solely because the requested format - doesn't match the device capabilities. They must instead modify the format - to match what the hardware can provide. The modified format should be as - close as possible to the original request. - - - struct <structname>v4l2_subdev_format</structname> - - &cs-str; - - - __u32 - pad - Pad number as reported by the media controller API. - - - __u32 - which - Format to modified, from &v4l2-subdev-format-whence;. - - - &v4l2-mbus-framefmt; - format - Definition of an image format, see for details. - - - __u32 - reserved[8] - Reserved for future extensions. Applications and drivers must - set the array to zero. - - - -
- - - enum <structname>v4l2_subdev_format_whence</structname> - - &cs-def; - - - V4L2_SUBDEV_FORMAT_TRY - 0 - Try formats, used for querying device capabilities. - - - V4L2_SUBDEV_FORMAT_ACTIVE - 1 - Active formats, applied to the hardware. - - - -
-
- - - &return-value; - - - - EBUSY - - The format can't be changed because the pad is currently busy. - This can be caused, for instance, by an active video stream on the - pad. The ioctl must not be retried without performing another action - to fix the problem first. Only returned by - VIDIOC_SUBDEV_S_FMT - - - - EINVAL - - The &v4l2-subdev-format; pad - references a non-existing pad, or the which - field references a non-existing format. - - - - -
diff --git a/Documentation/DocBook/v4l/vidioc-subdev-g-frame-interval.xml b/Documentation/DocBook/v4l/vidioc-subdev-g-frame-interval.xml deleted file mode 100644 index 0bc3ea22d31f..000000000000 --- a/Documentation/DocBook/v4l/vidioc-subdev-g-frame-interval.xml +++ /dev/null @@ -1,141 +0,0 @@ - - - ioctl VIDIOC_SUBDEV_G_FRAME_INTERVAL, VIDIOC_SUBDEV_S_FRAME_INTERVAL - &manvol; - - - - VIDIOC_SUBDEV_G_FRAME_INTERVAL - VIDIOC_SUBDEV_S_FRAME_INTERVAL - Get or set the frame interval on a subdev pad - - - - - - int ioctl - int fd - int request - struct v4l2_subdev_frame_interval *argp - - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_SUBDEV_G_FRAME_INTERVAL, VIDIOC_SUBDEV_S_FRAME_INTERVAL - - - - argp - - - - - - - - - Description - - - Experimental - This is an experimental - interface and may change in the future. - - - These ioctls are used to get and set the frame interval at specific - subdev pads in the image pipeline. The frame interval only makes sense for - sub-devices that can control the frame period on their own. This includes, - for instance, image sensors and TV tuners. Sub-devices that don't support - frame intervals must not implement these ioctls. - - To retrieve the current frame interval applications set the - pad field of a &v4l2-subdev-frame-interval; to - the desired pad number as reported by the media controller API. When they - call the VIDIOC_SUBDEV_G_FRAME_INTERVAL ioctl with a - pointer to this structure the driver fills the members of the - interval field. - - To change the current frame interval applications set both the - pad field and all members of the - interval field. When they call the - VIDIOC_SUBDEV_S_FRAME_INTERVAL ioctl with a pointer to - this structure the driver verifies the requested interval, adjusts it based - on the hardware capabilities and configures the device. Upon return the - &v4l2-subdev-frame-interval; contains the current frame interval as would be - returned by a VIDIOC_SUBDEV_G_FRAME_INTERVAL call. - - - Drivers must not return an error solely because the requested interval - doesn't match the device capabilities. They must instead modify the interval - to match what the hardware can provide. The modified interval should be as - close as possible to the original request. - - Sub-devices that support the frame interval ioctls should implement - them on a single pad only. Their behaviour when supported on multiple pads - of the same sub-device is not defined. - - - struct <structname>v4l2_subdev_frame_interval</structname> - - &cs-str; - - - __u32 - pad - Pad number as reported by the media controller API. - - - &v4l2-fract; - interval - Period, in seconds, between consecutive video frames. - - - __u32 - reserved[9] - Reserved for future extensions. Applications and drivers must - set the array to zero. - - - -
-
- - - &return-value; - - - - EBUSY - - The frame interval can't be changed because the pad is currently - busy. This can be caused, for instance, by an active video stream on - the pad. The ioctl must not be retried without performing another - action to fix the problem first. Only returned by - VIDIOC_SUBDEV_S_FRAME_INTERVAL - - - - EINVAL - - The &v4l2-subdev-frame-interval; pad - references a non-existing pad, or the pad doesn't support frame - intervals. - - - - -
diff --git a/Documentation/DocBook/v4l/vidioc-subscribe-event.xml b/Documentation/DocBook/v4l/vidioc-subscribe-event.xml deleted file mode 100644 index 8b501791aa68..000000000000 --- a/Documentation/DocBook/v4l/vidioc-subscribe-event.xml +++ /dev/null @@ -1,133 +0,0 @@ - - - ioctl VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT - &manvol; - - - - VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT - Subscribe or unsubscribe event - - - - - - int ioctl - int fd - int request - struct v4l2_event_subscription -*argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT - - - - argp - - - - - - - - - Description - - Subscribe or unsubscribe V4L2 event. Subscribed events are - dequeued by using the &VIDIOC-DQEVENT; ioctl. - - - struct <structname>v4l2_event_subscription</structname> - - &cs-str; - - - __u32 - type - Type of the event. - - - __u32 - reserved[7] - Reserved for future extensions. Drivers and applications - must set the array to zero. - - - -
- - - Event Types - - &cs-def; - - - V4L2_EVENT_ALL - 0 - All events. V4L2_EVENT_ALL is valid only for - VIDIOC_UNSUBSCRIBE_EVENT for unsubscribing all events at once. - - - - V4L2_EVENT_VSYNC - 1 - This event is triggered on the vertical sync. - This event has &v4l2-event-vsync; associated with it. - - - - V4L2_EVENT_EOS - 2 - This event is triggered when the end of a stream is reached. - This is typically used with MPEG decoders to report to the application - when the last of the MPEG stream has been decoded. - - - - V4L2_EVENT_PRIVATE_START - 0x08000000 - Base event number for driver-private events. - - - -
- - - struct <structname>v4l2_event_vsync</structname> - - &cs-str; - - - __u8 - field - The upcoming field. See &v4l2-field;. - - - -
- -
-
- -- cgit v1.2.3 From 798ae1501d7a27faf017cc0d78543417c19d7af3 Mon Sep 17 00:00:00 2001 From: Jean-François Moine Date: Mon, 23 May 2011 05:38:10 -0300 Subject: [media] gspca - ov519: New sensor ov9600 with bridge ovfx2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This sensor was found in a webcam 8020:ef04 (SVC - SVU2-1.3MV PCCam). Signed-off-by: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/ov519.c | 109 +++++++++++++++++++++++++++++++++----- 1 file changed, 96 insertions(+), 13 deletions(-) diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c index 057e287b9152..cb42a5182d17 100644 --- a/drivers/media/video/gspca/ov519.c +++ b/drivers/media/video/gspca/ov519.c @@ -134,6 +134,7 @@ enum sensors { SEN_OV7670, SEN_OV76BE, SEN_OV8610, + SEN_OV9600, }; /* Note this is a bit of a hack, but the w9968cf driver needs the code for all @@ -340,6 +341,10 @@ static const unsigned ctrl_dis[] = { (1 << EXPOSURE) | (1 << AUTOGAIN) | (1 << FREQ), +[SEN_OV9600] = ((1 << NCTRL) - 1) /* no control */ + ^ ((1 << EXPOSURE) /* but exposure */ + | (1 << AUTOGAIN)), /* and autogain */ + }; static const struct v4l2_pix_format ov519_vga_mode[] = { @@ -525,6 +530,17 @@ static const struct v4l2_pix_format ovfx2_ov3610_mode[] = { .colorspace = V4L2_COLORSPACE_SRGB, .priv = 0}, }; +static const struct v4l2_pix_format ovfx2_ov9600_mode[] = { + {640, 480, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE, + .bytesperline = 640, + .sizeimage = 640 * 480, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 1}, + {1280, 1024, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE, + .bytesperline = 1280, + .sizeimage = 1280 * 1024, + .colorspace = V4L2_COLORSPACE_SRGB}, +}; /* Registers common to OV511 / OV518 */ #define R51x_FIFO_PSIZE 0x30 /* 2 bytes wide w/ OV518(+) */ @@ -1807,6 +1823,22 @@ static const struct ov_i2c_regvals norm_7660[] = { | OV7670_COM8_AEC}, {0xa1, 0xc8} }; +static const struct ov_i2c_regvals norm_9600[] = { + {0x12, 0x80}, + {0x0c, 0x28}, + {0x11, 0x80}, + {0x13, 0xb5}, + {0x14, 0x3e}, + {0x1b, 0x04}, + {0x24, 0xb0}, + {0x25, 0x90}, + {0x26, 0x94}, + {0x35, 0x90}, + {0x37, 0x07}, + {0x38, 0x08}, + {0x01, 0x8e}, + {0x02, 0x85} +}; /* 7670. Defaults taken from OmniVision provided data, * as provided by Jonathan Corbet of OLPC */ @@ -2686,7 +2718,7 @@ static void write_i2c_regvals(struct sd *sd, * ***************************************************************************/ -/* This initializes the OV2x10 / OV3610 / OV3620 */ +/* This initializes the OV2x10 / OV3610 / OV3620 / OV9600 */ static void ov_hires_configure(struct sd *sd) { int high, low; @@ -2702,19 +2734,32 @@ static void ov_hires_configure(struct sd *sd) high = i2c_r(sd, 0x0a); low = i2c_r(sd, 0x0b); /* info("%x, %x", high, low); */ - if (high == 0x96 && low == 0x40) { - PDEBUG(D_PROBE, "Sensor is an OV2610"); - sd->sensor = SEN_OV2610; - } else if (high == 0x96 && low == 0x41) { - PDEBUG(D_PROBE, "Sensor is an OV2610AE"); - sd->sensor = SEN_OV2610AE; - } else if (high == 0x36 && (low & 0x0f) == 0x00) { - PDEBUG(D_PROBE, "Sensor is an OV3610"); - sd->sensor = SEN_OV3610; - } else { - err("Error unknown sensor type: %02x%02x", - high, low); + switch (high) { + case 0x96: + switch (low) { + case 0x40: + PDEBUG(D_PROBE, "Sensor is a OV2610"); + sd->sensor = SEN_OV2610; + return; + case 0x41: + PDEBUG(D_PROBE, "Sensor is a OV2610AE"); + sd->sensor = SEN_OV2610AE; + return; + case 0xb1: + PDEBUG(D_PROBE, "Sensor is a OV9600"); + sd->sensor = SEN_OV9600; + return; + } + break; + case 0x36: + if ((low & 0x0f) == 0x00) { + PDEBUG(D_PROBE, "Sensor is a OV3610"); + sd->sensor = SEN_OV3610; + return; + } + break; } + err("Error unknown sensor type: %02x%02x", high, low); } /* This initializes the OV8110, OV8610 sensor. The OV8110 uses @@ -3400,6 +3445,10 @@ static int sd_init(struct gspca_dev *gspca_dev) cam->cam_mode = ovfx2_ov3610_mode; cam->nmodes = ARRAY_SIZE(ovfx2_ov3610_mode); break; + case SEN_OV9600: + cam->cam_mode = ovfx2_ov9600_mode; + cam->nmodes = ARRAY_SIZE(ovfx2_ov9600_mode); + break; default: if (sd->sif) { cam->cam_mode = ov519_sif_mode; @@ -3497,6 +3546,12 @@ static int sd_init(struct gspca_dev *gspca_dev) case SEN_OV8610: write_i2c_regvals(sd, norm_8610, ARRAY_SIZE(norm_8610)); break; + case SEN_OV9600: + write_i2c_regvals(sd, norm_9600, ARRAY_SIZE(norm_9600)); + + /* enable autoexpo */ +/* i2c_w_mask(sd, 0x13, 0x05, 0x05); */ + break; } return gspca_dev->usb_err; error: @@ -4085,6 +4140,33 @@ static void mode_init_ov_sensor_regs(struct sd *sd) i2c_w_mask(sd, 0x14, qvga ? 0x20 : 0x00, 0x20); i2c_w_mask(sd, 0x12, 0x04, 0x06); /* AWB: 1 Test pattern: 0 */ break; + case SEN_OV9600: { + const struct ov_i2c_regvals *vals; + static const struct ov_i2c_regvals sxga_15[] = { + {0x11, 0x80}, {0x14, 0x3e}, {0x24, 0x85}, {0x25, 0x75} + }; + static const struct ov_i2c_regvals sxga_7_5[] = { + {0x11, 0x81}, {0x14, 0x3e}, {0x24, 0x85}, {0x25, 0x75} + }; + static const struct ov_i2c_regvals vga_30[] = { + {0x11, 0x81}, {0x14, 0x7e}, {0x24, 0x70}, {0x25, 0x60} + }; + static const struct ov_i2c_regvals vga_15[] = { + {0x11, 0x83}, {0x14, 0x3e}, {0x24, 0x80}, {0x25, 0x70} + }; + + /* frame rates: + * 15fps / 7.5 fps for 1280x1024 + * 30fps / 15fps for 640x480 + */ + i2c_w_mask(sd, 0x12, qvga ? 0x40 : 0x00, 0x40); + if (qvga) + vals = sd->frame_rate < 30 ? vga_15 : vga_30; + else + vals = sd->frame_rate < 15 ? sxga_7_5 : sxga_15; + write_i2c_regvals(sd, vals, ARRAY_SIZE(sxga_15)); + return; + } default: return; } @@ -4120,6 +4202,7 @@ static void set_ov_sensor_window(struct sd *sd) case SEN_OV2610AE: case SEN_OV3610: case SEN_OV7670: + case SEN_OV9600: mode_init_ov_sensor_regs(sd); return; case SEN_OV7660: -- cgit v1.2.3 From 8439e0df9cf8e6668d5798aaa7e23ce399b66459 Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Tue, 24 May 2011 07:57:34 -0300 Subject: [media] anysee: add support for Anysee E7 PTC Basically it is just same device as Anysee E7 TC but made for internal PCI(e) slot and motherboard USB connector. Cc: info@anysee.com Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/anysee.c | 19 +++++++++++++++++++ drivers/media/dvb/dvb-usb/anysee.h | 15 ++++++++------- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/drivers/media/dvb/dvb-usb/anysee.c b/drivers/media/dvb/dvb-usb/anysee.c index 7c327b54308e..49028aeb5630 100644 --- a/drivers/media/dvb/dvb-usb/anysee.c +++ b/drivers/media/dvb/dvb-usb/anysee.c @@ -419,6 +419,21 @@ static struct isl6423_config anysee_isl6423_config = { * IOA[7] TS 1=enabled * IOE[5] STV0903 1=enabled * + * E7 PTC VID=1c73 PID=861f HW=21 FW=0.1 AMTCI=?? "anysee-E7PTC(LP)" + * PCB: 508PTC (rev0.5) + * parts: ZL10353, TDA10023, DNOD44CDH086A(TDA18212) + * OEA=80 OEB=00 OEC=03 OED=f7 OEE=ff + * IOA=4d IOB=00 IOC=cc IOD=48 IOE=e4 + * IOA[7] TS 1=enabled + * IOE[4] TDA18212 1=enabled + * DVB-C: + * IOD[6] ZL10353 0=disabled + * IOD[5] TDA10023 1=enabled + * IOE[0] IF 1=enabled + * DVB-T: + * IOD[5] TDA10023 0=disabled + * IOD[6] ZL10353 1=enabled + * IOE[0] IF 0=enabled */ static int anysee_frontend_attach(struct dvb_usb_adapter *adap) @@ -593,7 +608,9 @@ static int anysee_frontend_attach(struct dvb_usb_adapter *adap) break; case ANYSEE_HW_508TC: /* 18 */ + case ANYSEE_HW_508PTC: /* 21 */ /* E7 TC */ + /* E7 PTC */ /* enable transport stream on IOA[7] */ ret = anysee_wr_reg_mask(adap->dev, REG_IOA, (1 << 7), 0x80); @@ -762,7 +779,9 @@ static int anysee_tuner_attach(struct dvb_usb_adapter *adap) break; case ANYSEE_HW_508TC: /* 18 */ + case ANYSEE_HW_508PTC: /* 21 */ /* E7 TC */ + /* E7 PTC */ /* enable tuner on IOE[4] */ ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (1 << 4), 0x10); diff --git a/drivers/media/dvb/dvb-usb/anysee.h b/drivers/media/dvb/dvb-usb/anysee.h index a7673aa1e007..3bec60c5565f 100644 --- a/drivers/media/dvb/dvb-usb/anysee.h +++ b/drivers/media/dvb/dvb-usb/anysee.h @@ -61,13 +61,14 @@ struct anysee_state { u8 seq; }; -#define ANYSEE_HW_02 2 /* E30 */ -#define ANYSEE_HW_507CD 6 /* E30 Plus */ -#define ANYSEE_HW_507DC 10 /* E30 C Plus */ -#define ANYSEE_HW_507SI 11 /* E30 S2 Plus */ -#define ANYSEE_HW_507FA 15 /* E30 Combo Plus / E30 C Plus */ -#define ANYSEE_HW_508TC 18 /* E7 TC */ -#define ANYSEE_HW_508S2 19 /* E7 S2 */ +#define ANYSEE_HW_02 2 /* E30 */ +#define ANYSEE_HW_507CD 6 /* E30 Plus */ +#define ANYSEE_HW_507DC 10 /* E30 C Plus */ +#define ANYSEE_HW_507SI 11 /* E30 S2 Plus */ +#define ANYSEE_HW_507FA 15 /* E30 Combo Plus / E30 C Plus */ +#define ANYSEE_HW_508TC 18 /* E7 TC */ +#define ANYSEE_HW_508S2 19 /* E7 S2 */ +#define ANYSEE_HW_508PTC 21 /* E7 PTC Plus */ #define REG_IOA 0x80 /* Port A (bit addressable) */ #define REG_IOB 0x90 /* Port B (bit addressable) */ -- cgit v1.2.3 From fea3c39a2eb8401e939b368dd90c03089caa3ed9 Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Wed, 25 May 2011 18:21:43 -0300 Subject: [media] anysee: add support for Anysee E7 PS2 Basically it is just same device as Anysee E7 S2 but made for internal PCI(e) slot and motherboard USB connector. Cc: info@anysee.com Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/anysee.c | 12 ++++++++++++ drivers/media/dvb/dvb-usb/anysee.h | 1 + 2 files changed, 13 insertions(+) diff --git a/drivers/media/dvb/dvb-usb/anysee.c b/drivers/media/dvb/dvb-usb/anysee.c index 49028aeb5630..a4a5361cf066 100644 --- a/drivers/media/dvb/dvb-usb/anysee.c +++ b/drivers/media/dvb/dvb-usb/anysee.c @@ -434,6 +434,14 @@ static struct isl6423_config anysee_isl6423_config = { * IOD[5] TDA10023 0=disabled * IOD[6] ZL10353 1=enabled * IOE[0] IF 0=enabled + * + * E7 S2 VID=1c73 PID=861f HW=22 FW=0.1 AMTCI=?? "anysee-E7PS2(LP)" + * PCB: 508PS2 (rev0.4) + * parts: DNBU10512IST(STV0903, STV6110), ISL6423 + * OEA=80 OEB=00 OEC=03 OED=f7 OEE=ff + * IOA=4d IOB=00 IOC=c4 IOD=08 IOE=e4 + * IOA[7] TS 1=enabled + * IOE[5] STV0903 1=enabled */ static int anysee_frontend_attach(struct dvb_usb_adapter *adap) @@ -667,7 +675,9 @@ static int anysee_frontend_attach(struct dvb_usb_adapter *adap) break; case ANYSEE_HW_508S2: /* 19 */ + case ANYSEE_HW_508PS2: /* 22 */ /* E7 S2 */ + /* E7 PS2 */ /* enable transport stream on IOA[7] */ ret = anysee_wr_reg_mask(adap->dev, REG_IOA, (1 << 7), 0x80); @@ -794,7 +804,9 @@ static int anysee_tuner_attach(struct dvb_usb_adapter *adap) break; case ANYSEE_HW_508S2: /* 19 */ + case ANYSEE_HW_508PS2: /* 22 */ /* E7 S2 */ + /* E7 PS2 */ /* attach tuner */ fe = dvb_attach(stv6110_attach, adap->fe, diff --git a/drivers/media/dvb/dvb-usb/anysee.h b/drivers/media/dvb/dvb-usb/anysee.h index 3bec60c5565f..24ce5e656e54 100644 --- a/drivers/media/dvb/dvb-usb/anysee.h +++ b/drivers/media/dvb/dvb-usb/anysee.h @@ -69,6 +69,7 @@ struct anysee_state { #define ANYSEE_HW_508TC 18 /* E7 TC */ #define ANYSEE_HW_508S2 19 /* E7 S2 */ #define ANYSEE_HW_508PTC 21 /* E7 PTC Plus */ +#define ANYSEE_HW_508PS2 22 /* E7 PS2 Plus */ #define REG_IOA 0x80 /* Port A (bit addressable) */ #define REG_IOB 0x90 /* Port B (bit addressable) */ -- cgit v1.2.3 From 05c46c05d20d9504d832dc12b2a84e9e0cc9be31 Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Wed, 25 May 2011 18:30:09 -0300 Subject: [media] anysee: style issues, comments, etc Change some info, comments, variables. No functionality changes. Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/anysee.c | 38 ++++++++++++++++++++------------------ drivers/media/dvb/dvb-usb/anysee.h | 2 +- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/drivers/media/dvb/dvb-usb/anysee.c b/drivers/media/dvb/dvb-usb/anysee.c index a4a5361cf066..2cbf19a52e38 100644 --- a/drivers/media/dvb/dvb-usb/anysee.c +++ b/drivers/media/dvb/dvb-usb/anysee.c @@ -347,15 +347,17 @@ static struct isl6423_config anysee_isl6423_config = { * PCB: ? * parts: DNOS404ZH102A(MT352, DTT7579(?)) * - * E30 VID=04b4 PID=861f HW=2 FW=2.1 Product=???????? - * PCB: ? + * E30 VID=04b4 PID=861f HW=2 FW=2.1 "anysee-T(LP)" + * PCB: PCB 507T (rev1.61) * parts: DNOS404ZH103A(ZL10353, DTT7579(?)) + * OEA=0a OEB=00 OEC=00 OED=ff OEE=00 + * IOA=45 IOB=ff IOC=00 IOD=ff IOE=00 * * E30 Plus VID=04b4 PID=861f HW=6 FW=1.0 "anysee" * PCB: 507CD (rev1.1) * parts: DNOS404ZH103A(ZL10353, DTT7579(?)), CST56I01 - * OEA=80 OEB=00 OEC=00 OED=ff OEF=fe - * IOA=4f IOB=ff IOC=00 IOD=06 IOF=01 + * OEA=80 OEB=00 OEC=00 OED=ff OEE=fe + * IOA=4f IOB=ff IOC=00 IOD=06 IOE=01 * IOD[0] ZL10353 1=enabled * IOA[7] TS 0=enabled * tuner is not behind ZL10353 I2C-gate (no care if gate disabled or not) @@ -363,30 +365,30 @@ static struct isl6423_config anysee_isl6423_config = { * E30 C Plus VID=04b4 PID=861f HW=10 FW=1.0 "anysee-DC(LP)" * PCB: 507DC (rev0.2) * parts: TDA10023, DTOS403IH102B TM, CST56I01 - * OEA=80 OEB=00 OEC=00 OED=ff OEF=fe - * IOA=4f IOB=ff IOC=00 IOD=26 IOF=01 + * OEA=80 OEB=00 OEC=00 OED=ff OEE=fe + * IOA=4f IOB=ff IOC=00 IOD=26 IOE=01 * IOD[0] TDA10023 1=enabled * * E30 S2 Plus VID=04b4 PID=861f HW=11 FW=0.1 "anysee-S2(LP)" * PCB: 507SI (rev2.1) * parts: BS2N10WCC01(CX24116, CX24118), ISL6423, TDA8024 - * OEA=80 OEB=00 OEC=ff OED=ff OEF=fe - * IOA=4d IOB=ff IOC=00 IOD=26 IOF=01 + * OEA=80 OEB=00 OEC=ff OED=ff OEE=fe + * IOA=4d IOB=ff IOC=00 IOD=26 IOE=01 * IOD[0] CX24116 1=enabled * * E30 C Plus VID=1c73 PID=861f HW=15 FW=1.2 "anysee-FA(LP)" * PCB: 507FA (rev0.4) * parts: TDA10023, DTOS403IH102B TM, TDA8024 - * OEA=80 OEB=00 OEC=ff OED=ff OEF=ff - * IOA=4d IOB=ff IOC=00 IOD=00 IOF=c0 + * OEA=80 OEB=00 OEC=ff OED=ff OEE=ff + * IOA=4d IOB=ff IOC=00 IOD=00 IOE=c0 * IOD[5] TDA10023 1=enabled * IOE[0] tuner 1=enabled * * E30 Combo Plus VID=1c73 PID=861f HW=15 FW=1.2 "anysee-FA(LP)" * PCB: 507FA (rev1.1) * parts: ZL10353, TDA10023, DTOS403IH102B TM, TDA8024 - * OEA=80 OEB=00 OEC=ff OED=ff OEF=ff - * IOA=4d IOB=ff IOC=00 IOD=00 IOF=c0 + * OEA=80 OEB=00 OEC=ff OED=ff OEE=ff + * IOA=4d IOB=ff IOC=00 IOD=00 IOE=c0 * DVB-C: * IOD[5] TDA10023 1=enabled * IOE[0] tuner 1=enabled @@ -398,8 +400,8 @@ static struct isl6423_config anysee_isl6423_config = { * E7 TC VID=1c73 PID=861f HW=18 FW=0.7 AMTCI=0.5 "anysee-E7TC(LP)" * PCB: 508TC (rev0.6) * parts: ZL10353, TDA10023, DNOD44CDH086A(TDA18212) - * OEA=80 OEB=00 OEC=03 OED=f7 OEF=ff - * IOA=4d IOB=00 IOC=cc IOD=48 IOF=e4 + * OEA=80 OEB=00 OEC=03 OED=f7 OEE=ff + * IOA=4d IOB=00 IOC=cc IOD=48 IOE=e4 * IOA[7] TS 1=enabled * IOE[4] TDA18212 1=enabled * DVB-C: @@ -414,8 +416,8 @@ static struct isl6423_config anysee_isl6423_config = { * E7 S2 VID=1c73 PID=861f HW=19 FW=0.4 AMTCI=0.5 "anysee-E7S2(LP)" * PCB: 508S2 (rev0.7) * parts: DNBU10512IST(STV0903, STV6110), ISL6423 - * OEA=80 OEB=00 OEC=03 OED=f7 OEF=ff - * IOA=4d IOB=00 IOC=c4 IOD=08 IOF=e4 + * OEA=80 OEB=00 OEC=03 OED=f7 OEE=ff + * IOA=4d IOB=00 IOC=c4 IOD=08 IOE=e4 * IOA[7] TS 1=enabled * IOE[5] STV0903 1=enabled * @@ -482,7 +484,7 @@ static int anysee_frontend_attach(struct dvb_usb_adapter *adap) state->hw = hw_info[0]; switch (state->hw) { - case ANYSEE_HW_02: /* 2 */ + case ANYSEE_HW_507T: /* 2 */ /* E30 */ /* attach demod */ @@ -714,7 +716,7 @@ static int anysee_tuner_attach(struct dvb_usb_adapter *adap) deb_info("%s:\n", __func__); switch (state->hw) { - case ANYSEE_HW_02: /* 2 */ + case ANYSEE_HW_507T: /* 2 */ /* E30 */ /* attach tuner */ diff --git a/drivers/media/dvb/dvb-usb/anysee.h b/drivers/media/dvb/dvb-usb/anysee.h index 24ce5e656e54..ad6ccd1ea2d9 100644 --- a/drivers/media/dvb/dvb-usb/anysee.h +++ b/drivers/media/dvb/dvb-usb/anysee.h @@ -61,7 +61,7 @@ struct anysee_state { u8 seq; }; -#define ANYSEE_HW_02 2 /* E30 */ +#define ANYSEE_HW_507T 2 /* E30 */ #define ANYSEE_HW_507CD 6 /* E30 Plus */ #define ANYSEE_HW_507DC 10 /* E30 C Plus */ #define ANYSEE_HW_507SI 11 /* E30 S2 Plus */ -- cgit v1.2.3 From d838f4c318f12785a81e3e073a71ba4bb4ccd8cf Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Wed, 25 May 2011 12:32:44 -0300 Subject: [media] cxd2820r: malloc buffers instead of stack kmalloc I2C buffers Signed-off-by: Antti Palosaari Cc: Dan Carpenter Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/cxd2820r_core.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/media/dvb/frontends/cxd2820r_core.c b/drivers/media/dvb/frontends/cxd2820r_core.c index 0779f69db793..903cbdbbc73b 100644 --- a/drivers/media/dvb/frontends/cxd2820r_core.c +++ b/drivers/media/dvb/frontends/cxd2820r_core.c @@ -740,12 +740,13 @@ static int cxd2820r_tuner_i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msg[], int num) { struct cxd2820r_priv *priv = i2c_get_adapdata(i2c_adap); - u8 obuf[msg[0].len + 2]; + int ret; + u8 *obuf = kmalloc(msg[0].len + 2, GFP_KERNEL); struct i2c_msg msg2[2] = { { .addr = priv->cfg.i2c_address, .flags = 0, - .len = sizeof(obuf), + .len = msg[0].len + 2, .buf = obuf, }, { .addr = priv->cfg.i2c_address, @@ -755,15 +756,24 @@ static int cxd2820r_tuner_i2c_xfer(struct i2c_adapter *i2c_adap, } }; + if (!obuf) + return -ENOMEM; + obuf[0] = 0x09; obuf[1] = (msg[0].addr << 1); if (num == 2) { /* I2C read */ obuf[1] = (msg[0].addr << 1) | I2C_M_RD; /* I2C RD flag */ - msg2[0].len = sizeof(obuf) - 1; /* maybe HW bug ? */ + msg2[0].len = msg[0].len + 2 - 1; /* '-1' maybe HW bug ? */ } memcpy(&obuf[2], msg[0].buf, msg[0].len); - return i2c_transfer(priv->i2c, msg2, num); + ret = i2c_transfer(priv->i2c, msg2, num); + if (ret < 0) + warn("tuner i2c failed ret:%d", ret); + + kfree(obuf); + + return ret; } static struct i2c_algorithm cxd2820r_tuner_i2c_algo = { -- cgit v1.2.3 From 1d44ccb9ea7fc05cae7d76fdb7e1e54c7dd27ef5 Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Wed, 25 May 2011 12:42:52 -0300 Subject: [media] cxd2820r: fix bitfields error: dubious one-bit signed bitfield Reported-by: Dan Carpenter Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/cxd2820r.h | 4 ++-- drivers/media/dvb/frontends/cxd2820r_priv.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/dvb/frontends/cxd2820r.h b/drivers/media/dvb/frontends/cxd2820r.h index ad17845123d9..2906582dc94c 100644 --- a/drivers/media/dvb/frontends/cxd2820r.h +++ b/drivers/media/dvb/frontends/cxd2820r.h @@ -55,13 +55,13 @@ struct cxd2820r_config { * Default: 0 * Values: 0, 1 */ - int if_agc_polarity:1; + bool if_agc_polarity; /* Spectrum inversion. * Default: 0 * Values: 0, 1 */ - int spec_inv:1; + bool spec_inv; /* IFs for all used modes. * Default: none, must set diff --git a/drivers/media/dvb/frontends/cxd2820r_priv.h b/drivers/media/dvb/frontends/cxd2820r_priv.h index 25adbeefa6d3..0c0ebc9d5c4a 100644 --- a/drivers/media/dvb/frontends/cxd2820r_priv.h +++ b/drivers/media/dvb/frontends/cxd2820r_priv.h @@ -55,13 +55,13 @@ struct cxd2820r_priv { struct mutex fe_lock; /* FE lock */ int active_fe:2; /* FE lock, -1=NONE, 0=DVB-T/T2, 1=DVB-C */ - int ber_running:1; + bool ber_running; u8 bank[2]; u8 gpio[3]; fe_delivery_system_t delivery_system; - int last_tune_failed:1; /* for switch between T and T2 tune */ + bool last_tune_failed; /* for switch between T and T2 tune */ }; /* cxd2820r_core.c */ -- cgit v1.2.3 From a24ec44801708e67585fa31dd0cc5802010dab31 Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Wed, 25 May 2011 16:56:37 -0300 Subject: [media] em28xx: EM28174 remote support For some reason it repeats rather slowly, around 800ms intervals, two RC5 remotes tested. Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-input.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c index ba1ba8648c81..5d12b14282e3 100644 --- a/drivers/media/video/em28xx/em28xx-input.c +++ b/drivers/media/video/em28xx/em28xx-input.c @@ -372,6 +372,7 @@ int em28xx_ir_change_protocol(struct rc_dev *rc_dev, u64 rc_type) ir->get_key = default_polling_getkey; break; case CHIP_ID_EM2874: + case CHIP_ID_EM28174: ir->get_key = em2874_polling_getkey; em28xx_write_regs(dev, EM2874_R50_IR_CONFIG, &ir_config, 1); break; -- cgit v1.2.3 From ff7b929f04b8e9f2e5d8929e14b10f913021a00c Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Wed, 25 May 2011 17:00:35 -0300 Subject: [media] em28xx: add remote for PCTV nanoStick T2 290e Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-cards.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 4e37375decf5..703af4f89de2 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -1775,11 +1775,11 @@ struct em28xx_board em28xx_boards[] = { [EM28174_BOARD_PCTV_290E] = { .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT | EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_FREQ_100_KHZ, - .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, .name = "PCTV Systems nanoStick T2 290e", .tuner_type = TUNER_ABSENT, .tuner_gpio = pctv_290e, .has_dvb = 1, + .ir_codes = RC_MAP_PINNACLE_PCTV_HD, }, }; const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards); -- cgit v1.2.3 From 460312ec5aff5e4c12b2e50a2965ed1ee832682a Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Wed, 25 May 2011 17:03:50 -0300 Subject: [media] em28xx: correct PCTV nanoStick T2 290e device name PCTV Systems nanoStick T2 290e => PCTV nanoStick T2 290e Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-cards.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 703af4f89de2..f15c73469ee7 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -289,7 +289,7 @@ static struct em28xx_reg_seq leadership_reset[] = { { -1, -1, -1, -1}, }; -/* 2013:024f PCTV Systems nanoStick T2 290e +/* 2013:024f PCTV nanoStick T2 290e * GPIO_6 - demod reset * GPIO_7 - LED */ @@ -1770,12 +1770,12 @@ struct em28xx_board em28xx_boards[] = { .dvb_gpio = kworld_a340_digital, .tuner_gpio = default_tuner_gpio, }, - /* 2013:024f PCTV Systems nanoStick T2 290e. + /* 2013:024f PCTV nanoStick T2 290e. * Empia EM28174, Sony CXD2820R and NXP TDA18271HD/C2 */ [EM28174_BOARD_PCTV_290E] = { + .name = "PCTV nanoStick T2 290e", .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT | EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_FREQ_100_KHZ, - .name = "PCTV Systems nanoStick T2 290e", .tuner_type = TUNER_ABSENT, .tuner_gpio = pctv_290e, .has_dvb = 1, -- cgit v1.2.3 From ebaefdb7651383645f17d2d32398914175d1bcdd Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 1 Jun 2011 10:16:25 -0300 Subject: [media] em28xx: use the proper prefix for board names All boards use EM28xxx_BOARD, to identify that the macro refers to a card entry. So: EM2874_LEADERSHIP_ISDBT -> EM2874_BOARD_LEADERSHIP_ISDBT Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-cards.c | 4 ++-- drivers/media/video/em28xx/em28xx-dvb.c | 2 +- drivers/media/video/em28xx/em28xx.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index f15c73469ee7..7635a45a1220 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -1259,7 +1259,7 @@ struct em28xx_board em28xx_boards[] = { } }, }, - [EM2874_LEADERSHIP_ISDBT] = { + [EM2874_BOARD_LEADERSHIP_ISDBT] = { .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT | EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_FREQ_100_KHZ, @@ -1937,7 +1937,7 @@ static struct em28xx_hash_table em28xx_i2c_hash[] = { {0x77800080, EM2860_BOARD_TVP5150_REFERENCE_DESIGN, TUNER_ABSENT}, {0xc51200e3, EM2820_BOARD_GADMEI_TVR200, TUNER_LG_PAL_NEW_TAPC}, {0x4ba50080, EM2861_BOARD_GADMEI_UTV330PLUS, TUNER_TNF_5335MF}, - {0x6b800080, EM2874_LEADERSHIP_ISDBT, TUNER_ABSENT}, + {0x6b800080, EM2874_BOARD_LEADERSHIP_ISDBT, TUNER_ABSENT}, }; /* I2C possible address to saa7115, tvp5150, msp3400, tvaudio */ diff --git a/drivers/media/video/em28xx/em28xx-dvb.c b/drivers/media/video/em28xx/em28xx-dvb.c index 7904ca4b6913..012ab8ec19cf 100644 --- a/drivers/media/video/em28xx/em28xx-dvb.c +++ b/drivers/media/video/em28xx/em28xx-dvb.c @@ -546,7 +546,7 @@ static int dvb_init(struct em28xx *dev) em28xx_set_mode(dev, EM28XX_DIGITAL_MODE); /* init frontend */ switch (dev->model) { - case EM2874_LEADERSHIP_ISDBT: + case EM2874_BOARD_LEADERSHIP_ISDBT: dvb->fe[0] = dvb_attach(s921_attach, &sharp_isdbt, &dev->i2c_adap); diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index 3cca33122450..28b9954d9326 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h @@ -117,7 +117,7 @@ #define EM2800_BOARD_VC211A 74 #define EM2882_BOARD_DIKOM_DK300 75 #define EM2870_BOARD_KWORLD_A340 76 -#define EM2874_LEADERSHIP_ISDBT 77 +#define EM2874_BOARD_LEADERSHIP_ISDBT 77 #define EM28174_BOARD_PCTV_290E 78 -- cgit v1.2.3 From 58b0ed25b6e9d6dbf00c30b816e8a2a0fec2bec8 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 1 Jun 2011 10:23:53 -0300 Subject: [media] Update several cardlists Several cardlist entries are missed. Fix them by running some script magic (about the same scripts we used to have at -hg tree). Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/CARDLIST.cx23885 | 2 ++ Documentation/video4linux/CARDLIST.cx88 | 1 + Documentation/video4linux/CARDLIST.em28xx | 2 ++ Documentation/video4linux/CARDLIST.saa7134 | 4 ++++ Documentation/video4linux/CARDLIST.tuner | 1 + Documentation/video4linux/CARDLIST.usbvision | 2 ++ 6 files changed, 12 insertions(+) diff --git a/Documentation/video4linux/CARDLIST.cx23885 b/Documentation/video4linux/CARDLIST.cx23885 index 87c46347bd63..8910449d23a8 100644 --- a/Documentation/video4linux/CARDLIST.cx23885 +++ b/Documentation/video4linux/CARDLIST.cx23885 @@ -27,3 +27,5 @@ 26 -> Hauppauge WinTV-HVR1290 [0070:8551] 27 -> Mygica X8558 PRO DMB-TH [14f1:8578] 28 -> LEADTEK WinFast PxTV1200 [107d:6f22] + 29 -> GoTView X5 3D Hybrid [5654:2390] + 30 -> NetUP Dual DVB-T/C-CI RF [1b55:e2e4] diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88 index 42517d9121de..d9c0f119196d 100644 --- a/Documentation/video4linux/CARDLIST.cx88 +++ b/Documentation/video4linux/CARDLIST.cx88 @@ -84,3 +84,4 @@ 83 -> Prof 7301 DVB-S/S2 [b034:3034] 84 -> Samsung SMT 7020 DVB-S [18ac:dc00,18ac:dccd] 85 -> Twinhan VP-1027 DVB-S [1822:0023] + 86 -> TeVii S464 DVB-S/S2 [d464:9022] diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx index 9aae449440dc..4a7b3df6d8bd 100644 --- a/Documentation/video4linux/CARDLIST.em28xx +++ b/Documentation/video4linux/CARDLIST.em28xx @@ -74,3 +74,5 @@ 74 -> Actionmaster/LinXcel/Digitus VC211A (em2800) 75 -> Dikom DK300 (em2882) 76 -> KWorld PlusTV 340U or UB435-Q (ATSC) (em2870) [1b80:a340] + 77 -> EM2874 Leadership ISDBT (em2874) + 78 -> PCTV nanoStick T2 290e (em28174) diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index 6b4c72d8862d..7efae9bd73ed 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 @@ -182,3 +182,7 @@ 181 -> TechoTrend TT-budget T-3000 [13c2:2804] 182 -> Kworld PCI SBTVD/ISDB-T Full-Seg Hybrid [17de:b136] 183 -> Compro VideoMate Vista M1F [185b:c900] +184 -> Encore ENLTV-FM 3 [1a7f:2108] +185 -> MagicPro ProHDTV Pro2 DMB-TH/Hybrid [17de:d136] +186 -> Beholder BeholdTV 501 [5ace:5010] +187 -> Beholder BeholdTV 503 FM [5ace:5030] diff --git a/Documentation/video4linux/CARDLIST.tuner b/Documentation/video4linux/CARDLIST.tuner index e67c1db96854..562d7fa20f6d 100644 --- a/Documentation/video4linux/CARDLIST.tuner +++ b/Documentation/video4linux/CARDLIST.tuner @@ -83,3 +83,4 @@ tuner=82 - Philips CU1216L tuner=83 - NXP TDA18271 tuner=84 - Sony BTF-Pxn01Z tuner=85 - Philips FQ1236 MK5 +tuner=86 - Tena TNF5337 MFD diff --git a/Documentation/video4linux/CARDLIST.usbvision b/Documentation/video4linux/CARDLIST.usbvision index 0b72d3fee17e..6fd1af365142 100644 --- a/Documentation/video4linux/CARDLIST.usbvision +++ b/Documentation/video4linux/CARDLIST.usbvision @@ -63,3 +63,5 @@ 62 -> Pinnacle PCTV Bungee USB (PAL) FM [2304:0419] 63 -> Hauppauge WinTv-USB [2400:4200] 64 -> Pinnacle Studio PCTV USB (NTSC) FM V3 [2304:0113] + 65 -> Nogatech USB MicroCam NTSC (NV3000N) [0573:3000] + 66 -> Nogatech USB MicroCam PAL (NV3001P) [0573:3001] -- cgit v1.2.3 From 050bf0faa833028f30ed3ad6a8fc5e51994dabfe Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Wed, 25 May 2011 17:25:53 -0300 Subject: [media] cxd2820r: correct missing error checks Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/cxd2820r_core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/media/dvb/frontends/cxd2820r_core.c b/drivers/media/dvb/frontends/cxd2820r_core.c index 903cbdbbc73b..d416e85589e1 100644 --- a/drivers/media/dvb/frontends/cxd2820r_core.c +++ b/drivers/media/dvb/frontends/cxd2820r_core.c @@ -314,6 +314,8 @@ static int cxd2820r_set_frontend(struct dvb_frontend *fe, } else if (c->delivery_system == SYS_DVBT2) { /* DVB-T => DVB-T2 */ ret = cxd2820r_sleep_t(fe); + if (ret) + break; ret = cxd2820r_set_frontend_t2(fe, p); } break; @@ -324,6 +326,8 @@ static int cxd2820r_set_frontend(struct dvb_frontend *fe, } else if (c->delivery_system == SYS_DVBT) { /* DVB-T2 => DVB-T */ ret = cxd2820r_sleep_t2(fe); + if (ret) + break; ret = cxd2820r_set_frontend_t(fe, p); } break; -- cgit v1.2.3 From 061d55eb450102408289599ae79b92322d6126e1 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Wed, 24 Nov 2010 02:36:57 -0300 Subject: [media] saa7164: poll mask set incorrectly list_first_entry() always returns non-null here. I think the intent was to test whether there were any entries in the used list. Signed-off-by: Dan Carpenter Cc: Steven Toth Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/saa7164/saa7164-encoder.c | 6 +----- drivers/media/video/saa7164/saa7164-vbi.c | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/media/video/saa7164/saa7164-encoder.c b/drivers/media/video/saa7164/saa7164-encoder.c index 400364569c8d..2fd38a01887f 100644 --- a/drivers/media/video/saa7164/saa7164-encoder.c +++ b/drivers/media/video/saa7164/saa7164-encoder.c @@ -1246,7 +1246,6 @@ static unsigned int fops_poll(struct file *file, poll_table *wait) struct saa7164_encoder_fh *fh = (struct saa7164_encoder_fh *)file->private_data; struct saa7164_port *port = fh->port; - struct saa7164_user_buffer *ubuf; unsigned int mask = 0; port->last_poll_msecs_diff = port->last_poll_msecs; @@ -1278,10 +1277,7 @@ static unsigned int fops_poll(struct file *file, poll_table *wait) } /* Pull the first buffer from the used list */ - ubuf = list_first_entry(&port->list_buf_used.list, - struct saa7164_user_buffer, list); - - if (ubuf) + if (!list_empty(&port->list_buf_used.list)) mask |= POLLIN | POLLRDNORM; return mask; diff --git a/drivers/media/video/saa7164/saa7164-vbi.c b/drivers/media/video/saa7164/saa7164-vbi.c index bc1fcedba874..e2e034158718 100644 --- a/drivers/media/video/saa7164/saa7164-vbi.c +++ b/drivers/media/video/saa7164/saa7164-vbi.c @@ -1192,7 +1192,6 @@ static unsigned int fops_poll(struct file *file, poll_table *wait) { struct saa7164_vbi_fh *fh = (struct saa7164_vbi_fh *)file->private_data; struct saa7164_port *port = fh->port; - struct saa7164_user_buffer *ubuf; unsigned int mask = 0; port->last_poll_msecs_diff = port->last_poll_msecs; @@ -1224,10 +1223,7 @@ static unsigned int fops_poll(struct file *file, poll_table *wait) } /* Pull the first buffer from the used list */ - ubuf = list_first_entry(&port->list_buf_used.list, - struct saa7164_user_buffer, list); - - if (ubuf) + if (!list_empty(&port->list_buf_used.list)) mask |= POLLIN | POLLRDNORM; return mask; -- cgit v1.2.3 From 4bbcd849b07259211dfe6d3168e669e89bbd19ea Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Tue, 15 Feb 2011 06:20:12 -0300 Subject: [media] cx23885: restore flushes of cx23885_dev work items Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx23885/cx23885-input.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/video/cx23885/cx23885-input.c b/drivers/media/video/cx23885/cx23885-input.c index e97cafd83984..1ca6693cb5f8 100644 --- a/drivers/media/video/cx23885/cx23885-input.c +++ b/drivers/media/video/cx23885/cx23885-input.c @@ -229,6 +229,9 @@ static void cx23885_input_ir_stop(struct cx23885_dev *dev) v4l2_subdev_call(dev->sd_ir, ir, rx_s_parameters, ¶ms); v4l2_subdev_call(dev->sd_ir, ir, rx_g_parameters, ¶ms); } + flush_work_sync(&dev->cx25840_work); + flush_work_sync(&dev->ir_rx_work); + flush_work_sync(&dev->ir_tx_work); } static void cx23885_input_ir_close(struct rc_dev *rc) -- cgit v1.2.3 From 45f239ab82b2a808103a0fae02594961b09c5c8b Mon Sep 17 00:00:00 2001 From: Newson Edouard Date: Tue, 19 Apr 2011 11:54:54 -0300 Subject: [media] videobuf_pages_to_sg: sglist[0] length problem On function videobuf_pages_to_sg the statement sg_set_page(&sglist[0], pages[0], PAGE_SIZE - offset, offset) will fail if size is less than PAGE_SIZE. Signed-off-by: Newson Edouard Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/videobuf-dma-sg.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c index ddb8f4b46c03..f300deafd268 100644 --- a/drivers/media/video/videobuf-dma-sg.c +++ b/drivers/media/video/videobuf-dma-sg.c @@ -108,8 +108,9 @@ static struct scatterlist *videobuf_pages_to_sg(struct page **pages, if (PageHighMem(pages[0])) /* DMA to highmem pages might not work */ goto highmem; - sg_set_page(&sglist[0], pages[0], PAGE_SIZE - offset, offset); - size -= PAGE_SIZE - offset; + sg_set_page(&sglist[0], pages[0], + min_t(size_t, PAGE_SIZE - offset, size), offset); + size -= min_t(size_t, PAGE_SIZE - offset, size); for (i = 1; i < nr_pages; i++) { if (NULL == pages[i]) goto nopage; -- cgit v1.2.3 From 82f7b59cb80679038e8e3a99738cce5e094f69b6 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Sun, 15 May 2011 12:33:58 -0300 Subject: [media] v4l: Document EACCES in VIDIOC_[GS]_CTRL and VIDIOC_{G, S, TRY}_EXT_CTRLS VIDIOC_S_CTRL and VIDIOC_S_EXT_CTRLS return EACCES when setting a read-only control VIDIOC_TRY_EXT_CTRLS when trying a read-only control and VIDIOC_G_CTRL and VIDIOC_G_EXT_CTRLS when getting a write-only control. Document this. Signed-off-by: Sakari Ailus Acked-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/v4l/vidioc-g-ctrl.xml | 7 +++++++ Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/Documentation/DocBook/media/v4l/vidioc-g-ctrl.xml b/Documentation/DocBook/media/v4l/vidioc-g-ctrl.xml index 8b5e6ff7f3df..5146d00782e3 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-ctrl.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-ctrl.xml @@ -117,6 +117,13 @@ because another applications took over control of the device function this control belongs to. + + EACCES + + Attempt to set a read-only control or to get a + write-only control. + + diff --git a/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml index 3aa7f8f9ff0c..5e73517fa232 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml @@ -294,6 +294,13 @@ The field size is set to a value that is enough to store the payload and this error code is returned. + + EACCES + + Attempt to try or set a read-only control or to get a + write-only control. + + -- cgit v1.2.3 From 2ef403708880c6e00854fb81bbffb9a4036327e6 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Mon, 23 May 2011 08:13:06 -0300 Subject: [media] Fix compile warning: Dereferencing type-punned pointer will break strict-aliasing rules Signed-off-by: Hans Petter Selasky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/v4l2-ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 69e8c6ffcc49..55df1436f835 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c @@ -2276,7 +2276,7 @@ static int check_array_args(unsigned int cmd, void *parg, size_t *array_size, break; } *user_ptr = (void __user *)buf->m.planes; - *kernel_ptr = (void **)&buf->m.planes; + *kernel_ptr = (void *)&buf->m.planes; *array_size = sizeof(struct v4l2_plane) * buf->length; ret = 1; } @@ -2290,7 +2290,7 @@ static int check_array_args(unsigned int cmd, void *parg, size_t *array_size, if (ctrls->count != 0) { *user_ptr = (void __user *)ctrls->controls; - *kernel_ptr = (void **)&ctrls->controls; + *kernel_ptr = (void *)&ctrls->controls; *array_size = sizeof(struct v4l2_ext_control) * ctrls->count; ret = 1; -- cgit v1.2.3 From 4522e825dbfc19537a08f65719dc3d69c46fe661 Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Mon, 23 May 2011 09:17:19 -0300 Subject: [media] tea575x: convert to control framework Convert tea575x-tuner to use the new V4L2 control framework. Also add ext_init() callback that can be used by a card driver for additional initialization right before registering the video device (for SF16-FMR2). Also embed struct video_device to struct snd_tea575x to simplify the code. Signed-off-by: Ondrej Zary Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/sound/tea575x-tuner.h | 6 ++- sound/i2c/other/tea575x-tuner.c | 106 +++++++++++++--------------------------- 2 files changed, 39 insertions(+), 73 deletions(-) diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h index d2ea112fc20f..5aa8186e7820 100644 --- a/include/sound/tea575x-tuner.h +++ b/include/sound/tea575x-tuner.h @@ -23,8 +23,8 @@ */ #include +#include #include -#include #define TEA575X_FMIF 10700 @@ -42,7 +42,7 @@ struct snd_tea575x_ops { }; struct snd_tea575x { - struct video_device *vd; /* video device */ + struct video_device vd; /* video device */ bool tea5759; /* 5759 chip is present */ bool mute; /* Device is muted? */ bool stereo; /* receiving stereo */ @@ -54,6 +54,8 @@ struct snd_tea575x { void *private_data; u8 card[32]; u8 bus_info[32]; + struct v4l2_ctrl_handler ctrl_handler; + int (*ext_init)(struct snd_tea575x *tea); }; int snd_tea575x_init(struct snd_tea575x *tea); diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c index 4831800239d3..0d7a659c494c 100644 --- a/sound/i2c/other/tea575x-tuner.c +++ b/sound/i2c/other/tea575x-tuner.c @@ -22,11 +22,11 @@ #include #include -#include #include #include #include -#include +#include +#include #include MODULE_AUTHOR("Jaroslav Kysela "); @@ -62,17 +62,6 @@ module_param(radio_nr, int, 0); #define TEA575X_BIT_DUMMY (1<<15) /* buffer */ #define TEA575X_BIT_FREQ_MASK 0x7fff -static struct v4l2_queryctrl radio_qctrl[] = { - { - .id = V4L2_CID_AUDIO_MUTE, - .name = "Mute", - .minimum = 0, - .maximum = 1, - .default_value = 1, - .type = V4L2_CTRL_TYPE_BOOLEAN, - } -}; - /* * lowlevel part */ @@ -266,47 +255,17 @@ static int vidioc_s_audio(struct file *file, void *priv, return 0; } -static int vidioc_queryctrl(struct file *file, void *priv, - struct v4l2_queryctrl *qc) +static int tea575x_s_ctrl(struct v4l2_ctrl *ctrl) { - int i; - - for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { - if (qc->id && qc->id == radio_qctrl[i].id) { - memcpy(qc, &(radio_qctrl[i]), - sizeof(*qc)); - return 0; - } - } - return -EINVAL; -} - -static int vidioc_g_ctrl(struct file *file, void *priv, - struct v4l2_control *ctrl) -{ - struct snd_tea575x *tea = video_drvdata(file); + struct snd_tea575x *tea = container_of(ctrl->handler, struct snd_tea575x, ctrl_handler); switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: - ctrl->value = tea->mute; + tea->mute = ctrl->val; + snd_tea575x_set_freq(tea); return 0; } - return -EINVAL; -} -static int vidioc_s_ctrl(struct file *file, void *priv, - struct v4l2_control *ctrl) -{ - struct snd_tea575x *tea = video_drvdata(file); - - switch (ctrl->id) { - case V4L2_CID_AUDIO_MUTE: - if (tea->mute != ctrl->value) { - tea->mute = ctrl->value; - snd_tea575x_set_freq(tea); - } - return 0; - } return -EINVAL; } @@ -355,16 +314,17 @@ static const struct v4l2_ioctl_ops tea575x_ioctl_ops = { .vidioc_s_input = vidioc_s_input, .vidioc_g_frequency = vidioc_g_frequency, .vidioc_s_frequency = vidioc_s_frequency, - .vidioc_queryctrl = vidioc_queryctrl, - .vidioc_g_ctrl = vidioc_g_ctrl, - .vidioc_s_ctrl = vidioc_s_ctrl, }; static struct video_device tea575x_radio = { .name = "tea575x-tuner", .fops = &tea575x_fops, .ioctl_ops = &tea575x_ioctl_ops, - .release = video_device_release, + .release = video_device_release_empty, +}; + +static const struct v4l2_ctrl_ops tea575x_ctrl_ops = { + .s_ctrl = tea575x_s_ctrl, }; /* @@ -373,7 +333,6 @@ static struct video_device tea575x_radio = { int snd_tea575x_init(struct snd_tea575x *tea) { int retval; - struct video_device *tea575x_radio_inst; tea->mute = 1; @@ -384,40 +343,45 @@ int snd_tea575x_init(struct snd_tea575x *tea) tea->in_use = 0; tea->val = TEA575X_BIT_BAND_FM | TEA575X_BIT_SEARCH_10_40; tea->freq = 90500 * 16; /* 90.5Mhz default */ + snd_tea575x_set_freq(tea); - tea575x_radio_inst = video_device_alloc(); - if (tea575x_radio_inst == NULL) { - printk(KERN_ERR "tea575x-tuner: not enough memory\n"); - return -ENOMEM; - } + tea->vd = tea575x_radio; + video_set_drvdata(&tea->vd, tea); - memcpy(tea575x_radio_inst, &tea575x_radio, sizeof(tea575x_radio)); + v4l2_ctrl_handler_init(&tea->ctrl_handler, 1); + tea->vd.ctrl_handler = &tea->ctrl_handler; + v4l2_ctrl_new_std(&tea->ctrl_handler, &tea575x_ctrl_ops, V4L2_CID_AUDIO_MUTE, 0, 1, 1, 1); + retval = tea->ctrl_handler.error; + if (retval) { + printk(KERN_ERR "tea575x-tuner: can't initialize controls\n"); + v4l2_ctrl_handler_free(&tea->ctrl_handler); + return retval; + } - strcpy(tea575x_radio.name, tea->tea5759 ? - "TEA5759 radio" : "TEA5757 radio"); + if (tea->ext_init) { + retval = tea->ext_init(tea); + if (retval) { + v4l2_ctrl_handler_free(&tea->ctrl_handler); + return retval; + } + } - video_set_drvdata(tea575x_radio_inst, tea); + v4l2_ctrl_handler_setup(&tea->ctrl_handler); - retval = video_register_device(tea575x_radio_inst, - VFL_TYPE_RADIO, radio_nr); + retval = video_register_device(&tea->vd, VFL_TYPE_RADIO, radio_nr); if (retval) { printk(KERN_ERR "tea575x-tuner: can't register video device!\n"); - kfree(tea575x_radio_inst); + v4l2_ctrl_handler_free(&tea->ctrl_handler); return retval; } - snd_tea575x_set_freq(tea); - tea->vd = tea575x_radio_inst; - return 0; } void snd_tea575x_exit(struct snd_tea575x *tea) { - if (tea->vd) { - video_unregister_device(tea->vd); - tea->vd = NULL; - } + video_unregister_device(&tea->vd); + v4l2_ctrl_handler_free(&tea->ctrl_handler); } static int __init alsa_tea575x_module_init(void) -- cgit v1.2.3 From a34ff6cdbb464b3e37f0cbb6b0cff9dab4ee057b Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Mon, 23 May 2011 09:43:35 -0300 Subject: [media] Make DVB NET configurable in the kernel Signed-off-by: Hans Petter Selasky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/Kconfig | 12 +++++++++++- drivers/media/dvb/dvb-core/Makefile | 4 +++- drivers/media/dvb/dvb-core/dvb_net.h | 26 ++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index 6995940b633a..dc61895abcf5 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig @@ -68,7 +68,6 @@ config VIDEO_V4L2_SUBDEV_API config DVB_CORE tristate "DVB for Linux" - depends on NET && INET select CRC32 help DVB core utility functions for device handling, software fallbacks etc. @@ -85,6 +84,17 @@ config DVB_CORE If unsure say N. +config DVB_NET + bool "DVB Network Support" + default (NET && INET) + depends on NET && INET + help + The DVB network support in the DVB core can + optionally be disabled if this + option is set to N. + + If unsure say Y. + config VIDEO_MEDIA tristate default (DVB_CORE && (VIDEO_DEV = n)) || (VIDEO_DEV && (DVB_CORE = n)) || (DVB_CORE && VIDEO_DEV) diff --git a/drivers/media/dvb/dvb-core/Makefile b/drivers/media/dvb/dvb-core/Makefile index 0b5182835cc8..8f22bcd7c1f9 100644 --- a/drivers/media/dvb/dvb-core/Makefile +++ b/drivers/media/dvb/dvb-core/Makefile @@ -2,8 +2,10 @@ # Makefile for the kernel DVB device drivers. # +dvb-net-$(CONFIG_DVB_NET) := dvb_net.o + dvb-core-objs := dvbdev.o dmxdev.o dvb_demux.o dvb_filter.o \ dvb_ca_en50221.o dvb_frontend.o \ - dvb_net.o dvb_ringbuffer.o dvb_math.o + $(dvb-net-y) dvb_ringbuffer.o dvb_math.o obj-$(CONFIG_DVB_CORE) += dvb-core.o diff --git a/drivers/media/dvb/dvb-core/dvb_net.h b/drivers/media/dvb/dvb-core/dvb_net.h index 3a3126cae03b..cfd2c46bd5d9 100644 --- a/drivers/media/dvb/dvb-core/dvb_net.h +++ b/drivers/media/dvb/dvb-core/dvb_net.h @@ -32,6 +32,8 @@ #define DVB_NET_DEVICES_MAX 10 +#ifdef CONFIG_DVB_NET + struct dvb_net { struct dvb_device *dvbdev; struct net_device *device[DVB_NET_DEVICES_MAX]; @@ -45,3 +47,27 @@ void dvb_net_release(struct dvb_net *); int dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *); #endif + +#ifndef CONFIG_DVB_NET + +struct dvb_dev_stub; + +struct dvb_net { + struct dvb_dev_stub *dvbdev; +}; + +static inline void dvb_net_release(struct dvb_net *dvbnet) +{ + dvbnet->dvbdev = 0; +} + +static inline int dvb_net_init(struct dvb_adapter *adap, + struct dvb_net *dvbnet, struct dmx_demux *dmx) +{ + dvbnet->dvbdev = (void *)1; + return 0; +} + +#endif + +#endif -- cgit v1.2.3 From fcc8e7d8c0e228cf032de0df049a91d5d2bfd0e9 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 1 Jun 2011 13:03:12 -0300 Subject: dvb_net: Simplify the code if DVB NET is not defined Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-core/dvb_net.h | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/media/dvb/dvb-core/dvb_net.h b/drivers/media/dvb/dvb-core/dvb_net.h index cfd2c46bd5d9..1e53acd50cf4 100644 --- a/drivers/media/dvb/dvb-core/dvb_net.h +++ b/drivers/media/dvb/dvb-core/dvb_net.h @@ -42,32 +42,25 @@ struct dvb_net { struct dmx_demux *demux; }; - void dvb_net_release(struct dvb_net *); int dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *); -#endif - -#ifndef CONFIG_DVB_NET - -struct dvb_dev_stub; +#else struct dvb_net { - struct dvb_dev_stub *dvbdev; + struct dvb_device *dvbdev; }; static inline void dvb_net_release(struct dvb_net *dvbnet) { - dvbnet->dvbdev = 0; } static inline int dvb_net_init(struct dvb_adapter *adap, struct dvb_net *dvbnet, struct dmx_demux *dmx) { - dvbnet->dvbdev = (void *)1; return 0; } -#endif +#endif /* ifdef CONFIG_DVB_NET */ #endif -- cgit v1.2.3 From fabc6b85ca1d364f4e3fdcf80f80b393a508e771 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Sat, 28 May 2011 14:36:28 -0300 Subject: [media] media: Convert vmalloc/memset to vzalloc Signed-off-by: Joe Perches Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/videobuf2-dma-sg.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/media/video/videobuf2-dma-sg.c b/drivers/media/video/videobuf2-dma-sg.c index 10a20d9509d9..065f468faf8f 100644 --- a/drivers/media/video/videobuf2-dma-sg.c +++ b/drivers/media/video/videobuf2-dma-sg.c @@ -48,12 +48,10 @@ static void *vb2_dma_sg_alloc(void *alloc_ctx, unsigned long size) buf->sg_desc.size = size; buf->sg_desc.num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; - buf->sg_desc.sglist = vmalloc(buf->sg_desc.num_pages * + buf->sg_desc.sglist = vzalloc(buf->sg_desc.num_pages * sizeof(*buf->sg_desc.sglist)); if (!buf->sg_desc.sglist) goto fail_sglist_alloc; - memset(buf->sg_desc.sglist, 0, buf->sg_desc.num_pages * - sizeof(*buf->sg_desc.sglist)); sg_init_table(buf->sg_desc.sglist, buf->sg_desc.num_pages); buf->pages = kzalloc(buf->sg_desc.num_pages * sizeof(struct page *), @@ -136,13 +134,11 @@ static void *vb2_dma_sg_get_userptr(void *alloc_ctx, unsigned long vaddr, last = ((vaddr + size - 1) & PAGE_MASK) >> PAGE_SHIFT; buf->sg_desc.num_pages = last - first + 1; - buf->sg_desc.sglist = vmalloc( + buf->sg_desc.sglist = vzalloc( buf->sg_desc.num_pages * sizeof(*buf->sg_desc.sglist)); if (!buf->sg_desc.sglist) goto userptr_fail_sglist_alloc; - memset(buf->sg_desc.sglist, 0, - buf->sg_desc.num_pages * sizeof(*buf->sg_desc.sglist)); sg_init_table(buf->sg_desc.sglist, buf->sg_desc.num_pages); buf->pages = kzalloc(buf->sg_desc.num_pages * sizeof(struct page *), -- cgit v1.2.3 From f54ba7f199d63cea08b8cc7114cb6c5cd9a042ab Mon Sep 17 00:00:00 2001 From: Alexey Khoroshilov Date: Tue, 31 May 2011 17:54:40 -0300 Subject: [media] radio-si470x: fix memory leak in si470x_usb_driver_probe() radio->int_in_urb is not deallocated on error paths in si470x_usb_driver_probe(). Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov Signed-off-by: Mauro Carvalho Chehab --- drivers/media/radio/si470x/radio-si470x-usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c b/drivers/media/radio/si470x/radio-si470x-usb.c index 392e84fe90ef..ccefdaea4dc5 100644 --- a/drivers/media/radio/si470x/radio-si470x-usb.c +++ b/drivers/media/radio/si470x/radio-si470x-usb.c @@ -699,7 +699,7 @@ static int si470x_usb_driver_probe(struct usb_interface *intf, radio->videodev = video_device_alloc(); if (!radio->videodev) { retval = -ENOMEM; - goto err_intbuffer; + goto err_urb; } memcpy(radio->videodev, &si470x_viddev_template, sizeof(si470x_viddev_template)); @@ -790,6 +790,8 @@ err_all: kfree(radio->buffer); err_video: video_device_release(radio->videodev); +err_urb: + usb_free_urb(radio->int_in_urb); err_intbuffer: kfree(radio->int_in_buffer); err_radio: -- cgit v1.2.3 From a5bef1d25212107b867f0161fdc2b7bf1b260cbd Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Mon, 23 May 2011 08:40:00 -0300 Subject: [media] itd1000: Don't reuse core macro names The dbg, warn and info macros are already defined by the USB stack. Rename these macros to avoid macro redefinition warnings. Refactor lineshift in printouts. Signed-off-by: Hans Petter Selasky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/itd1000.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/media/dvb/frontends/itd1000.c b/drivers/media/dvb/frontends/itd1000.c index f7a40a18777a..aa9ccb821fa5 100644 --- a/drivers/media/dvb/frontends/itd1000.c +++ b/drivers/media/dvb/frontends/itd1000.c @@ -35,21 +35,18 @@ static int debug; module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); -#define deb(args...) do { \ +#define itd_dbg(args...) do { \ if (debug) { \ printk(KERN_DEBUG "ITD1000: " args);\ - printk("\n"); \ } \ } while (0) -#define warn(args...) do { \ +#define itd_warn(args...) do { \ printk(KERN_WARNING "ITD1000: " args); \ - printk("\n"); \ } while (0) -#define info(args...) do { \ +#define itd_info(args...) do { \ printk(KERN_INFO "ITD1000: " args); \ - printk("\n"); \ } while (0) /* don't write more than one byte with flexcop behind */ @@ -62,7 +59,7 @@ static int itd1000_write_regs(struct itd1000_state *state, u8 reg, u8 v[], u8 le buf[0] = reg; memcpy(&buf[1], v, len); - /* deb("wr %02x: %02x", reg, v[0]); */ + /* itd_dbg("wr %02x: %02x\n", reg, v[0]); */ if (i2c_transfer(state->i2c, &msg, 1) != 1) { printk(KERN_WARNING "itd1000 I2C write failed\n"); @@ -83,7 +80,7 @@ static int itd1000_read_reg(struct itd1000_state *state, u8 reg) itd1000_write_regs(state, (reg - 1) & 0xff, &state->shadow[(reg - 1) & 0xff], 1); if (i2c_transfer(state->i2c, msg, 2) != 2) { - warn("itd1000 I2C read failed"); + itd_warn("itd1000 I2C read failed\n"); return -EREMOTEIO; } return val; @@ -127,14 +124,14 @@ static void itd1000_set_lpf_bw(struct itd1000_state *state, u32 symbol_rate) u8 bbgvmin = itd1000_read_reg(state, BBGVMIN) & 0xf0; u8 bw = itd1000_read_reg(state, BW) & 0xf0; - deb("symbol_rate = %d", symbol_rate); + itd_dbg("symbol_rate = %d\n", symbol_rate); /* not sure what is that ? - starting to download the table */ itd1000_write_reg(state, CON1, con1 | (1 << 1)); for (i = 0; i < ARRAY_SIZE(itd1000_lpf_pga); i++) if (symbol_rate < itd1000_lpf_pga[i].symbol_rate) { - deb("symrate: index: %d pgaext: %x, bbgvmin: %x", i, itd1000_lpf_pga[i].pgaext, itd1000_lpf_pga[i].bbgvmin); + itd_dbg("symrate: index: %d pgaext: %x, bbgvmin: %x\n", i, itd1000_lpf_pga[i].pgaext, itd1000_lpf_pga[i].bbgvmin); itd1000_write_reg(state, PLLFH, pllfh | (itd1000_lpf_pga[i].pgaext << 4)); itd1000_write_reg(state, BBGVMIN, bbgvmin | (itd1000_lpf_pga[i].bbgvmin)); itd1000_write_reg(state, BW, bw | (i & 0x0f)); @@ -182,7 +179,7 @@ static void itd1000_set_vco(struct itd1000_state *state, u32 freq_khz) adcout = itd1000_read_reg(state, PLLLOCK) & 0x0f; - deb("VCO: %dkHz: %d -> ADCOUT: %d %02x", freq_khz, itd1000_vcorg[i].vcorg, adcout, vco_chp1_i2c); + itd_dbg("VCO: %dkHz: %d -> ADCOUT: %d %02x\n", freq_khz, itd1000_vcorg[i].vcorg, adcout, vco_chp1_i2c); if (adcout > 13) { if (!(itd1000_vcorg[i].vcorg == 7 || itd1000_vcorg[i].vcorg == 15)) @@ -232,7 +229,7 @@ static void itd1000_set_lo(struct itd1000_state *state, u32 freq_khz) pllf = (u32) tmp; state->frequency = ((plln * 1000) + (pllf * 1000)/1048576) * 2*FREF; - deb("frequency: %dkHz (wanted) %dkHz (set), PLLF = %d, PLLN = %d", freq_khz, state->frequency, pllf, plln); + itd_dbg("frequency: %dkHz (wanted) %dkHz (set), PLLF = %d, PLLN = %d\n", freq_khz, state->frequency, pllf, plln); itd1000_write_reg(state, PLLNH, 0x80); /* PLLNH */; itd1000_write_reg(state, PLLNL, plln & 0xff); @@ -242,7 +239,7 @@ static void itd1000_set_lo(struct itd1000_state *state, u32 freq_khz) for (i = 0; i < ARRAY_SIZE(itd1000_fre_values); i++) { if (freq_khz <= itd1000_fre_values[i].freq) { - deb("fre_values: %d", i); + itd_dbg("fre_values: %d\n", i); itd1000_write_reg(state, RFTR, itd1000_fre_values[i].values[0]); for (j = 0; j < 9; j++) itd1000_write_reg(state, RFST1+j, itd1000_fre_values[i].values[j+1]); @@ -382,7 +379,7 @@ struct dvb_frontend *itd1000_attach(struct dvb_frontend *fe, struct i2c_adapter kfree(state); return NULL; } - info("successfully identified (ID: %d)", i); + itd_info("successfully identified (ID: %d)\n", i); memset(state->shadow, 0xff, sizeof(state->shadow)); for (i = 0x65; i < 0x9c; i++) -- cgit v1.2.3 From d294093010c86294baaaa414a412ea117bacd8fc Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Mon, 23 May 2011 08:42:40 -0300 Subject: [media] cx24113: Don't reuse core macro names The info and err macros are already defined by the USB stack. Rename these macros to avoid macro redefinition warnings. Signed-off-by: Hans Petter Selasky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/cx24113.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/media/dvb/frontends/cx24113.c b/drivers/media/dvb/frontends/cx24113.c index e9ee55592fd3..c341d57d5e81 100644 --- a/drivers/media/dvb/frontends/cx24113.c +++ b/drivers/media/dvb/frontends/cx24113.c @@ -31,8 +31,8 @@ static int debug; -#define info(args...) do { printk(KERN_INFO "CX24113: " args); } while (0) -#define err(args...) do { printk(KERN_ERR "CX24113: " args); } while (0) +#define cx_info(args...) do { printk(KERN_INFO "CX24113: " args); } while (0) +#define cx_err(args...) do { printk(KERN_ERR "CX24113: " args); } while (0) #define dprintk(args...) \ do { \ @@ -341,7 +341,7 @@ static void cx24113_calc_pll_nf(struct cx24113_state *state, u16 *n, s32 *f) } while (N < 6 && R < 3); if (N < 6) { - err("strange frequency: N < 6\n"); + cx_err("strange frequency: N < 6\n"); return; } F = freq_hz; @@ -563,7 +563,7 @@ struct dvb_frontend *cx24113_attach(struct dvb_frontend *fe, kzalloc(sizeof(struct cx24113_state), GFP_KERNEL); int rc; if (state == NULL) { - err("Unable to kzalloc\n"); + cx_err("Unable to kzalloc\n"); goto error; } @@ -571,7 +571,7 @@ struct dvb_frontend *cx24113_attach(struct dvb_frontend *fe, state->config = config; state->i2c = i2c; - info("trying to detect myself\n"); + cx_info("trying to detect myself\n"); /* making a dummy read, because of some expected troubles * after power on */ @@ -579,24 +579,24 @@ struct dvb_frontend *cx24113_attach(struct dvb_frontend *fe, rc = cx24113_readreg(state, 0x00); if (rc < 0) { - info("CX24113 not found.\n"); + cx_info("CX24113 not found.\n"); goto error; } state->rev = rc; switch (rc) { case 0x43: - info("detected CX24113 variant\n"); + cx_info("detected CX24113 variant\n"); break; case REV_CX24113: - info("successfully detected\n"); + cx_info("successfully detected\n"); break; default: - err("unsupported device id: %x\n", state->rev); + cx_err("unsupported device id: %x\n", state->rev); goto error; } state->ver = cx24113_readreg(state, 0x01); - info("version: %x\n", state->ver); + cx_info("version: %x\n", state->ver); /* create dvb_frontend */ memcpy(&fe->ops.tuner_ops, &cx24113_tuner_ops, -- cgit v1.2.3 From 9e8fa0e644a3ccb1b5807e4155c1c7a73793b371 Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Wed, 1 Jun 2011 16:57:11 -0300 Subject: [media] radio-sf16fmr2: convert to generic TEA575x interface Convert radio-sf16fmr2 to use generic TEA575x implementation. Most of the driver code goes away as SF16-FMR2 is basically just a TEA5757 tuner connected to ISA bus. The card can optionally be equipped with PT2254A volume control (equivalent of TC9154AP) - the volume setting is completely reworked (with balance control added) and tested. Signed-off-by: Ondrej Zary Acked-by: Takashi Iwai Signed-off-by: Mauro Carvalho Chehab --- drivers/media/radio/radio-sf16fmr2.c | 531 ++++++++++------------------------- sound/pci/Kconfig | 4 +- 2 files changed, 145 insertions(+), 390 deletions(-) diff --git a/drivers/media/radio/radio-sf16fmr2.c b/drivers/media/radio/radio-sf16fmr2.c index 87bad7678d92..2dd485996ba8 100644 --- a/drivers/media/radio/radio-sf16fmr2.c +++ b/drivers/media/radio/radio-sf16fmr2.c @@ -1,441 +1,209 @@ -/* SF16FMR2 radio driver for Linux radio support - * heavily based on fmi driver... - * (c) 2000-2002 Ziglio Frediano, freddy77@angelfire.com +/* SF16-FMR2 radio driver for Linux + * Copyright (c) 2011 Ondrej Zary * - * Notes on the hardware - * - * Frequency control is done digitally -- ie out(port,encodefreq(95.8)); - * No volume control - only mute/unmute - you have to use line volume - * - * For read stereo/mono you must wait 0.1 sec after set frequency and - * card unmuted so I set frequency on unmute - * Signal handling seem to work only on autoscanning (not implemented) - * - * Converted to V4L2 API by Mauro Carvalho Chehab + * Original driver was (c) 2000-2002 Ziglio Frediano, freddy77@angelfire.com + * but almost nothing remained here after conversion to generic TEA575x + * implementation */ +#include #include /* Modules */ #include /* Initdata */ #include /* request_region */ -#include /* udelay */ -#include /* kernel radio structs */ -#include -#include /* for KERNEL_VERSION MACRO */ #include /* outb, outb_p */ -#include -#include +#include -MODULE_AUTHOR("Ziglio Frediano, freddy77@angelfire.com"); -MODULE_DESCRIPTION("A driver for the SF16FMR2 radio."); +MODULE_AUTHOR("Ondrej Zary"); +MODULE_DESCRIPTION("MediaForte SF16-FMR2 FM radio card driver"); MODULE_LICENSE("GPL"); -static int io = 0x384; -static int radio_nr = -1; - -module_param(io, int, 0); -MODULE_PARM_DESC(io, "I/O address of the SF16FMR2 card (should be 0x384, if do not work try 0x284)"); -module_param(radio_nr, int, 0); - -#define RADIO_VERSION KERNEL_VERSION(0,0,2) - -#define AUD_VOL_INDEX 1 - -#undef DEBUG -//#define DEBUG 1 - -#ifdef DEBUG -# define debug_print(s) printk s -#else -# define debug_print(s) -#endif - -/* this should be static vars for module size */ -struct fmr2 -{ - struct v4l2_device v4l2_dev; - struct video_device vdev; - struct mutex lock; +struct fmr2 { int io; - int curvol; /* 0-15 */ - int mute; - int stereo; /* card is producing stereo audio */ - unsigned long curfreq; /* freq in kHz */ - int card_type; + struct snd_tea575x tea; + struct v4l2_ctrl *volume; + struct v4l2_ctrl *balance; }; +/* the port is hardwired so no need to support multiple cards */ +#define FMR2_PORT 0x384 static struct fmr2 fmr2_card; -/* hw precision is 12.5 kHz - * It is only useful to give freq in interval of 200 (=0.0125Mhz), - * other bits will be truncated - */ -#define RSF16_ENCODE(x) ((x) / 200 + 856) -#define RSF16_MINFREQ (87 * 16000) -#define RSF16_MAXFREQ (108 * 16000) - -static inline void wait(int n, int io) -{ - for (; n; --n) - inb(io); -} - -static void outbits(int bits, unsigned int data, int nWait, int io) -{ - int bit; - - for (; --bits >= 0;) { - bit = (data >> bits) & 1; - outb(bit, io); - wait(nWait, io); - outb(bit | 2, io); - wait(nWait, io); - outb(bit, io); - wait(nWait, io); - } -} - -static inline void fmr2_mute(int io) -{ - outb(0x00, io); - wait(4, io); -} - -static inline void fmr2_unmute(int io) -{ - outb(0x04, io); - wait(4, io); -} - -static inline int fmr2_stereo_mode(int io) -{ - int n = inb(io); - - outb(6, io); - inb(io); - n = ((n >> 3) & 1) ^ 1; - debug_print((KERN_DEBUG "stereo: %d\n", n)); - return n; -} - -static int fmr2_product_info(struct fmr2 *dev) -{ - int n = inb(dev->io); - - n &= 0xC1; - if (n == 0) { - /* this should support volume set */ - dev->card_type = 12; - return 0; - } - /* not volume (mine is 11) */ - dev->card_type = (n == 128) ? 11 : 0; - return n; -} +/* TEA575x tuner pins */ +#define STR_DATA (1 << 0) +#define STR_CLK (1 << 1) +#define STR_WREN (1 << 2) +#define STR_MOST (1 << 3) +/* PT2254A/TC9154A volume control pins */ +#define PT_ST (1 << 4) +#define PT_CK (1 << 5) +#define PT_DATA (1 << 6) +/* volume control presence pin */ +#define FMR2_HASVOL (1 << 7) -static inline int fmr2_getsigstr(struct fmr2 *dev) +static void fmr2_tea575x_set_pins(struct snd_tea575x *tea, u8 pins) { - /* !!! works only if scanning freq */ - int res = 0xffff; - - outb(5, dev->io); - wait(4, dev->io); - if (!(inb(dev->io) & 1)) - res = 0; - debug_print((KERN_DEBUG "signal: %d\n", res)); - return res; -} - -/* set frequency and unmute card */ -static int fmr2_setfreq(struct fmr2 *dev) -{ - unsigned long freq = dev->curfreq; - - fmr2_mute(dev->io); - - /* 0x42 for mono output - * 0x102 forward scanning - * 0x182 scansione avanti - */ - outbits(9, 0x2, 3, dev->io); - outbits(16, RSF16_ENCODE(freq), 2, dev->io); - - fmr2_unmute(dev->io); + struct fmr2 *fmr2 = tea->private_data; + u8 bits = 0; - /* wait 0.11 sec */ - msleep(110); + bits |= (pins & TEA575X_DATA) ? STR_DATA : 0; + bits |= (pins & TEA575X_CLK) ? STR_CLK : 0; + /* WRITE_ENABLE is inverted, DATA must be high during read */ + bits |= (pins & TEA575X_WREN) ? 0 : STR_WREN | STR_DATA; - /* NOTE if mute this stop radio - you must set freq on unmute */ - dev->stereo = fmr2_stereo_mode(dev->io); - return 0; -} - -/* !!! not tested, in my card this doesn't work !!! */ -static int fmr2_setvolume(struct fmr2 *dev) -{ - int vol[16] = { 0x021, 0x084, 0x090, 0x104, - 0x110, 0x204, 0x210, 0x402, - 0x404, 0x408, 0x410, 0x801, - 0x802, 0x804, 0x808, 0x810 }; - int i, a; - int n = vol[dev->curvol & 0x0f]; - - if (dev->card_type != 11) - return 1; - - for (i = 12; --i >= 0; ) { - a = ((n >> i) & 1) << 6; /* if (a==0) a = 0; else a = 0x40; */ - outb(a | 4, dev->io); - wait(4, dev->io); - outb(a | 0x24, dev->io); - wait(4, dev->io); - outb(a | 4, dev->io); - wait(4, dev->io); - } - for (i = 6; --i >= 0; ) { - a = ((0x18 >> i) & 1) << 6; - outb(a | 4, dev->io); - wait(4, dev->io); - outb(a | 0x24, dev->io); - wait(4, dev->io); - outb(a | 4, dev->io); - wait(4, dev->io); - } - wait(4, dev->io); - outb(0x14, dev->io); - return 0; + outb(bits, fmr2->io); } -static int vidioc_querycap(struct file *file, void *priv, - struct v4l2_capability *v) +static u8 fmr2_tea575x_get_pins(struct snd_tea575x *tea) { - strlcpy(v->driver, "radio-sf16fmr2", sizeof(v->driver)); - strlcpy(v->card, "SF16-FMR2 radio", sizeof(v->card)); - strlcpy(v->bus_info, "ISA", sizeof(v->bus_info)); - v->version = RADIO_VERSION; - v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO; - return 0; -} - -static int vidioc_g_tuner(struct file *file, void *priv, - struct v4l2_tuner *v) -{ - struct fmr2 *fmr2 = video_drvdata(file); - - if (v->index > 0) - return -EINVAL; + struct fmr2 *fmr2 = tea->private_data; + u8 bits = inb(fmr2->io); - strlcpy(v->name, "FM", sizeof(v->name)); - v->type = V4L2_TUNER_RADIO; - - v->rangelow = RSF16_MINFREQ; - v->rangehigh = RSF16_MAXFREQ; - v->rxsubchans = fmr2->stereo ? V4L2_TUNER_SUB_STEREO : - V4L2_TUNER_SUB_MONO; - v->capability = V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_LOW; - v->audmode = V4L2_TUNER_MODE_STEREO; - mutex_lock(&fmr2->lock); - v->signal = fmr2_getsigstr(fmr2); - mutex_unlock(&fmr2->lock); - return 0; + return (bits & STR_DATA) ? TEA575X_DATA : 0 | + (bits & STR_MOST) ? TEA575X_MOST : 0; } -static int vidioc_s_tuner(struct file *file, void *priv, - struct v4l2_tuner *v) +static void fmr2_tea575x_set_direction(struct snd_tea575x *tea, bool output) { - return v->index ? -EINVAL : 0; } -static int vidioc_s_frequency(struct file *file, void *priv, - struct v4l2_frequency *f) -{ - struct fmr2 *fmr2 = video_drvdata(file); +static struct snd_tea575x_ops fmr2_tea_ops = { + .set_pins = fmr2_tea575x_set_pins, + .get_pins = fmr2_tea575x_get_pins, + .set_direction = fmr2_tea575x_set_direction, +}; - if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO) - return -EINVAL; - if (f->frequency < RSF16_MINFREQ || - f->frequency > RSF16_MAXFREQ) - return -EINVAL; - /* rounding in steps of 200 to match the freq - that will be used */ - fmr2->curfreq = (f->frequency / 200) * 200; - - /* set card freq (if not muted) */ - if (fmr2->curvol && !fmr2->mute) { - mutex_lock(&fmr2->lock); - fmr2_setfreq(fmr2); - mutex_unlock(&fmr2->lock); +/* TC9154A/PT2254A volume control */ + +/* 18-bit shift register bit definitions */ +#define TC9154A_ATT_MAJ_0DB (1 << 0) +#define TC9154A_ATT_MAJ_10DB (1 << 1) +#define TC9154A_ATT_MAJ_20DB (1 << 2) +#define TC9154A_ATT_MAJ_30DB (1 << 3) +#define TC9154A_ATT_MAJ_40DB (1 << 4) +#define TC9154A_ATT_MAJ_50DB (1 << 5) +#define TC9154A_ATT_MAJ_60DB (1 << 6) + +#define TC9154A_ATT_MIN_0DB (1 << 7) +#define TC9154A_ATT_MIN_2DB (1 << 8) +#define TC9154A_ATT_MIN_4DB (1 << 9) +#define TC9154A_ATT_MIN_6DB (1 << 10) +#define TC9154A_ATT_MIN_8DB (1 << 11) +/* bit 12 is ignored */ +#define TC9154A_CHANNEL_LEFT (1 << 13) +#define TC9154A_CHANNEL_RIGHT (1 << 14) +/* bits 15, 16, 17 must be 0 */ + +#define TC9154A_ATT_MAJ(x) (1 << x) +#define TC9154A_ATT_MIN(x) (1 << (7 + x)) + +static void tc9154a_set_pins(struct fmr2 *fmr2, u8 pins) +{ + if (!fmr2->tea.mute) + pins |= STR_WREN; + + outb(pins, fmr2->io); +} + +static void tc9154a_set_attenuation(struct fmr2 *fmr2, int att, u32 channel) +{ + int i; + u32 reg; + u8 bit; + + reg = TC9154A_ATT_MAJ(att / 10) | TC9154A_ATT_MIN((att % 10) / 2); + reg |= channel; + /* write 18-bit shift register, LSB first */ + for (i = 0; i < 18; i++) { + bit = reg & (1 << i) ? PT_DATA : 0; + tc9154a_set_pins(fmr2, bit); + udelay(5); + tc9154a_set_pins(fmr2, bit | PT_CK); + udelay(5); + tc9154a_set_pins(fmr2, bit); } - return 0; -} - -static int vidioc_g_frequency(struct file *file, void *priv, - struct v4l2_frequency *f) -{ - struct fmr2 *fmr2 = video_drvdata(file); - - if (f->tuner != 0) - return -EINVAL; - f->type = V4L2_TUNER_RADIO; - f->frequency = fmr2->curfreq; - return 0; -} -static int vidioc_queryctrl(struct file *file, void *priv, - struct v4l2_queryctrl *qc) -{ - struct fmr2 *fmr2 = video_drvdata(file); - - switch (qc->id) { - case V4L2_CID_AUDIO_MUTE: - return v4l2_ctrl_query_fill(qc, 0, 1, 1, 1); - case V4L2_CID_AUDIO_VOLUME: - /* Only card_type == 11 implements volume */ - if (fmr2->card_type == 11) - return v4l2_ctrl_query_fill(qc, 0, 15, 1, 0); - return v4l2_ctrl_query_fill(qc, 0, 1, 1, 0); - } - return -EINVAL; + /* latch register data */ + udelay(5); + tc9154a_set_pins(fmr2, PT_ST); + udelay(5); + tc9154a_set_pins(fmr2, 0); } -static int vidioc_g_ctrl(struct file *file, void *priv, - struct v4l2_control *ctrl) +static int fmr2_s_ctrl(struct v4l2_ctrl *ctrl) { - struct fmr2 *fmr2 = video_drvdata(file); + struct snd_tea575x *tea = container_of(ctrl->handler, struct snd_tea575x, ctrl_handler); + struct fmr2 *fmr2 = tea->private_data; + int volume, balance, left, right; switch (ctrl->id) { - case V4L2_CID_AUDIO_MUTE: - ctrl->value = fmr2->mute; - return 0; case V4L2_CID_AUDIO_VOLUME: - ctrl->value = fmr2->curvol; - return 0; - } - return -EINVAL; -} - -static int vidioc_s_ctrl(struct file *file, void *priv, - struct v4l2_control *ctrl) -{ - struct fmr2 *fmr2 = video_drvdata(file); - - switch (ctrl->id) { - case V4L2_CID_AUDIO_MUTE: - fmr2->mute = ctrl->value; + volume = ctrl->val; + balance = fmr2->balance->cur.val; break; - case V4L2_CID_AUDIO_VOLUME: - fmr2->curvol = ctrl->value; + case V4L2_CID_AUDIO_BALANCE: + balance = ctrl->val; + volume = fmr2->volume->cur.val; break; default: return -EINVAL; } -#ifdef DEBUG - if (fmr2->curvol && !fmr2->mute) - printk(KERN_DEBUG "unmute\n"); - else - printk(KERN_DEBUG "mute\n"); -#endif - - mutex_lock(&fmr2->lock); - if (fmr2->curvol && !fmr2->mute) { - fmr2_setvolume(fmr2); - /* Set frequency and unmute card */ - fmr2_setfreq(fmr2); - } else - fmr2_mute(fmr2->io); - mutex_unlock(&fmr2->lock); - return 0; -} - -static int vidioc_g_input(struct file *filp, void *priv, unsigned int *i) -{ - *i = 0; - return 0; -} + left = right = volume; + if (balance < 0) + right = max(0, right + balance); + if (balance > 0) + left = max(0, left - balance); -static int vidioc_s_input(struct file *filp, void *priv, unsigned int i) -{ - return i ? -EINVAL : 0; -} + tc9154a_set_attenuation(fmr2, abs(left - 68), TC9154A_CHANNEL_LEFT); + tc9154a_set_attenuation(fmr2, abs(right - 68), TC9154A_CHANNEL_RIGHT); -static int vidioc_g_audio(struct file *file, void *priv, - struct v4l2_audio *a) -{ - a->index = 0; - strlcpy(a->name, "Radio", sizeof(a->name)); - a->capability = V4L2_AUDCAP_STEREO; return 0; } -static int vidioc_s_audio(struct file *file, void *priv, - struct v4l2_audio *a) +static const struct v4l2_ctrl_ops fmr2_ctrl_ops = { + .s_ctrl = fmr2_s_ctrl, +}; + +static int fmr2_tea_ext_init(struct snd_tea575x *tea) { - return a->index ? -EINVAL : 0; -} + struct fmr2 *fmr2 = tea->private_data; -static const struct v4l2_file_operations fmr2_fops = { - .owner = THIS_MODULE, - .unlocked_ioctl = video_ioctl2, -}; + if (inb(fmr2->io) & FMR2_HASVOL) { + fmr2->volume = v4l2_ctrl_new_std(&tea->ctrl_handler, &fmr2_ctrl_ops, V4L2_CID_AUDIO_VOLUME, 0, 68, 2, 56); + fmr2->balance = v4l2_ctrl_new_std(&tea->ctrl_handler, &fmr2_ctrl_ops, V4L2_CID_AUDIO_BALANCE, -68, 68, 2, 0); + if (tea->ctrl_handler.error) { + printk(KERN_ERR "radio-sf16fmr2: can't initialize contrls\n"); + return tea->ctrl_handler.error; + } + } -static const struct v4l2_ioctl_ops fmr2_ioctl_ops = { - .vidioc_querycap = vidioc_querycap, - .vidioc_g_tuner = vidioc_g_tuner, - .vidioc_s_tuner = vidioc_s_tuner, - .vidioc_g_audio = vidioc_g_audio, - .vidioc_s_audio = vidioc_s_audio, - .vidioc_g_input = vidioc_g_input, - .vidioc_s_input = vidioc_s_input, - .vidioc_g_frequency = vidioc_g_frequency, - .vidioc_s_frequency = vidioc_s_frequency, - .vidioc_queryctrl = vidioc_queryctrl, - .vidioc_g_ctrl = vidioc_g_ctrl, - .vidioc_s_ctrl = vidioc_s_ctrl, -}; + return 0; +} static int __init fmr2_init(void) { struct fmr2 *fmr2 = &fmr2_card; - struct v4l2_device *v4l2_dev = &fmr2->v4l2_dev; - int res; - strlcpy(v4l2_dev->name, "sf16fmr2", sizeof(v4l2_dev->name)); - fmr2->io = io; - fmr2->stereo = 1; - mutex_init(&fmr2->lock); + fmr2->io = FMR2_PORT; - if (!request_region(fmr2->io, 2, "sf16fmr2")) { - v4l2_err(v4l2_dev, "request_region failed!\n"); + if (!request_region(fmr2->io, 2, "SF16-FMR2")) { + printk(KERN_ERR "radio-sf16fmr2: I/O port 0x%x already in use\n", fmr2->io); return -EBUSY; } - res = v4l2_device_register(NULL, v4l2_dev); - if (res < 0) { - release_region(fmr2->io, 2); - v4l2_err(v4l2_dev, "Could not register v4l2_device\n"); - return res; - } + fmr2->tea.private_data = fmr2; + fmr2->tea.ops = &fmr2_tea_ops; + fmr2->tea.ext_init = fmr2_tea_ext_init; + strlcpy(fmr2->tea.card, "SF16-FMR2", sizeof(fmr2->tea.card)); + strcpy(fmr2->tea.bus_info, "ISA"); - strlcpy(fmr2->vdev.name, v4l2_dev->name, sizeof(fmr2->vdev.name)); - fmr2->vdev.v4l2_dev = v4l2_dev; - fmr2->vdev.fops = &fmr2_fops; - fmr2->vdev.ioctl_ops = &fmr2_ioctl_ops; - fmr2->vdev.release = video_device_release_empty; - video_set_drvdata(&fmr2->vdev, fmr2); - - /* mute card - prevents noisy bootups */ - fmr2_mute(fmr2->io); - fmr2_product_info(fmr2); - - if (video_register_device(&fmr2->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { - v4l2_device_unregister(v4l2_dev); + if (snd_tea575x_init(&fmr2->tea)) { + printk(KERN_ERR "radio-sf16fmr2: Unable to detect TEA575x tuner\n"); release_region(fmr2->io, 2); - return -EINVAL; + return -ENODEV; } - v4l2_info(v4l2_dev, "SF16FMR2 radio card driver at 0x%x.\n", fmr2->io); - debug_print((KERN_DEBUG "card_type %d\n", fmr2->card_type)); + printk(KERN_INFO "radio-sf16fmr2: SF16-FMR2 radio card at 0x%x.\n", fmr2->io); return 0; } @@ -443,22 +211,9 @@ static void __exit fmr2_exit(void) { struct fmr2 *fmr2 = &fmr2_card; - video_unregister_device(&fmr2->vdev); - v4l2_device_unregister(&fmr2->v4l2_dev); + snd_tea575x_exit(&fmr2->tea); release_region(fmr2->io, 2); } module_init(fmr2_init); module_exit(fmr2_exit); - -#ifndef MODULE - -static int __init fmr2_setup_io(char *str) -{ - get_option(&str, &io); - return 1; -} - -__setup("sf16fmr2=", fmr2_setup_io); - -#endif diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig index e90d103e177e..50abf5bf8e09 100644 --- a/sound/pci/Kconfig +++ b/sound/pci/Kconfig @@ -565,8 +565,8 @@ config SND_FM801_TEA575X_BOOL config SND_TEA575X tristate - depends on SND_FM801_TEA575X_BOOL || SND_ES1968_RADIO - default SND_FM801 || SND_ES1968 + depends on SND_FM801_TEA575X_BOOL || SND_ES1968_RADIO || RADIO_SF16FMR2 + default SND_FM801 || SND_ES1968 || RADIO_SF16FMR2 source "sound/pci/hda/Kconfig" -- cgit v1.2.3 From 147b68cd7e093ea576280a2961734a74ee7e7090 Mon Sep 17 00:00:00 2001 From: Manoel Pinheiro Date: Sat, 7 May 2011 03:49:13 -0300 Subject: [media] dvb-usb.h function rc5_scan The function "rc5_scan" in "dvb_usb.h" is returning invalid value. The value should be returned "u16" but is returning "u8". See example below in "drivers/media/dvb/dvb-usb/opera1.c": send_key = (send_key & 0xffff) | 0x0100; for (i = 0; i < ARRAY_SIZE(rc_map_opera1_table); i++) { if (rc5_scan(&rc_map_opera1_table[i]) == (send_key & 0xffff)) { *state = REMOTE_KEY_PRESSED; *event = rc_map_opera1_table[i].keycode; opst->last_key_pressed = rc_map_opera1_table[i].keycode; break; } opst->last_key_pressed = 0; } Signed-off-by: Manoel Pinheiro Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/dvb-usb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h index 76a80968482a..7d35d078342b 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb.h @@ -85,7 +85,7 @@ static inline u8 rc5_data(struct rc_map_table *key) return key->scancode & 0xff; } -static inline u8 rc5_scan(struct rc_map_table *key) +static inline u16 rc5_scan(struct rc_map_table *key) { return key->scancode & 0xffff; } -- cgit v1.2.3 From 7f116b3ea908e277132fd68c5ff4c46284ae2d97 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Wed, 1 Jun 2011 17:19:22 -0300 Subject: [media] V4L/videobuf2-memops: use pr_debug for debug messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise they clutter the dmesg buffer even on a production kernel. Signed-off-by: Uwe Kleine-König Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/videobuf2-memops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/videobuf2-memops.c b/drivers/media/video/videobuf2-memops.c index 5370a3a7ee25..1987e1b13b95 100644 --- a/drivers/media/video/videobuf2-memops.c +++ b/drivers/media/video/videobuf2-memops.c @@ -177,7 +177,7 @@ int vb2_mmap_pfn_range(struct vm_area_struct *vma, unsigned long paddr, vma->vm_ops->open(vma); - printk(KERN_DEBUG "%s: mapped paddr 0x%08lx at 0x%08lx, size %ld\n", + pr_debug("%s: mapped paddr 0x%08lx at 0x%08lx, size %ld\n", __func__, paddr, vma->vm_start, size); return 0; @@ -195,7 +195,7 @@ static void vb2_common_vm_open(struct vm_area_struct *vma) { struct vb2_vmarea_handler *h = vma->vm_private_data; - printk(KERN_DEBUG "%s: %p, refcount: %d, vma: %08lx-%08lx\n", + pr_debug("%s: %p, refcount: %d, vma: %08lx-%08lx\n", __func__, h, atomic_read(h->refcount), vma->vm_start, vma->vm_end); @@ -213,7 +213,7 @@ static void vb2_common_vm_close(struct vm_area_struct *vma) { struct vb2_vmarea_handler *h = vma->vm_private_data; - printk(KERN_DEBUG "%s: %p, refcount: %d, vma: %08lx-%08lx\n", + pr_debug("%s: %p, refcount: %d, vma: %08lx-%08lx\n", __func__, h, atomic_read(h->refcount), vma->vm_start, vma->vm_end); -- cgit v1.2.3 From ec05a642140c7c34f7ba1cb8a94be9b1154286ae Mon Sep 17 00:00:00 2001 From: Andreas Oberritter Date: Thu, 26 May 2011 07:54:14 -0300 Subject: [media] DVB: dvb_frontend: fix dtv_property_dump for DTV_DVBT2_PLP_ID - Add missing entry to array "dtv_cmds". - Set array size to DTV_MAX_COMMAND + 1 to avoid future off-by-ones. Reported-by: Dan Carpenter Signed-off-by: Andreas Oberritter Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-core/dvb_frontend.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 5b6b451d4694..efe9c30605e8 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -904,7 +904,7 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe) .buffer = b \ } -static struct dtv_cmds_h dtv_cmds[] = { +static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = { _DTV_CMD(DTV_TUNE, 1, 0), _DTV_CMD(DTV_CLEAR, 1, 0), @@ -966,6 +966,7 @@ static struct dtv_cmds_h dtv_cmds[] = { _DTV_CMD(DTV_ISDBT_LAYERC_TIME_INTERLEAVING, 0, 0), _DTV_CMD(DTV_ISDBS_TS_ID, 1, 0), + _DTV_CMD(DTV_DVBT2_PLP_ID, 1, 0), /* Get */ _DTV_CMD(DTV_DISEQC_SLAVE_REPLY, 0, 1), -- cgit v1.2.3 From 0528f354cfb98d8df32a76302ec07af1aa29dbd4 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 26 May 2011 05:52:01 -0300 Subject: [media] rc: double unlock in rc_register_device() If change_protocol() fails and we goto out_raw, then it calls unlock twice. I noticed that the other time we called change_protocol() we held the &dev->lock, so I changed it to hold it here too. Reviewed-by: Jarod Wilson Acked-by: Jarod Wilson Signed-off-by: Dan Carpenter Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/rc-main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 3186ac7c2c10..30634ab5c226 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -1099,7 +1099,6 @@ int rc_register_device(struct rc_dev *dev) if (rc < 0) goto out_input; } - mutex_unlock(&dev->lock); if (dev->change_protocol) { rc = dev->change_protocol(dev, rc_map->rc_type); @@ -1107,6 +1106,8 @@ int rc_register_device(struct rc_dev *dev) goto out_raw; } + mutex_unlock(&dev->lock); + IR_dprintk(1, "Registered rc%ld (driver: %s, remote: %s, mode %s)\n", dev->devno, dev->driver_name ? dev->driver_name : "unknown", -- cgit v1.2.3 From 7eb75715460026c82afd20e42ee51f4b30fe4bae Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 26 May 2011 05:55:08 -0300 Subject: [media] rc/redrat3: dereferencing null pointer In the original code, if the allocation failed we dereference "rr3" when it was NULL. Acked-by: Jarod Wilson Signed-off-by: Dan Carpenter Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/redrat3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c index 5147767ccb78..4582ef72d963 100644 --- a/drivers/media/rc/redrat3.c +++ b/drivers/media/rc/redrat3.c @@ -1186,7 +1186,7 @@ static int __devinit redrat3_dev_probe(struct usb_interface *intf, rr3 = kzalloc(sizeof(*rr3), GFP_KERNEL); if (rr3 == NULL) { dev_err(dev, "Memory allocation failure\n"); - goto error; + goto no_endpoints; } rr3->dev = &intf->dev; -- cgit v1.2.3 From b87f2eddfaa2e74b51978f7c8671f3f4777af3fe Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Wed, 30 Mar 2011 11:20:14 -0300 Subject: [media] rc-core: fix winbond-cir issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The conversion of winbond-cir to use rc-core seems to have missed a a few bits and pieces which were in my local tree. Kudos to Juan Jesús García de Soria Lucena for noticing. [mchehab@redhat.com: fix two UTF-8 violations] Signed-off-by: David Härdeman Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/winbond-cir.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c index 5d06b899e859..18e70d104f80 100644 --- a/drivers/media/rc/winbond-cir.c +++ b/drivers/media/rc/winbond-cir.c @@ -6,8 +6,8 @@ * could probably support others (Winbond WEC102X, NatSemi, etc) * with minor modifications. * - * Original Author: David Härdeman - * Copyright (C) 2009 - 2010 David Härdeman + * Original Author: David Härdeman + * Copyright (C) 2009 - 2011 David Härdeman * * Dedicated to my daughter Matilda, without whose loving attention this * driver would have been finished in half the time and with a fraction @@ -876,18 +876,8 @@ wbcir_init_hw(struct wbcir_data *data) /* prescaler 1.0, tx/rx fifo lvl 16 */ outb(0x30, data->sbase + WBCIR_REG_SP3_EXCR2); - /* Set baud divisor to generate one byte per bit/cell */ - switch (protocol) { - case IR_PROTOCOL_RC5: - outb(0xA7, data->sbase + WBCIR_REG_SP3_BGDL); - break; - case IR_PROTOCOL_RC6: - outb(0x53, data->sbase + WBCIR_REG_SP3_BGDL); - break; - case IR_PROTOCOL_NEC: - outb(0x69, data->sbase + WBCIR_REG_SP3_BGDL); - break; - } + /* Set baud divisor to sample every 10 us */ + outb(0x0F, data->sbase + WBCIR_REG_SP3_BGDL); outb(0x00, data->sbase + WBCIR_REG_SP3_BGDH); /* Set CEIR mode */ @@ -896,9 +886,9 @@ wbcir_init_hw(struct wbcir_data *data) inb(data->sbase + WBCIR_REG_SP3_LSR); /* Clear LSR */ inb(data->sbase + WBCIR_REG_SP3_MSR); /* Clear MSR */ - /* Disable RX demod, run-length encoding/decoding, set freq span */ + /* Disable RX demod, enable run-length enc/dec, set freq span */ wbcir_select_bank(data, WBCIR_BANK_7); - outb(0x10, data->sbase + WBCIR_REG_SP3_RCCFG); + outb(0x90, data->sbase + WBCIR_REG_SP3_RCCFG); /* Disable timer */ wbcir_select_bank(data, WBCIR_BANK_4); -- cgit v1.2.3 From 1048af2f810b3d08210c600ca3c8e84877edbbc7 Mon Sep 17 00:00:00 2001 From: Johannes Obermaier Date: Thu, 2 Jun 2011 12:17:51 -0300 Subject: [media] mt9v011: Fixed incorrect value for the first valid column According to the datasheet (page 8), the first optical clear pixel-column is not at position 14. The correct/recommended value is 20. Without this patch there is a dark line on the left side of the image. Tested-by: Mauro Carvalho Chehab Signed-off-by: Johannes Obermaier Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/mt9v011.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/mt9v011.c b/drivers/media/video/mt9v011.c index 4904d25f689f..a6cf05aa4550 100644 --- a/drivers/media/video/mt9v011.c +++ b/drivers/media/video/mt9v011.c @@ -286,7 +286,7 @@ static void set_res(struct v4l2_subdev *sd) * be missing. */ - hstart = 14 + (640 - core->width) / 2; + hstart = 20 + (640 - core->width) / 2; mt9v011_write(sd, R02_MT9V011_COLSTART, hstart); mt9v011_write(sd, R04_MT9V011_WIDTH, core->width); mt9v011_write(sd, R05_MT9V011_HBLANK, 771 - core->width); -- cgit v1.2.3 From 590929f32adc3aaa702c287b624a0d0382730088 Mon Sep 17 00:00:00 2001 From: Johannes Obermaier Date: Thu, 2 Jun 2011 12:43:14 -0300 Subject: [media] mt9v011: Added exposure for mt9v011 There are problems when you use this camera/sensor in a very bright room or outside. The image is completely white, because it is overexposed. The driver uses a default value which is not suitable for all environments. This patch makes it possible to adjust the exposure time by youself. I found out by logging the i2c-data, that the windows driver for this sensor is doing this, too. I tested the camera on a sunny day and after adjusting the exposure time, I was able to see a very good image. Tested-by: Mauro Carvalho Chehab Signed-off-by: Johannes Obermaier Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/mt9v011.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/mt9v011.c b/drivers/media/video/mt9v011.c index a6cf05aa4550..fbbd018c94ab 100644 --- a/drivers/media/video/mt9v011.c +++ b/drivers/media/video/mt9v011.c @@ -58,6 +58,15 @@ static struct v4l2_queryctrl mt9v011_qctrl[] = { .step = 1, .default_value = 0x0020, .flags = 0, + }, { + .id = V4L2_CID_EXPOSURE, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Exposure", + .minimum = 0, + .maximum = 2047, + .step = 1, + .default_value = 0x01fc, + .flags = 0, }, { .id = V4L2_CID_RED_BALANCE, .type = V4L2_CTRL_TYPE_INTEGER, @@ -105,7 +114,7 @@ struct mt9v011 { unsigned hflip:1; unsigned vflip:1; - u16 global_gain, red_bal, blue_bal; + u16 global_gain, exposure, red_bal, blue_bal; }; static inline struct mt9v011 *to_mt9v011(struct v4l2_subdev *sd) @@ -184,6 +193,9 @@ static void set_balance(struct v4l2_subdev *sd) { struct mt9v011 *core = to_mt9v011(sd); u16 green1_gain, green2_gain, blue_gain, red_gain; + u16 exposure; + + exposure = core->exposure; green1_gain = core->global_gain; green2_gain = core->global_gain; @@ -198,6 +210,7 @@ static void set_balance(struct v4l2_subdev *sd) mt9v011_write(sd, R2E_MT9V011_GREEN_2_GAIN, green1_gain); mt9v011_write(sd, R2C_MT9V011_BLUE_GAIN, blue_gain); mt9v011_write(sd, R2D_MT9V011_RED_GAIN, red_gain); + mt9v011_write(sd, R09_MT9V011_SHUTTER_WIDTH, exposure); } static void calc_fps(struct v4l2_subdev *sd, u32 *numerator, u32 *denominator) @@ -338,6 +351,9 @@ static int mt9v011_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) case V4L2_CID_GAIN: ctrl->value = core->global_gain; return 0; + case V4L2_CID_EXPOSURE: + ctrl->value = core->exposure; + return 0; case V4L2_CID_RED_BALANCE: ctrl->value = core->red_bal; return 0; @@ -392,6 +408,9 @@ static int mt9v011_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) case V4L2_CID_GAIN: core->global_gain = ctrl->value; break; + case V4L2_CID_EXPOSURE: + core->exposure = ctrl->value; + break; case V4L2_CID_RED_BALANCE: core->red_bal = ctrl->value; break; @@ -598,6 +617,7 @@ static int mt9v011_probe(struct i2c_client *c, } core->global_gain = 0x0024; + core->exposure = 0x01fc; core->width = 640; core->height = 480; core->xtal = 27000000; /* Hz */ -- cgit v1.2.3 From 32127363eebdf63be2f375ed94838a4cdb1d6fe0 Mon Sep 17 00:00:00 2001 From: Johannes Obermaier Date: Thu, 2 Jun 2011 13:03:41 -0300 Subject: [media] mt9v011: Fixed gain calculation The implementation of the gain calculation for this sensor is incorrect. It is only working for the first 127 values. The reason is, that the gain cannot be set directly by writing a value into the gain registers of the sensor. The gain register work this way (see datasheet page 24): bits 0 to 6 are called "initial gain". These are linear. But bits 7 and 8 ("analog multiplicative factors") and bits 9 and 10 ("digital multiplicative factors") work completely different: Each of these bits increase the gain by the factor 2. So if the bits 7-10 are 0011, 0110, 1100 or 0101 for example, the gain from bits 0-6 is multiplied by 4. The order of the bits 7-10 is not important for the resulting gain. (But there are some recommended values for low noise) The current driver doesn't do this correctly: If the current gain is 000 0111 1111 (127) and the gain is increased by 1, you would expect the image to become brighter. But the image is completly dark, because the new gain is 000 1000 0000 (128). This means: Initial gain of 0, multiplied by 2. The result is 0. This patch adds a new function which does the gain calculation and also fixes the same bug for red_balance and blue_balance. Additionally, the driver follows the recommendation from the datasheet, which says, that the gain should always be above 0x0020. Tested-by: Mauro Carvalho Chehab Signed-off-by: Johannes Obermaier Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/mt9v011.c | 63 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 11 deletions(-) diff --git a/drivers/media/video/mt9v011.c b/drivers/media/video/mt9v011.c index fbbd018c94ab..893a8b8f5141 100644 --- a/drivers/media/video/mt9v011.c +++ b/drivers/media/video/mt9v011.c @@ -54,7 +54,7 @@ static struct v4l2_queryctrl mt9v011_qctrl[] = { .type = V4L2_CTRL_TYPE_INTEGER, .name = "Gain", .minimum = 0, - .maximum = (1 << 10) - 1, + .maximum = (1 << 12) - 1 - 0x0020, .step = 1, .default_value = 0x0020, .flags = 0, @@ -114,7 +114,8 @@ struct mt9v011 { unsigned hflip:1; unsigned vflip:1; - u16 global_gain, exposure, red_bal, blue_bal; + u16 global_gain, exposure; + s16 red_bal, blue_bal; }; static inline struct mt9v011 *to_mt9v011(struct v4l2_subdev *sd) @@ -189,25 +190,65 @@ static const struct i2c_reg_value mt9v011_init_default[] = { { R07_MT9V011_OUT_CTRL, 0x0002 }, /* chip enable */ }; + +static u16 calc_mt9v011_gain(s16 lineargain) +{ + + u16 digitalgain = 0; + u16 analogmult = 0; + u16 analoginit = 0; + + if (lineargain < 0) + lineargain = 0; + + /* recommended minimum */ + lineargain += 0x0020; + + if (lineargain > 2047) + lineargain = 2047; + + if (lineargain > 1023) { + digitalgain = 3; + analogmult = 3; + analoginit = lineargain / 16; + } else if (lineargain > 511) { + digitalgain = 1; + analogmult = 3; + analoginit = lineargain / 8; + } else if (lineargain > 255) { + analogmult = 3; + analoginit = lineargain / 4; + } else if (lineargain > 127) { + analogmult = 1; + analoginit = lineargain / 2; + } else + analoginit = lineargain; + + return analoginit + (analogmult << 7) + (digitalgain << 9); + +} + static void set_balance(struct v4l2_subdev *sd) { struct mt9v011 *core = to_mt9v011(sd); - u16 green1_gain, green2_gain, blue_gain, red_gain; + u16 green_gain, blue_gain, red_gain; u16 exposure; + s16 bal; exposure = core->exposure; - green1_gain = core->global_gain; - green2_gain = core->global_gain; + green_gain = calc_mt9v011_gain(core->global_gain); - blue_gain = core->global_gain + - core->global_gain * core->blue_bal / (1 << 9); + bal = core->global_gain; + bal += (core->blue_bal * core->global_gain / (1 << 7)); + blue_gain = calc_mt9v011_gain(bal); - red_gain = core->global_gain + - core->global_gain * core->blue_bal / (1 << 9); + bal = core->global_gain; + bal += (core->red_bal * core->global_gain / (1 << 7)); + red_gain = calc_mt9v011_gain(bal); - mt9v011_write(sd, R2B_MT9V011_GREEN_1_GAIN, green1_gain); - mt9v011_write(sd, R2E_MT9V011_GREEN_2_GAIN, green1_gain); + mt9v011_write(sd, R2B_MT9V011_GREEN_1_GAIN, green_gain); + mt9v011_write(sd, R2E_MT9V011_GREEN_2_GAIN, green_gain); mt9v011_write(sd, R2C_MT9V011_BLUE_GAIN, blue_gain); mt9v011_write(sd, R2D_MT9V011_RED_GAIN, red_gain); mt9v011_write(sd, R09_MT9V011_SHUTTER_WIDTH, exposure); -- cgit v1.2.3 From 8d009a0c41475a482aca17d2a9fc8e6965f2fdf9 Mon Sep 17 00:00:00 2001 From: Davide Ferri Date: Tue, 23 Jun 2009 22:34:06 -0300 Subject: [media] dib0700: add initial code for PCTV 340e by Davide Ferri This is initial code written by Davide Ferri for the PCTV 340e, including a new xc4000 driver. I am checking in all the code unmodified, and making no assertions about its quality (other than confirming it compiles). [mchehab@redhat.com: rebased on the top of the current tree] Signed-off-by: Devin Heitmueller Signed-off-by: Davide Ferri Cc: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/CARDLIST.tuner | 1 + drivers/media/common/tuners/Kconfig | 10 + drivers/media/common/tuners/Makefile | 1 + drivers/media/common/tuners/tuner-types.c | 4 + drivers/media/common/tuners/xc4000.c | 1083 +++++++++++++++++++++++++++ drivers/media/common/tuners/xc4000.h | 61 ++ drivers/media/dvb/dvb-usb/dib0700_devices.c | 68 ++ drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 1 + drivers/media/video/tuner-core.c | 14 + include/media/tuner.h | 2 + 10 files changed, 1245 insertions(+) create mode 100644 drivers/media/common/tuners/xc4000.c create mode 100644 drivers/media/common/tuners/xc4000.h diff --git a/Documentation/video4linux/CARDLIST.tuner b/Documentation/video4linux/CARDLIST.tuner index 562d7fa20f6d..6323b7a20719 100644 --- a/Documentation/video4linux/CARDLIST.tuner +++ b/Documentation/video4linux/CARDLIST.tuner @@ -78,6 +78,7 @@ tuner=77 - TCL tuner MF02GIP-5N-E tuner=78 - Philips FMD1216MEX MK3 Hybrid Tuner tuner=79 - Philips PAL/SECAM multi (FM1216 MK5) tuner=80 - Philips FQ1216LME MK3 PAL/SECAM w/active loopthrough +tuner=81 - Xceive 4000 tuner tuner=81 - Partsnic (Daewoo) PTI-5NF05 tuner=82 - Philips CU1216L tuner=83 - NXP TDA18271 diff --git a/drivers/media/common/tuners/Kconfig b/drivers/media/common/tuners/Kconfig index 22d3ca36370e..996302ae210e 100644 --- a/drivers/media/common/tuners/Kconfig +++ b/drivers/media/common/tuners/Kconfig @@ -23,6 +23,7 @@ config MEDIA_TUNER depends on VIDEO_MEDIA && I2C select MEDIA_TUNER_XC2028 if !MEDIA_TUNER_CUSTOMISE select MEDIA_TUNER_XC5000 if !MEDIA_TUNER_CUSTOMISE + select MEDIA_TUNER_XC4000 if !MEDIA_TUNER_CUSTOMISE select MEDIA_TUNER_MT20XX if !MEDIA_TUNER_CUSTOMISE select MEDIA_TUNER_TDA8290 if !MEDIA_TUNER_CUSTOMISE select MEDIA_TUNER_TEA5761 if !MEDIA_TUNER_CUSTOMISE @@ -152,6 +153,15 @@ config MEDIA_TUNER_XC5000 This device is only used inside a SiP called together with a demodulator for now. +config MEDIA_TUNER_XC4000 + tristate "Xceive XC4000 silicon tuner" + depends on VIDEO_MEDIA && I2C + default m if MEDIA_TUNER_CUSTOMISE + help + A driver for the silicon tuner XC4000 from Xceive. + This device is only used inside a SiP called together with a + demodulator for now. + config MEDIA_TUNER_MXL5005S tristate "MaxLinear MSL5005S silicon tuner" depends on VIDEO_MEDIA && I2C diff --git a/drivers/media/common/tuners/Makefile b/drivers/media/common/tuners/Makefile index 2cb4f5327843..20d24fca2cfb 100644 --- a/drivers/media/common/tuners/Makefile +++ b/drivers/media/common/tuners/Makefile @@ -16,6 +16,7 @@ obj-$(CONFIG_MEDIA_TUNER_TDA9887) += tda9887.o obj-$(CONFIG_MEDIA_TUNER_TDA827X) += tda827x.o obj-$(CONFIG_MEDIA_TUNER_TDA18271) += tda18271.o obj-$(CONFIG_MEDIA_TUNER_XC5000) += xc5000.o +obj-$(CONFIG_MEDIA_TUNER_XC4000) += xc4000.o obj-$(CONFIG_MEDIA_TUNER_MT2060) += mt2060.o obj-$(CONFIG_MEDIA_TUNER_MT2266) += mt2266.o obj-$(CONFIG_MEDIA_TUNER_QT1010) += qt1010.o diff --git a/drivers/media/common/tuners/tuner-types.c b/drivers/media/common/tuners/tuner-types.c index afba6dc5e080..94a603a60842 100644 --- a/drivers/media/common/tuners/tuner-types.c +++ b/drivers/media/common/tuners/tuner-types.c @@ -1805,6 +1805,10 @@ struct tunertype tuners[] = { .name = "Xceive 5000 tuner", /* see xc5000.c for details */ }, + [TUNER_XC4000] = { /* Xceive 4000 */ + .name = "Xceive 4000 tuner", + /* see xc4000.c for details */ + }, [TUNER_TCL_MF02GIP_5N] = { /* TCL tuner MF02GIP-5N-E */ .name = "TCL tuner MF02GIP-5N-E", .params = tuner_tcl_mf02gip_5n_params, diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c new file mode 100644 index 000000000000..68f5e2beee1e --- /dev/null +++ b/drivers/media/common/tuners/xc4000.c @@ -0,0 +1,1083 @@ +/* + * Driver for Xceive XC4000 "QAM/8VSB single chip tuner" + * + * Copyright (c) 2007 Xceive Corporation + * Copyright (c) 2007 Steven Toth + * Copyright (c) 2009 Devin Heitmueller + * Copyright (c) 2009 Davide Ferri + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * 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 General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include + +#include "dvb_frontend.h" + +#include "xc4000.h" +#include "tuner-i2c.h" + +static int debug; +module_param(debug, int, 0644); +MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); + +static int no_poweroff; +module_param(no_poweroff, int, 0644); +MODULE_PARM_DESC(no_poweroff, "0 (default) powers device off when not used.\n" + "\t\t1 keep device energized and with tuner ready all the times.\n" + "\t\tFaster, but consumes more power and keeps the device hotter"); + +static DEFINE_MUTEX(xc4000_list_mutex); +static LIST_HEAD(hybrid_tuner_instance_list); + +#define dprintk(level, fmt, arg...) if (debug >= level) \ + printk(KERN_INFO "%s: " fmt, "xc4000", ## arg) + +#define XC4000_DEFAULT_FIRMWARE "dvb-fe-xc4000-1.4.26.fw" +#define XC4000_DEFAULT_FIRMWARE_SIZE 8236 + +struct xc4000_priv { + struct tuner_i2c_props i2c_props; + struct list_head hybrid_tuner_instance_list; + + u32 if_khz; + u32 freq_hz; + u32 bandwidth; + u8 video_standard; + u8 rf_mode; +}; + +/* Misc Defines */ +#define MAX_TV_STANDARD 23 +#define XC_MAX_I2C_WRITE_LENGTH 64 + +/* Signal Types */ +#define XC_RF_MODE_AIR 0 +#define XC_RF_MODE_CABLE 1 + +/* Result codes */ +#define XC_RESULT_SUCCESS 0 +#define XC_RESULT_RESET_FAILURE 1 +#define XC_RESULT_I2C_WRITE_FAILURE 2 +#define XC_RESULT_I2C_READ_FAILURE 3 +#define XC_RESULT_OUT_OF_RANGE 5 + +/* Product id */ +#define XC_PRODUCT_ID_FW_NOT_LOADED 0x2000 +#define XC_PRODUCT_ID_FW_LOADED 0x0FA0 /* WAS: 0x1388*/ + +/* Registers */ +#define XREG_INIT 0x00 +#define XREG_VIDEO_MODE 0x01 +#define XREG_AUDIO_MODE 0x02 +#define XREG_RF_FREQ 0x03 +#define XREG_D_CODE 0x04 +#define XREG_IF_OUT 0x05 /* ?? */ +#define XREG_SEEK_MODE 0x07 /* WAS: 0x06 */ +#define XREG_POWER_DOWN 0x08 /* WAS: 0x0A Obsolete */ +#define XREG_SIGNALSOURCE 0x0A /* WAS: 0x0D 0=Air, 1=Cable */ +//#define XREG_SMOOTHEDCVBS 0x0E +//#define XREG_XTALFREQ 0x0F +//#define XREG_FINERFREQ 0x10 +//#define XREG_DDIMODE 0x11 + +#define XREG_ADC_ENV 0x00 +#define XREG_QUALITY 0x01 +#define XREG_FRAME_LINES 0x02 +#define XREG_HSYNC_FREQ 0x03 +#define XREG_LOCK 0x04 +#define XREG_FREQ_ERROR 0x05 +#define XREG_SNR 0x06 +#define XREG_VERSION 0x07 +#define XREG_PRODUCT_ID 0x08 +//#define XREG_BUSY 0x09 +//#define XREG_BUILD 0x0D + +/* + Basic firmware description. This will remain with + the driver for documentation purposes. + + This represents an I2C firmware file encoded as a + string of unsigned char. Format is as follows: + + char[0 ]=len0_MSB -> len = len_MSB * 256 + len_LSB + char[1 ]=len0_LSB -> length of first write transaction + char[2 ]=data0 -> first byte to be sent + char[3 ]=data1 + char[4 ]=data2 + char[ ]=... + char[M ]=dataN -> last byte to be sent + char[M+1]=len1_MSB -> len = len_MSB * 256 + len_LSB + char[M+2]=len1_LSB -> length of second write transaction + char[M+3]=data0 + char[M+4]=data1 + ... + etc. + + The [len] value should be interpreted as follows: + + len= len_MSB _ len_LSB + len=1111_1111_1111_1111 : End of I2C_SEQUENCE + len=0000_0000_0000_0000 : Reset command: Do hardware reset + len=0NNN_NNNN_NNNN_NNNN : Normal transaction: number of bytes = {1:32767) + len=1WWW_WWWW_WWWW_WWWW : Wait command: wait for {1:32767} ms + + For the RESET and WAIT commands, the two following bytes will contain + immediately the length of the following transaction. + +*/ +struct XC_TV_STANDARD { + char *Name; + u16 AudioMode; + u16 VideoMode; +}; + +/* Tuner standards */ +#define MN_NTSC_PAL_BTSC 0 +#define MN_NTSC_PAL_A2 1 +#define MN_NTSC_PAL_EIAJ 2 +#define MN_NTSC_PAL_Mono 3 +#define BG_PAL_A2 4 +#define BG_PAL_NICAM 5 +#define BG_PAL_MONO 6 +#define I_PAL_NICAM 7 +#define I_PAL_NICAM_MONO 8 +#define DK_PAL_A2 9 +#define DK_PAL_NICAM 10 +#define DK_PAL_MONO 11 +#define DK_SECAM_A2DK1 12 +#define DK_SECAM_A2LDK3 13 +#define DK_SECAM_A2MONO 14 +#define L_SECAM_NICAM 15 +#define LC_SECAM_NICAM 16 +#define DTV6 17 +#define DTV8 18 +#define DTV7_8 19 +#define DTV7 20 +#define FM_Radio_INPUT2 21 +#define FM_Radio_INPUT1 22 + +/* WAS : +static struct XC_TV_STANDARD XC4000_Standard[MAX_TV_STANDARD] = { + {"M/N-NTSC/PAL-BTSC", 0x0400, 0x8020}, + {"M/N-NTSC/PAL-A2", 0x0600, 0x8020}, + {"M/N-NTSC/PAL-EIAJ", 0x0440, 0x8020}, + {"M/N-NTSC/PAL-Mono", 0x0478, 0x8020}, + {"B/G-PAL-A2", 0x0A00, 0x8049}, + {"B/G-PAL-NICAM", 0x0C04, 0x8049}, + {"B/G-PAL-MONO", 0x0878, 0x8059}, + {"I-PAL-NICAM", 0x1080, 0x8009}, + {"I-PAL-NICAM-MONO", 0x0E78, 0x8009}, + {"D/K-PAL-A2", 0x1600, 0x8009}, + {"D/K-PAL-NICAM", 0x0E80, 0x8009}, + {"D/K-PAL-MONO", 0x1478, 0x8009}, + {"D/K-SECAM-A2 DK1", 0x1200, 0x8009}, + {"D/K-SECAM-A2 L/DK3", 0x0E00, 0x8009}, + {"D/K-SECAM-A2 MONO", 0x1478, 0x8009}, + {"L-SECAM-NICAM", 0x8E82, 0x0009}, + {"L'-SECAM-NICAM", 0x8E82, 0x4009}, + {"DTV6", 0x00C0, 0x8002}, + {"DTV8", 0x00C0, 0x800B}, + {"DTV7/8", 0x00C0, 0x801B}, + {"DTV7", 0x00C0, 0x8007}, + {"FM Radio-INPUT2", 0x9802, 0x9002}, + {"FM Radio-INPUT1", 0x0208, 0x9002} +};*/ + +static struct XC_TV_STANDARD XC4000_Standard[MAX_TV_STANDARD] = { + {"M/N-NTSC/PAL-BTSC", 0x0000, 0x8020}, + {"M/N-NTSC/PAL-A2", 0x0000, 0x8020}, + {"M/N-NTSC/PAL-EIAJ", 0x0040, 0x8020}, + {"M/N-NTSC/PAL-Mono", 0x0078, 0x8020}, + {"B/G-PAL-A2", 0x0000, 0x8059}, + {"B/G-PAL-NICAM", 0x0004, 0x8059}, + {"B/G-PAL-MONO", 0x0078, 0x8059}, + {"I-PAL-NICAM", 0x0080, 0x8049}, + {"I-PAL-NICAM-MONO", 0x0078, 0x8049}, + {"D/K-PAL-A2", 0x0000, 0x8049}, + {"D/K-PAL-NICAM", 0x0080, 0x8049}, + {"D/K-PAL-MONO", 0x0078, 0x8049}, + {"D/K-SECAM-A2 DK1", 0x0000, 0x8049}, + {"D/K-SECAM-A2 L/DK3", 0x0000, 0x8049}, + {"D/K-SECAM-A2 MONO", 0x0078, 0x8049}, + {"L-SECAM-NICAM", 0x8080, 0x0009}, + {"L'-SECAM-NICAM", 0x8080, 0x4009}, + {"DTV6", 0x00C0, 0x8002}, + {"DTV8", 0x00C0, 0x800B}, + {"DTV7/8", 0x00C0, 0x801B}, + {"DTV7", 0x00C0, 0x8007}, + {"FM Radio-INPUT2", 0x0008, 0x9800}, + {"FM Radio-INPUT1", 0x0008, 0x9000} +}; + +static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe); +static int xc4000_is_firmware_loaded(struct dvb_frontend *fe); +static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val); +static int xc4000_TunerReset(struct dvb_frontend *fe); + +static int xc_send_i2c_data(struct xc4000_priv *priv, u8 *buf, int len) +{ + struct i2c_msg msg = { .addr = priv->i2c_props.addr, + .flags = 0, .buf = buf, .len = len }; + + if (i2c_transfer(priv->i2c_props.adap, &msg, 1) != 1) { + printk(KERN_ERR "xc4000: I2C write failed (len=%i)\n", len); + return XC_RESULT_I2C_WRITE_FAILURE; + } + return XC_RESULT_SUCCESS; +} + +/* This routine is never used because the only time we read data from the + i2c bus is when we read registers, and we want that to be an atomic i2c + transaction in case we are on a multi-master bus */ +static int xc_read_i2c_data(struct xc4000_priv *priv, u8 *buf, int len) +{ + struct i2c_msg msg = { .addr = priv->i2c_props.addr, + .flags = I2C_M_RD, .buf = buf, .len = len }; + + if (i2c_transfer(priv->i2c_props.adap, &msg, 1) != 1) { + printk(KERN_ERR "xc4000 I2C read failed (len=%i)\n", len); + return -EREMOTEIO; + } + return 0; +} + +static void xc_wait(int wait_ms) +{ + msleep(wait_ms); +} + +static int xc4000_TunerReset(struct dvb_frontend *fe) +{ + struct xc4000_priv *priv = fe->tuner_priv; + int ret; + + dprintk(1, "%s()\n", __func__); + + if (fe->callback) { + ret = fe->callback(((fe->dvb) && (fe->dvb->priv)) ? + fe->dvb->priv : + priv->i2c_props.adap->algo_data, + DVB_FRONTEND_COMPONENT_TUNER, + XC4000_TUNER_RESET, 0); + if (ret) { + printk(KERN_ERR "xc4000: reset failed\n"); + return XC_RESULT_RESET_FAILURE; + } + } else { + printk(KERN_ERR "xc4000: no tuner reset callback function, fatal\n"); + return XC_RESULT_RESET_FAILURE; + } + return XC_RESULT_SUCCESS; +} + +static int xc_write_reg(struct xc4000_priv *priv, u16 regAddr, u16 i2cData) +{ + u8 buf[4]; +// int WatchDogTimer = 100; + int result; + + buf[0] = (regAddr >> 8) & 0xFF; + buf[1] = regAddr & 0xFF; + buf[2] = (i2cData >> 8) & 0xFF; + buf[3] = i2cData & 0xFF; + result = xc_send_i2c_data(priv, buf, 4); +//WAS THERE +// if (result == XC_RESULT_SUCCESS) { +// /* wait for busy flag to clear */ +// while ((WatchDogTimer > 0) && (result == XC_RESULT_SUCCESS)) { +// buf[0] = 0; +// buf[1] = XREG_BUSY; +// +// result = xc_send_i2c_data(priv, buf, 2); +// if (result == XC_RESULT_SUCCESS) { +// result = xc_read_i2c_data(priv, buf, 2); +// if (result == XC_RESULT_SUCCESS) { +// if ((buf[0] == 0) && (buf[1] == 0)) { +// /* busy flag cleared */ +// break; +// } else { +// xc_wait(5); /* wait 5 ms */ +// WatchDogTimer--; +// } +// } +// } +// } +// } +// if (WatchDogTimer < 0) +// result = XC_RESULT_I2C_WRITE_FAILURE; + + return result; +} + +static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence) +{ + struct xc4000_priv *priv = fe->tuner_priv; + + int i, nbytes_to_send, result; + unsigned int len, pos, index; + u8 buf[XC_MAX_I2C_WRITE_LENGTH]; + + index = 0; + while ((i2c_sequence[index] != 0xFF) || + (i2c_sequence[index + 1] != 0xFF)) { + len = i2c_sequence[index] * 256 + i2c_sequence[index+1]; + if (len == 0x0000) { + /* RESET command */ + result = xc4000_TunerReset(fe); + index += 2; + if (result != XC_RESULT_SUCCESS) + return result; + } else if (len & 0x8000) { + /* WAIT command */ + xc_wait(len & 0x7FFF); + index += 2; + } else { + /* Send i2c data whilst ensuring individual transactions + * do not exceed XC_MAX_I2C_WRITE_LENGTH bytes. + */ + index += 2; + buf[0] = i2c_sequence[index]; + buf[1] = i2c_sequence[index + 1]; + pos = 2; + while (pos < len) { + if ((len - pos) > XC_MAX_I2C_WRITE_LENGTH - 2) + nbytes_to_send = + XC_MAX_I2C_WRITE_LENGTH; + else + nbytes_to_send = (len - pos + 2); + for (i = 2; i < nbytes_to_send; i++) { + buf[i] = i2c_sequence[index + pos + + i - 2]; + } + result = xc_send_i2c_data(priv, buf, + nbytes_to_send); + + if (result != XC_RESULT_SUCCESS) + return result; + + pos += nbytes_to_send - 2; + } + index += len; + } + } + return XC_RESULT_SUCCESS; +} + +static int xc_initialize(struct xc4000_priv *priv) +{ + dprintk(1, "%s()\n", __func__); + return xc_write_reg(priv, XREG_INIT, 0); +} + +static int xc_SetTVStandard(struct xc4000_priv *priv, + u16 VideoMode, u16 AudioMode) +{ + int ret; + dprintk(1, "%s(0x%04x,0x%04x)\n", __func__, VideoMode, AudioMode); + dprintk(1, "%s() Standard = %s\n", + __func__, + XC4000_Standard[priv->video_standard].Name); + + ret = xc_write_reg(priv, XREG_VIDEO_MODE, VideoMode); + if (ret == XC_RESULT_SUCCESS) + ret = xc_write_reg(priv, XREG_AUDIO_MODE, AudioMode); + + return ret; +} + +static int xc_SetSignalSource(struct xc4000_priv *priv, u16 rf_mode) +{ + dprintk(1, "%s(%d) Source = %s\n", __func__, rf_mode, + rf_mode == XC_RF_MODE_AIR ? "ANTENNA" : "CABLE"); + + if ((rf_mode != XC_RF_MODE_AIR) && (rf_mode != XC_RF_MODE_CABLE)) { + rf_mode = XC_RF_MODE_CABLE; + printk(KERN_ERR + "%s(), Invalid mode, defaulting to CABLE", + __func__); + } + return xc_write_reg(priv, XREG_SIGNALSOURCE, rf_mode); +} + +static const struct dvb_tuner_ops xc4000_tuner_ops; + +static int xc_set_RF_frequency(struct xc4000_priv *priv, u32 freq_hz) +{ + u16 freq_code; + + dprintk(1, "%s(%u)\n", __func__, freq_hz); + + if ((freq_hz > xc4000_tuner_ops.info.frequency_max) || + (freq_hz < xc4000_tuner_ops.info.frequency_min)) + return XC_RESULT_OUT_OF_RANGE; + + freq_code = (u16)(freq_hz / 15625); + + /* WAS: Starting in firmware version 1.1.44, Xceive recommends using the + FINERFREQ for all normal tuning (the doc indicates reg 0x03 should + only be used for fast scanning for channel lock) */ + return xc_write_reg(priv, XREG_RF_FREQ, freq_code); /* WAS: XREG_FINERFREQ */ +} + + +static int xc_set_IF_frequency(struct xc4000_priv *priv, u32 freq_khz) +{ + u32 freq_code = (freq_khz * 1024)/1000; + dprintk(1, "%s(freq_khz = %d) freq_code = 0x%x\n", + __func__, freq_khz, freq_code); + + return xc_write_reg(priv, XREG_IF_OUT, freq_code); +} + + +static int xc_get_ADC_Envelope(struct xc4000_priv *priv, u16 *adc_envelope) +{ + return xc4000_readreg(priv, XREG_ADC_ENV, adc_envelope); +} + +static int xc_get_frequency_error(struct xc4000_priv *priv, u32 *freq_error_hz) +{ + int result; + u16 regData; + u32 tmp; + + result = xc4000_readreg(priv, XREG_FREQ_ERROR, ®Data); + if (result != XC_RESULT_SUCCESS) + return result; + + tmp = (u32)regData; + (*freq_error_hz) = (tmp * 15625) / 1000; + return result; +} + +static int xc_get_lock_status(struct xc4000_priv *priv, u16 *lock_status) +{ + return xc4000_readreg(priv, XREG_LOCK, lock_status); +} + +static int xc_get_version(struct xc4000_priv *priv, + u8 *hw_majorversion, u8 *hw_minorversion, + u8 *fw_majorversion, u8 *fw_minorversion) +{ + u16 data; + int result; + + result = xc4000_readreg(priv, XREG_VERSION, &data); + if (result != XC_RESULT_SUCCESS) + return result; + + (*hw_majorversion) = (data >> 12) & 0x0F; + (*hw_minorversion) = (data >> 8) & 0x0F; + (*fw_majorversion) = (data >> 4) & 0x0F; + (*fw_minorversion) = data & 0x0F; + + return 0; +} + +/* WAS THERE +static int xc_get_buildversion(struct xc4000_priv *priv, u16 *buildrev) +{ + return xc4000_readreg(priv, XREG_BUILD, buildrev); +}*/ + +static int xc_get_hsync_freq(struct xc4000_priv *priv, u32 *hsync_freq_hz) +{ + u16 regData; + int result; + + result = xc4000_readreg(priv, XREG_HSYNC_FREQ, ®Data); + if (result != XC_RESULT_SUCCESS) + return result; + + (*hsync_freq_hz) = ((regData & 0x0fff) * 763)/100; + return result; +} + +static int xc_get_frame_lines(struct xc4000_priv *priv, u16 *frame_lines) +{ + return xc4000_readreg(priv, XREG_FRAME_LINES, frame_lines); +} + +static int xc_get_quality(struct xc4000_priv *priv, u16 *quality) +{ + return xc4000_readreg(priv, XREG_QUALITY, quality); +} + +static u16 WaitForLock(struct xc4000_priv *priv) +{ + u16 lockState = 0; + int watchDogCount = 40; + + while ((lockState == 0) && (watchDogCount > 0)) { + xc_get_lock_status(priv, &lockState); + if (lockState != 1) { + xc_wait(5); + watchDogCount--; + } + } + return lockState; +} + +#define XC_TUNE_ANALOG 0 +#define XC_TUNE_DIGITAL 1 +static int xc_tune_channel(struct xc4000_priv *priv, u32 freq_hz, int mode) +{ + int found = 0; + + dprintk(1, "%s(%u)\n", __func__, freq_hz); + + if (xc_set_RF_frequency(priv, freq_hz) != XC_RESULT_SUCCESS) + return 0; + + if (mode == XC_TUNE_ANALOG) { + if (WaitForLock(priv) == 1) + found = 1; + } + + return found; +} + +static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val) +{ + u8 buf[2] = { reg >> 8, reg & 0xff }; + u8 bval[2] = { 0, 0 }; + struct i2c_msg msg[2] = { + { .addr = priv->i2c_props.addr, + .flags = 0, .buf = &buf[0], .len = 2 }, + { .addr = priv->i2c_props.addr, + .flags = I2C_M_RD, .buf = &bval[0], .len = 2 }, + }; + + if (i2c_transfer(priv->i2c_props.adap, msg, 2) != 2) { + printk(KERN_WARNING "xc4000: I2C read failed\n"); + return -EREMOTEIO; + } + + *val = (bval[0] << 8) | bval[1]; + return XC_RESULT_SUCCESS; +} + +static int xc4000_fwupload(struct dvb_frontend *fe) +{ + struct xc4000_priv *priv = fe->tuner_priv; + const struct firmware *fw; + int ret; + + /* request the firmware, this will block and timeout */ + printk(KERN_INFO "xc4000: waiting for firmware upload (%s)...\n", + XC4000_DEFAULT_FIRMWARE); + + ret = request_firmware(&fw, XC4000_DEFAULT_FIRMWARE, + priv->i2c_props.adap->dev.parent); + if (ret) { + printk(KERN_ERR "xc4000: Upload failed. (file not found?)\n"); + ret = XC_RESULT_RESET_FAILURE; + goto out; + } else { + printk(KERN_DEBUG "xc4000: firmware read %Zu bytes.\n", + fw->size); + ret = XC_RESULT_SUCCESS; + } + + if (fw->size != XC4000_DEFAULT_FIRMWARE_SIZE) { + printk(KERN_ERR "xc4000: firmware incorrect size\n"); + ret = XC_RESULT_RESET_FAILURE; + } else { + printk(KERN_INFO "xc4000: firmware uploading...\n"); + ret = xc_load_i2c_sequence(fe, fw->data); + printk(KERN_INFO "xc4000: firmware upload complete...\n"); + } + +out: + release_firmware(fw); + return ret; +} + +static void xc_debug_dump(struct xc4000_priv *priv) +{ + u16 adc_envelope; + u32 freq_error_hz = 0; + u16 lock_status; + u32 hsync_freq_hz = 0; + u16 frame_lines; + u16 quality; + u8 hw_majorversion = 0, hw_minorversion = 0; + u8 fw_majorversion = 0, fw_minorversion = 0; +// u16 fw_buildversion = 0; + + /* Wait for stats to stabilize. + * Frame Lines needs two frame times after initial lock + * before it is valid. + */ + xc_wait(100); + + xc_get_ADC_Envelope(priv, &adc_envelope); + dprintk(1, "*** ADC envelope (0-1023) = %d\n", adc_envelope); + + xc_get_frequency_error(priv, &freq_error_hz); + dprintk(1, "*** Frequency error = %d Hz\n", freq_error_hz); + + xc_get_lock_status(priv, &lock_status); + dprintk(1, "*** Lock status (0-Wait, 1-Locked, 2-No-signal) = %d\n", + lock_status); + + xc_get_version(priv, &hw_majorversion, &hw_minorversion, + &fw_majorversion, &fw_minorversion); +// WAS: +// xc_get_buildversion(priv, &fw_buildversion); +// dprintk(1, "*** HW: V%02x.%02x, FW: V%02x.%02x.%04x\n", +// hw_majorversion, hw_minorversion, +// fw_majorversion, fw_minorversion, fw_buildversion); +// NOW: + dprintk(1, "*** HW: V%02x.%02x, FW: V%02x.%02x\n", + hw_majorversion, hw_minorversion, + fw_majorversion, fw_minorversion); + + xc_get_hsync_freq(priv, &hsync_freq_hz); + dprintk(1, "*** Horizontal sync frequency = %d Hz\n", hsync_freq_hz); + + xc_get_frame_lines(priv, &frame_lines); + dprintk(1, "*** Frame lines = %d\n", frame_lines); + + xc_get_quality(priv, &quality); + dprintk(1, "*** Quality (0:<8dB, 7:>56dB) = %d\n", quality); +} + +static int xc4000_set_params(struct dvb_frontend *fe, + struct dvb_frontend_parameters *params) +{ + struct xc4000_priv *priv = fe->tuner_priv; + int ret; + + if (xc4000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) + xc_load_fw_and_init_tuner(fe); + + dprintk(1, "%s() frequency=%d (Hz)\n", __func__, params->frequency); + + if (fe->ops.info.type == FE_ATSC) { + dprintk(1, "%s() ATSC\n", __func__); + switch (params->u.vsb.modulation) { + case VSB_8: + case VSB_16: + dprintk(1, "%s() VSB modulation\n", __func__); + priv->rf_mode = XC_RF_MODE_AIR; + priv->freq_hz = params->frequency - 1750000; + priv->bandwidth = BANDWIDTH_6_MHZ; + priv->video_standard = DTV6; + break; + case QAM_64: + case QAM_256: + case QAM_AUTO: + dprintk(1, "%s() QAM modulation\n", __func__); + priv->rf_mode = XC_RF_MODE_CABLE; + priv->freq_hz = params->frequency - 1750000; + priv->bandwidth = BANDWIDTH_6_MHZ; + priv->video_standard = DTV6; + break; + default: + return -EINVAL; + } + } else if (fe->ops.info.type == FE_OFDM) { + dprintk(1, "%s() OFDM\n", __func__); + switch (params->u.ofdm.bandwidth) { + case BANDWIDTH_6_MHZ: + priv->bandwidth = BANDWIDTH_6_MHZ; + priv->video_standard = DTV6; + priv->freq_hz = params->frequency - 1750000; + break; + case BANDWIDTH_7_MHZ: + printk(KERN_ERR "xc4000 bandwidth 7MHz not supported\n"); + return -EINVAL; + case BANDWIDTH_8_MHZ: + priv->bandwidth = BANDWIDTH_8_MHZ; + priv->video_standard = DTV8; + priv->freq_hz = params->frequency - 2750000; + break; + default: + printk(KERN_ERR "xc4000 bandwidth not set!\n"); + return -EINVAL; + } + priv->rf_mode = XC_RF_MODE_AIR; + } else { + printk(KERN_ERR "xc4000 modulation type not supported!\n"); + return -EINVAL; + } + + dprintk(1, "%s() frequency=%d (compensated)\n", + __func__, priv->freq_hz); + + ret = xc_SetSignalSource(priv, priv->rf_mode); + if (ret != XC_RESULT_SUCCESS) { + printk(KERN_ERR + "xc4000: xc_SetSignalSource(%d) failed\n", + priv->rf_mode); + return -EREMOTEIO; + } + + ret = xc_SetTVStandard(priv, + XC4000_Standard[priv->video_standard].VideoMode, + XC4000_Standard[priv->video_standard].AudioMode); + if (ret != XC_RESULT_SUCCESS) { + printk(KERN_ERR "xc4000: xc_SetTVStandard failed\n"); + return -EREMOTEIO; + } + + ret = xc_set_IF_frequency(priv, priv->if_khz); + if (ret != XC_RESULT_SUCCESS) { + printk(KERN_ERR "xc4000: xc_Set_IF_frequency(%d) failed\n", + priv->if_khz); + return -EIO; + } + + xc_tune_channel(priv, priv->freq_hz, XC_TUNE_DIGITAL); + + if (debug) + xc_debug_dump(priv); + + return 0; +} + +static int xc4000_is_firmware_loaded(struct dvb_frontend *fe) +{ + struct xc4000_priv *priv = fe->tuner_priv; + int ret; + u16 id; + + ret = xc4000_readreg(priv, XREG_PRODUCT_ID, &id); + if (ret == XC_RESULT_SUCCESS) { + if (id == XC_PRODUCT_ID_FW_NOT_LOADED) + ret = XC_RESULT_RESET_FAILURE; + else + ret = XC_RESULT_SUCCESS; + } + + dprintk(1, "%s() returns %s id = 0x%x\n", __func__, + ret == XC_RESULT_SUCCESS ? "True" : "False", id); + return ret; +} + +static int xc4000_set_analog_params(struct dvb_frontend *fe, + struct analog_parameters *params) +{ + struct xc4000_priv *priv = fe->tuner_priv; + int ret; + + if (xc4000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) + xc_load_fw_and_init_tuner(fe); + + dprintk(1, "%s() frequency=%d (in units of 62.5khz)\n", + __func__, params->frequency); + + /* Fix me: it could be air. */ + priv->rf_mode = params->mode; + if (params->mode > XC_RF_MODE_CABLE) + priv->rf_mode = XC_RF_MODE_CABLE; + + /* params->frequency is in units of 62.5khz */ + priv->freq_hz = params->frequency * 62500; + + /* FIX ME: Some video standards may have several possible audio + standards. We simply default to one of them here. + */ + if (params->std & V4L2_STD_MN) { + /* default to BTSC audio standard */ + priv->video_standard = MN_NTSC_PAL_BTSC; + goto tune_channel; + } + + if (params->std & V4L2_STD_PAL_BG) { + /* default to NICAM audio standard */ + priv->video_standard = BG_PAL_NICAM; + goto tune_channel; + } + + if (params->std & V4L2_STD_PAL_I) { + /* default to NICAM audio standard */ + priv->video_standard = I_PAL_NICAM; + goto tune_channel; + } + + if (params->std & V4L2_STD_PAL_DK) { + /* default to NICAM audio standard */ + priv->video_standard = DK_PAL_NICAM; + goto tune_channel; + } + + if (params->std & V4L2_STD_SECAM_DK) { + /* default to A2 DK1 audio standard */ + priv->video_standard = DK_SECAM_A2DK1; + goto tune_channel; + } + + if (params->std & V4L2_STD_SECAM_L) { + priv->video_standard = L_SECAM_NICAM; + goto tune_channel; + } + + if (params->std & V4L2_STD_SECAM_LC) { + priv->video_standard = LC_SECAM_NICAM; + goto tune_channel; + } + +tune_channel: + ret = xc_SetSignalSource(priv, priv->rf_mode); + if (ret != XC_RESULT_SUCCESS) { + printk(KERN_ERR + "xc4000: xc_SetSignalSource(%d) failed\n", + priv->rf_mode); + return -EREMOTEIO; + } + + ret = xc_SetTVStandard(priv, + XC4000_Standard[priv->video_standard].VideoMode, + XC4000_Standard[priv->video_standard].AudioMode); + if (ret != XC_RESULT_SUCCESS) { + printk(KERN_ERR "xc4000: xc_SetTVStandard failed\n"); + return -EREMOTEIO; + } + + xc_tune_channel(priv, priv->freq_hz, XC_TUNE_ANALOG); + + if (debug) + xc_debug_dump(priv); + + return 0; +} + +static int xc4000_get_frequency(struct dvb_frontend *fe, u32 *freq) +{ + struct xc4000_priv *priv = fe->tuner_priv; + dprintk(1, "%s()\n", __func__); + *freq = priv->freq_hz; + return 0; +} + +static int xc4000_get_bandwidth(struct dvb_frontend *fe, u32 *bw) +{ + struct xc4000_priv *priv = fe->tuner_priv; + dprintk(1, "%s()\n", __func__); + + *bw = priv->bandwidth; + return 0; +} + +static int xc4000_get_status(struct dvb_frontend *fe, u32 *status) +{ + struct xc4000_priv *priv = fe->tuner_priv; + u16 lock_status = 0; + + xc_get_lock_status(priv, &lock_status); + + dprintk(1, "%s() lock_status = 0x%08x\n", __func__, lock_status); + + *status = lock_status; + + return 0; +} + +static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe) +{ + struct xc4000_priv *priv = fe->tuner_priv; + int ret = 0; + + if (xc4000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) { + ret = xc4000_fwupload(fe); + if (ret != XC_RESULT_SUCCESS) + return ret; + } + + /* Start the tuner self-calibration process */ + ret |= xc_initialize(priv); + + /* Wait for calibration to complete. + * We could continue but XC4000 will clock stretch subsequent + * I2C transactions until calibration is complete. This way we + * don't have to rely on clock stretching working. + */ + xc_wait(100); + + /* Default to "CABLE" mode */ + ret |= xc_write_reg(priv, XREG_SIGNALSOURCE, XC_RF_MODE_CABLE); + + return ret; +} + +static int xc4000_sleep(struct dvb_frontend *fe) +{ + int ret; + + dprintk(1, "%s()\n", __func__); + + /* Avoid firmware reload on slow devices */ + if (no_poweroff) + return 0; + + /* According to Xceive technical support, the "powerdown" register + was removed in newer versions of the firmware. The "supported" + way to sleep the tuner is to pull the reset pin low for 10ms */ + ret = xc4000_TunerReset(fe); + if (ret != XC_RESULT_SUCCESS) { + printk(KERN_ERR + "xc4000: %s() unable to shutdown tuner\n", + __func__); + return -EREMOTEIO; + } else + return XC_RESULT_SUCCESS; +} + +static int xc4000_init(struct dvb_frontend *fe) +{ + struct xc4000_priv *priv = fe->tuner_priv; + dprintk(1, "%s()\n", __func__); + + if (xc_load_fw_and_init_tuner(fe) != XC_RESULT_SUCCESS) { + printk(KERN_ERR "xc4000: Unable to initialise tuner\n"); + return -EREMOTEIO; + } + + if (debug) + xc_debug_dump(priv); + + return 0; +} + +static int xc4000_release(struct dvb_frontend *fe) +{ + struct xc4000_priv *priv = fe->tuner_priv; + + dprintk(1, "%s()\n", __func__); + + mutex_lock(&xc4000_list_mutex); + + if (priv) + hybrid_tuner_release_state(priv); + + mutex_unlock(&xc4000_list_mutex); + + fe->tuner_priv = NULL; + + return 0; +} + +static const struct dvb_tuner_ops xc4000_tuner_ops = { + .info = { + .name = "Xceive XC4000", + .frequency_min = 1000000, + .frequency_max = 1023000000, + .frequency_step = 50000, + }, + + .release = xc4000_release, + .init = xc4000_init, + .sleep = xc4000_sleep, + + .set_params = xc4000_set_params, + .set_analog_params = xc4000_set_analog_params, + .get_frequency = xc4000_get_frequency, + .get_bandwidth = xc4000_get_bandwidth, + .get_status = xc4000_get_status +}; + +struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, + struct i2c_adapter *i2c, + struct xc4000_config *cfg) +{ + struct xc4000_priv *priv = NULL; + int instance; + u16 id = 0; + + dprintk(1, "%s(%d-%04x)\n", __func__, + i2c ? i2c_adapter_id(i2c) : -1, + cfg ? cfg->i2c_address : -1); + + mutex_lock(&xc4000_list_mutex); + + instance = hybrid_tuner_request_state(struct xc4000_priv, priv, + hybrid_tuner_instance_list, + i2c, cfg->i2c_address, "xc4000"); + switch (instance) { + case 0: + goto fail; + break; + case 1: + /* new tuner instance */ + priv->bandwidth = BANDWIDTH_6_MHZ; + fe->tuner_priv = priv; + break; + default: + /* existing tuner instance */ + fe->tuner_priv = priv; + break; + } + + if (priv->if_khz == 0) { + /* If the IF hasn't been set yet, use the value provided by + the caller (occurs in hybrid devices where the analog + call to xc4000_attach occurs before the digital side) */ + priv->if_khz = cfg->if_khz; + } + + /* Check if firmware has been loaded. It is possible that another + instance of the driver has loaded the firmware. + */ + + if (xc4000_readreg(priv, XREG_PRODUCT_ID, &id) != XC_RESULT_SUCCESS) + goto fail; + + switch (id) { + case XC_PRODUCT_ID_FW_LOADED: + printk(KERN_INFO + "xc4000: Successfully identified at address 0x%02x\n", + cfg->i2c_address); + printk(KERN_INFO + "xc4000: Firmware has been loaded previously\n"); + break; + case XC_PRODUCT_ID_FW_NOT_LOADED: + printk(KERN_INFO + "xc4000: Successfully identified at address 0x%02x\n", + cfg->i2c_address); + printk(KERN_INFO + "xc4000: Firmware has not been loaded previously\n"); + break; + default: + printk(KERN_ERR + "xc4000: Device not found at addr 0x%02x (0x%x)\n", + cfg->i2c_address, id); + goto fail; + } + + mutex_unlock(&xc4000_list_mutex); + + memcpy(&fe->ops.tuner_ops, &xc4000_tuner_ops, + sizeof(struct dvb_tuner_ops)); + + return fe; +fail: + mutex_unlock(&xc4000_list_mutex); + + xc4000_release(fe); + return NULL; +} +EXPORT_SYMBOL(xc4000_attach); + +MODULE_AUTHOR("Steven Toth, Davide Ferri"); +MODULE_DESCRIPTION("Xceive xc4000 silicon tuner driver"); +MODULE_LICENSE("GPL"); diff --git a/drivers/media/common/tuners/xc4000.h b/drivers/media/common/tuners/xc4000.h new file mode 100644 index 000000000000..2bbbe9d6480b --- /dev/null +++ b/drivers/media/common/tuners/xc4000.h @@ -0,0 +1,61 @@ +/* + * Driver for Xceive XC4000 "QAM/8VSB single chip tuner" + * + * Copyright (c) 2007 Steven Toth + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * 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 General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __XC4000_H__ +#define __XC4000_H__ + +#include + +struct dvb_frontend; +struct i2c_adapter; + +struct xc4000_config { + u8 i2c_address; + u32 if_khz; +}; + +/* xc4000 callback command */ +#define XC4000_TUNER_RESET 0 + +/* For each bridge framework, when it attaches either analog or digital, + * it has to store a reference back to its _core equivalent structure, + * so that it can service the hardware by steering gpio's etc. + * Each bridge implementation is different so cast devptr accordingly. + * The xc4000 driver cares not for this value, other than ensuring + * it's passed back to a bridge during tuner_callback(). + */ + +#if defined(CONFIG_MEDIA_TUNER_XC4000) || \ + (defined(CONFIG_MEDIA_TUNER_XC4000_MODULE) && defined(MODULE)) +extern struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, + struct i2c_adapter *i2c, + struct xc4000_config *cfg); +#else +static inline struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, + struct i2c_adapter *i2c, + struct xc4000_config *cfg) +{ + printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); + return NULL; +} +#endif + +#endif diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index c519ad5eb731..a79c4ea9d7ed 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c @@ -17,6 +17,7 @@ #include "mt2266.h" #include "tuner-xc2028.h" #include "xc5000.h" +#include "xc4000.h" #include "s5h1411.h" #include "dib0070.h" #include "dib0090.h" @@ -2655,6 +2656,41 @@ static int xc5000_tuner_attach(struct dvb_usb_adapter *adap) == NULL ? -ENODEV : 0; } +static int dib0700_xc4000_tuner_callback(void *priv, int component, + int command, int arg) +{ + struct dvb_usb_adapter *adap = priv; + + if (command == XC4000_TUNER_RESET) { + /* Reset the tuner */ + dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0); + msleep(10); + dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1); + msleep(10); + } else { + err("xc4000: unknown tuner callback command: %d\n", command); + return -EINVAL; + } + + return 0; +} + +static struct xc4000_config s5h1411_xc4000_tunerconfig = { + .i2c_address = 0x64, + .if_khz = 5380, +}; + +static int xc4000_tuner_attach(struct dvb_usb_adapter *adap) +{ + err("xc4000: xc4000_tuner_attach"); + /* FIXME: generalize & move to common area */ + adap->fe->callback = dib0700_xc4000_tuner_callback; + + return dvb_attach(xc4000_attach, adap->fe, &adap->dev->i2c_adap, + &s5h1411_xc4000_tunerconfig) + == NULL ? -ENODEV : 0; +} + static struct lgdt3305_config hcw_lgdt3305_config = { .i2c_addr = 0x0e, .mpeg_mode = LGDT3305_MPEG_PARALLEL, @@ -2802,6 +2838,7 @@ struct usb_device_id dib0700_usb_id_table[] = { { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7090PVR) }, { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_AIRSTAR_TELESTICK_2) }, /* 75 */{ USB_DEVICE(USB_VID_MEDION, USB_PID_CREATIX_CTX1921) }, + { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E) }, { 0 } /* Terminating entry */ }; MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table); @@ -3762,6 +3799,37 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, }, + .rc.core = { + .rc_interval = DEFAULT_RC_INTERVAL, + .rc_codes = RC_MAP_DIB0700_RC5_TABLE, + .module_name = "dib0700", + .rc_query = dib0700_rc_query_old_firmware, + .allowed_protos = RC_TYPE_RC5 | + RC_TYPE_RC6 | + RC_TYPE_NEC, + .change_protocol = dib0700_change_protocol, + }, + }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, + .num_adapters = 1, + .adapter = { + { + .frontend_attach = stk7700ph_frontend_attach, + .tuner_attach = xc4000_tuner_attach, + + DIB0700_DEFAULT_STREAMING_CONFIG(0x02), + + .size_of_priv = sizeof(struct + dib0700_adapter_state), + }, + }, + + .num_device_descs = 1, + .devices = { + { "Pinnacle PCTV 340e HD Pro USB Stick", + { &dib0700_usb_id_table[76], NULL }, + { NULL }, + }, + }, .rc.core = { .rc_interval = DEFAULT_RC_INTERVAL, .rc_codes = RC_MAP_DIB0700_RC5_TABLE, diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index 21b15495d2d7..9b40f12cfd22 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h @@ -228,6 +228,7 @@ #define USB_PID_PINNACLE_PCTV72E 0x0236 #define USB_PID_PINNACLE_PCTV73E 0x0237 #define USB_PID_PINNACLE_PCTV310E 0x3211 +#define USB_PID_PINNACLE_PCTV340E 0x023d #define USB_PID_PINNACLE_PCTV801E 0x023a #define USB_PID_PINNACLE_PCTV801E_SE 0x023b #define USB_PID_PINNACLE_PCTV73A 0x0243 diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index a03945ab9f08..850b45d042ff 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -39,6 +39,7 @@ #include "tda9887.h" #include "xc5000.h" #include "tda18271.h" +#include "xc4000.h" #define UNSET (-1U) @@ -391,6 +392,19 @@ static void set_type(struct i2c_client *c, unsigned int type, tune_now = 0; break; } + case TUNER_XC4000: + { + struct xc4000_config xc4000_cfg = { + .i2c_address = t->i2c->addr, + /* if_khz will be set when the digital dvb_attach() occurs */ + .if_khz = 0, + }; + if (!dvb_attach(xc4000_attach, + &t->fe, t->i2c->adapter, &xc4000_cfg)) + goto attach_failed; + tune_now = 0; + break; + } default: if (!dvb_attach(simple_tuner_attach, &t->fe, t->i2c->adapter, t->i2c->addr, t->type)) diff --git a/include/media/tuner.h b/include/media/tuner.h index 963e33471835..89c290b69a5c 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h @@ -127,6 +127,8 @@ #define TUNER_PHILIPS_FMD1216MEX_MK3 78 #define TUNER_PHILIPS_FM1216MK5 79 #define TUNER_PHILIPS_FQ1216LME_MK3 80 /* Active loopthrough, no FM */ +#define TUNER_XC4000 81 /* Xceive Silicon Tuner */ + #define TUNER_PARTSNIC_PTI_5NF05 81 #define TUNER_PHILIPS_CU1216L 82 #define TUNER_NXP_TDA18271 83 -- cgit v1.2.3 From 33fb1681c61456898b986405a13222a913f10a4a Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Tue, 23 Jun 2009 22:48:02 -0300 Subject: [media] dib0700: add USB id for PCTV 340eSE Add the board profile for the PCTV 340eSE, since that's what I have here for development. [mchehab@redhat.com: rebased on the top of the current tree] Signed-off-by: Devin Heitmueller Cc: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/dib0700_devices.c | 7 ++++++- drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index a79c4ea9d7ed..66c6de98c97b 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c @@ -2839,6 +2839,7 @@ struct usb_device_id dib0700_usb_id_table[] = { { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_AIRSTAR_TELESTICK_2) }, /* 75 */{ USB_DEVICE(USB_VID_MEDION, USB_PID_CREATIX_CTX1921) }, { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E) }, + { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E_SE) }, { 0 } /* Terminating entry */ }; MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table); @@ -3823,12 +3824,16 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, }, - .num_device_descs = 1, + .num_device_descs = 2, .devices = { { "Pinnacle PCTV 340e HD Pro USB Stick", { &dib0700_usb_id_table[76], NULL }, { NULL }, }, + { "Pinnacle PCTV Hybrid Stick Solo", + { &dib0700_usb_id_table[77], NULL }, + { NULL }, + }, }, .rc.core = { .rc_interval = DEFAULT_RC_INTERVAL, diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index 9b40f12cfd22..20e47882827b 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h @@ -228,9 +228,10 @@ #define USB_PID_PINNACLE_PCTV72E 0x0236 #define USB_PID_PINNACLE_PCTV73E 0x0237 #define USB_PID_PINNACLE_PCTV310E 0x3211 -#define USB_PID_PINNACLE_PCTV340E 0x023d #define USB_PID_PINNACLE_PCTV801E 0x023a #define USB_PID_PINNACLE_PCTV801E_SE 0x023b +#define USB_PID_PINNACLE_PCTV340E 0x023d +#define USB_PID_PINNACLE_PCTV340E_SE 0x023e #define USB_PID_PINNACLE_PCTV73A 0x0243 #define USB_PID_PINNACLE_PCTV73ESE 0x0245 #define USB_PID_PINNACLE_PCTV74E 0x0246 -- cgit v1.2.3 From 01f16263ad8c53f368575db50ab72a287d7daa75 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Wed, 24 Jun 2009 00:07:01 -0300 Subject: [media] dib0700: properly setup GPIOs for PCTV 340e Provide a frontend setup routine for the PCTV 340e which takes into account the specific GPIO setup of the board. Note that this patch does *not* take into account the xc4000 reset pin, which is attached to the dib7000. Signed-off-by: Devin Heitmueller Cc: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/dib0700_devices.c | 64 ++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index 66c6de98c97b..5e3290739f12 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c @@ -2675,6 +2675,68 @@ static int dib0700_xc4000_tuner_callback(void *priv, int component, return 0; } +/* FIXME: none of these inputs are validated yet */ +static struct dib7000p_config pctv_340e_config = { + .output_mpeg2_in_188_bytes = 1, + + .agc_config_count = 1, + .agc = &stk7700p_7000p_mt2060_agc_config, + .bw = &stk7700p_pll_config, + + /* FIXME: need to take xc4000 out of reset */ + .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS, + .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES, + .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS, +}; + +/* PCTV 340e GPIOs map: + dib0700: + GPIO2 - CX25843 sleep + GPIO3 - CS5340 reset + GPIO5 - IRD + GPIO6 - Power Supply + GPIO8 - LNA (1=off 0=on) + GPIO10 - CX25843 reset + dib7000: + GPIO8 - xc4000 reset + */ +static int pctv340e_frontend_attach(struct dvb_usb_adapter *adap) +{ + struct dib0700_state *st = adap->dev->priv; + + /* Power Supply on */ + dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); + msleep(50); + dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); + msleep(100); /* Allow power supply to settle before probing */ + + /* cx25843 reset */ + dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); + msleep(1); /* cx25843 datasheet say 350us required */ + dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); + + /* LNA off for now */ + dib0700_set_gpio(adap->dev, GPIO8, GPIO_OUT, 1); + + /* Put the CX25843 to sleep for now since we're in digital mode */ + dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1); + + /* FIXME: not verified yet */ + dib0700_ctrl_clock(adap->dev, 72, 1); + + if (dib7000pc_detection(&adap->dev->i2c_adap) == 0) { + /* Demodulator not found for some reason? */ + return -ENODEV; + } + + adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x12, + &pctv_340e_config); + st->is_dib7000pc = 1; + + return adap->fe == NULL ? -ENODEV : 0; +} + + static struct xc4000_config s5h1411_xc4000_tunerconfig = { .i2c_address = 0x64, .if_khz = 5380, @@ -3814,7 +3876,7 @@ struct dvb_usb_device_properties dib0700_devices[] = { .num_adapters = 1, .adapter = { { - .frontend_attach = stk7700ph_frontend_attach, + .frontend_attach = pctv340e_frontend_attach, .tuner_attach = xc4000_tuner_attach, DIB0700_DEFAULT_STREAMING_CONFIG(0x02), -- cgit v1.2.3 From 59d0c37baadaba10a3966ad28bbf1663d850adf1 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Mon, 29 Jun 2009 21:11:02 -0300 Subject: [media] dib0700: successfully connect to xc4000 over i2c for PCTV 340e Use the correct i2c bus to communicate with the tuner, and properly setup the reset GPIO and i2c address. Signed-off-by: Devin Heitmueller Cc: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/dib0700_devices.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index 5e3290739f12..e9311041a556 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c @@ -2663,10 +2663,9 @@ static int dib0700_xc4000_tuner_callback(void *priv, int component, if (command == XC4000_TUNER_RESET) { /* Reset the tuner */ - dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0); - msleep(10); - dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1); + dib7000p_set_gpio(adap->fe, 8, 0, 0); msleep(10); + dib7000p_set_gpio(adap->fe, 8, 0, 1); } else { err("xc4000: unknown tuner callback command: %d\n", command); return -EINVAL; @@ -2683,7 +2682,6 @@ static struct dib7000p_config pctv_340e_config = { .agc = &stk7700p_7000p_mt2060_agc_config, .bw = &stk7700p_pll_config, - /* FIXME: need to take xc4000 out of reset */ .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS, .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES, .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS, @@ -2738,17 +2736,26 @@ static int pctv340e_frontend_attach(struct dvb_usb_adapter *adap) static struct xc4000_config s5h1411_xc4000_tunerconfig = { - .i2c_address = 0x64, + .i2c_address = 0x61, .if_khz = 5380, }; static int xc4000_tuner_attach(struct dvb_usb_adapter *adap) { - err("xc4000: xc4000_tuner_attach"); - /* FIXME: generalize & move to common area */ + struct i2c_adapter *tun_i2c; + + /* The xc4000 is not on the main i2c bus */ + tun_i2c = dib7000p_get_i2c_master(adap->fe, + DIBX000_I2C_INTERFACE_TUNER, 1); + if (tun_i2c == NULL) { + printk("Could not reach tuner i2c bus\n"); + return 0; + } + + /* Setup the reset callback */ adap->fe->callback = dib0700_xc4000_tuner_callback; - return dvb_attach(xc4000_attach, adap->fe, &adap->dev->i2c_adap, + return dvb_attach(xc4000_attach, adap->fe, tun_i2c, &s5h1411_xc4000_tunerconfig) == NULL ? -ENODEV : 0; } -- cgit v1.2.3 From 2750d9c3afe7c4b9a21993d79fe31b8d44bde5bd Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Mon, 20 Jul 2009 00:42:33 -0300 Subject: [media] dib0700: add a sleep before attempting to detect dib7000p Add a sleep since in some cases the dib7000p wasn't online when being probed. The optimal timing has not yet been determined. Signed-off-by: Devin Heitmueller Cc: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/dib0700_devices.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index e9311041a556..5da350429907 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c @@ -2722,6 +2722,8 @@ static int pctv340e_frontend_attach(struct dvb_usb_adapter *adap) /* FIXME: not verified yet */ dib0700_ctrl_clock(adap->dev, 72, 1); + msleep(500); + if (dib7000pc_detection(&adap->dev->i2c_adap) == 0) { /* Demodulator not found for some reason? */ return -ENODEV; -- cgit v1.2.3 From 85ec9d7193a0d98e1c2af78d3a2110dd96c6cf02 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Mon, 20 Jul 2009 00:45:25 -0300 Subject: [media] dib7000p: setup dev.parent for i2c master built into 7000p We need to set the dev.parent member on the dib7000p on its i2c master, or else calls to request_firmware() will hit an oops in 2.6.31. Signed-off-by: Devin Heitmueller Cc: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/dib7000p.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/dvb/frontends/dib7000p.c b/drivers/media/dvb/frontends/dib7000p.c index 0c9f40c2a251..a64a538ba364 100644 --- a/drivers/media/dvb/frontends/dib7000p.c +++ b/drivers/media/dvb/frontends/dib7000p.c @@ -2336,6 +2336,11 @@ struct dvb_frontend *dib7000p_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, request_firmware() will hit an OOPS (this should be moved somewhere more common) */ + /* FIXME: make sure the dev.parent field is initialized, or else + request_firmware() will hit an OOPS (this should be moved somewhere + more common) */ + st->i2c_master.gated_tuner_i2c_adap.dev.parent = i2c_adap->dev.parent; + dibx000_init_i2c_master(&st->i2c_master, DIB7000P, st->i2c_adap, st->i2c_addr); /* init 7090 tuner adapter */ -- cgit v1.2.3 From 11091a31fbf7496294795ca72d69db0233857d94 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Mon, 20 Jul 2009 00:54:57 -0300 Subject: [media] xc4000: pull in firmware management code from xc3028 Switch over to using the firmware management routines from the tuner-xc2028, since that has support for scodes, etc. This code still requires signficant cleanup, and at this point the base firmware does not load properly (i2c write errors about 300 bytes in). Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 424 ++++++++++++++++++++++++++++++++--- 1 file changed, 393 insertions(+), 31 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 68f5e2beee1e..98ec80abb047 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -28,11 +28,13 @@ #include #include #include +#include #include "dvb_frontend.h" #include "xc4000.h" #include "tuner-i2c.h" +#include "tuner-xc2028-types.h" static int debug; module_param(debug, int, 0644); @@ -50,13 +52,34 @@ static LIST_HEAD(hybrid_tuner_instance_list); #define dprintk(level, fmt, arg...) if (debug >= level) \ printk(KERN_INFO "%s: " fmt, "xc4000", ## arg) -#define XC4000_DEFAULT_FIRMWARE "dvb-fe-xc4000-1.4.26.fw" -#define XC4000_DEFAULT_FIRMWARE_SIZE 8236 +#define XC4000_DEFAULT_FIRMWARE "xc4000-01.fw" +#define XC4000_DEFAULT_FIRMWARE_SIZE 8434 + + +/* struct for storing firmware table */ +struct firmware_description { + unsigned int type; + v4l2_std_id id; + __u16 int_freq; + unsigned char *ptr; + unsigned int size; +}; + +struct firmware_properties { + unsigned int type; + v4l2_std_id id; + v4l2_std_id std_req; + __u16 int_freq; + unsigned int scode_table; + int scode_nr; +}; struct xc4000_priv { struct tuner_i2c_props i2c_props; struct list_head hybrid_tuner_instance_list; - + struct firmware_description *firm; + int firm_size; + __u16 firm_version; u32 if_khz; u32 freq_hz; u32 bandwidth; @@ -167,10 +190,6 @@ struct XC_TV_STANDARD { #define DK_SECAM_A2MONO 14 #define L_SECAM_NICAM 15 #define LC_SECAM_NICAM 16 -#define DTV6 17 -#define DTV8 18 -#define DTV7_8 19 -#define DTV7 20 #define FM_Radio_INPUT2 21 #define FM_Radio_INPUT1 22 @@ -575,42 +594,358 @@ static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val) return XC_RESULT_SUCCESS; } + +static int seek_firmware(struct dvb_frontend *fe, unsigned int type, + v4l2_std_id *id) +{ + struct xc4000_priv *priv = fe->tuner_priv; + int i, best_i = -1, best_nr_matches = 0; + unsigned int type_mask = 0; + + printk("%s called, want type=", __func__); + if (debug) { +// dump_firm_type(type); + printk("(%x), id %016llx.\n", type, (unsigned long long)*id); + } + + if (!priv->firm) { + printk("Error! firmware not loaded\n"); + return -EINVAL; + } + + if (((type & ~SCODE) == 0) && (*id == 0)) + *id = V4L2_STD_PAL; + + if (type & BASE) + type_mask = BASE_TYPES; + else if (type & SCODE) { + type &= SCODE_TYPES; + type_mask = SCODE_TYPES & ~HAS_IF; + } else if (type & DTV_TYPES) + type_mask = DTV_TYPES; + else if (type & STD_SPECIFIC_TYPES) + type_mask = STD_SPECIFIC_TYPES; + + type &= type_mask; + + if (!(type & SCODE)) + type_mask = ~0; + + /* Seek for exact match */ + for (i = 0; i < priv->firm_size; i++) { + if ((type == (priv->firm[i].type & type_mask)) && + (*id == priv->firm[i].id)) + goto found; + } + + /* Seek for generic video standard match */ + for (i = 0; i < priv->firm_size; i++) { + v4l2_std_id match_mask; + int nr_matches; + + if (type != (priv->firm[i].type & type_mask)) + continue; + + match_mask = *id & priv->firm[i].id; + if (!match_mask) + continue; + + if ((*id & match_mask) == *id) + goto found; /* Supports all the requested standards */ + + nr_matches = hweight64(match_mask); + if (nr_matches > best_nr_matches) { + best_nr_matches = nr_matches; + best_i = i; + } + } + + if (best_nr_matches > 0) { + printk("Selecting best matching firmware (%d bits) for " + "type=", best_nr_matches); +// dump_firm_type(type); + printk("(%x), id %016llx:\n", type, (unsigned long long)*id); + i = best_i; + goto found; + } + + /*FIXME: Would make sense to seek for type "hint" match ? */ + + i = -ENOENT; + goto ret; + +found: + *id = priv->firm[i].id; + +ret: + printk("%s firmware for type=", (i < 0) ? "Can't find" : "Found"); + if (debug) { +// dump_firm_type(type); + printk("(%x), id %016llx.\n", type, (unsigned long long)*id); + } + return i; +} + +static int load_firmware(struct dvb_frontend *fe, unsigned int type, + v4l2_std_id *id) +{ + struct xc4000_priv *priv = fe->tuner_priv; + int pos, rc; + unsigned char *p, *endp, buf[XC_MAX_I2C_WRITE_LENGTH]; + + printk("%s called\n", __func__); + + pos = seek_firmware(fe, type, id); + if (pos < 0) + return pos; + + printk("Loading firmware for type="); +// dump_firm_type(priv->firm[pos].type); + printk("(%x), id %016llx.\n", priv->firm[pos].type, + (unsigned long long)*id); + + p = priv->firm[pos].ptr; + endp = p + priv->firm[pos].size; + + while (p < endp) { + __u16 size; + + printk("block %02x %02x %02x %02x %02x %02x\n", p[0], p[1], p[2], p[3], p[4], p[5]); + + /* Checks if there's enough bytes to read */ + if (p + sizeof(size) > endp) { + printk("Firmware chunk size is wrong\n"); + return -EINVAL; + } + + size = be16_to_cpu(*(__u16 *) p); + p += sizeof(size); + + printk("djh size=%x\n", size); + + if (size == 0xffff) + return 0; + + if (!size) { + /* Special callback command received */ + rc = xc4000_TunerReset(fe); + if (rc != XC_RESULT_SUCCESS) { + printk("Error at RESET code %d\n", + (*p) & 0x7f); + return -EINVAL; + } + continue; + } + if (size >= 0xff00) { + switch (size) { +#ifdef DJH_XXX + case 0xff00: + rc = do_tuner_callback(fe, XC2028_RESET_CLK, 0); + if (rc < 0) { + printk("Error at RESET code %d\n", + (*p) & 0x7f); + return -EINVAL; + } + break; +#endif + default: + printk("Invalid RESET code %d\n", + size & 0x7f); + return -EINVAL; + + } + continue; + } + + /* Checks for a sleep command */ + if (size & 0x8000) { + printk("djh doing msleep for %x\n", (size & 0x7fff)); + msleep(size & 0x7fff); + continue; + } + + if ((size + p > endp)) { + printk("missing bytes: need %d, have %d\n", + size, (int)(endp - p)); + return -EINVAL; + } + + buf[0] = *p; + p++; + size--; + + /* Sends message chunks */ + printk("djh final size %d\n", size); + while (size > 0) { + int len = (size < XC_MAX_I2C_WRITE_LENGTH - 1) ? + size : XC_MAX_I2C_WRITE_LENGTH - 1; + + memcpy(buf + 1, p, len); + +// rc = i2c_send(priv, buf, len + 1); + printk("djh sending %d\n", len + 1); + rc = xc_send_i2c_data(priv, buf, len + 1); + if (rc < 0) { + printk("%d returned from send\n", rc); + return -EINVAL; + } + + p += len; + size -= len; + } + } + return 0; +} + +//static int load_all_firmwares(struct dvb_frontend *fe) static int xc4000_fwupload(struct dvb_frontend *fe) { struct xc4000_priv *priv = fe->tuner_priv; - const struct firmware *fw; - int ret; + const struct firmware *fw = NULL; + const unsigned char *p, *endp; + int rc = 0; + int n, n_array; + char name[33]; + char *fname; + + printk("%s called\n", __func__); + + fname = XC4000_DEFAULT_FIRMWARE; + + printk("Reading firmware %s\n", fname); + rc = request_firmware(&fw, fname, priv->i2c_props.adap->dev.parent); + if (rc < 0) { + if (rc == -ENOENT) + printk("Error: firmware %s not found.\n", + fname); + else + printk("Error %d while requesting firmware %s \n", + rc, fname); - /* request the firmware, this will block and timeout */ - printk(KERN_INFO "xc4000: waiting for firmware upload (%s)...\n", - XC4000_DEFAULT_FIRMWARE); + return rc; + } + p = fw->data; + endp = p + fw->size; - ret = request_firmware(&fw, XC4000_DEFAULT_FIRMWARE, - priv->i2c_props.adap->dev.parent); - if (ret) { - printk(KERN_ERR "xc4000: Upload failed. (file not found?)\n"); - ret = XC_RESULT_RESET_FAILURE; - goto out; - } else { - printk(KERN_DEBUG "xc4000: firmware read %Zu bytes.\n", - fw->size); - ret = XC_RESULT_SUCCESS; + if (fw->size < sizeof(name) - 1 + 2 + 2) { + printk("Error: firmware file %s has invalid size!\n", + fname); + goto corrupt; } - if (fw->size != XC4000_DEFAULT_FIRMWARE_SIZE) { - printk(KERN_ERR "xc4000: firmware incorrect size\n"); - ret = XC_RESULT_RESET_FAILURE; - } else { - printk(KERN_INFO "xc4000: firmware uploading...\n"); - ret = xc_load_i2c_sequence(fe, fw->data); - printk(KERN_INFO "xc4000: firmware upload complete...\n"); + memcpy(name, p, sizeof(name) - 1); + name[sizeof(name) - 1] = 0; + p += sizeof(name) - 1; + + priv->firm_version = get_unaligned_le16(p); + p += 2; + + n_array = get_unaligned_le16(p); + p += 2; + + printk("Loading %d firmware images from %s, type: %s, ver %d.%d\n", + n_array, fname, name, + priv->firm_version >> 8, priv->firm_version & 0xff); + + priv->firm = kzalloc(sizeof(*priv->firm) * n_array, GFP_KERNEL); + if (priv->firm == NULL) { + printk("Not enough memory to load firmware file.\n"); + rc = -ENOMEM; + goto err; + } + priv->firm_size = n_array; + + n = -1; + while (p < endp) { + __u32 type, size; + v4l2_std_id id; + __u16 int_freq = 0; + + n++; + if (n >= n_array) { + printk("More firmware images in file than " + "were expected!\n"); + goto corrupt; + } + + /* Checks if there's enough bytes to read */ + if (endp - p < sizeof(type) + sizeof(id) + sizeof(size)) + goto header; + + type = get_unaligned_le32(p); + p += sizeof(type); + + id = get_unaligned_le64(p); + p += sizeof(id); + + if (type & HAS_IF) { + int_freq = get_unaligned_le16(p); + p += sizeof(int_freq); + if (endp - p < sizeof(size)) + goto header; + } + + size = get_unaligned_le32(p); + p += sizeof(size); + + if (!size || size > endp - p) { + printk("Firmware type "); +// dump_firm_type(type); + printk("(%x), id %llx is corrupted " + "(size=%d, expected %d)\n", + type, (unsigned long long)id, + (unsigned)(endp - p), size); + goto corrupt; + } + + priv->firm[n].ptr = kzalloc(size, GFP_KERNEL); + if (priv->firm[n].ptr == NULL) { + printk("Not enough memory to load firmware file.\n"); + rc = -ENOMEM; + goto err; + } + printk("Reading firmware type "); + if (debug) { +// dump_firm_type_and_int_freq(type, int_freq); + printk("(%x), id %llx, size=%d.\n", + type, (unsigned long long)id, size); + } + + memcpy(priv->firm[n].ptr, p, size); + priv->firm[n].type = type; + priv->firm[n].id = id; + priv->firm[n].size = size; + priv->firm[n].int_freq = int_freq; + + p += size; } -out: + if (n + 1 != priv->firm_size) { + printk("Firmware file is incomplete!\n"); + goto corrupt; + } + + goto done; + +header: + printk("Firmware header is incomplete!\n"); +corrupt: + rc = -EINVAL; + printk("Error: firmware file is corrupted!\n"); + +err: + printk("Releasing partially loaded firmware file.\n"); +// free_firmware(priv); + +done: release_firmware(fw); - return ret; + if (rc == 0) + printk("Firmware files loaded.\n"); + + return rc; } + static void xc_debug_dump(struct xc4000_priv *priv) { u16 adc_envelope; @@ -1002,7 +1337,9 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, { struct xc4000_priv *priv = NULL; int instance; + v4l2_std_id std0; u16 id = 0; + int rc; dprintk(1, "%s(%d-%04x)\n", __func__, i2c ? i2c_adapter_id(i2c) : -1, @@ -1069,6 +1406,31 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, memcpy(&fe->ops.tuner_ops, &xc4000_tuner_ops, sizeof(struct dvb_tuner_ops)); + /* FIXME: For now, load the firmware at startup. We will remove this + before the code goes to production... */ + xc4000_fwupload(fe); + printk("xc4000_fwupload done\n"); + + std0 = 0; +// rc = load_firmware(fe, BASE | new_fw.type, &std0); + rc = load_firmware(fe, BASE, &std0); + if (rc < 0) { + tuner_err("Error %d while loading base firmware\n", + rc); + goto fail; + } + + /* Load INIT1, if needed */ + tuner_dbg("Load init1 firmware, if exists\n"); + +// rc = load_firmware(fe, BASE | INIT1 | new_fw.type, &std0); + rc = load_firmware(fe, INIT1, &std0); + printk("init1 load result %x\n", rc); + + if (xc4000_readreg(priv, XREG_PRODUCT_ID, &id) != XC_RESULT_SUCCESS) + goto fail; + printk("djh id is now %x\n", id); + return fe; fail: mutex_unlock(&xc4000_list_mutex); -- cgit v1.2.3 From 31f880e2b99a780a4ee5fb6199e489b62e0a76ec Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Mon, 20 Jul 2009 02:15:31 -0300 Subject: [media] xc4000: cut over to using xc5000 version for loading i2c sequences The xc3028 version does i2c splitting in a different manner than xc4000 and xc5000, so reuse the xc5000 version of the routine (the key here being that xc4000 expects the first *two* bytes to be the same for splitting transactions. Doing it the xc3028 way was resulting in i2c errors partially through the firmware load. With this change, it would appear that the entire base firmware is being loaded successfully (product id now properly shows 0x0FA0). Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 95 ++---------------------------------- 1 file changed, 5 insertions(+), 90 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 98ec80abb047..5d1390c2f50d 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -691,7 +691,7 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type, { struct xc4000_priv *priv = fe->tuner_priv; int pos, rc; - unsigned char *p, *endp, buf[XC_MAX_I2C_WRITE_LENGTH]; + unsigned char *p; printk("%s called\n", __func__); @@ -705,96 +705,11 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type, (unsigned long long)*id); p = priv->firm[pos].ptr; - endp = p + priv->firm[pos].size; - while (p < endp) { - __u16 size; - - printk("block %02x %02x %02x %02x %02x %02x\n", p[0], p[1], p[2], p[3], p[4], p[5]); - - /* Checks if there's enough bytes to read */ - if (p + sizeof(size) > endp) { - printk("Firmware chunk size is wrong\n"); - return -EINVAL; - } - - size = be16_to_cpu(*(__u16 *) p); - p += sizeof(size); - - printk("djh size=%x\n", size); + rc = xc_load_i2c_sequence(fe, p); + printk("load i2c sequence result=%d\n", rc); - if (size == 0xffff) - return 0; - - if (!size) { - /* Special callback command received */ - rc = xc4000_TunerReset(fe); - if (rc != XC_RESULT_SUCCESS) { - printk("Error at RESET code %d\n", - (*p) & 0x7f); - return -EINVAL; - } - continue; - } - if (size >= 0xff00) { - switch (size) { -#ifdef DJH_XXX - case 0xff00: - rc = do_tuner_callback(fe, XC2028_RESET_CLK, 0); - if (rc < 0) { - printk("Error at RESET code %d\n", - (*p) & 0x7f); - return -EINVAL; - } - break; -#endif - default: - printk("Invalid RESET code %d\n", - size & 0x7f); - return -EINVAL; - - } - continue; - } - - /* Checks for a sleep command */ - if (size & 0x8000) { - printk("djh doing msleep for %x\n", (size & 0x7fff)); - msleep(size & 0x7fff); - continue; - } - - if ((size + p > endp)) { - printk("missing bytes: need %d, have %d\n", - size, (int)(endp - p)); - return -EINVAL; - } - - buf[0] = *p; - p++; - size--; - - /* Sends message chunks */ - printk("djh final size %d\n", size); - while (size > 0) { - int len = (size < XC_MAX_I2C_WRITE_LENGTH - 1) ? - size : XC_MAX_I2C_WRITE_LENGTH - 1; - - memcpy(buf + 1, p, len); - -// rc = i2c_send(priv, buf, len + 1); - printk("djh sending %d\n", len + 1); - rc = xc_send_i2c_data(priv, buf, len + 1); - if (rc < 0) { - printk("%d returned from send\n", rc); - return -EINVAL; - } - - p += len; - size -= len; - } - } - return 0; + return rc; } //static int load_all_firmwares(struct dvb_frontend *fe) @@ -1414,7 +1329,7 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, std0 = 0; // rc = load_firmware(fe, BASE | new_fw.type, &std0); rc = load_firmware(fe, BASE, &std0); - if (rc < 0) { + if (rc != XC_RESULT_SUCCESS) { tuner_err("Error %d while loading base firmware\n", rc); goto fail; -- cgit v1.2.3 From 6bf60d56b36d7d4d0bdfb2996d56b064923ea541 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Wed, 22 Jul 2009 21:49:28 -0300 Subject: [media] xc4000: properly set type for init1 firmware We need to set the firmware type properly in order to locate the init1 firmware. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 5d1390c2f50d..a7f8b29e38fd 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -1339,7 +1339,7 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, tuner_dbg("Load init1 firmware, if exists\n"); // rc = load_firmware(fe, BASE | INIT1 | new_fw.type, &std0); - rc = load_firmware(fe, INIT1, &std0); + rc = load_firmware(fe, BASE | INIT1, &std0); printk("init1 load result %x\n", rc); if (xc4000_readreg(priv, XREG_PRODUCT_ID, &id) != XC_RESULT_SUCCESS) -- cgit v1.2.3 From 02dec509825dd5cb9f4bfa0526c75c0a7c20348a Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Wed, 22 Jul 2009 21:52:11 -0300 Subject: [media] xc4000: remove XREG_BUSY code only supported in xc5000 The xc4000 driver is based on the original xc5000 driver, and while the xc5000 supports the XREG_BUSY register, the xc4000 does not. So remove the code in question. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index a7f8b29e38fd..fd9119eb3316 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -130,7 +130,6 @@ struct xc4000_priv { #define XREG_SNR 0x06 #define XREG_VERSION 0x07 #define XREG_PRODUCT_ID 0x08 -//#define XREG_BUSY 0x09 //#define XREG_BUILD 0x0D /* @@ -310,7 +309,6 @@ static int xc4000_TunerReset(struct dvb_frontend *fe) static int xc_write_reg(struct xc4000_priv *priv, u16 regAddr, u16 i2cData) { u8 buf[4]; -// int WatchDogTimer = 100; int result; buf[0] = (regAddr >> 8) & 0xFF; @@ -318,30 +316,6 @@ static int xc_write_reg(struct xc4000_priv *priv, u16 regAddr, u16 i2cData) buf[2] = (i2cData >> 8) & 0xFF; buf[3] = i2cData & 0xFF; result = xc_send_i2c_data(priv, buf, 4); -//WAS THERE -// if (result == XC_RESULT_SUCCESS) { -// /* wait for busy flag to clear */ -// while ((WatchDogTimer > 0) && (result == XC_RESULT_SUCCESS)) { -// buf[0] = 0; -// buf[1] = XREG_BUSY; -// -// result = xc_send_i2c_data(priv, buf, 2); -// if (result == XC_RESULT_SUCCESS) { -// result = xc_read_i2c_data(priv, buf, 2); -// if (result == XC_RESULT_SUCCESS) { -// if ((buf[0] == 0) && (buf[1] == 0)) { -// /* busy flag cleared */ -// break; -// } else { -// xc_wait(5); /* wait 5 ms */ -// WatchDogTimer--; -// } -// } -// } -// } -// } -// if (WatchDogTimer < 0) -// result = XC_RESULT_I2C_WRITE_FAILURE; return result; } -- cgit v1.2.3 From e7490d5962ad7959c0597cd55c97ff7eae3acf82 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Wed, 22 Jul 2009 21:56:37 -0300 Subject: [media] xc4000: remove xc5000 firmware loading routine Since we use the xc3028 version of the firmware file parsing routine (which includes support for scodes and separate blobs), we can drop the xc5000 version of the code. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index fd9119eb3316..6d5ab599e83a 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -568,7 +568,6 @@ static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val) return XC_RESULT_SUCCESS; } - static int seek_firmware(struct dvb_frontend *fe, unsigned int type, v4l2_std_id *id) { @@ -686,7 +685,6 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type, return rc; } -//static int load_all_firmwares(struct dvb_frontend *fe) static int xc4000_fwupload(struct dvb_frontend *fe) { struct xc4000_priv *priv = fe->tuner_priv; -- cgit v1.2.3 From d0962382cf6ca55e5a33413b39a10fe2f56bae78 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Sat, 25 Jul 2009 17:39:54 -0300 Subject: [media] xc4000: add code to do standard and scode firmware loading Add code to handle firmware blobs for the standard and scode. Note there appears to be some issue with loading the DTV8 standard firmware, probably related to direct/indirect mode. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 341 ++++++++++++++++++++++++++++++++++- 1 file changed, 332 insertions(+), 9 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 6d5ab599e83a..19973887312a 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -36,7 +36,7 @@ #include "tuner-i2c.h" #include "tuner-xc2028-types.h" -static int debug; +static int debug=1; module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); @@ -52,8 +52,8 @@ static LIST_HEAD(hybrid_tuner_instance_list); #define dprintk(level, fmt, arg...) if (debug >= level) \ printk(KERN_INFO "%s: " fmt, "xc4000", ## arg) -#define XC4000_DEFAULT_FIRMWARE "xc4000-01.fw" -#define XC4000_DEFAULT_FIRMWARE_SIZE 8434 +#define XC4000_DEFAULT_FIRMWARE "xc4000-02.fw" +#define XC4000_DEFAULT_FIRMWARE_SIZE 18643 /* struct for storing firmware table */ @@ -85,6 +85,10 @@ struct xc4000_priv { u32 bandwidth; u8 video_standard; u8 rf_mode; +// struct xc2028_ctrl ctrl; + struct firmware_properties cur_fw; + __u16 hwmodel; + __u16 hwvers; }; /* Misc Defines */ @@ -568,6 +572,73 @@ static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val) return XC_RESULT_SUCCESS; } +#define dump_firm_type(t) dump_firm_type_and_int_freq(t, 0) +static void dump_firm_type_and_int_freq(unsigned int type, u16 int_freq) +{ + if (type & BASE) + printk("BASE "); + if (type & INIT1) + printk("INIT1 "); + if (type & F8MHZ) + printk("F8MHZ "); + if (type & MTS) + printk("MTS "); + if (type & D2620) + printk("D2620 "); + if (type & D2633) + printk("D2633 "); + if (type & DTV6) + printk("DTV6 "); + if (type & QAM) + printk("QAM "); + if (type & DTV7) + printk("DTV7 "); + if (type & DTV78) + printk("DTV78 "); + if (type & DTV8) + printk("DTV8 "); + if (type & FM) + printk("FM "); + if (type & INPUT1) + printk("INPUT1 "); + if (type & LCD) + printk("LCD "); + if (type & NOGD) + printk("NOGD "); + if (type & MONO) + printk("MONO "); + if (type & ATSC) + printk("ATSC "); + if (type & IF) + printk("IF "); + if (type & LG60) + printk("LG60 "); + if (type & ATI638) + printk("ATI638 "); + if (type & OREN538) + printk("OREN538 "); + if (type & OREN36) + printk("OREN36 "); + if (type & TOYOTA388) + printk("TOYOTA388 "); + if (type & TOYOTA794) + printk("TOYOTA794 "); + if (type & DIBCOM52) + printk("DIBCOM52 "); + if (type & ZARLINK456) + printk("ZARLINK456 "); + if (type & CHINA) + printk("CHINA "); + if (type & F6MHZ) + printk("F6MHZ "); + if (type & INPUT2) + printk("INPUT2 "); + if (type & SCODE) + printk("SCODE "); + if (type & HAS_IF) + printk("HAS_IF_%d ", int_freq); +} + static int seek_firmware(struct dvb_frontend *fe, unsigned int type, v4l2_std_id *id) { @@ -577,7 +648,7 @@ static int seek_firmware(struct dvb_frontend *fe, unsigned int type, printk("%s called, want type=", __func__); if (debug) { -// dump_firm_type(type); + dump_firm_type(type); printk("(%x), id %016llx.\n", type, (unsigned long long)*id); } @@ -653,8 +724,10 @@ found: ret: printk("%s firmware for type=", (i < 0) ? "Can't find" : "Found"); if (debug) { -// dump_firm_type(type); + dump_firm_type(type); printk("(%x), id %016llx.\n", type, (unsigned long long)*id); + if (i < 0) + dump_stack(); } return i; } @@ -680,7 +753,6 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type, p = priv->firm[pos].ptr; rc = xc_load_i2c_sequence(fe, p); - printk("load i2c sequence result=%d\n", rc); return rc; } @@ -791,9 +863,10 @@ static int xc4000_fwupload(struct dvb_frontend *fe) rc = -ENOMEM; goto err; } - printk("Reading firmware type "); + if (debug) { -// dump_firm_type_and_int_freq(type, int_freq); + printk("Reading firmware type "); + dump_firm_type_and_int_freq(type, int_freq); printk("(%x), id %llx, size=%d.\n", type, (unsigned long long)id, size); } @@ -832,6 +905,253 @@ done: return rc; } +static int load_scode(struct dvb_frontend *fe, unsigned int type, + v4l2_std_id *id, __u16 int_freq, int scode) +{ + struct xc4000_priv *priv = fe->tuner_priv; + int pos, rc; + unsigned char *p; + u8 direct_mode[4]; + u8 indirect_mode[5]; + + dprintk(1, "%s called\n", __func__); + + if (!int_freq) { + pos = seek_firmware(fe, type, id); + if (pos < 0) + return pos; + } else { + for (pos = 0; pos < priv->firm_size; pos++) { + if ((priv->firm[pos].int_freq == int_freq) && + (priv->firm[pos].type & HAS_IF)) + break; + } + if (pos == priv->firm_size) + return -ENOENT; + } + + p = priv->firm[pos].ptr; + + if (priv->firm[pos].type & HAS_IF) { + if (priv->firm[pos].size != 12 * 16 || scode >= 16) + return -EINVAL; + p += 12 * scode; + } else { + /* 16 SCODE entries per file; each SCODE entry is 12 bytes and + * has a 2-byte size header in the firmware format. */ + if (priv->firm[pos].size != 14 * 16 || scode >= 16 || + le16_to_cpu(*(__u16 *)(p + 14 * scode)) != 12) + return -EINVAL; + p += 14 * scode + 2; + } + + tuner_info("Loading SCODE for type="); + dump_firm_type_and_int_freq(priv->firm[pos].type, + priv->firm[pos].int_freq); + printk("(%x), id %016llx.\n", priv->firm[pos].type, + (unsigned long long)*id); + + + /* Enter direct-mode */ + memset(direct_mode, 0, sizeof(direct_mode)); + direct_mode[1] = 0x05; + rc = xc_send_i2c_data(priv, direct_mode, sizeof(direct_mode)); + if (rc < 0) + return -EIO; + + rc = xc_send_i2c_data(priv, p, 12); + if (rc != XC_RESULT_SUCCESS) + return -EIO; + + /* Switch back to indirect-mode */ + memset(indirect_mode, 0, sizeof(indirect_mode)); + indirect_mode[4] = 0x88; + rc = xc_send_i2c_data(priv, indirect_mode, sizeof(indirect_mode)); + if (rc < 0) + return -EIO; + + return 0; +} + +static int check_firmware(struct dvb_frontend *fe, unsigned int type, + v4l2_std_id std, __u16 int_freq) +{ + struct xc4000_priv *priv = fe->tuner_priv; + struct firmware_properties new_fw; + int rc = 0, is_retry = 0; + u16 version, hwmodel; + v4l2_std_id std0; + u8 hw_major, hw_minor, fw_major, fw_minor; + + dprintk(1, "%s called\n", __func__); + + if (!priv->firm) { + rc = xc4000_fwupload(fe); + if (rc < 0) + return rc; + } + +#ifdef DJH_DEBUG + if (priv->ctrl.mts && !(type & FM)) + type |= MTS; +#endif + +retry: + new_fw.type = type; + new_fw.id = std; + new_fw.std_req = std; +// new_fw.scode_table = SCODE | priv->ctrl.scode_table; + new_fw.scode_table = SCODE; + new_fw.scode_nr = 0; + new_fw.int_freq = int_freq; + + dprintk(1, "checking firmware, user requested type="); + if (debug) { + dump_firm_type(new_fw.type); + printk("(%x), id %016llx, ", new_fw.type, + (unsigned long long)new_fw.std_req); + if (!int_freq) { + printk("scode_tbl "); +#ifdef DJH_DEBUG + dump_firm_type(priv->ctrl.scode_table); + printk("(%x), ", priv->ctrl.scode_table); +#endif + } else + printk("int_freq %d, ", new_fw.int_freq); + printk("scode_nr %d\n", new_fw.scode_nr); + } + + /* No need to reload base firmware if it matches */ + if (((BASE | new_fw.type) & BASE_TYPES) == + (priv->cur_fw.type & BASE_TYPES)) { + dprintk(1, "BASE firmware not changed.\n"); + goto skip_base; + } + + /* Updating BASE - forget about all currently loaded firmware */ + memset(&priv->cur_fw, 0, sizeof(priv->cur_fw)); + + /* Reset is needed before loading firmware */ + rc = xc4000_TunerReset(fe); + if (rc < 0) + goto fail; + + /* BASE firmwares are all std0 */ + std0 = 0; + rc = load_firmware(fe, BASE | new_fw.type, &std0); + if (rc < 0) { + printk("Error %d while loading base firmware\n", rc); + goto fail; + } + + /* Load INIT1, if needed */ + dprintk(1, "Load init1 firmware, if exists\n"); + + rc = load_firmware(fe, BASE | INIT1 | new_fw.type, &std0); + if (rc == -ENOENT) + rc = load_firmware(fe, (BASE | INIT1 | new_fw.type) & ~F8MHZ, + &std0); + if (rc < 0 && rc != -ENOENT) { + tuner_err("Error %d while loading init1 firmware\n", + rc); + goto fail; + } + +skip_base: + /* + * No need to reload standard specific firmware if base firmware + * was not reloaded and requested video standards have not changed. + */ + if (priv->cur_fw.type == (BASE | new_fw.type) && + priv->cur_fw.std_req == std) { + dprintk(1, "Std-specific firmware already loaded.\n"); + goto skip_std_specific; + } + + /* Reloading std-specific firmware forces a SCODE update */ + priv->cur_fw.scode_table = 0; + + rc = load_firmware(fe, new_fw.type, &new_fw.id); + if (rc == -ENOENT) + rc = load_firmware(fe, new_fw.type & ~F8MHZ, &new_fw.id); + + if (rc < 0) + goto fail; + +skip_std_specific: + if (priv->cur_fw.scode_table == new_fw.scode_table && + priv->cur_fw.scode_nr == new_fw.scode_nr) { + dprintk(1, "SCODE firmware already loaded.\n"); + goto check_device; + } + + if (new_fw.type & FM) + goto check_device; + + /* Load SCODE firmware, if exists */ + dprintk(1, "Trying to load scode %d\n", new_fw.scode_nr); + + rc = load_scode(fe, new_fw.type | new_fw.scode_table, &new_fw.id, + new_fw.int_freq, new_fw.scode_nr); + +check_device: + rc = xc4000_readreg(priv, XREG_PRODUCT_ID, &hwmodel); + + if (xc_get_version(priv, &hw_major, &hw_minor, &fw_major, + &fw_minor) != XC_RESULT_SUCCESS) { + printk("Unable to read tuner registers.\n"); + goto fail; + } + + dprintk(1, "Device is Xceive %d version %d.%d, " + "firmware version %d.%d\n", + hwmodel, hw_major, hw_minor, fw_major, fw_minor); + + /* Check firmware version against what we downloaded. */ +#ifdef DJH_DEBUG + if (priv->firm_version != ((version & 0xf0) << 4 | (version & 0x0f))) { + printk("Incorrect readback of firmware version %x.\n", + (version & 0xff)); + goto fail; + } +#endif + + /* Check that the tuner hardware model remains consistent over time. */ + if (priv->hwmodel == 0 && hwmodel == 4000) { + priv->hwmodel = hwmodel; + priv->hwvers = version & 0xff00; + } else if (priv->hwmodel == 0 || priv->hwmodel != hwmodel || + priv->hwvers != (version & 0xff00)) { + printk("Read invalid device hardware information - tuner " + "hung?\n"); + goto fail; + } + + memcpy(&priv->cur_fw, &new_fw, sizeof(priv->cur_fw)); + + /* + * By setting BASE in cur_fw.type only after successfully loading all + * firmwares, we can: + * 1. Identify that BASE firmware with type=0 has been loaded; + * 2. Tell whether BASE firmware was just changed the next time through. + */ + priv->cur_fw.type |= BASE; + + return 0; + +fail: + memset(&priv->cur_fw, 0, sizeof(priv->cur_fw)); + if (!is_retry) { + msleep(50); + is_retry = 1; + dprintk(1, "Retrying firmware load\n"); + goto retry; + } + + if (rc == -ENOENT) + rc = -EINVAL; + return rc; +} static void xc_debug_dump(struct xc4000_priv *priv) { @@ -1295,6 +1615,7 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, /* FIXME: For now, load the firmware at startup. We will remove this before the code goes to production... */ +#ifdef DJH_DEBUG xc4000_fwupload(fe); printk("xc4000_fwupload done\n"); @@ -1308,11 +1629,13 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, } /* Load INIT1, if needed */ - tuner_dbg("Load init1 firmware, if exists\n"); + dprintk("Load init1 firmware, if exists\n"); // rc = load_firmware(fe, BASE | INIT1 | new_fw.type, &std0); rc = load_firmware(fe, BASE | INIT1, &std0); printk("init1 load result %x\n", rc); +#endif + check_firmware(fe, DTV8, 0, 5400); if (xc4000_readreg(priv, XREG_PRODUCT_ID, &id) != XC_RESULT_SUCCESS) goto fail; -- cgit v1.2.3 From ee4c3cd67b90cb42143e230485d3aad60768c551 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Mon, 27 Jul 2009 23:51:54 -0300 Subject: [media] xc4000: continued cleanup of the firmware loading routine Properly setup the standard firmware loading and scode loading, as well as getting rid of a ton of dead code. Note that I am getting a single i2c error when the standard firmware sets the video standard, but everything else seems to be loading properly now. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 180 +++++++++-------------------------- 1 file changed, 44 insertions(+), 136 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 19973887312a..65d07ebcd2c9 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -108,23 +108,21 @@ struct xc4000_priv { /* Product id */ #define XC_PRODUCT_ID_FW_NOT_LOADED 0x2000 -#define XC_PRODUCT_ID_FW_LOADED 0x0FA0 /* WAS: 0x1388*/ +#define XC_PRODUCT_ID_FW_LOADED 0x0FA0 -/* Registers */ +/* Registers (Write-only) */ #define XREG_INIT 0x00 #define XREG_VIDEO_MODE 0x01 #define XREG_AUDIO_MODE 0x02 #define XREG_RF_FREQ 0x03 #define XREG_D_CODE 0x04 -#define XREG_IF_OUT 0x05 /* ?? */ -#define XREG_SEEK_MODE 0x07 /* WAS: 0x06 */ -#define XREG_POWER_DOWN 0x08 /* WAS: 0x0A Obsolete */ -#define XREG_SIGNALSOURCE 0x0A /* WAS: 0x0D 0=Air, 1=Cable */ -//#define XREG_SMOOTHEDCVBS 0x0E -//#define XREG_XTALFREQ 0x0F -//#define XREG_FINERFREQ 0x10 -//#define XREG_DDIMODE 0x11 +#define XREG_DIRECTSITTING_MODE 0x05 +#define XREG_SEEK_MODE 0x06 +#define XREG_POWER_DOWN 0x08 +#define XREG_SIGNALSOURCE 0x0A +#define XREG_AMPLITUDE 0x10 +/* Registers (Read-only) */ #define XREG_ADC_ENV 0x00 #define XREG_QUALITY 0x01 #define XREG_FRAME_LINES 0x02 @@ -134,7 +132,6 @@ struct xc4000_priv { #define XREG_SNR 0x06 #define XREG_VERSION 0x07 #define XREG_PRODUCT_ID 0x08 -//#define XREG_BUILD 0x0D /* Basic firmware description. This will remain with @@ -249,7 +246,6 @@ static struct XC_TV_STANDARD XC4000_Standard[MAX_TV_STANDARD] = { {"FM Radio-INPUT1", 0x0008, 0x9000} }; -static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe); static int xc4000_is_firmware_loaded(struct dvb_frontend *fe); static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val); static int xc4000_TunerReset(struct dvb_frontend *fe); @@ -258,7 +254,6 @@ static int xc_send_i2c_data(struct xc4000_priv *priv, u8 *buf, int len) { struct i2c_msg msg = { .addr = priv->i2c_props.addr, .flags = 0, .buf = buf, .len = len }; - if (i2c_transfer(priv->i2c_props.adap, &msg, 1) != 1) { printk(KERN_ERR "xc4000: I2C write failed (len=%i)\n", len); return XC_RESULT_I2C_WRITE_FAILURE; @@ -269,17 +264,6 @@ static int xc_send_i2c_data(struct xc4000_priv *priv, u8 *buf, int len) /* This routine is never used because the only time we read data from the i2c bus is when we read registers, and we want that to be an atomic i2c transaction in case we are on a multi-master bus */ -static int xc_read_i2c_data(struct xc4000_priv *priv, u8 *buf, int len) -{ - struct i2c_msg msg = { .addr = priv->i2c_props.addr, - .flags = I2C_M_RD, .buf = buf, .len = len }; - - if (i2c_transfer(priv->i2c_props.adap, &msg, 1) != 1) { - printk(KERN_ERR "xc4000 I2C read failed (len=%i)\n", len); - return -EREMOTEIO; - } - return 0; -} static void xc_wait(int wait_ms) { @@ -378,12 +362,6 @@ static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence) return XC_RESULT_SUCCESS; } -static int xc_initialize(struct xc4000_priv *priv) -{ - dprintk(1, "%s()\n", __func__); - return xc_write_reg(priv, XREG_INIT, 0); -} - static int xc_SetTVStandard(struct xc4000_priv *priv, u16 VideoMode, u16 AudioMode) { @@ -435,16 +413,6 @@ static int xc_set_RF_frequency(struct xc4000_priv *priv, u32 freq_hz) } -static int xc_set_IF_frequency(struct xc4000_priv *priv, u32 freq_khz) -{ - u32 freq_code = (freq_khz * 1024)/1000; - dprintk(1, "%s(freq_khz = %d) freq_code = 0x%x\n", - __func__, freq_khz, freq_code); - - return xc_write_reg(priv, XREG_IF_OUT, freq_code); -} - - static int xc_get_ADC_Envelope(struct xc4000_priv *priv, u16 *adc_envelope) { return xc4000_readreg(priv, XREG_ADC_ENV, adc_envelope); @@ -751,6 +719,7 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type, (unsigned long long)*id); p = priv->firm[pos].ptr; + printk("firmware length = %d\n", priv->firm[pos].size); rc = xc_load_i2c_sequence(fe, p); @@ -911,7 +880,7 @@ static int load_scode(struct dvb_frontend *fe, unsigned int type, struct xc4000_priv *priv = fe->tuner_priv; int pos, rc; unsigned char *p; - u8 direct_mode[4]; + u8 scode_buf[13]; u8 indirect_mode[5]; dprintk(1, "%s called\n", __func__); @@ -951,24 +920,28 @@ static int load_scode(struct dvb_frontend *fe, unsigned int type, printk("(%x), id %016llx.\n", priv->firm[pos].type, (unsigned long long)*id); + scode_buf[0] = 0x00; + memcpy(&scode_buf[1], p, 12); /* Enter direct-mode */ - memset(direct_mode, 0, sizeof(direct_mode)); - direct_mode[1] = 0x05; - rc = xc_send_i2c_data(priv, direct_mode, sizeof(direct_mode)); - if (rc < 0) + rc = xc_write_reg(priv, XREG_DIRECTSITTING_MODE, 0); + if (rc < 0) { + printk("failed to put device into direct mode!\n"); return -EIO; + } - rc = xc_send_i2c_data(priv, p, 12); - if (rc != XC_RESULT_SUCCESS) - return -EIO; + rc = xc_send_i2c_data(priv, scode_buf, 13); + if (rc != XC_RESULT_SUCCESS) { + /* Even if the send failed, make sure we set back to indirect + mode */ + printk("Failed to set scode %d\n", rc); + } /* Switch back to indirect-mode */ memset(indirect_mode, 0, sizeof(indirect_mode)); indirect_mode[4] = 0x88; - rc = xc_send_i2c_data(priv, indirect_mode, sizeof(indirect_mode)); - if (rc < 0) - return -EIO; + xc_send_i2c_data(priv, indirect_mode, sizeof(indirect_mode)); + msleep(10); return 0; } @@ -1057,6 +1030,8 @@ retry: goto fail; } + printk("Done with init1\n"); + skip_base: /* * No need to reload standard specific firmware if base firmware @@ -1071,9 +1046,8 @@ skip_base: /* Reloading std-specific firmware forces a SCODE update */ priv->cur_fw.scode_table = 0; + /* Load the standard firmware */ rc = load_firmware(fe, new_fw.type, &new_fw.id); - if (rc == -ENOENT) - rc = load_firmware(fe, new_fw.type & ~F8MHZ, &new_fw.id); if (rc < 0) goto fail; @@ -1089,10 +1063,10 @@ skip_std_specific: goto check_device; /* Load SCODE firmware, if exists */ - dprintk(1, "Trying to load scode %d\n", new_fw.scode_nr); - rc = load_scode(fe, new_fw.type | new_fw.scode_table, &new_fw.id, new_fw.int_freq, new_fw.scode_nr); + if (rc != XC_RESULT_SUCCESS) + dprintk(1, "load scode failed %d\n", rc); check_device: rc = xc4000_readreg(priv, XREG_PRODUCT_ID, &hwmodel); @@ -1209,11 +1183,13 @@ static int xc4000_set_params(struct dvb_frontend *fe, struct xc4000_priv *priv = fe->tuner_priv; int ret; - if (xc4000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) - xc_load_fw_and_init_tuner(fe); - dprintk(1, "%s() frequency=%d (Hz)\n", __func__, params->frequency); + /* FIXME: setup proper parameters */ + if (check_firmware(fe, DTV8, 0, 5400) != XC_RESULT_SUCCESS) { + return -EREMOTEIO; + } + if (fe->ops.info.type == FE_ATSC) { dprintk(1, "%s() ATSC\n", __func__); switch (params->u.vsb.modulation) { @@ -1281,14 +1257,14 @@ static int xc4000_set_params(struct dvb_frontend *fe, printk(KERN_ERR "xc4000: xc_SetTVStandard failed\n"); return -EREMOTEIO; } - +#ifdef DJH_DEBUG ret = xc_set_IF_frequency(priv, priv->if_khz); if (ret != XC_RESULT_SUCCESS) { printk(KERN_ERR "xc4000: xc_Set_IF_frequency(%d) failed\n", priv->if_khz); return -EIO; } - +#endif xc_tune_channel(priv, priv->freq_hz, XC_TUNE_DIGITAL); if (debug) @@ -1322,12 +1298,14 @@ static int xc4000_set_analog_params(struct dvb_frontend *fe, struct xc4000_priv *priv = fe->tuner_priv; int ret; - if (xc4000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) - xc_load_fw_and_init_tuner(fe); - dprintk(1, "%s() frequency=%d (in units of 62.5khz)\n", __func__, params->frequency); + /* FIXME: setup proper parameters */ + if (check_firmware(fe, DTV8, 0, 5400) != XC_RESULT_SUCCESS) { + return -EREMOTEIO; + } + /* Fix me: it could be air. */ priv->rf_mode = params->mode; if (params->mode > XC_RF_MODE_CABLE) @@ -1435,54 +1413,10 @@ static int xc4000_get_status(struct dvb_frontend *fe, u32 *status) return 0; } -static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe) -{ - struct xc4000_priv *priv = fe->tuner_priv; - int ret = 0; - - if (xc4000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) { - ret = xc4000_fwupload(fe); - if (ret != XC_RESULT_SUCCESS) - return ret; - } - - /* Start the tuner self-calibration process */ - ret |= xc_initialize(priv); - - /* Wait for calibration to complete. - * We could continue but XC4000 will clock stretch subsequent - * I2C transactions until calibration is complete. This way we - * don't have to rely on clock stretching working. - */ - xc_wait(100); - - /* Default to "CABLE" mode */ - ret |= xc_write_reg(priv, XREG_SIGNALSOURCE, XC_RF_MODE_CABLE); - - return ret; -} - static int xc4000_sleep(struct dvb_frontend *fe) { - int ret; - - dprintk(1, "%s()\n", __func__); - - /* Avoid firmware reload on slow devices */ - if (no_poweroff) - return 0; - - /* According to Xceive technical support, the "powerdown" register - was removed in newer versions of the firmware. The "supported" - way to sleep the tuner is to pull the reset pin low for 10ms */ - ret = xc4000_TunerReset(fe); - if (ret != XC_RESULT_SUCCESS) { - printk(KERN_ERR - "xc4000: %s() unable to shutdown tuner\n", - __func__); - return -EREMOTEIO; - } else - return XC_RESULT_SUCCESS; + /* FIXME: djh disable this for now... */ + return XC_RESULT_SUCCESS; } static int xc4000_init(struct dvb_frontend *fe) @@ -1490,7 +1424,7 @@ static int xc4000_init(struct dvb_frontend *fe) struct xc4000_priv *priv = fe->tuner_priv; dprintk(1, "%s()\n", __func__); - if (xc_load_fw_and_init_tuner(fe) != XC_RESULT_SUCCESS) { + if (check_firmware(fe, DTV8, 0, 5400) != XC_RESULT_SUCCESS) { printk(KERN_ERR "xc4000: Unable to initialise tuner\n"); return -EREMOTEIO; } @@ -1544,9 +1478,7 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, { struct xc4000_priv *priv = NULL; int instance; - v4l2_std_id std0; u16 id = 0; - int rc; dprintk(1, "%s(%d-%04x)\n", __func__, i2c ? i2c_adapter_id(i2c) : -1, @@ -1615,32 +1547,8 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, /* FIXME: For now, load the firmware at startup. We will remove this before the code goes to production... */ -#ifdef DJH_DEBUG - xc4000_fwupload(fe); - printk("xc4000_fwupload done\n"); - - std0 = 0; -// rc = load_firmware(fe, BASE | new_fw.type, &std0); - rc = load_firmware(fe, BASE, &std0); - if (rc != XC_RESULT_SUCCESS) { - tuner_err("Error %d while loading base firmware\n", - rc); - goto fail; - } - - /* Load INIT1, if needed */ - dprintk("Load init1 firmware, if exists\n"); - -// rc = load_firmware(fe, BASE | INIT1 | new_fw.type, &std0); - rc = load_firmware(fe, BASE | INIT1, &std0); - printk("init1 load result %x\n", rc); -#endif check_firmware(fe, DTV8, 0, 5400); - if (xc4000_readreg(priv, XREG_PRODUCT_ID, &id) != XC_RESULT_SUCCESS) - goto fail; - printk("djh id is now %x\n", id); - return fe; fail: mutex_unlock(&xc4000_list_mutex); -- cgit v1.2.3 From fe8303647640e1183640a9b85cd60c4a981c7b4b Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Tue, 28 Jul 2009 00:04:27 -0300 Subject: [media] xc4000: use if_khz provided in xc4000_config Remove hard-coded references to 5400, using the value passed in when the xc4000 is attached. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 65d07ebcd2c9..2dacf209d427 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -883,7 +883,7 @@ static int load_scode(struct dvb_frontend *fe, unsigned int type, u8 scode_buf[13]; u8 indirect_mode[5]; - dprintk(1, "%s called\n", __func__); + dprintk(1, "%s called int_freq=%d\n", __func__, int_freq); if (!int_freq) { pos = seek_firmware(fe, type, id); @@ -1186,7 +1186,7 @@ static int xc4000_set_params(struct dvb_frontend *fe, dprintk(1, "%s() frequency=%d (Hz)\n", __func__, params->frequency); /* FIXME: setup proper parameters */ - if (check_firmware(fe, DTV8, 0, 5400) != XC_RESULT_SUCCESS) { + if (check_firmware(fe, DTV8, 0, priv->if_khz) != XC_RESULT_SUCCESS) { return -EREMOTEIO; } @@ -1302,7 +1302,7 @@ static int xc4000_set_analog_params(struct dvb_frontend *fe, __func__, params->frequency); /* FIXME: setup proper parameters */ - if (check_firmware(fe, DTV8, 0, 5400) != XC_RESULT_SUCCESS) { + if (check_firmware(fe, DTV8, 0, priv->if_khz) != XC_RESULT_SUCCESS) { return -EREMOTEIO; } @@ -1424,7 +1424,7 @@ static int xc4000_init(struct dvb_frontend *fe) struct xc4000_priv *priv = fe->tuner_priv; dprintk(1, "%s()\n", __func__); - if (check_firmware(fe, DTV8, 0, 5400) != XC_RESULT_SUCCESS) { + if (check_firmware(fe, DTV8, 0, priv->if_khz) != XC_RESULT_SUCCESS) { printk(KERN_ERR "xc4000: Unable to initialise tuner\n"); return -EREMOTEIO; } @@ -1547,7 +1547,7 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, /* FIXME: For now, load the firmware at startup. We will remove this before the code goes to production... */ - check_firmware(fe, DTV8, 0, 5400); + check_firmware(fe, DTV8, 0, priv->if_khz); return fe; fail: -- cgit v1.2.3 From 8583fc834e704312fa9e7c756244895de55d800a Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Tue, 28 Jul 2009 01:16:05 -0300 Subject: [media] xc4000: setup dib7000p AGC config for PCTV 340e Setup a proper AGC config for the 340e, based on the Windows USB trace Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/dib0700_devices.c | 71 +++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 5 deletions(-) diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index 5da350429907..aaf1eabf175f 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c @@ -2674,12 +2674,73 @@ static int dib0700_xc4000_tuner_callback(void *priv, int component, return 0; } +/* validation: + band + setup 0x4b=0x64 + inv_gain 0x4c=0x02c8 + time_stabaliz 0x4d=0x0015 + alpha_level 0 (0x64=0x0076) + thlock 0x76 (0x64=0x0076) + wbd_inv 0x01 (0x69=0x1b33) + wbd_ref 0x0b33 (0x69=1b33) + wbd_sel 0x00 (0x6a=0400) + wbd_alpha 0x02 (0x6a=0x400) + agc1_max 0x00 (0x6b=0x0000) + agc1_min 0x00 (0x6c=0x0000) + agc2_max 0x9b26 (0x6d=0x9b26) + agc2_min 0x26ca (0x6e=0x26ca) + agc1_pt1 0x00 (0x6f=0x0000) + agc1_pt2 0x00 (0x6f=0x0000) + agc1_pt3 0x00 (0x70=0x0000) + agc1_slope1 0x00 (0x71=0x0000) + agc1_slope2 0x00 (0x71=0x0000) + agc2_pt1 0x00 (0x72=0x0080) + agc2_pt2 0x80 (0x72=0x0080) + agc2_slope1 0x1d (0x73=0x1d1d) + agc2_slope2 0x1d (0x73=0x1d1d) + alpha_mant 0x11 (0x65=023b) + alpha_exp 0x1b (0x65=023b) + beta_mant 0x17 (0x66=05f3) + beta_exp 0x33 (0x66=05f3) + perform_agc_softsplit 0x00 (0x6a=0x400) + + */ +static struct dibx000_agc_config stk7700p_7000p_xc4000_agc_config = { + .band_caps = BAND_UHF | BAND_VHF, + .setup = 0x64, + .inv_gain = 0x02c8, + .time_stabiliz = 0x15, + .alpha_level = 0x00, + .thlock = 0x76, + .wbd_inv = 0x01, + .wbd_ref = 0x0b33, + .wbd_sel = 0x00, + .wbd_alpha = 0x02, + .agc1_max = 0x00, + .agc1_min = 0x00, + .agc2_max = 0x9b26, + .agc2_min = 0x26ca, + .agc1_pt1 = 0x00, + .agc1_pt2 = 0x00, + .agc1_pt3 = 0x00, + .agc1_slope1 = 0x00, + .agc1_slope2 = 0x00, + .agc2_pt1 = 0x00, + .agc2_pt2 = 0x80, + .agc2_slope1 = 0x1d, + .agc2_slope2 = 0x1d, + .alpha_exp = 0x1b, + .beta_mant = 0x17, + .beta_exp = 0x33, + .perform_agc_softsplit = 0x00, +}; + /* FIXME: none of these inputs are validated yet */ static struct dib7000p_config pctv_340e_config = { - .output_mpeg2_in_188_bytes = 1, + .output_mpeg2_in_188_bytes = 1, // validated L3317: 0x00eb=0x0066 .agc_config_count = 1, - .agc = &stk7700p_7000p_mt2060_agc_config, + .agc = &stk7700p_7000p_xc4000_agc_config, .bw = &stk7700p_pll_config, .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS, @@ -2737,9 +2798,9 @@ static int pctv340e_frontend_attach(struct dvb_usb_adapter *adap) } -static struct xc4000_config s5h1411_xc4000_tunerconfig = { +static struct xc4000_config dib7000p_xc4000_tunerconfig = { .i2c_address = 0x61, - .if_khz = 5380, + .if_khz = 5400, }; static int xc4000_tuner_attach(struct dvb_usb_adapter *adap) @@ -2758,7 +2819,7 @@ static int xc4000_tuner_attach(struct dvb_usb_adapter *adap) adap->fe->callback = dib0700_xc4000_tuner_callback; return dvb_attach(xc4000_attach, adap->fe, tun_i2c, - &s5h1411_xc4000_tunerconfig) + &dib7000p_xc4000_tunerconfig) == NULL ? -ENODEV : 0; } -- cgit v1.2.3 From 799ed11afe7694858584d1ed4e9ae2f9e48142ec Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Sun, 4 Oct 2009 23:09:18 -0300 Subject: [media] xc4000: handle dib0700 broken i2c stretching It was confirmed by DibCom that i2c stretching is broken in the i2c master on the dib7700. So we need to put a hack into the xc4000 driver to not complain in certain very specific cases where we know i2c stretching occurs. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 2dacf209d427..b3b33d266b7c 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -89,6 +89,7 @@ struct xc4000_priv { struct firmware_properties cur_fw; __u16 hwmodel; __u16 hwvers; + u8 ignore_i2c_write_errors; }; /* Misc Defines */ @@ -255,8 +256,15 @@ static int xc_send_i2c_data(struct xc4000_priv *priv, u8 *buf, int len) struct i2c_msg msg = { .addr = priv->i2c_props.addr, .flags = 0, .buf = buf, .len = len }; if (i2c_transfer(priv->i2c_props.adap, &msg, 1) != 1) { - printk(KERN_ERR "xc4000: I2C write failed (len=%i)\n", len); - return XC_RESULT_I2C_WRITE_FAILURE; + if (priv->ignore_i2c_write_errors == 0) { + printk(KERN_ERR "xc4000: I2C write failed (len=%i)\n", + len); + if (len == 4) { + printk("bytes %02x %02x %02x %02x\n", buf[0], + buf[1], buf[2], buf[3]); + } + return XC_RESULT_I2C_WRITE_FAILURE; + } } return XC_RESULT_SUCCESS; } @@ -371,10 +379,15 @@ static int xc_SetTVStandard(struct xc4000_priv *priv, __func__, XC4000_Standard[priv->video_standard].Name); + /* Don't complain when the request fails because of i2c stretching */ + priv->ignore_i2c_write_errors = 1; + ret = xc_write_reg(priv, XREG_VIDEO_MODE, VideoMode); if (ret == XC_RESULT_SUCCESS) ret = xc_write_reg(priv, XREG_AUDIO_MODE, AudioMode); + priv->ignore_i2c_write_errors = 0; + return ret; } @@ -506,10 +519,16 @@ static u16 WaitForLock(struct xc4000_priv *priv) static int xc_tune_channel(struct xc4000_priv *priv, u32 freq_hz, int mode) { int found = 0; + int result = 0; dprintk(1, "%s(%u)\n", __func__, freq_hz); - if (xc_set_RF_frequency(priv, freq_hz) != XC_RESULT_SUCCESS) + /* Don't complain when the request fails because of i2c stretching */ + priv->ignore_i2c_write_errors = 1; + result = xc_set_RF_frequency(priv, freq_hz); + priv->ignore_i2c_write_errors = 0; + + if (result != XC_RESULT_SUCCESS) return 0; if (mode == XC_TUNE_ANALOG) { @@ -721,8 +740,13 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type, p = priv->firm[pos].ptr; printk("firmware length = %d\n", priv->firm[pos].size); + /* Don't complain when the request fails because of i2c stretching */ + priv->ignore_i2c_write_errors = 1; + rc = xc_load_i2c_sequence(fe, p); + priv->ignore_i2c_write_errors = 0; + return rc; } @@ -954,7 +978,7 @@ static int check_firmware(struct dvb_frontend *fe, unsigned int type, int rc = 0, is_retry = 0; u16 version, hwmodel; v4l2_std_id std0; - u8 hw_major, hw_minor, fw_major, fw_minor; + u8 hw_major, hw_minor, fw_major, fw_minor; dprintk(1, "%s called\n", __func__); @@ -1071,7 +1095,7 @@ skip_std_specific: check_device: rc = xc4000_readreg(priv, XREG_PRODUCT_ID, &hwmodel); - if (xc_get_version(priv, &hw_major, &hw_minor, &fw_major, + if (xc_get_version(priv, &hw_major, &hw_minor, &fw_major, &fw_minor) != XC_RESULT_SUCCESS) { printk("Unable to read tuner registers.\n"); goto fail; -- cgit v1.2.3 From f1c78d340fc21adb01f89f9bee15c58b533bffd7 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Mon, 5 Oct 2009 00:34:04 -0300 Subject: [media] dib0700: fixup PLL config for PCTV 340e Based on a reference trace under Windows, reverse engineer the PLL config. Note that the xtal is not yet setup, and the timf cannot be determined yet because my reference trace doesn't actually achieve a signal lock. Signed-off-by: Devin Heitmueller Cc: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/dib0700_devices.c | 42 ++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index aaf1eabf175f..790fca63248a 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c @@ -2735,13 +2735,53 @@ static struct dibx000_agc_config stk7700p_7000p_xc4000_agc_config = { .perform_agc_softsplit = 0x00, }; +/* validation: + reg 900 (0x0384) = 0x0e60 + reg 903 (0x0387) = 0x0027 + reg 18 (0x0012) = 0x0321 + reg 19 (0x0013) = 0x1620 + reg 21 (0x0015) = 0x0265 + reg 22 (0x0016) = 0x6cbd + reg 23 (0x0017) = 0x0138 + reg 24 (0x0018) = 0x1381 + reg 72 (0x0048) = 0xd257 + internal = 52500 + sampling = never seems to be used? + pll_prediv = 1 + pll_ratio = 7 + pll_range = 3 + pll_reset = 1 + pll_bypass = 0 + enable_refdiv = 0 + bypclk_div = 0 + IO_CLK_en_core = 1 + ADClkSrc = 1 + modulo = 0 + sad_cfg: = 0xd257 + refsel = (3 << 14) + sel = (1 << 12) + freq_15k = (599 << 0) + ifreq = 40201405 + timf = ? (need lock to compute) + xtal_hz = ? (val dependent on exact tuning freq) + */ +static struct dibx000_bandwidth_config stk7700p_xc4000_pll_config = { + 52500, 30000, // internal, sampling + 1, 7, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass + 0, 0, 1, 1, 0, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo + (3 << 14) | (1 << 12) | (599 << 0), // sad_cfg: refsel, sel, freq_15k + 40201405, // ifreq + 20452225, // timf + 30000000, // xtal +}; + /* FIXME: none of these inputs are validated yet */ static struct dib7000p_config pctv_340e_config = { .output_mpeg2_in_188_bytes = 1, // validated L3317: 0x00eb=0x0066 .agc_config_count = 1, .agc = &stk7700p_7000p_xc4000_agc_config, - .bw = &stk7700p_pll_config, + .bw = &stk7700p_xc4000_pll_config, .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS, .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES, -- cgit v1.2.3 From ed23db32271997e03ea59d31839a40470a1c434b Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Mon, 5 Oct 2009 01:27:14 -0300 Subject: [media] xc4000: get rid of hard-coded 8MHz firmware config Remove a hack I had put in to force the firmware to be 8MHz, now setting the firmware properly based on the target standard. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 91 ++++++++++++++++++++---------------- 1 file changed, 51 insertions(+), 40 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index b3b33d266b7c..1263bfe12bc2 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -174,25 +174,29 @@ struct XC_TV_STANDARD { }; /* Tuner standards */ -#define MN_NTSC_PAL_BTSC 0 -#define MN_NTSC_PAL_A2 1 -#define MN_NTSC_PAL_EIAJ 2 -#define MN_NTSC_PAL_Mono 3 -#define BG_PAL_A2 4 -#define BG_PAL_NICAM 5 -#define BG_PAL_MONO 6 -#define I_PAL_NICAM 7 -#define I_PAL_NICAM_MONO 8 -#define DK_PAL_A2 9 -#define DK_PAL_NICAM 10 -#define DK_PAL_MONO 11 -#define DK_SECAM_A2DK1 12 -#define DK_SECAM_A2LDK3 13 -#define DK_SECAM_A2MONO 14 -#define L_SECAM_NICAM 15 -#define LC_SECAM_NICAM 16 -#define FM_Radio_INPUT2 21 -#define FM_Radio_INPUT1 22 +#define XC4000_MN_NTSC_PAL_BTSC 0 +#define XC4000_MN_NTSC_PAL_A2 1 +#define XC4000_MN_NTSC_PAL_EIAJ 2 +#define XC4000_MN_NTSC_PAL_Mono 3 +#define XC4000_BG_PAL_A2 4 +#define XC4000_BG_PAL_NICAM 5 +#define XC4000_BG_PAL_MONO 6 +#define XC4000_I_PAL_NICAM 7 +#define XC4000_I_PAL_NICAM_MONO 8 +#define XC4000_DK_PAL_A2 9 +#define XC4000_DK_PAL_NICAM 10 +#define XC4000_DK_PAL_MONO 11 +#define XC4000_DK_SECAM_A2DK1 12 +#define XC4000_DK_SECAM_A2LDK3 13 +#define XC4000_DK_SECAM_A2MONO 14 +#define XC4000_L_SECAM_NICAM 15 +#define XC4000_LC_SECAM_NICAM 16 +#define XC4000_DTV6 17 +#define XC4000_DTV8 18 +#define XC4000_DTV7_8 19 +#define XC4000_DTV7 20 +#define XC4000_FM_Radio_INPUT2 21 +#define XC4000_FM_Radio_INPUT1 22 /* WAS : static struct XC_TV_STANDARD XC4000_Standard[MAX_TV_STANDARD] = { @@ -1205,15 +1209,11 @@ static int xc4000_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) { struct xc4000_priv *priv = fe->tuner_priv; + unsigned int type; int ret; dprintk(1, "%s() frequency=%d (Hz)\n", __func__, params->frequency); - /* FIXME: setup proper parameters */ - if (check_firmware(fe, DTV8, 0, priv->if_khz) != XC_RESULT_SUCCESS) { - return -EREMOTEIO; - } - if (fe->ops.info.type == FE_ATSC) { dprintk(1, "%s() ATSC\n", __func__); switch (params->u.vsb.modulation) { @@ -1223,7 +1223,8 @@ static int xc4000_set_params(struct dvb_frontend *fe, priv->rf_mode = XC_RF_MODE_AIR; priv->freq_hz = params->frequency - 1750000; priv->bandwidth = BANDWIDTH_6_MHZ; - priv->video_standard = DTV6; + priv->video_standard = XC4000_DTV6; + type = DTV6; break; case QAM_64: case QAM_256: @@ -1232,7 +1233,8 @@ static int xc4000_set_params(struct dvb_frontend *fe, priv->rf_mode = XC_RF_MODE_CABLE; priv->freq_hz = params->frequency - 1750000; priv->bandwidth = BANDWIDTH_6_MHZ; - priv->video_standard = DTV6; + priv->video_standard = XC4000_DTV6; + type = DTV6; break; default: return -EINVAL; @@ -1242,16 +1244,19 @@ static int xc4000_set_params(struct dvb_frontend *fe, switch (params->u.ofdm.bandwidth) { case BANDWIDTH_6_MHZ: priv->bandwidth = BANDWIDTH_6_MHZ; - priv->video_standard = DTV6; + priv->video_standard = XC4000_DTV6; priv->freq_hz = params->frequency - 1750000; + type = DTV6; break; case BANDWIDTH_7_MHZ: printk(KERN_ERR "xc4000 bandwidth 7MHz not supported\n"); + type = DTV7; return -EINVAL; case BANDWIDTH_8_MHZ: priv->bandwidth = BANDWIDTH_8_MHZ; - priv->video_standard = DTV8; + priv->video_standard = XC4000_DTV8; priv->freq_hz = params->frequency - 2750000; + type = DTV8; break; default: printk(KERN_ERR "xc4000 bandwidth not set!\n"); @@ -1266,6 +1271,11 @@ static int xc4000_set_params(struct dvb_frontend *fe, dprintk(1, "%s() frequency=%d (compensated)\n", __func__, priv->freq_hz); + /* Make sure the correct firmware type is loaded */ + if (check_firmware(fe, type, 0, priv->if_khz) != XC_RESULT_SUCCESS) { + return -EREMOTEIO; + } + ret = xc_SetSignalSource(priv, priv->rf_mode); if (ret != XC_RESULT_SUCCESS) { printk(KERN_ERR @@ -1325,11 +1335,6 @@ static int xc4000_set_analog_params(struct dvb_frontend *fe, dprintk(1, "%s() frequency=%d (in units of 62.5khz)\n", __func__, params->frequency); - /* FIXME: setup proper parameters */ - if (check_firmware(fe, DTV8, 0, priv->if_khz) != XC_RESULT_SUCCESS) { - return -EREMOTEIO; - } - /* Fix me: it could be air. */ priv->rf_mode = params->mode; if (params->mode > XC_RF_MODE_CABLE) @@ -1343,45 +1348,51 @@ static int xc4000_set_analog_params(struct dvb_frontend *fe, */ if (params->std & V4L2_STD_MN) { /* default to BTSC audio standard */ - priv->video_standard = MN_NTSC_PAL_BTSC; + priv->video_standard = XC4000_MN_NTSC_PAL_BTSC; goto tune_channel; } if (params->std & V4L2_STD_PAL_BG) { /* default to NICAM audio standard */ - priv->video_standard = BG_PAL_NICAM; + priv->video_standard = XC4000_BG_PAL_NICAM; goto tune_channel; } if (params->std & V4L2_STD_PAL_I) { /* default to NICAM audio standard */ - priv->video_standard = I_PAL_NICAM; + priv->video_standard = XC4000_I_PAL_NICAM; goto tune_channel; } if (params->std & V4L2_STD_PAL_DK) { /* default to NICAM audio standard */ - priv->video_standard = DK_PAL_NICAM; + priv->video_standard = XC4000_DK_PAL_NICAM; goto tune_channel; } if (params->std & V4L2_STD_SECAM_DK) { /* default to A2 DK1 audio standard */ - priv->video_standard = DK_SECAM_A2DK1; + priv->video_standard = XC4000_DK_SECAM_A2DK1; goto tune_channel; } if (params->std & V4L2_STD_SECAM_L) { - priv->video_standard = L_SECAM_NICAM; + priv->video_standard = XC4000_L_SECAM_NICAM; goto tune_channel; } if (params->std & V4L2_STD_SECAM_LC) { - priv->video_standard = LC_SECAM_NICAM; + priv->video_standard = XC4000_LC_SECAM_NICAM; goto tune_channel; } tune_channel: + + /* FIXME - firmware type not being set properly */ + if (check_firmware(fe, DTV8, 0, priv->if_khz) != XC_RESULT_SUCCESS) { + return -EREMOTEIO; + } + ret = xc_SetSignalSource(priv, priv->rf_mode); if (ret != XC_RESULT_SUCCESS) { printk(KERN_ERR -- cgit v1.2.3 From 2df12510f97664b740a94cd7fd816460c55ce29b Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Sun, 27 Dec 2009 17:44:31 -0300 Subject: [media] dib0700: make PCTV 340e work! Fixup the PLL and AGC configs so that the 340e works (correcting errors I made when I did the original config blindly). Signed-off-by: Devin Heitmueller Cc: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/dib0700_devices.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index 790fca63248a..cc962892fd1e 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c @@ -2729,6 +2729,7 @@ static struct dibx000_agc_config stk7700p_7000p_xc4000_agc_config = { .agc2_pt2 = 0x80, .agc2_slope1 = 0x1d, .agc2_slope2 = 0x1d, + .alpha_mant = 0x11, .alpha_exp = 0x1b, .beta_mant = 0x17, .beta_exp = 0x33, @@ -2738,10 +2739,10 @@ static struct dibx000_agc_config stk7700p_7000p_xc4000_agc_config = { /* validation: reg 900 (0x0384) = 0x0e60 reg 903 (0x0387) = 0x0027 - reg 18 (0x0012) = 0x0321 - reg 19 (0x0013) = 0x1620 - reg 21 (0x0015) = 0x0265 - reg 22 (0x0016) = 0x6cbd + reg 18 (0x0012) = 0x0321 (0393) + reg 19 (0x0013) = 0x1620 (8700) + reg 21 (0x0015) = 0x0265 (0258) + reg 22 (0x0016) = 0x6cbd (bf26) reg 23 (0x0017) = 0x0138 reg 24 (0x0018) = 0x1381 reg 72 (0x0048) = 0xd257 @@ -2766,11 +2767,11 @@ static struct dibx000_agc_config stk7700p_7000p_xc4000_agc_config = { xtal_hz = ? (val dependent on exact tuning freq) */ static struct dibx000_bandwidth_config stk7700p_xc4000_pll_config = { - 52500, 30000, // internal, sampling - 1, 7, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass + 60000, 30000, // internal, sampling + 1, 8, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass 0, 0, 1, 1, 0, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo - (3 << 14) | (1 << 12) | (599 << 0), // sad_cfg: refsel, sel, freq_15k - 40201405, // ifreq + (3 << 14) | (1 << 12) | (524 << 0), // sad_cfg: refsel, sel, freq_15k + 39370534, // ifreq 20452225, // timf 30000000, // xtal }; -- cgit v1.2.3 From 4922cec59a1b37d49b3e01577ab2f779a13b3ae6 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Sun, 27 Dec 2009 17:50:43 -0300 Subject: [media] xc4000: turn off debug logging by default Don't dump debug into to dmesg by default (something I had enabled during bringup of the xc4000 driver). Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 1263bfe12bc2..49d5929389ff 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -36,7 +36,7 @@ #include "tuner-i2c.h" #include "tuner-xc2028-types.h" -static int debug=1; +static int debug; module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); -- cgit v1.2.3 From 980029eb35a6faa076f4b480a72625cd75172f44 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Sun, 27 Dec 2009 17:55:13 -0300 Subject: [media] xc4000: rename firmware image filename Give the xc4000 firmware filename a filename that makes more sense for public release. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 49d5929389ff..02edd9493d27 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -52,7 +52,9 @@ static LIST_HEAD(hybrid_tuner_instance_list); #define dprintk(level, fmt, arg...) if (debug >= level) \ printk(KERN_INFO "%s: " fmt, "xc4000", ## arg) -#define XC4000_DEFAULT_FIRMWARE "xc4000-02.fw" +/* Note that the last version digit is my internal build number (so I can + rev the firmware even if the core Xceive firmware was unchanged) */ +#define XC4000_DEFAULT_FIRMWARE "dvb-fe-xc4000-1.4.1.fw" #define XC4000_DEFAULT_FIRMWARE_SIZE 18643 -- cgit v1.2.3 From b6cdb5bea31c86645782950d84745bb2f95ec9ca Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Sun, 27 Dec 2009 18:15:14 -0300 Subject: [media] xc4000: cleanup dmesg logging Remove some printk() calls added during driver development, and demote some other messages to debug only (to reduce dmesg chatter). Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 02edd9493d27..bad9c9db9f0f 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -639,12 +639,6 @@ static int seek_firmware(struct dvb_frontend *fe, unsigned int type, int i, best_i = -1, best_nr_matches = 0; unsigned int type_mask = 0; - printk("%s called, want type=", __func__); - if (debug) { - dump_firm_type(type); - printk("(%x), id %016llx.\n", type, (unsigned long long)*id); - } - if (!priv->firm) { printk("Error! firmware not loaded\n"); return -EINVAL; @@ -715,12 +709,11 @@ found: *id = priv->firm[i].id; ret: - printk("%s firmware for type=", (i < 0) ? "Can't find" : "Found"); if (debug) { + printk("%s firmware for type=", (i < 0) ? "Can't find" : + "Found"); dump_firm_type(type); printk("(%x), id %016llx.\n", type, (unsigned long long)*id); - if (i < 0) - dump_stack(); } return i; } @@ -732,19 +725,11 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type, int pos, rc; unsigned char *p; - printk("%s called\n", __func__); - pos = seek_firmware(fe, type, id); if (pos < 0) return pos; - printk("Loading firmware for type="); -// dump_firm_type(priv->firm[pos].type); - printk("(%x), id %016llx.\n", priv->firm[pos].type, - (unsigned long long)*id); - p = priv->firm[pos].ptr; - printk("firmware length = %d\n", priv->firm[pos].size); /* Don't complain when the request fails because of i2c stretching */ priv->ignore_i2c_write_errors = 1; @@ -766,8 +751,6 @@ static int xc4000_fwupload(struct dvb_frontend *fe) char name[33]; char *fname; - printk("%s called\n", __func__); - fname = XC4000_DEFAULT_FIRMWARE; printk("Reading firmware %s\n", fname); @@ -801,9 +784,9 @@ static int xc4000_fwupload(struct dvb_frontend *fe) n_array = get_unaligned_le16(p); p += 2; - printk("Loading %d firmware images from %s, type: %s, ver %d.%d\n", - n_array, fname, name, - priv->firm_version >> 8, priv->firm_version & 0xff); + dprintk(1, "Loading %d firmware images from %s, type: %s, ver %d.%d\n", + n_array, fname, name, + priv->firm_version >> 8, priv->firm_version & 0xff); priv->firm = kzalloc(sizeof(*priv->firm) * n_array, GFP_KERNEL); if (priv->firm == NULL) { @@ -899,7 +882,7 @@ err: done: release_firmware(fw); if (rc == 0) - printk("Firmware files loaded.\n"); + dprintk(1, "Firmware files loaded.\n"); return rc; } @@ -1060,8 +1043,6 @@ retry: goto fail; } - printk("Done with init1\n"); - skip_base: /* * No need to reload standard specific firmware if base firmware -- cgit v1.2.3 From 62956cedb5e6932c021d52b80bfbcf8add014be4 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Sun, 27 Dec 2009 18:58:11 -0300 Subject: [media] dib0700: remove notes from bringup of PCTV 340e Remove some inline comments I had written from when I was computing the proper dib7000p configuration to work with the xc4000. Signed-off-by: Devin Heitmueller Cc: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/dib0700_devices.c | 63 +---------------------------- 1 file changed, 1 insertion(+), 62 deletions(-) diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index cc962892fd1e..a5212a5c2b48 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c @@ -2674,37 +2674,6 @@ static int dib0700_xc4000_tuner_callback(void *priv, int component, return 0; } -/* validation: - band - setup 0x4b=0x64 - inv_gain 0x4c=0x02c8 - time_stabaliz 0x4d=0x0015 - alpha_level 0 (0x64=0x0076) - thlock 0x76 (0x64=0x0076) - wbd_inv 0x01 (0x69=0x1b33) - wbd_ref 0x0b33 (0x69=1b33) - wbd_sel 0x00 (0x6a=0400) - wbd_alpha 0x02 (0x6a=0x400) - agc1_max 0x00 (0x6b=0x0000) - agc1_min 0x00 (0x6c=0x0000) - agc2_max 0x9b26 (0x6d=0x9b26) - agc2_min 0x26ca (0x6e=0x26ca) - agc1_pt1 0x00 (0x6f=0x0000) - agc1_pt2 0x00 (0x6f=0x0000) - agc1_pt3 0x00 (0x70=0x0000) - agc1_slope1 0x00 (0x71=0x0000) - agc1_slope2 0x00 (0x71=0x0000) - agc2_pt1 0x00 (0x72=0x0080) - agc2_pt2 0x80 (0x72=0x0080) - agc2_slope1 0x1d (0x73=0x1d1d) - agc2_slope2 0x1d (0x73=0x1d1d) - alpha_mant 0x11 (0x65=023b) - alpha_exp 0x1b (0x65=023b) - beta_mant 0x17 (0x66=05f3) - beta_exp 0x33 (0x66=05f3) - perform_agc_softsplit 0x00 (0x6a=0x400) - - */ static struct dibx000_agc_config stk7700p_7000p_xc4000_agc_config = { .band_caps = BAND_UHF | BAND_VHF, .setup = 0x64, @@ -2736,36 +2705,6 @@ static struct dibx000_agc_config stk7700p_7000p_xc4000_agc_config = { .perform_agc_softsplit = 0x00, }; -/* validation: - reg 900 (0x0384) = 0x0e60 - reg 903 (0x0387) = 0x0027 - reg 18 (0x0012) = 0x0321 (0393) - reg 19 (0x0013) = 0x1620 (8700) - reg 21 (0x0015) = 0x0265 (0258) - reg 22 (0x0016) = 0x6cbd (bf26) - reg 23 (0x0017) = 0x0138 - reg 24 (0x0018) = 0x1381 - reg 72 (0x0048) = 0xd257 - internal = 52500 - sampling = never seems to be used? - pll_prediv = 1 - pll_ratio = 7 - pll_range = 3 - pll_reset = 1 - pll_bypass = 0 - enable_refdiv = 0 - bypclk_div = 0 - IO_CLK_en_core = 1 - ADClkSrc = 1 - modulo = 0 - sad_cfg: = 0xd257 - refsel = (3 << 14) - sel = (1 << 12) - freq_15k = (599 << 0) - ifreq = 40201405 - timf = ? (need lock to compute) - xtal_hz = ? (val dependent on exact tuning freq) - */ static struct dibx000_bandwidth_config stk7700p_xc4000_pll_config = { 60000, 30000, // internal, sampling 1, 8, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass @@ -2778,7 +2717,7 @@ static struct dibx000_bandwidth_config stk7700p_xc4000_pll_config = { /* FIXME: none of these inputs are validated yet */ static struct dib7000p_config pctv_340e_config = { - .output_mpeg2_in_188_bytes = 1, // validated L3317: 0x00eb=0x0066 + .output_mpeg2_in_188_bytes = 1, .agc_config_count = 1, .agc = &stk7700p_7000p_xc4000_agc_config, -- cgit v1.2.3 From e3bb7c607f5ca87030692ad4dab653b4a8d1571a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 2 Jun 2011 11:36:56 -0300 Subject: [media] xc4000: Fix a few bad whitespaces on it Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index bad9c9db9f0f..19be5aa21107 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -73,7 +73,7 @@ struct firmware_properties { v4l2_std_id std_req; __u16 int_freq; unsigned int scode_table; - int scode_nr; + int scode_nr; }; struct xc4000_priv { @@ -111,7 +111,7 @@ struct xc4000_priv { /* Product id */ #define XC_PRODUCT_ID_FW_NOT_LOADED 0x2000 -#define XC_PRODUCT_ID_FW_LOADED 0x0FA0 +#define XC_PRODUCT_ID_FW_LOADED 0x0FA0 /* Registers (Write-only) */ #define XREG_INIT 0x00 @@ -189,16 +189,16 @@ struct XC_TV_STANDARD { #define XC4000_DK_PAL_NICAM 10 #define XC4000_DK_PAL_MONO 11 #define XC4000_DK_SECAM_A2DK1 12 -#define XC4000_DK_SECAM_A2LDK3 13 -#define XC4000_DK_SECAM_A2MONO 14 +#define XC4000_DK_SECAM_A2LDK3 13 +#define XC4000_DK_SECAM_A2MONO 14 #define XC4000_L_SECAM_NICAM 15 #define XC4000_LC_SECAM_NICAM 16 #define XC4000_DTV6 17 #define XC4000_DTV8 18 #define XC4000_DTV7_8 19 #define XC4000_DTV7 20 -#define XC4000_FM_Radio_INPUT2 21 -#define XC4000_FM_Radio_INPUT1 22 +#define XC4000_FM_Radio_INPUT2 21 +#define XC4000_FM_Radio_INPUT1 22 /* WAS : static struct XC_TV_STANDARD XC4000_Standard[MAX_TV_STANDARD] = { @@ -565,7 +565,7 @@ static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val) return XC_RESULT_SUCCESS; } -#define dump_firm_type(t) dump_firm_type_and_int_freq(t, 0) +#define dump_firm_type(t) dump_firm_type_and_int_freq(t, 0) static void dump_firm_type_and_int_freq(unsigned int type, u16 int_freq) { if (type & BASE) @@ -967,7 +967,7 @@ static int check_firmware(struct dvb_frontend *fe, unsigned int type, int rc = 0, is_retry = 0; u16 version, hwmodel; v4l2_std_id std0; - u8 hw_major, hw_minor, fw_major, fw_minor; + u8 hw_major, hw_minor, fw_major, fw_minor; dprintk(1, "%s called\n", __func__); -- cgit v1.2.3 From fbe4a29f2f6523b8b839debb19baa49461a302be Mon Sep 17 00:00:00 2001 From: Istvan Varga Date: Fri, 3 Jun 2011 10:11:48 -0300 Subject: [media] xc4000: code cleanup This is the first of a set of patches that update the original xc4000 sources to my modified version. It removes some unused code, and makes a few minor formatting changes. [mchehab@redhat.com: re-add XC_TUNE_ANALOG/XC_TUNE_DIGITAL constants, to avoid compilation breakage] Signed-off-by: Istvan Varga Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 156 ++++++++++------------------------- drivers/media/common/tuners/xc4000.h | 4 +- 2 files changed, 45 insertions(+), 115 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 19be5aa21107..15e4e99ad9cb 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -55,8 +55,6 @@ static LIST_HEAD(hybrid_tuner_instance_list); /* Note that the last version digit is my internal build number (so I can rev the firmware even if the core Xceive firmware was unchanged) */ #define XC4000_DEFAULT_FIRMWARE "dvb-fe-xc4000-1.4.1.fw" -#define XC4000_DEFAULT_FIRMWARE_SIZE 18643 - /* struct for storing firmware table */ struct firmware_description { @@ -80,18 +78,18 @@ struct xc4000_priv { struct tuner_i2c_props i2c_props; struct list_head hybrid_tuner_instance_list; struct firmware_description *firm; - int firm_size; - __u16 firm_version; - u32 if_khz; - u32 freq_hz; - u32 bandwidth; - u8 video_standard; - u8 rf_mode; -// struct xc2028_ctrl ctrl; + int firm_size; + __u16 firm_version; + u32 if_khz; + u32 freq_hz; + u32 bandwidth; + u8 video_standard; + u8 rf_mode; + u8 ignore_i2c_write_errors; + /* struct xc2028_ctrl ctrl; */ struct firmware_properties cur_fw; - __u16 hwmodel; - __u16 hwvers; - u8 ignore_i2c_write_errors; + __u16 hwmodel; + __u16 hwvers; }; /* Misc Defines */ @@ -167,12 +165,12 @@ struct xc4000_priv { For the RESET and WAIT commands, the two following bytes will contain immediately the length of the following transaction. - */ + struct XC_TV_STANDARD { - char *Name; - u16 AudioMode; - u16 VideoMode; + const char *Name; + u16 AudioMode; + u16 VideoMode; }; /* Tuner standards */ @@ -200,33 +198,6 @@ struct XC_TV_STANDARD { #define XC4000_FM_Radio_INPUT2 21 #define XC4000_FM_Radio_INPUT1 22 -/* WAS : -static struct XC_TV_STANDARD XC4000_Standard[MAX_TV_STANDARD] = { - {"M/N-NTSC/PAL-BTSC", 0x0400, 0x8020}, - {"M/N-NTSC/PAL-A2", 0x0600, 0x8020}, - {"M/N-NTSC/PAL-EIAJ", 0x0440, 0x8020}, - {"M/N-NTSC/PAL-Mono", 0x0478, 0x8020}, - {"B/G-PAL-A2", 0x0A00, 0x8049}, - {"B/G-PAL-NICAM", 0x0C04, 0x8049}, - {"B/G-PAL-MONO", 0x0878, 0x8059}, - {"I-PAL-NICAM", 0x1080, 0x8009}, - {"I-PAL-NICAM-MONO", 0x0E78, 0x8009}, - {"D/K-PAL-A2", 0x1600, 0x8009}, - {"D/K-PAL-NICAM", 0x0E80, 0x8009}, - {"D/K-PAL-MONO", 0x1478, 0x8009}, - {"D/K-SECAM-A2 DK1", 0x1200, 0x8009}, - {"D/K-SECAM-A2 L/DK3", 0x0E00, 0x8009}, - {"D/K-SECAM-A2 MONO", 0x1478, 0x8009}, - {"L-SECAM-NICAM", 0x8E82, 0x0009}, - {"L'-SECAM-NICAM", 0x8E82, 0x4009}, - {"DTV6", 0x00C0, 0x8002}, - {"DTV8", 0x00C0, 0x800B}, - {"DTV7/8", 0x00C0, 0x801B}, - {"DTV7", 0x00C0, 0x8007}, - {"FM Radio-INPUT2", 0x9802, 0x9002}, - {"FM Radio-INPUT1", 0x0208, 0x9002} -};*/ - static struct XC_TV_STANDARD XC4000_Standard[MAX_TV_STANDARD] = { {"M/N-NTSC/PAL-BTSC", 0x0000, 0x8020}, {"M/N-NTSC/PAL-A2", 0x0000, 0x8020}, @@ -253,7 +224,6 @@ static struct XC_TV_STANDARD XC4000_Standard[MAX_TV_STANDARD] = { {"FM Radio-INPUT1", 0x0008, 0x9000} }; -static int xc4000_is_firmware_loaded(struct dvb_frontend *fe); static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val); static int xc4000_TunerReset(struct dvb_frontend *fe); @@ -275,10 +245,6 @@ static int xc_send_i2c_data(struct xc4000_priv *priv, u8 *buf, int len) return XC_RESULT_SUCCESS; } -/* This routine is never used because the only time we read data from the - i2c bus is when we read registers, and we want that to be an atomic i2c - transaction in case we are on a multi-master bus */ - static void xc_wait(int wait_ms) { msleep(wait_ms); @@ -431,7 +397,6 @@ static int xc_set_RF_frequency(struct xc4000_priv *priv, u32 freq_hz) return xc_write_reg(priv, XREG_RF_FREQ, freq_code); /* WAS: XREG_FINERFREQ */ } - static int xc_get_ADC_Envelope(struct xc4000_priv *priv, u16 *adc_envelope) { return xc4000_readreg(priv, XREG_ADC_ENV, adc_envelope); @@ -476,12 +441,6 @@ static int xc_get_version(struct xc4000_priv *priv, return 0; } -/* WAS THERE -static int xc_get_buildversion(struct xc4000_priv *priv, u16 *buildrev) -{ - return xc4000_readreg(priv, XREG_BUILD, buildrev); -}*/ - static int xc_get_hsync_freq(struct xc4000_priv *priv, u32 *hsync_freq_hz) { u16 regData; @@ -524,8 +483,8 @@ static u16 WaitForLock(struct xc4000_priv *priv) #define XC_TUNE_DIGITAL 1 static int xc_tune_channel(struct xc4000_priv *priv, u32 freq_hz, int mode) { - int found = 0; - int result = 0; + int found = 0; + int result = 0; dprintk(1, "%s(%u)\n", __func__, freq_hz); @@ -694,7 +653,6 @@ static int seek_firmware(struct dvb_frontend *fe, unsigned int type, if (best_nr_matches > 0) { printk("Selecting best matching firmware (%d bits) for " "type=", best_nr_matches); -// dump_firm_type(type); printk("(%x), id %016llx:\n", type, (unsigned long long)*id); i = best_i; goto found; @@ -749,7 +707,7 @@ static int xc4000_fwupload(struct dvb_frontend *fe) int rc = 0; int n, n_array; char name[33]; - char *fname; + const char *fname; fname = XC4000_DEFAULT_FIRMWARE; @@ -770,7 +728,7 @@ static int xc4000_fwupload(struct dvb_frontend *fe) if (fw->size < sizeof(name) - 1 + 2 + 2) { printk("Error: firmware file %s has invalid size!\n", - fname); + fname); goto corrupt; } @@ -805,7 +763,7 @@ static int xc4000_fwupload(struct dvb_frontend *fe) n++; if (n >= n_array) { printk("More firmware images in file than " - "were expected!\n"); + "were expected!\n"); goto corrupt; } @@ -831,7 +789,6 @@ static int xc4000_fwupload(struct dvb_frontend *fe) if (!size || size > endp - p) { printk("Firmware type "); -// dump_firm_type(type); printk("(%x), id %llx is corrupted " "(size=%d, expected %d)\n", type, (unsigned long long)id, @@ -877,7 +834,6 @@ corrupt: err: printk("Releasing partially loaded firmware file.\n"); -// free_firmware(priv); done: release_firmware(fw); @@ -986,8 +942,7 @@ retry: new_fw.type = type; new_fw.id = std; new_fw.std_req = std; -// new_fw.scode_table = SCODE | priv->ctrl.scode_table; - new_fw.scode_table = SCODE; + new_fw.scode_table = SCODE /* | priv->ctrl.scode_table */; new_fw.scode_nr = 0; new_fw.int_freq = int_freq; @@ -1108,7 +1063,7 @@ check_device: } else if (priv->hwmodel == 0 || priv->hwmodel != hwmodel || priv->hwvers != (version & 0xff00)) { printk("Read invalid device hardware information - tuner " - "hung?\n"); + "hung?\n"); goto fail; } @@ -1140,15 +1095,14 @@ fail: static void xc_debug_dump(struct xc4000_priv *priv) { - u16 adc_envelope; - u32 freq_error_hz = 0; - u16 lock_status; - u32 hsync_freq_hz = 0; - u16 frame_lines; - u16 quality; - u8 hw_majorversion = 0, hw_minorversion = 0; - u8 fw_majorversion = 0, fw_minorversion = 0; -// u16 fw_buildversion = 0; + u16 adc_envelope; + u32 freq_error_hz = 0; + u16 lock_status; + u32 hsync_freq_hz = 0; + u16 frame_lines; + u16 quality; + u8 hw_majorversion = 0, hw_minorversion = 0; + u8 fw_majorversion = 0, fw_minorversion = 0; /* Wait for stats to stabilize. * Frame Lines needs two frame times after initial lock @@ -1156,35 +1110,30 @@ static void xc_debug_dump(struct xc4000_priv *priv) */ xc_wait(100); - xc_get_ADC_Envelope(priv, &adc_envelope); + xc_get_ADC_Envelope(priv, &adc_envelope); dprintk(1, "*** ADC envelope (0-1023) = %d\n", adc_envelope); xc_get_frequency_error(priv, &freq_error_hz); dprintk(1, "*** Frequency error = %d Hz\n", freq_error_hz); - xc_get_lock_status(priv, &lock_status); + xc_get_lock_status(priv, &lock_status); dprintk(1, "*** Lock status (0-Wait, 1-Locked, 2-No-signal) = %d\n", lock_status); - xc_get_version(priv, &hw_majorversion, &hw_minorversion, - &fw_majorversion, &fw_minorversion); -// WAS: -// xc_get_buildversion(priv, &fw_buildversion); -// dprintk(1, "*** HW: V%02x.%02x, FW: V%02x.%02x.%04x\n", -// hw_majorversion, hw_minorversion, -// fw_majorversion, fw_minorversion, fw_buildversion); -// NOW: + xc_get_version(priv, &hw_majorversion, &hw_minorversion, + &fw_majorversion, &fw_minorversion); + dprintk(1, "*** HW: V%02x.%02x, FW: V%02x.%02x\n", hw_majorversion, hw_minorversion, fw_majorversion, fw_minorversion); - xc_get_hsync_freq(priv, &hsync_freq_hz); + xc_get_hsync_freq(priv, &hsync_freq_hz); dprintk(1, "*** Horizontal sync frequency = %d Hz\n", hsync_freq_hz); - xc_get_frame_lines(priv, &frame_lines); + xc_get_frame_lines(priv, &frame_lines); dprintk(1, "*** Frame lines = %d\n", frame_lines); - xc_get_quality(priv, &quality); + xc_get_quality(priv, &quality); dprintk(1, "*** Quality (0:<8dB, 7:>56dB) = %d\n", quality); } @@ -1193,7 +1142,7 @@ static int xc4000_set_params(struct dvb_frontend *fe, { struct xc4000_priv *priv = fe->tuner_priv; unsigned int type; - int ret; + int ret; dprintk(1, "%s() frequency=%d (Hz)\n", __func__, params->frequency); @@ -1290,30 +1239,11 @@ static int xc4000_set_params(struct dvb_frontend *fe, return 0; } -static int xc4000_is_firmware_loaded(struct dvb_frontend *fe) -{ - struct xc4000_priv *priv = fe->tuner_priv; - int ret; - u16 id; - - ret = xc4000_readreg(priv, XREG_PRODUCT_ID, &id); - if (ret == XC_RESULT_SUCCESS) { - if (id == XC_PRODUCT_ID_FW_NOT_LOADED) - ret = XC_RESULT_RESET_FAILURE; - else - ret = XC_RESULT_SUCCESS; - } - - dprintk(1, "%s() returns %s id = 0x%x\n", __func__, - ret == XC_RESULT_SUCCESS ? "True" : "False", id); - return ret; -} - static int xc4000_set_analog_params(struct dvb_frontend *fe, struct analog_parameters *params) { struct xc4000_priv *priv = fe->tuner_priv; - int ret; + int ret; dprintk(1, "%s() frequency=%d (in units of 62.5khz)\n", __func__, params->frequency); @@ -1420,7 +1350,7 @@ static int xc4000_get_bandwidth(struct dvb_frontend *fe, u32 *bw) static int xc4000_get_status(struct dvb_frontend *fe, u32 *status) { struct xc4000_priv *priv = fe->tuner_priv; - u16 lock_status = 0; + u16 lock_status = 0; xc_get_lock_status(priv, &lock_status); @@ -1495,8 +1425,8 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, struct xc4000_config *cfg) { struct xc4000_priv *priv = NULL; - int instance; - u16 id = 0; + int instance; + u16 id = 0; dprintk(1, "%s(%d-%04x)\n", __func__, i2c ? i2c_adapter_id(i2c) : -1, diff --git a/drivers/media/common/tuners/xc4000.h b/drivers/media/common/tuners/xc4000.h index 2bbbe9d6480b..3881ba26b794 100644 --- a/drivers/media/common/tuners/xc4000.h +++ b/drivers/media/common/tuners/xc4000.h @@ -28,8 +28,8 @@ struct dvb_frontend; struct i2c_adapter; struct xc4000_config { - u8 i2c_address; - u32 if_khz; + u8 i2c_address; + u32 if_khz; }; /* xc4000 callback command */ -- cgit v1.2.3 From 4911085fa3342d2ccb04f84c2987305b86785ebf Mon Sep 17 00:00:00 2001 From: Istvan Varga Date: Fri, 3 Jun 2011 10:55:24 -0300 Subject: [media] xc4000: updated standards table This patch makes the following changes to the standards table: - added 'u16 int_freq' to struct XC_TV_STANDARD (needed for analog TV and radio, 0 for DVB-T) - added new standard for SECAM-D/K video with PAL-D/K audio - the 'int_freq' values are now specified in the table - changed VideoMode for NTSC and PAL-B/G standards Signed-off-by: Istvan Varga Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 67 +++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 15e4e99ad9cb..65dd948bf6a6 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -93,7 +93,7 @@ struct xc4000_priv { }; /* Misc Defines */ -#define MAX_TV_STANDARD 23 +#define MAX_TV_STANDARD 24 #define XC_MAX_I2C_WRITE_LENGTH 64 /* Signal Types */ @@ -171,6 +171,7 @@ struct XC_TV_STANDARD { const char *Name; u16 AudioMode; u16 VideoMode; + u16 int_freq; }; /* Tuner standards */ @@ -189,39 +190,41 @@ struct XC_TV_STANDARD { #define XC4000_DK_SECAM_A2DK1 12 #define XC4000_DK_SECAM_A2LDK3 13 #define XC4000_DK_SECAM_A2MONO 14 -#define XC4000_L_SECAM_NICAM 15 -#define XC4000_LC_SECAM_NICAM 16 -#define XC4000_DTV6 17 -#define XC4000_DTV8 18 -#define XC4000_DTV7_8 19 -#define XC4000_DTV7 20 -#define XC4000_FM_Radio_INPUT2 21 -#define XC4000_FM_Radio_INPUT1 22 +#define XC4000_DK_SECAM_NICAM 15 +#define XC4000_L_SECAM_NICAM 16 +#define XC4000_LC_SECAM_NICAM 17 +#define XC4000_DTV6 18 +#define XC4000_DTV8 19 +#define XC4000_DTV7_8 20 +#define XC4000_DTV7 21 +#define XC4000_FM_Radio_INPUT2 22 +#define XC4000_FM_Radio_INPUT1 23 static struct XC_TV_STANDARD XC4000_Standard[MAX_TV_STANDARD] = { - {"M/N-NTSC/PAL-BTSC", 0x0000, 0x8020}, - {"M/N-NTSC/PAL-A2", 0x0000, 0x8020}, - {"M/N-NTSC/PAL-EIAJ", 0x0040, 0x8020}, - {"M/N-NTSC/PAL-Mono", 0x0078, 0x8020}, - {"B/G-PAL-A2", 0x0000, 0x8059}, - {"B/G-PAL-NICAM", 0x0004, 0x8059}, - {"B/G-PAL-MONO", 0x0078, 0x8059}, - {"I-PAL-NICAM", 0x0080, 0x8049}, - {"I-PAL-NICAM-MONO", 0x0078, 0x8049}, - {"D/K-PAL-A2", 0x0000, 0x8049}, - {"D/K-PAL-NICAM", 0x0080, 0x8049}, - {"D/K-PAL-MONO", 0x0078, 0x8049}, - {"D/K-SECAM-A2 DK1", 0x0000, 0x8049}, - {"D/K-SECAM-A2 L/DK3", 0x0000, 0x8049}, - {"D/K-SECAM-A2 MONO", 0x0078, 0x8049}, - {"L-SECAM-NICAM", 0x8080, 0x0009}, - {"L'-SECAM-NICAM", 0x8080, 0x4009}, - {"DTV6", 0x00C0, 0x8002}, - {"DTV8", 0x00C0, 0x800B}, - {"DTV7/8", 0x00C0, 0x801B}, - {"DTV7", 0x00C0, 0x8007}, - {"FM Radio-INPUT2", 0x0008, 0x9800}, - {"FM Radio-INPUT1", 0x0008, 0x9000} + {"M/N-NTSC/PAL-BTSC", 0x0000, 0x80A0, 4500}, + {"M/N-NTSC/PAL-A2", 0x0000, 0x80A0, 4600}, + {"M/N-NTSC/PAL-EIAJ", 0x0040, 0x80A0, 4500}, + {"M/N-NTSC/PAL-Mono", 0x0078, 0x80A0, 4500}, + {"B/G-PAL-A2", 0x0000, 0x8159, 5640}, + {"B/G-PAL-NICAM", 0x0004, 0x8159, 5740}, + {"B/G-PAL-MONO", 0x0078, 0x8159, 5500}, + {"I-PAL-NICAM", 0x0080, 0x8049, 6240}, + {"I-PAL-NICAM-MONO", 0x0078, 0x8049, 6000}, + {"D/K-PAL-A2", 0x0000, 0x8049, 6380}, + {"D/K-PAL-NICAM", 0x0080, 0x8049, 6200}, + {"D/K-PAL-MONO", 0x0078, 0x8049, 6500}, + {"D/K-SECAM-A2 DK1", 0x0000, 0x8049, 6340}, + {"D/K-SECAM-A2 L/DK3", 0x0000, 0x8049, 6000}, + {"D/K-SECAM-A2 MONO", 0x0078, 0x8049, 6500}, + {"D/K-SECAM-NICAM", 0x0080, 0x8049, 6200}, + {"L-SECAM-NICAM", 0x8080, 0x0009, 6200}, + {"L'-SECAM-NICAM", 0x8080, 0x4009, 6200}, + {"DTV6", 0x00C0, 0x8002, 0}, + {"DTV8", 0x00C0, 0x800B, 0}, + {"DTV7/8", 0x00C0, 0x801B, 0}, + {"DTV7", 0x00C0, 0x8007, 0}, + {"FM Radio-INPUT2", 0x0008, 0x9800,10700}, + {"FM Radio-INPUT1", 0x0008, 0x9000,10700} }; static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val); -- cgit v1.2.3 From f0ef7c88ca919912011593d2392a59c2fde04748 Mon Sep 17 00:00:00 2001 From: Istvan Varga Date: Fri, 3 Jun 2011 12:17:59 -0300 Subject: [media] xc4000: added support for 7 MHz DVB-T The following patch implements support for DVB-T with 7 MHz bandwidth. Signed-off-by: Istvan Varga Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 65dd948bf6a6..307a8745e06e 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -1184,15 +1184,28 @@ static int xc4000_set_params(struct dvb_frontend *fe, type = DTV6; break; case BANDWIDTH_7_MHZ: - printk(KERN_ERR "xc4000 bandwidth 7MHz not supported\n"); + priv->bandwidth = BANDWIDTH_7_MHZ; + priv->video_standard = XC4000_DTV7; + priv->freq_hz = params->frequency - 2250000; type = DTV7; - return -EINVAL; + break; case BANDWIDTH_8_MHZ: priv->bandwidth = BANDWIDTH_8_MHZ; priv->video_standard = XC4000_DTV8; priv->freq_hz = params->frequency - 2750000; type = DTV8; break; + case BANDWIDTH_AUTO: + if (params->frequency < 400000000) { + priv->bandwidth = BANDWIDTH_7_MHZ; + priv->freq_hz = params->frequency - 2250000; + } else { + priv->bandwidth = BANDWIDTH_8_MHZ; + priv->freq_hz = params->frequency - 2750000; + } + priv->video_standard = XC4000_DTV7_8; + type = DTV78; + break; default: printk(KERN_ERR "xc4000 bandwidth not set!\n"); return -EINVAL; -- cgit v1.2.3 From 5614942bb06f5620d0d6eb67bc0268c76c5dd921 Mon Sep 17 00:00:00 2001 From: Istvan Varga Date: Fri, 3 Jun 2011 12:23:33 -0300 Subject: [media] xc4000: added mutex This patch adds a mutex to xc4000_priv, to protect the driver from being accessed by multiple processes at the same time. Signed-off-by: Istvan Varga Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 80 ++++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 30 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 307a8745e06e..be43a6dfac6c 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include "dvb_frontend.h" @@ -90,6 +91,7 @@ struct xc4000_priv { struct firmware_properties cur_fw; __u16 hwmodel; __u16 hwvers; + struct mutex lock; }; /* Misc Defines */ @@ -1145,10 +1147,12 @@ static int xc4000_set_params(struct dvb_frontend *fe, { struct xc4000_priv *priv = fe->tuner_priv; unsigned int type; - int ret; + int ret = -EREMOTEIO; dprintk(1, "%s() frequency=%d (Hz)\n", __func__, params->frequency); + mutex_lock(&priv->lock); + if (fe->ops.info.type == FE_ATSC) { dprintk(1, "%s() ATSC\n", __func__); switch (params->u.vsb.modulation) { @@ -1172,7 +1176,8 @@ static int xc4000_set_params(struct dvb_frontend *fe, type = DTV6; break; default: - return -EINVAL; + ret = -EINVAL; + goto fail; } } else if (fe->ops.info.type == FE_OFDM) { dprintk(1, "%s() OFDM\n", __func__); @@ -1208,28 +1213,29 @@ static int xc4000_set_params(struct dvb_frontend *fe, break; default: printk(KERN_ERR "xc4000 bandwidth not set!\n"); - return -EINVAL; + ret = -EINVAL; + goto fail; } priv->rf_mode = XC_RF_MODE_AIR; } else { printk(KERN_ERR "xc4000 modulation type not supported!\n"); - return -EINVAL; + ret = -EINVAL; + goto fail; } dprintk(1, "%s() frequency=%d (compensated)\n", __func__, priv->freq_hz); /* Make sure the correct firmware type is loaded */ - if (check_firmware(fe, type, 0, priv->if_khz) != XC_RESULT_SUCCESS) { - return -EREMOTEIO; - } + if (check_firmware(fe, type, 0, priv->if_khz) != XC_RESULT_SUCCESS) + goto fail; ret = xc_SetSignalSource(priv, priv->rf_mode); if (ret != XC_RESULT_SUCCESS) { printk(KERN_ERR - "xc4000: xc_SetSignalSource(%d) failed\n", - priv->rf_mode); - return -EREMOTEIO; + "xc4000: xc_SetSignalSource(%d) failed\n", + priv->rf_mode); + goto fail; } ret = xc_SetTVStandard(priv, @@ -1237,33 +1243,32 @@ static int xc4000_set_params(struct dvb_frontend *fe, XC4000_Standard[priv->video_standard].AudioMode); if (ret != XC_RESULT_SUCCESS) { printk(KERN_ERR "xc4000: xc_SetTVStandard failed\n"); - return -EREMOTEIO; - } -#ifdef DJH_DEBUG - ret = xc_set_IF_frequency(priv, priv->if_khz); - if (ret != XC_RESULT_SUCCESS) { - printk(KERN_ERR "xc4000: xc_Set_IF_frequency(%d) failed\n", - priv->if_khz); - return -EIO; + goto fail; } -#endif xc_tune_channel(priv, priv->freq_hz, XC_TUNE_DIGITAL); if (debug) xc_debug_dump(priv); - return 0; + ret = 0; + +fail: + mutex_unlock(&priv->lock); + + return ret; } static int xc4000_set_analog_params(struct dvb_frontend *fe, struct analog_parameters *params) { struct xc4000_priv *priv = fe->tuner_priv; - int ret; + int ret = -EREMOTEIO; dprintk(1, "%s() frequency=%d (in units of 62.5khz)\n", __func__, params->frequency); + mutex_lock(&priv->lock); + /* Fix me: it could be air. */ priv->rf_mode = params->mode; if (params->mode > XC_RF_MODE_CABLE) @@ -1318,16 +1323,15 @@ static int xc4000_set_analog_params(struct dvb_frontend *fe, tune_channel: /* FIXME - firmware type not being set properly */ - if (check_firmware(fe, DTV8, 0, priv->if_khz) != XC_RESULT_SUCCESS) { - return -EREMOTEIO; - } + if (check_firmware(fe, DTV8, 0, priv->if_khz) != XC_RESULT_SUCCESS) + goto fail; ret = xc_SetSignalSource(priv, priv->rf_mode); if (ret != XC_RESULT_SUCCESS) { printk(KERN_ERR - "xc4000: xc_SetSignalSource(%d) failed\n", - priv->rf_mode); - return -EREMOTEIO; + "xc4000: xc_SetSignalSource(%d) failed\n", + priv->rf_mode); + goto fail; } ret = xc_SetTVStandard(priv, @@ -1335,7 +1339,7 @@ tune_channel: XC4000_Standard[priv->video_standard].AudioMode); if (ret != XC_RESULT_SUCCESS) { printk(KERN_ERR "xc4000: xc_SetTVStandard failed\n"); - return -EREMOTEIO; + goto fail; } xc_tune_channel(priv, priv->freq_hz, XC_TUNE_ANALOG); @@ -1343,7 +1347,12 @@ tune_channel: if (debug) xc_debug_dump(priv); - return 0; + ret = 0; + +fail: + mutex_unlock(&priv->lock); + + return ret; } static int xc4000_get_frequency(struct dvb_frontend *fe, u32 *freq) @@ -1368,8 +1377,12 @@ static int xc4000_get_status(struct dvb_frontend *fe, u32 *status) struct xc4000_priv *priv = fe->tuner_priv; u16 lock_status = 0; + mutex_lock(&priv->lock); + xc_get_lock_status(priv, &lock_status); + mutex_unlock(&priv->lock); + dprintk(1, "%s() lock_status = 0x%08x\n", __func__, lock_status); *status = lock_status; @@ -1386,9 +1399,13 @@ static int xc4000_sleep(struct dvb_frontend *fe) static int xc4000_init(struct dvb_frontend *fe) { struct xc4000_priv *priv = fe->tuner_priv; + int ret; dprintk(1, "%s()\n", __func__); - if (check_firmware(fe, DTV8, 0, priv->if_khz) != XC_RESULT_SUCCESS) { + mutex_lock(&priv->lock); + ret = check_firmware(fe, DTV8, 0, priv->if_khz); + mutex_unlock(&priv->lock); + if (ret != XC_RESULT_SUCCESS) { printk(KERN_ERR "xc4000: Unable to initialise tuner\n"); return -EREMOTEIO; } @@ -1460,6 +1477,7 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, case 1: /* new tuner instance */ priv->bandwidth = BANDWIDTH_6_MHZ; + mutex_init(&priv->lock); fe->tuner_priv = priv; break; default: @@ -1511,7 +1529,9 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, /* FIXME: For now, load the firmware at startup. We will remove this before the code goes to production... */ + mutex_lock(&priv->lock); check_firmware(fe, DTV8, 0, priv->if_khz); + mutex_unlock(&priv->lock); return fe; fail: -- cgit v1.2.3 From 1368ceb266990af58a72cdb0e121eb4ff22bde6f Mon Sep 17 00:00:00 2001 From: Istvan Varga Date: Fri, 3 Jun 2011 12:27:30 -0300 Subject: [media] xc4000: fixed frequency error The xc_get_frequency_error() function reported the frequency error incorrectly. The data read from the hardware is a signed integer, in 15625 Hz units. The attached patch fixes the bug. Signed-off-by: Istvan Varga Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index be43a6dfac6c..f50dd6e713f7 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -417,8 +417,9 @@ static int xc_get_frequency_error(struct xc4000_priv *priv, u32 *freq_error_hz) if (result != XC_RESULT_SUCCESS) return result; - tmp = (u32)regData; - (*freq_error_hz) = (tmp * 15625) / 1000; + tmp = (u32)regData & 0xFFFFU; + tmp = (tmp < 0x8000U ? tmp : 0x10000U - tmp); + (*freq_error_hz) = tmp * 15625; return result; } -- cgit v1.2.3 From fa285bc1bf5a2ebe3252523454def096d86a064b Mon Sep 17 00:00:00 2001 From: Istvan Varga Date: Sat, 4 Jun 2011 11:48:16 -0300 Subject: [media] xc4000: added firmware_name parameter The firmware_name module parameter makes it possible to set the firmware file name. It defaults to "xc4000.fw" if not specified. Signed-off-by: Istvan Varga Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index f50dd6e713f7..229a2155b2e8 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -47,16 +47,20 @@ MODULE_PARM_DESC(no_poweroff, "0 (default) powers device off when not used.\n" "\t\t1 keep device energized and with tuner ready all the times.\n" "\t\tFaster, but consumes more power and keeps the device hotter"); +#define XC4000_DEFAULT_FIRMWARE "xc4000.fw" + +static char firmware_name[30]; +module_param_string(firmware_name, firmware_name, sizeof(firmware_name), 0); +MODULE_PARM_DESC(firmware_name, "\n\t\tFirmware file name. Allows overriding " + "the default firmware\n" + "\t\tname."); + static DEFINE_MUTEX(xc4000_list_mutex); static LIST_HEAD(hybrid_tuner_instance_list); #define dprintk(level, fmt, arg...) if (debug >= level) \ printk(KERN_INFO "%s: " fmt, "xc4000", ## arg) -/* Note that the last version digit is my internal build number (so I can - rev the firmware even if the core Xceive firmware was unchanged) */ -#define XC4000_DEFAULT_FIRMWARE "dvb-fe-xc4000-1.4.1.fw" - /* struct for storing firmware table */ struct firmware_description { unsigned int type; @@ -715,7 +719,10 @@ static int xc4000_fwupload(struct dvb_frontend *fe) char name[33]; const char *fname; - fname = XC4000_DEFAULT_FIRMWARE; + if (firmware_name[0] != '\0') + fname = firmware_name; + else + fname = XC4000_DEFAULT_FIRMWARE; printk("Reading firmware %s\n", fname); rc = request_firmware(&fw, fname, priv->i2c_props.adap->dev.parent); -- cgit v1.2.3 From 3db9570482f368cd2f62c258802da21667ec6198 Mon Sep 17 00:00:00 2001 From: Istvan Varga Date: Sat, 4 Jun 2011 11:52:34 -0300 Subject: [media] xc4000: simplified seek_firmware() This patch simplifies the code in seek_firmware(). Signed-off-by: Istvan Varga Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 71 +++++++++++++----------------------- 1 file changed, 25 insertions(+), 46 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 229a2155b2e8..811519a49f59 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -605,8 +605,8 @@ static int seek_firmware(struct dvb_frontend *fe, unsigned int type, v4l2_std_id *id) { struct xc4000_priv *priv = fe->tuner_priv; - int i, best_i = -1, best_nr_matches = 0; - unsigned int type_mask = 0; + int i, best_i = -1; + unsigned int best_nr_diffs = 255U; if (!priv->firm) { printk("Error! firmware not loaded\n"); @@ -616,63 +616,42 @@ static int seek_firmware(struct dvb_frontend *fe, unsigned int type, if (((type & ~SCODE) == 0) && (*id == 0)) *id = V4L2_STD_PAL; - if (type & BASE) - type_mask = BASE_TYPES; - else if (type & SCODE) { - type &= SCODE_TYPES; - type_mask = SCODE_TYPES & ~HAS_IF; - } else if (type & DTV_TYPES) - type_mask = DTV_TYPES; - else if (type & STD_SPECIFIC_TYPES) - type_mask = STD_SPECIFIC_TYPES; - - type &= type_mask; - - if (!(type & SCODE)) - type_mask = ~0; - - /* Seek for exact match */ - for (i = 0; i < priv->firm_size; i++) { - if ((type == (priv->firm[i].type & type_mask)) && - (*id == priv->firm[i].id)) - goto found; - } - /* Seek for generic video standard match */ for (i = 0; i < priv->firm_size; i++) { - v4l2_std_id match_mask; - int nr_matches; - - if (type != (priv->firm[i].type & type_mask)) + v4l2_std_id id_diff_mask = + (priv->firm[i].id ^ (*id)) & (*id); + unsigned int type_diff_mask = + (priv->firm[i].type ^ type) + & (BASE_TYPES | DTV_TYPES | LCD | NOGD | MONO | SCODE); + unsigned int nr_diffs; + + if (type_diff_mask + & (BASE | INIT1 | FM | DTV6 | DTV7 | DTV78 | DTV8 | SCODE)) continue; - match_mask = *id & priv->firm[i].id; - if (!match_mask) - continue; - - if ((*id & match_mask) == *id) - goto found; /* Supports all the requested standards */ + nr_diffs = hweight64(id_diff_mask) + hweight32(type_diff_mask); + if (!nr_diffs) /* Supports all the requested standards */ + goto found; - nr_matches = hweight64(match_mask); - if (nr_matches > best_nr_matches) { - best_nr_matches = nr_matches; + if (nr_diffs < best_nr_diffs) { + best_nr_diffs = nr_diffs; best_i = i; } } - if (best_nr_matches > 0) { - printk("Selecting best matching firmware (%d bits) for " - "type=", best_nr_matches); + /* FIXME: Would make sense to seek for type "hint" match ? */ + if (best_i < 0) { + i = -ENOENT; + goto ret; + } + + if (best_nr_diffs > 0U) { + printk("Selecting best matching firmware (%u bits differ) for " + "type=", best_nr_diffs); printk("(%x), id %016llx:\n", type, (unsigned long long)*id); i = best_i; - goto found; } - /*FIXME: Would make sense to seek for type "hint" match ? */ - - i = -ENOENT; - goto ret; - found: *id = priv->firm[i].id; -- cgit v1.2.3 From ffce6266c8be9076947462c688ad3a3099c83eeb Mon Sep 17 00:00:00 2001 From: Istvan Varga Date: Sat, 4 Jun 2011 11:56:18 -0300 Subject: [media] xc4000: simplified load_scode Removed unused code from load_scode() (all SCODE firmwares are assumed to have the HAS_IF bit set). Signed-off-by: Istvan Varga Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 811519a49f59..d83da50ebb70 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -780,8 +780,7 @@ static int xc4000_fwupload(struct dvb_frontend *fe) p += sizeof(size); if (!size || size > endp - p) { - printk("Firmware type "); - printk("(%x), id %llx is corrupted " + printk("Firmware type (%x), id %llx is corrupted " "(size=%d, expected %d)\n", type, (unsigned long long)id, (unsigned)(endp - p), size); @@ -839,10 +838,10 @@ static int load_scode(struct dvb_frontend *fe, unsigned int type, v4l2_std_id *id, __u16 int_freq, int scode) { struct xc4000_priv *priv = fe->tuner_priv; - int pos, rc; - unsigned char *p; - u8 scode_buf[13]; - u8 indirect_mode[5]; + int pos, rc; + unsigned char *p; + u8 scode_buf[13]; + u8 indirect_mode[5]; dprintk(1, "%s called int_freq=%d\n", __func__, int_freq); @@ -862,18 +861,9 @@ static int load_scode(struct dvb_frontend *fe, unsigned int type, p = priv->firm[pos].ptr; - if (priv->firm[pos].type & HAS_IF) { - if (priv->firm[pos].size != 12 * 16 || scode >= 16) - return -EINVAL; - p += 12 * scode; - } else { - /* 16 SCODE entries per file; each SCODE entry is 12 bytes and - * has a 2-byte size header in the firmware format. */ - if (priv->firm[pos].size != 14 * 16 || scode >= 16 || - le16_to_cpu(*(__u16 *)(p + 14 * scode)) != 12) - return -EINVAL; - p += 14 * scode + 2; - } + if (priv->firm[pos].size != 12 * 16 || scode >= 16) + return -EINVAL; + p += 12 * scode; tuner_info("Loading SCODE for type="); dump_firm_type_and_int_freq(priv->firm[pos].type, -- cgit v1.2.3 From 595a83f49a7536f43a68cab78098d5ad11d1c51f Mon Sep 17 00:00:00 2001 From: Istvan Varga Date: Sat, 4 Jun 2011 11:59:54 -0300 Subject: [media] xc4000: check_firmware() cleanup This patch makes the following fixes in check_firmware(): - there is only one BASE and INIT1 firmware for XC4000 - loading SCODE is needed also for FM radio Signed-off-by: Istvan Varga Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index d83da50ebb70..71739dc33438 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -903,7 +903,7 @@ static int check_firmware(struct dvb_frontend *fe, unsigned int type, struct xc4000_priv *priv = fe->tuner_priv; struct firmware_properties new_fw; int rc = 0, is_retry = 0; - u16 version, hwmodel; + u16 version = 0, hwmodel; v4l2_std_id std0; u8 hw_major, hw_minor, fw_major, fw_minor; @@ -945,8 +945,7 @@ retry: } /* No need to reload base firmware if it matches */ - if (((BASE | new_fw.type) & BASE_TYPES) == - (priv->cur_fw.type & BASE_TYPES)) { + if (priv->cur_fw.type & BASE) { dprintk(1, "BASE firmware not changed.\n"); goto skip_base; } @@ -961,7 +960,7 @@ retry: /* BASE firmwares are all std0 */ std0 = 0; - rc = load_firmware(fe, BASE | new_fw.type, &std0); + rc = load_firmware(fe, BASE, &std0); if (rc < 0) { printk("Error %d while loading base firmware\n", rc); goto fail; @@ -970,10 +969,9 @@ retry: /* Load INIT1, if needed */ dprintk(1, "Load init1 firmware, if exists\n"); - rc = load_firmware(fe, BASE | INIT1 | new_fw.type, &std0); + rc = load_firmware(fe, BASE | INIT1, &std0); if (rc == -ENOENT) - rc = load_firmware(fe, (BASE | INIT1 | new_fw.type) & ~F8MHZ, - &std0); + rc = load_firmware(fe, BASE | INIT1, &std0); if (rc < 0 && rc != -ENOENT) { tuner_err("Error %d while loading init1 firmware\n", rc); @@ -1007,9 +1005,6 @@ skip_std_specific: goto check_device; } - if (new_fw.type & FM) - goto check_device; - /* Load SCODE firmware, if exists */ rc = load_scode(fe, new_fw.type | new_fw.scode_table, &new_fw.id, new_fw.int_freq, new_fw.scode_nr); -- cgit v1.2.3 From 0b4021321c0536a3368746497686ce56e5bcf3e5 Mon Sep 17 00:00:00 2001 From: Istvan Varga Date: Fri, 3 Jun 2011 09:38:04 -0300 Subject: [media] xc4000: added card_type This patch adds support for selecting a card type in struct xc4000_config, to allow for implementing some card specific code in the driver. Signed-off-by: Istvan Varga Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 15 ++++++++++++++- drivers/media/common/tuners/xc4000.h | 7 ++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 71739dc33438..0afb61f8eae5 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -90,6 +90,7 @@ struct xc4000_priv { u32 bandwidth; u8 video_standard; u8 rf_mode; + u8 card_type; u8 ignore_i2c_write_errors; /* struct xc2028_ctrl ctrl; */ struct firmware_properties cur_fw; @@ -1433,6 +1434,16 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, int instance; u16 id = 0; + if (cfg->card_type != XC4000_CARD_GENERIC) { + if (cfg->card_type == XC4000_CARD_WINFAST_CX88) { + cfg->i2c_address = 0x61; + cfg->if_khz = 4560; + } else { /* default to PCTV 340E */ + cfg->i2c_address = 0x61; + cfg->if_khz = 5400; + } + } + dprintk(1, "%s(%d-%04x)\n", __func__, i2c ? i2c_adapter_id(i2c) : -1, cfg ? cfg->i2c_address : -1); @@ -1442,6 +1453,8 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, instance = hybrid_tuner_request_state(struct xc4000_priv, priv, hybrid_tuner_instance_list, i2c, cfg->i2c_address, "xc4000"); + if (cfg->card_type != XC4000_CARD_GENERIC) + priv->card_type = cfg->card_type; switch (instance) { case 0: goto fail; @@ -1458,7 +1471,7 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, break; } - if (priv->if_khz == 0) { + if (cfg->if_khz != 0) { /* If the IF hasn't been set yet, use the value provided by the caller (occurs in hybrid devices where the analog call to xc4000_attach occurs before the digital side) */ diff --git a/drivers/media/common/tuners/xc4000.h b/drivers/media/common/tuners/xc4000.h index 3881ba26b794..d560d01cc82b 100644 --- a/drivers/media/common/tuners/xc4000.h +++ b/drivers/media/common/tuners/xc4000.h @@ -27,8 +27,13 @@ struct dvb_frontend; struct i2c_adapter; +#define XC4000_CARD_GENERIC 0 +#define XC4000_CARD_PCTV_340E 1 +#define XC4000_CARD_WINFAST_CX88 2 + struct xc4000_config { - u8 i2c_address; + u8 card_type; /* if card type is not generic, all other */ + u8 i2c_address; /* parameters are automatically set */ u32 if_khz; }; -- cgit v1.2.3 From 5272f6b1f423d4ce636dc90f190e245897bdb045 Mon Sep 17 00:00:00 2001 From: Istvan Varga Date: Sat, 4 Jun 2011 12:03:03 -0300 Subject: [media] xc4000: implemented power management The following patch implements the xc4000_sleep() function. The 'no_powerdown' module parameter is now interpreted differently: - 0 uses a device-specific default - 1 disables power management like before - 2 enables power management Signed-off-by: Istvan Varga Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 39 +++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 0afb61f8eae5..c373f4b36f5a 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -43,9 +43,11 @@ MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); static int no_poweroff; module_param(no_poweroff, int, 0644); -MODULE_PARM_DESC(no_poweroff, "0 (default) powers device off when not used.\n" - "\t\t1 keep device energized and with tuner ready all the times.\n" - "\t\tFaster, but consumes more power and keeps the device hotter"); +MODULE_PARM_DESC(no_poweroff, "\n\t\t1: keep device energized and with tuner " + "ready all the times.\n" + "\t\tFaster, but consumes more power and keeps the device hotter.\n" + "\t\t2: powers device off when not used.\n" + "\t\t0 (default): use device-specific default mode."); #define XC4000_DEFAULT_FIRMWARE "xc4000.fw" @@ -102,6 +104,7 @@ struct xc4000_priv { /* Misc Defines */ #define MAX_TV_STANDARD 24 #define XC_MAX_I2C_WRITE_LENGTH 64 +#define XC_POWERED_DOWN 0x80000000U /* Signal Types */ #define XC_RF_MODE_AIR 0 @@ -1365,8 +1368,34 @@ static int xc4000_get_status(struct dvb_frontend *fe, u32 *status) static int xc4000_sleep(struct dvb_frontend *fe) { - /* FIXME: djh disable this for now... */ - return XC_RESULT_SUCCESS; + struct xc4000_priv *priv = fe->tuner_priv; + int ret = XC_RESULT_SUCCESS; + + dprintk(1, "%s()\n", __func__); + + mutex_lock(&priv->lock); + + /* Avoid firmware reload on slow devices */ + if ((no_poweroff == 2 || + (no_poweroff == 0 && + priv->card_type != XC4000_CARD_WINFAST_CX88)) && + (priv->cur_fw.type & BASE) != 0) { + /* force reset and firmware reload */ + priv->cur_fw.type = XC_POWERED_DOWN; + + if (xc_write_reg(priv, XREG_POWER_DOWN, 0) + != XC_RESULT_SUCCESS) { + printk(KERN_ERR + "xc4000: %s() unable to shutdown tuner\n", + __func__); + ret = -EREMOTEIO; + } + xc_wait(20); + } + + mutex_unlock(&priv->lock); + + return ret; } static int xc4000_init(struct dvb_frontend *fe) -- cgit v1.2.3 From 027fd361860e40736c0ad093a8f4194d727afb63 Mon Sep 17 00:00:00 2001 From: Istvan Varga Date: Sat, 4 Jun 2011 12:04:51 -0300 Subject: [media] xc4000: firmware initialization This patch fixes/cleans up the loading of the firmware file when the driver is loaded and initialized. Signed-off-by: Istvan Varga Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index c373f4b36f5a..ec5f1f1b3f3c 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -1400,21 +1400,8 @@ static int xc4000_sleep(struct dvb_frontend *fe) static int xc4000_init(struct dvb_frontend *fe) { - struct xc4000_priv *priv = fe->tuner_priv; - int ret; dprintk(1, "%s()\n", __func__); - mutex_lock(&priv->lock); - ret = check_firmware(fe, DTV8, 0, priv->if_khz); - mutex_unlock(&priv->lock); - if (ret != XC_RESULT_SUCCESS) { - printk(KERN_ERR "xc4000: Unable to initialise tuner\n"); - return -EREMOTEIO; - } - - if (debug) - xc_debug_dump(priv); - return 0; } @@ -1511,8 +1498,14 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, instance of the driver has loaded the firmware. */ - if (xc4000_readreg(priv, XREG_PRODUCT_ID, &id) != XC_RESULT_SUCCESS) + if (instance == 1) { + if (xc4000_readreg(priv, XREG_PRODUCT_ID, &id) + != XC_RESULT_SUCCESS) goto fail; + } else { + id = ((priv->cur_fw.type & BASE) != 0 ? + priv->hwmodel : XC_PRODUCT_ID_FW_NOT_LOADED); + } switch (id) { case XC_PRODUCT_ID_FW_LOADED: @@ -1541,16 +1534,19 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, memcpy(&fe->ops.tuner_ops, &xc4000_tuner_ops, sizeof(struct dvb_tuner_ops)); - /* FIXME: For now, load the firmware at startup. We will remove this - before the code goes to production... */ - mutex_lock(&priv->lock); - check_firmware(fe, DTV8, 0, priv->if_khz); - mutex_unlock(&priv->lock); + if (instance == 1) { + int ret; + mutex_lock(&priv->lock); + ret = xc4000_fwupload(fe); + mutex_unlock(&priv->lock); + if (ret != XC_RESULT_SUCCESS) + goto fail2; + } return fe; fail: mutex_unlock(&xc4000_list_mutex); - +fail2: xc4000_release(fe); return NULL; } -- cgit v1.2.3 From f4312e2fd4ca44e1defad1637d054bbe11a4ade6 Mon Sep 17 00:00:00 2001 From: Istvan Varga Date: Sat, 4 Jun 2011 12:08:29 -0300 Subject: [media] xc4000: debug message improvements The following patch makes a few minor changes to the printing of debug messages, and reporting the tuner status. The 'debug' module parameter can now be set from 0 to 2 to control the verbosity of debug messages. Signed-off-by: Istvan Varga Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 68 ++++++++++++++++++++++++------------ 1 file changed, 45 insertions(+), 23 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index ec5f1f1b3f3c..24afebb93331 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -39,7 +39,7 @@ static int debug; module_param(debug, int, 0644); -MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); +MODULE_PARM_DESC(debug, "\n\t\tDebugging level (0 to 2, default: 0 (off))."); static int no_poweroff; module_param(no_poweroff, int, 0644); @@ -239,6 +239,7 @@ static struct XC_TV_STANDARD XC4000_Standard[MAX_TV_STANDARD] = { static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val); static int xc4000_TunerReset(struct dvb_frontend *fe); +static void xc_debug_dump(struct xc4000_priv *priv); static int xc_send_i2c_data(struct xc4000_priv *priv, u8 *buf, int len) { @@ -515,6 +516,15 @@ static int xc_tune_channel(struct xc4000_priv *priv, u32 freq_hz, int mode) found = 1; } + /* Wait for stats to stabilize. + * Frame Lines needs two frame times after initial lock + * before it is valid. + */ + xc_wait(debug ? 100 : 10); + + if (debug) + xc_debug_dump(priv); + return found; } @@ -1085,12 +1095,6 @@ static void xc_debug_dump(struct xc4000_priv *priv) u8 hw_majorversion = 0, hw_minorversion = 0; u8 fw_majorversion = 0, fw_minorversion = 0; - /* Wait for stats to stabilize. - * Frame Lines needs two frame times after initial lock - * before it is valid. - */ - xc_wait(100); - xc_get_ADC_Envelope(priv, &adc_envelope); dprintk(1, "*** ADC envelope (0-1023) = %d\n", adc_envelope); @@ -1103,16 +1107,18 @@ static void xc_debug_dump(struct xc4000_priv *priv) xc_get_version(priv, &hw_majorversion, &hw_minorversion, &fw_majorversion, &fw_minorversion); - dprintk(1, "*** HW: V%02x.%02x, FW: V%02x.%02x\n", hw_majorversion, hw_minorversion, fw_majorversion, fw_minorversion); - xc_get_hsync_freq(priv, &hsync_freq_hz); - dprintk(1, "*** Horizontal sync frequency = %d Hz\n", hsync_freq_hz); + if (priv->video_standard < XC4000_DTV6) { + xc_get_hsync_freq(priv, &hsync_freq_hz); + dprintk(1, "*** Horizontal sync frequency = %d Hz\n", + hsync_freq_hz); - xc_get_frame_lines(priv, &frame_lines); - dprintk(1, "*** Frame lines = %d\n", frame_lines); + xc_get_frame_lines(priv, &frame_lines); + dprintk(1, "*** Frame lines = %d\n", frame_lines); + } xc_get_quality(priv, &quality); dprintk(1, "*** Quality (0:<8dB, 7:>56dB) = %d\n", quality); @@ -1223,9 +1229,6 @@ static int xc4000_set_params(struct dvb_frontend *fe, } xc_tune_channel(priv, priv->freq_hz, XC_TUNE_DIGITAL); - if (debug) - xc_debug_dump(priv); - ret = 0; fail: @@ -1320,9 +1323,6 @@ tune_channel: xc_tune_channel(priv, priv->freq_hz, XC_TUNE_ANALOG); - if (debug) - xc_debug_dump(priv); - ret = 0; fail: @@ -1334,8 +1334,26 @@ fail: static int xc4000_get_frequency(struct dvb_frontend *fe, u32 *freq) { struct xc4000_priv *priv = fe->tuner_priv; - dprintk(1, "%s()\n", __func__); + *freq = priv->freq_hz; + + if (debug) { + mutex_lock(&priv->lock); + if ((priv->cur_fw.type + & (BASE | FM | DTV6 | DTV7 | DTV78 | DTV8)) == BASE) { + u16 snr = 0; + if (xc4000_readreg(priv, XREG_SNR, &snr) == 0) { + mutex_unlock(&priv->lock); + dprintk(1, "%s() freq = %u, SNR = %d\n", + __func__, *freq, snr); + return 0; + } + } + mutex_unlock(&priv->lock); + } + + dprintk(1, "%s()\n", __func__); + return 0; } @@ -1355,13 +1373,17 @@ static int xc4000_get_status(struct dvb_frontend *fe, u32 *status) mutex_lock(&priv->lock); - xc_get_lock_status(priv, &lock_status); + if (priv->cur_fw.type & BASE) + xc_get_lock_status(priv, &lock_status); - mutex_unlock(&priv->lock); + *status = (lock_status == 1 ? + TUNER_STATUS_LOCKED | TUNER_STATUS_STEREO : 0); + if (priv->cur_fw.type & (DTV6 | DTV7 | DTV78 | DTV8)) + *status &= (~TUNER_STATUS_STEREO); - dprintk(1, "%s() lock_status = 0x%08x\n", __func__, lock_status); + mutex_unlock(&priv->lock); - *status = lock_status; + dprintk(2, "%s() lock_status = %d\n", __func__, lock_status); return 0; } -- cgit v1.2.3 From 30f544ec56eefc628e73e23324dc18105ad13012 Mon Sep 17 00:00:00 2001 From: Istvan Varga Date: Sat, 4 Jun 2011 12:12:42 -0300 Subject: [media] xc4000: setting registers This patch implements setting the registers in xc4000_set_params() and xc4000_set_analog_params(). A new register is defined which enables filtering of the composite video output (this is needed to avoid bad picture quality with some boards). Signed-off-by: Istvan Varga Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 67 +++++++++++++++++++++++++++++------- 1 file changed, 55 insertions(+), 12 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 24afebb93331..bf3f6f1664cd 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -131,6 +131,7 @@ struct xc4000_priv { #define XREG_SEEK_MODE 0x06 #define XREG_POWER_DOWN 0x08 #define XREG_SIGNALSOURCE 0x0A +#define XREG_SMOOTHEDCVBS 0x0E #define XREG_AMPLITUDE 0x10 /* Registers (Read-only) */ @@ -1218,15 +1219,35 @@ static int xc4000_set_params(struct dvb_frontend *fe, "xc4000: xc_SetSignalSource(%d) failed\n", priv->rf_mode); goto fail; + } else { + u16 video_mode, audio_mode; + video_mode = XC4000_Standard[priv->video_standard].VideoMode; + audio_mode = XC4000_Standard[priv->video_standard].AudioMode; + if (type == DTV6 && priv->firm_version != 0x0102) + video_mode |= 0x0001; + ret = xc_SetTVStandard(priv, video_mode, audio_mode); + if (ret != XC_RESULT_SUCCESS) { + printk(KERN_ERR "xc4000: xc_SetTVStandard failed\n"); + /* DJH - do not return when it fails... */ + /* goto fail; */ + } } - ret = xc_SetTVStandard(priv, - XC4000_Standard[priv->video_standard].VideoMode, - XC4000_Standard[priv->video_standard].AudioMode); - if (ret != XC_RESULT_SUCCESS) { - printk(KERN_ERR "xc4000: xc_SetTVStandard failed\n"); - goto fail; + if (priv->card_type == XC4000_CARD_WINFAST_CX88) { + if (xc_write_reg(priv, XREG_D_CODE, 0) == 0) + ret = 0; + if (xc_write_reg(priv, XREG_AMPLITUDE, + (priv->firm_version == 0x0102 ? 132 : 134)) + != 0) + ret = -EREMOTEIO; + if (xc_write_reg(priv, XREG_SMOOTHEDCVBS, 1) != 0) + ret = -EREMOTEIO; + if (ret != 0) { + printk(KERN_ERR "xc4000: setting registers failed\n"); + /* goto fail; */ + } } + xc_tune_channel(priv, priv->freq_hz, XC_TUNE_DIGITAL); ret = 0; @@ -1311,14 +1332,36 @@ tune_channel: "xc4000: xc_SetSignalSource(%d) failed\n", priv->rf_mode); goto fail; + } else { + u16 video_mode, audio_mode; + video_mode = XC4000_Standard[priv->video_standard].VideoMode; + audio_mode = XC4000_Standard[priv->video_standard].AudioMode; + if (priv->video_standard < XC4000_BG_PAL_A2) { + if (0 /*type & NOGD*/) + video_mode &= 0xFF7F; + } else if (priv->video_standard < XC4000_I_PAL_NICAM) { + if (priv->card_type == XC4000_CARD_WINFAST_CX88 && + priv->firm_version == 0x0102) + video_mode &= 0xFEFF; + } + ret = xc_SetTVStandard(priv, video_mode, audio_mode); + if (ret != XC_RESULT_SUCCESS) { + printk(KERN_ERR "xc4000: xc_SetTVStandard failed\n"); + goto fail; + } } - ret = xc_SetTVStandard(priv, - XC4000_Standard[priv->video_standard].VideoMode, - XC4000_Standard[priv->video_standard].AudioMode); - if (ret != XC_RESULT_SUCCESS) { - printk(KERN_ERR "xc4000: xc_SetTVStandard failed\n"); - goto fail; + if (priv->card_type == XC4000_CARD_WINFAST_CX88) { + if (xc_write_reg(priv, XREG_D_CODE, 0) == 0) + ret = 0; + if (xc_write_reg(priv, XREG_AMPLITUDE, 1) != 0) + ret = -EREMOTEIO; + if (xc_write_reg(priv, XREG_SMOOTHEDCVBS, 1) != 0) + ret = -EREMOTEIO; + if (ret != 0) { + printk(KERN_ERR "xc4000: setting registers failed\n"); + goto fail; + } } xc_tune_channel(priv, priv->freq_hz, XC_TUNE_ANALOG); -- cgit v1.2.3 From 923137a4037d1b9f19d175708eeced209dff9320 Mon Sep 17 00:00:00 2001 From: Istvan Varga Date: Sat, 4 Jun 2011 12:15:51 -0300 Subject: [media] xc4000: added audio_std module parameter The 'audio_std' module parameter makes it possible to fine tune some audio related aspects of the driver, like setting the exact audio standard (NICAM, A2, etc.) to be used for some video standards. Signed-off-by: Istvan Varga Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index bf3f6f1664cd..2a20d0e63da6 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -49,6 +49,27 @@ MODULE_PARM_DESC(no_poweroff, "\n\t\t1: keep device energized and with tuner " "\t\t2: powers device off when not used.\n" "\t\t0 (default): use device-specific default mode."); +#define XC4000_AUDIO_STD_B 1 +#define XC4000_AUDIO_STD_A2 2 +#define XC4000_AUDIO_STD_K3 4 +#define XC4000_AUDIO_STD_L 8 +#define XC4000_AUDIO_STD_INPUT1 16 +#define XC4000_AUDIO_STD_MONO 32 + +static int audio_std; +module_param(audio_std, int, 0644); +MODULE_PARM_DESC(audio_std, "\n\t\tAudio standard. XC4000 audio decoder " + "explicitly needs to know\n" + "\t\twhat audio standard is needed for some video standards with\n" + "\t\taudio A2 or NICAM.\n" + "\t\tThe valid settings are a sum of:\n" + "\t\t 1: use NICAM/B or A2/B instead of NICAM/A or A2/A\n" + "\t\t 2: use A2 instead of NICAM or BTSC\n" + "\t\t 4: use SECAM/K3 instead of K1\n" + "\t\t 8: use PAL-D/K audio for SECAM-D/K\n" + "\t\t16: use FM radio input 1 instead of input 2\n" + "\t\t32: use mono audio (the lower three bits are ignored)"); + #define XC4000_DEFAULT_FIRMWARE "xc4000.fw" static char firmware_name[30]; @@ -1343,6 +1364,8 @@ tune_channel: if (priv->card_type == XC4000_CARD_WINFAST_CX88 && priv->firm_version == 0x0102) video_mode &= 0xFEFF; + if (audio_std & XC4000_AUDIO_STD_B) + video_mode |= 0x0080; } ret = xc_SetTVStandard(priv, video_mode, audio_mode); if (ret != XC_RESULT_SUCCESS) { -- cgit v1.2.3 From 818a1776a45c230c4f230c8e4e2d0c7bdf5f8fa3 Mon Sep 17 00:00:00 2001 From: Istvan Varga Date: Sat, 4 Jun 2011 12:17:22 -0300 Subject: [media] xc4000: implemented analog TV and radio The following patch implements support for analog TV and FM radio. Signed-off-by: Istvan Varga Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 119 +++++++++++++++++++++++++++++------ 1 file changed, 100 insertions(+), 19 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 2a20d0e63da6..52375498257c 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -1283,69 +1283,150 @@ static int xc4000_set_analog_params(struct dvb_frontend *fe, struct analog_parameters *params) { struct xc4000_priv *priv = fe->tuner_priv; + unsigned int type = 0; int ret = -EREMOTEIO; + if (params->mode == V4L2_TUNER_RADIO) { + dprintk(1, "%s() frequency=%d (in units of 62.5Hz)\n", + __func__, params->frequency); + + mutex_lock(&priv->lock); + + params->std = 0; + priv->freq_hz = params->frequency * 125L / 2; + + if (audio_std & XC4000_AUDIO_STD_INPUT1) { + priv->video_standard = XC4000_FM_Radio_INPUT1; + type = FM | INPUT1; + } else { + priv->video_standard = XC4000_FM_Radio_INPUT2; + type = FM | INPUT2; + } + + goto tune_channel; + } + dprintk(1, "%s() frequency=%d (in units of 62.5khz)\n", __func__, params->frequency); mutex_lock(&priv->lock); - /* Fix me: it could be air. */ - priv->rf_mode = params->mode; - if (params->mode > XC_RF_MODE_CABLE) - priv->rf_mode = XC_RF_MODE_CABLE; - /* params->frequency is in units of 62.5khz */ priv->freq_hz = params->frequency * 62500; - /* FIX ME: Some video standards may have several possible audio - standards. We simply default to one of them here. - */ + params->std &= V4L2_STD_ALL; + /* if std is not defined, choose one */ + if (!params->std) + params->std = V4L2_STD_PAL_BG; + + if (audio_std & XC4000_AUDIO_STD_MONO) + type = MONO; + if (params->std & V4L2_STD_MN) { - /* default to BTSC audio standard */ - priv->video_standard = XC4000_MN_NTSC_PAL_BTSC; + params->std = V4L2_STD_MN; + if (audio_std & XC4000_AUDIO_STD_MONO) { + priv->video_standard = XC4000_MN_NTSC_PAL_Mono; + } else if (audio_std & XC4000_AUDIO_STD_A2) { + params->std |= V4L2_STD_A2; + priv->video_standard = XC4000_MN_NTSC_PAL_A2; + } else { + params->std |= V4L2_STD_BTSC; + priv->video_standard = XC4000_MN_NTSC_PAL_BTSC; + } goto tune_channel; } if (params->std & V4L2_STD_PAL_BG) { - /* default to NICAM audio standard */ - priv->video_standard = XC4000_BG_PAL_NICAM; + params->std = V4L2_STD_PAL_BG; + if (audio_std & XC4000_AUDIO_STD_MONO) { + priv->video_standard = XC4000_BG_PAL_MONO; + } else if (!(audio_std & XC4000_AUDIO_STD_A2)) { + if (!(audio_std & XC4000_AUDIO_STD_B)) { + params->std |= V4L2_STD_NICAM_A; + priv->video_standard = XC4000_BG_PAL_NICAM; + } else { + params->std |= V4L2_STD_NICAM_B; + priv->video_standard = XC4000_BG_PAL_NICAM; + } + } else { + if (!(audio_std & XC4000_AUDIO_STD_B)) { + params->std |= V4L2_STD_A2_A; + priv->video_standard = XC4000_BG_PAL_A2; + } else { + params->std |= V4L2_STD_A2_B; + priv->video_standard = XC4000_BG_PAL_A2; + } + } goto tune_channel; } if (params->std & V4L2_STD_PAL_I) { /* default to NICAM audio standard */ - priv->video_standard = XC4000_I_PAL_NICAM; + params->std = V4L2_STD_PAL_I | V4L2_STD_NICAM; + if (audio_std & XC4000_AUDIO_STD_MONO) { + priv->video_standard = XC4000_I_PAL_NICAM_MONO; + } else { + priv->video_standard = XC4000_I_PAL_NICAM; + } goto tune_channel; } if (params->std & V4L2_STD_PAL_DK) { - /* default to NICAM audio standard */ - priv->video_standard = XC4000_DK_PAL_NICAM; + params->std = V4L2_STD_PAL_DK; + if (audio_std & XC4000_AUDIO_STD_MONO) { + priv->video_standard = XC4000_DK_PAL_MONO; + } else if (audio_std & XC4000_AUDIO_STD_A2) { + params->std |= V4L2_STD_A2; + priv->video_standard = XC4000_DK_PAL_A2; + } else { + params->std |= V4L2_STD_NICAM; + priv->video_standard = XC4000_DK_PAL_NICAM; + } goto tune_channel; } if (params->std & V4L2_STD_SECAM_DK) { - /* default to A2 DK1 audio standard */ - priv->video_standard = XC4000_DK_SECAM_A2DK1; + /* default to A2 audio standard */ + params->std = V4L2_STD_SECAM_DK | V4L2_STD_A2; + if (audio_std & XC4000_AUDIO_STD_L) { + type = 0; + priv->video_standard = XC4000_DK_SECAM_NICAM; + } else if (audio_std & XC4000_AUDIO_STD_MONO) { + priv->video_standard = XC4000_DK_SECAM_A2MONO; + } else if (audio_std & XC4000_AUDIO_STD_K3) { + params->std |= V4L2_STD_SECAM_K3; + priv->video_standard = XC4000_DK_SECAM_A2LDK3; + } else { + priv->video_standard = XC4000_DK_SECAM_A2DK1; + } goto tune_channel; } if (params->std & V4L2_STD_SECAM_L) { + /* default to NICAM audio standard */ + type = 0; + params->std = V4L2_STD_SECAM_L | V4L2_STD_NICAM; priv->video_standard = XC4000_L_SECAM_NICAM; goto tune_channel; } if (params->std & V4L2_STD_SECAM_LC) { + /* default to NICAM audio standard */ + type = 0; + params->std = V4L2_STD_SECAM_LC | V4L2_STD_NICAM; priv->video_standard = XC4000_LC_SECAM_NICAM; goto tune_channel; } tune_channel: + /* Fix me: it could be air. */ + priv->rf_mode = XC_RF_MODE_CABLE; - /* FIXME - firmware type not being set properly */ - if (check_firmware(fe, DTV8, 0, priv->if_khz) != XC_RESULT_SUCCESS) + if (check_firmware(fe, type, params->std, + XC4000_Standard[priv->video_standard].int_freq) + != XC_RESULT_SUCCESS) { goto fail; + } ret = xc_SetSignalSource(priv, priv->rf_mode); if (ret != XC_RESULT_SUCCESS) { -- cgit v1.2.3 From e75873c1f80380f190d0270fec566410f59c4829 Mon Sep 17 00:00:00 2001 From: Istvan Varga Date: Sat, 4 Jun 2011 12:18:41 -0300 Subject: [media] xc4000: xc_tune_channel() cleanup Minor coding changes related to the xc_tune_channel() function. Signed-off-by: Istvan Varga Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 52375498257c..c3e564e9f8ca 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -516,12 +516,10 @@ static u16 WaitForLock(struct xc4000_priv *priv) return lockState; } -#define XC_TUNE_ANALOG 0 -#define XC_TUNE_DIGITAL 1 -static int xc_tune_channel(struct xc4000_priv *priv, u32 freq_hz, int mode) +static int xc_tune_channel(struct xc4000_priv *priv, u32 freq_hz) { - int found = 0; - int result = 0; + int found = 1; + int result; dprintk(1, "%s(%u)\n", __func__, freq_hz); @@ -533,9 +531,10 @@ static int xc_tune_channel(struct xc4000_priv *priv, u32 freq_hz, int mode) if (result != XC_RESULT_SUCCESS) return 0; - if (mode == XC_TUNE_ANALOG) { - if (WaitForLock(priv) == 1) - found = 1; + /* wait for lock only in analog TV mode */ + if ((priv->cur_fw.type & (FM | DTV6 | DTV7 | DTV78 | DTV8)) == 0) { + if (WaitForLock(priv) != 1) + found = 0; } /* Wait for stats to stabilize. @@ -1269,7 +1268,7 @@ static int xc4000_set_params(struct dvb_frontend *fe, } } - xc_tune_channel(priv, priv->freq_hz, XC_TUNE_DIGITAL); + xc_tune_channel(priv, priv->freq_hz); ret = 0; @@ -1468,7 +1467,7 @@ tune_channel: } } - xc_tune_channel(priv, priv->freq_hz, XC_TUNE_ANALOG); + xc_tune_channel(priv, priv->freq_hz); ret = 0; -- cgit v1.2.3 From 8f76afe8d737b9ecadc0097941c9ef1ece61af9e Mon Sep 17 00:00:00 2001 From: Istvan Varga Date: Sat, 4 Jun 2011 12:21:17 -0300 Subject: [media] xc4000: removed redundant tuner reset This patch causes the tuner reset command to be ignored in the firmware code, since this only happens when the BASE/INIT1 firmware is loaded by check_firmware(), and in that case check_firmware() already calls the reset callback before starting to load the firmware. Signed-off-by: Istvan Varga Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index c3e564e9f8ca..b04c73bab83c 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -338,10 +338,12 @@ static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence) len = i2c_sequence[index] * 256 + i2c_sequence[index+1]; if (len == 0x0000) { /* RESET command */ - result = xc4000_TunerReset(fe); index += 2; +#if 0 /* not needed, as already called by check_firmware() */ + result = xc4000_TunerReset(fe); if (result != XC_RESULT_SUCCESS) return result; +#endif } else if (len & 0x8000) { /* WAIT command */ xc_wait(len & 0x7FFF); -- cgit v1.2.3 From 7db98fe66be035494912b6b2c4e9c1e3abfedfe5 Mon Sep 17 00:00:00 2001 From: Istvan Varga Date: Sat, 4 Jun 2011 12:25:19 -0300 Subject: [media] xc4000: detect also xc4100 Added code to detect the XC4100 chip, which is presumably an analog-only "value" version of the XC4000. It is not sure, however, if any devices using this have actually been produced and sold, so the patch may be unneeded. Signed-off-by: Istvan Varga Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index b04c73bab83c..160ca26286cc 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -140,7 +140,8 @@ struct xc4000_priv { /* Product id */ #define XC_PRODUCT_ID_FW_NOT_LOADED 0x2000 -#define XC_PRODUCT_ID_FW_LOADED 0x0FA0 +#define XC_PRODUCT_ID_XC4000 0x0FA0 +#define XC_PRODUCT_ID_XC4100 0x1004 /* Registers (Write-only) */ #define XREG_INIT 0x00 @@ -1071,7 +1072,9 @@ check_device: #endif /* Check that the tuner hardware model remains consistent over time. */ - if (priv->hwmodel == 0 && hwmodel == 4000) { + if (priv->hwmodel == 0 && + (hwmodel == XC_PRODUCT_ID_XC4000 || + hwmodel == XC_PRODUCT_ID_XC4100)) { priv->hwmodel = hwmodel; priv->hwvers = version & 0xff00; } else if (priv->hwmodel == 0 || priv->hwmodel != hwmodel || @@ -1678,7 +1681,8 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, } switch (id) { - case XC_PRODUCT_ID_FW_LOADED: + case XC_PRODUCT_ID_XC4000: + case XC_PRODUCT_ID_XC4100: printk(KERN_INFO "xc4000: Successfully identified at address 0x%02x\n", cfg->i2c_address); -- cgit v1.2.3 From 341747bef5dd2e2f56647ba30ea2180752905fa0 Mon Sep 17 00:00:00 2001 From: "istvan_v@mailbox.hu" Date: Mon, 6 Jun 2011 12:54:54 -0300 Subject: [media] xc4000: code cleanup Various coding style changes: - removed unused / commented out code - changed C++ style comments to C format - renamed functions and variables that included upper case letters in the name - removed tabs from module parameter descriptions - replaced the use of XC_RESULT_* with standard error codes Signed-off-by: Istvan Varga Cc: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 272 ++++++++++++---------------- drivers/media/dvb/dvb-usb/dib0700_devices.c | 15 +- 2 files changed, 126 insertions(+), 161 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 160ca26286cc..ebc84269b5e6 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -5,6 +5,7 @@ * Copyright (c) 2007 Steven Toth * Copyright (c) 2009 Devin Heitmueller * Copyright (c) 2009 Davide Ferri + * Copyright (c) 2010 Istvan Varga * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -14,7 +15,6 @@ * This program is distributed in the hope that it will be useful, * 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 General Public License @@ -39,44 +39,29 @@ static int debug; module_param(debug, int, 0644); -MODULE_PARM_DESC(debug, "\n\t\tDebugging level (0 to 2, default: 0 (off))."); +MODULE_PARM_DESC(debug, "Debugging level (0 to 2, default: 0 (off))."); static int no_poweroff; module_param(no_poweroff, int, 0644); -MODULE_PARM_DESC(no_poweroff, "\n\t\t1: keep device energized and with tuner " - "ready all the times.\n" - "\t\tFaster, but consumes more power and keeps the device hotter.\n" - "\t\t2: powers device off when not used.\n" - "\t\t0 (default): use device-specific default mode."); - -#define XC4000_AUDIO_STD_B 1 -#define XC4000_AUDIO_STD_A2 2 -#define XC4000_AUDIO_STD_K3 4 -#define XC4000_AUDIO_STD_L 8 -#define XC4000_AUDIO_STD_INPUT1 16 -#define XC4000_AUDIO_STD_MONO 32 +MODULE_PARM_DESC(no_poweroff, "Power management (1: disabled, 2: enabled, " + "0 (default): use device-specific default mode)."); static int audio_std; module_param(audio_std, int, 0644); -MODULE_PARM_DESC(audio_std, "\n\t\tAudio standard. XC4000 audio decoder " - "explicitly needs to know\n" - "\t\twhat audio standard is needed for some video standards with\n" - "\t\taudio A2 or NICAM.\n" - "\t\tThe valid settings are a sum of:\n" - "\t\t 1: use NICAM/B or A2/B instead of NICAM/A or A2/A\n" - "\t\t 2: use A2 instead of NICAM or BTSC\n" - "\t\t 4: use SECAM/K3 instead of K1\n" - "\t\t 8: use PAL-D/K audio for SECAM-D/K\n" - "\t\t16: use FM radio input 1 instead of input 2\n" - "\t\t32: use mono audio (the lower three bits are ignored)"); - -#define XC4000_DEFAULT_FIRMWARE "xc4000.fw" +MODULE_PARM_DESC(audio_std, "Audio standard. XC4000 audio decoder explicitly " + "needs to know what audio standard is needed for some video standards " + "with audio A2 or NICAM. The valid settings are a sum of:\n" + " 1: use NICAM/B or A2/B instead of NICAM/A or A2/A\n" + " 2: use A2 instead of NICAM or BTSC\n" + " 4: use SECAM/K3 instead of K1\n" + " 8: use PAL-D/K audio for SECAM-D/K\n" + "16: use FM radio input 1 instead of input 2\n" + "32: use mono audio (the lower three bits are ignored)"); static char firmware_name[30]; module_param_string(firmware_name, firmware_name, sizeof(firmware_name), 0); -MODULE_PARM_DESC(firmware_name, "\n\t\tFirmware file name. Allows overriding " - "the default firmware\n" - "\t\tname."); +MODULE_PARM_DESC(firmware_name, "Firmware file name. Allows overriding the " + "default firmware name."); static DEFINE_MUTEX(xc4000_list_mutex); static LIST_HEAD(hybrid_tuner_instance_list); @@ -115,13 +100,21 @@ struct xc4000_priv { u8 rf_mode; u8 card_type; u8 ignore_i2c_write_errors; - /* struct xc2028_ctrl ctrl; */ struct firmware_properties cur_fw; __u16 hwmodel; __u16 hwvers; struct mutex lock; }; +#define XC4000_AUDIO_STD_B 1 +#define XC4000_AUDIO_STD_A2 2 +#define XC4000_AUDIO_STD_K3 4 +#define XC4000_AUDIO_STD_L 8 +#define XC4000_AUDIO_STD_INPUT1 16 +#define XC4000_AUDIO_STD_MONO 32 + +#define XC4000_DEFAULT_FIRMWARE "dvb-fe-xc4000-1.4.fw" + /* Misc Defines */ #define MAX_TV_STANDARD 24 #define XC_MAX_I2C_WRITE_LENGTH 64 @@ -131,13 +124,6 @@ struct xc4000_priv { #define XC_RF_MODE_AIR 0 #define XC_RF_MODE_CABLE 1 -/* Result codes */ -#define XC_RESULT_SUCCESS 0 -#define XC_RESULT_RESET_FAILURE 1 -#define XC_RESULT_I2C_WRITE_FAILURE 2 -#define XC_RESULT_I2C_READ_FAILURE 3 -#define XC_RESULT_OUT_OF_RANGE 5 - /* Product id */ #define XC_PRODUCT_ID_FW_NOT_LOADED 0x2000 #define XC_PRODUCT_ID_XC4000 0x0FA0 @@ -202,8 +188,8 @@ struct xc4000_priv { struct XC_TV_STANDARD { const char *Name; - u16 AudioMode; - u16 VideoMode; + u16 audio_mode; + u16 video_mode; u16 int_freq; }; @@ -233,7 +219,7 @@ struct XC_TV_STANDARD { #define XC4000_FM_Radio_INPUT2 22 #define XC4000_FM_Radio_INPUT1 23 -static struct XC_TV_STANDARD XC4000_Standard[MAX_TV_STANDARD] = { +static struct XC_TV_STANDARD xc4000_standard[MAX_TV_STANDARD] = { {"M/N-NTSC/PAL-BTSC", 0x0000, 0x80A0, 4500}, {"M/N-NTSC/PAL-A2", 0x0000, 0x80A0, 4600}, {"M/N-NTSC/PAL-EIAJ", 0x0040, 0x80A0, 4500}, @@ -261,7 +247,7 @@ static struct XC_TV_STANDARD XC4000_Standard[MAX_TV_STANDARD] = { }; static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val); -static int xc4000_TunerReset(struct dvb_frontend *fe); +static int xc4000_tuner_reset(struct dvb_frontend *fe); static void xc_debug_dump(struct xc4000_priv *priv); static int xc_send_i2c_data(struct xc4000_priv *priv, u8 *buf, int len) @@ -276,18 +262,13 @@ static int xc_send_i2c_data(struct xc4000_priv *priv, u8 *buf, int len) printk("bytes %02x %02x %02x %02x\n", buf[0], buf[1], buf[2], buf[3]); } - return XC_RESULT_I2C_WRITE_FAILURE; + return -EREMOTEIO; } } - return XC_RESULT_SUCCESS; -} - -static void xc_wait(int wait_ms) -{ - msleep(wait_ms); + return 0; } -static int xc4000_TunerReset(struct dvb_frontend *fe) +static int xc4000_tuner_reset(struct dvb_frontend *fe) { struct xc4000_priv *priv = fe->tuner_priv; int ret; @@ -302,13 +283,14 @@ static int xc4000_TunerReset(struct dvb_frontend *fe) XC4000_TUNER_RESET, 0); if (ret) { printk(KERN_ERR "xc4000: reset failed\n"); - return XC_RESULT_RESET_FAILURE; + return -EREMOTEIO; } } else { - printk(KERN_ERR "xc4000: no tuner reset callback function, fatal\n"); - return XC_RESULT_RESET_FAILURE; + printk(KERN_ERR "xc4000: no tuner reset callback function, " + "fatal\n"); + return -EINVAL; } - return XC_RESULT_SUCCESS; + return 0; } static int xc_write_reg(struct xc4000_priv *priv, u16 regAddr, u16 i2cData) @@ -339,15 +321,12 @@ static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence) len = i2c_sequence[index] * 256 + i2c_sequence[index+1]; if (len == 0x0000) { /* RESET command */ + /* NOTE: this is ignored, as the reset callback was */ + /* already called by check_firmware() */ index += 2; -#if 0 /* not needed, as already called by check_firmware() */ - result = xc4000_TunerReset(fe); - if (result != XC_RESULT_SUCCESS) - return result; -#endif } else if (len & 0x8000) { /* WAIT command */ - xc_wait(len & 0x7FFF); + msleep(len & 0x7FFF); index += 2; } else { /* Send i2c data whilst ensuring individual transactions @@ -370,7 +349,7 @@ static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence) result = xc_send_i2c_data(priv, buf, nbytes_to_send); - if (result != XC_RESULT_SUCCESS) + if (result != 0) return result; pos += nbytes_to_send - 2; @@ -378,31 +357,31 @@ static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence) index += len; } } - return XC_RESULT_SUCCESS; + return 0; } -static int xc_SetTVStandard(struct xc4000_priv *priv, - u16 VideoMode, u16 AudioMode) +static int xc_set_tv_standard(struct xc4000_priv *priv, + u16 video_mode, u16 audio_mode) { int ret; - dprintk(1, "%s(0x%04x,0x%04x)\n", __func__, VideoMode, AudioMode); + dprintk(1, "%s(0x%04x,0x%04x)\n", __func__, video_mode, audio_mode); dprintk(1, "%s() Standard = %s\n", __func__, - XC4000_Standard[priv->video_standard].Name); + xc4000_standard[priv->video_standard].Name); /* Don't complain when the request fails because of i2c stretching */ priv->ignore_i2c_write_errors = 1; - ret = xc_write_reg(priv, XREG_VIDEO_MODE, VideoMode); - if (ret == XC_RESULT_SUCCESS) - ret = xc_write_reg(priv, XREG_AUDIO_MODE, AudioMode); + ret = xc_write_reg(priv, XREG_VIDEO_MODE, video_mode); + if (ret == 0) + ret = xc_write_reg(priv, XREG_AUDIO_MODE, audio_mode); priv->ignore_i2c_write_errors = 0; return ret; } -static int xc_SetSignalSource(struct xc4000_priv *priv, u16 rf_mode) +static int xc_set_signal_source(struct xc4000_priv *priv, u16 rf_mode) { dprintk(1, "%s(%d) Source = %s\n", __func__, rf_mode, rf_mode == XC_RF_MODE_AIR ? "ANTENNA" : "CABLE"); @@ -418,25 +397,26 @@ static int xc_SetSignalSource(struct xc4000_priv *priv, u16 rf_mode) static const struct dvb_tuner_ops xc4000_tuner_ops; -static int xc_set_RF_frequency(struct xc4000_priv *priv, u32 freq_hz) +static int xc_set_rf_frequency(struct xc4000_priv *priv, u32 freq_hz) { u16 freq_code; dprintk(1, "%s(%u)\n", __func__, freq_hz); if ((freq_hz > xc4000_tuner_ops.info.frequency_max) || - (freq_hz < xc4000_tuner_ops.info.frequency_min)) - return XC_RESULT_OUT_OF_RANGE; + (freq_hz < xc4000_tuner_ops.info.frequency_min)) + return -EINVAL; freq_code = (u16)(freq_hz / 15625); /* WAS: Starting in firmware version 1.1.44, Xceive recommends using the FINERFREQ for all normal tuning (the doc indicates reg 0x03 should only be used for fast scanning for channel lock) */ - return xc_write_reg(priv, XREG_RF_FREQ, freq_code); /* WAS: XREG_FINERFREQ */ + /* WAS: XREG_FINERFREQ */ + return xc_write_reg(priv, XREG_RF_FREQ, freq_code); } -static int xc_get_ADC_Envelope(struct xc4000_priv *priv, u16 *adc_envelope) +static int xc_get_adc_envelope(struct xc4000_priv *priv, u16 *adc_envelope) { return xc4000_readreg(priv, XREG_ADC_ENV, adc_envelope); } @@ -448,7 +428,7 @@ static int xc_get_frequency_error(struct xc4000_priv *priv, u32 *freq_error_hz) u32 tmp; result = xc4000_readreg(priv, XREG_FREQ_ERROR, ®Data); - if (result != XC_RESULT_SUCCESS) + if (result != 0) return result; tmp = (u32)regData & 0xFFFFU; @@ -470,7 +450,7 @@ static int xc_get_version(struct xc4000_priv *priv, int result; result = xc4000_readreg(priv, XREG_VERSION, &data); - if (result != XC_RESULT_SUCCESS) + if (result != 0) return result; (*hw_majorversion) = (data >> 12) & 0x0F; @@ -487,7 +467,7 @@ static int xc_get_hsync_freq(struct xc4000_priv *priv, u32 *hsync_freq_hz) int result; result = xc4000_readreg(priv, XREG_HSYNC_FREQ, ®Data); - if (result != XC_RESULT_SUCCESS) + if (result != 0) return result; (*hsync_freq_hz) = ((regData & 0x0fff) * 763)/100; @@ -504,19 +484,19 @@ static int xc_get_quality(struct xc4000_priv *priv, u16 *quality) return xc4000_readreg(priv, XREG_QUALITY, quality); } -static u16 WaitForLock(struct xc4000_priv *priv) +static u16 xc_wait_for_lock(struct xc4000_priv *priv) { - u16 lockState = 0; - int watchDogCount = 40; - - while ((lockState == 0) && (watchDogCount > 0)) { - xc_get_lock_status(priv, &lockState); - if (lockState != 1) { - xc_wait(5); - watchDogCount--; + u16 lock_state = 0; + int watchdog_count = 40; + + while ((lock_state == 0) && (watchdog_count > 0)) { + xc_get_lock_status(priv, &lock_state); + if (lock_state != 1) { + msleep(5); + watchdog_count--; } } - return lockState; + return lock_state; } static int xc_tune_channel(struct xc4000_priv *priv, u32 freq_hz) @@ -528,15 +508,15 @@ static int xc_tune_channel(struct xc4000_priv *priv, u32 freq_hz) /* Don't complain when the request fails because of i2c stretching */ priv->ignore_i2c_write_errors = 1; - result = xc_set_RF_frequency(priv, freq_hz); + result = xc_set_rf_frequency(priv, freq_hz); priv->ignore_i2c_write_errors = 0; - if (result != XC_RESULT_SUCCESS) + if (result != 0) return 0; /* wait for lock only in analog TV mode */ if ((priv->cur_fw.type & (FM | DTV6 | DTV7 | DTV78 | DTV8)) == 0) { - if (WaitForLock(priv) != 1) + if (xc_wait_for_lock(priv) != 1) found = 0; } @@ -544,7 +524,7 @@ static int xc_tune_channel(struct xc4000_priv *priv, u32 freq_hz) * Frame Lines needs two frame times after initial lock * before it is valid. */ - xc_wait(debug ? 100 : 10); + msleep(debug ? 100 : 10); if (debug) xc_debug_dump(priv); @@ -569,7 +549,7 @@ static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val) } *val = (bval[0] << 8) | bval[1]; - return XC_RESULT_SUCCESS; + return 0; } #define dump_firm_type(t) dump_firm_type_and_int_freq(t, 0) @@ -647,7 +627,7 @@ static int seek_firmware(struct dvb_frontend *fe, unsigned int type, unsigned int best_nr_diffs = 255U; if (!priv->firm) { - printk("Error! firmware not loaded\n"); + printk(KERN_ERR "Error! firmware not loaded\n"); return -EINVAL; } @@ -685,8 +665,8 @@ static int seek_firmware(struct dvb_frontend *fe, unsigned int type, if (best_nr_diffs > 0U) { printk("Selecting best matching firmware (%u bits differ) for " - "type=", best_nr_diffs); - printk("(%x), id %016llx:\n", type, (unsigned long long)*id); + "type=(%x), id %016llx:\n", + best_nr_diffs, type, (unsigned long long)*id); i = best_i; } @@ -695,8 +675,8 @@ found: ret: if (debug) { - printk("%s firmware for type=", (i < 0) ? "Can't find" : - "Found"); + printk("%s firmware for type=", + (i < 0) ? "Can't find" : "Found"); dump_firm_type(type); printk("(%x), id %016llx.\n", type, (unsigned long long)*id); } @@ -745,11 +725,10 @@ static int xc4000_fwupload(struct dvb_frontend *fe) rc = request_firmware(&fw, fname, priv->i2c_props.adap->dev.parent); if (rc < 0) { if (rc == -ENOENT) - printk("Error: firmware %s not found.\n", - fname); + printk("Error: firmware %s not found.\n", fname); else printk("Error %d while requesting firmware %s \n", - rc, fname); + rc, fname); return rc; } @@ -757,13 +736,12 @@ static int xc4000_fwupload(struct dvb_frontend *fe) endp = p + fw->size; if (fw->size < sizeof(name) - 1 + 2 + 2) { - printk("Error: firmware file %s has invalid size!\n", - fname); + printk("Error: firmware file %s has invalid size!\n", fname); goto corrupt; } memcpy(name, p, sizeof(name) - 1); - name[sizeof(name) - 1] = 0; + name[sizeof(name) - 1] = '\0'; p += sizeof(name) - 1; priv->firm_version = get_unaligned_le16(p); @@ -920,7 +898,7 @@ static int load_scode(struct dvb_frontend *fe, unsigned int type, } rc = xc_send_i2c_data(priv, scode_buf, 13); - if (rc != XC_RESULT_SUCCESS) { + if (rc != 0) { /* Even if the send failed, make sure we set back to indirect mode */ printk("Failed to set scode %d\n", rc); @@ -953,16 +931,11 @@ static int check_firmware(struct dvb_frontend *fe, unsigned int type, return rc; } -#ifdef DJH_DEBUG - if (priv->ctrl.mts && !(type & FM)) - type |= MTS; -#endif - retry: new_fw.type = type; new_fw.id = std; new_fw.std_req = std; - new_fw.scode_table = SCODE /* | priv->ctrl.scode_table */; + new_fw.scode_table = SCODE; new_fw.scode_nr = 0; new_fw.int_freq = int_freq; @@ -971,15 +944,11 @@ retry: dump_firm_type(new_fw.type); printk("(%x), id %016llx, ", new_fw.type, (unsigned long long)new_fw.std_req); - if (!int_freq) { - printk("scode_tbl "); -#ifdef DJH_DEBUG - dump_firm_type(priv->ctrl.scode_table); - printk("(%x), ", priv->ctrl.scode_table); -#endif - } else - printk("int_freq %d, ", new_fw.int_freq); - printk("scode_nr %d\n", new_fw.scode_nr); + if (!int_freq) + printk(KERN_CONT "scode_tbl "); + else + printk(KERN_CONT "int_freq %d, ", new_fw.int_freq); + printk(KERN_CONT "scode_nr %d\n", new_fw.scode_nr); } /* No need to reload base firmware if it matches */ @@ -992,7 +961,7 @@ retry: memset(&priv->cur_fw, 0, sizeof(priv->cur_fw)); /* Reset is needed before loading firmware */ - rc = xc4000_TunerReset(fe); + rc = xc4000_tuner_reset(fe); if (rc < 0) goto fail; @@ -1046,14 +1015,14 @@ skip_std_specific: /* Load SCODE firmware, if exists */ rc = load_scode(fe, new_fw.type | new_fw.scode_table, &new_fw.id, new_fw.int_freq, new_fw.scode_nr); - if (rc != XC_RESULT_SUCCESS) + if (rc != 0) dprintk(1, "load scode failed %d\n", rc); check_device: rc = xc4000_readreg(priv, XREG_PRODUCT_ID, &hwmodel); if (xc_get_version(priv, &hw_major, &hw_minor, &fw_major, - &fw_minor) != XC_RESULT_SUCCESS) { + &fw_minor) != 0) { printk("Unable to read tuner registers.\n"); goto fail; } @@ -1121,7 +1090,7 @@ static void xc_debug_dump(struct xc4000_priv *priv) u8 hw_majorversion = 0, hw_minorversion = 0; u8 fw_majorversion = 0, fw_minorversion = 0; - xc_get_ADC_Envelope(priv, &adc_envelope); + xc_get_adc_envelope(priv, &adc_envelope); dprintk(1, "*** ADC envelope (0-1023) = %d\n", adc_envelope); xc_get_frequency_error(priv, &freq_error_hz); @@ -1235,24 +1204,23 @@ static int xc4000_set_params(struct dvb_frontend *fe, __func__, priv->freq_hz); /* Make sure the correct firmware type is loaded */ - if (check_firmware(fe, type, 0, priv->if_khz) != XC_RESULT_SUCCESS) + if (check_firmware(fe, type, 0, priv->if_khz) != 0) goto fail; - ret = xc_SetSignalSource(priv, priv->rf_mode); - if (ret != XC_RESULT_SUCCESS) { - printk(KERN_ERR - "xc4000: xc_SetSignalSource(%d) failed\n", + ret = xc_set_signal_source(priv, priv->rf_mode); + if (ret != 0) { + printk(KERN_ERR "xc4000: xc_set_signal_source(%d) failed\n", priv->rf_mode); goto fail; } else { u16 video_mode, audio_mode; - video_mode = XC4000_Standard[priv->video_standard].VideoMode; - audio_mode = XC4000_Standard[priv->video_standard].AudioMode; + video_mode = xc4000_standard[priv->video_standard].video_mode; + audio_mode = xc4000_standard[priv->video_standard].audio_mode; if (type == DTV6 && priv->firm_version != 0x0102) video_mode |= 0x0001; - ret = xc_SetTVStandard(priv, video_mode, audio_mode); - if (ret != XC_RESULT_SUCCESS) { - printk(KERN_ERR "xc4000: xc_SetTVStandard failed\n"); + ret = xc_set_tv_standard(priv, video_mode, audio_mode); + if (ret != 0) { + printk(KERN_ERR "xc4000: xc_set_tv_standard failed\n"); /* DJH - do not return when it fails... */ /* goto fail; */ } @@ -1423,27 +1391,25 @@ static int xc4000_set_analog_params(struct dvb_frontend *fe, } tune_channel: - /* Fix me: it could be air. */ + /* FIXME: it could be air. */ priv->rf_mode = XC_RF_MODE_CABLE; if (check_firmware(fe, type, params->std, - XC4000_Standard[priv->video_standard].int_freq) - != XC_RESULT_SUCCESS) { + xc4000_standard[priv->video_standard].int_freq) != 0) goto fail; - } - ret = xc_SetSignalSource(priv, priv->rf_mode); - if (ret != XC_RESULT_SUCCESS) { + ret = xc_set_signal_source(priv, priv->rf_mode); + if (ret != 0) { printk(KERN_ERR - "xc4000: xc_SetSignalSource(%d) failed\n", + "xc4000: xc_set_signal_source(%d) failed\n", priv->rf_mode); goto fail; } else { u16 video_mode, audio_mode; - video_mode = XC4000_Standard[priv->video_standard].VideoMode; - audio_mode = XC4000_Standard[priv->video_standard].AudioMode; + video_mode = xc4000_standard[priv->video_standard].video_mode; + audio_mode = xc4000_standard[priv->video_standard].audio_mode; if (priv->video_standard < XC4000_BG_PAL_A2) { - if (0 /*type & NOGD*/) + if (type & NOGD) video_mode &= 0xFF7F; } else if (priv->video_standard < XC4000_I_PAL_NICAM) { if (priv->card_type == XC4000_CARD_WINFAST_CX88 && @@ -1452,9 +1418,9 @@ tune_channel: if (audio_std & XC4000_AUDIO_STD_B) video_mode |= 0x0080; } - ret = xc_SetTVStandard(priv, video_mode, audio_mode); - if (ret != XC_RESULT_SUCCESS) { - printk(KERN_ERR "xc4000: xc_SetTVStandard failed\n"); + ret = xc_set_tv_standard(priv, video_mode, audio_mode); + if (ret != 0) { + printk(KERN_ERR "xc4000: xc_set_tv_standard failed\n"); goto fail; } } @@ -1542,7 +1508,7 @@ static int xc4000_get_status(struct dvb_frontend *fe, u32 *status) static int xc4000_sleep(struct dvb_frontend *fe) { struct xc4000_priv *priv = fe->tuner_priv; - int ret = XC_RESULT_SUCCESS; + int ret = 0; dprintk(1, "%s()\n", __func__); @@ -1556,14 +1522,13 @@ static int xc4000_sleep(struct dvb_frontend *fe) /* force reset and firmware reload */ priv->cur_fw.type = XC_POWERED_DOWN; - if (xc_write_reg(priv, XREG_POWER_DOWN, 0) - != XC_RESULT_SUCCESS) { + if (xc_write_reg(priv, XREG_POWER_DOWN, 0) != 0) { printk(KERN_ERR "xc4000: %s() unable to shutdown tuner\n", __func__); ret = -EREMOTEIO; } - xc_wait(20); + msleep(20); } mutex_unlock(&priv->lock); @@ -1672,8 +1637,7 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, */ if (instance == 1) { - if (xc4000_readreg(priv, XREG_PRODUCT_ID, &id) - != XC_RESULT_SUCCESS) + if (xc4000_readreg(priv, XREG_PRODUCT_ID, &id) != 0) goto fail; } else { id = ((priv->cur_fw.type & BASE) != 0 ? @@ -1713,7 +1677,7 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, mutex_lock(&priv->lock); ret = xc4000_fwupload(fe); mutex_unlock(&priv->lock); - if (ret != XC_RESULT_SUCCESS) + if (ret != 0) goto fail2; } diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index a5212a5c2b48..d546270d3f5d 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c @@ -2706,13 +2706,14 @@ static struct dibx000_agc_config stk7700p_7000p_xc4000_agc_config = { }; static struct dibx000_bandwidth_config stk7700p_xc4000_pll_config = { - 60000, 30000, // internal, sampling - 1, 8, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass - 0, 0, 1, 1, 0, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo - (3 << 14) | (1 << 12) | (524 << 0), // sad_cfg: refsel, sel, freq_15k - 39370534, // ifreq - 20452225, // timf - 30000000, // xtal + 60000, 30000, /* internal, sampling */ + 1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */ + 0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, */ + /* ADClkSrc, modulo */ + (3 << 14) | (1 << 12) | 524, /* sad_cfg: refsel, sel, freq_15k */ + 39370534, /* ifreq */ + 20452225, /* timf */ + 30000000 /* xtal */ }; /* FIXME: none of these inputs are validated yet */ -- cgit v1.2.3 From 7c8ec47a92107281cd00d5d4c2b7ccfb53143e28 Mon Sep 17 00:00:00 2001 From: "istvan_v@mailbox.hu" Date: Mon, 6 Jun 2011 12:57:43 -0300 Subject: [media] dvb-usb/Kconfig: auto-select XC4000 tuner for dib0700 Automatically select the xc4000 module for dib0700 if the tuner selection is not customized. Signed-off-by: Istvan Varga Cc: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig index e85304c59a2b..5d73dec8ac07 100644 --- a/drivers/media/dvb/dvb-usb/Kconfig +++ b/drivers/media/dvb/dvb-usb/Kconfig @@ -81,6 +81,7 @@ config DVB_USB_DIB0700 select MEDIA_TUNER_MT2266 if !MEDIA_TUNER_CUSTOMISE select MEDIA_TUNER_XC2028 if !MEDIA_TUNER_CUSTOMISE select MEDIA_TUNER_XC5000 if !MEDIA_TUNER_CUSTOMISE + select MEDIA_TUNER_XC4000 if !MEDIA_TUNER_CUSTOMISE select MEDIA_TUNER_MXL5007T if !MEDIA_TUNER_CUSTOMISE help Support for USB2.0/1.1 DVB receivers based on the DiB0700 USB bridge. The -- cgit v1.2.3 From 09f4634293f2d48a9619f51b104bef8e6cc6d559 Mon Sep 17 00:00:00 2001 From: "istvan_v@mailbox.hu" Date: Mon, 6 Jun 2011 13:00:17 -0300 Subject: [media] xc4000: check firmware version Enabled code to check if the version of the firmware reported by the hardware is correct after uploading it. Signed-off-by: Istvan Varga Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index ebc84269b5e6..a053dece60ce 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -919,7 +919,7 @@ static int check_firmware(struct dvb_frontend *fe, unsigned int type, struct xc4000_priv *priv = fe->tuner_priv; struct firmware_properties new_fw; int rc = 0, is_retry = 0; - u16 version = 0, hwmodel; + u16 hwmodel; v4l2_std_id std0; u8 hw_major, hw_minor, fw_major, fw_minor; @@ -1032,23 +1032,23 @@ check_device: hwmodel, hw_major, hw_minor, fw_major, fw_minor); /* Check firmware version against what we downloaded. */ -#ifdef DJH_DEBUG - if (priv->firm_version != ((version & 0xf0) << 4 | (version & 0x0f))) { - printk("Incorrect readback of firmware version %x.\n", - (version & 0xff)); + if (priv->firm_version != ((fw_major << 8) | fw_minor)) { + printk(KERN_WARNING + "Incorrect readback of firmware version %d.%d.\n", + fw_major, fw_minor); goto fail; } -#endif /* Check that the tuner hardware model remains consistent over time. */ if (priv->hwmodel == 0 && (hwmodel == XC_PRODUCT_ID_XC4000 || hwmodel == XC_PRODUCT_ID_XC4100)) { priv->hwmodel = hwmodel; - priv->hwvers = version & 0xff00; + priv->hwvers = (hw_major << 8) | hw_minor; } else if (priv->hwmodel == 0 || priv->hwmodel != hwmodel || - priv->hwvers != (version & 0xff00)) { - printk("Read invalid device hardware information - tuner " + priv->hwvers != ((hw_major << 8) | hw_minor)) { + printk(KERN_WARNING + "Read invalid device hardware information - tuner " "hung?\n"); goto fail; } -- cgit v1.2.3 From 8edeb6eb1ae113b8f25a79e5076c1a1ec93538d0 Mon Sep 17 00:00:00 2001 From: "istvan_v@mailbox.hu" Date: Mon, 6 Jun 2011 13:03:44 -0300 Subject: [media] xc4000: removed card_type Removed the use of 'card_type' from the tuner configuration structure, and replaced it with separate parameters to set board-specific configuration. Signed-off-by: Istvan Varga Cc: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 75 ++++++++++++++--------------- drivers/media/common/tuners/xc4000.h | 14 +++--- drivers/media/dvb/dvb-usb/dib0700_devices.c | 8 +-- drivers/media/video/tuner-core.c | 8 ++- 4 files changed, 55 insertions(+), 50 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index a053dece60ce..479c198e9469 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -92,14 +92,16 @@ struct xc4000_priv { struct list_head hybrid_tuner_instance_list; struct firmware_description *firm; int firm_size; - __u16 firm_version; u32 if_khz; u32 freq_hz; u32 bandwidth; u8 video_standard; u8 rf_mode; - u8 card_type; + u8 default_pm; + u8 dvb_amplitude; + u8 set_smoothedcvbs; u8 ignore_i2c_write_errors; + __u16 firm_version; struct firmware_properties cur_fw; __u16 hwmodel; __u16 hwvers; @@ -1226,19 +1228,22 @@ static int xc4000_set_params(struct dvb_frontend *fe, } } - if (priv->card_type == XC4000_CARD_WINFAST_CX88) { - if (xc_write_reg(priv, XREG_D_CODE, 0) == 0) - ret = 0; + if (xc_write_reg(priv, XREG_D_CODE, 0) == 0) + ret = 0; + if (priv->dvb_amplitude != 0) { if (xc_write_reg(priv, XREG_AMPLITUDE, - (priv->firm_version == 0x0102 ? 132 : 134)) - != 0) + (priv->firm_version != 0x0102 || + priv->dvb_amplitude != 134 ? + priv->dvb_amplitude : 132)) != 0) ret = -EREMOTEIO; + } + if (priv->set_smoothedcvbs != 0) { if (xc_write_reg(priv, XREG_SMOOTHEDCVBS, 1) != 0) ret = -EREMOTEIO; - if (ret != 0) { - printk(KERN_ERR "xc4000: setting registers failed\n"); - /* goto fail; */ - } + } + if (ret != 0) { + printk(KERN_ERR "xc4000: setting registers failed\n"); + /* goto fail; */ } xc_tune_channel(priv, priv->freq_hz); @@ -1412,8 +1417,7 @@ tune_channel: if (type & NOGD) video_mode &= 0xFF7F; } else if (priv->video_standard < XC4000_I_PAL_NICAM) { - if (priv->card_type == XC4000_CARD_WINFAST_CX88 && - priv->firm_version == 0x0102) + if (priv->firm_version == 0x0102) video_mode &= 0xFEFF; if (audio_std & XC4000_AUDIO_STD_B) video_mode |= 0x0080; @@ -1425,17 +1429,17 @@ tune_channel: } } - if (priv->card_type == XC4000_CARD_WINFAST_CX88) { - if (xc_write_reg(priv, XREG_D_CODE, 0) == 0) - ret = 0; - if (xc_write_reg(priv, XREG_AMPLITUDE, 1) != 0) - ret = -EREMOTEIO; + if (xc_write_reg(priv, XREG_D_CODE, 0) == 0) + ret = 0; + if (xc_write_reg(priv, XREG_AMPLITUDE, 1) != 0) + ret = -EREMOTEIO; + if (priv->set_smoothedcvbs != 0) { if (xc_write_reg(priv, XREG_SMOOTHEDCVBS, 1) != 0) ret = -EREMOTEIO; - if (ret != 0) { - printk(KERN_ERR "xc4000: setting registers failed\n"); - goto fail; - } + } + if (ret != 0) { + printk(KERN_ERR "xc4000: setting registers failed\n"); + goto fail; } xc_tune_channel(priv, priv->freq_hz); @@ -1516,8 +1520,7 @@ static int xc4000_sleep(struct dvb_frontend *fe) /* Avoid firmware reload on slow devices */ if ((no_poweroff == 2 || - (no_poweroff == 0 && - priv->card_type != XC4000_CARD_WINFAST_CX88)) && + (no_poweroff == 0 && priv->default_pm != 0)) && (priv->cur_fw.type & BASE) != 0) { /* force reset and firmware reload */ priv->cur_fw.type = XC_POWERED_DOWN; @@ -1588,16 +1591,6 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, int instance; u16 id = 0; - if (cfg->card_type != XC4000_CARD_GENERIC) { - if (cfg->card_type == XC4000_CARD_WINFAST_CX88) { - cfg->i2c_address = 0x61; - cfg->if_khz = 4560; - } else { /* default to PCTV 340E */ - cfg->i2c_address = 0x61; - cfg->if_khz = 5400; - } - } - dprintk(1, "%s(%d-%04x)\n", __func__, i2c ? i2c_adapter_id(i2c) : -1, cfg ? cfg->i2c_address : -1); @@ -1607,8 +1600,6 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, instance = hybrid_tuner_request_state(struct xc4000_priv, priv, hybrid_tuner_instance_list, i2c, cfg->i2c_address, "xc4000"); - if (cfg->card_type != XC4000_CARD_GENERIC) - priv->card_type = cfg->card_type; switch (instance) { case 0: goto fail; @@ -1616,6 +1607,11 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, case 1: /* new tuner instance */ priv->bandwidth = BANDWIDTH_6_MHZ; + /* set default configuration */ + priv->if_khz = 4560; + priv->default_pm = 0; + priv->dvb_amplitude = 134; + priv->set_smoothedcvbs = 1; mutex_init(&priv->lock); fe->tuner_priv = priv; break; @@ -1626,10 +1622,11 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, } if (cfg->if_khz != 0) { - /* If the IF hasn't been set yet, use the value provided by - the caller (occurs in hybrid devices where the analog - call to xc4000_attach occurs before the digital side) */ + /* copy configuration if provided by the caller */ priv->if_khz = cfg->if_khz; + priv->default_pm = cfg->default_pm; + priv->dvb_amplitude = cfg->dvb_amplitude; + priv->set_smoothedcvbs = cfg->set_smoothedcvbs; } /* Check if firmware has been loaded. It is possible that another diff --git a/drivers/media/common/tuners/xc4000.h b/drivers/media/common/tuners/xc4000.h index d560d01cc82b..442cb0fc9338 100644 --- a/drivers/media/common/tuners/xc4000.h +++ b/drivers/media/common/tuners/xc4000.h @@ -27,13 +27,15 @@ struct dvb_frontend; struct i2c_adapter; -#define XC4000_CARD_GENERIC 0 -#define XC4000_CARD_PCTV_340E 1 -#define XC4000_CARD_WINFAST_CX88 2 - struct xc4000_config { - u8 card_type; /* if card type is not generic, all other */ - u8 i2c_address; /* parameters are automatically set */ + u8 i2c_address; + /* if non-zero, power management is enabled by default */ + u8 default_pm; + /* value to be written to XREG_AMPLITUDE in DVB-T mode (0: no write) */ + u8 dvb_amplitude; + /* if non-zero, register 0x0E is set to filter analog TV video output */ + u8 set_smoothedcvbs; + /* IF for DVB-T */ u32 if_khz; }; diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index d546270d3f5d..ae0abc5dcf94 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c @@ -2778,10 +2778,12 @@ static int pctv340e_frontend_attach(struct dvb_usb_adapter *adap) return adap->fe == NULL ? -ENODEV : 0; } - static struct xc4000_config dib7000p_xc4000_tunerconfig = { - .i2c_address = 0x61, - .if_khz = 5400, + .i2c_address = 0x61, + .default_pm = 1, + .dvb_amplitude = 0, + .set_smoothedcvbs = 0, + .if_khz = 5400 }; static int xc4000_tuner_attach(struct dvb_usb_adapter *adap) diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 850b45d042ff..11cc980b0cd5 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -396,8 +396,12 @@ static void set_type(struct i2c_client *c, unsigned int type, { struct xc4000_config xc4000_cfg = { .i2c_address = t->i2c->addr, - /* if_khz will be set when the digital dvb_attach() occurs */ - .if_khz = 0, + /* FIXME: the correct parameters will be set */ + /* only when the digital dvb_attach() occurs */ + .default_pm = 0, + .dvb_amplitude = 0, + .set_smoothedcvbs = 0, + .if_khz = 0 }; if (!dvb_attach(xc4000_attach, &t->fe, t->i2c->adapter, &xc4000_cfg)) -- cgit v1.2.3 From 941830c9278a72e31389eb04cdfc397f66866de0 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 6 Jun 2011 16:51:11 -0300 Subject: [media] xc4000: make checkpatch.pl happy Solve the ./scripts/checkpatch.pl compliants for the patches that added xc4000 support, including a few changes at dib0700. While here, remove a few printk noise by converting some msgs into debug ones. Cc: Istvan Varga Cc: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/xc4000.c | 139 ++++++++++++++-------------- drivers/media/common/tuners/xc4000.h | 3 +- drivers/media/dvb/dvb-usb/dib0700_devices.c | 2 +- 3 files changed, 71 insertions(+), 73 deletions(-) diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 479c198e9469..634f4d9b6c63 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -244,8 +244,8 @@ static struct XC_TV_STANDARD xc4000_standard[MAX_TV_STANDARD] = { {"DTV8", 0x00C0, 0x800B, 0}, {"DTV7/8", 0x00C0, 0x801B, 0}, {"DTV7", 0x00C0, 0x8007, 0}, - {"FM Radio-INPUT2", 0x0008, 0x9800,10700}, - {"FM Radio-INPUT1", 0x0008, 0x9000,10700} + {"FM Radio-INPUT2", 0x0008, 0x9800, 10700}, + {"FM Radio-INPUT1", 0x0008, 0x9000, 10700} }; static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val); @@ -261,7 +261,7 @@ static int xc_send_i2c_data(struct xc4000_priv *priv, u8 *buf, int len) printk(KERN_ERR "xc4000: I2C write failed (len=%i)\n", len); if (len == 4) { - printk("bytes %02x %02x %02x %02x\n", buf[0], + printk(KERN_ERR "bytes %02x %02x %02x %02x\n", buf[0], buf[1], buf[2], buf[3]); } return -EREMOTEIO; @@ -546,7 +546,7 @@ static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val) }; if (i2c_transfer(priv->i2c_props.adap, msg, 2) != 2) { - printk(KERN_WARNING "xc4000: I2C read failed\n"); + printk(KERN_ERR "xc4000: I2C read failed\n"); return -EREMOTEIO; } @@ -558,67 +558,67 @@ static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val) static void dump_firm_type_and_int_freq(unsigned int type, u16 int_freq) { if (type & BASE) - printk("BASE "); + printk(KERN_CONT "BASE "); if (type & INIT1) - printk("INIT1 "); + printk(KERN_CONT "INIT1 "); if (type & F8MHZ) - printk("F8MHZ "); + printk(KERN_CONT "F8MHZ "); if (type & MTS) - printk("MTS "); + printk(KERN_CONT "MTS "); if (type & D2620) - printk("D2620 "); + printk(KERN_CONT "D2620 "); if (type & D2633) - printk("D2633 "); + printk(KERN_CONT "D2633 "); if (type & DTV6) - printk("DTV6 "); + printk(KERN_CONT "DTV6 "); if (type & QAM) - printk("QAM "); + printk(KERN_CONT "QAM "); if (type & DTV7) - printk("DTV7 "); + printk(KERN_CONT "DTV7 "); if (type & DTV78) - printk("DTV78 "); + printk(KERN_CONT "DTV78 "); if (type & DTV8) - printk("DTV8 "); + printk(KERN_CONT "DTV8 "); if (type & FM) - printk("FM "); + printk(KERN_CONT "FM "); if (type & INPUT1) - printk("INPUT1 "); + printk(KERN_CONT "INPUT1 "); if (type & LCD) - printk("LCD "); + printk(KERN_CONT "LCD "); if (type & NOGD) - printk("NOGD "); + printk(KERN_CONT "NOGD "); if (type & MONO) - printk("MONO "); + printk(KERN_CONT "MONO "); if (type & ATSC) - printk("ATSC "); + printk(KERN_CONT "ATSC "); if (type & IF) - printk("IF "); + printk(KERN_CONT "IF "); if (type & LG60) - printk("LG60 "); + printk(KERN_CONT "LG60 "); if (type & ATI638) - printk("ATI638 "); + printk(KERN_CONT "ATI638 "); if (type & OREN538) - printk("OREN538 "); + printk(KERN_CONT "OREN538 "); if (type & OREN36) - printk("OREN36 "); + printk(KERN_CONT "OREN36 "); if (type & TOYOTA388) - printk("TOYOTA388 "); + printk(KERN_CONT "TOYOTA388 "); if (type & TOYOTA794) - printk("TOYOTA794 "); + printk(KERN_CONT "TOYOTA794 "); if (type & DIBCOM52) - printk("DIBCOM52 "); + printk(KERN_CONT "DIBCOM52 "); if (type & ZARLINK456) - printk("ZARLINK456 "); + printk(KERN_CONT "ZARLINK456 "); if (type & CHINA) - printk("CHINA "); + printk(KERN_CONT "CHINA "); if (type & F6MHZ) - printk("F6MHZ "); + printk(KERN_CONT "F6MHZ "); if (type & INPUT2) - printk("INPUT2 "); + printk(KERN_CONT "INPUT2 "); if (type & SCODE) - printk("SCODE "); + printk(KERN_CONT "SCODE "); if (type & HAS_IF) - printk("HAS_IF_%d ", int_freq); + printk(KERN_CONT "HAS_IF_%d ", int_freq); } static int seek_firmware(struct dvb_frontend *fe, unsigned int type, @@ -666,7 +666,8 @@ static int seek_firmware(struct dvb_frontend *fe, unsigned int type, } if (best_nr_diffs > 0U) { - printk("Selecting best matching firmware (%u bits differ) for " + printk(KERN_WARNING + "Selecting best matching firmware (%u bits differ) for " "type=(%x), id %016llx:\n", best_nr_diffs, type, (unsigned long long)*id); i = best_i; @@ -677,10 +678,10 @@ found: ret: if (debug) { - printk("%s firmware for type=", + printk(KERN_DEBUG "%s firmware for type=", (i < 0) ? "Can't find" : "Found"); dump_firm_type(type); - printk("(%x), id %016llx.\n", type, (unsigned long long)*id); + printk(KERN_DEBUG "(%x), id %016llx.\n", type, (unsigned long long)*id); } return i; } @@ -723,13 +724,13 @@ static int xc4000_fwupload(struct dvb_frontend *fe) else fname = XC4000_DEFAULT_FIRMWARE; - printk("Reading firmware %s\n", fname); + dprintk(1, "Reading firmware %s\n", fname); rc = request_firmware(&fw, fname, priv->i2c_props.adap->dev.parent); if (rc < 0) { if (rc == -ENOENT) - printk("Error: firmware %s not found.\n", fname); + printk(KERN_ERR "Error: firmware %s not found.\n", fname); else - printk("Error %d while requesting firmware %s \n", + printk(KERN_ERR "Error %d while requesting firmware %s\n", rc, fname); return rc; @@ -738,7 +739,8 @@ static int xc4000_fwupload(struct dvb_frontend *fe) endp = p + fw->size; if (fw->size < sizeof(name) - 1 + 2 + 2) { - printk("Error: firmware file %s has invalid size!\n", fname); + printk(KERN_ERR "Error: firmware file %s has invalid size!\n", + fname); goto corrupt; } @@ -758,9 +760,9 @@ static int xc4000_fwupload(struct dvb_frontend *fe) priv->firm = kzalloc(sizeof(*priv->firm) * n_array, GFP_KERNEL); if (priv->firm == NULL) { - printk("Not enough memory to load firmware file.\n"); + printk(KERN_ERR "Not enough memory to load firmware file.\n"); rc = -ENOMEM; - goto err; + goto done; } priv->firm_size = n_array; @@ -772,7 +774,7 @@ static int xc4000_fwupload(struct dvb_frontend *fe) n++; if (n >= n_array) { - printk("More firmware images in file than " + printk(KERN_ERR "More firmware images in file than " "were expected!\n"); goto corrupt; } @@ -798,8 +800,7 @@ static int xc4000_fwupload(struct dvb_frontend *fe) p += sizeof(size); if (!size || size > endp - p) { - printk("Firmware type (%x), id %llx is corrupted " - "(size=%d, expected %d)\n", + printk(KERN_ERR "Firmware type (%x), id %llx is corrupted (size=%d, expected %d)\n", type, (unsigned long long)id, (unsigned)(endp - p), size); goto corrupt; @@ -807,15 +808,15 @@ static int xc4000_fwupload(struct dvb_frontend *fe) priv->firm[n].ptr = kzalloc(size, GFP_KERNEL); if (priv->firm[n].ptr == NULL) { - printk("Not enough memory to load firmware file.\n"); + printk(KERN_ERR "Not enough memory to load firmware file.\n"); rc = -ENOMEM; - goto err; + goto done; } if (debug) { - printk("Reading firmware type "); + printk(KERN_DEBUG "Reading firmware type "); dump_firm_type_and_int_freq(type, int_freq); - printk("(%x), id %llx, size=%d.\n", + printk(KERN_DEBUG "(%x), id %llx, size=%d.\n", type, (unsigned long long)id, size); } @@ -829,20 +830,17 @@ static int xc4000_fwupload(struct dvb_frontend *fe) } if (n + 1 != priv->firm_size) { - printk("Firmware file is incomplete!\n"); + printk(KERN_ERR "Firmware file is incomplete!\n"); goto corrupt; } goto done; header: - printk("Firmware header is incomplete!\n"); + printk(KERN_ERR "Firmware header is incomplete!\n"); corrupt: rc = -EINVAL; - printk("Error: firmware file is corrupted!\n"); - -err: - printk("Releasing partially loaded firmware file.\n"); + printk(KERN_ERR "Error: firmware file is corrupted!\n"); done: release_firmware(fw); @@ -883,11 +881,13 @@ static int load_scode(struct dvb_frontend *fe, unsigned int type, return -EINVAL; p += 12 * scode; - tuner_info("Loading SCODE for type="); - dump_firm_type_and_int_freq(priv->firm[pos].type, - priv->firm[pos].int_freq); - printk("(%x), id %016llx.\n", priv->firm[pos].type, - (unsigned long long)*id); + if (debug) { + tuner_info("Loading SCODE for type="); + dump_firm_type_and_int_freq(priv->firm[pos].type, + priv->firm[pos].int_freq); + printk(KERN_CONT "(%x), id %016llx.\n", priv->firm[pos].type, + (unsigned long long)*id); + } scode_buf[0] = 0x00; memcpy(&scode_buf[1], p, 12); @@ -895,7 +895,7 @@ static int load_scode(struct dvb_frontend *fe, unsigned int type, /* Enter direct-mode */ rc = xc_write_reg(priv, XREG_DIRECTSITTING_MODE, 0); if (rc < 0) { - printk("failed to put device into direct mode!\n"); + printk(KERN_ERR "failed to put device into direct mode!\n"); return -EIO; } @@ -903,7 +903,7 @@ static int load_scode(struct dvb_frontend *fe, unsigned int type, if (rc != 0) { /* Even if the send failed, make sure we set back to indirect mode */ - printk("Failed to set scode %d\n", rc); + printk(KERN_ERR "Failed to set scode %d\n", rc); } /* Switch back to indirect-mode */ @@ -944,7 +944,7 @@ retry: dprintk(1, "checking firmware, user requested type="); if (debug) { dump_firm_type(new_fw.type); - printk("(%x), id %016llx, ", new_fw.type, + printk(KERN_CONT "(%x), id %016llx, ", new_fw.type, (unsigned long long)new_fw.std_req); if (!int_freq) printk(KERN_CONT "scode_tbl "); @@ -971,7 +971,7 @@ retry: std0 = 0; rc = load_firmware(fe, BASE, &std0); if (rc < 0) { - printk("Error %d while loading base firmware\n", rc); + printk(KERN_ERR "Error %d while loading base firmware\n", rc); goto fail; } @@ -1025,7 +1025,7 @@ check_device: if (xc_get_version(priv, &hw_major, &hw_minor, &fw_major, &fw_minor) != 0) { - printk("Unable to read tuner registers.\n"); + printk(KERN_ERR "Unable to read tuner registers.\n"); goto fail; } @@ -1340,11 +1340,10 @@ static int xc4000_set_analog_params(struct dvb_frontend *fe, if (params->std & V4L2_STD_PAL_I) { /* default to NICAM audio standard */ params->std = V4L2_STD_PAL_I | V4L2_STD_NICAM; - if (audio_std & XC4000_AUDIO_STD_MONO) { + if (audio_std & XC4000_AUDIO_STD_MONO) priv->video_standard = XC4000_I_PAL_NICAM_MONO; - } else { + else priv->video_standard = XC4000_I_PAL_NICAM; - } goto tune_channel; } diff --git a/drivers/media/common/tuners/xc4000.h b/drivers/media/common/tuners/xc4000.h index 442cb0fc9338..e6a44d151cbd 100644 --- a/drivers/media/common/tuners/xc4000.h +++ b/drivers/media/common/tuners/xc4000.h @@ -50,8 +50,7 @@ struct xc4000_config { * it's passed back to a bridge during tuner_callback(). */ -#if defined(CONFIG_MEDIA_TUNER_XC4000) || \ - (defined(CONFIG_MEDIA_TUNER_XC4000_MODULE) && defined(MODULE)) +#if defined(CONFIG_MEDIA_TUNER_XC4000) || (defined(CONFIG_MEDIA_TUNER_XC4000_MODULE) && defined(MODULE)) extern struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct xc4000_config *cfg); diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index ae0abc5dcf94..d0ea5b64f6b4 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c @@ -2794,7 +2794,7 @@ static int xc4000_tuner_attach(struct dvb_usb_adapter *adap) tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1); if (tun_i2c == NULL) { - printk("Could not reach tuner i2c bus\n"); + printk(KERN_ERR "Could not reach tuner i2c bus\n"); return 0; } -- cgit v1.2.3 From 157e03f2d30d78bde0b6778560430e425d4ff7e9 Mon Sep 17 00:00:00 2001 From: Jean-François Moine Date: Fri, 3 Jun 2011 03:33:41 -0300 Subject: [media] v4l: Documentation about the JPGL pixel format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The JPG-Light, AKA Pegasus Lossless JPEG, is used in Divio webcams based on NW 800/801/802 chips. Signed-off-by: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/v4l/pixfmt.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/DocBook/media/v4l/pixfmt.xml b/Documentation/DocBook/media/v4l/pixfmt.xml index deb660207f94..88e5c212140e 100644 --- a/Documentation/DocBook/media/v4l/pixfmt.xml +++ b/Documentation/DocBook/media/v4l/pixfmt.xml @@ -804,6 +804,12 @@ kernel sources in the file Documentation/video4linux/cx2341x/README.hm 'CPIA' YUV format used by the gspca cpia1 driver. + + V4L2_PIX_FMT_JPGL + 'JPGL' + JPEG-Light format (Pegasus Lossless JPEG) + used in Divio webcams NW 80x. + V4L2_PIX_FMT_SPCA501 'S501' -- cgit v1.2.3 From 98a2b60d89ca48c22b77c09306156ccc3c11e939 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 7 Jun 2011 14:51:56 -0300 Subject: [media] DocBook/Makefile: add references for several dvb structures With this change, it is now possible to discover the gap between the API defined inside include/dvb/frontend.h and the one documented into the specs. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/Makefile | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile index baeea174fdc6..d9a21d3ea93a 100644 --- a/Documentation/DocBook/media/Makefile +++ b/Documentation/DocBook/media/Makefile @@ -51,6 +51,7 @@ FUNCS = \ IOCTLS = \ $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/videodev2.h) \ + $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/frontend.h) \ $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/media.h) \ $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/v4l2-subdev.h) \ VIDIOC_SUBDEV_G_FRAME_INTERVAL \ @@ -60,16 +61,19 @@ IOCTLS = \ VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL \ TYPES = \ - $(shell perl -ne 'print "$$1 " if /^typedef\s+[^\s]+\s+([^\s]+)\;/' $(srctree)/include/linux/videodev2.h) + $(shell perl -ne 'print "$$1 " if /^typedef\s+[^\s]+\s+([^\s]+)\;/' $(srctree)/include/linux/videodev2.h) \ + $(shell perl -ne 'print "$$1 " if /^}\s+([a-z0-9_]+_t)/' $(srctree)/include/linux/dvb/frontend.h) ENUMS = \ $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/videodev2.h) \ + $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/frontend.h) \ $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/media.h) \ $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-mediabus.h) \ $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-subdev.h) STRUCTS = \ $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/videodev2.h) \ + $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/frontend.h) \ $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/media.h) \ $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-subdev.h) \ $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-mediabus.h) @@ -116,9 +120,11 @@ DOCUMENTED = \ -e "s/v4l2\-mpeg\-vbi\-ITV0/v4l2-mpeg-vbi-itv0-1/g" DVB_DOCUMENTED = \ - -e "s,\(define \)\([A-Z0-9_]\+\)\(\s\+_IO\),\1\\2\<\/link\>\3,g" \ - -e "s/\(linkend\=\"\)FE_SET_PROPERTY/\1FE_GET_PROPERTY/g" - + -e "s,\(define\s\+\)\([A-Z0-9_]\+\)\(\s\+_IO\),\1\\2\<\/link\>\3,g" \ + -e "s/\(linkend\=\"\)FE_SET_PROPERTY/\1FE_GET_PROPERTY/g" \ + -e "s,\(struct\s\+\)\([a-z0-9_]\+\)\(\s\+{\),\1\\2\<\/link\>\3,g" \ + -e "s,\(}\s\+\)\([a-z0-9_]\+_t\+\),\1\\2\<\/link\>,g" \ +# -e "s,\(\s\+\)\(FE_[A-Z0-9_]\+\)\([\s\=\,]*\),\1\\2\<\/link\>\3,g" \ # # Media targets and dependencies -- cgit v1.2.3 From d5dc2dee5030564ef3228d3a2647d4c25c84fedf Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 7 Jun 2011 16:17:00 -0300 Subject: [media] DocBook/frontend.xml: Better document fe_type_t The fe_type_t documentation was incomplete and not linked to the dvb/frontend.h.xml. Properly document it. Also, drop a note that newer formats are only supported via FE_GET_PROPERTY/FE_GET_SET_PROPERTY ioctls. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/Makefile | 1 + Documentation/DocBook/media/dvb/frontend.xml | 47 +++++++++++++++++++++------- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile index d9a21d3ea93a..34afc545ddeb 100644 --- a/Documentation/DocBook/media/Makefile +++ b/Documentation/DocBook/media/Makefile @@ -124,6 +124,7 @@ DVB_DOCUMENTED = \ -e "s/\(linkend\=\"\)FE_SET_PROPERTY/\1FE_GET_PROPERTY/g" \ -e "s,\(struct\s\+\)\([a-z0-9_]\+\)\(\s\+{\),\1\\2\<\/link\>\3,g" \ -e "s,\(}\s\+\)\([a-z0-9_]\+_t\+\),\1\\2\<\/link\>,g" \ + -e ":a;s/\(linkend=\".*\)_\(.*\">\)/\1-\2/;ta" \ # -e "s,\(\s\+\)\(FE_[A-Z0-9_]\+\)\([\s\=\,]*\),\1\\2\<\/link\>\3,g" \ # diff --git a/Documentation/DocBook/media/dvb/frontend.xml b/Documentation/DocBook/media/dvb/frontend.xml index 60c6976fb311..b52f66abbbd4 100644 --- a/Documentation/DocBook/media/dvb/frontend.xml +++ b/Documentation/DocBook/media/dvb/frontend.xml @@ -20,19 +20,44 @@ cards, in which case there exists no frontend device.
Frontend Data Types -
-frontend type +
+Frontend type For historical reasons frontend types are named after the type of modulation used in -transmission. - - typedef enum fe_type { - FE_QPSK, /⋆ DVB-S ⋆/ - FE_QAM, /⋆ DVB-C ⋆/ - FE_OFDM /⋆ DVB-T ⋆/ - } fe_type_t; - - +transmission. The fontend types are given by fe_type_t type, defined as: + + +Frontend types + + &cs-def; + + + fe_type + Description + + + + + FE_QPSK + For DVB-S standard + + + FE_QAM + For DVB-C standard + + + FE_OFDM + For DVB-T standard. Also used for ISDB-T on compatibility mode + + + FE_ATSC + For ATSC standard (terrestrial or cable) + +
+ +Newer formats like DVB-S2, ISDB-T, ISDB-S and DVB-T2 are not described at the above, as they're +supported via the new FE_GET_PROPERTY/FE_GET_SET_PROPERTY method. +
-- cgit v1.2.3 From 95e61e01888d207b2ffd1ef709466c5144534121 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 7 Jun 2011 16:58:00 -0300 Subject: [media] DocBook/frontend.xml: Link DVB S2API parameters Associate the frontend.h DVB S2API parmeters to the corresponding documentation at the spec. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/Makefile | 2 ++ Documentation/DocBook/media/dvb/dvbproperty.xml | 34 ++++++++++++------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile index 34afc545ddeb..30360709ace8 100644 --- a/Documentation/DocBook/media/Makefile +++ b/Documentation/DocBook/media/Makefile @@ -124,7 +124,9 @@ DVB_DOCUMENTED = \ -e "s/\(linkend\=\"\)FE_SET_PROPERTY/\1FE_GET_PROPERTY/g" \ -e "s,\(struct\s\+\)\([a-z0-9_]\+\)\(\s\+{\),\1\\2\<\/link\>\3,g" \ -e "s,\(}\s\+\)\([a-z0-9_]\+_t\+\),\1\\2\<\/link\>,g" \ + -e "s,\(define\s\+\)\(DTV_[A-Z0-9_]\+\)\(\s\+[0-9]\+\),\1\\2\<\/link\>\3,g" \ -e ":a;s/\(linkend=\".*\)_\(.*\">\)/\1-\2/;ta" \ + -e "s,DTV-ISDBT-LAYER[A-C],DTV-ISDBT-LAYER,g" \ # -e "s,\(\s\+\)\(FE_[A-Z0-9_]\+\)\([\s\=\,]*\),\1\\2\<\/link\>\3,g" \ # diff --git a/Documentation/DocBook/media/dvb/dvbproperty.xml b/Documentation/DocBook/media/dvb/dvbproperty.xml index b5365f61d69b..3a1ecb2ba632 100644 --- a/Documentation/DocBook/media/dvb/dvbproperty.xml +++ b/Documentation/DocBook/media/dvb/dvbproperty.xml @@ -199,7 +199,7 @@ get/set up to 64 properties. The actual meaning of each property is described on
Parameters that are common to all Digital TV standards -
+
<constant>DTV_FREQUENCY</constant> Central frequency of the channel, in HZ. @@ -214,7 +214,7 @@ get/set up to 64 properties. The actual meaning of each property is described on central frequency of the channel is expected.
-
+
<constant>DTV_BANDWIDTH_HZ</constant> Bandwidth for the channel, in HZ. @@ -241,7 +241,7 @@ get/set up to 64 properties. The actual meaning of each property is described on 6) In addition, DVB-T2 supports 1.172, 5 and 10MHz.
-
+
<constant>DTV_DELIVERY_SYSTEM</constant> Specifies the type of Delivery system @@ -271,7 +271,7 @@ typedef enum fe_delivery_system {
-
+
<constant>DTV_TRANSMISSION_MODE</constant> Specifies the number of carriers used by the standard @@ -300,7 +300,7 @@ typedef enum fe_transmit_mode { 4) DVB-T2 specifies 1K, 2K, 4K, 8K, 16K and 32K.
-
+
<constant>DTV_GUARD_INTERVAL</constant> Possible values are: @@ -359,10 +359,10 @@ typedef enum fe_guard_interval {
ISDB-T only parameters -
+
<constant>DTV_ISDBT_PARTIAL_RECEPTION</constant> - If DTV_ISDBT_SOUND_BROADCASTING is '0' this bit-field represents whether + If DTV_ISDBT_SOUND_BROADCASTING is '0' this bit-field represents whether the channel is in partial reception mode or not. If '1' DTV_ISDBT_LAYERA_* values are assigned to the center segment and @@ -375,7 +375,7 @@ typedef enum fe_guard_interval { Possible values: 0, 1, -1 (AUTO)
-
+
<constant>DTV_ISDBT_SOUND_BROADCASTING</constant> This field represents whether the other DTV_ISDBT_*-parameters are @@ -385,7 +385,7 @@ typedef enum fe_guard_interval { Possible values: 0, 1, -1 (AUTO)
-
+
<constant>DTV_ISDBT_SB_SUBCHANNEL_ID</constant> This field only applies if DTV_ISDBT_SOUND_BROADCASTING is '1'. @@ -418,7 +418,7 @@ typedef enum fe_guard_interval { Possible values: 0 .. 41, -1 (AUTO)
-
+
<constant>DTV_ISDBT_SB_SEGMENT_IDX</constant> @@ -433,7 +433,7 @@ typedef enum fe_guard_interval { Note: This value cannot be determined by an automatic channel search.
-
+
<constant>DTV_ISDBT_SB_SEGMENT_COUNT</constant> This field only applies if DTV_ISDBT_SOUND_BROADCASTING is '1'. @@ -457,7 +457,7 @@ typedef enum fe_guard_interval { available segments. The total number of segments over all layers has to 13 in ISDB-T. -
+
<constant>DTV_ISDBT_LAYER_ENABLED</constant> Hierarchical reception in ISDB-T is achieved by enabling or disabling @@ -482,13 +482,13 @@ typedef enum fe_guard_interval { DTV_ISDBT_LAYER_ENABLED[31:3] unused
-
+
<constant>DTV_ISDBT_LAYER*_FEC</constant> Possible values: FEC_AUTO, FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_7_8
-
+
<constant>DTV_ISDBT_LAYER*_MODULATION</constant> Possible values: QAM_AUTO, QPSK, QAM_16, QAM_64, DQPSK @@ -497,7 +497,7 @@ typedef enum fe_guard_interval { and DTV_ISDBT_PARTIAL_RECEPTION=0 layer has to be DQPSK.
-
+
<constant>DTV_ISDBT_LAYER*_SEGMENT_COUNT</constant> Possible values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, -1 (AUTO) @@ -560,7 +560,7 @@ typedef enum fe_guard_interval {
-
+
<constant>DTV_ISDBT_LAYER*_TIME_INTERLEAVING</constant> Possible values: 0, 1, 2, 3, -1 (AUTO) @@ -578,7 +578,7 @@ typedef enum fe_guard_interval { support is currently in the early stages development so expect this section to grow and become more detailed with time. -
+
<constant>DTV_DVBT2_PLP_ID</constant> DVB-T2 supports Physical Layer Pipes (PLP) to allow transmission of -- cgit v1.2.3 From 0969ec18346c174a20e9d7e73231efab95c23f86 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 7 Jun 2011 17:02:37 -0300 Subject: [media] DocBook/frontend.xml: Correlate dvb delivery systems As the DVB API provides two ways to specify the delivery systems, correlate both ways into a table. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/dvb/frontend.xml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Documentation/DocBook/media/dvb/frontend.xml b/Documentation/DocBook/media/dvb/frontend.xml index b52f66abbbd4..65a790e196bc 100644 --- a/Documentation/DocBook/media/dvb/frontend.xml +++ b/Documentation/DocBook/media/dvb/frontend.xml @@ -23,40 +23,45 @@ cards, in which case there exists no frontend device.
Frontend type -For historical reasons frontend types are named after the type of modulation used in +For historical reasons, frontend types are named by the type of modulation used in transmission. The fontend types are given by fe_type_t type, defined as: Frontend types - + &cs-def; fe_type Description + DTV_DELIVERY_SYSTEM equivalent type FE_QPSK For DVB-S standard + SYS_DVBS FE_QAM - For DVB-C standard + For DVB-C annex A/C standard + SYS_DVBC_ANNEX_AC FE_OFDM - For DVB-T standard. Also used for ISDB-T on compatibility mode + For DVB-T standard + SYS_DVBT FE_ATSC - For ATSC standard (terrestrial or cable) + For ATSC standard (terrestrial) or for DVB-C Annex B (cable) used in US. + SYS_ATSC (terrestrial) or SYS_DVBC_ANNEX_B (cable)
Newer formats like DVB-S2, ISDB-T, ISDB-S and DVB-T2 are not described at the above, as they're -supported via the new FE_GET_PROPERTY/FE_GET_SET_PROPERTY method. +supported via the new FE_GET_PROPERTY/FE_GET_SET_PROPERTY ioctl's, using the DTV_DELIVERY_SYSTEM parameter.
-- cgit v1.2.3 From 6cb77a85aaf317e0b6e513f70eca6ebe34f9cdf0 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 7 Jun 2011 17:58:59 -0300 Subject: [media] DocBook/frontend.xml: add references for some missing info The frontend.h.xml now references to the main document. However, several references are missed. Links the trivial ones with the corresponding API descriptions. While here, updates the main API to reflect the API improvements. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/Makefile | 2 +- Documentation/DocBook/media/dvb/frontend.xml | 204 +++++++++++++++++---------- 2 files changed, 131 insertions(+), 75 deletions(-) diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile index 30360709ace8..f2216b05b2d5 100644 --- a/Documentation/DocBook/media/Makefile +++ b/Documentation/DocBook/media/Makefile @@ -120,13 +120,13 @@ DOCUMENTED = \ -e "s/v4l2\-mpeg\-vbi\-ITV0/v4l2-mpeg-vbi-itv0-1/g" DVB_DOCUMENTED = \ - -e "s,\(define\s\+\)\([A-Z0-9_]\+\)\(\s\+_IO\),\1\\2\<\/link\>\3,g" \ -e "s/\(linkend\=\"\)FE_SET_PROPERTY/\1FE_GET_PROPERTY/g" \ -e "s,\(struct\s\+\)\([a-z0-9_]\+\)\(\s\+{\),\1\\2\<\/link\>\3,g" \ -e "s,\(}\s\+\)\([a-z0-9_]\+_t\+\),\1\\2\<\/link\>,g" \ -e "s,\(define\s\+\)\(DTV_[A-Z0-9_]\+\)\(\s\+[0-9]\+\),\1\\2\<\/link\>\3,g" \ -e ":a;s/\(linkend=\".*\)_\(.*\">\)/\1-\2/;ta" \ -e "s,DTV-ISDBT-LAYER[A-C],DTV-ISDBT-LAYER,g" \ + -e "s,\(define\s\+\)\([A-Z0-9_]\+\)\(\s\+_IO\),\1\\2\<\/link\>\3,g" \ # -e "s,\(\s\+\)\(FE_[A-Z0-9_]\+\)\([\s\=\,]*\),\1\\2\<\/link\>\3,g" \ # diff --git a/Documentation/DocBook/media/dvb/frontend.xml b/Documentation/DocBook/media/dvb/frontend.xml index 65a790e196bc..a925b4507cef 100644 --- a/Documentation/DocBook/media/dvb/frontend.xml +++ b/Documentation/DocBook/media/dvb/frontend.xml @@ -65,7 +65,7 @@ supported via the new FE_GET_PROPERTY/FE_GET
-
+
frontend capabilities Capabilities describe what a frontend can do. Some capabilities can only be supported for @@ -106,7 +106,7 @@ a specific frontend type.
-
+
frontend information Information about the frontend ca be queried with @@ -129,7 +129,7 @@ a specific frontend type.
-
+
diseqc master command A message sent from the frontend to DiSEqC capable equipment. @@ -153,7 +153,7 @@ a specific frontend type.
-
+
diseqc slave reply The voltage is usually used with non-DiSEqC capable LNBs to switch the polarzation (horizontal/vertical). When using DiSEqC epuipment this voltage has to be switched @@ -166,7 +166,7 @@ consistently to the DiSEqC commands as described in the DiSEqC spec.
-
+
SEC continuous tone The continuous 22KHz tone is usually used with non-DiSEqC capable LNBs to switch the @@ -181,7 +181,7 @@ spec.
-
+
SEC tone burst The 22KHz tone burst is usually used with non-DiSEqC capable switches to select @@ -198,7 +198,7 @@ spec.
-
+
frontend status Several functions of the frontend device use the fe_status data type defined by @@ -218,31 +218,42 @@ by
-
+
frontend parameters The kind of parameters passed to the frontend device for tuning depend on the kind of hardware you are using. All kinds of parameters are combined as an union in the FrontendParameters structure: - struct dvb_frontend_parameters { - uint32_t frequency; /⋆ (absolute) frequency in Hz for QAM/OFDM ⋆/ - /⋆ intermediate frequency in kHz for QPSK ⋆/ - fe_spectral_inversion_t inversion; - union { - struct dvb_qpsk_parameters qpsk; - struct dvb_qam_parameters qam; - struct dvb_ofdm_parameters ofdm; - } u; - }; +struct dvb_frontend_parameters { + uint32_t frequency; /⋆ (absolute) frequency in Hz for QAM/OFDM ⋆/ + /⋆ intermediate frequency in kHz for QPSK ⋆/ + fe_spectral_inversion_t inversion; + union { + struct dvb_qpsk_parameters qpsk; + struct dvb_qam_parameters qam; + struct dvb_ofdm_parameters ofdm; + struct dvb_vsb_parameters vsb; + } u; +}; -For satellite QPSK frontends you have to use the QPSKParameters member defined by +In the case of QPSK frontends the frequency field specifies the intermediate +frequency, i.e. the offset which is effectively added to the local oscillator frequency (LOF) of +the LNB. The intermediate frequency has to be specified in units of kHz. For QAM and +OFDM frontends the frequency specifies the absolute frequency and is given in Hz. + +
+QPSK parameters +For satellite QPSK frontends you have to use the dvb_qpsk_parameters structure: struct dvb_qpsk_parameters { uint32_t symbol_rate; /⋆ symbol rate in Symbols per second ⋆/ fe_code_rate_t fec_inner; /⋆ forward error correction (see above) ⋆/ }; -for cable QAM frontend you use the QAMParameters structure +
+
+QAM parameters +for cable QAM frontend you use the dvb_qam_parameters structure: struct dvb_qam_parameters { uint32_t symbol_rate; /⋆ symbol rate in Symbols per second ⋆/ @@ -250,8 +261,10 @@ union in the FrontendParameters structure: fe_modulation_t modulation; /⋆ modulation type (see above) ⋆/ }; -DVB-T frontends are supported by the OFDMParamters structure - +
+
+OFDM parameters +DVB-T frontends are supported by the dvb_ofdm_parameters structure: struct dvb_ofdm_parameters { fe_bandwidth_t bandwidth; @@ -263,86 +276,128 @@ union in the FrontendParameters structure: fe_hierarchy_t hierarchy_information; }; -In the case of QPSK frontends the Frequency field specifies the intermediate -frequency, i.e. the offset which is effectively added to the local oscillator frequency (LOF) of -the LNB. The intermediate frequency has to be specified in units of kHz. For QAM and -OFDM frontends the Frequency specifies the absolute frequency and is given in -Hz. - +
+
+VSB parameters +DVB-T frontends are supported by the dvb_vsb_parameters structure: + +struct dvb_vsb_parameters { + fe_modulation_t modulation; /⋆ modulation type (see above) ⋆/ +}; + +
+
+frontend spectral inversion The Inversion field can take one of these values: - typedef enum fe_spectral_inversion { - INVERSION_OFF, - INVERSION_ON, - INVERSION_AUTO - } fe_spectral_inversion_t; +typedef enum fe_spectral_inversion { + INVERSION_OFF, + INVERSION_ON, + INVERSION_AUTO +} fe_spectral_inversion_t; It indicates if spectral inversion should be presumed or not. In the automatic setting (INVERSION_AUTO) the hardware will try to figure out the correct setting by itself. +
+
+frontend code rate The possible values for the FEC_inner field are - typedef enum fe_code_rate { - FEC_NONE = 0, - FEC_1_2, - FEC_2_3, - FEC_3_4, - FEC_4_5, - FEC_5_6, - FEC_6_7, - FEC_7_8, - FEC_8_9, - FEC_AUTO - } fe_code_rate_t; +typedef enum fe_code_rate { + FEC_NONE = 0, + FEC_1_2, + FEC_2_3, + FEC_3_4, + FEC_4_5, + FEC_5_6, + FEC_6_7, + FEC_7_8, + FEC_8_9, + FEC_AUTO, + FEC_3_5, + FEC_9_10, +} fe_code_rate_t; which correspond to error correction rates of 1/2, 2/3, etc., no error correction or auto detection. +
+
+frontend modulation type for QAM and OFDM For cable and terrestrial frontends (QAM and OFDM) one also has to specify the quadrature modulation mode which can be one of the following: typedef enum fe_modulation { - QPSK, - QAM_16, - QAM_32, - QAM_64, - QAM_128, - QAM_256, - QAM_AUTO + QPSK, + QAM_16, + QAM_32, + QAM_64, + QAM_128, + QAM_256, + QAM_AUTO, + VSB_8, + VSB_16, + PSK_8, + APSK_16, + APSK_32, + DQPSK, } fe_modulation_t; +
Finally, there are several more parameters for OFDM: +
+Number of carriers per channel, on OFTM modulation - typedef enum fe_transmit_mode { - TRANSMISSION_MODE_2K, - TRANSMISSION_MODE_8K, - TRANSMISSION_MODE_AUTO +typedef enum fe_transmit_mode { + TRANSMISSION_MODE_2K, + TRANSMISSION_MODE_8K, + TRANSMISSION_MODE_AUTO, + TRANSMISSION_MODE_4K, + TRANSMISSION_MODE_1K, + TRANSMISSION_MODE_16K, + TRANSMISSION_MODE_32K, } fe_transmit_mode_t; - - typedef enum fe_bandwidth { - BANDWIDTH_8_MHZ, - BANDWIDTH_7_MHZ, - BANDWIDTH_6_MHZ, - BANDWIDTH_AUTO - } fe_bandwidth_t; +
+
+frontend bandwidth + +typedef enum fe_bandwidth { + BANDWIDTH_8_MHZ, + BANDWIDTH_7_MHZ, + BANDWIDTH_6_MHZ, + BANDWIDTH_AUTO, + BANDWIDTH_5_MHZ, + BANDWIDTH_10_MHZ, + BANDWIDTH_1_712_MHZ, +} fe_bandwidth_t; - - typedef enum fe_guard_interval { - GUARD_INTERVAL_1_32, - GUARD_INTERVAL_1_16, - GUARD_INTERVAL_1_8, - GUARD_INTERVAL_1_4, - GUARD_INTERVAL_AUTO - } fe_guard_interval_t; +
+
+frontend guard inverval + +typedef enum fe_guard_interval { + GUARD_INTERVAL_1_32, + GUARD_INTERVAL_1_16, + GUARD_INTERVAL_1_8, + GUARD_INTERVAL_1_4, + GUARD_INTERVAL_AUTO, + GUARD_INTERVAL_1_128, + GUARD_INTERVAL_19_128, + GUARD_INTERVAL_19_256, +} fe_guard_interval_t; - - typedef enum fe_hierarchy { +
+
+frontend hierarchy + +typedef enum fe_hierarchy { HIERARCHY_NONE, HIERARCHY_1, HIERARCHY_2, @@ -350,10 +405,11 @@ modulation mode which can be one of the following: HIERARCHY_AUTO } fe_hierarchy_t; +
-
+
frontend events struct dvb_frontend_event { -- cgit v1.2.3 From 0be153efb18141162bcaa8ea3de6b94d2d92397e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 7 Jun 2011 18:15:19 -0300 Subject: [media] DocBook/frontend.xml: Better describe the frontend parameters Update the DVB parameter structs to reflect VSB modulation and improve a few descriptions. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/dvb/frontend.xml | 33 ++++++++++++++++------------ 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/Documentation/DocBook/media/dvb/frontend.xml b/Documentation/DocBook/media/dvb/frontend.xml index a925b4507cef..b1f01239d4da 100644 --- a/Documentation/DocBook/media/dvb/frontend.xml +++ b/Documentation/DocBook/media/dvb/frontend.xml @@ -262,6 +262,15 @@ OFDM frontends the frequency specifies the absolute frequen };
+
+VSB parameters +DVB-T frontends are supported by the dvb_vsb_parameters structure: + +struct dvb_vsb_parameters { + fe_modulation_t modulation; /⋆ modulation type (see above) ⋆/ +}; + +
OFDM parameters DVB-T frontends are supported by the dvb_ofdm_parameters structure: @@ -277,15 +286,6 @@ OFDM frontends the frequency specifies the absolute frequen };
-
-VSB parameters -DVB-T frontends are supported by the dvb_vsb_parameters structure: - -struct dvb_vsb_parameters { - fe_modulation_t modulation; /⋆ modulation type (see above) ⋆/ -}; - -
frontend spectral inversion The Inversion field can take one of these values: @@ -304,7 +304,9 @@ itself.
frontend code rate -The possible values for the FEC_inner field are +The possible values for the fec_inner field used on +struct dvb_qpsk_parameters and +struct dvb_qam_parameters are: typedef enum fe_code_rate { @@ -327,9 +329,12 @@ detection.
-frontend modulation type for QAM and OFDM -For cable and terrestrial frontends (QAM and OFDM) one also has to specify the quadrature -modulation mode which can be one of the following: +frontend modulation type for QAM, OFDM and VSB +For cable and terrestrial frontends, e. g. for +struct dvb_qpsk_parameters, +struct dvb_qam_parameters and +struct dvb_qam_parameters, +it needs to specify the quadrature modulation mode which can be one of the following: typedef enum fe_modulation { @@ -352,7 +357,7 @@ modulation mode which can be one of the following: Finally, there are several more parameters for OFDM:
-Number of carriers per channel, on OFTM modulation +Number of carriers per channel typedef enum fe_transmit_mode { TRANSMISSION_MODE_2K, -- cgit v1.2.3 From 04a92077d205abdf3827545f8dea4c6521384c4c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 7 Jun 2011 19:37:47 -0300 Subject: [media] DocBook/dvbproperty.xml: Document the remaining S2API parameters There were lots of DVB S2API parameters that were never documented. Let's add a definition for all of them, based on what's currently used inside the core and the drivers. The description here is not complete nor perfect, so patches improving it are welcome. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/dvb/dvbproperty.xml | 204 +++++++++++++++++++++++- 1 file changed, 203 insertions(+), 1 deletion(-) diff --git a/Documentation/DocBook/media/dvb/dvbproperty.xml b/Documentation/DocBook/media/dvb/dvbproperty.xml index 3a1ecb2ba632..67a2deba747a 100644 --- a/Documentation/DocBook/media/dvb/dvbproperty.xml +++ b/Documentation/DocBook/media/dvb/dvbproperty.xml @@ -199,6 +199,208 @@ get/set up to 64 properties. The actual meaning of each property is described on
Parameters that are common to all Digital TV standards +
+ <constant>DTV_UNDEFINED</constant> + Used internally. A GET/SET operation for it won't change or return anything. +
+
+ <constant>DTV_TUNE</constant> + Interpret the cache of data, build either a traditional frontend tunerequest so we can pass validation in the FE_SET_FRONTEND ioctl. +
+
+ <constant>DTV_CLEAR</constant> + Reset a cache of data specific to the frontend here. This does not effect hardware. +
+
+ <constant>DTV_MODULATION</constant> +Specifies the frontend modulation type for cable and satellite types. The modulation can be one of the types bellow: + + typedef enum fe_modulation { + QPSK, + QAM_16, + QAM_32, + QAM_64, + QAM_128, + QAM_256, + QAM_AUTO, + VSB_8, + VSB_16, + PSK_8, + APSK_16, + APSK_32, + DQPSK, + } fe_modulation_t; + +
+
+ <constant>DTV_INVERSION</constant> + The Inversion field can take one of these values: + + + typedef enum fe_spectral_inversion { + INVERSION_OFF, + INVERSION_ON, + INVERSION_AUTO + } fe_spectral_inversion_t; + + It indicates if spectral inversion should be presumed or not. In the automatic setting + (INVERSION_AUTO) the hardware will try to figure out the correct setting by + itself. + +
+
+ <constant>DTV_DISEQC_MASTER</constant> + Currently not implemented. +
+
+ <constant>DTV_SYMBOL_RATE</constant> + Digital TV symbol rate, in bauds (symbols/second). Used on cable standards. +
+
+ <constant>DTV_INNER_FEC</constant> + Used cable/satellite transmissions. The acceptable values are: + + +typedef enum fe_code_rate { + FEC_NONE = 0, + FEC_1_2, + FEC_2_3, + FEC_3_4, + FEC_4_5, + FEC_5_6, + FEC_6_7, + FEC_7_8, + FEC_8_9, + FEC_AUTO, + FEC_3_5, + FEC_9_10, +} fe_code_rate_t; + + which correspond to error correction rates of 1/2, 2/3, etc., + no error correction or auto detection. +
+
+ <constant>DTV_VOLTAGE</constant> + The voltage is usually used with non-DiSEqC capable LNBs to switch + the polarzation (horizontal/vertical). When using DiSEqC epuipment this + voltage has to be switched consistently to the DiSEqC commands as + described in the DiSEqC spec. + + typedef enum fe_sec_voltage { + SEC_VOLTAGE_13, + SEC_VOLTAGE_18 + } fe_sec_voltage_t; + +
+
+ <constant>DTV_TONE</constant> + Currently not used. +
+
+ <constant>DTV_PILOT</constant> + Sets DVB-S2 pilot +
+ fe_pilot type + +typedef enum fe_pilot { + PILOT_ON, + PILOT_OFF, + PILOT_AUTO, +} fe_pilot_t; + +
+
+
+ <constant>DTV_ROLLOFF</constant> + Sets DVB-S2 rolloff + +
+ fe_rolloff type + +typedef enum fe_rolloff { + ROLLOFF_35, /* Implied value in DVB-S, default for DVB-S2 */ + ROLLOFF_20, + ROLLOFF_25, + ROLLOFF_AUTO, +} fe_rolloff_t; + +
+
+
+ <constant>DTV_DISEQC_SLAVE_REPLY</constant> + Currently not implemented. +
+
+ <constant>DTV_FE_CAPABILITY_COUNT</constant> + Currently not implemented. +
+
+ <constant>DTV_FE_CAPABILITY</constant> + Currently not implemented. +
+
+ <constant>DTV_API_VERSION</constant> + Returns the major/minor version of the DVB API +
+
+ <constant>DTV_CODE_RATE_HP</constant> + Used on terrestrial transmissions. The acceptable values are: + + +typedef enum fe_code_rate { + FEC_NONE = 0, + FEC_1_2, + FEC_2_3, + FEC_3_4, + FEC_4_5, + FEC_5_6, + FEC_6_7, + FEC_7_8, + FEC_8_9, + FEC_AUTO, + FEC_3_5, + FEC_9_10, +} fe_code_rate_t; + +
+
+ <constant>DTV_CODE_RATE_LP</constant> + Used on terrestrial transmissions. The acceptable values are: + + +typedef enum fe_code_rate { + FEC_NONE = 0, + FEC_1_2, + FEC_2_3, + FEC_3_4, + FEC_4_5, + FEC_5_6, + FEC_6_7, + FEC_7_8, + FEC_8_9, + FEC_AUTO, + FEC_3_5, + FEC_9_10, +} fe_code_rate_t; + +
+
+ <constant>DTV_HIERARCHY</constant> + Frontend hierarchy + +typedef enum fe_hierarchy { + HIERARCHY_NONE, + HIERARCHY_1, + HIERARCHY_2, + HIERARCHY_4, + HIERARCHY_AUTO + } fe_hierarchy_t; + +
+
+ <constant>DTV_ISDBS_TS_ID</constant> + Currently unused. +
<constant>DTV_FREQUENCY</constant> @@ -573,7 +775,7 @@ typedef enum fe_guard_interval {
DVB-T2 parameters - + This section covers parameters that apply only to the DVB-T2 delivery method. DVB-T2 support is currently in the early stages development so expect this section to grow and become more detailed with time. -- cgit v1.2.3 From db8d0ea70572c5f74624115e0d5cd7e34a6ba3c7 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 7 Jun 2011 19:48:46 -0300 Subject: [media] DocBook/dvbproperty.xml: Use links for all parameters Instead of adding a program listing, just add there all parameters. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/dvb/dvbproperty.xml | 90 ++++++++++++------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/Documentation/DocBook/media/dvb/dvbproperty.xml b/Documentation/DocBook/media/dvb/dvbproperty.xml index 67a2deba747a..01f39337e3f7 100644 --- a/Documentation/DocBook/media/dvb/dvbproperty.xml +++ b/Documentation/DocBook/media/dvb/dvbproperty.xml @@ -150,51 +150,51 @@ get/set up to 64 properties. The actual meaning of each property is described on The available frontend property types are: - -#define DTV_UNDEFINED 0 -#define DTV_TUNE 1 -#define DTV_CLEAR 2 -#define DTV_FREQUENCY 3 -#define DTV_MODULATION 4 -#define DTV_BANDWIDTH_HZ 5 -#define DTV_INVERSION 6 -#define DTV_DISEQC_MASTER 7 -#define DTV_SYMBOL_RATE 8 -#define DTV_INNER_FEC 9 -#define DTV_VOLTAGE 10 -#define DTV_TONE 11 -#define DTV_PILOT 12 -#define DTV_ROLLOFF 13 -#define DTV_DISEQC_SLAVE_REPLY 14 -#define DTV_FE_CAPABILITY_COUNT 15 -#define DTV_FE_CAPABILITY 16 -#define DTV_DELIVERY_SYSTEM 17 -#define DTV_ISDBT_PARTIAL_RECEPTION 18 -#define DTV_ISDBT_SOUND_BROADCASTING 19 -#define DTV_ISDBT_SB_SUBCHANNEL_ID 20 -#define DTV_ISDBT_SB_SEGMENT_IDX 21 -#define DTV_ISDBT_SB_SEGMENT_COUNT 22 -#define DTV_ISDBT_LAYERA_FEC 23 -#define DTV_ISDBT_LAYERA_MODULATION 24 -#define DTV_ISDBT_LAYERA_SEGMENT_COUNT 25 -#define DTV_ISDBT_LAYERA_TIME_INTERLEAVING 26 -#define DTV_ISDBT_LAYERB_FEC 27 -#define DTV_ISDBT_LAYERB_MODULATION 28 -#define DTV_ISDBT_LAYERB_SEGMENT_COUNT 29 -#define DTV_ISDBT_LAYERB_TIME_INTERLEAVING 30 -#define DTV_ISDBT_LAYERC_FEC 31 -#define DTV_ISDBT_LAYERC_MODULATION 32 -#define DTV_ISDBT_LAYERC_SEGMENT_COUNT 33 -#define DTV_ISDBT_LAYERC_TIME_INTERLEAVING 34 -#define DTV_API_VERSION 35 -#define DTV_CODE_RATE_HP 36 -#define DTV_CODE_RATE_LP 37 -#define DTV_GUARD_INTERVAL 38 -#define DTV_TRANSMISSION_MODE 39 -#define DTV_HIERARCHY 40 -#define DTV_ISDBT_LAYER_ENABLED 41 -#define DTV_ISDBS_TS_ID 42 - + +DTV_UNDEFINED +DTV_TUNE +DTV_CLEAR +DTV_FREQUENCY +DTV_MODULATION +DTV_BANDWIDTH_HZ +DTV_INVERSION +DTV_DISEQC_MASTER +DTV_SYMBOL_RATE +DTV_INNER_FEC +DTV_VOLTAGE +DTV_TONE +DTV_PILOT +DTV_ROLLOFF +DTV_DISEQC_SLAVE_REPLY +DTV_FE_CAPABILITY_COUNT +DTV_FE_CAPABILITY +DTV_DELIVERY_SYSTEM +DTV_ISDBT_PARTIAL_RECEPTION +DTV_ISDBT_SOUND_BROADCASTING +DTV_ISDBT_SB_SUBCHANNEL_ID +DTV_ISDBT_SB_SEGMENT_IDX +DTV_ISDBT_SB_SEGMENT_COUNT +DTV_ISDBT_LAYERA_FEC +DTV_ISDBT_LAYERA_MODULATION +DTV_ISDBT_LAYERA_SEGMENT_COUNT +DTV_ISDBT_LAYERA_TIME_INTERLEAVING +DTV_ISDBT_LAYERB_FEC +DTV_ISDBT_LAYERB_MODULATION +DTV_ISDBT_LAYERB_SEGMENT_COUNT +DTV_ISDBT_LAYERB_TIME_INTERLEAVING +DTV_ISDBT_LAYERC_FEC +DTV_ISDBT_LAYERC_MODULATION +DTV_ISDBT_LAYERC_SEGMENT_COUNT +DTV_ISDBT_LAYERC_TIME_INTERLEAVING +DTV_API_VERSION +DTV_CODE_RATE_HP +DTV_CODE_RATE_LP +DTV_GUARD_INTERVAL +DTV_TRANSMISSION_MODE +DTV_HIERARCHY +DTV_ISDBT_LAYER_ENABLED +DTV_ISDBS_TS_ID +DTV_DVBT2_PLP_ID
-- cgit v1.2.3 From 17d8bb061fcf8ba6a56adcf193d7d255966cff79 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 7 Jun 2011 20:05:13 -0300 Subject: [media] DocBook/dvbproperty.xml: Reorganize the parameters Put the parameters at the sequencial order as they appear inside the frontend.h header. TODO: fix the per-standard section, to reflect the parameters that should actually be used for each transmission system type. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/dvb/dvbproperty.xml | 681 +++++++++++------------- 1 file changed, 311 insertions(+), 370 deletions(-) diff --git a/Documentation/DocBook/media/dvb/dvbproperty.xml b/Documentation/DocBook/media/dvb/dvbproperty.xml index 01f39337e3f7..d8a642475ad8 100644 --- a/Documentation/DocBook/media/dvb/dvbproperty.xml +++ b/Documentation/DocBook/media/dvb/dvbproperty.xml @@ -197,8 +197,8 @@ get/set up to 64 properties. The actual meaning of each property is described on DTV_DVBT2_PLP_ID
-
- Parameters that are common to all Digital TV standards +
+ Digital TV property parameters
<constant>DTV_UNDEFINED</constant> Used internally. A GET/SET operation for it won't change or return anything. @@ -211,6 +211,20 @@ get/set up to 64 properties. The actual meaning of each property is described on <constant>DTV_CLEAR</constant> Reset a cache of data specific to the frontend here. This does not effect hardware.
+
+ <constant>DTV_FREQUENCY</constant> + + Central frequency of the channel, in HZ. + + Notes: + 1)For ISDB-T, the channels are usually transmitted with an offset of 143kHz. + E.g. a valid frequncy could be 474143 kHz. The stepping is bound to the bandwidth of + the channel which is 6MHz. + + 2)As in ISDB-Tsb the channel consists of only one or three segments the + frequency step is 429kHz, 3*429 respectively. As for ISDB-T the + central frequency of the channel is expected. +
<constant>DTV_MODULATION</constant> Specifies the frontend modulation type for cable and satellite types. The modulation can be one of the types bellow: @@ -232,6 +246,32 @@ get/set up to 64 properties. The actual meaning of each property is described on } fe_modulation_t;
+
+ <constant>DTV_BANDWIDTH_HZ</constant> + + Bandwidth for the channel, in HZ. + + Possible values: + 1712000, + 5000000, + 6000000, + 7000000, + 8000000, + 10000000. + + + Notes: + + 1) For ISDB-T it should be always 6000000Hz (6MHz) + 2) For ISDB-Tsb it can vary depending on the number of connected segments + 3) Bandwidth doesn't apply for DVB-C transmissions, as the bandwidth + for DVB-C depends on the symbol rate + 4) Bandwidth in ISDB-T is fixed (6MHz) or can be easily derived from + other parameters (DTV_ISDBT_SB_SEGMENT_IDX, + DTV_ISDBT_SB_SEGMENT_COUNT). + 5) DVB-T supports 6, 7 and 8MHz. + 6) In addition, DVB-T2 supports 1.172, 5 and 10MHz. +
<constant>DTV_INVERSION</constant> The Inversion field can take one of these values: @@ -338,6 +378,205 @@ typedef enum fe_rolloff { <constant>DTV_FE_CAPABILITY</constant> Currently not implemented.
+
+ <constant>DTV_DELIVERY_SYSTEM</constant> + Specifies the type of Delivery system +
+ fe_delivery_system type + Possible values: + +typedef enum fe_delivery_system { + SYS_UNDEFINED, + SYS_DVBC_ANNEX_AC, + SYS_DVBC_ANNEX_B, + SYS_DVBT, + SYS_DSS, + SYS_DVBS, + SYS_DVBS2, + SYS_DVBH, + SYS_ISDBT, + SYS_ISDBS, + SYS_ISDBC, + SYS_ATSC, + SYS_ATSCMH, + SYS_DMBTH, + SYS_CMMB, + SYS_DAB, + SYS_DVBT2, +} fe_delivery_system_t; + +
+
+
+ <constant>DTV_ISDBT_PARTIAL_RECEPTION</constant> + + If DTV_ISDBT_SOUND_BROADCASTING is '0' this bit-field represents whether + the channel is in partial reception mode or not. + + If '1' DTV_ISDBT_LAYERA_* values are assigned to the center segment and + DTV_ISDBT_LAYERA_SEGMENT_COUNT has to be '1'. + + If in addition DTV_ISDBT_SOUND_BROADCASTING is '1' + DTV_ISDBT_PARTIAL_RECEPTION represents whether this ISDB-Tsb channel + is consisting of one segment and layer or three segments and two layers. + + Possible values: 0, 1, -1 (AUTO) +
+
+ <constant>DTV_ISDBT_SOUND_BROADCASTING</constant> + + This field represents whether the other DTV_ISDBT_*-parameters are + referring to an ISDB-T and an ISDB-Tsb channel. (See also + DTV_ISDBT_PARTIAL_RECEPTION). + + Possible values: 0, 1, -1 (AUTO) +
+
+ <constant>DTV_ISDBT_SB_SUBCHANNEL_ID</constant> + + This field only applies if DTV_ISDBT_SOUND_BROADCASTING is '1'. + + (Note of the author: This might not be the correct description of the + SUBCHANNEL-ID in all details, but it is my understanding of the technical + background needed to program a device) + + An ISDB-Tsb channel (1 or 3 segments) can be broadcasted alone or in a + set of connected ISDB-Tsb channels. In this set of channels every + channel can be received independently. The number of connected + ISDB-Tsb segment can vary, e.g. depending on the frequency spectrum + bandwidth available. + + Example: Assume 8 ISDB-Tsb connected segments are broadcasted. The + broadcaster has several possibilities to put those channels in the + air: Assuming a normal 13-segment ISDB-T spectrum he can align the 8 + segments from position 1-8 to 5-13 or anything in between. + + The underlying layer of segments are subchannels: each segment is + consisting of several subchannels with a predefined IDs. A sub-channel + is used to help the demodulator to synchronize on the channel. + + An ISDB-T channel is always centered over all sub-channels. As for + the example above, in ISDB-Tsb it is no longer as simple as that. + + The DTV_ISDBT_SB_SUBCHANNEL_ID parameter is used to give the + sub-channel ID of the segment to be demodulated. + + Possible values: 0 .. 41, -1 (AUTO) +
+
+ <constant>DTV_ISDBT_SB_SEGMENT_IDX</constant> + This field only applies if DTV_ISDBT_SOUND_BROADCASTING is '1'. + DTV_ISDBT_SB_SEGMENT_IDX gives the index of the segment to be + demodulated for an ISDB-Tsb channel where several of them are + transmitted in the connected manner. + Possible values: 0 .. DTV_ISDBT_SB_SEGMENT_COUNT - 1 + Note: This value cannot be determined by an automatic channel search. +
+
+ <constant>DTV_ISDBT_SB_SEGMENT_COUNT</constant> + This field only applies if DTV_ISDBT_SOUND_BROADCASTING is '1'. + DTV_ISDBT_SB_SEGMENT_COUNT gives the total count of connected ISDB-Tsb + channels. + Possible values: 1 .. 13 + Note: This value cannot be determined by an automatic channel search. +
+
+ Hierarchical layers + ISDB-T channels can be coded hierarchically. As opposed to DVB-T in + ISDB-T hierarchical layers can be decoded simultaneously. For that + reason a ISDB-T demodulator has 3 viterbi and 3 reed-solomon-decoders. + ISDB-T has 3 hierarchical layers which each can use a part of the + available segments. The total number of segments over all layers has + to 13 in ISDB-T. +
+ <constant>DTV_ISDBT_LAYER_ENABLED</constant> + Hierarchical reception in ISDB-T is achieved by enabling or disabling + layers in the decoding process. Setting all bits of + DTV_ISDBT_LAYER_ENABLED to '1' forces all layers (if applicable) to be + demodulated. This is the default. + If the channel is in the partial reception mode + (DTV_ISDBT_PARTIAL_RECEPTION = 1) the central segment can be decoded + independently of the other 12 segments. In that mode layer A has to + have a SEGMENT_COUNT of 1. + In ISDB-Tsb only layer A is used, it can be 1 or 3 in ISDB-Tsb + according to DTV_ISDBT_PARTIAL_RECEPTION. SEGMENT_COUNT must be filled + accordingly. + Possible values: 0x1, 0x2, 0x4 (|-able) + DTV_ISDBT_LAYER_ENABLED[0:0] - layer A + DTV_ISDBT_LAYER_ENABLED[1:1] - layer B + DTV_ISDBT_LAYER_ENABLED[2:2] - layer C + DTV_ISDBT_LAYER_ENABLED[31:3] unused +
+
+ <constant>DTV_ISDBT_LAYER*_FEC</constant> + Possible values: FEC_AUTO, FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_7_8 +
+
+ <constant>DTV_ISDBT_LAYER*_MODULATION</constant> + Possible values: QAM_AUTO, QPSK, QAM_16, QAM_64, DQPSK + Note: If layer C is DQPSK layer B has to be DQPSK. If layer B is DQPSK + and DTV_ISDBT_PARTIAL_RECEPTION=0 layer has to be DQPSK. +
+
+ <constant>DTV_ISDBT_LAYER*_SEGMENT_COUNT</constant> + Possible values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, -1 (AUTO) + Note: Truth table for DTV_ISDBT_SOUND_BROADCASTING and + DTV_ISDBT_PARTIAL_RECEPTION and LAYER*_SEGMENT_COUNT + + + + + PR + SB + Layer A width + Layer B width + Layer C width + total width + + + 0 + 0 + 1 .. 13 + 1 .. 13 + 1 .. 13 + 13 + + + 1 + 0 + 1 + 1 .. 13 + 1 .. 13 + 13 + + + 0 + 1 + 1 + 0 + 0 + 1 + + + 1 + 1 + 1 + 2 + 0 + 13 + + + + +
+
+ <constant>DTV_ISDBT_LAYER*_TIME_INTERLEAVING</constant> + Possible values: 0, 1, 2, 3, -1 (AUTO) + Note: The real inter-leaver depth-names depend on the mode (fft-size); the values + here are referring to what can be found in the TMCC-structure - + independent of the mode. +
+
<constant>DTV_API_VERSION</constant> Returns the major/minor version of the DVB API @@ -384,95 +623,29 @@ typedef enum fe_code_rate { } fe_code_rate_t;
-
- <constant>DTV_HIERARCHY</constant> - Frontend hierarchy - -typedef enum fe_hierarchy { - HIERARCHY_NONE, - HIERARCHY_1, - HIERARCHY_2, - HIERARCHY_4, - HIERARCHY_AUTO - } fe_hierarchy_t; - -
-
- <constant>DTV_ISDBS_TS_ID</constant> - Currently unused. -
-
- <constant>DTV_FREQUENCY</constant> - - Central frequency of the channel, in HZ. - - Notes: - 1)For ISDB-T, the channels are usually transmitted with an offset of 143kHz. - E.g. a valid frequncy could be 474143 kHz. The stepping is bound to the bandwidth of - the channel which is 6MHz. - - 2)As in ISDB-Tsb the channel consists of only one or three segments the - frequency step is 429kHz, 3*429 respectively. As for ISDB-T the - central frequency of the channel is expected. -
- -
- <constant>DTV_BANDWIDTH_HZ</constant> - - Bandwidth for the channel, in HZ. - - Possible values: - 1712000, - 5000000, - 6000000, - 7000000, - 8000000, - 10000000. - - - Notes: - - 1) For ISDB-T it should be always 6000000Hz (6MHz) - 2) For ISDB-Tsb it can vary depending on the number of connected segments - 3) Bandwidth doesn't apply for DVB-C transmissions, as the bandwidth - for DVB-C depends on the symbol rate - 4) Bandwidth in ISDB-T is fixed (6MHz) or can be easily derived from - other parameters (DTV_ISDBT_SB_SEGMENT_IDX, - DTV_ISDBT_SB_SEGMENT_COUNT). - 5) DVB-T supports 6, 7 and 8MHz. - 6) In addition, DVB-T2 supports 1.172, 5 and 10MHz. -
- -
- <constant>DTV_DELIVERY_SYSTEM</constant> - - Specifies the type of Delivery system +
+ <constant>DTV_GUARD_INTERVAL</constant> - Possible values: + Possible values are: -typedef enum fe_delivery_system { - SYS_UNDEFINED, - SYS_DVBC_ANNEX_AC, - SYS_DVBC_ANNEX_B, - SYS_DVBT, - SYS_DSS, - SYS_DVBS, - SYS_DVBS2, - SYS_DVBH, - SYS_ISDBT, - SYS_ISDBS, - SYS_ISDBC, - SYS_ATSC, - SYS_ATSCMH, - SYS_DMBTH, - SYS_CMMB, - SYS_DAB, - SYS_DVBT2, -} fe_delivery_system_t; +typedef enum fe_guard_interval { + GUARD_INTERVAL_1_32, + GUARD_INTERVAL_1_16, + GUARD_INTERVAL_1_8, + GUARD_INTERVAL_1_4, + GUARD_INTERVAL_AUTO, + GUARD_INTERVAL_1_128, + GUARD_INTERVAL_19_128, + GUARD_INTERVAL_19_256, +} fe_guard_interval_t; + Notes: + 1) If DTV_GUARD_INTERVAL is set the GUARD_INTERVAL_AUTO the hardware will + try to find the correct guard interval (if capable) and will use TMCC to fill + in the missing parameters. + 2) Intervals 1/128, 19/128 and 19/256 are used only for DVB-T2 at present
-
<constant>DTV_TRANSMISSION_MODE</constant> @@ -490,7 +663,6 @@ typedef enum fe_transmit_mode { TRANSMISSION_MODE_32K, } fe_transmit_mode_t; - Notes: 1) ISDB-T supports three carrier/symbol-size: 8K, 4K, 2K. It is called 'mode' in the standard: Mode 1 is 2K, mode 2 is 4K, mode 3 is 8K @@ -501,291 +673,60 @@ typedef enum fe_transmit_mode { 3) DVB-T specifies 2K and 8K as valid sizes. 4) DVB-T2 specifies 1K, 2K, 4K, 8K, 16K and 32K.
- -
- <constant>DTV_GUARD_INTERVAL</constant> - - Possible values are: - -typedef enum fe_guard_interval { - GUARD_INTERVAL_1_32, - GUARD_INTERVAL_1_16, - GUARD_INTERVAL_1_8, - GUARD_INTERVAL_1_4, - GUARD_INTERVAL_AUTO, - GUARD_INTERVAL_1_128, - GUARD_INTERVAL_19_128, - GUARD_INTERVAL_19_256, -} fe_guard_interval_t; - - - Notes: - 1) If DTV_GUARD_INTERVAL is set the GUARD_INTERVAL_AUTO the hardware will - try to find the correct guard interval (if capable) and will use TMCC to fill - in the missing parameters. - 2) Intervals 1/128, 19/128 and 19/256 are used only for DVB-T2 at present +
+ <constant>DTV_HIERARCHY</constant> + Frontend hierarchy + +typedef enum fe_hierarchy { + HIERARCHY_NONE, + HIERARCHY_1, + HIERARCHY_2, + HIERARCHY_4, + HIERARCHY_AUTO + } fe_hierarchy_t; +
-
- -
- ISDB-T frontend - This section describes shortly what are the possible parameters in the Linux - DVB-API called "S2API" and now DVB API 5 in order to tune an ISDB-T/ISDB-Tsb - demodulator: - - This ISDB-T/ISDB-Tsb API extension should reflect all information - needed to tune any ISDB-T/ISDB-Tsb hardware. Of course it is possible - that some very sophisticated devices won't need certain parameters to - tune. - - The information given here should help application writers to know how - to handle ISDB-T and ISDB-Tsb hardware using the Linux DVB-API. - - The details given here about ISDB-T and ISDB-Tsb are just enough to - basically show the dependencies between the needed parameter values, - but surely some information is left out. For more detailed information - see the following documents: - - ARIB STD-B31 - "Transmission System for Digital Terrestrial - Television Broadcasting" and - ARIB TR-B14 - "Operational Guidelines for Digital Terrestrial - Television Broadcasting". - - In order to read this document one has to have some knowledge the - channel structure in ISDB-T and ISDB-Tsb. I.e. it has to be known to - the reader that an ISDB-T channel consists of 13 segments, that it can - have up to 3 layer sharing those segments, and things like that. - - Parameters used by ISDB-T and ISDB-Tsb. - -
- ISDB-T only parameters - -
- <constant>DTV_ISDBT_PARTIAL_RECEPTION</constant> - - If DTV_ISDBT_SOUND_BROADCASTING is '0' this bit-field represents whether - the channel is in partial reception mode or not. - - If '1' DTV_ISDBT_LAYERA_* values are assigned to the center segment and - DTV_ISDBT_LAYERA_SEGMENT_COUNT has to be '1'. - - If in addition DTV_ISDBT_SOUND_BROADCASTING is '1' - DTV_ISDBT_PARTIAL_RECEPTION represents whether this ISDB-Tsb channel - is consisting of one segment and layer or three segments and two layers. - - Possible values: 0, 1, -1 (AUTO) -
- -
- <constant>DTV_ISDBT_SOUND_BROADCASTING</constant> - - This field represents whether the other DTV_ISDBT_*-parameters are - referring to an ISDB-T and an ISDB-Tsb channel. (See also - DTV_ISDBT_PARTIAL_RECEPTION). - - Possible values: 0, 1, -1 (AUTO) -
- -
- <constant>DTV_ISDBT_SB_SUBCHANNEL_ID</constant> - - This field only applies if DTV_ISDBT_SOUND_BROADCASTING is '1'. - - (Note of the author: This might not be the correct description of the - SUBCHANNEL-ID in all details, but it is my understanding of the technical - background needed to program a device) - - An ISDB-Tsb channel (1 or 3 segments) can be broadcasted alone or in a - set of connected ISDB-Tsb channels. In this set of channels every - channel can be received independently. The number of connected - ISDB-Tsb segment can vary, e.g. depending on the frequency spectrum - bandwidth available. - - Example: Assume 8 ISDB-Tsb connected segments are broadcasted. The - broadcaster has several possibilities to put those channels in the - air: Assuming a normal 13-segment ISDB-T spectrum he can align the 8 - segments from position 1-8 to 5-13 or anything in between. - - The underlying layer of segments are subchannels: each segment is - consisting of several subchannels with a predefined IDs. A sub-channel - is used to help the demodulator to synchronize on the channel. - - An ISDB-T channel is always centered over all sub-channels. As for - the example above, in ISDB-Tsb it is no longer as simple as that. - - The DTV_ISDBT_SB_SUBCHANNEL_ID parameter is used to give the - sub-channel ID of the segment to be demodulated. - - Possible values: 0 .. 41, -1 (AUTO) -
- -
- - <constant>DTV_ISDBT_SB_SEGMENT_IDX</constant> - - This field only applies if DTV_ISDBT_SOUND_BROADCASTING is '1'. - - DTV_ISDBT_SB_SEGMENT_IDX gives the index of the segment to be - demodulated for an ISDB-Tsb channel where several of them are - transmitted in the connected manner. - - Possible values: 0 .. DTV_ISDBT_SB_SEGMENT_COUNT - 1 - - Note: This value cannot be determined by an automatic channel search. -
- -
- <constant>DTV_ISDBT_SB_SEGMENT_COUNT</constant> - - This field only applies if DTV_ISDBT_SOUND_BROADCASTING is '1'. - - DTV_ISDBT_SB_SEGMENT_COUNT gives the total count of connected ISDB-Tsb - channels. - - Possible values: 1 .. 13 - - Note: This value cannot be determined by an automatic channel search. -
- -
- Hierarchical layers - - ISDB-T channels can be coded hierarchically. As opposed to DVB-T in - ISDB-T hierarchical layers can be decoded simultaneously. For that - reason a ISDB-T demodulator has 3 viterbi and 3 reed-solomon-decoders. - - ISDB-T has 3 hierarchical layers which each can use a part of the - available segments. The total number of segments over all layers has - to 13 in ISDB-T. - -
- <constant>DTV_ISDBT_LAYER_ENABLED</constant> - - Hierarchical reception in ISDB-T is achieved by enabling or disabling - layers in the decoding process. Setting all bits of - DTV_ISDBT_LAYER_ENABLED to '1' forces all layers (if applicable) to be - demodulated. This is the default. - - If the channel is in the partial reception mode - (DTV_ISDBT_PARTIAL_RECEPTION = 1) the central segment can be decoded - independently of the other 12 segments. In that mode layer A has to - have a SEGMENT_COUNT of 1. - - In ISDB-Tsb only layer A is used, it can be 1 or 3 in ISDB-Tsb - according to DTV_ISDBT_PARTIAL_RECEPTION. SEGMENT_COUNT must be filled - accordingly. - - Possible values: 0x1, 0x2, 0x4 (|-able) - - DTV_ISDBT_LAYER_ENABLED[0:0] - layer A - DTV_ISDBT_LAYER_ENABLED[1:1] - layer B - DTV_ISDBT_LAYER_ENABLED[2:2] - layer C - DTV_ISDBT_LAYER_ENABLED[31:3] unused -
- -
- <constant>DTV_ISDBT_LAYER*_FEC</constant> - - Possible values: FEC_AUTO, FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_7_8 -
- -
- <constant>DTV_ISDBT_LAYER*_MODULATION</constant> - - Possible values: QAM_AUTO, QPSK, QAM_16, QAM_64, DQPSK - - Note: If layer C is DQPSK layer B has to be DQPSK. If layer B is DQPSK - and DTV_ISDBT_PARTIAL_RECEPTION=0 layer has to be DQPSK. -
- -
- <constant>DTV_ISDBT_LAYER*_SEGMENT_COUNT</constant> - - Possible values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, -1 (AUTO) - - Note: Truth table for DTV_ISDBT_SOUND_BROADCASTING and - DTV_ISDBT_PARTIAL_RECEPTION and LAYER*_SEGMENT_COUNT - - - - - - - PR - SB - Layer A width - Layer B width - Layer C width - total width - - - - 0 - 0 - 1 .. 13 - 1 .. 13 - 1 .. 13 - 13 - - - - 1 - 0 - 1 - 1 .. 13 - 1 .. 13 - 13 - - - - 0 - 1 - 1 - 0 - 0 - 1 - - - - 1 - 1 - 1 - 2 - 0 - 13 - - - - - - -
- -
- <constant>DTV_ISDBT_LAYER*_TIME_INTERLEAVING</constant> - - Possible values: 0, 1, 2, 3, -1 (AUTO) - - Note: The real inter-leaver depth-names depend on the mode (fft-size); the values - here are referring to what can be found in the TMCC-structure - - independent of the mode. -
-
+
+ <constant>DTV_ISDBS_TS_ID</constant> + Currently unused.
-
- DVB-T2 parameters - - This section covers parameters that apply only to the DVB-T2 delivery method. DVB-T2 - support is currently in the early stages development so expect this section to grow - and become more detailed with time. - -
- <constant>DTV_DVBT2_PLP_ID</constant> - - DVB-T2 supports Physical Layer Pipes (PLP) to allow transmission of - many data types via a single multiplex. The API will soon support this - at which point this section will be expanded. +
+ <constant>DTV_DVBT2_PLP_ID</constant> + DVB-T2 supports Physical Layer Pipes (PLP) to allow transmission of + many data types via a single multiplex. The API will soon support this + at which point this section will be expanded. +
+
+ Properties used by each DTV type +
+ ISDB-T frontend + This section describes shortly what are the possible parameters in the Linux + DVB-API called "S2API" and now DVB API 5 in order to tune an ISDB-T/ISDB-Tsb + demodulator: + This ISDB-T/ISDB-Tsb API extension should reflect all information + needed to tune any ISDB-T/ISDB-Tsb hardware. Of course it is possible + that some very sophisticated devices won't need certain parameters to + tune. + The information given here should help application writers to know how + to handle ISDB-T and ISDB-Tsb hardware using the Linux DVB-API. + The details given here about ISDB-T and ISDB-Tsb are just enough to + basically show the dependencies between the needed parameter values, + but surely some information is left out. For more detailed information + see the following documents: + ARIB STD-B31 - "Transmission System for Digital Terrestrial + Television Broadcasting" and + ARIB TR-B14 - "Operational Guidelines for Digital Terrestrial + Television Broadcasting". + In order to read this document one has to have some knowledge the + channel structure in ISDB-T and ISDB-Tsb. I.e. it has to be known to + the reader that an ISDB-T channel consists of 13 segments, that it can + have up to 3 layer sharing those segments, and things like that. +
+
+ DVB-T2 parameters + This section covers parameters that apply only to the DVB-T2 delivery method. DVB-T2 + support is currently in the early stages development so expect this section to grow + and become more detailed with time.
-- cgit v1.2.3 From df2692a6dd89fc00929a18735b83204b352ebb52 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 7 Jun 2011 20:43:25 -0300 Subject: [media] DocBook/frontend.xml: Recomend the usage of the new API The old way of setting delivery system parameters were to use an union with specific per-system parameters. However, as newer delivery systems required more data, the structure size weren't enough to fit. So, recomend using the DVBS2API instead. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/dvb/frontend.xml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Documentation/DocBook/media/dvb/frontend.xml b/Documentation/DocBook/media/dvb/frontend.xml index b1f01239d4da..086e62bcad11 100644 --- a/Documentation/DocBook/media/dvb/frontend.xml +++ b/Documentation/DocBook/media/dvb/frontend.xml @@ -221,8 +221,20 @@ by
frontend parameters The kind of parameters passed to the frontend device for tuning depend on -the kind of hardware you are using. All kinds of parameters are combined as an -union in the FrontendParameters structure: +the kind of hardware you are using. +The struct dvb_frontend_parameters uses an +union with specific per-system parameters. However, as newer delivery systems +required more data, the structure size weren't enough to fit, and just +extending its size would break the existing applications. So, those parameters +were replaced by the usage of +FE_GET_PROPERTY/FE_SET_PROPERTY ioctl's. The +new API is flexible enough to add new parameters to existing delivery systems, +and to add newer delivery systems. +So, newer applications should use +FE_GET_PROPERTY/FE_SET_PROPERTY instead, in +order to be able to support the newer System Delivery like DVB-S2, DVB-T2, +DVB-C2, ISDB, etc. +All kinds of parameters are combined as an union in the FrontendParameters structure: struct dvb_frontend_parameters { uint32_t frequency; /⋆ (absolute) frequency in Hz for QAM/OFDM ⋆/ -- cgit v1.2.3 From 994e262e3e52bf9840f0f079c29696e5ab50057f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 7 Jun 2011 20:52:33 -0300 Subject: [media] DocBook/dvbproperty.xml: Document the terrestrial delivery systems Instead of repeating duplicate parameters to each delivery system, just add a section for each specific delivery system, showing what's applicable to each case. This helps userspace app developers to know what DVB parameters are applicable to each delivery system. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/dvb/dvbproperty.xml | 168 +++++++++++++++--------- 1 file changed, 103 insertions(+), 65 deletions(-) diff --git a/Documentation/DocBook/media/dvb/dvbproperty.xml b/Documentation/DocBook/media/dvb/dvbproperty.xml index d8a642475ad8..4c45f3c1ba79 100644 --- a/Documentation/DocBook/media/dvb/dvbproperty.xml +++ b/Documentation/DocBook/media/dvb/dvbproperty.xml @@ -1,6 +1,12 @@
-FE_GET_PROPERTY/FE_SET_PROPERTY - +<constant>FE_GET_PROPERTY/FE_SET_PROPERTY</constant> +This section describes the DVB version 5 extention of the DVB-API, also +called "S2API", as this API were added to provide support for DVB-S2. It was +designed to be able to replace the old frontend API. Yet, the DISEQC and +the capability ioctls weren't implemented yet via the new way. +The typical usage for the FE_GET_PROPERTY/FE_SET_PROPERTY +API is to replace the ioctl's were the +struct dvb_frontend_parameters were used. /* Reserved fields should be set to 0 */ struct dtv_property { @@ -149,52 +155,7 @@ the actual action is determined by the dtv_property cmd/data pairs. With one sin get/set up to 64 properties. The actual meaning of each property is described on the next sections. -The available frontend property types are: - -DTV_UNDEFINED -DTV_TUNE -DTV_CLEAR -DTV_FREQUENCY -DTV_MODULATION -DTV_BANDWIDTH_HZ -DTV_INVERSION -DTV_DISEQC_MASTER -DTV_SYMBOL_RATE -DTV_INNER_FEC -DTV_VOLTAGE -DTV_TONE -DTV_PILOT -DTV_ROLLOFF -DTV_DISEQC_SLAVE_REPLY -DTV_FE_CAPABILITY_COUNT -DTV_FE_CAPABILITY -DTV_DELIVERY_SYSTEM -DTV_ISDBT_PARTIAL_RECEPTION -DTV_ISDBT_SOUND_BROADCASTING -DTV_ISDBT_SB_SUBCHANNEL_ID -DTV_ISDBT_SB_SEGMENT_IDX -DTV_ISDBT_SB_SEGMENT_COUNT -DTV_ISDBT_LAYERA_FEC -DTV_ISDBT_LAYERA_MODULATION -DTV_ISDBT_LAYERA_SEGMENT_COUNT -DTV_ISDBT_LAYERA_TIME_INTERLEAVING -DTV_ISDBT_LAYERB_FEC -DTV_ISDBT_LAYERB_MODULATION -DTV_ISDBT_LAYERB_SEGMENT_COUNT -DTV_ISDBT_LAYERB_TIME_INTERLEAVING -DTV_ISDBT_LAYERC_FEC -DTV_ISDBT_LAYERC_MODULATION -DTV_ISDBT_LAYERC_SEGMENT_COUNT -DTV_ISDBT_LAYERC_TIME_INTERLEAVING -DTV_API_VERSION -DTV_CODE_RATE_HP -DTV_CODE_RATE_LP -DTV_GUARD_INTERVAL -DTV_TRANSMISSION_MODE -DTV_HIERARCHY -DTV_ISDBT_LAYER_ENABLED -DTV_ISDBS_TS_ID -DTV_DVBT2_PLP_ID +The available frontend property types are shown on the next section.
@@ -696,13 +657,53 @@ typedef enum fe_hierarchy { many data types via a single multiplex. The API will soon support this at which point this section will be expanded.
-
- Properties used by each DTV type +
+
+ Properties used on terrestrial delivery systems +
+ DVB-T delivery system + The following parameters are valid for DVB-T: + + DTV_API_VERSION + DTV_TUNE + DTV_CLEAR + DTV_FREQUENCY + DTV_MODULATION + DTV_BANDWIDTH_HZ + DTV_INVERSION + DTV_CODE_RATE_HP + DTV_CODE_RATE_LP + DTV_GUARD_INTERVAL + DTV_TRANSMISSION_MODE + DTV_HIERARCHY + DTV_DELIVERY_SYSTEM + +
+
+ DVB-T2 delivery system + DVB-T2support is currently in the early stages + of development so expect this section to grow and become + more detailed with time. + The following parameters are valid for DVB-T2: + + DTV_API_VERSION + DTV_TUNE + DTV_CLEAR + DTV_FREQUENCY + DTV_MODULATION + DTV_BANDWIDTH_HZ + DTV_INVERSION + DTV_CODE_RATE_HP + DTV_CODE_RATE_LP + DTV_GUARD_INTERVAL + DTV_TRANSMISSION_MODE + DTV_HIERARCHY + DTV_DELIVERY_SYSTEM + DTV_DVBT2_PLP_ID + +
- ISDB-T frontend - This section describes shortly what are the possible parameters in the Linux - DVB-API called "S2API" and now DVB API 5 in order to tune an ISDB-T/ISDB-Tsb - demodulator: + ISDB-T delivery system This ISDB-T/ISDB-Tsb API extension should reflect all information needed to tune any ISDB-T/ISDB-Tsb hardware. Of course it is possible that some very sophisticated devices won't need certain parameters to @@ -717,17 +718,54 @@ typedef enum fe_hierarchy { Television Broadcasting" and ARIB TR-B14 - "Operational Guidelines for Digital Terrestrial Television Broadcasting". - In order to read this document one has to have some knowledge the - channel structure in ISDB-T and ISDB-Tsb. I.e. it has to be known to - the reader that an ISDB-T channel consists of 13 segments, that it can - have up to 3 layer sharing those segments, and things like that. -
-
- DVB-T2 parameters - This section covers parameters that apply only to the DVB-T2 delivery method. DVB-T2 - support is currently in the early stages development so expect this section to grow - and become more detailed with time. + In order to understand the ISDB specific parameters, + one has to have some knowledge the channel structure in + ISDB-T and ISDB-Tsb. I.e. it has to be known to + the reader that an ISDB-T channel consists of 13 segments, + that it can have up to 3 layer sharing those segments, + and things like that. + The following parameters are valid for ISDB-T: + + DTV_API_VERSION + DTV_TUNE + DTV_CLEAR + DTV_FREQUENCY + DTV_MODULATION + DTV_BANDWIDTH_HZ + DTV_INVERSION + DTV_CODE_RATE_HP + DTV_CODE_RATE_LP + DTV_GUARD_INTERVAL + DTV_TRANSMISSION_MODE + DTV_HIERARCHY + DTV_DELIVERY_SYSTEM + DTV_ISDBT_LAYER_ENABLED + DTV_ISDBT_PARTIAL_RECEPTION + DTV_ISDBT_SOUND_BROADCASTING + DTV_ISDBT_SB_SUBCHANNEL_ID + DTV_ISDBT_SB_SEGMENT_IDX + DTV_ISDBT_SB_SEGMENT_COUNT + DTV_ISDBT_LAYERA_FEC + DTV_ISDBT_LAYERA_MODULATION + DTV_ISDBT_LAYERA_SEGMENT_COUNT + DTV_ISDBT_LAYERA_TIME_INTERLEAVING + DTV_ISDBT_LAYERB_FEC + DTV_ISDBT_LAYERB_MODULATION + DTV_ISDBT_LAYERB_SEGMENT_COUNT + DTV_ISDBT_LAYERB_TIME_INTERLEAVING + DTV_ISDBT_LAYERC_FEC + DTV_ISDBT_LAYERC_MODULATION + DTV_ISDBT_LAYERC_SEGMENT_COUNT + DTV_ISDBT_LAYERC_TIME_INTERLEAVING +
-
+
+ Properties used on cable delivery systems + TODO +
+
+ Properties used on satellital delivery systems + TODO +
-- cgit v1.2.3 From 3272c3ec21a28bad3f852376e48388bae55e0134 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 7 Jun 2011 21:40:22 -0300 Subject: [media] DocBook: Finish synchronizing the frontend API Remove the remaining: Error: no ID for constraint linkend: With this patch, the dvb frontend API matches the current dvb core implementation. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/Makefile | 4 ++-- Documentation/DocBook/media/dvb/dvbproperty.xml | 9 ++++++++- Documentation/DocBook/media/dvb/frontend.xml | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile index f2216b05b2d5..eb64087ac520 100644 --- a/Documentation/DocBook/media/Makefile +++ b/Documentation/DocBook/media/Makefile @@ -73,7 +73,7 @@ ENUMS = \ STRUCTS = \ $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/videodev2.h) \ - $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/frontend.h) \ + $(shell perl -ne 'print "$$1 " if (!/dtv\_cmds\_h/ && /^struct\s+([^\s]+)\s+/)' $(srctree)/include/linux/dvb/frontend.h) \ $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/media.h) \ $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-subdev.h) \ $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-mediabus.h) @@ -124,10 +124,10 @@ DVB_DOCUMENTED = \ -e "s,\(struct\s\+\)\([a-z0-9_]\+\)\(\s\+{\),\1\\2\<\/link\>\3,g" \ -e "s,\(}\s\+\)\([a-z0-9_]\+_t\+\),\1\\2\<\/link\>,g" \ -e "s,\(define\s\+\)\(DTV_[A-Z0-9_]\+\)\(\s\+[0-9]\+\),\1\\2\<\/link\>\3,g" \ + -e "s,\(DTV_IOCTL_MAX_MSGS\|dtv_cmds_h\)<\/link>,\1,g" \ -e ":a;s/\(linkend=\".*\)_\(.*\">\)/\1-\2/;ta" \ -e "s,DTV-ISDBT-LAYER[A-C],DTV-ISDBT-LAYER,g" \ -e "s,\(define\s\+\)\([A-Z0-9_]\+\)\(\s\+_IO\),\1\\2\<\/link\>\3,g" \ -# -e "s,\(\s\+\)\(FE_[A-Z0-9_]\+\)\([\s\=\,]*\),\1\\2\<\/link\>\3,g" \ # # Media targets and dependencies diff --git a/Documentation/DocBook/media/dvb/dvbproperty.xml b/Documentation/DocBook/media/dvb/dvbproperty.xml index 4c45f3c1ba79..64151bb16b1d 100644 --- a/Documentation/DocBook/media/dvb/dvbproperty.xml +++ b/Documentation/DocBook/media/dvb/dvbproperty.xml @@ -7,6 +7,8 @@ the capability ioctls weren't implemented yet via the new way. The typical usage for the FE_GET_PROPERTY/FE_SET_PROPERTY API is to replace the ioctl's were the struct dvb_frontend_parameters were used. +
+DTV property type /* Reserved fields should be set to 0 */ struct dtv_property { @@ -25,12 +27,17 @@ struct dtv_property { /* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */ #define DTV_IOCTL_MAX_MSGS 64 - + +
+
+DTV properties type + struct dtv_properties { __u32 num; struct dtv_property *props; }; +
FE_GET_PROPERTY diff --git a/Documentation/DocBook/media/dvb/frontend.xml b/Documentation/DocBook/media/dvb/frontend.xml index 086e62bcad11..1417d50518f6 100644 --- a/Documentation/DocBook/media/dvb/frontend.xml +++ b/Documentation/DocBook/media/dvb/frontend.xml @@ -140,7 +140,7 @@ a specific frontend type. };
-
+
diseqc slave reply A reply to the frontend from DiSEqC 2.0 capable equipment. -- cgit v1.2.3 From e7da0ae3c85590045da4163f3f46f2488f4cba37 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 7 Jun 2011 22:02:32 -0300 Subject: [media] DocBook/dvbproperty.xml: Add Cable standards Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/dvb/dvbproperty.xml | 38 +++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/Documentation/DocBook/media/dvb/dvbproperty.xml b/Documentation/DocBook/media/dvb/dvbproperty.xml index 64151bb16b1d..262d9957766e 100644 --- a/Documentation/DocBook/media/dvb/dvbproperty.xml +++ b/Documentation/DocBook/media/dvb/dvbproperty.xml @@ -672,6 +672,7 @@ typedef enum fe_hierarchy { The following parameters are valid for DVB-T: DTV_API_VERSION + DTV_DELIVERY_SYSTEM DTV_TUNE DTV_CLEAR DTV_FREQUENCY @@ -683,7 +684,6 @@ typedef enum fe_hierarchy { DTV_GUARD_INTERVAL DTV_TRANSMISSION_MODE DTV_HIERARCHY - DTV_DELIVERY_SYSTEM
@@ -694,6 +694,7 @@ typedef enum fe_hierarchy { The following parameters are valid for DVB-T2: DTV_API_VERSION + DTV_DELIVERY_SYSTEM DTV_TUNE DTV_CLEAR DTV_FREQUENCY @@ -705,7 +706,6 @@ typedef enum fe_hierarchy { DTV_GUARD_INTERVAL DTV_TRANSMISSION_MODE DTV_HIERARCHY - DTV_DELIVERY_SYSTEM DTV_DVBT2_PLP_ID
@@ -734,6 +734,7 @@ typedef enum fe_hierarchy { The following parameters are valid for ISDB-T: DTV_API_VERSION + DTV_DELIVERY_SYSTEM DTV_TUNE DTV_CLEAR DTV_FREQUENCY @@ -745,7 +746,6 @@ typedef enum fe_hierarchy { DTV_GUARD_INTERVAL DTV_TRANSMISSION_MODE DTV_HIERARCHY - DTV_DELIVERY_SYSTEM DTV_ISDBT_LAYER_ENABLED DTV_ISDBT_PARTIAL_RECEPTION DTV_ISDBT_SOUND_BROADCASTING @@ -768,6 +768,38 @@ typedef enum fe_hierarchy {
+
+ DVB-C delivery system + The DVB-C Annex-A/C is the widely used cable standard. Transmission uses QAM modulation. + The following parameters are valid for DVB-C Annex A/C: + + DTV_API_VERSION + DTV_DELIVERY_SYSTEM + DTV_TUNE + DTV_CLEAR + DTV_FREQUENCY + DTV_MODULATION + DTV_INVERSION + DTV_SYMBOL_RATE + DTV_INNER_FEC + +
+
+ DVB-C Annex B delivery system + The DVB-C Annex-B is only used on a few Countries like the United States. + The following parameters are valid for DVB-C Annex B: + + DTV_API_VERSION + DTV_DELIVERY_SYSTEM + DTV_TUNE + DTV_CLEAR + DTV_FREQUENCY + DTV_MODULATION + DTV_INVERSION + DTV_SYMBOL_RATE + DTV_INNER_FEC + +
Properties used on cable delivery systems TODO
-- cgit v1.2.3 From 76f9a69aae335c9496c77424dc72416feda83ac5 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 7 Jun 2011 22:08:13 -0300 Subject: [media] DocBook/dvbproperty.xml: Add ATSC standard Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/dvb/dvbproperty.xml | 15 +++++++++++++-- Documentation/DocBook/media/dvb/frontend.xml | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Documentation/DocBook/media/dvb/dvbproperty.xml b/Documentation/DocBook/media/dvb/dvbproperty.xml index 262d9957766e..9cbb289460c9 100644 --- a/Documentation/DocBook/media/dvb/dvbproperty.xml +++ b/Documentation/DocBook/media/dvb/dvbproperty.xml @@ -766,6 +766,19 @@ typedef enum fe_hierarchy { DTV_ISDBT_LAYERC_TIME_INTERLEAVING
+
+ ATSC delivery system + The following parameters are valid for ATSC: + + DTV_API_VERSION + DTV_DELIVERY_SYSTEM + DTV_TUNE + DTV_CLEAR + DTV_FREQUENCY + DTV_MODULATION + DTV_BANDWIDTH_HZ + +
@@ -796,8 +809,6 @@ typedef enum fe_hierarchy { DTV_FREQUENCY DTV_MODULATION DTV_INVERSION - DTV_SYMBOL_RATE - DTV_INNER_FEC
Properties used on cable delivery systems diff --git a/Documentation/DocBook/media/dvb/frontend.xml b/Documentation/DocBook/media/dvb/frontend.xml index 1417d50518f6..304d54ed3cbf 100644 --- a/Documentation/DocBook/media/dvb/frontend.xml +++ b/Documentation/DocBook/media/dvb/frontend.xml @@ -276,7 +276,7 @@ OFDM frontends the frequency specifies the absolute frequen
VSB parameters -DVB-T frontends are supported by the dvb_vsb_parameters structure: +ATSC frontends are supported by the dvb_vsb_parameters structure: struct dvb_vsb_parameters { fe_modulation_t modulation; /⋆ modulation type (see above) ⋆/ -- cgit v1.2.3 From ff74b8ee526c5eb72c01cb2709ac0d14e370d791 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 7 Jun 2011 22:13:35 -0300 Subject: [media] DocBook/dvbproperty.xml: Add Satellite standards Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/dvb/dvbproperty.xml | 66 +++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 5 deletions(-) diff --git a/Documentation/DocBook/media/dvb/dvbproperty.xml b/Documentation/DocBook/media/dvb/dvbproperty.xml index 9cbb289460c9..a9863a3bb8f8 100644 --- a/Documentation/DocBook/media/dvb/dvbproperty.xml +++ b/Documentation/DocBook/media/dvb/dvbproperty.xml @@ -688,8 +688,8 @@ typedef enum fe_hierarchy {
DVB-T2 delivery system - DVB-T2support is currently in the early stages - of development so expect this section to grow and become + DVB-T2 support is currently in the early stages + of development, so expect that this section maygrow and become more detailed with time. The following parameters are valid for DVB-T2: @@ -781,6 +781,7 @@ typedef enum fe_hierarchy {
+ Properties used on cable delivery systems
DVB-C delivery system The DVB-C Annex-A/C is the widely used cable standard. Transmission uses QAM modulation. @@ -811,11 +812,66 @@ typedef enum fe_hierarchy { DTV_INVERSION
- Properties used on cable delivery systems - TODO
Properties used on satellital delivery systems - TODO +
+ DVB-S delivery system + The following parameters are valid for DVB-S: + + DTV_API_VERSION + DTV_DELIVERY_SYSTEM + DTV_TUNE + DTV_CLEAR + DTV_FREQUENCY + DTV_INVERSION + DTV_SYMBOL_RATE + DTV_INNER_FEC + + Future implementations might add those two missing parameters: + + DTV_DISEQC_MASTER + DTV_DISEQC_SLAVE_REPLY + +
+
+ DVB-S2 delivery system + The following parameters are valid for DVB-S2: + + DTV_API_VERSION + DTV_DELIVERY_SYSTEM + DTV_TUNE + DTV_CLEAR + DTV_FREQUENCY + DTV_INVERSION + DTV_SYMBOL_RATE + DTV_INNER_FEC + DTV_VOLTAGE + DTV_TONE + DTV_PILOT + DTV_ROLLOFF + + Future implementations might add those two missing parameters: + + DTV_DISEQC_MASTER + DTV_DISEQC_SLAVE_REPLY + +
+
+ ISDB-S delivery system + The following parameters are valid for ISDB-S: + + DTV_API_VERSION + DTV_DELIVERY_SYSTEM + DTV_TUNE + DTV_CLEAR + DTV_FREQUENCY + DTV_INVERSION + DTV_SYMBOL_RATE + DTV_INNER_FEC + DTV_VOLTAGE + DTV_ISDBS_TS_ID + +
-- cgit v1.2.3 From 446c18fcfdd1c165e50b18c07e0ac2f4b10e5947 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 7 Jun 2011 23:08:19 -0300 Subject: [media] DocBook/dvbproperty.xml: Better name the ISDB-T layers In order to improve the DVB index, replace the title to a better name. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/dvb/dvbproperty.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/DocBook/media/dvb/dvbproperty.xml b/Documentation/DocBook/media/dvb/dvbproperty.xml index a9863a3bb8f8..caec58c60032 100644 --- a/Documentation/DocBook/media/dvb/dvbproperty.xml +++ b/Documentation/DocBook/media/dvb/dvbproperty.xml @@ -449,13 +449,14 @@ typedef enum fe_delivery_system { Note: This value cannot be determined by an automatic channel search.
- Hierarchical layers + <constant>DTV-ISDBT-LAYER*</constant> parameters ISDB-T channels can be coded hierarchically. As opposed to DVB-T in ISDB-T hierarchical layers can be decoded simultaneously. For that reason a ISDB-T demodulator has 3 viterbi and 3 reed-solomon-decoders. ISDB-T has 3 hierarchical layers which each can use a part of the available segments. The total number of segments over all layers has to 13 in ISDB-T. + There are 3 parameter sets, for Layers A, B and C.
<constant>DTV_ISDBT_LAYER_ENABLED</constant> Hierarchical reception in ISDB-T is achieved by enabling or disabling -- cgit v1.2.3 From d9d73416edfad05aa5c34255948a12c3860291f3 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 8 Jun 2011 10:23:34 -0300 Subject: [media] DocBook: Add the other DVB API header files Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/Makefile | 92 +++++++++++++++++++++++++++++- Documentation/DocBook/media/dvb/dvbapi.xml | 24 ++++++++ Documentation/DocBook/media/dvb/intro.xml | 19 +++++- 3 files changed, 133 insertions(+), 2 deletions(-) diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile index eb64087ac520..a747f2a6c2c1 100644 --- a/Documentation/DocBook/media/Makefile +++ b/Documentation/DocBook/media/Makefile @@ -11,7 +11,13 @@ MEDIA_TEMP = media-entities.tmpl \ media-indices.tmpl \ videodev2.h.xml \ v4l2.xml \ - frontend.h.xml + audio.h.xml \ + ca.h.xml \ + dmx.h.xml \ + frontend.h.xml \ + net.h.xml \ + osd.h.xml \ + video.h.xml \ IMGFILES := $(addprefix $(MEDIA_OBJ_DIR)/media/, $(notdir $(shell ls $(MEDIA_SRC_DIR)/*/*.gif $(MEDIA_SRC_DIR)/*/*.png))) GENFILES := $(addprefix $(MEDIA_OBJ_DIR)/, $(MEDIA_TEMP)) @@ -51,7 +57,13 @@ FUNCS = \ IOCTLS = \ $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/videodev2.h) \ + $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/audio.h) \ + $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/ca.h) \ + $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/dmx.h) \ $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/frontend.h) \ + $(shell perl -ne 'print "$$1 " if /\#define\s+([A-Z][^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/net.h) \ + $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/osd.h) \ + $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/video.h) \ $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/media.h) \ $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/v4l2-subdev.h) \ VIDIOC_SUBDEV_G_FRAME_INTERVAL \ @@ -66,14 +78,26 @@ TYPES = \ ENUMS = \ $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/videodev2.h) \ + $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/audio.h) \ + $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/ca.h) \ + $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/dmx.h) \ $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/frontend.h) \ + $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/net.h) \ + $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/osd.h) \ + $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/video.h) \ $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/media.h) \ $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-mediabus.h) \ $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-subdev.h) STRUCTS = \ $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/videodev2.h) \ + $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s\{]+)\s*/)' $(srctree)/include/linux/dvb/audio.h) \ + $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s]+)\s+/)' $(srctree)/include/linux/dvb/ca.h) \ + $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s]+)\s+/)' $(srctree)/include/linux/dvb/dmx.h) \ $(shell perl -ne 'print "$$1 " if (!/dtv\_cmds\_h/ && /^struct\s+([^\s]+)\s+/)' $(srctree)/include/linux/dvb/frontend.h) \ + $(shell perl -ne 'print "$$1 " if (/^struct\s+([A-Z][^\s]+)\s+/)' $(srctree)/include/linux/dvb/net.h) \ + $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s]+)\s+/)' $(srctree)/include/linux/dvb/osd.h) \ + $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s]+)\s+/)' $(srctree)/include/linux/dvb/video.h) \ $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/media.h) \ $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-subdev.h) \ $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-mediabus.h) @@ -151,6 +175,39 @@ $(MEDIA_OBJ_DIR)/videodev2.h.xml: $(srctree)/include/linux/videodev2.h $(MEDIA_O @( \ echo "") >> $@ +$(MEDIA_OBJ_DIR)/audio.h.xml: $(srctree)/include/linux/dvb/audio.h $(MEDIA_OBJ_DIR)/v4l2.xml + @$($(quiet)gen_xml) + @( \ + echo "") > $@ + @( \ + expand --tabs=8 < $< | \ + sed $(ESCAPE) $(DVB_DOCUMENTED) | \ + sed 's/i\.e\./&ie;/') >> $@ + @( \ + echo "") >> $@ + +$(MEDIA_OBJ_DIR)/ca.h.xml: $(srctree)/include/linux/dvb/ca.h $(MEDIA_OBJ_DIR)/v4l2.xml + @$($(quiet)gen_xml) + @( \ + echo "") > $@ + @( \ + expand --tabs=8 < $< | \ + sed $(ESCAPE) $(DVB_DOCUMENTED) | \ + sed 's/i\.e\./&ie;/') >> $@ + @( \ + echo "") >> $@ + +$(MEDIA_OBJ_DIR)/dmx.h.xml: $(srctree)/include/linux/dvb/dmx.h $(MEDIA_OBJ_DIR)/v4l2.xml + @$($(quiet)gen_xml) + @( \ + echo "") > $@ + @( \ + expand --tabs=8 < $< | \ + sed $(ESCAPE) $(DVB_DOCUMENTED) | \ + sed 's/i\.e\./&ie;/') >> $@ + @( \ + echo "") >> $@ + $(MEDIA_OBJ_DIR)/frontend.h.xml: $(srctree)/include/linux/dvb/frontend.h $(MEDIA_OBJ_DIR)/v4l2.xml @$($(quiet)gen_xml) @( \ @@ -162,6 +219,39 @@ $(MEDIA_OBJ_DIR)/frontend.h.xml: $(srctree)/include/linux/dvb/frontend.h $(MEDIA @( \ echo "") >> $@ +$(MEDIA_OBJ_DIR)/net.h.xml: $(srctree)/include/linux/dvb/net.h $(MEDIA_OBJ_DIR)/v4l2.xml + @$($(quiet)gen_xml) + @( \ + echo "") > $@ + @( \ + expand --tabs=8 < $< | \ + sed $(ESCAPE) $(DVB_DOCUMENTED) | \ + sed 's/i\.e\./&ie;/') >> $@ + @( \ + echo "") >> $@ + +$(MEDIA_OBJ_DIR)/osd.h.xml: $(srctree)/include/linux/dvb/osd.h $(MEDIA_OBJ_DIR)/v4l2.xml + @$($(quiet)gen_xml) + @( \ + echo "") > $@ + @( \ + expand --tabs=8 < $< | \ + sed $(ESCAPE) $(DVB_DOCUMENTED) | \ + sed 's/i\.e\./&ie;/') >> $@ + @( \ + echo "") >> $@ + +$(MEDIA_OBJ_DIR)/video.h.xml: $(srctree)/include/linux/dvb/video.h $(MEDIA_OBJ_DIR)/v4l2.xml + @$($(quiet)gen_xml) + @( \ + echo "") > $@ + @( \ + expand --tabs=8 < $< | \ + sed $(ESCAPE) $(DVB_DOCUMENTED) | \ + sed 's/i\.e\./&ie;/') >> $@ + @( \ + echo "") >> $@ + $(MEDIA_OBJ_DIR)/media-entities.tmpl: $(MEDIA_OBJ_DIR)/v4l2.xml @$($(quiet)gen_xml) @( \ diff --git a/Documentation/DocBook/media/dvb/dvbapi.xml b/Documentation/DocBook/media/dvb/dvbapi.xml index 9fad86ce7f5e..5291430dbb62 100644 --- a/Documentation/DocBook/media/dvb/dvbapi.xml +++ b/Documentation/DocBook/media/dvb/dvbapi.xml @@ -114,8 +114,32 @@ Added ISDB-T test originally written by Patrick Boettcher &sub-examples; + + DVB Audio Header File + &sub-audio-h; + + + DVB Conditional Access Header File + &sub-ca-h; + + + DVB Demux Header File + &sub-dmx-h; + DVB Frontend Header File &sub-frontend-h; + + DVB Network Header File + &sub-net-h; + + + DVB OSD Header File + &sub-osd-h; + + + DVB Video Header File + &sub-video-h; + diff --git a/Documentation/DocBook/media/dvb/intro.xml b/Documentation/DocBook/media/dvb/intro.xml index 0dc83f672ea2..82236396eef3 100644 --- a/Documentation/DocBook/media/dvb/intro.xml +++ b/Documentation/DocBook/media/dvb/intro.xml @@ -175,10 +175,27 @@ the devices are described in the following chapters. The DVB API include files should be included in application sources with a partial path like: - + + #include <linux/dvb/audio.h> + + + #include <linux/dvb/ca.h> + + + #include <linux/dvb/dmx.h> + #include <linux/dvb/frontend.h> + + #include <linux/dvb/net.h> + + + #include <linux/dvb/osd.h> + + + #include <linux/dvb/video.h> + To enable applications to support different API version, an additional include file Date: Wed, 8 Jun 2011 10:42:22 -0300 Subject: [media] DocBook/audio.xml: match section ID's with the reference links Make sure that both audio.h.xml and audio.xml will match the same names. This way, it is now possible to identify API spec gaps: Error: no ID for constraint linkend: AUDIO_CONTINUE. Error: no ID for constraint linkend: AUDIO_GET_PTS. Error: no ID for constraint linkend: AUDIO_BILINGUAL_CHANNEL_SELECT. While here, fix the cut-and-paste description error on AUDIO_SET_KARAOKE. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/Makefile | 1 + Documentation/DocBook/media/dvb/audio.xml | 52 +++++++++++++++---------------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile index a747f2a6c2c1..18604dde1b87 100644 --- a/Documentation/DocBook/media/Makefile +++ b/Documentation/DocBook/media/Makefile @@ -150,6 +150,7 @@ DVB_DOCUMENTED = \ -e "s,\(define\s\+\)\(DTV_[A-Z0-9_]\+\)\(\s\+[0-9]\+\),\1\\2\<\/link\>\3,g" \ -e "s,\(DTV_IOCTL_MAX_MSGS\|dtv_cmds_h\)<\/link>,\1,g" \ -e ":a;s/\(linkend=\".*\)_\(.*\">\)/\1-\2/;ta" \ + -e "s,\(audio-mixer\|audio-karaoke\|audio-status\)-t,\1,g" \ -e "s,DTV-ISDBT-LAYER[A-C],DTV-ISDBT-LAYER,g" \ -e "s,\(define\s\+\)\([A-Z0-9_]\+\)\(\s\+_IO\),\1\\2\<\/link\>\3,g" \ diff --git a/Documentation/DocBook/media/dvb/audio.xml b/Documentation/DocBook/media/dvb/audio.xml index eeb96b8a0864..60abf9a55d5c 100644 --- a/Documentation/DocBook/media/dvb/audio.xml +++ b/Documentation/DocBook/media/dvb/audio.xml @@ -14,7 +14,7 @@ the omission of the audio and video device. audio device. -
+
audio_stream_source_t The audio stream source is set through the AUDIO_SELECT_SOURCE call and can take the following values, depending on whether we are replaying from an internal (demux) or @@ -33,7 +33,7 @@ call.
-
+
audio_play_state_t The following values can be returned by the AUDIO_GET_STATUS call representing the state of audio playback. @@ -47,7 +47,7 @@ state of audio playback.
-
+
audio_channel_select_t The audio channel selected via AUDIO_CHANNEL_SELECT is determined by the following values. @@ -61,7 +61,7 @@ following values.
-
+
struct audio_status The AUDIO_GET_STATUS call returns the following structure informing about various states of the playback operation. @@ -78,7 +78,7 @@ states of the playback operation.
-
+
struct audio_mixer The following structure is used by the AUDIO_SET_MIXER call to set the audio volume. @@ -109,7 +109,7 @@ bits set according to the hardwares capabilities.
-
+
struct audio_karaoke The ioctl AUDIO_SET_KARAOKE uses the following format: @@ -128,7 +128,7 @@ and right.
-
+
audio attributes The following attributes can be set by a call to AUDIO_SET_ATTRIBUTES: @@ -358,7 +358,7 @@ and right. -
AUDIO_STOP DESCRIPTION @@ -409,7 +409,7 @@ role="subsection">AUDIO_STOP -
AUDIO_PLAY DESCRIPTION @@ -461,7 +461,7 @@ role="subsection">AUDIO_PLAY -
AUDIO_PAUSE DESCRIPTION @@ -521,7 +521,7 @@ role="subsection">AUDIO_PAUSE -
AUDIO_SELECT_SOURCE DESCRIPTION @@ -592,7 +592,7 @@ role="subsection">AUDIO_SELECT_SOURCE -
AUDIO_SET_MUTE DESCRIPTION @@ -671,7 +671,7 @@ role="subsection">AUDIO_SET_MUTE -
AUDIO_SET_AV_SYNC DESCRIPTION @@ -750,7 +750,7 @@ role="subsection">AUDIO_SET_AV_SYNC -
AUDIO_SET_BYPASS_MODE DESCRIPTION @@ -833,7 +833,7 @@ role="subsection">AUDIO_SET_BYPASS_MODE -
AUDIO_CHANNEL_SELECT DESCRIPTION @@ -902,7 +902,7 @@ role="subsection">AUDIO_CHANNEL_SELECT -
AUDIO_GET_STATUS DESCRIPTION @@ -970,7 +970,7 @@ role="subsection">AUDIO_GET_STATUS -
AUDIO_GET_CAPABILITIES DESCRIPTION @@ -1038,7 +1038,7 @@ role="subsection">AUDIO_GET_CAPABILITIES -
AUDIO_CLEAR_BUFFER DESCRIPTION @@ -1090,7 +1090,7 @@ role="subsection">AUDIO_CLEAR_BUFFER -
AUDIO_SET_ID DESCRIPTION @@ -1161,7 +1161,7 @@ role="subsection">AUDIO_SET_ID -
AUDIO_SET_MIXER DESCRIPTION @@ -1227,7 +1227,7 @@ role="subsection">AUDIO_SET_MIXER -
AUDIO_SET_STREAMTYPE DESCRIPTION @@ -1288,7 +1288,7 @@ role="subsection">AUDIO_SET_STREAMTYPE -
AUDIO_SET_EXT_ID DESCRIPTION @@ -1348,7 +1348,7 @@ role="subsection">AUDIO_SET_EXT_ID -
AUDIO_SET_ATTRIBUTES DESCRIPTION @@ -1409,7 +1409,7 @@ role="subsection">AUDIO_SET_ATTRIBUTES -
AUDIO_SET_KARAOKE DESCRIPTION @@ -1422,7 +1422,7 @@ role="subsection">AUDIO_SET_KARAOKE -int ioctl(fd, int request = AUDIO_SET_STREAMTYPE, +int ioctl(fd, int request = AUDIO_SET_KARAOKE, audio_karaoke_t ⋆karaoke); @@ -1440,7 +1440,7 @@ role="subsection">AUDIO_SET_KARAOKE int request -Equals AUDIO_SET_STREAMTYPE for this +Equals AUDIO_SET_KARAOKE for this command. Date: Wed, 8 Jun 2011 10:55:57 -0300 Subject: [media] DocBook/audio.xml: synchronize attribute changes Some attributes suffered some changes since DVBv1. Sync them with the current API header files. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/dvb/audio.xml | 67 ++++++++++++++++--------------- include/linux/dvb/audio.h | 2 +- 2 files changed, 36 insertions(+), 33 deletions(-) diff --git a/Documentation/DocBook/media/dvb/audio.xml b/Documentation/DocBook/media/dvb/audio.xml index 60abf9a55d5c..b3d3895544e1 100644 --- a/Documentation/DocBook/media/dvb/audio.xml +++ b/Documentation/DocBook/media/dvb/audio.xml @@ -21,10 +21,10 @@ the following values, depending on whether we are replaying from an internal (de external (user write) source. - typedef enum { - AUDIO_SOURCE_DEMUX, - AUDIO_SOURCE_MEMORY - } audio_stream_source_t; +typedef enum { + AUDIO_SOURCE_DEMUX, + AUDIO_SOURCE_MEMORY +} audio_stream_source_t; AUDIO_SOURCE_DEMUX selects the demultiplexer (fed either by the frontend or the DVR device) as the source of the video stream. If AUDIO_SOURCE_MEMORY @@ -39,11 +39,11 @@ call. state of audio playback. - typedef enum { - AUDIO_STOPPED, - AUDIO_PLAYING, - AUDIO_PAUSED - } audio_play_state_t; +typedef enum { + AUDIO_STOPPED, + AUDIO_PLAYING, + AUDIO_PAUSED +} audio_play_state_t;
@@ -53,11 +53,13 @@ state of audio playback. following values. - typedef enum { - AUDIO_STEREO, - AUDIO_MONO_LEFT, - AUDIO_MONO_RIGHT, - } audio_channel_select_t; +typedef enum { + AUDIO_STEREO, + AUDIO_MONO_LEFT, + AUDIO_MONO_RIGHT, + AUDIO_MONO, + AUDIO_STEREO_SWAPPED +} audio_channel_select_t;
@@ -67,14 +69,15 @@ following values. states of the playback operation. - typedef struct audio_status { - boolean AV_sync_state; - boolean mute_state; - audio_play_state_t play_state; - audio_stream_source_t stream_source; - audio_channel_select_t channel_select; - boolean bypass_mode; - } audio_status_t; +typedef struct audio_status { + boolean AV_sync_state; + boolean mute_state; + audio_play_state_t play_state; + audio_stream_source_t stream_source; + audio_channel_select_t channel_select; + boolean bypass_mode; + audio_mixer_t mixer_state; +} audio_status_t;
@@ -84,10 +87,10 @@ states of the playback operation. volume. - typedef struct audio_mixer { - unsigned int volume_left; - unsigned int volume_right; - } audio_mixer_t; +typedef struct audio_mixer { + unsigned int volume_left; + unsigned int volume_right; +} audio_mixer_t;
@@ -114,12 +117,12 @@ bits set according to the hardwares capabilities. The ioctl AUDIO_SET_KARAOKE uses the following format: - typedef - struct audio_karaoke{ - int vocal1; - int vocal2; - int melody; - } audio_karaoke_t; +typedef +struct audio_karaoke { + int vocal1; + int vocal2; + int melody; +} audio_karaoke_t; If Vocal1 or Vocal2 are non-zero, they get mixed into left and right t at 70% each. If both, Vocal1 and Vocal2 are non-zero, Vocal1 gets mixed into the left channel and Vocal2 into the diff --git a/include/linux/dvb/audio.h b/include/linux/dvb/audio.h index fec66bd24f22..d47bccd604e4 100644 --- a/include/linux/dvb/audio.h +++ b/include/linux/dvb/audio.h @@ -67,7 +67,7 @@ typedef struct audio_status { typedef -struct audio_karaoke{ /* if Vocal1 or Vocal2 are non-zero, they get mixed */ +struct audio_karaoke { /* if Vocal1 or Vocal2 are non-zero, they get mixed */ int vocal1; /* into left and right t at 70% each */ int vocal2; /* if both, Vocal1 and Vocal2 are non-zero, Vocal1 gets*/ int melody; /* mixed into the left channel and */ -- cgit v1.2.3 From a2eb7c020008d664823323aba9fb428fdccc8ba6 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 8 Jun 2011 11:03:10 -0300 Subject: [media] DocBook: Document AUDIO_CONTINUE ioctl Although this ioctl is only used at the av7110 driver, it is not described at the API docbook. Yet, AUDIO_PAUSE ioctl description somewhat describes it. Fill the gap by using the information there and by looking inside av7110 implementation. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/dvb/audio.xml | 57 +++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/Documentation/DocBook/media/dvb/audio.xml b/Documentation/DocBook/media/dvb/audio.xml index b3d3895544e1..c27fe73a4b66 100644 --- a/Documentation/DocBook/media/dvb/audio.xml +++ b/Documentation/DocBook/media/dvb/audio.xml @@ -524,6 +524,63 @@ role="subsection">AUDIO_PAUSE + +
AUDIO_CONTINUE +DESCRIPTION + + +This ioctl restarts the decoding and playing process previously paused +with AUDIO_PAUSE command. + + +It only works if the stream were previously stopped with AUDIO_PAUSE + + +SYNOPSIS + + +int ioctl(int fd, int request = AUDIO_CONTINUE); + + +PARAMETERS + + +int fd + +File descriptor returned by a previous call to open(). + + +int request + +Equals AUDIO_CONTINUE for this command. + + +ERRORS + + +EBADF + +fd is not a valid open file descriptor. + + +EINTERNAL + +Internal error. + + +
AUDIO_SELECT_SOURCE DESCRIPTION -- cgit v1.2.3 From fa24198897ff0e8d34876be0e61f9b35d3c0d467 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 8 Jun 2011 11:25:26 -0300 Subject: [media] dvb/audio.h: Remove definition for AUDIO_GET_PTS While this ioctl is defined inside dvb/audio.h, it is not docummented at the API specs, nor implemented on any driver inside the Linux Kernel. So, it doesn't make sense to keep it here. As this is not used anywere, removing it is not a regression. So, there's no need to use the normal features-to-be-removed process. Signed-off-by: Mauro Carvalho Chehab --- include/linux/dvb/audio.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/include/linux/dvb/audio.h b/include/linux/dvb/audio.h index d47bccd604e4..c1b35550899a 100644 --- a/include/linux/dvb/audio.h +++ b/include/linux/dvb/audio.h @@ -118,18 +118,6 @@ typedef __u16 audio_attributes_t; #define AUDIO_SET_ATTRIBUTES _IOW('o', 17, audio_attributes_t) #define AUDIO_SET_KARAOKE _IOW('o', 18, audio_karaoke_t) -/** - * AUDIO_GET_PTS - * - * Read the 33 bit presentation time stamp as defined - * in ITU T-REC-H.222.0 / ISO/IEC 13818-1. - * - * The PTS should belong to the currently played - * frame if possible, but may also be a value close to it - * like the PTS of the last decoded frame or the last PTS - * extracted by the PES parser. - */ -#define AUDIO_GET_PTS _IOR('o', 19, __u64) #define AUDIO_BILINGUAL_CHANNEL_SELECT _IO('o', 20) #endif /* _DVBAUDIO_H_ */ -- cgit v1.2.3 From 2b680d1b4e7e0c561d1523d5155212705fcbb10a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 8 Jun 2011 11:29:27 -0300 Subject: [media] Docbook/ca.xml: match section ID's with the reference links Make sure that both ca.h.xml and ca.xml will match the same names for the sections/links. This way, it is now possible to identify API spec gaps: Error: no ID for constraint linkend: ca-pid. Error: no ID for constraint linkend: ca-pid. Error: no ID for constraint linkend: CA_RESET. Error: no ID for constraint linkend: CA_GET_CAP. Error: no ID for constraint linkend: CA_GET_SLOT_INFO. Error: no ID for constraint linkend: CA_GET_DESCR_INFO. Error: no ID for constraint linkend: CA_GET_MSG. Error: no ID for constraint linkend: CA_SEND_MSG. Error: no ID for constraint linkend: CA_SET_DESCR. Error: no ID for constraint linkend: CA_SET_PID. Basically, in this case, no CA ioctl is described at the specs, and one file structure (ca-pid) is missing. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/Makefile | 2 +- Documentation/DocBook/media/dvb/ca.xml | 93 +++++++++++++++++----------------- 2 files changed, 47 insertions(+), 48 deletions(-) diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile index 18604dde1b87..249edd353968 100644 --- a/Documentation/DocBook/media/Makefile +++ b/Documentation/DocBook/media/Makefile @@ -150,7 +150,7 @@ DVB_DOCUMENTED = \ -e "s,\(define\s\+\)\(DTV_[A-Z0-9_]\+\)\(\s\+[0-9]\+\),\1\\2\<\/link\>\3,g" \ -e "s,\(DTV_IOCTL_MAX_MSGS\|dtv_cmds_h\)<\/link>,\1,g" \ -e ":a;s/\(linkend=\".*\)_\(.*\">\)/\1-\2/;ta" \ - -e "s,\(audio-mixer\|audio-karaoke\|audio-status\)-t,\1,g" \ + -e "s,\(audio-mixer\|audio-karaoke\|audio-status\|ca-slot-info\|ca-descr-info\|ca-caps\|ca-msg\|ca-descr\|ca-pid\)-t,\1,g" \ -e "s,DTV-ISDBT-LAYER[A-C],DTV-ISDBT-LAYER,g" \ -e "s,\(define\s\+\)\([A-Z0-9_]\+\)\(\s\+_IO\),\1\\2\<\/link\>\3,g" \ diff --git a/Documentation/DocBook/media/dvb/ca.xml b/Documentation/DocBook/media/dvb/ca.xml index b1f1d2fad654..143ec5bf6bd3 100644 --- a/Documentation/DocBook/media/dvb/ca.xml +++ b/Documentation/DocBook/media/dvb/ca.xml @@ -8,73 +8,72 @@ including linux/dvb/ca.h in your application. CA Data Types -
+
ca_slot_info_t - /⋆ slot interface types and info ⋆/ +typedef struct ca_slot_info { + int num; /⋆ slot number ⋆/ - typedef struct ca_slot_info_s { - int num; /⋆ slot number ⋆/ + int type; /⋆ CA interface this slot supports ⋆/ +#define CA_CI 1 /⋆ CI high level interface ⋆/ +#define CA_CI_LINK 2 /⋆ CI link layer level interface ⋆/ +#define CA_CI_PHYS 4 /⋆ CI physical layer level interface ⋆/ +#define CA_DESCR 8 /⋆ built-in descrambler ⋆/ +#define CA_SC 128 /⋆ simple smart card interface ⋆/ - int type; /⋆ CA interface this slot supports ⋆/ - #define CA_CI 1 /⋆ CI high level interface ⋆/ - #define CA_CI_LINK 2 /⋆ CI link layer level interface ⋆/ - #define CA_CI_PHYS 4 /⋆ CI physical layer level interface ⋆/ - #define CA_SC 128 /⋆ simple smart card interface ⋆/ - - unsigned int flags; - #define CA_CI_MODULE_PRESENT 1 /⋆ module (or card) inserted ⋆/ - #define CA_CI_MODULE_READY 2 - } ca_slot_info_t; + unsigned int flags; +#define CA_CI_MODULE_PRESENT 1 /⋆ module (or card) inserted ⋆/ +#define CA_CI_MODULE_READY 2 +} ca_slot_info_t;
-
+
ca_descr_info_t - - typedef struct ca_descr_info_s { - unsigned int num; /⋆ number of available descramblers (keys) ⋆/ - unsigned int type; /⋆ type of supported scrambling system ⋆/ - #define CA_ECD 1 - #define CA_NDS 2 - #define CA_DSS 4 - } ca_descr_info_t; + +typedef struct ca_descr_info { + unsigned int num; /⋆ number of available descramblers (keys) ⋆/ + unsigned int type; /⋆ type of supported scrambling system ⋆/ +#define CA_ECD 1 +#define CA_NDS 2 +#define CA_DSS 4 +} ca_descr_info_t;
-
-ca_cap_t - - typedef struct ca_cap_s { - unsigned int slot_num; /⋆ total number of CA card and module slots ⋆/ - unsigned int slot_type; /⋆ OR of all supported types ⋆/ - unsigned int descr_num; /⋆ total number of descrambler slots (keys) ⋆/ - unsigned int descr_type;/⋆ OR of all supported types ⋆/ +
+ca_caps_t + +typedef struct ca_cap_s { + unsigned int slot_num; /⋆ total number of CA card and module slots ⋆/ + unsigned int slot_type; /⋆ OR of all supported types ⋆/ + unsigned int descr_num; /⋆ total number of descrambler slots (keys) ⋆/ + unsigned int descr_type;/⋆ OR of all supported types ⋆/ } ca_cap_t;
-
+
ca_msg_t - - /⋆ a message to/from a CI-CAM ⋆/ - typedef struct ca_msg_s { - unsigned int index; - unsigned int type; - unsigned int length; - unsigned char msg[256]; - } ca_msg_t; + +/⋆ a message to/from a CI-CAM ⋆/ +typedef struct ca_msg { + unsigned int index; + unsigned int type; + unsigned int length; + unsigned char msg[256]; +} ca_msg_t;
-
+
ca_descr_t - - typedef struct ca_descr_s { - unsigned int index; - unsigned int parity; - unsigned char cw[8]; - } ca_descr_t; + +typedef struct ca_descr { + unsigned int index; + unsigned int parity; + unsigned char cw[8]; +} ca_descr_t;
-- cgit v1.2.3 From cde291dfd7df3f7202078afcf27e9bb21ea76d0c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 8 Jun 2011 11:34:31 -0300 Subject: [media] DocBook/ca.xml: Describe structure ca_pid This is the remaining missing structure at ca.xml. The ioctl's are still missing through. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/dvb/ca.xml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Documentation/DocBook/media/dvb/ca.xml b/Documentation/DocBook/media/dvb/ca.xml index 143ec5bf6bd3..a6cb9522f289 100644 --- a/Documentation/DocBook/media/dvb/ca.xml +++ b/Documentation/DocBook/media/dvb/ca.xml @@ -44,7 +44,7 @@ typedef struct ca_descr_info {
ca_caps_t -typedef struct ca_cap_s { +typedef struct ca_caps { unsigned int slot_num; /⋆ total number of CA card and module slots ⋆/ unsigned int slot_type; /⋆ OR of all supported types ⋆/ unsigned int descr_num; /⋆ total number of descrambler slots (keys) ⋆/ @@ -75,7 +75,18 @@ typedef struct ca_descr { unsigned char cw[8]; } ca_descr_t; -
+
+ +
+ca-pid + +typedef struct ca_pid { + unsigned int pid; + int index; /⋆ -1 == disable⋆/ +} ca_pid_t; + +
+
CA Function Calls -- cgit v1.2.3 From fb029093e7408efa177e80444199746638c7d79d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 8 Jun 2011 11:56:57 -0300 Subject: [media] DocBook/demux.xml: Fix section references with dmx.h.xml Make the reference links at dmx.h.xml to match the ones at demux.xml. While here, also syncronizes the structures defined inside the API, in order to match the current API. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/Makefile | 2 +- Documentation/DocBook/media/dvb/demux.xml | 177 +++++++++++++++--------------- 2 files changed, 91 insertions(+), 88 deletions(-) diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile index 249edd353968..0b055ad411c8 100644 --- a/Documentation/DocBook/media/Makefile +++ b/Documentation/DocBook/media/Makefile @@ -150,7 +150,7 @@ DVB_DOCUMENTED = \ -e "s,\(define\s\+\)\(DTV_[A-Z0-9_]\+\)\(\s\+[0-9]\+\),\1\\2\<\/link\>\3,g" \ -e "s,\(DTV_IOCTL_MAX_MSGS\|dtv_cmds_h\)<\/link>,\1,g" \ -e ":a;s/\(linkend=\".*\)_\(.*\">\)/\1-\2/;ta" \ - -e "s,\(audio-mixer\|audio-karaoke\|audio-status\|ca-slot-info\|ca-descr-info\|ca-caps\|ca-msg\|ca-descr\|ca-pid\)-t,\1,g" \ + -e "s,\(audio-mixer\|audio-karaoke\|audio-status\|ca-slot-info\|ca-descr-info\|ca-caps\|ca-msg\|ca-descr\|ca-pid\|dmx-filter\|dmx-caps\)-t,\1,g" \ -e "s,DTV-ISDBT-LAYER[A-C],DTV-ISDBT-LAYER,g" \ -e "s,\(define\s\+\)\([A-Z0-9_]\+\)\(\s\+_IO\),\1\\2\<\/link\>\3,g" \ diff --git a/Documentation/DocBook/media/dvb/demux.xml b/Documentation/DocBook/media/dvb/demux.xml index 1b8c4e9835b9..a297f0aadd0a 100644 --- a/Documentation/DocBook/media/dvb/demux.xml +++ b/Documentation/DocBook/media/dvb/demux.xml @@ -7,15 +7,19 @@ accessed by including linux/dvb/dmx.h in your app
Demux Data Types -
+
dmx_output_t - - typedef enum - { - DMX_OUT_DECODER, - DMX_OUT_TAP, - DMX_OUT_TS_TAP - } dmx_output_t; + +typedef enum +{ + DMX_OUT_DECODER, /⋆ Streaming directly to decoder. ⋆/ + DMX_OUT_TAP, /⋆ Output going to a memory buffer ⋆/ + /⋆ (to be retrieved via the read command).⋆/ + DMX_OUT_TS_TAP, /⋆ Output multiplexed into a new TS ⋆/ + /⋆ (to be retrieved by reading from the ⋆/ + /⋆ logical DVR device). ⋆/ + DMX_OUT_TSDEMUX_TAP /⋆ Like TS_TAP but retrieved from the DMX device ⋆/ +} dmx_output_t; DMX_OUT_TAP delivers the stream output to the demux device on which the ioctl is called. @@ -26,96 +30,95 @@ specified.
-
+
dmx_input_t - - typedef enum - { - DMX_IN_FRONTEND, - DMX_IN_DVR - } dmx_input_t; + +typedef enum +{ + DMX_IN_FRONTEND, /⋆ Input from a front-end device. ⋆/ + DMX_IN_DVR /⋆ Input from the logical DVR device. ⋆/ +} dmx_input_t;
-
+
dmx_pes_type_t - - typedef enum - { - DMX_PES_AUDIO, - DMX_PES_VIDEO, - DMX_PES_TELETEXT, - DMX_PES_SUBTITLE, - DMX_PES_PCR, - DMX_PES_OTHER - } dmx_pes_type_t; - -
+ +typedef enum +{ + DMX_PES_AUDIO0, + DMX_PES_VIDEO0, + DMX_PES_TELETEXT0, + DMX_PES_SUBTITLE0, + DMX_PES_PCR0, -
-dmx_event_t - - typedef enum - { - DMX_SCRAMBLING_EV, - DMX_FRONTEND_EV - } dmx_event_t; - -
+ DMX_PES_AUDIO1, + DMX_PES_VIDEO1, + DMX_PES_TELETEXT1, + DMX_PES_SUBTITLE1, + DMX_PES_PCR1, -
-dmx_scrambling_status_t - - typedef enum - { - DMX_SCRAMBLING_OFF, - DMX_SCRAMBLING_ON - } dmx_scrambling_status_t; + DMX_PES_AUDIO2, + DMX_PES_VIDEO2, + DMX_PES_TELETEXT2, + DMX_PES_SUBTITLE2, + DMX_PES_PCR2, + + DMX_PES_AUDIO3, + DMX_PES_VIDEO3, + DMX_PES_TELETEXT3, + DMX_PES_SUBTITLE3, + DMX_PES_PCR3, + + DMX_PES_OTHER +} dmx_pes_type_t;
-
+
struct dmx_filter typedef struct dmx_filter - { - uint8_t filter[DMX_FILTER_SIZE]; - uint8_t mask[DMX_FILTER_SIZE]; - } dmx_filter_t; +{ + __u8 filter[DMX_FILTER_SIZE]; + __u8 mask[DMX_FILTER_SIZE]; + __u8 mode[DMX_FILTER_SIZE]; +} dmx_filter_t;
-
+
struct dmx_sct_filter_params - - struct dmx_sct_filter_params - { - uint16_t pid; - dmx_filter_t filter; - uint32_t timeout; - uint32_t flags; - #define DMX_CHECK_CRC 1 - #define DMX_ONESHOT 2 - #define DMX_IMMEDIATE_START 4 - }; + +struct dmx_sct_filter_params +{ + __u16 pid; + dmx_filter_t filter; + __u32 timeout; + __u32 flags; +#define DMX_CHECK_CRC 1 +#define DMX_ONESHOT 2 +#define DMX_IMMEDIATE_START 4 +#define DMX_KERNEL_CLIENT 0x8000 +};
-
+
struct dmx_pes_filter_params - - struct dmx_pes_filter_params - { - uint16_t pid; - dmx_input_t input; - dmx_output_t output; - dmx_pes_type_t pes_type; - uint32_t flags; - }; + +struct dmx_pes_filter_params +{ + __u16 pid; + dmx_input_t input; + dmx_output_t output; + dmx_pes_type_t pes_type; + __u32 flags; +};
-
+
struct dmx_event struct dmx_event @@ -130,14 +133,14 @@ specified.
-
+
struct dmx_stc - struct dmx_stc { - unsigned int num; /⋆ input : which STC? 0..N ⋆/ - unsigned int base; /⋆ output: divisor for stc to get 90 kHz clock ⋆/ - uint64_t stc; /⋆ output: stc in 'base'⋆90 kHz units ⋆/ - }; +struct dmx_stc { + unsigned int num; /⋆ input : which STC? 0..N ⋆/ + unsigned int base; /⋆ output: divisor for stc to get 90 kHz clock ⋆/ + __u64 stc; /⋆ output: stc in 'base'⋆90 kHz units ⋆/ +};
@@ -491,7 +494,7 @@ specified.
-
+
DMX_START DESCRIPTION @@ -556,7 +559,7 @@ specified.
-
+
DMX_STOP DESCRIPTION @@ -603,7 +606,7 @@ specified.
-
+
DMX_SET_FILTER DESCRIPTION @@ -673,7 +676,7 @@ specified.
-
+
DMX_SET_PES_FILTER DESCRIPTION @@ -756,7 +759,7 @@ specified.
-
+
DMX_SET_BUFFER_SIZE DESCRIPTION @@ -819,7 +822,7 @@ specified.
-
+
DMX_GET_EVENT DESCRIPTION @@ -899,7 +902,7 @@ specified.
-
+
DMX_GET_STC DESCRIPTION -- cgit v1.2.3 From ab94782213835f90f5def384ee75e171c0bfd100 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 8 Jun 2011 14:14:31 -0300 Subject: [media] DocBook/demux.xml: Add the remaining data structures to the API spec Still, there are a few ioctl's not documented: Error: no ID for constraint linkend: DMX_GET_PES_PIDS. Error: no ID for constraint linkend: DMX_GET_CAPS. Error: no ID for constraint linkend: DMX_SET_SOURCE. Error: no ID for constraint linkend: DMX_ADD_PID. Error: no ID for constraint linkend: DMX_REMOVE_PID. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/dvb/demux.xml | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/Documentation/DocBook/media/dvb/demux.xml b/Documentation/DocBook/media/dvb/demux.xml index a297f0aadd0a..6758739cd611 100644 --- a/Documentation/DocBook/media/dvb/demux.xml +++ b/Documentation/DocBook/media/dvb/demux.xml @@ -135,17 +135,42 @@ struct dmx_pes_filter_params
struct dmx_stc - + struct dmx_stc { unsigned int num; /⋆ input : which STC? 0..N ⋆/ unsigned int base; /⋆ output: divisor for stc to get 90 kHz clock ⋆/ __u64 stc; /⋆ output: stc in 'base'⋆90 kHz units ⋆/ }; -
+
+ +
+struct dmx_caps + + typedef struct dmx_caps { + __u32 caps; + int num_decoders; +} dmx_caps_t; + +
+
+enum dmx_source_t + +typedef enum { + DMX_SOURCE_FRONT0 = 0, + DMX_SOURCE_FRONT1, + DMX_SOURCE_FRONT2, + DMX_SOURCE_FRONT3, + DMX_SOURCE_DVR0 = 16, + DMX_SOURCE_DVR1, + DMX_SOURCE_DVR2, + DMX_SOURCE_DVR3 +} dmx_source_t; +
+
Demux Function Calls -- cgit v1.2.3 From ca5b2339c8a1311b6475cb679a62380bc22b48e7 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 8 Jun 2011 15:08:57 -0300 Subject: [media] DocBook/net.xml: Synchronize Network data structure There's no documentation at all for the DVB net API. Still, better to remove a few warnings about the missing symbols. So, add the net data structure inside the net.xml. Now, only the ioctl documentation is missed. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/Makefile | 3 ++- Documentation/DocBook/media/dvb/net.xml | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile index 0b055ad411c8..ab312545619a 100644 --- a/Documentation/DocBook/media/Makefile +++ b/Documentation/DocBook/media/Makefile @@ -148,11 +148,12 @@ DVB_DOCUMENTED = \ -e "s,\(struct\s\+\)\([a-z0-9_]\+\)\(\s\+{\),\1\\2\<\/link\>\3,g" \ -e "s,\(}\s\+\)\([a-z0-9_]\+_t\+\),\1\\2\<\/link\>,g" \ -e "s,\(define\s\+\)\(DTV_[A-Z0-9_]\+\)\(\s\+[0-9]\+\),\1\\2\<\/link\>\3,g" \ - -e "s,\(DTV_IOCTL_MAX_MSGS\|dtv_cmds_h\)<\/link>,\1,g" \ + -e "s,\(DTV_IOCTL_MAX_MSGS\|dtv_cmds_h\|__.*_old\)<\/link>,\1,g" \ -e ":a;s/\(linkend=\".*\)_\(.*\">\)/\1-\2/;ta" \ -e "s,\(audio-mixer\|audio-karaoke\|audio-status\|ca-slot-info\|ca-descr-info\|ca-caps\|ca-msg\|ca-descr\|ca-pid\|dmx-filter\|dmx-caps\)-t,\1,g" \ -e "s,DTV-ISDBT-LAYER[A-C],DTV-ISDBT-LAYER,g" \ -e "s,\(define\s\+\)\([A-Z0-9_]\+\)\(\s\+_IO\),\1\\2\<\/link\>\3,g" \ + -e "s,\(__.*_OLD\)<\/link>,\1,g" \ # # Media targets and dependencies diff --git a/Documentation/DocBook/media/dvb/net.xml b/Documentation/DocBook/media/dvb/net.xml index 94e388d94c0d..67d37e5ce597 100644 --- a/Documentation/DocBook/media/dvb/net.xml +++ b/Documentation/DocBook/media/dvb/net.xml @@ -7,6 +7,23 @@ application.
DVB Net Data Types + +
+struct dvb_net_if + +struct dvb_net_if { + __u16 pid; + __u16 if_num; + __u8 feedtype; +#define DVB_NET_FEEDTYPE_MPE 0 /⋆ multi protocol encapsulation ⋆/ +#define DVB_NET_FEEDTYPE_ULE 1 /⋆ ultra lightweight encapsulation ⋆/ +}; + +
+ +
+
+DVB net Function Calls To be written…
-- cgit v1.2.3 From ec77f15caef3f45a6ebc86a569376eb94a94fb03 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 8 Jun 2011 15:17:12 -0300 Subject: [media] DocBook/Makefile: Remove osd.h header The av7110 uses an OSD API. Such API is not documented at all. Also, the osd.h API uses camelCase and some other weird stuff. Also, dvb-core doesn't recognize it. I don't see any good reason why we should document it. It seems better to just let it as-is. If ever needed, it is probably better to write a different API for dvb-core. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/Makefile | 15 --------------- Documentation/DocBook/media/dvb/dvbapi.xml | 4 ---- 2 files changed, 19 deletions(-) diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile index ab312545619a..a914eb094cd9 100644 --- a/Documentation/DocBook/media/Makefile +++ b/Documentation/DocBook/media/Makefile @@ -16,7 +16,6 @@ MEDIA_TEMP = media-entities.tmpl \ dmx.h.xml \ frontend.h.xml \ net.h.xml \ - osd.h.xml \ video.h.xml \ IMGFILES := $(addprefix $(MEDIA_OBJ_DIR)/media/, $(notdir $(shell ls $(MEDIA_SRC_DIR)/*/*.gif $(MEDIA_SRC_DIR)/*/*.png))) @@ -62,7 +61,6 @@ IOCTLS = \ $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/dmx.h) \ $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/frontend.h) \ $(shell perl -ne 'print "$$1 " if /\#define\s+([A-Z][^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/net.h) \ - $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/osd.h) \ $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/video.h) \ $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/media.h) \ $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/v4l2-subdev.h) \ @@ -83,7 +81,6 @@ ENUMS = \ $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/dmx.h) \ $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/frontend.h) \ $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/net.h) \ - $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/osd.h) \ $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/video.h) \ $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/media.h) \ $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-mediabus.h) \ @@ -96,7 +93,6 @@ STRUCTS = \ $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s]+)\s+/)' $(srctree)/include/linux/dvb/dmx.h) \ $(shell perl -ne 'print "$$1 " if (!/dtv\_cmds\_h/ && /^struct\s+([^\s]+)\s+/)' $(srctree)/include/linux/dvb/frontend.h) \ $(shell perl -ne 'print "$$1 " if (/^struct\s+([A-Z][^\s]+)\s+/)' $(srctree)/include/linux/dvb/net.h) \ - $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s]+)\s+/)' $(srctree)/include/linux/dvb/osd.h) \ $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s]+)\s+/)' $(srctree)/include/linux/dvb/video.h) \ $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/media.h) \ $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-subdev.h) \ @@ -232,17 +228,6 @@ $(MEDIA_OBJ_DIR)/net.h.xml: $(srctree)/include/linux/dvb/net.h $(MEDIA_OBJ_DIR)/ @( \ echo "") >> $@ -$(MEDIA_OBJ_DIR)/osd.h.xml: $(srctree)/include/linux/dvb/osd.h $(MEDIA_OBJ_DIR)/v4l2.xml - @$($(quiet)gen_xml) - @( \ - echo "") > $@ - @( \ - expand --tabs=8 < $< | \ - sed $(ESCAPE) $(DVB_DOCUMENTED) | \ - sed 's/i\.e\./&ie;/') >> $@ - @( \ - echo "") >> $@ - $(MEDIA_OBJ_DIR)/video.h.xml: $(srctree)/include/linux/dvb/video.h $(MEDIA_OBJ_DIR)/v4l2.xml @$($(quiet)gen_xml) @( \ diff --git a/Documentation/DocBook/media/dvb/dvbapi.xml b/Documentation/DocBook/media/dvb/dvbapi.xml index 5291430dbb62..2ab6ddcfc4e0 100644 --- a/Documentation/DocBook/media/dvb/dvbapi.xml +++ b/Documentation/DocBook/media/dvb/dvbapi.xml @@ -134,10 +134,6 @@ Added ISDB-T test originally written by Patrick Boettcher DVB Network Header File &sub-net-h; - - DVB OSD Header File - &sub-osd-h; - DVB Video Header File &sub-video-h; -- cgit v1.2.3 From dc05e571725a5a609a29bd84bd020263728ed5e4 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 8 Jun 2011 15:39:05 -0300 Subject: [media] DocBook/video.xml: Fix section references with video.h.xml Make the reference links at video.h.xml to match the ones at video.xml. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/Makefile | 2 +- Documentation/DocBook/media/dvb/video.xml | 175 ++++++++++++++++-------------- 2 files changed, 93 insertions(+), 84 deletions(-) diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile index a914eb094cd9..1e909c28299e 100644 --- a/Documentation/DocBook/media/Makefile +++ b/Documentation/DocBook/media/Makefile @@ -146,7 +146,7 @@ DVB_DOCUMENTED = \ -e "s,\(define\s\+\)\(DTV_[A-Z0-9_]\+\)\(\s\+[0-9]\+\),\1\\2\<\/link\>\3,g" \ -e "s,\(DTV_IOCTL_MAX_MSGS\|dtv_cmds_h\|__.*_old\)<\/link>,\1,g" \ -e ":a;s/\(linkend=\".*\)_\(.*\">\)/\1-\2/;ta" \ - -e "s,\(audio-mixer\|audio-karaoke\|audio-status\|ca-slot-info\|ca-descr-info\|ca-caps\|ca-msg\|ca-descr\|ca-pid\|dmx-filter\|dmx-caps\)-t,\1,g" \ + -e "s,\(audio-mixer\|audio-karaoke\|audio-status\|ca-slot-info\|ca-descr-info\|ca-caps\|ca-msg\|ca-descr\|ca-pid\|dmx-filter\|dmx-caps\|video-system\|video-highlight\|video-spu\|video-spu-palette\|video-navi-pack\)-t,\1,g" \ -e "s,DTV-ISDBT-LAYER[A-C],DTV-ISDBT-LAYER,g" \ -e "s,\(define\s\+\)\([A-Z0-9_]\+\)\(\s\+_IO\),\1\\2\<\/link\>\3,g" \ -e "s,\(__.*_OLD\)<\/link>,\1,g" \ diff --git a/Documentation/DocBook/media/dvb/video.xml b/Documentation/DocBook/media/dvb/video.xml index 7bb287e67c8e..ef30f69edf22 100644 --- a/Documentation/DocBook/media/dvb/video.xml +++ b/Documentation/DocBook/media/dvb/video.xml @@ -18,15 +18,16 @@ supported on some MPEG decoders made for DVD playback.
Video Data Types -
+
video_format_t The video_format_t data type defined by - typedef enum { - VIDEO_FORMAT_4_3, - VIDEO_FORMAT_16_9 - } video_format_t; +typedef enum { + VIDEO_FORMAT_4_3, /⋆ Select 4:3 format ⋆/ + VIDEO_FORMAT_16_9, /⋆ Select 16:9 format. ⋆/ + VIDEO_FORMAT_221_1 /⋆ 2.21:1 ⋆/ +} video_format_t; is used in the VIDEO_SET_FORMAT function (??) to tell the driver which aspect ratio the output hardware (e.g. TV) has. It is also used in the data structures video_status @@ -36,34 +37,36 @@ stream.
-
+
video_display_format_t In case the display format of the video stream and of the display hardware differ the application has to specify how to handle the cropping of the picture. This can be done using the VIDEO_SET_DISPLAY_FORMAT call (??) which accepts - typedef enum { - VIDEO_PAN_SCAN, - VIDEO_LETTER_BOX, - VIDEO_CENTER_CUT_OUT - } video_display_format_t; +typedef enum { + VIDEO_PAN_SCAN, /⋆ use pan and scan format ⋆/ + VIDEO_LETTER_BOX, /⋆ use letterbox format ⋆/ + VIDEO_CENTER_CUT_OUT /⋆ use center cut out format ⋆/ +} video_displayformat_t; as argument.
-
+
video stream source The video stream source is set through the VIDEO_SELECT_SOURCE call and can take the following values, depending on whether we are replaying from an internal (demuxer) or external (user write) source. - typedef enum { - VIDEO_SOURCE_DEMUX, - VIDEO_SOURCE_MEMORY - } video_stream_source_t; +typedef enum { + VIDEO_SOURCE_DEMUX, /⋆ Select the demux as the main source ⋆/ + VIDEO_SOURCE_MEMORY /⋆ If this source is selected, the stream + comes from the user through the write + system call ⋆/ +} video_stream_source_t; VIDEO_SOURCE_DEMUX selects the demultiplexer (fed either by the frontend or the DVR device) as the source of the video stream. If VIDEO_SOURCE_MEMORY @@ -72,49 +75,55 @@ call.
-
+
video play state The following values can be returned by the VIDEO_GET_STATUS call representing the state of video playback. - typedef enum { - VIDEO_STOPPED, - VIDEO_PLAYING, - VIDEO_FREEZED - } video_play_state_t; +typedef enum { + VIDEO_STOPPED, /⋆ Video is stopped ⋆/ + VIDEO_PLAYING, /⋆ Video is currently playing ⋆/ + VIDEO_FREEZED /⋆ Video is freezed ⋆/ +} video_play_state_t;
-
+
struct video_event The following is the structure of a video event as it is returned by the VIDEO_GET_EVENT call. - struct video_event { - int32_t type; - time_t timestamp; - union { - video_format_t video_format; - } u; - }; +struct video_event { + __s32 type; +#define VIDEO_EVENT_SIZE_CHANGED 1 +#define VIDEO_EVENT_FRAME_RATE_CHANGED 2 +#define VIDEO_EVENT_DECODER_STOPPED 3 +#define VIDEO_EVENT_VSYNC 4 + __kernel_time_t timestamp; + union { + video_size_t size; + unsigned int frame_rate; /⋆ in frames per 1000sec ⋆/ + unsigned char vsync_field; /⋆ unknown/odd/even/progressive ⋆/ + } u; +};
-
+
struct video_status The VIDEO_GET_STATUS call returns the following structure informing about various states of the playback operation. - struct video_status { - boolean video_blank; - video_play_state_t play_state; - video_stream_source_t stream_source; - video_format_t video_format; - video_displayformat_t display_format; - }; +struct video_status { + int video_blank; /⋆ blank video on freeze? ⋆/ + video_play_state_t play_state; /⋆ current state of playback ⋆/ + video_stream_source_t stream_source; /⋆ current source (demux/memory) ⋆/ + video_format_t video_format; /⋆ current aspect ratio of stream ⋆/ + video_displayformat_t display_format;/⋆ selected cropping mode ⋆/ +}; If video_blank is set video will be blanked out if the channel is changed or if playback is stopped. Otherwise, the last picture will be displayed. play_state indicates if the video is @@ -127,17 +136,17 @@ device.
-
+
struct video_still_picture An I-frame displayed via the VIDEO_STILLPICTURE call is passed on within the following structure. - /⋆ pointer to and size of a single iframe in memory ⋆/ - struct video_still_picture { - char ⋆iFrame; - int32_t size; - }; +/⋆ pointer to and size of a single iframe in memory ⋆/ +struct video_still_picture { + char ⋆iFrame; /⋆ pointer to a single iframe in memory ⋆/ + int32_t size; +};
@@ -164,26 +173,26 @@ bits set according to the hardwares capabilities.
-
+
video system A call to VIDEO_SET_SYSTEM sets the desired video system for TV output. The following system types can be set: - typedef enum { - VIDEO_SYSTEM_PAL, - VIDEO_SYSTEM_NTSC, - VIDEO_SYSTEM_PALN, - VIDEO_SYSTEM_PALNc, - VIDEO_SYSTEM_PALM, - VIDEO_SYSTEM_NTSC60, - VIDEO_SYSTEM_PAL60, - VIDEO_SYSTEM_PALM60 - } video_system_t; +typedef enum { + VIDEO_SYSTEM_PAL, + VIDEO_SYSTEM_NTSC, + VIDEO_SYSTEM_PALN, + VIDEO_SYSTEM_PALNc, + VIDEO_SYSTEM_PALM, + VIDEO_SYSTEM_NTSC60, + VIDEO_SYSTEM_PAL60, + VIDEO_SYSTEM_PALM60 +} video_system_t;
-
+
struct video_highlight Calling the ioctl VIDEO_SET_HIGHLIGHTS posts the SPU highlight information. The call expects the following format for that information: @@ -210,7 +219,7 @@ call expects the following format for that information:
-
+
video SPU Calling VIDEO_SET_SPU deactivates or activates SPU decoding, according to the following format: @@ -224,7 +233,7 @@ following format:
-
+
video SPU palette The following structure is used to set the SPU palette by calling VIDEO_SPU_PALETTE: @@ -237,7 +246,7 @@ following format:
-
+
video NAVI pack In order to get the navigational data the following structure has to be passed to the ioctl VIDEO_GET_NAVI: @@ -252,7 +261,7 @@ VIDEO_GET_NAVI:
-
+
video attributes The following attributes can be set by a call to VIDEO_SET_ATTRIBUTES: @@ -488,7 +497,7 @@ VIDEO_GET_NAVI: -
VIDEO_STOP DESCRIPTION @@ -562,7 +571,7 @@ role="subsection">VIDEO_STOP -
VIDEO_PLAY DESCRIPTION @@ -615,7 +624,7 @@ role="subsection">VIDEO_PLAY -
VIDEO_FREEZE DESCRIPTION @@ -672,7 +681,7 @@ role="subsection">VIDEO_FREEZE -
VIDEO_CONTINUE DESCRIPTION @@ -725,7 +734,7 @@ role="subsection">VIDEO_CONTINUE -
VIDEO_SELECT_SOURCE DESCRIPTION @@ -788,7 +797,7 @@ role="subsection">VIDEO_SELECT_SOURCE -
VIDEO_SET_BLANK DESCRIPTION @@ -861,7 +870,7 @@ role="subsection">VIDEO_SET_BLANK -
VIDEO_GET_STATUS DESCRIPTION @@ -929,7 +938,7 @@ role="subsection">VIDEO_GET_STATUS -
VIDEO_GET_EVENT DESCRIPTION @@ -1018,7 +1027,7 @@ role="subsection">VIDEO_GET_EVENT -
VIDEO_SET_DISPLAY_FORMAT DESCRIPTION @@ -1088,7 +1097,7 @@ role="subsection">VIDEO_SET_DISPLAY_FORMAT -
VIDEO_STILLPICTURE DESCRIPTION @@ -1158,7 +1167,7 @@ role="subsection">VIDEO_STILLPICTURE -
VIDEO_FAST_FORWARD DESCRIPTION @@ -1232,7 +1241,7 @@ role="subsection">VIDEO_FAST_FORWARD -
VIDEO_SLOWMOTION DESCRIPTION @@ -1306,7 +1315,7 @@ role="subsection">VIDEO_SLOWMOTION -
VIDEO_GET_CAPABILITIES DESCRIPTION @@ -1368,7 +1377,7 @@ role="subsection">VIDEO_GET_CAPABILITIES -
VIDEO_SET_ID DESCRIPTION @@ -1435,7 +1444,7 @@ role="subsection">VIDEO_SET_ID -
VIDEO_CLEAR_BUFFER DESCRIPTION @@ -1479,7 +1488,7 @@ role="subsection">VIDEO_CLEAR_BUFFER -
VIDEO_SET_STREAMTYPE DESCRIPTION @@ -1540,7 +1549,7 @@ role="subsection">VIDEO_SET_STREAMTYPE -
VIDEO_SET_FORMAT DESCRIPTION @@ -1601,7 +1610,7 @@ role="subsection">VIDEO_SET_FORMAT -
VIDEO_SET_SYSTEM DESCRIPTION @@ -1663,7 +1672,7 @@ role="subsection">VIDEO_SET_SYSTEM -
VIDEO_SET_HIGHLIGHT DESCRIPTION @@ -1723,7 +1732,7 @@ role="subsection">VIDEO_SET_HIGHLIGHT -
VIDEO_SET_SPU DESCRIPTION @@ -1785,7 +1794,7 @@ role="subsection">VIDEO_SET_SPU -
VIDEO_SET_SPU_PALETTE DESCRIPTION @@ -1845,7 +1854,7 @@ role="subsection">VIDEO_SET_SPU_PALETTE -
VIDEO_GET_NAVI DESCRIPTION @@ -1907,7 +1916,7 @@ role="subsection">VIDEO_GET_NAVI -
VIDEO_SET_ATTRIBUTES DESCRIPTION -- cgit v1.2.3 From 84b01c1633497e748d98ca0d100faaca13579148 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 8 Jun 2011 16:56:03 -0300 Subject: [media] DocBook/video.xml: Document the remaining data structures Now, all data structures are commented. A few ioctls remain undocumented: Error: no ID for constraint linkend: VIDEO_GET_SIZE. Error: no ID for constraint linkend: VIDEO_GET_FRAME_RATE. Error: no ID for constraint linkend: VIDEO_GET_PTS. Error: no ID for constraint linkend: VIDEO_GET_FRAME_COUNT. Error: no ID for constraint linkend: VIDEO_COMMAND. Error: no ID for constraint linkend: VIDEO_TRY_COMMAND. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/dvb/video.xml | 47 +++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/Documentation/DocBook/media/dvb/video.xml b/Documentation/DocBook/media/dvb/video.xml index ef30f69edf22..539c79b027c3 100644 --- a/Documentation/DocBook/media/dvb/video.xml +++ b/Documentation/DocBook/media/dvb/video.xml @@ -37,8 +37,8 @@ stream.
-
-video_display_format_t +
+video_displayformat_t In case the display format of the video stream and of the display hardware differ the application has to specify how to handle the cropping of the picture. This can be done using the VIDEO_SET_DISPLAY_FORMAT call (??) which accepts @@ -89,6 +89,49 @@ typedef enum {
+
+The structure must be zeroed before use by the application +This ensures it can be extended safely in the future. +struct video-command + +struct video_command { + __u32 cmd; + __u32 flags; + union { + struct { + __u64 pts; + } stop; + + struct { + /⋆ 0 or 1000 specifies normal speed, + 1 specifies forward single stepping, + -1 specifies backward single stepping, + >>1: playback at speed/1000 of the normal speed, + <-1: reverse playback at (-speed/1000) of the normal speed. ⋆/ + __s32 speed; + __u32 format; + } play; + + struct { + __u32 data[16]; + } raw; + }; +}; + +
+ +
+struct video_size-t + +typedef struct { + int w; + int h; + video_format_t aspect_ratio; +} video_size_t; + +
+ +
struct video_event The following is the structure of a video event as it is returned by the VIDEO_GET_EVENT -- cgit v1.2.3 From 7a2b66b1bd26d717763985bad401410665fa0672 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 9 Jun 2011 16:26:32 -0300 Subject: Revert "[media] dvb/audio.h: Remove definition for AUDIO_GET_PTS" Based on those feedback: http://www.spinics.net/lists/linux-media/msg33704.html http://www.spinics.net/lists/linux-media/msg33700.html I'm reverting the removal of this unused ioctl, as it seems that some drivers under development may be using. So, I'll wait until the next merge window before removing those unused ioctls, to give a chance for developers to submit their pending work. This reverts commit db48923da6c528d461b5e764692239eb9c1b7a00. Cc: Andreas Oberritter Cc: Manu Abraham Signed-off-by: Mauro Carvalho Chehab --- include/linux/dvb/audio.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/linux/dvb/audio.h b/include/linux/dvb/audio.h index c1b35550899a..d47bccd604e4 100644 --- a/include/linux/dvb/audio.h +++ b/include/linux/dvb/audio.h @@ -118,6 +118,18 @@ typedef __u16 audio_attributes_t; #define AUDIO_SET_ATTRIBUTES _IOW('o', 17, audio_attributes_t) #define AUDIO_SET_KARAOKE _IOW('o', 18, audio_karaoke_t) +/** + * AUDIO_GET_PTS + * + * Read the 33 bit presentation time stamp as defined + * in ITU T-REC-H.222.0 / ISO/IEC 13818-1. + * + * The PTS should belong to the currently played + * frame if possible, but may also be a value close to it + * like the PTS of the last decoded frame or the last PTS + * extracted by the PES parser. + */ +#define AUDIO_GET_PTS _IOR('o', 19, __u64) #define AUDIO_BILINGUAL_CHANNEL_SELECT _IO('o', 20) #endif /* _DVBAUDIO_H_ */ -- cgit v1.2.3 From a012fb2c9b2cf6fa6be1ee2961df700332d41031 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 9 Jun 2011 16:34:29 -0300 Subject: [media] DocBook: Don't be noisy at make cleanmediadocs While here, remove the mediaindexdocs from PHONY. Reported-by: Randy Dunlap Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile index 1e909c28299e..b7627e18fcc9 100644 --- a/Documentation/DocBook/media/Makefile +++ b/Documentation/DocBook/media/Makefile @@ -21,10 +21,10 @@ MEDIA_TEMP = media-entities.tmpl \ IMGFILES := $(addprefix $(MEDIA_OBJ_DIR)/media/, $(notdir $(shell ls $(MEDIA_SRC_DIR)/*/*.gif $(MEDIA_SRC_DIR)/*/*.png))) GENFILES := $(addprefix $(MEDIA_OBJ_DIR)/, $(MEDIA_TEMP)) -PHONY += cleanmediadocs mediaindexdocs +PHONY += cleanmediadocs cleanmediadocs: - -@rm `find $(MEDIA_OBJ_DIR) -type l` $(GENFILES) $(IMGFILES) + -@rm `find $(MEDIA_OBJ_DIR) -type l` $(GENFILES) $(IMGFILES) 2>/dev/null $(obj)/media_api.xml: $(GENFILES) FORCE -- cgit v1.2.3 From 8a8cc952d3fe0eca3ded22a01d4f7e642d676be0 Mon Sep 17 00:00:00 2001 From: Sensoray Linux Development Date: Mon, 4 Apr 2011 14:08:40 -0300 Subject: [media] s2255drv: firmware version update, vendor request change removes obsolete comments. updates firmware versions. firmware vendor request simplified. Signed-off-by: Dean Anderson Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/s2255drv.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c index 5b9dce85645c..704e2cb1e459 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c @@ -16,15 +16,10 @@ * Example maximum bandwidth utilization: * * -full size, color mode YUYV or YUV422P: 2 channels at once - * * -full or half size Grey scale: all 4 channels at once - * * -half size, color mode YUYV or YUV422P: all 4 channels at once - * * -full size, color mode YUYV or YUV422P 1/2 frame rate: all 4 channels * at once. - * (TODO: Incorporate videodev2 frame rate(FR) enumeration, - * which is currently experimental.) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -57,7 +52,7 @@ #include #define S2255_MAJOR_VERSION 1 -#define S2255_MINOR_VERSION 21 +#define S2255_MINOR_VERSION 22 #define S2255_RELEASE 0 #define S2255_VERSION KERNEL_VERSION(S2255_MAJOR_VERSION, \ S2255_MINOR_VERSION, \ @@ -126,7 +121,7 @@ #define MASK_COLOR 0x000000ff #define MASK_JPG_QUALITY 0x0000ff00 #define MASK_INPUT_TYPE 0x000f0000 -/* frame decimation. Not implemented by V4L yet(experimental in V4L) */ +/* frame decimation. */ #define FDEC_1 1 /* capture every frame. default */ #define FDEC_2 2 /* capture every 2nd frame */ #define FDEC_3 3 /* capture every 3rd frame */ @@ -312,9 +307,9 @@ struct s2255_fh { }; /* current cypress EEPROM firmware version */ -#define S2255_CUR_USB_FWVER ((3 << 8) | 11) +#define S2255_CUR_USB_FWVER ((3 << 8) | 12) /* current DSP FW version */ -#define S2255_CUR_DSP_FWVER 10102 +#define S2255_CUR_DSP_FWVER 10104 /* Need DSP version 5+ for video status feature */ #define S2255_MIN_DSP_STATUS 5 #define S2255_MIN_DSP_COLORFILTER 8 @@ -502,7 +497,7 @@ static void planar422p_to_yuv_packed(const unsigned char *in, static void s2255_reset_dsppower(struct s2255_dev *dev) { - s2255_vendor_req(dev, 0x40, 0x0b0b, 0x0b01, NULL, 0, 1); + s2255_vendor_req(dev, 0x40, 0x0000, 0x0001, NULL, 0, 1); msleep(10); s2255_vendor_req(dev, 0x50, 0x0000, 0x0000, NULL, 0, 1); msleep(600); @@ -2302,15 +2297,12 @@ static int s2255_board_init(struct s2255_dev *dev) /* query the firmware */ fw_ver = s2255_get_fx2fw(dev); - printk(KERN_INFO "2255 usb firmware version %d.%d\n", + printk(KERN_INFO "s2255: usb firmware version %d.%d\n", (fw_ver >> 8) & 0xff, fw_ver & 0xff); if (fw_ver < S2255_CUR_USB_FWVER) - dev_err(&dev->udev->dev, - "usb firmware not up to date %d.%d\n", - (fw_ver >> 8) & 0xff, - fw_ver & 0xff); + printk(KERN_INFO "s2255: newer USB firmware available\n"); for (j = 0; j < MAX_CHANNELS; j++) { struct s2255_channel *channel = &dev->channel[j]; -- cgit v1.2.3 From 5588dc2b025fd8b2188142b8d59efe562bd57d80 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Thu, 28 Apr 2011 12:13:58 -0300 Subject: [media] rc-core: lirc use unsigned int MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Durations can never be negative, so it makes sense to consistently use unsigned int for LIRC transmission. Contrary to the initial impression, this shouldn't actually change the userspace API. Signed-off-by: David Härdeman Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/ene_ir.c | 4 ++-- drivers/media/rc/ene_ir.h | 2 +- drivers/media/rc/ir-lirc-codec.c | 15 +++++++++------ drivers/media/rc/ite-cir.c | 5 +---- drivers/media/rc/mceusb.c | 10 ++++------ drivers/media/rc/nuvoton-cir.c | 12 +++--------- drivers/media/rc/rc-loopback.c | 13 +++---------- drivers/media/rc/winbond-cir.c | 6 +----- include/media/rc-core.h | 2 +- 9 files changed, 25 insertions(+), 44 deletions(-) diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c index a43ed6c41bfc..2b9c2569d74a 100644 --- a/drivers/media/rc/ene_ir.c +++ b/drivers/media/rc/ene_ir.c @@ -953,13 +953,13 @@ static void ene_set_idle(struct rc_dev *rdev, bool idle) } /* outside interface: transmit */ -static int ene_transmit(struct rc_dev *rdev, int *buf, u32 n) +static int ene_transmit(struct rc_dev *rdev, unsigned *buf, unsigned n) { struct ene_device *dev = rdev->priv; unsigned long flags; dev->tx_buffer = buf; - dev->tx_len = n / sizeof(int); + dev->tx_len = n; dev->tx_pos = 0; dev->tx_reg = 0; dev->tx_done = 0; diff --git a/drivers/media/rc/ene_ir.h b/drivers/media/rc/ene_ir.h index 337a41d4450b..017c209cdf8a 100644 --- a/drivers/media/rc/ene_ir.h +++ b/drivers/media/rc/ene_ir.h @@ -235,7 +235,7 @@ struct ene_device { bool tx_sample_pulse; /* current sample is pulse */ /* TX buffer */ - int *tx_buffer; /* input samples buffer*/ + unsigned *tx_buffer; /* input samples buffer*/ int tx_pos; /* position in that bufer */ int tx_len; /* current len of tx buffer */ int tx_done; /* done transmitting */ diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c index 1c5cc65ea1e1..e5eeec4da76e 100644 --- a/drivers/media/rc/ir-lirc-codec.c +++ b/drivers/media/rc/ir-lirc-codec.c @@ -103,19 +103,19 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf, { struct lirc_codec *lirc; struct rc_dev *dev; - int *txbuf; /* buffer with values to transmit */ - int ret = 0; + unsigned int *txbuf; /* buffer with values to transmit */ + ssize_t ret = 0; size_t count; lirc = lirc_get_pdata(file); if (!lirc) return -EFAULT; - if (n % sizeof(int)) + if (n < sizeof(unsigned) || n % sizeof(unsigned)) return -EINVAL; - count = n / sizeof(int); - if (count > LIRCBUF_SIZE || count % 2 == 0 || n % sizeof(int) != 0) + count = n / sizeof(unsigned); + if (count > LIRCBUF_SIZE || count % 2 == 0) return -EINVAL; txbuf = memdup_user(buf, n); @@ -129,7 +129,10 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf, } if (dev->tx_ir) - ret = dev->tx_ir(dev, txbuf, (u32)n); + ret = dev->tx_ir(dev, txbuf, count); + + if (ret > 0) + ret *= sizeof(unsigned); out: kfree(txbuf); diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c index ecd3d0280768..1cee20761a3f 100644 --- a/drivers/media/rc/ite-cir.c +++ b/drivers/media/rc/ite-cir.c @@ -383,7 +383,7 @@ static int ite_set_tx_duty_cycle(struct rc_dev *rcdev, u32 duty_cycle) /* transmit out IR pulses; what you get here is a batch of alternating * pulse/space/pulse/space lengths that we should write out completely through * the FIFO, blocking on a full FIFO */ -static int ite_tx_ir(struct rc_dev *rcdev, int *txbuf, u32 n) +static int ite_tx_ir(struct rc_dev *rcdev, unsigned *txbuf, unsigned n) { unsigned long flags; struct ite_dev *dev = rcdev->priv; @@ -399,9 +399,6 @@ static int ite_tx_ir(struct rc_dev *rcdev, int *txbuf, u32 n) /* clear the array just in case */ memset(last_sent, 0, ARRAY_SIZE(last_sent)); - /* n comes in bytes; convert to ints */ - n /= sizeof(int); - spin_lock_irqsave(&dev->lock, flags); /* let everybody know we're now transmitting */ diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c index ec972dc25790..85ff9a1ffb39 100644 --- a/drivers/media/rc/mceusb.c +++ b/drivers/media/rc/mceusb.c @@ -692,20 +692,18 @@ static void mce_flush_rx_buffer(struct mceusb_dev *ir, int size) } /* Send data out the IR blaster port(s) */ -static int mceusb_tx_ir(struct rc_dev *dev, int *txbuf, u32 n) +static int mceusb_tx_ir(struct rc_dev *dev, unsigned *txbuf, unsigned count) { struct mceusb_dev *ir = dev->priv; int i, ret = 0; - int count, cmdcount = 0; + int cmdcount = 0; unsigned char *cmdbuf; /* MCE command buffer */ long signal_duration = 0; /* Singnal length in us */ struct timeval start_time, end_time; do_gettimeofday(&start_time); - count = n / sizeof(int); - - cmdbuf = kzalloc(sizeof(int) * MCE_CMDBUF_SIZE, GFP_KERNEL); + cmdbuf = kzalloc(sizeof(unsigned) * MCE_CMDBUF_SIZE, GFP_KERNEL); if (!cmdbuf) return -ENOMEM; @@ -774,7 +772,7 @@ static int mceusb_tx_ir(struct rc_dev *dev, int *txbuf, u32 n) out: kfree(cmdbuf); - return ret ? ret : n; + return ret ? ret : count; } /* Sets active IR outputs -- mce devices typically have two */ diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index ce595f9ab4c7..eae05b500476 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c @@ -546,24 +546,18 @@ static int nvt_set_tx_carrier(struct rc_dev *dev, u32 carrier) * number may larger than TXFCONT (0xff). So in interrupt_handler, it has to * set TXFCONT as 0xff, until buf_count less than 0xff. */ -static int nvt_tx_ir(struct rc_dev *dev, int *txbuf, u32 n) +static int nvt_tx_ir(struct rc_dev *dev, unsigned *txbuf, unsigned n) { struct nvt_dev *nvt = dev->priv; unsigned long flags; - size_t cur_count; unsigned int i; u8 iren; int ret; spin_lock_irqsave(&nvt->tx.lock, flags); - if (n >= TX_BUF_LEN) { - nvt->tx.buf_count = cur_count = TX_BUF_LEN; - ret = TX_BUF_LEN; - } else { - nvt->tx.buf_count = cur_count = n; - ret = n; - } + ret = min((unsigned)(TX_BUF_LEN / sizeof(unsigned)), n); + nvt->tx.buf_count = (ret * sizeof(unsigned)); memcpy(nvt->tx.buf, txbuf, nvt->tx.buf_count); diff --git a/drivers/media/rc/rc-loopback.c b/drivers/media/rc/rc-loopback.c index cc846b2619cf..efc6a514348a 100644 --- a/drivers/media/rc/rc-loopback.c +++ b/drivers/media/rc/rc-loopback.c @@ -101,21 +101,14 @@ static int loop_set_rx_carrier_range(struct rc_dev *dev, u32 min, u32 max) return 0; } -static int loop_tx_ir(struct rc_dev *dev, int *txbuf, u32 n) +static int loop_tx_ir(struct rc_dev *dev, unsigned *txbuf, unsigned count) { struct loopback_dev *lodev = dev->priv; u32 rxmask; - unsigned count; unsigned total_duration = 0; unsigned i; DEFINE_IR_RAW_EVENT(rawir); - if (n == 0 || n % sizeof(int)) { - dprintk("invalid tx buffer size\n"); - return -EINVAL; - } - - count = n / sizeof(int); for (i = 0; i < count; i++) total_duration += abs(txbuf[i]); @@ -142,7 +135,7 @@ static int loop_tx_ir(struct rc_dev *dev, int *txbuf, u32 n) for (i = 0; i < count; i++) { rawir.pulse = i % 2 ? false : true; - rawir.duration = abs(txbuf[i]) * 1000; + rawir.duration = txbuf[i] * 1000; if (rawir.duration) ir_raw_event_store_with_filter(dev, &rawir); } @@ -158,7 +151,7 @@ out: /* Lirc expects this function to take as long as the total duration */ set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(usecs_to_jiffies(total_duration)); - return n; + return count; } static void loop_set_idle(struct rc_dev *dev, bool enable) diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c index 18e70d104f80..bec8abc965f7 100644 --- a/drivers/media/rc/winbond-cir.c +++ b/drivers/media/rc/winbond-cir.c @@ -577,16 +577,12 @@ wbcir_txmask(struct rc_dev *dev, u32 mask) } static int -wbcir_tx(struct rc_dev *dev, int *buf, u32 bufsize) +wbcir_tx(struct rc_dev *dev, unsigned *buf, unsigned count) { struct wbcir_data *data = dev->priv; - u32 count; unsigned i; unsigned long flags; - /* bufsize has been sanity checked by the caller */ - count = bufsize / sizeof(int); - /* Not sure if this is possible, but better safe than sorry */ spin_lock_irqsave(&data->spinlock, flags); if (data->txstate != WBCIR_TXSTATE_INACTIVE) { diff --git a/include/media/rc-core.h b/include/media/rc-core.h index 60536c74c1ea..b1f19b77ecd4 100644 --- a/include/media/rc-core.h +++ b/include/media/rc-core.h @@ -117,7 +117,7 @@ struct rc_dev { int (*s_tx_carrier)(struct rc_dev *dev, u32 carrier); int (*s_tx_duty_cycle)(struct rc_dev *dev, u32 duty_cycle); int (*s_rx_carrier_range)(struct rc_dev *dev, u32 min, u32 max); - int (*tx_ir)(struct rc_dev *dev, int *txbuf, u32 n); + int (*tx_ir)(struct rc_dev *dev, unsigned *txbuf, unsigned n); void (*s_idle)(struct rc_dev *dev, bool enable); int (*s_learning_mode)(struct rc_dev *dev, int enable); int (*s_carrier_report) (struct rc_dev *dev, int enable); -- cgit v1.2.3 From 2c7988ab0effa9e41bd9c9db5cb33ddda870ca10 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Thu, 26 May 2011 04:49:52 -0300 Subject: [media] Correct error code from -ENOMEM to -EINVAL. Make sure the return value is set in all cases >From 9b38a5c9878b5e4be2899ae291c4524f5f5fc218 Mon Sep 17 00:00:00 2001 Signed-off-by: Hans Petter Selasky Cc: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/sr030pc30.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/sr030pc30.c b/drivers/media/video/sr030pc30.c index c901721a1db3..8afb0e8a2e00 100644 --- a/drivers/media/video/sr030pc30.c +++ b/drivers/media/video/sr030pc30.c @@ -726,8 +726,10 @@ static int sr030pc30_s_power(struct v4l2_subdev *sd, int on) const struct sr030pc30_platform_data *pdata = info->pdata; int ret; - if (WARN(pdata == NULL, "No platform data!\n")) - return -ENOMEM; + if (pdata == NULL) { + WARN(1, "No platform data!\n"); + return -EINVAL; + } /* * Put sensor into power sleep mode before switching off @@ -746,6 +748,7 @@ static int sr030pc30_s_power(struct v4l2_subdev *sd, int on) if (on) { ret = sr030pc30_base_config(sd); } else { + ret = 0; info->curr_win = NULL; info->curr_fmt = NULL; } -- cgit v1.2.3 From ed5d11d592e21f00d6f72e1da0dca0ba3f4cd6ee Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Thu, 26 May 2011 04:56:55 -0300 Subject: [media] Remove unused definitions which can cause conflict with definitions in usb/ch9.h >From 0dd2949dfeae431ed4ffbd00fd14a10dc3747ad0 Mon Sep 17 00:00:00 2001 Signed-off-by: Hans Petter Selasky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/gp8psk.h | 3 --- drivers/media/dvb/dvb-usb/vp7045.h | 3 --- 2 files changed, 6 deletions(-) diff --git a/drivers/media/dvb/dvb-usb/gp8psk.h b/drivers/media/dvb/dvb-usb/gp8psk.h index 831749a518cb..ed32b9da4843 100644 --- a/drivers/media/dvb/dvb-usb/gp8psk.h +++ b/drivers/media/dvb/dvb-usb/gp8psk.h @@ -78,9 +78,6 @@ extern int dvb_usb_gp8psk_debug; #define ADV_MOD_DVB_BPSK 9 /* DVB-S BPSK */ #define GET_USB_SPEED 0x07 - #define USB_SPEED_LOW 0 - #define USB_SPEED_FULL 1 - #define USB_SPEED_HIGH 2 #define RESET_FX2 0x13 diff --git a/drivers/media/dvb/dvb-usb/vp7045.h b/drivers/media/dvb/dvb-usb/vp7045.h index 969688f85267..cf5ec46f8bb1 100644 --- a/drivers/media/dvb/dvb-usb/vp7045.h +++ b/drivers/media/dvb/dvb-usb/vp7045.h @@ -36,9 +36,6 @@ #define Tuner_Power_OFF 0 #define GET_USB_SPEED 0x07 - #define USB_SPEED_LOW 0 - #define USB_SPEED_FULL 1 - #define USB_SPEED_HIGH 2 #define LOCK_TUNER_COMMAND 0x09 -- cgit v1.2.3 From 7ce338d9dfc432b71db15184ad3ec458c9961164 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Thu, 26 May 2011 05:06:09 -0300 Subject: [media] Correct and add some parameter descriptions >From 70d02ce19f64fae4ceee563501e8462a76e17b91 Mon Sep 17 00:00:00 2001 Signed-off-by: Hans Petter Selasky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/tda7432.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/tda7432.c b/drivers/media/video/tda7432.c index 3941f954daf4..bd218545da9c 100644 --- a/drivers/media/video/tda7432.c +++ b/drivers/media/video/tda7432.c @@ -49,10 +49,11 @@ static int maxvol; static int loudness; /* disable loudness by default */ static int debug; /* insmod parameter */ module_param(debug, int, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(debug, "Set debugging level from 0 to 3. Default is off(0)."); module_param(loudness, int, S_IRUGO); -MODULE_PARM_DESC(maxvol,"Set maximium volume to +20db (0), default is 0db(1)"); +MODULE_PARM_DESC(loudness, "Turn loudness on(1) else off(0). Default is off(0)."); module_param(maxvol, int, S_IRUGO | S_IWUSR); - +MODULE_PARM_DESC(maxvol, "Set maximium volume to +20dB(0) else +0dB(1). Default is +20dB(0)."); /* Structure of address and subaddresses for the tda7432 */ -- cgit v1.2.3 From 2c87d9db46d1dcc956facaf98805d4d68b823b23 Mon Sep 17 00:00:00 2001 From: Andre Bartke Date: Fri, 3 Jun 2011 15:06:58 -0300 Subject: [media] drivers/media/video: fix memory leak of snd_cx18_init() cxsc is not freed in the error case. Signed-off-by: Andre Bartke Cc: Andy Walls Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx18/cx18-alsa-main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/video/cx18/cx18-alsa-main.c b/drivers/media/video/cx18/cx18-alsa-main.c index d50d69da387b..a1e6c2a32478 100644 --- a/drivers/media/video/cx18/cx18-alsa-main.c +++ b/drivers/media/video/cx18/cx18-alsa-main.c @@ -192,6 +192,7 @@ static int snd_cx18_init(struct v4l2_device *v4l2_dev) err_exit_free: if (sc != NULL) snd_card_free(sc); + kfree(cxsc); err_exit: return ret; } -- cgit v1.2.3 From bd7319dc325ac327ddb3777564361bd4186ecdb6 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 15 Jun 2011 23:13:19 -0300 Subject: [media] DocBook: Use base64 for gif/png files The patch utility doesn't work with non-binary files. This causes some tools to break, like generating tarball targets and the scripts that generate diff patches at http://www.kernel.org/pub/linux/kernel/v2.6/. So, let's convert all binaries to ascii using base64, and add a logic at Makefile to convert them back into binaries at runtime. Reported-by: Randy Dunlap Reported-by: Andrew Morton Reviewed-by: Michal Marek Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/.gitignore | 10 +- Documentation/DocBook/Makefile | 1 + Documentation/DocBook/media/Makefile | 15 +- Documentation/DocBook/media/bayer.png.b64 | 171 ++++++++ Documentation/DocBook/media/crop.gif.b64 | 105 +++++ Documentation/DocBook/media/dvb/dvbstb.png | Bin 22655 -> 0 bytes Documentation/DocBook/media/dvbstb.png.b64 | 398 ++++++++++++++++++ Documentation/DocBook/media/fieldseq_bt.gif.b64 | 447 +++++++++++++++++++++ Documentation/DocBook/media/fieldseq_tb.gif.b64 | 445 ++++++++++++++++++++ Documentation/DocBook/media/nv12mt.gif.b64 | 37 ++ Documentation/DocBook/media/nv12mt_example.gif.b64 | 121 ++++++ Documentation/DocBook/media/pipeline.png.b64 | 213 ++++++++++ Documentation/DocBook/media/v4l/bayer.pdf | Bin 12116 -> 0 bytes Documentation/DocBook/media/v4l/bayer.png | Bin 9725 -> 0 bytes Documentation/DocBook/media/v4l/crop.gif | Bin 5967 -> 0 bytes Documentation/DocBook/media/v4l/fieldseq_bt.gif | Bin 25430 -> 0 bytes Documentation/DocBook/media/v4l/fieldseq_tb.gif | Bin 25323 -> 0 bytes Documentation/DocBook/media/v4l/nv12mt.gif | Bin 2108 -> 0 bytes Documentation/DocBook/media/v4l/nv12mt_example.gif | Bin 6858 -> 0 bytes Documentation/DocBook/media/v4l/pipeline.png | Bin 12130 -> 0 bytes Documentation/DocBook/media/v4l/subdev-formats.xml | 3 - Documentation/DocBook/media/v4l/vbi_525.gif | Bin 4741 -> 0 bytes Documentation/DocBook/media/v4l/vbi_625.gif | Bin 5095 -> 0 bytes Documentation/DocBook/media/v4l/vbi_hsync.gif | Bin 2400 -> 0 bytes Documentation/DocBook/media/vbi_525.gif.b64 | 84 ++++ Documentation/DocBook/media/vbi_625.gif.b64 | 90 +++++ Documentation/DocBook/media/vbi_hsync.gif.b64 | 43 ++ 27 files changed, 2166 insertions(+), 17 deletions(-) create mode 100644 Documentation/DocBook/media/bayer.png.b64 create mode 100644 Documentation/DocBook/media/crop.gif.b64 delete mode 100644 Documentation/DocBook/media/dvb/dvbstb.png create mode 100644 Documentation/DocBook/media/dvbstb.png.b64 create mode 100644 Documentation/DocBook/media/fieldseq_bt.gif.b64 create mode 100644 Documentation/DocBook/media/fieldseq_tb.gif.b64 create mode 100644 Documentation/DocBook/media/nv12mt.gif.b64 create mode 100644 Documentation/DocBook/media/nv12mt_example.gif.b64 create mode 100644 Documentation/DocBook/media/pipeline.png.b64 delete mode 100644 Documentation/DocBook/media/v4l/bayer.pdf delete mode 100644 Documentation/DocBook/media/v4l/bayer.png delete mode 100644 Documentation/DocBook/media/v4l/crop.gif delete mode 100644 Documentation/DocBook/media/v4l/fieldseq_bt.gif delete mode 100644 Documentation/DocBook/media/v4l/fieldseq_tb.gif delete mode 100644 Documentation/DocBook/media/v4l/nv12mt.gif delete mode 100644 Documentation/DocBook/media/v4l/nv12mt_example.gif delete mode 100644 Documentation/DocBook/media/v4l/pipeline.png delete mode 100644 Documentation/DocBook/media/v4l/vbi_525.gif delete mode 100644 Documentation/DocBook/media/v4l/vbi_625.gif delete mode 100644 Documentation/DocBook/media/v4l/vbi_hsync.gif create mode 100644 Documentation/DocBook/media/vbi_525.gif.b64 create mode 100644 Documentation/DocBook/media/vbi_625.gif.b64 create mode 100644 Documentation/DocBook/media/vbi_hsync.gif.b64 diff --git a/Documentation/DocBook/.gitignore b/Documentation/DocBook/.gitignore index 2c8c882038bf..25214a5ae14d 100644 --- a/Documentation/DocBook/.gitignore +++ b/Documentation/DocBook/.gitignore @@ -8,13 +8,5 @@ *.dvi *.log *.out -crop.gif -dvbstb.png -fieldseq_bt.gif -fieldseq_tb.gif media-indices.tmpl -nv12mt.gif -nv12mt_example.gif -vbi_525.gif -vbi_625.gif -vbi_hsync.gif +media-entities.tmpl diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index 5125277bd6a4..66725a3d30dc 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile @@ -50,6 +50,7 @@ HTML := $(sort $(patsubst %.xml, %.html, $(BOOKS))) htmldocs: $(HTML) $(call build_main_index) $(call build_images) + $(call install_media_images) MAN := $(patsubst %.xml, %.9, $(BOOKS)) mandocs: $(MAN) diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile index b7627e18fcc9..8cb27f346d0d 100644 --- a/Documentation/DocBook/media/Makefile +++ b/Documentation/DocBook/media/Makefile @@ -18,13 +18,14 @@ MEDIA_TEMP = media-entities.tmpl \ net.h.xml \ video.h.xml \ -IMGFILES := $(addprefix $(MEDIA_OBJ_DIR)/media/, $(notdir $(shell ls $(MEDIA_SRC_DIR)/*/*.gif $(MEDIA_SRC_DIR)/*/*.png))) +IMGFILES := $(patsubst %.b64,%, $(notdir $(shell ls $(MEDIA_SRC_DIR)/*.b64))) +OBJIMGFILES := $(addprefix $(MEDIA_OBJ_DIR)/, $(IMGFILES)) GENFILES := $(addprefix $(MEDIA_OBJ_DIR)/, $(MEDIA_TEMP)) PHONY += cleanmediadocs cleanmediadocs: - -@rm `find $(MEDIA_OBJ_DIR) -type l` $(GENFILES) $(IMGFILES) 2>/dev/null + -@rm `find $(MEDIA_OBJ_DIR) -type l` $(GENFILES) $(OBJIMGFILES) 2>/dev/null $(obj)/media_api.xml: $(GENFILES) FORCE @@ -155,10 +156,14 @@ DVB_DOCUMENTED = \ # Media targets and dependencies # -$(MEDIA_OBJ_DIR)/v4l2.xml: +install_media_images = \ + $(Q)cp $(OBJIMGFILES) $(MEDIA_OBJ_DIR)/media_api + +$(MEDIA_OBJ_DIR)/%: $(MEDIA_SRC_DIR)/%.b64 + $(Q)base64 -d $< >$@ + +$(MEDIA_OBJ_DIR)/v4l2.xml: $(OBJIMGFILES) @$($(quiet)gen_xml) - @(mkdir -p $(MEDIA_OBJ_DIR)/media) - @(cp $(MEDIA_SRC_DIR)/dvb/*.png $(MEDIA_SRC_DIR)/v4l/*.gif $(MEDIA_OBJ_DIR)/media/) @(ln -sf $(MEDIA_SRC_DIR)/v4l/*xml $(MEDIA_OBJ_DIR)/) @(ln -sf $(MEDIA_SRC_DIR)/dvb/*xml $(MEDIA_OBJ_DIR)/) diff --git a/Documentation/DocBook/media/bayer.png.b64 b/Documentation/DocBook/media/bayer.png.b64 new file mode 100644 index 000000000000..ccdf2bcda95c --- /dev/null +++ b/Documentation/DocBook/media/bayer.png.b64 @@ -0,0 +1,171 @@ +iVBORw0KGgoAAAANSUhEUgAAAlgAAACqCAMAAABGfcHVAAAAAXNSR0IArs4c6QAAAwBQTFRFAAIA +CAICAAQVEQEBAgsAJgECAAogAwsTAQopHQYBNAEAAAxNARQAERIQAhoDABwAABZEHRQKGRYKQw0F +ACMBACUAERwpHR4cVRAFBR5rZhADACR2JiIhBDAGAiWGgQ4AcxQABDYACSeQMSYlJykmESxYlQ4A +PSYZIS05OSsJHS5JOC8kAEMDUC8SADXLNDUzADbEAEsAADX/2RABCFIAAD/qxB0AAD//BFgAK0Vp +WT4r3hwA3RsTRERAAEf/5CIA2iYCCUv+WUgz7iIAOk5g3CgVSU5SiD8uB2sABm8AE1X/U1RQOFyL +4jkfIlz/RV98M1j+G2H/fVk23jtD4T0pXl9ieFtGcV894UIiYWJfAIwA50gOV2p+4kssO2j+dGZx +bG1qVmj/OHH/aHJzfnBX5lQ7B50AZnahdXd0AKUG5V1ARnz/6mErCqgAAKsAent46GBIW4GhAK0A +AK8B42FtALIOin9/ALUAiIOBALkAVIf/6WxWg4eBi4SKJrEAmoVtdY2geoP/rYVXhoyOqYVuJbUh +IrgWX5D/jo6J7nszP7gAsI9S63xnN70zZqO/fZzCOb4+cZr+64dy8otYnJ6b7ImDRcM56IqcWMEo +oJb/N8ZoTMRL7Y9/QchcsaOTo6eohaj/7ZqKXspXj6v9xal+oK+7d7vTUM+Afco5r7CumLTVStKV +bs9ukbb/9qx/9q9l8queoLv/e9R66beG7rDImNRhi9aDwsPAs8bWzcK2cd67jtqP5MWUodyB8b+1 +tMr/z8L/j9+kbOXWnN2ZstD7yc7Rzs7Ly9xb183UwdD/+si/qeOmvuKIx9fj4tPCtuWiqOrL+tS2 +y9v++NPK2dvZt+m0ueq80+Wo3OeSwuy/yezG+d7f/eS/z/DS3uf/6Ono4PC71O39xPb02vPZ/+nR ++Ori6e399+vt+PGz+ur65fL55/Xb4vbh7ffX/PPY8vP9+vLy6Pf36fjr/PfM8vjr//f+/vn48P36 +9vv+/vzf+fv4/fvu//z7+v7//P/7/v/8//QpxAAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAFY8AABWW +AQ2TT8cAAAAHdElNRQfaCRQXGSltwbPRAAAgAElEQVR42u2dDXwU1bXAZwEJtEaNH1nbh68fpoWK +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 diff --git a/Documentation/DocBook/media/crop.gif.b64 b/Documentation/DocBook/media/crop.gif.b64 new file mode 100644 index 000000000000..11d936ae72e8 --- /dev/null +++ b/Documentation/DocBook/media/crop.gif.b64 @@ -0,0 +1,105 @@ +R0lGODlhuQJGAeMAAAAAAH9/fwCvAP8AANEA0dEAAK8Ar////wCOAAAA0QAA//////////////// +/////ywAAAAAuQJGAQAE/vDISau9OOvNu/9gKI5kaZ5oqq5s675wLM90bd94ru987//AoHBILBqP +yKRyyWw6n9CodEqtWq/YrHbL7Xq/4LB4TC6bz+i0es1uu9/wuHxOr9vv+Lx+z+/7/4CBgoOEhYaH +iImKi4yNjo+QkZKTlJWWl5iZmpucnZ6foKGio6SlpqeoqaqrrK2ur7CxsrO0tba3uLm6gQC9vr/A +wcLDxMXGx8jJysvMzc7P0NHS09TV1tfYxbth2d3e3+DRAePk5ebn6Onl4ezt7u3q8fLqANtg7/j5 ++s/z/f4B+wIKHAjsn8F09ex5IciwobuDEM1Bi0ixosWLGDNqrJhQIZdk/htDihxJsiTJiSZTqlzJ +MmNHj1q+tRznsKbNmzhzDoz3EiYWmTN7+vQJgOfQmN5mAjzKtCg9pj+TBoU61ClCqlaAthSKVZdV +dFy7NtHKMqxYW1/PmT2bhOzKtWxlpZUYF4pblXDrvpq7Tq+Tu+UGCB5MuLDhw4gTK17MuLHjx5Aj +S55MubLly5gza95MmVxev0EAkxsg8jNoVXNJ0zy9RPQ41RtNsz6V2vPstlLTwdYo+zap2qt9G3Ed +YLdL4bGAL0VOhLhxjL2Zf1IeXboM56Wtt6KuPXRudM8vVu+eiTt5H9hDjj9vyfyIXrTW80gfO4OC ++/jz69/Pv7///wAG/ijggAQWaOCBCCao4IIMNujggRe4J4IwBxBg4YUYZqjhhhx26OGHIIYo4ogk +loihMBbi1k084VlklgLsWQKjBRJqgIwEBJRyY4UqZsNidhjMGOMkQlLgnjERwkdBjuVpk2QFTB5B +H2/2DUlJkRNYhWQKUTKyJQpdFjHlcUFaSaQxo9nGQph/fCkDm0OMCV2VZh7iZpbnwCYfBnDKcecO +fXq3ojotckRnnXr8SQGWEtQIphuKEhEoEHKKdygHCUiQ6QEJdDrEphWA2oGo3UXaAaMHOHrCpFmY +2gSr6H2XJ5AXoHqBp5xyuimpPfCa6we+6uWqCaiqagKsTAxrBbLz/slqTqEUvWgBqLviSqqvnXpq +rbbZTpDtt9ziSsG3unKraabkltutWMq+UOyswa3A7A/tfjGvDpW6eKm3v+a667i38vvvuQLzW7Cm +AJ878L/W9ouuR/Xi8O6zasorRMRo3JtDvoaWOe2v4IIc7LUIE4zwtd1Sm7C6KZ8MLsmzYBzExIFV +rILGJsgcB843cBztvgqHWnKwup5s8rroVivwwEc3DHLR/jKcis5K0JxmvDezQLUePNvgc0TSBix0 +1OuG6nS56nob7ssqp132wuIi7cnWU1j9ms1chkD3IF3X8DVEYe9AtNi37M2F3cXh/WgFhjPSNw1/ +HxS4CS97MPjH/ts5uQfieqbQuCWPzxC5QZPncPnYoXz+BueKY+Bm6J3AHsPo/5TOmup5sB5vxLJv +0vsLtPtjO1W4D0Kz6r9nknwLwfczvFeam6IAmndjnfcsy2vtbM3qAT2KkhkULwj4SRITIbzLWYx9 +j9j82L3HvyljivzeG1tC9qCzf4379cEPigACCAYAB0jAAhrwgAhMoAIXyMAGOvCBEIygAVMVDBLo +Ln1ZWx8SmjeP521CAEYiXypAGML1XHBPF8BfJVToue1drX+1GgUJZTHDFJywBSycRA5PwEF5eFAT +NYRFEE9wwzXRYoc5c2H1YGgBW32QFkMk1vkoZr3FyQKJJeih/lH894kotsKLFpwi9zB4vSvqzxr8 +oxIXPQHGVbRRBEVUnxk3qMTEvS+GonjjBBCwxwMg4I+d0CMI4pjBOUqpjtACm/c4IUhASuCPfPQj +I1lAyDLGAosk0OJT1hhIC0RSkpDsoyg9GUpAhtKPp6QAJD9pB0F+oJJWvOQZq5FGMuExFFHkYyR1 +OUpWqrKPvHykJIXZyzy40gOwXNURZ0mNWs6Jk5P0JChXKUxHXsCXwQTlKIe5h2OeSowvRKEFMOkI +ck4IkbRqogyvaU1uZpOd1URlNXepSnriwZscSOaxlknHQekmnRVwIhAxgM09rtKXBrXnKalJzFTe +AZ8b0Of9/vh5SH+CB6CLWicPEAoIiGpAoiQwp+OYOQ1nWgqaT0TBQTl6TUN4tH7oEyeUKDocdN5R +nXnsAUv98FJO2i+kNBWTTZkYUI3SkJLgXKJMlxTU5gxVjbf8HxSRSqOY4rCpcXqqLXGKy6muAKQj +EOkixPoBTV4FpQOdRU+jiicqkjGWsCCrB8wKlkWm9KhfTaod36pMDVbUR4TC6AQEmom1spGqjLOq +Ef1aU4uiD6pclapaEWskxcpRlv0E7D9vWtScTjavVXXrUicgV0SUlgN0VYtd04pXFYBVBKc1RGxt +pNVnsvWwn3WtXju3WEM2VrMX5WxGPdtaG+62dftkrFAd/utWyHa2q7k1bmjHOFocYfVitT3pbTsZ +XRS8NgSzJUR4XZddfaG1sF7V7XTDeVXlOpW5Y3TucKFbXO8et4p99e1ygfvYrT5XsvUl4n35mlz9 +vpe/zfXvfAEcC8P+t63Uba+BswrfF8p3sEZtMGUhzN7eYvav7QuscDFMXA2DNrGilfCHfxvizRJ1 +wV1Mr3RRHGEPx5Wk0jCpebcbzQBLcb1KVfGNM9vi4L6YxPQ1sXpp3OHLDhnE+xPxkSVAWEw4uMcz +rmyKbfyK8ZYPwfFVMJIZLMQNN8qyhVzxfovcX9tGNsbdFTCQ91pdHrmXwmC2sJipnOEyn1jLNXZy +l3Es/g4pX5jPJfbzkgHd5DQ/mcVRdvGhD1DlS1z5rlnmcJC57Aov06i8HeMxphWd6TNvWdCdJjRK +JL1nSvf5FZdGNJM3jepWeJpxoP7Zea0sY/vOmbe1ZsWtS5jnJU660paINXr/rGk6C3nQRI60kY/9 +alco+7sgGLYftN2oXCty15butZxn7WxO21rV/DB0q5FdCWXzmtmmDrSjoQ1lNKrbzQ/GrY9LgO0P +cJsP/04tXcCdbHH/mNzAnneqo21vVuMbxvpWcqlThWZLPnrN0m6zdt8ccVL7GuHIneidsVthY6+7 +2l80M8VPrfBzM5yW9954vrm77zD+OuRAHbmgir1X/monGtYq/2lYr7tzNif44WOGc81H0G8P/HsP +Afc24Fa77KXDccB1fjrX0O0MHYea4zSX+McZTeuWC5vrzfC6rkXNWrGPm+zlDvYqol7ynp/859YO +esXhSm9IN3zad0+yx9/e7IRbvO8Y/7vGdwx2LA/+4HA3PN8XXm+YO1zmEA/74/mN9WdT3u+WBzzS +ZU1moMN75fI+/OcTH/rFf33mjjf9oguP86HrnFJSlxzV3231EDS9A1rPA915nsipE7zdBuf8zfFb +YDUf2OhhHr2r8Z7y0wsdtkTHfd2Lr/vjU8Ld4bb+3vPrfDxDX8/SZ/f3k29zkDNf5BMmOfEFS3ql +/rsd8rR/f87jX/SMHx3zSddxsjdx1wde2UcvuUc6uxd+vTdInWduZ/dyzRRzjAd7ozaAY5d/BAZ/ +5Sd/52dy6YdyrHBtDyh3qjB8H2h3IUh9I6h3LKd6Lld5E3h5FZh5sZd34veCkxeDoDeDogeA9SeA +ODh78dZoMBiBMlhSFPh6NniBQ0iA49d8F/d8/hd9QDh9goeBhFeEZXeEc4d2zKB238Z2VXd/yud+ +G7h/Hdh/ivd/NRiAmqeF+MeFcWd2XyiBSkiDTAiHN1h9RIh6RriDSNiDefiDbxiEcfiEGUiHkkd+ +U2h+VYh+V6h+kyBBlniJmJiJmriJluiCqSeI/neYhDm2hGvXeJzgCzEjQkxXgnZ4gmC4DGJofGS4 +CcAAC7XYfpFXe9h3ewi4ffSHhfGjiqvwC2eYi/pne/ynffM3YoiYOqhoi894dcuXhsi4hsqYgtyn +gN5XHt1mi93oe6zoha6Ih6Ooh6VogTpSZ+3RG7/HAcGHBygYiSA4idCYisgUjqA4jqJYaOY4hqY4 +NepYCcI4cwWYbQcYK77IjMBYj3KxFu24Ae94B/HYhlZ4iAuZHAFJCQP5kBoQkXYwka3nhnvYjAyJ +kWBXkP52kD0gcH2xjQBpj3CIkk6nks2SkFN2kWiRkZOgJByZAR5ZByDpg653jk1YCwM5jADQ/pN8 +QpM7wJIhR4l7oZOSoIoyCXxMiS8JWDsLaJRS+QgwQj5V6Y5XuTFZKTxbmZOvICRKEpYQOZY44JTv +B5Xx0ZWKgCW+EIUc+IgeKI8qSI9YcZSiUCxp0YhSiHhUSJGSaJFyWTh0WQjv0guB6IiGCYmIOY+K +GReA2QnHUxSEmZeTuZeV2ZeXWReZqQl2A5nHuIvJ2IvLeJOLuQ2leQmcA5lZ55Y9U5bOc5ZHEZtX +cl+8mZK8iJCt6XO305h6cEK/KZbBuZK42UG6STzGeQdFlJw+aZte05w+9Jx/GZ10QEjUOU7W6TfY +uUWzKCzcGQew9J2kFZ6QM56bVJ5+oZ6E/qBP6vmTdBCUhTiU/oiOtyGfgQBS1Gmfc4Cf5WiII4mT +0uGffvBavymgckCg/GigRMmH1qGgm4OP5GWVy1mTwxl4Q2KheNB0memgO/OKyhCL3QefzAGiddCO +R0micAChqyah+1mU58GicsCRwgijbyCj6daPsviPMYKjq4OhZdUTPOoGPtp1pFijFGomRMoGSvmN +draawomNv/iaCXqeh2Ok51Sl1siaWKqQWlqhXJoFU4pr7Ck67nlWKgqlZ2oFaQolUZo/5Bih+hmk +/IkoIfQHc8pUFKSXbBiSFXmgZcoedQoGf7qeWRKngrCkadekemqjfPokx+mlakilqQCp/mEoqSkq +pJWaoSGKqdXYp5tqoiDhqdr4pqFqqi1KqqppqabAqbCoqlrpkq3aqK86jbW5AYlqWqiKDCi6qqCa +q7Q1B4tqXR3wq4VAqydqq2aJq8bqqm6QrGCKWo4KlMF6DMN6q6w6rbIqpbBqgHqTrQ+6rdQDpJ+6 +p+C6rObqA9baNcy6behaDN0ard/arqKaBvGaRJzgrKmqrsTKrvo6V++aA/3KQwebBgArrNCam9Ja +sPtKBgmLAvMqkfVKDPcKsfkqscdKseNqkCtwsfeZscOwsc4ZsR4bPgsbAxU7si0bBg3LrQ+bsh27 +sr4asy3wstojCTObrjQ6qU+Ks/7q/gU8yzw6uwU/a681m50qS7Q52wVH6wIkuwZLq7FNS57FCrVZ +lLTFqIG92p4jdaczmqfrSqlcq7BoGrLAeZ2KcLUnm7XvubVpW7RVMLVsCqxk+6NBe7ZDW7cqULUu +y7Yz2ZRe+wRwKwwo67Q3C7jlWjeEq6HNIl4mq7hy66Z067gWe7gwpYOSiZWPWrnBsLhaS7CaG7ic +e5J4manMCQiJO7qXW1dPe7pfygR4O7l98LoFEbuqNbu0W7tJcLutC3Wiu7sC662Z+7swG7yRq5w1 +tXV7y6THi6/Jq7zLawTCi3vwWLy/QLpza7rWS7U6m73e8ZHce5e8O3CNG76bOwTk/otdJRu9kTq9 +HFu97Iu0M9O8bfkEgvsq54ua9Guz9nu/+Auv+tuRUtC/SqC73Zu+Lbm+BIy6PfC+h6Sk/8sXiWmo +EQy/OkDBdMQGDIy+Acy4A7zBwHOeHowbahDCANy3A4u2JnybN5DCSqDAQcDCGGyZGhzDTlUDNNwa +qQuB18iX2Yi84MvDbisDP5wsQSyOV0rEWYrEFQwDSzwWTVyYlEmoGTyhJCnFCOguB1yd3HDFpXqY +WqzDXIygXly+nhiZWNwFNmwDOOy9mHvEa0yWOfiJn/sFcTwDc+zAT3nHQAyFnvvG90DGzkuIBWq2 +L/y3gqy9cwiIXZiPfIzIYryP/mUrkml8qI8snl/LiLpIrmrQx0IsplBMpp38F+NRxUhBBX88wqUL +w6nMxq8Uxkv5BqS8x4MqlJrspF08y897j7zqeWuQy6ybxbxcqJsMzFEQm6xcyU7wyi5sxLLMzFkV +UbacQnZgzG2ryHjay0L7y9b8wT61umXsJ6krzYxMzY48zlNMkOYcq9t8uOoMzn4rzu6swpnHlgi8 +B9x8y5jMt+tMvXaczz2MiPx8yf4cs/WszL6sxgatyjiZ0ADdB//MqAEtvdNM0NUc0eSMhmHbJu/a +0Fv80Jzs0T8wPT1B0do8CNxM0mhs0ih9BTMCPiwNnoWQyzAtmjs801RQJPBx/tMzZSdcutNFzNHt +7NNHwCgtPMm6zAvcadRRrNSQ+2lf0ZnHnNPGKdWoTNVSMDGoidXnTNQ0wNWu6dVfDU69INbyvAgX +a9bEidZOgDioGdKOwKxw7aFybbvHFY2tmAiJmtcruNdNgJyl7NbVJdh+Sdh8Pcw4yiwGMAGRbQCU +jQGRnQKXvQWPfcF0LLsQzNg+XIIgiiyVLQGUfdmZTQGpbQKr3cpPbcqhedT1W9CgjbDhqKBsktmT +XdoHkNqtXdqnLdm7fdqVTdy7PcaGPMSxPdW1zbzD/GnHPNmm3duSXd0XIN3TTd3ajdoVwN1iIJ+K +PZrNjQQS9Z1wIt3GPd28/m0B2L3d2e3dxJ3dY2DenA3IcTnezg3SUdvNwu3b1d3aqt3b8P3e6m3d +AH7IIpvR87vRs93R+D3D48qbfbLaup3e7G3avD3g1G3c7W0GEl7fsPy9Dv7gof3c7prIolCa4d3T +JO6+kQuYssPhgL0WK77MLU4ED7mWQ40KOg6oCt6pIV7HI37jg2vi50Q+SVoGxIjR3pzJDh3OEE3k +tm3kR94RSa7k0VjjMi3l+Uvl5fqMV04GFaTlUH7SXL6FklyH/hrmZ+ALZH7PUX7mJa7fa2Iidn7n +eJ7ner7nJgLiDC7AtC3neezG9wuXG2jmgr6KXh7Bhv5DiT4D1qqvja6d/o/+h0K9spPuu5UujXTO +w5n+2ZsOjotOwJ9ewqGOi2ArxaUe6Keu6J0ew6s+5K3u6sZIjdYb60k962h+6R6L6/is64uY5myt +vL4e58Ae7LwuscWO6Me+XclesMve7EqczUQb7dJOxdSOs9Z+7S4Q6e267dzexk5N6m3q2aYe7uVc +yIVe7r0L6ugek/FM7OyuvudurAUgAfd+AAWw7z+Q7yfg79806utuk3F9uvyu7/qe7wCvAwtPAg3/ +UdmO6fP+wPVuJf5+7/uu8BXw8BmP8QrP7x0/AR0/8gl/8CKf8fhu8hpf8h4P8iHfuXpM7gAw8wBQ +8zZ/8zif8zrf2e1e/vEWj/AIv/L4fgEXD/QXX/RFL/JAv/RLr/JDb/Qpr/QmD/ECz746f/VYj/U8 +T++sjigYz/Jfn/AYsPBC7/Rkj/JJ//Ri//Qr//FKz/JU/+omnPV0X/dbT/FdXyco//ZCbwEHH/Z/ +//drb/Z9H/htz/Ypr/Fp7+zx/rt1//hXf/eB7LhkP/Qk7/eCn/hwr/kjf/lBv/d7v/mKj/ahn+4x +P/CQn/o5zNM2jtIPnwGvvwPeDq6qX/uSf99I3PkeEPtE7+JVH761r/q3f+g+zft+7/tyv8HBn/rD +7+jvLurJz+jL//jNT+nPb/qEbvXTb/f2fegP8v3gH/7iP/7kX/7m/n/+6D/707r93K8bnPH+8B// +8j//9F//9n//+E//oez47J/1SmHJEHDkpNVenPXm3X8wFEeyNM8RCFa2BVA4lme6tm8g13e+9/lW +UDgkFgOvW1K5ZDadT6hSVURGrVdsdvnjdntGcHhY1ZbNZ3Ra3ZkSyWt4XF7z1rtivNi+5/f9f8BA +wUHCQsNDxETFHaO3uUfISDa7vErLS8xMzU3OTr1Az1DRUdJS0yBHSdXVyL3TV9hY2dmjRdtb3NxB +2iNW3985XeFh4mLjY+Rk5WUeYOdn6Gjpaepq62vsbO1t7m7vb/Bw8XHycvNz9HT1dfZ293f4ePl5 ++nr7e/x8/X3+G37/f4ABBQ4kWNDgQYQJFS5k2NDhQ4gRJdKLAAA7 diff --git a/Documentation/DocBook/media/dvb/dvbstb.png b/Documentation/DocBook/media/dvb/dvbstb.png deleted file mode 100644 index 9b8f372e7afd..000000000000 Binary files a/Documentation/DocBook/media/dvb/dvbstb.png and /dev/null differ diff --git a/Documentation/DocBook/media/dvbstb.png.b64 b/Documentation/DocBook/media/dvbstb.png.b64 new file mode 100644 index 000000000000..e8b52fde3d11 --- /dev/null +++ b/Documentation/DocBook/media/dvbstb.png.b64 @@ -0,0 +1,398 @@ +iVBORw0KGgoAAAANSUhEUgAAAzMAAAGaCAYAAAA7Jx25AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBI +WXMAAA3XAAANiQFmEOuiAAAgAElEQVR42uzdd1RU18I28GdgKFZUBE0saFA0KoqFFkEhKhbAQmxJ +bIkNNEpMEUwsMZarJMZrw4KxRExQczUqil0jRBA1GAjGQqLYC4TemdnfH76cj3HodYDntxaLmTll +zuw57Zmz9z4yIYQAkYZzcnJCSkoKGjZsyMIgIiIiquPS09PRoEEDyBhmqCaQyWRo06YN3nvvPRYG +ERERUR137Ngx/Pnnn5CzKKgmMDAwwKpVqxhmiIiIiAj29vZ4//33ocWiICIiIiKimohhhoiIiIiI +GGaIiIiIiIgYZoiIiIiIiBhmiIiIiIiIYYaIiIiIiIhhhoiIiIiIiGGGiIiIiIgYZoiIiIiIiBhm +iIiIiIiIGGaIiIiIiIgYZoiIiIiIiGGGiIiIiIiIYYaIiIiIiIhhhoiIiIiIGGaIiIiIiIgYZoiI +iIiIiBhmiIiIiIiIYYaIiIiIiIhhhoiIiIiIqFLIWQRElSMsLAy2trZo1KgR5HJualTxEhIS8P33 +3+PDDz+sM5+5bdu2ePDgAZo2bcoVgCplm3J0dMS5c+fqzGf++uuvsWTJEm5TVClSU1ORk5ODBw8e +oHXr1gwzRDVJbm4uAGDRokUwMDBggVCFmzlzJrKysurUZ3727BksLCzg4eHBFYAq3IIFC5CQkFCn +PnNGRgYAYNWqVVwBqMJFRUVh48aNUCqVlfYeDDNElWzGjBkMM1QpNm7cWOc+c8uWLTFjxgzMmDGD +KwBVuLt37yIkJKTOfW5nZ2duU1SpYaYysc0MERERERHVSAwzRERERETEMENERERERMQwQ0RERERE +xDBDREREREQMM0RERERERAwzREREREREDDNERERERMQwQ0RERERExDBDRERERETEMENERERERMQw +Q0REREREDDNEREREREQMM0RERERERAwzRERERETEMENERERERMQwQ0RERERExDBDREREREQMM0RE +RERERAwzREREREREDDNEREREREQMM0RERERExDBDRERERETEMENERERERMQwQ0REREREDDNERERE +REQMM0RERERERAwzRERERETEMENERERERMQwQ0REREREVGnkLAKimunBgwdISkoq8/SGhoZ47bXX +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 +AADISP8FpxZnWS0U37cAAAAASUVORK5CYII= diff --git a/Documentation/DocBook/media/fieldseq_bt.gif.b64 b/Documentation/DocBook/media/fieldseq_bt.gif.b64 new file mode 100644 index 000000000000..b5b557b88158 --- /dev/null +++ b/Documentation/DocBook/media/fieldseq_bt.gif.b64 @@ -0,0 +1,447 @@ +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 +l3O5NwEBADs= diff --git a/Documentation/DocBook/media/fieldseq_tb.gif.b64 b/Documentation/DocBook/media/fieldseq_tb.gif.b64 new file mode 100644 index 000000000000..7b4c1766b407 --- /dev/null +++ b/Documentation/DocBook/media/fieldseq_tb.gif.b64 @@ -0,0 +1,445 @@ +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 +kh6JXympkivJkm4TEAA7 diff --git a/Documentation/DocBook/media/nv12mt.gif.b64 b/Documentation/DocBook/media/nv12mt.gif.b64 new file mode 100644 index 000000000000..083a7c85d107 --- /dev/null +++ b/Documentation/DocBook/media/nv12mt.gif.b64 @@ -0,0 +1,37 @@ +R0lGODlhFgFnAMZnAAAAAAYCAgAASAwFBQAAdEgAACQODkgASCoQEEgAdHQAADATEjUVFHQASDsX +F3QAdE0eHVMhIABISABInEhIAIM0Mok2NI84Nk9PT5o9O5xIAHRInFlZWaxEQbhJRgB0v75LSLhQ +TbRTUcBRTrBXVatcWsJWVKdfXW9vb6VhX0h0v8RcWZhpaJJubpBwb8ZiX8ZiYI5zc4t1dYd4eMhn +Zb90AIN8fH9/f8pracpta8ttasxzcM51dM52dM53dc94dkic39F+fNOEgpmZmdWJh9ePjdiTkt+c +SNuamd2gnt6lo3S//5y/nOCqqeKwr+S1tOa7uv+/dOjBwOrGxuzKye3KyuzMy5zf/7/fnO/S0fHX +1//fnPPd3fTe3vXj4vfo6Pnu7r////v09N////35+f//v///3/////////////////////////// +/////////////////////////////////////////////////////////////////////////yH+ +FE5WMTJNVCBtZW1vcnkgbGF5b3V0ACwAAAAAFgFnAAAH/oBngoOEhYaHiImKi4yNjo+QkZKTlJWW +l5iZmpucnZ6foKGio6SlpqeoqaqrrK2ur7CxsrO0tba3uLm6u7y9vr/AwcLDxMXGmkM3ysvMzc7P +0NHS0CjT1tfY19XZ3N3Y297h4sxDlQDj6OLn6ezZ6+3w0u/x9M0A5r/3vvq9/Lz+kQDqEpiLIC6D +txAyUliLIS2HsyDKkniIIiyLrzC60tiKoyCPq0CqEpmKJCqQJk+lNLWyVEtSKPPJ3Ddz0stRN0Xl +DLUTVEyaQPvVlNTzU1FPRzsl5fRTaNB/QwNGHTi1IL6nu5Zu0qqpKVSsVME+4pqJLCazl9Ba8oqp +jAIA/gTCIOXkVsAVo52OAABgV6kmMxr2Cgbil9LLGh/OIJ6r6QgBLAfuMm48YYzPT1siF7a5qUyD +u1HibtaUWfLoS55NT+a0+DSklqXPxK5EJkuhm7NdV8pMYW9i3YJsT8q99Wqm2MQn/cihZRBuzasv +RenrdgnwM8uFQzpSOfrrTcihW5KyogiYM89VF9cUWq7i3+sRTVlB5Lyj6ngNd/58pn0mMUmY4ER6 ++R2nGWCEMbUIGQE2QUYj3Fnm3VibIPgeJ178kEFz4Imn4F8aEJbcWY18EcQLViziVoITOvLSFgXA +5R4iVvxg44045oijByAU0QMIQAYppJAwPHhIFILx/qUeieDFCIB1igjBg45U4nhBlVSaAEIQYiTi +2IzXLbTKF1mUaeaZaJr5RAc5aKeIFStw0RErVehARZp4mrlAnmlCscILU8yp3y5iILECBI7AKaeg +q3DxQ5cuMgLgCg5uZBwuTpiAhBgQKZqRK45CKqYiftZ30aW1WEFDEF58xIinn4L6aCMIabHDDhye +OqgtYgSRonOLwBqrrKImglAQUjyEalg0xjlRLKEuotayFIoliLC6whKtsVVFai222Wo7KyLT7kpU +VeCGK26xhJTLmblZGZKuuutW1C2tUc1Lb7233TuqU9c6m9At2wJrLb68JEEGP/rG4u4iBaPnr7S8 +/ohhgsRnNOxwLgU/LJVh9YR8Qwsl3HCOCyHIIDI986yMjgwkzKBMyy63g1LN8JzAgskoq4wzOzT/ +3E0MIIiQggM2CG0ztbW88MUZDAgc7y5aFlHBCDsk4ebA8NryxQsZd7DoV7oIQcQKBpyhRRM/jOCE +VV3X8kQRcKYtCBnsNsQLFHSLPQjecL+bi9lxApCFEjuM0ASzuXwNtdSMf5yLlkQEAcIOSmzN9S5O +A6Dxs3HPogUIOSBhRQATy1LEE/d8vq+3t5BhhH0YA6zLFELo47qlocNChhC/unowLRYzDLnevbvy +e/DC265LEqgPsntITCsPvCEef4fV9CVVz8ry/vYOjzwh3KvkvSrgh+985AGPDbrgvl9PbuoRNev+ +6wjHzzz29L8v7/G8g18r0sct8SkrEeXTyfkigaS9sIgRBCwge/bSlzBNAjAV/BACAXgIGAmmOxo8 +lybK8AC5TGdJh4igBAuhOUaUYQOWqQEIMVGb2jVGAh6iRA0N9iYOFmJE8RFhJ/CzIPn9qxDZoYR/ +NLEcBNClAUzIISWWw6FO+XAQQOzKAocjxUKoUBEImY+pIAEY+GhCCh0wT2OAkEVJkMc8EtGYB/cC +pRBKjjVmTKER85fCBhlpEQ2c4SYGEKC3XWILCQhDGyUBIBNE4BG7O0IGtZg8SkRIEV+k2CJM/oSi +R0gShWs5Q4aYY4kaiKiLlvDCBUjZCNcRMYh3zMSXFuEDHGAJS1e65Y20xKVGvPJNurTSjUbQox8N +6ZhAosEf3ZIkADxQXsHU0QWI6SNkIrNIKlJAHSkpwEvIUEKK6AKfxrmncZbJT4BSxBZUIIgTlsic +ZyrnE1bQJkws8gxkgieaIEDPFkaiBlCapR21dxwn7UWQTErEpCqlCMBQEJRrKdQKnkAaVFKiUB2g +aEEPCk5YEpRshygV7VwRAU3lbRaZQsIA+qc+kBLCVriKhaos0CpcqIpVNpxaNwNXCGTJoldWyJ5C +fcVDl35Up0blKVJjyT6lNvUgW/TfUp+6jzkhJhWqBqxfJQ+4Pqd6FXZXrepUv8rHsWK1q2e1qlnF +SlVbsKWt4wurW6O6saxKFa5gZCn+5mrXiijNZn8FWmDTEbTBuqMSHDDsODCgWHEwtrHeeCxkucGB +Y1j2spjNrGY3y9nOevazoA2taEdL2tKa9rSoTa1qV8va1rr2tbCNrWxnS9va2va2uM3tLQIBADs= diff --git a/Documentation/DocBook/media/nv12mt_example.gif.b64 b/Documentation/DocBook/media/nv12mt_example.gif.b64 new file mode 100644 index 000000000000..a512078c7f24 --- /dev/null +++ b/Documentation/DocBook/media/nv12mt_example.gif.b64 @@ -0,0 +1,121 @@ +R0lGODlhoAHkAOe1AAAAAAAASAAAdEgAAEgASEgAdBgYGHQAABoaGnQASHQAdC0eHigoKEIlJEYm +JS4uLlssKzY2NgBISFIyMQBInEBAQEhBQUhIAFBBQVhCQkhISF5DQ2NDQmdDQ3NEQ05OToNGRHhJ +SJxIAItHRY9HRXRInJdIRlpaWppLSaJJRqpJR7BIRa5KR2NfX7JKR2BgYGxdXWleXmZfX31ZWXJc +XHpaWQB0v29dXLZKSHhbWolXVpVUU5JVU55SUJhUUqdQTrpLSK9OTKRRT6FSULRNS7hMSrVNSr5L +SL9MSr1OS7xQTsBRTrtTUL5WU7lYVsJWVEh0v7deW4pqab5dW8RcWbdgXrZjYcZgXnd3d8ZiX8Zi +YL9lY7RoZshnZb90ALJubLFwb8prabBzccpta79wbsttaqx6ecxzcKt8e4aGhr93dc10cs51dM52 +dImJib97ec53dc94dqiEhKeHhkic39F+fKeKiaWPj9OEgqSSkb6PjtWJh5qamqGamqCcnNePjZ+f +n9iTkr6amtiUktmVk9+cSL6enduamb+jo92gnr+pqd6lo7Ozs7+wsHS//7W1tZy/nOCqqbm5ub+4 +uOKwr+S1tL+/v9+/dOa7uv+/dOjBwOrGxuzKye3KyuzMy5zf/7/fnO/S0d/fnPHX1+Dg4P/fnPPd +3fTe3vXj4vfo6L//v+/v7/nu7r///9//v/v09N//39////35+f//v///3/////////////////// +//////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////yH+EUNyZWF0ZWQgd2l0aCBH +SU1QACwAAAAAoAHkAAAI/gBrCRxIsKDBgwgTKlzIsKHDhxAjSpxIsaLFixgzatzIsaPHjyBDihxJ +sqTJkyhTqlzJsqXLlzBjypxJs6bNmzhz6tzJs6fPn0CDCh1KtKjRo0iTKl3KtKnTp1CjSp1KtapV +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 +XnvvxTdfffflt19//+03IAA7 diff --git a/Documentation/DocBook/media/pipeline.png.b64 b/Documentation/DocBook/media/pipeline.png.b64 new file mode 100644 index 000000000000..97d9ac007473 --- /dev/null +++ b/Documentation/DocBook/media/pipeline.png.b64 @@ -0,0 +1,213 @@ +iVBORw0KGgoAAAANSUhEUgAAAlgAAAEcCAMAAAAsmToJAAAAAXNSR0IArs4c6QAAAwBQTFRFAAEA +EAEBAwUBCgMBCAUKAgkMHQIDCwYXFQYDBgkVDwgFCAsHChASJwkDFA4NEg4TDhANHgwHDg8aExAG +DBEjBBUZERMQCBNRDxU0ExcZFRgVFRcgCRkzHBcUDRdCNRELIxYTAx4mLBUMEBwcEhsiDxwhExsu +Dh8XJRkQByAtDCMUHx4bACk0DSsiGScsFCRcJSUiGSZCDiwqGCg1LyQbIycpVhsPDy0wNyQVECxA +PSIfCS84ADJCEStWRiIULSwpADdHCDkgEy1/BjorEjhADDhXCzZvITNPUysQDzs8MjIvCj04BT1O +PDEoQjEhMDU3LzY9KTdFTTMYNzk2GD6PAEpfEUVjBExFCEpPB1ArK0FjKEVZYTscdDYXG0d5SkA5 +FEiJQUNAOURPAFhCA1RpP0ZJVEMvYUAyBFtRWkYnDlR+QEleAF1jkTojHlV1AGB4PlN5YU87cUws +SVRXAGaBWVJKUlRRRVZlAG1PWFNSBGt5AmqVAG+NAHNpK17BWl9ifFs9KWmnSGZ0YGFfp1IuCnWj +AHuKbWBXoVNAdGBPDniWAHujTWmLk14rAH+ch19XX2aRX2t8AIeLiWgvAIeeAIaqa21rOnehdW1m +AImspWJYj2tLW3C0AIyvWXaNAo6xb3Z5dXZzent4WIKiQojAen+CkX1pcoSWcYDOoH9fp4E+Y4ur +hoWCXIvGb4mut3xpqYNYnYdUO5rDyXxdjY6LYJqk0IRGb5azXZnMjJGUgJWqpJB8l5aUyJN4kKK1 +rZ6IYqzge6Xho6GdnaWpgqy6yZ9zvaR0hqzMk6rN5Jxxw6mF26lbq7C2pLTGwrCbs7Owvb+8zcGc +8rp42L2xsMbY3L+jtMfsz8W2nM/yx8jH0MfA7MWU78h/3crIyNTo4NLD6dK1z9bc1dbT3NXOv9vr +/OKSwur8++Gw4uTh0ef78uPU+OPL3Ojz++bGyfH36evo/+3b6vT88vPw/feu1/v+//bb//nK/PnW +5f/+//ro+fv49/7///37//71//3//v/8sZeTnQAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAFY4AABWO +AUTUBDsAAAAHdElNRQfaCRQPAiJBEFMLAAAgAElEQVR42u2dD3wU5bX300nWws50shA4lyTGikRE +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 diff --git a/Documentation/DocBook/media/v4l/bayer.pdf b/Documentation/DocBook/media/v4l/bayer.pdf deleted file mode 100644 index 905e60e6cd42..000000000000 Binary files a/Documentation/DocBook/media/v4l/bayer.pdf and /dev/null differ diff --git a/Documentation/DocBook/media/v4l/bayer.png b/Documentation/DocBook/media/v4l/bayer.png deleted file mode 100644 index 9b15fb22e817..000000000000 Binary files a/Documentation/DocBook/media/v4l/bayer.png and /dev/null differ diff --git a/Documentation/DocBook/media/v4l/crop.gif b/Documentation/DocBook/media/v4l/crop.gif deleted file mode 100644 index 3b9e7d836d4b..000000000000 Binary files a/Documentation/DocBook/media/v4l/crop.gif and /dev/null differ diff --git a/Documentation/DocBook/media/v4l/fieldseq_bt.gif b/Documentation/DocBook/media/v4l/fieldseq_bt.gif deleted file mode 100644 index 60e8569a76c9..000000000000 Binary files a/Documentation/DocBook/media/v4l/fieldseq_bt.gif and /dev/null differ diff --git a/Documentation/DocBook/media/v4l/fieldseq_tb.gif b/Documentation/DocBook/media/v4l/fieldseq_tb.gif deleted file mode 100644 index 718492f1cfc7..000000000000 Binary files a/Documentation/DocBook/media/v4l/fieldseq_tb.gif and /dev/null differ diff --git a/Documentation/DocBook/media/v4l/nv12mt.gif b/Documentation/DocBook/media/v4l/nv12mt.gif deleted file mode 100644 index ef2d4cf8367b..000000000000 Binary files a/Documentation/DocBook/media/v4l/nv12mt.gif and /dev/null differ diff --git a/Documentation/DocBook/media/v4l/nv12mt_example.gif b/Documentation/DocBook/media/v4l/nv12mt_example.gif deleted file mode 100644 index df81d68108ee..000000000000 Binary files a/Documentation/DocBook/media/v4l/nv12mt_example.gif and /dev/null differ diff --git a/Documentation/DocBook/media/v4l/pipeline.png b/Documentation/DocBook/media/v4l/pipeline.png deleted file mode 100644 index f19b86c2c24d..000000000000 Binary files a/Documentation/DocBook/media/v4l/pipeline.png and /dev/null differ diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml b/Documentation/DocBook/media/v4l/subdev-formats.xml index 8d3409d2c632..bab70711c7c4 100644 --- a/Documentation/DocBook/media/v4l/subdev-formats.xml +++ b/Documentation/DocBook/media/v4l/subdev-formats.xml @@ -379,9 +379,6 @@
Bayer Patterns - - - diff --git a/Documentation/DocBook/media/v4l/vbi_525.gif b/Documentation/DocBook/media/v4l/vbi_525.gif deleted file mode 100644 index 5580b690d504..000000000000 Binary files a/Documentation/DocBook/media/v4l/vbi_525.gif and /dev/null differ diff --git a/Documentation/DocBook/media/v4l/vbi_625.gif b/Documentation/DocBook/media/v4l/vbi_625.gif deleted file mode 100644 index 34e3251983c4..000000000000 Binary files a/Documentation/DocBook/media/v4l/vbi_625.gif and /dev/null differ diff --git a/Documentation/DocBook/media/v4l/vbi_hsync.gif b/Documentation/DocBook/media/v4l/vbi_hsync.gif deleted file mode 100644 index b02434d3b356..000000000000 Binary files a/Documentation/DocBook/media/v4l/vbi_hsync.gif and /dev/null differ diff --git a/Documentation/DocBook/media/vbi_525.gif.b64 b/Documentation/DocBook/media/vbi_525.gif.b64 new file mode 100644 index 000000000000..d5dcf06f2aef --- /dev/null +++ b/Documentation/DocBook/media/vbi_525.gif.b64 @@ -0,0 +1,84 @@ +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 +E9gqF8bNWgAAOw== diff --git a/Documentation/DocBook/media/vbi_625.gif.b64 b/Documentation/DocBook/media/vbi_625.gif.b64 new file mode 100644 index 000000000000..831f49a02821 --- /dev/null +++ b/Documentation/DocBook/media/vbi_625.gif.b64 @@ -0,0 +1,90 @@ +R0lGODlhKgPIAIAAAAAAAP///yH5BAEAAAEALAAAAAAqA8gAAAL+jI+py+0Po5y02ouz3rz7D4bi +SJbmiabqWgJs475LLCt0fdy4oeN9/QPuEEFZkXVcJZXDXNP5pC0TgGrOCqVMidhAVdqVbLmx73Wc +FXfNabGFzfbG3Rz0bDO/2G1hzJ7o8ceT56dB+Gb4JciD16fnh3VI97bmOCE4tyhVUSbHKOlg1xnp +6aWFKDfaecrqQlrK2vqK2bjImPFaiLuKuxvY+2HLq1tniHcLzFmWy6mnitxMeWs5iaZo0xZhTahj +rdzXHa3m6Eod+h1+LW7MXpx83P7962y+ju4O//5oGr8PHUvs36VjoCBsujTsxp5t0MIB1MZLYb07 +CBt+QlWRHz/+Zto62NLYD+Ouj7Q+ZlMj0J80kCr1iaSHT6WmeAXPAXOVzNs0hw8fHAwzkeLATz9E +xVo2qCa2o7AA9Wz5cmXIgFAhKu2Yb2q1rFSrDmUZFeUgrQaLdhWriFZKGKt6LNTSlopXthevrIUB +d9rSp6FGcbnLwCRYe2ELo+VK+CxEwF9XkoypeCtZn05dTiqlNupMxnyWxXkL17OVtHz7loMTdO+4 +pGsMsz0dKbVcyK7LXsWbyKSweTA95qatDHho4T7TqqsdWN1toaFbExNMHMkTzimgR2cSZfpgI9qt +T8aePbz4IQebeLcsZDz56ecjv2g/9z37+fTNd6+vPb/+/fz++/v/D2CAAg5IYIEGHohgggouyGCD +Dj4IYYQSTkhhhRZeiGGGGm7IYYcefghiiCKOSGKJJp6IYooqrsjidyrAh9yL+K2nng/31WgjjtzN +mKOO8lFHxhlJxRjkkEY2tloWy51k2mxAVoaQQkImRiRuIyEmD5ZIomeVYMLIZhMkS6rWm4vJecZl +cWBsRomUz+Vlymg4bWflYnGWo5FOGZ02FphPYmbkmHQmRxRSgzJXpntl/UlmcIca5ItvilJJx2OS +TkrZo5k6CgemfBDFKJPF7ZRTIZsMgxUip4qKKFN5UropSKD54xasW9p6a65VBiYmb/dc2qZuwMaH +laXvZEb+FbKPCKpkm68KutBoTshZWpN6MRqtm6H+8ZmTulabqplhXikuNtBhgqqnM6SLa7jE2nZd +rGzK5CeUqMxJq6l2YavvTn6yGVG7zGn77aZgvOvuruvGexnCndXLq5YCC2Vsmg2LUzGcTSm8r7fg +0pUKxMgwdOdY/O4JaMkFf/pqyiv/Jau9CY/asqatOlwnzuM6JvHMOsPsZaQZ/3zzV0NfdnS4HL3c +KsBZpnIk01NCHbXP1o4MsSjgyAzp0xsddzHRHqOz2289d83wmb46e/aibauZNhXGMWuz3KjNG6Vz ++fooHY/p8Q0ejYDL6PeO9hX+4+DVsRr4DjByPMLjE5v+ILnUJ1Qe9t+Cb855j4d/jrnVfSuOQuii +N+5555qrbjjrrTt+Y4uyz0577bbfjnvuuu/Oe+++/w588MIPT3zxxh+PfPLKL8+87rWGYLqI0TdP +ffWwM249oXKDgC/y02cPfvgkkPJ97t137075HKovfvvuQ1KXh9zKJ6V37A7P/vv6739Oa0BFnoRK +QG9+2PlJMLDnu/zxb4EMxJPJ/DLA/sXvF0EogsgG5hQDkupeCOydAhkIwvcdAYJeqYdfymOMCvLK +Swe7yKqgkLU4dZB3AaRbCG8YwhrOEGazUaHJNuKboqjQaRBMSDrqBkOu4W9uTAQbDp8IRSV2jFtm +2Y7+thwIDyzi64VIBKIMvQip+/Gwit5Tkw2jiMbsGcVRPfyhBTdGq7gY6ovoG1UL6ximJSwtVLjT +YRr/mMZZFctJRZSgLswiR73gMWcsqw0Jx0a8DwJyksAj4CCjRr7T2aSCiQTiIiMGsvg8UorBkyQl +T7k7S3aNXQJEm2lWxcl9bRGFnWFM2TAIyuOZEpUpOqNHLhgMX9ahXqq02xZTQrCdRQyWdpolq+Yk +uTdqMoG8BOEnZSSsHYLRRmukFAnFGKOA2ayVsBjhNkUgTVcab5fVNNE1F5fNk33wnY2y2iOBWbQ2 +8rFj9axLNBmZy3W2c4H0vFwXcTmUeXaxmBmUlf3+LkmSdJprn5kb50AvWruCUu6g3gKNQrtZmns+ +dJUU/WE/6bjRgAIUoyx1J0e599I0eNQ+INXVPaEH0ZTeAZzE2QI7WwrU7Hw0KzNdT00rOkqckjSm +9jynUvMJyaBKVX5MDSJN9jHUj+UzqTCdGtWcOECJyAmf8CqSbWDTxLSiVa1MZA1b5+bWt5ImZHI1 +Dj2YZddgiSyvel1rXc3w17bSNbCiIWxhDUsGwyoWbNdYrGITO1jCJjatRXIsYs/gV7betbJkhZtM +ndqChkaPJ6fYTdk2g9pyQUmVrJVJQDS6Qnak9pBX1RxXxyfa2o4LmoG7LW6nVdJjgfa3imzc/Ez+ +K9ubKNdiuWytSJz7XKbCliKzxapuE+fJ3k5wHVOoX3AB4tvIAYKnxEUp4Yp7Xj5Od6LLtS5tmYtQ +8Lo2uq5Fbns5+N7Xei68T82ufl3J2/Tyt78Bxm6BS5fb9HJ0vXI57X2jcUv50pe7842uffOLX/f+ +t3UDPmAS59Xd8X63MR32sD9tO1zxfti4y0phcjEMYdV+dsISpnB9XfzgVuS4xgberk79S+Pdphid +CRbwkEML3KpKmMH6OC6OYaxjKGtVNdDlMYn1e2ENZ3jLQdbuFxe34grL68hdRa+RyaviQo02g51F +kpN74WApV0rGFumy0sQs3yxzOcpatjOY/eX+Zbols06wCXSbrwzWPyt5w9hdsHQfHVM0L5POMfPz +mC09Zj3HWM6XZPToFo3nT7Nv0F7e3KhJ+WNHa5rPe04opUkN4FDf+cZwfnGfWY3pH59am2UGda51 +PZ5dj7glb+4Xp5d66yl3VNax/nVzHx3nZM9ZuCiutrV7vN9gZ3t1xW7xjqct7YoK2dlUZnasV+3q +Y2cqwsL2tY2vLerrDfu68ea2t40dbmS32nIzfreVkYblJ+d73d8GOLxLzeFtHzzhC1e0qgW+705H +fJrlJveyLb5sdIN74gSnNsM/DvJ6N1zk2H5dt1Vla45v8tWofjbG+01hjUt80wO/dMgRXvL+nOsc +CHM1Qs/fw9fhkEtMmrBhovMW2Mn+Vel1Zbpcnf50r7KN6CMpOj6DjoSfZ/3o1dG6Erz+da5Pdexk +L7vZz472tKt97Wxvu9vfDve4y33udK+73e+O97zrfe9877vf/w74wAt+8IQvvOEPj/jEK37xjG+8 +4x8P+chLfvKUr7zlL4/5zGt+85zvvOfx7sNrXfzzpC89gyQB6zqbfvWsL9Bh7xgyNbd+9rT3zxwr +3aly1n73vAcdMw7rxt4Lf/iE4+LX2rJH4it/+bLNvSI7JXbmS3/61K++9a+P/exrf/vc7773vw/+ +8It//OQvv/nPj/70q3/97G+/+98P//j+y3/+9K+//e+P//zrf//877///w+AASiAA0iABWiAB4iA +CaiAC8iADeiADwiBtoc4n+Y6FChvFYg6qaOBG/g6HNiBq3OBE7gua1I1FCd1JKhsXkVa4jaCPRRD +XoOCKUg1MMeCtVQZ0RdVZQVD/+I1dzImWsMT0AKDUmeCR3I3HHOELXdSahMoP/g0n/GCUdKETvgn +5MMnJ3MYX4VFRQgoUChIboMmybdSIHOFYqhSfQFoJlWDQGOEYjMLs2A5b7iC6kQzaCJ6ayhLX6VN +JONAgHVUdSiHu2KFPoaHD5QykrZDsYEq3VQSUzQ5qzUyMniDOTiGNoeFGPE8/DZjQjj+XzhIiXfm +ibymegeFLBqkiZFYM4XoMXqjiqNHiskSikqIKIX2iDA3K9mSJ9QiiZmAiq3YhrIIjCoYjOrFilQo +dGamibzoMlxoViozBrhIg8yojDOYjM6hi9XoXZcohf/whVaBWYi4LZXQh7WYhNsiil9Gi6eIe4lY +KsP4Um6yV+04jKVIV7U4ilVIVKkYKzXGUAZHS3QoGbEniRv0j/tYWpmojqT1h+5yTANZaY5Whc8g +Q8QEJ/AIjlrTi+aIMkn0M7lgKAupPQTTjWiIexfpDBZhhp+4PQ/Zj2TYUNpYh81CkRsJezKYSUt4 +hi6piDBJkuOYkji5ks5nSUA4JZz+uI1KMpPHyBIjeTVqBpKvcYNRmCTRCJBNmYtPaZV22Ip5cHv8 +xpVEWJVQiZRMKZakYZRS+HNkyYRaqJYtaIRS6Y0zGI/zRmlEJoIKFoIeaIF6mYEg6Jcf+JeNlpd/ +Y0qFGTsY2JeCGZiKCZiNuZeO+ZiMCZnnZZikg2CWaVCYiWSaWV6I6XB8mZiRKZmiGYGlaZqniZqp +qZqryZqt2WuDOZl4uZikKZux+ZmzGZq5WZu2mZmc2ZueeZm+aZfC2V+wyZupZpy0eZu4uZzHuZlE +OYUK85UlaJA6uJTSuTXU6IvTeJbwpUw9CDluKTZAWZ3N8TZiWZdulZ7UaY9s6Z3+NqidDjmNmFiR +ntAtKRiI9qknh+GFgoh842iTqvCR7QmWDmmI79mT6hJKCgpVBkpm5RmewQWODRqSP5mTMWmhFLow +XyOPzdBCC/VfBVmJBqOS5BlfIPomJeqOGvqd40mX71gL53km8RQscdOi6siRCHqiOMqNDGouwCSi +TUKCSXmUYLSfRzmHYYmeD3mK98meI+qLKgqhUbqWBEqIDpqhUOqS63mOXfqkPJp6SgpgF+RgTnNv +6Uil8MiOKcpr9AhHzNgsUjpiSZMRXGqidzqCV7c2ERqkVLqicroXdEozb5qQZNSeikimiSiROEGk +YMhm+FifPTo5v7dPGNkyWTr+pzJ6oQ6ahy76p16KqSy6oYLqp6DqpTB6qqU4oeeIkBjzhDv5iNMZ +n1NapUlKq/DplOT4P1+6qTwqXbEoqp7lqakao5qKqz66klwqTFQkWJAzV0Z3V31KosT5msmpm7up +nMH5OcCprdaKrdn6m9yqU5W5reK6meUKms05mteqruwart7aru46rncZr99qr/farelar/mqr+/K +nPvqr//qmgNLsAVrsAeLsAl7O8ansNP3U9ZjKaHasID0sNxTsc3Dbi86sfxzaPzRsZOUse62sR9y +Ho8BI+RUp1KhhlMVshc7sgMSG8N0pUGZi8HET2KRYUxGSS37sh60jMuCZgD+Sqgn6U+xtLLTJqIS +5bInEkD7+LE9qyASQShBCBX3g0j66KHFZbRDS3CkhkfQtLQu9UqGKrJQmyD+s1O1MpciRrYn9opm +xkrPMkO0VEVqe7QNdFlm2yIFpoxusap1ezO8lTWdFJVu25U3qjKpeDBhWyI1BKx6CyJJJWltyahW +dCrRgowf9kKH26s3qXrSAkV+BLm086EvKaYNirIZpyqlK2Lsxbmiij5xG7qjKzwh9oxA8k8eCmtf +m10+pTFXyrgkEry0GyDd5Q2ykbtmtE1DtFN2YUGY2ranyjzDq3ePi05PO3U+IEzF6rsV8byg25mT +BpJS+0aryqnTe33mC1P+WUVv+iYE6otUMzss4utNpuu6yGlN6auxWWtUMbFGWZW8S6Gza1hiXHJg +w4lD1Jt38EtBNOW/NMdN+ysqBYwwFDwXB1ycxCsgDGxV/du+7ssdHAyhFtwuJFy/Ioy4GuyxEjwQ +7OtpMxfCLEwnJvwyNGxTD6qjKkwjLvy++QjBPVy2UmTD0zTETYXCWqrD9MHDMexxuMbEAdxGAZwJ +sNoCQOGH2MtZjhVZSWdZr7d0W9x00cqseAV2Z7VXz2pZYNx0XRxXSafGXRzGUwjHbwVZcxzHscfG +39hEWWzHalXH2/saYsWrxYqSMnxxA6xyhoRviTxpyMqkV/Zy9+iPEMf+v+q2cqaGw8BSxEsGaZyR +jWsWZmdmyM92xLOGyD9cyfdWc7iBN5Dsb678b6ZMyaWVcqjcY6XcbKfMySAGiqO8iUFMaJncaxh8 +rpucboucyoxMXTksybP2ygZnYzIXRrXsxLfsy3Wmy5A8wGH6Wbh8admMaNesusCMS+AMw7RcawUH +wgm5otzscs8sy+mMzNW8cSjmzeNmzrkcaUr4yYFGzhh0z738z4c80PaLcvK8yo08nu68o84cy/qM +0Adtyay8rcRcXsY8yW56buKsptPTzwkX0C6Xzx03zy1MzcccngxdcfDcbNE8yyatziSdbSFdzgX9 +yxqdaRxdZIpm0b/+iaY+PcgeJs2UEW3KjKeQGMmPDM2cHNHJbMv1DNKAbMpYLNKJ2kH1I9W5TNWk +nNWwTHJ9M9SKnNDL7Mgq7YpevdTa/NJuUNRPjXNvbWQKt3NwPdc8nSNhjRdtTc9wqtQOjdZ+PclN +jc4TrdBy/dV0bdcjp62SZNYEdtdr3RF6jdKH2s6VLYqN/cuCDdOETdYX2G6f7dmGfdg3F9c7gtex +FdOXvNCWrV6sDZF3KNGqbNT6FNqKDWyiXdqkXdeL/diazdYnDdXsfNmuXWVq7duRDdznPNqJrdvM +vdu8XdG4DWan3bypTdFlTdzmNm4ufdzTbN2FbdvFLN3OvdzkHd7RF93bJf3b393ZKZ3dSY3Z2AzZ +3s3ZAhzd551mNv3Ozw3U5lHGpfPfl3NGA351Rmfgj6XHd7xYUKdZCR51rGE2vVJ1E04eAU45Fl7F +1htMGv5LHN7hXZ3EIS7iI07iJW7iJ47iKa7iK87iLe7iLw7jMS7jM07jNW7jN47jOa7jO87jPe7j +Pw7kQV68E+EQhqrAQs6aZmirzYzkQC4aAmmIygHlTS7kP0G3gRJ8VB7kAGCRbQB8uqflTu6Ci4jl +ehjmPs7laf58XB7Fau6DR56aBQAAOw== diff --git a/Documentation/DocBook/media/vbi_hsync.gif.b64 b/Documentation/DocBook/media/vbi_hsync.gif.b64 new file mode 100644 index 000000000000..cdafabed5c11 --- /dev/null +++ b/Documentation/DocBook/media/vbi_hsync.gif.b64 @@ -0,0 +1,43 @@ +R0lGODlhBwHJAOcAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4O +Dg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGxwcHB0dHR4eHh8fHyAgICEh +ISIiIiMjIyQkJCUlJSYmJicnJygoKCkpKSoqKisrKywsLC0tLS4uLi8vLzAwMDExMTIyMjMzMzQ0 +NDU1NTY2Njc3Nzg4ODk5OTo6Ojs7Ozw8PD09PT4+Pj8/P0BAQEFBQUJCQkNDQ0REREVFRUZGRkdH +R0hISElJSUpKSktLS0xMTE1NTU5OTk9PT1BQUFFRUVJSUlNTU1RUVFVVVVZWVldXV1hYWFlZWVpa +WltbW1xcXF1dXV5eXl9fX2BgYGFhYWJiYmNjY2RkZGVlZWZmZmdnZ2hoaGlpaWpqamtra2xsbG1t +bW5ubm9vb3BwcHFxcXJycnNzc3R0dHV1dXZ2dnd3d3h4eHl5eXp6ent7e3x8fH19fX5+fn9/f4CA +gIGBgYKCgoODg4SEhIWFhYaGhoeHh4iIiImJiYqKiouLi4yMjI2NjY6Ojo+Pj5CQkJGRkZKSkpOT +k5SUlJWVlZaWlpeXl5iYmJmZmZqampubm5ycnJ2dnZ6enp+fn6CgoKGhoaKioqOjo6SkpKWlpaam +pqenp6ioqKmpqaqqqqurq6ysrK2tra6urq+vr7CwsLGxsbKysrOzs7S0tLW1tba2tre3t7i4uLm5 +ubq6uru7u7y8vL29vb6+vr+/v8DAwMHBwcLCwsPDw8TExMXFxcbGxsfHx8jIyMnJycrKysvLy8zM +zM3Nzc7Ozs/Pz9DQ0NHR0dLS0tPT09TU1NXV1dbW1tfX19jY2NnZ2dra2tvb29zc3N3d3d7e3t/f +3+Dg4OHh4eLi4uPj4+Tk5OXl5ebm5ufn5+jo6Onp6erq6uvr6+zs7O3t7e7u7u/v7/Dw8PHx8fLy +8vPz8/T09PX19fb29vf39/j4+Pn5+fr6+vv7+/z8/P39/f7+/v///ywAAAAABwHJAAAI/gD/CRxI +sKDBgwgTKlzIsKHDhxAjSpxIsaLFixgzatzIsaPHjyBDihxJsqTJkyhTqlzJsqXLlzBjypxJs6bN +mzhz6tzJs6fPn0CDCh1KtKjRo0iTKl3KtKnTp1CjSp1KtarVqyQBYN1aVSvXr1C9gh2rVOxCsV4B +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 +8lIkIAA7 -- cgit v1.2.3 From f8fc729870ee82662ae6e3a713d59b2fbf3b04c6 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Sat, 11 Jun 2011 17:46:42 +0000 Subject: [media] marvell-cam: Move cafe-ccic into its own directory This driver will soon become a family of drivers, so let's give it its own place to live. This move requires putting ov7670.h into include/media, but there are no code changes. Cc: Daniel Drake Signed-off-by: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/Kconfig | 11 +- drivers/media/video/Makefile | 2 +- drivers/media/video/cafe_ccic-regs.h | 166 -- drivers/media/video/cafe_ccic.c | 2267 --------------------- drivers/media/video/marvell-ccic/Kconfig | 9 + drivers/media/video/marvell-ccic/Makefile | 1 + drivers/media/video/marvell-ccic/cafe_ccic-regs.h | 166 ++ drivers/media/video/marvell-ccic/cafe_ccic.c | 2267 +++++++++++++++++++++ drivers/media/video/ov7670.c | 3 +- drivers/media/video/ov7670.h | 20 - include/media/ov7670.h | 20 + 11 files changed, 2467 insertions(+), 2465 deletions(-) delete mode 100644 drivers/media/video/cafe_ccic-regs.h delete mode 100644 drivers/media/video/cafe_ccic.c create mode 100644 drivers/media/video/marvell-ccic/Kconfig create mode 100644 drivers/media/video/marvell-ccic/Makefile create mode 100644 drivers/media/video/marvell-ccic/cafe_ccic-regs.h create mode 100644 drivers/media/video/marvell-ccic/cafe_ccic.c delete mode 100644 drivers/media/video/ov7670.h create mode 100644 include/media/ov7670.h diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index bb53de7fe408..4847c2cbc72b 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -707,6 +707,8 @@ source "drivers/media/video/cx18/Kconfig" source "drivers/media/video/saa7164/Kconfig" +source "drivers/media/video/marvell-ccic/Kconfig" + config VIDEO_M32R_AR tristate "AR devices" depends on M32R && VIDEO_V4L2 @@ -726,15 +728,6 @@ config VIDEO_M32R_AR_M64278 To compile this driver as a module, choose M here: the module will be called arv. -config VIDEO_CAFE_CCIC - tristate "Marvell 88ALP01 (Cafe) CMOS Camera Controller support" - depends on PCI && I2C && VIDEO_V4L2 - select VIDEO_OV7670 - ---help--- - This is a video4linux2 driver for the Marvell 88ALP01 integrated - CMOS camera controller. This is the controller found on first- - generation OLPC systems. - config VIDEO_SR030PC30 tristate "SR030PC30 VGA camera sensor support" depends on I2C && VIDEO_V4L2 diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index f0fecd6f6a33..42b6a7a64821 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -127,7 +127,7 @@ obj-$(CONFIG_VIDEO_M32R_AR_M64278) += arv.o obj-$(CONFIG_VIDEO_CX2341X) += cx2341x.o -obj-$(CONFIG_VIDEO_CAFE_CCIC) += cafe_ccic.o +obj-$(CONFIG_VIDEO_CAFE_CCIC) += marvell-ccic/ obj-$(CONFIG_VIDEO_VIA_CAMERA) += via-camera.o diff --git a/drivers/media/video/cafe_ccic-regs.h b/drivers/media/video/cafe_ccic-regs.h deleted file mode 100644 index 8e2a87cdc791..000000000000 --- a/drivers/media/video/cafe_ccic-regs.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Register definitions for the m88alp01 camera interface. Offsets in bytes - * as given in the spec. - * - * Copyright 2006 One Laptop Per Child Association, Inc. - * - * Written by Jonathan Corbet, corbet@lwn.net. - * - * This file may be distributed under the terms of the GNU General - * Public License, version 2. - */ -#define REG_Y0BAR 0x00 -#define REG_Y1BAR 0x04 -#define REG_Y2BAR 0x08 -/* ... */ - -#define REG_IMGPITCH 0x24 /* Image pitch register */ -#define IMGP_YP_SHFT 2 /* Y pitch params */ -#define IMGP_YP_MASK 0x00003ffc /* Y pitch field */ -#define IMGP_UVP_SHFT 18 /* UV pitch (planar) */ -#define IMGP_UVP_MASK 0x3ffc0000 -#define REG_IRQSTATRAW 0x28 /* RAW IRQ Status */ -#define IRQ_EOF0 0x00000001 /* End of frame 0 */ -#define IRQ_EOF1 0x00000002 /* End of frame 1 */ -#define IRQ_EOF2 0x00000004 /* End of frame 2 */ -#define IRQ_SOF0 0x00000008 /* Start of frame 0 */ -#define IRQ_SOF1 0x00000010 /* Start of frame 1 */ -#define IRQ_SOF2 0x00000020 /* Start of frame 2 */ -#define IRQ_OVERFLOW 0x00000040 /* FIFO overflow */ -#define IRQ_TWSIW 0x00010000 /* TWSI (smbus) write */ -#define IRQ_TWSIR 0x00020000 /* TWSI read */ -#define IRQ_TWSIE 0x00040000 /* TWSI error */ -#define TWSIIRQS (IRQ_TWSIW|IRQ_TWSIR|IRQ_TWSIE) -#define FRAMEIRQS (IRQ_EOF0|IRQ_EOF1|IRQ_EOF2|IRQ_SOF0|IRQ_SOF1|IRQ_SOF2) -#define ALLIRQS (TWSIIRQS|FRAMEIRQS|IRQ_OVERFLOW) -#define REG_IRQMASK 0x2c /* IRQ mask - same bits as IRQSTAT */ -#define REG_IRQSTAT 0x30 /* IRQ status / clear */ - -#define REG_IMGSIZE 0x34 /* Image size */ -#define IMGSZ_V_MASK 0x1fff0000 -#define IMGSZ_V_SHIFT 16 -#define IMGSZ_H_MASK 0x00003fff -#define REG_IMGOFFSET 0x38 /* IMage offset */ - -#define REG_CTRL0 0x3c /* Control 0 */ -#define C0_ENABLE 0x00000001 /* Makes the whole thing go */ - -/* Mask for all the format bits */ -#define C0_DF_MASK 0x00fffffc /* Bits 2-23 */ - -/* RGB ordering */ -#define C0_RGB4_RGBX 0x00000000 -#define C0_RGB4_XRGB 0x00000004 -#define C0_RGB4_BGRX 0x00000008 -#define C0_RGB4_XBGR 0x0000000c -#define C0_RGB5_RGGB 0x00000000 -#define C0_RGB5_GRBG 0x00000004 -#define C0_RGB5_GBRG 0x00000008 -#define C0_RGB5_BGGR 0x0000000c - -/* Spec has two fields for DIN and DOUT, but they must match, so - combine them here. */ -#define C0_DF_YUV 0x00000000 /* Data is YUV */ -#define C0_DF_RGB 0x000000a0 /* ... RGB */ -#define C0_DF_BAYER 0x00000140 /* ... Bayer */ -/* 8-8-8 must be missing from the below - ask */ -#define C0_RGBF_565 0x00000000 -#define C0_RGBF_444 0x00000800 -#define C0_RGB_BGR 0x00001000 /* Blue comes first */ -#define C0_YUV_PLANAR 0x00000000 /* YUV 422 planar format */ -#define C0_YUV_PACKED 0x00008000 /* YUV 422 packed */ -#define C0_YUV_420PL 0x0000a000 /* YUV 420 planar */ -/* Think that 420 packed must be 111 - ask */ -#define C0_YUVE_YUYV 0x00000000 /* Y1CbY0Cr */ -#define C0_YUVE_YVYU 0x00010000 /* Y1CrY0Cb */ -#define C0_YUVE_VYUY 0x00020000 /* CrY1CbY0 */ -#define C0_YUVE_UYVY 0x00030000 /* CbY1CrY0 */ -#define C0_YUVE_XYUV 0x00000000 /* 420: .YUV */ -#define C0_YUVE_XYVU 0x00010000 /* 420: .YVU */ -#define C0_YUVE_XUVY 0x00020000 /* 420: .UVY */ -#define C0_YUVE_XVUY 0x00030000 /* 420: .VUY */ -/* Bayer bits 18,19 if needed */ -#define C0_HPOL_LOW 0x01000000 /* HSYNC polarity active low */ -#define C0_VPOL_LOW 0x02000000 /* VSYNC polarity active low */ -#define C0_VCLK_LOW 0x04000000 /* VCLK on falling edge */ -#define C0_DOWNSCALE 0x08000000 /* Enable downscaler */ -#define C0_SIFM_MASK 0xc0000000 /* SIF mode bits */ -#define C0_SIF_HVSYNC 0x00000000 /* Use H/VSYNC */ -#define CO_SOF_NOSYNC 0x40000000 /* Use inband active signaling */ - - -#define REG_CTRL1 0x40 /* Control 1 */ -#define C1_444ALPHA 0x00f00000 /* Alpha field in RGB444 */ -#define C1_ALPHA_SHFT 20 -#define C1_DMAB32 0x00000000 /* 32-byte DMA burst */ -#define C1_DMAB16 0x02000000 /* 16-byte DMA burst */ -#define C1_DMAB64 0x04000000 /* 64-byte DMA burst */ -#define C1_DMAB_MASK 0x06000000 -#define C1_TWOBUFS 0x08000000 /* Use only two DMA buffers */ -#define C1_PWRDWN 0x10000000 /* Power down */ - -#define REG_CLKCTRL 0x88 /* Clock control */ -#define CLK_DIV_MASK 0x0000ffff /* Upper bits RW "reserved" */ - -#define REG_GPR 0xb4 /* General purpose register. This - controls inputs to the power and reset - pins on the OV7670 used with OLPC; - other deployments could differ. */ -#define GPR_C1EN 0x00000020 /* Pad 1 (power down) enable */ -#define GPR_C0EN 0x00000010 /* Pad 0 (reset) enable */ -#define GPR_C1 0x00000002 /* Control 1 value */ -/* - * Control 0 is wired to reset on OLPC machines. For ov7x sensors, - * it is active low, for 0v6x, instead, it's active high. What - * fun. - */ -#define GPR_C0 0x00000001 /* Control 0 value */ - -#define REG_TWSIC0 0xb8 /* TWSI (smbus) control 0 */ -#define TWSIC0_EN 0x00000001 /* TWSI enable */ -#define TWSIC0_MODE 0x00000002 /* 1 = 16-bit, 0 = 8-bit */ -#define TWSIC0_SID 0x000003fc /* Slave ID */ -#define TWSIC0_SID_SHIFT 2 -#define TWSIC0_CLKDIV 0x0007fc00 /* Clock divider */ -#define TWSIC0_MASKACK 0x00400000 /* Mask ack from sensor */ -#define TWSIC0_OVMAGIC 0x00800000 /* Make it work on OV sensors */ - -#define REG_TWSIC1 0xbc /* TWSI control 1 */ -#define TWSIC1_DATA 0x0000ffff /* Data to/from camchip */ -#define TWSIC1_ADDR 0x00ff0000 /* Address (register) */ -#define TWSIC1_ADDR_SHIFT 16 -#define TWSIC1_READ 0x01000000 /* Set for read op */ -#define TWSIC1_WSTAT 0x02000000 /* Write status */ -#define TWSIC1_RVALID 0x04000000 /* Read data valid */ -#define TWSIC1_ERROR 0x08000000 /* Something screwed up */ - - -#define REG_UBAR 0xc4 /* Upper base address register */ - -/* - * Here's the weird global control registers which are said to live - * way up here. - */ -#define REG_GL_CSR 0x3004 /* Control/status register */ -#define GCSR_SRS 0x00000001 /* SW Reset set */ -#define GCSR_SRC 0x00000002 /* SW Reset clear */ -#define GCSR_MRS 0x00000004 /* Master reset set */ -#define GCSR_MRC 0x00000008 /* HW Reset clear */ -#define GCSR_CCIC_EN 0x00004000 /* CCIC Clock enable */ -#define REG_GL_IMASK 0x300c /* Interrupt mask register */ -#define GIMSK_CCIC_EN 0x00000004 /* CCIC Interrupt enable */ - -#define REG_GL_FCR 0x3038 /* GPIO functional control register */ -#define GFCR_GPIO_ON 0x08 /* Camera GPIO enabled */ -#define REG_GL_GPIOR 0x315c /* GPIO register */ -#define GGPIO_OUT 0x80000 /* GPIO output */ -#define GGPIO_VAL 0x00008 /* Output pin value */ - -#define REG_LEN REG_GL_IMASK + 4 - - -/* - * Useful stuff that probably belongs somewhere global. - */ -#define VGA_WIDTH 640 -#define VGA_HEIGHT 480 diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c deleted file mode 100644 index 664703398493..000000000000 --- a/drivers/media/video/cafe_ccic.c +++ /dev/null @@ -1,2267 +0,0 @@ -/* - * A driver for the CMOS camera controller in the Marvell 88ALP01 "cafe" - * multifunction chip. Currently works with the Omnivision OV7670 - * sensor. - * - * The data sheet for this device can be found at: - * http://www.marvell.com/products/pc_connectivity/88alp01/ - * - * Copyright 2006 One Laptop Per Child Association, Inc. - * Copyright 2006-7 Jonathan Corbet - * - * Written by Jonathan Corbet, corbet@lwn.net. - * - * v4l2_device/v4l2_subdev conversion by: - * Copyright (C) 2009 Hans Verkuil - * - * Note: this conversion is untested! Please contact the linux-media - * mailinglist if you can test this, together with the test results. - * - * This file may be distributed under the terms of the GNU General - * Public License, version 2. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "ov7670.h" -#include "cafe_ccic-regs.h" - -#define CAFE_VERSION 0x000002 - - -/* - * Parameters. - */ -MODULE_AUTHOR("Jonathan Corbet "); -MODULE_DESCRIPTION("Marvell 88ALP01 CMOS Camera Controller driver"); -MODULE_LICENSE("GPL"); -MODULE_SUPPORTED_DEVICE("Video"); - -/* - * Internal DMA buffer management. Since the controller cannot do S/G I/O, - * we must have physically contiguous buffers to bring frames into. - * These parameters control how many buffers we use, whether we - * allocate them at load time (better chance of success, but nails down - * memory) or when somebody tries to use the camera (riskier), and, - * for load-time allocation, how big they should be. - * - * The controller can cycle through three buffers. We could use - * more by flipping pointers around, but it probably makes little - * sense. - */ - -#define MAX_DMA_BUFS 3 -static int alloc_bufs_at_read; -module_param(alloc_bufs_at_read, bool, 0444); -MODULE_PARM_DESC(alloc_bufs_at_read, - "Non-zero value causes DMA buffers to be allocated when the " - "video capture device is read, rather than at module load " - "time. This saves memory, but decreases the chances of " - "successfully getting those buffers."); - -static int n_dma_bufs = 3; -module_param(n_dma_bufs, uint, 0644); -MODULE_PARM_DESC(n_dma_bufs, - "The number of DMA buffers to allocate. Can be either two " - "(saves memory, makes timing tighter) or three."); - -static int dma_buf_size = VGA_WIDTH * VGA_HEIGHT * 2; /* Worst case */ -module_param(dma_buf_size, uint, 0444); -MODULE_PARM_DESC(dma_buf_size, - "The size of the allocated DMA buffers. If actual operating " - "parameters require larger buffers, an attempt to reallocate " - "will be made."); - -static int min_buffers = 1; -module_param(min_buffers, uint, 0644); -MODULE_PARM_DESC(min_buffers, - "The minimum number of streaming I/O buffers we are willing " - "to work with."); - -static int max_buffers = 10; -module_param(max_buffers, uint, 0644); -MODULE_PARM_DESC(max_buffers, - "The maximum number of streaming I/O buffers an application " - "will be allowed to allocate. These buffers are big and live " - "in vmalloc space."); - -static int flip; -module_param(flip, bool, 0444); -MODULE_PARM_DESC(flip, - "If set, the sensor will be instructed to flip the image " - "vertically."); - - -enum cafe_state { - S_NOTREADY, /* Not yet initialized */ - S_IDLE, /* Just hanging around */ - S_FLAKED, /* Some sort of problem */ - S_SINGLEREAD, /* In read() */ - S_SPECREAD, /* Speculative read (for future read()) */ - S_STREAMING /* Streaming data */ -}; - -/* - * Tracking of streaming I/O buffers. - */ -struct cafe_sio_buffer { - struct list_head list; - struct v4l2_buffer v4lbuf; - char *buffer; /* Where it lives in kernel space */ - int mapcount; - struct cafe_camera *cam; -}; - -/* - * A description of one of our devices. - * Locking: controlled by s_mutex. Certain fields, however, require - * the dev_lock spinlock; they are marked as such by comments. - * dev_lock is also required for access to device registers. - */ -struct cafe_camera -{ - struct v4l2_device v4l2_dev; - enum cafe_state state; - unsigned long flags; /* Buffer status, mainly (dev_lock) */ - int users; /* How many open FDs */ - struct file *owner; /* Who has data access (v4l2) */ - - /* - * Subsystem structures. - */ - struct pci_dev *pdev; - struct video_device vdev; - struct i2c_adapter i2c_adapter; - struct v4l2_subdev *sensor; - unsigned short sensor_addr; - - unsigned char __iomem *regs; - struct list_head dev_list; /* link to other devices */ - - /* DMA buffers */ - unsigned int nbufs; /* How many are alloc'd */ - int next_buf; /* Next to consume (dev_lock) */ - unsigned int dma_buf_size; /* allocated size */ - void *dma_bufs[MAX_DMA_BUFS]; /* Internal buffer addresses */ - dma_addr_t dma_handles[MAX_DMA_BUFS]; /* Buffer bus addresses */ - unsigned int specframes; /* Unconsumed spec frames (dev_lock) */ - unsigned int sequence; /* Frame sequence number */ - unsigned int buf_seq[MAX_DMA_BUFS]; /* Sequence for individual buffers */ - - /* Streaming buffers */ - unsigned int n_sbufs; /* How many we have */ - struct cafe_sio_buffer *sb_bufs; /* The array of housekeeping structs */ - struct list_head sb_avail; /* Available for data (we own) (dev_lock) */ - struct list_head sb_full; /* With data (user space owns) (dev_lock) */ - struct tasklet_struct s_tasklet; - - /* Current operating parameters */ - u32 sensor_type; /* Currently ov7670 only */ - struct v4l2_pix_format pix_format; - enum v4l2_mbus_pixelcode mbus_code; - - /* Locks */ - struct mutex s_mutex; /* Access to this structure */ - spinlock_t dev_lock; /* Access to device */ - - /* Misc */ - wait_queue_head_t smbus_wait; /* Waiting on i2c events */ - wait_queue_head_t iowait; /* Waiting on frame data */ -}; - -/* - * Status flags. Always manipulated with bit operations. - */ -#define CF_BUF0_VALID 0 /* Buffers valid - first three */ -#define CF_BUF1_VALID 1 -#define CF_BUF2_VALID 2 -#define CF_DMA_ACTIVE 3 /* A frame is incoming */ -#define CF_CONFIG_NEEDED 4 /* Must configure hardware */ - -#define sensor_call(cam, o, f, args...) \ - v4l2_subdev_call(cam->sensor, o, f, ##args) - -static inline struct cafe_camera *to_cam(struct v4l2_device *dev) -{ - return container_of(dev, struct cafe_camera, v4l2_dev); -} - -static struct cafe_format_struct { - __u8 *desc; - __u32 pixelformat; - int bpp; /* Bytes per pixel */ - enum v4l2_mbus_pixelcode mbus_code; -} cafe_formats[] = { - { - .desc = "YUYV 4:2:2", - .pixelformat = V4L2_PIX_FMT_YUYV, - .mbus_code = V4L2_MBUS_FMT_YUYV8_2X8, - .bpp = 2, - }, - { - .desc = "RGB 444", - .pixelformat = V4L2_PIX_FMT_RGB444, - .mbus_code = V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE, - .bpp = 2, - }, - { - .desc = "RGB 565", - .pixelformat = V4L2_PIX_FMT_RGB565, - .mbus_code = V4L2_MBUS_FMT_RGB565_2X8_LE, - .bpp = 2, - }, - { - .desc = "Raw RGB Bayer", - .pixelformat = V4L2_PIX_FMT_SBGGR8, - .mbus_code = V4L2_MBUS_FMT_SBGGR8_1X8, - .bpp = 1 - }, -}; -#define N_CAFE_FMTS ARRAY_SIZE(cafe_formats) - -static struct cafe_format_struct *cafe_find_format(u32 pixelformat) -{ - unsigned i; - - for (i = 0; i < N_CAFE_FMTS; i++) - if (cafe_formats[i].pixelformat == pixelformat) - return cafe_formats + i; - /* Not found? Then return the first format. */ - return cafe_formats; -} - -/* - * Start over with DMA buffers - dev_lock needed. - */ -static void cafe_reset_buffers(struct cafe_camera *cam) -{ - int i; - - cam->next_buf = -1; - for (i = 0; i < cam->nbufs; i++) - clear_bit(i, &cam->flags); - cam->specframes = 0; -} - -static inline int cafe_needs_config(struct cafe_camera *cam) -{ - return test_bit(CF_CONFIG_NEEDED, &cam->flags); -} - -static void cafe_set_config_needed(struct cafe_camera *cam, int needed) -{ - if (needed) - set_bit(CF_CONFIG_NEEDED, &cam->flags); - else - clear_bit(CF_CONFIG_NEEDED, &cam->flags); -} - - - - -/* - * Debugging and related. - */ -#define cam_err(cam, fmt, arg...) \ - dev_err(&(cam)->pdev->dev, fmt, ##arg); -#define cam_warn(cam, fmt, arg...) \ - dev_warn(&(cam)->pdev->dev, fmt, ##arg); -#define cam_dbg(cam, fmt, arg...) \ - dev_dbg(&(cam)->pdev->dev, fmt, ##arg); - - -/* ---------------------------------------------------------------------*/ - -/* - * Device register I/O - */ -static inline void cafe_reg_write(struct cafe_camera *cam, unsigned int reg, - unsigned int val) -{ - iowrite32(val, cam->regs + reg); -} - -static inline unsigned int cafe_reg_read(struct cafe_camera *cam, - unsigned int reg) -{ - return ioread32(cam->regs + reg); -} - - -static inline void cafe_reg_write_mask(struct cafe_camera *cam, unsigned int reg, - unsigned int val, unsigned int mask) -{ - unsigned int v = cafe_reg_read(cam, reg); - - v = (v & ~mask) | (val & mask); - cafe_reg_write(cam, reg, v); -} - -static inline void cafe_reg_clear_bit(struct cafe_camera *cam, - unsigned int reg, unsigned int val) -{ - cafe_reg_write_mask(cam, reg, 0, val); -} - -static inline void cafe_reg_set_bit(struct cafe_camera *cam, - unsigned int reg, unsigned int val) -{ - cafe_reg_write_mask(cam, reg, val, val); -} - - - -/* -------------------------------------------------------------------- */ -/* - * The I2C/SMBUS interface to the camera itself starts here. The - * controller handles SMBUS itself, presenting a relatively simple register - * interface; all we have to do is to tell it where to route the data. - */ -#define CAFE_SMBUS_TIMEOUT (HZ) /* generous */ - -static int cafe_smbus_write_done(struct cafe_camera *cam) -{ - unsigned long flags; - int c1; - - /* - * We must delay after the interrupt, or the controller gets confused - * and never does give us good status. Fortunately, we don't do this - * often. - */ - udelay(20); - spin_lock_irqsave(&cam->dev_lock, flags); - c1 = cafe_reg_read(cam, REG_TWSIC1); - spin_unlock_irqrestore(&cam->dev_lock, flags); - return (c1 & (TWSIC1_WSTAT|TWSIC1_ERROR)) != TWSIC1_WSTAT; -} - -static int cafe_smbus_write_data(struct cafe_camera *cam, - u16 addr, u8 command, u8 value) -{ - unsigned int rval; - unsigned long flags; - - spin_lock_irqsave(&cam->dev_lock, flags); - rval = TWSIC0_EN | ((addr << TWSIC0_SID_SHIFT) & TWSIC0_SID); - rval |= TWSIC0_OVMAGIC; /* Make OV sensors work */ - /* - * Marvell sez set clkdiv to all 1's for now. - */ - rval |= TWSIC0_CLKDIV; - cafe_reg_write(cam, REG_TWSIC0, rval); - (void) cafe_reg_read(cam, REG_TWSIC1); /* force write */ - rval = value | ((command << TWSIC1_ADDR_SHIFT) & TWSIC1_ADDR); - cafe_reg_write(cam, REG_TWSIC1, rval); - spin_unlock_irqrestore(&cam->dev_lock, flags); - - /* Unfortunately, reading TWSIC1 too soon after sending a command - * causes the device to die. - * Use a busy-wait because we often send a large quantity of small - * commands at-once; using msleep() would cause a lot of context - * switches which take longer than 2ms, resulting in a noticeable - * boot-time and capture-start delays. - */ - mdelay(2); - - /* - * Another sad fact is that sometimes, commands silently complete but - * cafe_smbus_write_done() never becomes aware of this. - * This happens at random and appears to possible occur with any - * command. - * We don't understand why this is. We work around this issue - * with the timeout in the wait below, assuming that all commands - * complete within the timeout. - */ - wait_event_timeout(cam->smbus_wait, cafe_smbus_write_done(cam), - CAFE_SMBUS_TIMEOUT); - - spin_lock_irqsave(&cam->dev_lock, flags); - rval = cafe_reg_read(cam, REG_TWSIC1); - spin_unlock_irqrestore(&cam->dev_lock, flags); - - if (rval & TWSIC1_WSTAT) { - cam_err(cam, "SMBUS write (%02x/%02x/%02x) timed out\n", addr, - command, value); - return -EIO; - } - if (rval & TWSIC1_ERROR) { - cam_err(cam, "SMBUS write (%02x/%02x/%02x) error\n", addr, - command, value); - return -EIO; - } - return 0; -} - - - -static int cafe_smbus_read_done(struct cafe_camera *cam) -{ - unsigned long flags; - int c1; - - /* - * We must delay after the interrupt, or the controller gets confused - * and never does give us good status. Fortunately, we don't do this - * often. - */ - udelay(20); - spin_lock_irqsave(&cam->dev_lock, flags); - c1 = cafe_reg_read(cam, REG_TWSIC1); - spin_unlock_irqrestore(&cam->dev_lock, flags); - return c1 & (TWSIC1_RVALID|TWSIC1_ERROR); -} - - - -static int cafe_smbus_read_data(struct cafe_camera *cam, - u16 addr, u8 command, u8 *value) -{ - unsigned int rval; - unsigned long flags; - - spin_lock_irqsave(&cam->dev_lock, flags); - rval = TWSIC0_EN | ((addr << TWSIC0_SID_SHIFT) & TWSIC0_SID); - rval |= TWSIC0_OVMAGIC; /* Make OV sensors work */ - /* - * Marvel sez set clkdiv to all 1's for now. - */ - rval |= TWSIC0_CLKDIV; - cafe_reg_write(cam, REG_TWSIC0, rval); - (void) cafe_reg_read(cam, REG_TWSIC1); /* force write */ - rval = TWSIC1_READ | ((command << TWSIC1_ADDR_SHIFT) & TWSIC1_ADDR); - cafe_reg_write(cam, REG_TWSIC1, rval); - spin_unlock_irqrestore(&cam->dev_lock, flags); - - wait_event_timeout(cam->smbus_wait, - cafe_smbus_read_done(cam), CAFE_SMBUS_TIMEOUT); - spin_lock_irqsave(&cam->dev_lock, flags); - rval = cafe_reg_read(cam, REG_TWSIC1); - spin_unlock_irqrestore(&cam->dev_lock, flags); - - if (rval & TWSIC1_ERROR) { - cam_err(cam, "SMBUS read (%02x/%02x) error\n", addr, command); - return -EIO; - } - if (! (rval & TWSIC1_RVALID)) { - cam_err(cam, "SMBUS read (%02x/%02x) timed out\n", addr, - command); - return -EIO; - } - *value = rval & 0xff; - return 0; -} - -/* - * Perform a transfer over SMBUS. This thing is called under - * the i2c bus lock, so we shouldn't race with ourselves... - */ -static int cafe_smbus_xfer(struct i2c_adapter *adapter, u16 addr, - unsigned short flags, char rw, u8 command, - int size, union i2c_smbus_data *data) -{ - struct v4l2_device *v4l2_dev = i2c_get_adapdata(adapter); - struct cafe_camera *cam = to_cam(v4l2_dev); - int ret = -EINVAL; - - /* - * This interface would appear to only do byte data ops. OK - * it can do word too, but the cam chip has no use for that. - */ - if (size != I2C_SMBUS_BYTE_DATA) { - cam_err(cam, "funky xfer size %d\n", size); - return -EINVAL; - } - - if (rw == I2C_SMBUS_WRITE) - ret = cafe_smbus_write_data(cam, addr, command, data->byte); - else if (rw == I2C_SMBUS_READ) - ret = cafe_smbus_read_data(cam, addr, command, &data->byte); - return ret; -} - - -static void cafe_smbus_enable_irq(struct cafe_camera *cam) -{ - unsigned long flags; - - spin_lock_irqsave(&cam->dev_lock, flags); - cafe_reg_set_bit(cam, REG_IRQMASK, TWSIIRQS); - spin_unlock_irqrestore(&cam->dev_lock, flags); -} - -static u32 cafe_smbus_func(struct i2c_adapter *adapter) -{ - return I2C_FUNC_SMBUS_READ_BYTE_DATA | - I2C_FUNC_SMBUS_WRITE_BYTE_DATA; -} - -static struct i2c_algorithm cafe_smbus_algo = { - .smbus_xfer = cafe_smbus_xfer, - .functionality = cafe_smbus_func -}; - -/* Somebody is on the bus */ -static void cafe_ctlr_stop_dma(struct cafe_camera *cam); -static void cafe_ctlr_power_down(struct cafe_camera *cam); - -static int cafe_smbus_setup(struct cafe_camera *cam) -{ - struct i2c_adapter *adap = &cam->i2c_adapter; - int ret; - - cafe_smbus_enable_irq(cam); - adap->owner = THIS_MODULE; - adap->algo = &cafe_smbus_algo; - strcpy(adap->name, "cafe_ccic"); - adap->dev.parent = &cam->pdev->dev; - i2c_set_adapdata(adap, &cam->v4l2_dev); - ret = i2c_add_adapter(adap); - if (ret) - printk(KERN_ERR "Unable to register cafe i2c adapter\n"); - return ret; -} - -static void cafe_smbus_shutdown(struct cafe_camera *cam) -{ - i2c_del_adapter(&cam->i2c_adapter); -} - - -/* ------------------------------------------------------------------- */ -/* - * Deal with the controller. - */ - -/* - * Do everything we think we need to have the interface operating - * according to the desired format. - */ -static void cafe_ctlr_dma(struct cafe_camera *cam) -{ - /* - * Store the first two Y buffers (we aren't supporting - * planar formats for now, so no UV bufs). Then either - * set the third if it exists, or tell the controller - * to just use two. - */ - cafe_reg_write(cam, REG_Y0BAR, cam->dma_handles[0]); - cafe_reg_write(cam, REG_Y1BAR, cam->dma_handles[1]); - if (cam->nbufs > 2) { - cafe_reg_write(cam, REG_Y2BAR, cam->dma_handles[2]); - cafe_reg_clear_bit(cam, REG_CTRL1, C1_TWOBUFS); - } - else - cafe_reg_set_bit(cam, REG_CTRL1, C1_TWOBUFS); - cafe_reg_write(cam, REG_UBAR, 0); /* 32 bits only for now */ -} - -static void cafe_ctlr_image(struct cafe_camera *cam) -{ - int imgsz; - struct v4l2_pix_format *fmt = &cam->pix_format; - - imgsz = ((fmt->height << IMGSZ_V_SHIFT) & IMGSZ_V_MASK) | - (fmt->bytesperline & IMGSZ_H_MASK); - cafe_reg_write(cam, REG_IMGSIZE, imgsz); - cafe_reg_write(cam, REG_IMGOFFSET, 0); - /* YPITCH just drops the last two bits */ - cafe_reg_write_mask(cam, REG_IMGPITCH, fmt->bytesperline, - IMGP_YP_MASK); - /* - * Tell the controller about the image format we are using. - */ - switch (cam->pix_format.pixelformat) { - case V4L2_PIX_FMT_YUYV: - cafe_reg_write_mask(cam, REG_CTRL0, - C0_DF_YUV|C0_YUV_PACKED|C0_YUVE_YUYV, - C0_DF_MASK); - break; - - case V4L2_PIX_FMT_RGB444: - cafe_reg_write_mask(cam, REG_CTRL0, - C0_DF_RGB|C0_RGBF_444|C0_RGB4_XRGB, - C0_DF_MASK); - /* Alpha value? */ - break; - - case V4L2_PIX_FMT_RGB565: - cafe_reg_write_mask(cam, REG_CTRL0, - C0_DF_RGB|C0_RGBF_565|C0_RGB5_BGGR, - C0_DF_MASK); - break; - - default: - cam_err(cam, "Unknown format %x\n", cam->pix_format.pixelformat); - break; - } - /* - * Make sure it knows we want to use hsync/vsync. - */ - cafe_reg_write_mask(cam, REG_CTRL0, C0_SIF_HVSYNC, - C0_SIFM_MASK); -} - - -/* - * Configure the controller for operation; caller holds the - * device mutex. - */ -static int cafe_ctlr_configure(struct cafe_camera *cam) -{ - unsigned long flags; - - spin_lock_irqsave(&cam->dev_lock, flags); - cafe_ctlr_dma(cam); - cafe_ctlr_image(cam); - cafe_set_config_needed(cam, 0); - spin_unlock_irqrestore(&cam->dev_lock, flags); - return 0; -} - -static void cafe_ctlr_irq_enable(struct cafe_camera *cam) -{ - /* - * Clear any pending interrupts, since we do not - * expect to have I/O active prior to enabling. - */ - cafe_reg_write(cam, REG_IRQSTAT, FRAMEIRQS); - cafe_reg_set_bit(cam, REG_IRQMASK, FRAMEIRQS); -} - -static void cafe_ctlr_irq_disable(struct cafe_camera *cam) -{ - cafe_reg_clear_bit(cam, REG_IRQMASK, FRAMEIRQS); -} - -/* - * Make the controller start grabbing images. Everything must - * be set up before doing this. - */ -static void cafe_ctlr_start(struct cafe_camera *cam) -{ - /* set_bit performs a read, so no other barrier should be - needed here */ - cafe_reg_set_bit(cam, REG_CTRL0, C0_ENABLE); -} - -static void cafe_ctlr_stop(struct cafe_camera *cam) -{ - cafe_reg_clear_bit(cam, REG_CTRL0, C0_ENABLE); -} - -static void cafe_ctlr_init(struct cafe_camera *cam) -{ - unsigned long flags; - - spin_lock_irqsave(&cam->dev_lock, flags); - /* - * Added magic to bring up the hardware on the B-Test board - */ - cafe_reg_write(cam, 0x3038, 0x8); - cafe_reg_write(cam, 0x315c, 0x80008); - /* - * Go through the dance needed to wake the device up. - * Note that these registers are global and shared - * with the NAND and SD devices. Interaction between the - * three still needs to be examined. - */ - cafe_reg_write(cam, REG_GL_CSR, GCSR_SRS|GCSR_MRS); /* Needed? */ - cafe_reg_write(cam, REG_GL_CSR, GCSR_SRC|GCSR_MRC); - cafe_reg_write(cam, REG_GL_CSR, GCSR_SRC|GCSR_MRS); - /* - * Here we must wait a bit for the controller to come around. - */ - spin_unlock_irqrestore(&cam->dev_lock, flags); - msleep(5); - spin_lock_irqsave(&cam->dev_lock, flags); - - cafe_reg_write(cam, REG_GL_CSR, GCSR_CCIC_EN|GCSR_SRC|GCSR_MRC); - cafe_reg_set_bit(cam, REG_GL_IMASK, GIMSK_CCIC_EN); - /* - * Make sure it's not powered down. - */ - cafe_reg_clear_bit(cam, REG_CTRL1, C1_PWRDWN); - /* - * Turn off the enable bit. It sure should be off anyway, - * but it's good to be sure. - */ - cafe_reg_clear_bit(cam, REG_CTRL0, C0_ENABLE); - /* - * Mask all interrupts. - */ - cafe_reg_write(cam, REG_IRQMASK, 0); - /* - * Clock the sensor appropriately. Controller clock should - * be 48MHz, sensor "typical" value is half that. - */ - cafe_reg_write_mask(cam, REG_CLKCTRL, 2, CLK_DIV_MASK); - spin_unlock_irqrestore(&cam->dev_lock, flags); -} - - -/* - * Stop the controller, and don't return until we're really sure that no - * further DMA is going on. - */ -static void cafe_ctlr_stop_dma(struct cafe_camera *cam) -{ - unsigned long flags; - - /* - * Theory: stop the camera controller (whether it is operating - * or not). Delay briefly just in case we race with the SOF - * interrupt, then wait until no DMA is active. - */ - spin_lock_irqsave(&cam->dev_lock, flags); - cafe_ctlr_stop(cam); - spin_unlock_irqrestore(&cam->dev_lock, flags); - mdelay(1); - wait_event_timeout(cam->iowait, - !test_bit(CF_DMA_ACTIVE, &cam->flags), HZ); - if (test_bit(CF_DMA_ACTIVE, &cam->flags)) - cam_err(cam, "Timeout waiting for DMA to end\n"); - /* This would be bad news - what now? */ - spin_lock_irqsave(&cam->dev_lock, flags); - cam->state = S_IDLE; - cafe_ctlr_irq_disable(cam); - spin_unlock_irqrestore(&cam->dev_lock, flags); -} - -/* - * Power up and down. - */ -static void cafe_ctlr_power_up(struct cafe_camera *cam) -{ - unsigned long flags; - - spin_lock_irqsave(&cam->dev_lock, flags); - cafe_reg_clear_bit(cam, REG_CTRL1, C1_PWRDWN); - /* - * Part one of the sensor dance: turn the global - * GPIO signal on. - */ - cafe_reg_write(cam, REG_GL_FCR, GFCR_GPIO_ON); - cafe_reg_write(cam, REG_GL_GPIOR, GGPIO_OUT|GGPIO_VAL); - /* - * Put the sensor into operational mode (assumes OLPC-style - * wiring). Control 0 is reset - set to 1 to operate. - * Control 1 is power down, set to 0 to operate. - */ - cafe_reg_write(cam, REG_GPR, GPR_C1EN|GPR_C0EN); /* pwr up, reset */ -/* mdelay(1); */ /* Marvell says 1ms will do it */ - cafe_reg_write(cam, REG_GPR, GPR_C1EN|GPR_C0EN|GPR_C0); -/* mdelay(1); */ /* Enough? */ - spin_unlock_irqrestore(&cam->dev_lock, flags); - msleep(5); /* Just to be sure */ -} - -static void cafe_ctlr_power_down(struct cafe_camera *cam) -{ - unsigned long flags; - - spin_lock_irqsave(&cam->dev_lock, flags); - cafe_reg_write(cam, REG_GPR, GPR_C1EN|GPR_C0EN|GPR_C1); - cafe_reg_write(cam, REG_GL_FCR, GFCR_GPIO_ON); - cafe_reg_write(cam, REG_GL_GPIOR, GGPIO_OUT); - cafe_reg_set_bit(cam, REG_CTRL1, C1_PWRDWN); - spin_unlock_irqrestore(&cam->dev_lock, flags); -} - -/* -------------------------------------------------------------------- */ -/* - * Communications with the sensor. - */ - -static int __cafe_cam_reset(struct cafe_camera *cam) -{ - return sensor_call(cam, core, reset, 0); -} - -/* - * We have found the sensor on the i2c. Let's try to have a - * conversation. - */ -static int cafe_cam_init(struct cafe_camera *cam) -{ - struct v4l2_dbg_chip_ident chip; - int ret; - - mutex_lock(&cam->s_mutex); - if (cam->state != S_NOTREADY) - cam_warn(cam, "Cam init with device in funky state %d", - cam->state); - ret = __cafe_cam_reset(cam); - if (ret) - goto out; - chip.ident = V4L2_IDENT_NONE; - chip.match.type = V4L2_CHIP_MATCH_I2C_ADDR; - chip.match.addr = cam->sensor_addr; - ret = sensor_call(cam, core, g_chip_ident, &chip); - if (ret) - goto out; - cam->sensor_type = chip.ident; - if (cam->sensor_type != V4L2_IDENT_OV7670) { - cam_err(cam, "Unsupported sensor type 0x%x", cam->sensor_type); - ret = -EINVAL; - goto out; - } -/* Get/set parameters? */ - ret = 0; - cam->state = S_IDLE; - out: - cafe_ctlr_power_down(cam); - mutex_unlock(&cam->s_mutex); - return ret; -} - -/* - * Configure the sensor to match the parameters we have. Caller should - * hold s_mutex - */ -static int cafe_cam_set_flip(struct cafe_camera *cam) -{ - struct v4l2_control ctrl; - - memset(&ctrl, 0, sizeof(ctrl)); - ctrl.id = V4L2_CID_VFLIP; - ctrl.value = flip; - return sensor_call(cam, core, s_ctrl, &ctrl); -} - - -static int cafe_cam_configure(struct cafe_camera *cam) -{ - struct v4l2_mbus_framefmt mbus_fmt; - int ret; - - v4l2_fill_mbus_format(&mbus_fmt, &cam->pix_format, cam->mbus_code); - ret = sensor_call(cam, core, init, 0); - if (ret == 0) - ret = sensor_call(cam, video, s_mbus_fmt, &mbus_fmt); - /* - * OV7670 does weird things if flip is set *before* format... - */ - ret += cafe_cam_set_flip(cam); - return ret; -} - -/* -------------------------------------------------------------------- */ -/* - * DMA buffer management. These functions need s_mutex held. - */ - -/* FIXME: this is inefficient as hell, since dma_alloc_coherent just - * does a get_free_pages() call, and we waste a good chunk of an orderN - * allocation. Should try to allocate the whole set in one chunk. - */ -static int cafe_alloc_dma_bufs(struct cafe_camera *cam, int loadtime) -{ - int i; - - cafe_set_config_needed(cam, 1); - if (loadtime) - cam->dma_buf_size = dma_buf_size; - else - cam->dma_buf_size = cam->pix_format.sizeimage; - if (n_dma_bufs > 3) - n_dma_bufs = 3; - - cam->nbufs = 0; - for (i = 0; i < n_dma_bufs; i++) { - cam->dma_bufs[i] = dma_alloc_coherent(&cam->pdev->dev, - cam->dma_buf_size, cam->dma_handles + i, - GFP_KERNEL); - if (cam->dma_bufs[i] == NULL) { - cam_warn(cam, "Failed to allocate DMA buffer\n"); - break; - } - /* For debug, remove eventually */ - memset(cam->dma_bufs[i], 0xcc, cam->dma_buf_size); - (cam->nbufs)++; - } - - switch (cam->nbufs) { - case 1: - dma_free_coherent(&cam->pdev->dev, cam->dma_buf_size, - cam->dma_bufs[0], cam->dma_handles[0]); - cam->nbufs = 0; - case 0: - cam_err(cam, "Insufficient DMA buffers, cannot operate\n"); - return -ENOMEM; - - case 2: - if (n_dma_bufs > 2) - cam_warn(cam, "Will limp along with only 2 buffers\n"); - break; - } - return 0; -} - -static void cafe_free_dma_bufs(struct cafe_camera *cam) -{ - int i; - - for (i = 0; i < cam->nbufs; i++) { - dma_free_coherent(&cam->pdev->dev, cam->dma_buf_size, - cam->dma_bufs[i], cam->dma_handles[i]); - cam->dma_bufs[i] = NULL; - } - cam->nbufs = 0; -} - - - - - -/* ----------------------------------------------------------------------- */ -/* - * Here starts the V4L2 interface code. - */ - -/* - * Read an image from the device. - */ -static ssize_t cafe_deliver_buffer(struct cafe_camera *cam, - char __user *buffer, size_t len, loff_t *pos) -{ - int bufno; - unsigned long flags; - - spin_lock_irqsave(&cam->dev_lock, flags); - if (cam->next_buf < 0) { - cam_err(cam, "deliver_buffer: No next buffer\n"); - spin_unlock_irqrestore(&cam->dev_lock, flags); - return -EIO; - } - bufno = cam->next_buf; - clear_bit(bufno, &cam->flags); - if (++(cam->next_buf) >= cam->nbufs) - cam->next_buf = 0; - if (! test_bit(cam->next_buf, &cam->flags)) - cam->next_buf = -1; - cam->specframes = 0; - spin_unlock_irqrestore(&cam->dev_lock, flags); - - if (len > cam->pix_format.sizeimage) - len = cam->pix_format.sizeimage; - if (copy_to_user(buffer, cam->dma_bufs[bufno], len)) - return -EFAULT; - (*pos) += len; - return len; -} - -/* - * Get everything ready, and start grabbing frames. - */ -static int cafe_read_setup(struct cafe_camera *cam, enum cafe_state state) -{ - int ret; - unsigned long flags; - - /* - * Configuration. If we still don't have DMA buffers, - * make one last, desperate attempt. - */ - if (cam->nbufs == 0) - if (cafe_alloc_dma_bufs(cam, 0)) - return -ENOMEM; - - if (cafe_needs_config(cam)) { - cafe_cam_configure(cam); - ret = cafe_ctlr_configure(cam); - if (ret) - return ret; - } - - /* - * Turn it loose. - */ - spin_lock_irqsave(&cam->dev_lock, flags); - cafe_reset_buffers(cam); - cafe_ctlr_irq_enable(cam); - cam->state = state; - cafe_ctlr_start(cam); - spin_unlock_irqrestore(&cam->dev_lock, flags); - return 0; -} - - -static ssize_t cafe_v4l_read(struct file *filp, - char __user *buffer, size_t len, loff_t *pos) -{ - struct cafe_camera *cam = filp->private_data; - int ret = 0; - - /* - * Perhaps we're in speculative read mode and already - * have data? - */ - mutex_lock(&cam->s_mutex); - if (cam->state == S_SPECREAD) { - if (cam->next_buf >= 0) { - ret = cafe_deliver_buffer(cam, buffer, len, pos); - if (ret != 0) - goto out_unlock; - } - } else if (cam->state == S_FLAKED || cam->state == S_NOTREADY) { - ret = -EIO; - goto out_unlock; - } else if (cam->state != S_IDLE) { - ret = -EBUSY; - goto out_unlock; - } - - /* - * v4l2: multiple processes can open the device, but only - * one gets to grab data from it. - */ - if (cam->owner && cam->owner != filp) { - ret = -EBUSY; - goto out_unlock; - } - cam->owner = filp; - - /* - * Do setup if need be. - */ - if (cam->state != S_SPECREAD) { - ret = cafe_read_setup(cam, S_SINGLEREAD); - if (ret) - goto out_unlock; - } - /* - * Wait for something to happen. This should probably - * be interruptible (FIXME). - */ - wait_event_timeout(cam->iowait, cam->next_buf >= 0, HZ); - if (cam->next_buf < 0) { - cam_err(cam, "read() operation timed out\n"); - cafe_ctlr_stop_dma(cam); - ret = -EIO; - goto out_unlock; - } - /* - * Give them their data and we should be done. - */ - ret = cafe_deliver_buffer(cam, buffer, len, pos); - - out_unlock: - mutex_unlock(&cam->s_mutex); - return ret; -} - - - - - - - - -/* - * Streaming I/O support. - */ - - - -static int cafe_vidioc_streamon(struct file *filp, void *priv, - enum v4l2_buf_type type) -{ - struct cafe_camera *cam = filp->private_data; - int ret = -EINVAL; - - if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) - goto out; - mutex_lock(&cam->s_mutex); - if (cam->state != S_IDLE || cam->n_sbufs == 0) - goto out_unlock; - - cam->sequence = 0; - ret = cafe_read_setup(cam, S_STREAMING); - - out_unlock: - mutex_unlock(&cam->s_mutex); - out: - return ret; -} - - -static int cafe_vidioc_streamoff(struct file *filp, void *priv, - enum v4l2_buf_type type) -{ - struct cafe_camera *cam = filp->private_data; - int ret = -EINVAL; - - if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) - goto out; - mutex_lock(&cam->s_mutex); - if (cam->state != S_STREAMING) - goto out_unlock; - - cafe_ctlr_stop_dma(cam); - ret = 0; - - out_unlock: - mutex_unlock(&cam->s_mutex); - out: - return ret; -} - - - -static int cafe_setup_siobuf(struct cafe_camera *cam, int index) -{ - struct cafe_sio_buffer *buf = cam->sb_bufs + index; - - INIT_LIST_HEAD(&buf->list); - buf->v4lbuf.length = PAGE_ALIGN(cam->pix_format.sizeimage); - buf->buffer = vmalloc_user(buf->v4lbuf.length); - if (buf->buffer == NULL) - return -ENOMEM; - buf->mapcount = 0; - buf->cam = cam; - - buf->v4lbuf.index = index; - buf->v4lbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - buf->v4lbuf.field = V4L2_FIELD_NONE; - buf->v4lbuf.memory = V4L2_MEMORY_MMAP; - /* - * Offset: must be 32-bit even on a 64-bit system. videobuf-dma-sg - * just uses the length times the index, but the spec warns - * against doing just that - vma merging problems. So we - * leave a gap between each pair of buffers. - */ - buf->v4lbuf.m.offset = 2*index*buf->v4lbuf.length; - return 0; -} - -static int cafe_free_sio_buffers(struct cafe_camera *cam) -{ - int i; - - /* - * If any buffers are mapped, we cannot free them at all. - */ - for (i = 0; i < cam->n_sbufs; i++) - if (cam->sb_bufs[i].mapcount > 0) - return -EBUSY; - /* - * OK, let's do it. - */ - for (i = 0; i < cam->n_sbufs; i++) - vfree(cam->sb_bufs[i].buffer); - cam->n_sbufs = 0; - kfree(cam->sb_bufs); - cam->sb_bufs = NULL; - INIT_LIST_HEAD(&cam->sb_avail); - INIT_LIST_HEAD(&cam->sb_full); - return 0; -} - - - -static int cafe_vidioc_reqbufs(struct file *filp, void *priv, - struct v4l2_requestbuffers *req) -{ - struct cafe_camera *cam = filp->private_data; - int ret = 0; /* Silence warning */ - - /* - * Make sure it's something we can do. User pointers could be - * implemented without great pain, but that's not been done yet. - */ - if (req->memory != V4L2_MEMORY_MMAP) - return -EINVAL; - /* - * If they ask for zero buffers, they really want us to stop streaming - * (if it's happening) and free everything. Should we check owner? - */ - mutex_lock(&cam->s_mutex); - if (req->count == 0) { - if (cam->state == S_STREAMING) - cafe_ctlr_stop_dma(cam); - ret = cafe_free_sio_buffers (cam); - goto out; - } - /* - * Device needs to be idle and working. We *could* try to do the - * right thing in S_SPECREAD by shutting things down, but it - * probably doesn't matter. - */ - if (cam->state != S_IDLE || (cam->owner && cam->owner != filp)) { - ret = -EBUSY; - goto out; - } - cam->owner = filp; - - if (req->count < min_buffers) - req->count = min_buffers; - else if (req->count > max_buffers) - req->count = max_buffers; - if (cam->n_sbufs > 0) { - ret = cafe_free_sio_buffers(cam); - if (ret) - goto out; - } - - cam->sb_bufs = kzalloc(req->count*sizeof(struct cafe_sio_buffer), - GFP_KERNEL); - if (cam->sb_bufs == NULL) { - ret = -ENOMEM; - goto out; - } - for (cam->n_sbufs = 0; cam->n_sbufs < req->count; (cam->n_sbufs++)) { - ret = cafe_setup_siobuf(cam, cam->n_sbufs); - if (ret) - break; - } - - if (cam->n_sbufs == 0) /* no luck at all - ret already set */ - kfree(cam->sb_bufs); - req->count = cam->n_sbufs; /* In case of partial success */ - - out: - mutex_unlock(&cam->s_mutex); - return ret; -} - - -static int cafe_vidioc_querybuf(struct file *filp, void *priv, - struct v4l2_buffer *buf) -{ - struct cafe_camera *cam = filp->private_data; - int ret = -EINVAL; - - mutex_lock(&cam->s_mutex); - if (buf->index >= cam->n_sbufs) - goto out; - *buf = cam->sb_bufs[buf->index].v4lbuf; - ret = 0; - out: - mutex_unlock(&cam->s_mutex); - return ret; -} - -static int cafe_vidioc_qbuf(struct file *filp, void *priv, - struct v4l2_buffer *buf) -{ - struct cafe_camera *cam = filp->private_data; - struct cafe_sio_buffer *sbuf; - int ret = -EINVAL; - unsigned long flags; - - mutex_lock(&cam->s_mutex); - if (buf->index >= cam->n_sbufs) - goto out; - sbuf = cam->sb_bufs + buf->index; - if (sbuf->v4lbuf.flags & V4L2_BUF_FLAG_QUEUED) { - ret = 0; /* Already queued?? */ - goto out; - } - if (sbuf->v4lbuf.flags & V4L2_BUF_FLAG_DONE) { - /* Spec doesn't say anything, seems appropriate tho */ - ret = -EBUSY; - goto out; - } - sbuf->v4lbuf.flags |= V4L2_BUF_FLAG_QUEUED; - spin_lock_irqsave(&cam->dev_lock, flags); - list_add(&sbuf->list, &cam->sb_avail); - spin_unlock_irqrestore(&cam->dev_lock, flags); - ret = 0; - out: - mutex_unlock(&cam->s_mutex); - return ret; -} - -static int cafe_vidioc_dqbuf(struct file *filp, void *priv, - struct v4l2_buffer *buf) -{ - struct cafe_camera *cam = filp->private_data; - struct cafe_sio_buffer *sbuf; - int ret = -EINVAL; - unsigned long flags; - - mutex_lock(&cam->s_mutex); - if (cam->state != S_STREAMING) - goto out_unlock; - if (list_empty(&cam->sb_full) && filp->f_flags & O_NONBLOCK) { - ret = -EAGAIN; - goto out_unlock; - } - - while (list_empty(&cam->sb_full) && cam->state == S_STREAMING) { - mutex_unlock(&cam->s_mutex); - if (wait_event_interruptible(cam->iowait, - !list_empty(&cam->sb_full))) { - ret = -ERESTARTSYS; - goto out; - } - mutex_lock(&cam->s_mutex); - } - - if (cam->state != S_STREAMING) - ret = -EINTR; - else { - spin_lock_irqsave(&cam->dev_lock, flags); - /* Should probably recheck !list_empty() here */ - sbuf = list_entry(cam->sb_full.next, - struct cafe_sio_buffer, list); - list_del_init(&sbuf->list); - spin_unlock_irqrestore(&cam->dev_lock, flags); - sbuf->v4lbuf.flags &= ~V4L2_BUF_FLAG_DONE; - *buf = sbuf->v4lbuf; - ret = 0; - } - - out_unlock: - mutex_unlock(&cam->s_mutex); - out: - return ret; -} - - - -static void cafe_v4l_vm_open(struct vm_area_struct *vma) -{ - struct cafe_sio_buffer *sbuf = vma->vm_private_data; - /* - * Locking: done under mmap_sem, so we don't need to - * go back to the camera lock here. - */ - sbuf->mapcount++; -} - - -static void cafe_v4l_vm_close(struct vm_area_struct *vma) -{ - struct cafe_sio_buffer *sbuf = vma->vm_private_data; - - mutex_lock(&sbuf->cam->s_mutex); - sbuf->mapcount--; - /* Docs say we should stop I/O too... */ - if (sbuf->mapcount == 0) - sbuf->v4lbuf.flags &= ~V4L2_BUF_FLAG_MAPPED; - mutex_unlock(&sbuf->cam->s_mutex); -} - -static const struct vm_operations_struct cafe_v4l_vm_ops = { - .open = cafe_v4l_vm_open, - .close = cafe_v4l_vm_close -}; - - -static int cafe_v4l_mmap(struct file *filp, struct vm_area_struct *vma) -{ - struct cafe_camera *cam = filp->private_data; - unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; - int ret = -EINVAL; - int i; - struct cafe_sio_buffer *sbuf = NULL; - - if (! (vma->vm_flags & VM_WRITE) || ! (vma->vm_flags & VM_SHARED)) - return -EINVAL; - /* - * Find the buffer they are looking for. - */ - mutex_lock(&cam->s_mutex); - for (i = 0; i < cam->n_sbufs; i++) - if (cam->sb_bufs[i].v4lbuf.m.offset == offset) { - sbuf = cam->sb_bufs + i; - break; - } - if (sbuf == NULL) - goto out; - - ret = remap_vmalloc_range(vma, sbuf->buffer, 0); - if (ret) - goto out; - vma->vm_flags |= VM_DONTEXPAND; - vma->vm_private_data = sbuf; - vma->vm_ops = &cafe_v4l_vm_ops; - sbuf->v4lbuf.flags |= V4L2_BUF_FLAG_MAPPED; - cafe_v4l_vm_open(vma); - ret = 0; - out: - mutex_unlock(&cam->s_mutex); - return ret; -} - - - -static int cafe_v4l_open(struct file *filp) -{ - struct cafe_camera *cam = video_drvdata(filp); - - filp->private_data = cam; - - mutex_lock(&cam->s_mutex); - if (cam->users == 0) { - cafe_ctlr_power_up(cam); - __cafe_cam_reset(cam); - cafe_set_config_needed(cam, 1); - /* FIXME make sure this is complete */ - } - (cam->users)++; - mutex_unlock(&cam->s_mutex); - return 0; -} - - -static int cafe_v4l_release(struct file *filp) -{ - struct cafe_camera *cam = filp->private_data; - - mutex_lock(&cam->s_mutex); - (cam->users)--; - if (filp == cam->owner) { - cafe_ctlr_stop_dma(cam); - cafe_free_sio_buffers(cam); - cam->owner = NULL; - } - if (cam->users == 0) { - cafe_ctlr_power_down(cam); - if (alloc_bufs_at_read) - cafe_free_dma_bufs(cam); - } - mutex_unlock(&cam->s_mutex); - return 0; -} - - - -static unsigned int cafe_v4l_poll(struct file *filp, - struct poll_table_struct *pt) -{ - struct cafe_camera *cam = filp->private_data; - - poll_wait(filp, &cam->iowait, pt); - if (cam->next_buf >= 0) - return POLLIN | POLLRDNORM; - return 0; -} - - - -static int cafe_vidioc_queryctrl(struct file *filp, void *priv, - struct v4l2_queryctrl *qc) -{ - struct cafe_camera *cam = priv; - int ret; - - mutex_lock(&cam->s_mutex); - ret = sensor_call(cam, core, queryctrl, qc); - mutex_unlock(&cam->s_mutex); - return ret; -} - - -static int cafe_vidioc_g_ctrl(struct file *filp, void *priv, - struct v4l2_control *ctrl) -{ - struct cafe_camera *cam = priv; - int ret; - - mutex_lock(&cam->s_mutex); - ret = sensor_call(cam, core, g_ctrl, ctrl); - mutex_unlock(&cam->s_mutex); - return ret; -} - - -static int cafe_vidioc_s_ctrl(struct file *filp, void *priv, - struct v4l2_control *ctrl) -{ - struct cafe_camera *cam = priv; - int ret; - - mutex_lock(&cam->s_mutex); - ret = sensor_call(cam, core, s_ctrl, ctrl); - mutex_unlock(&cam->s_mutex); - return ret; -} - - - - - -static int cafe_vidioc_querycap(struct file *file, void *priv, - struct v4l2_capability *cap) -{ - strcpy(cap->driver, "cafe_ccic"); - strcpy(cap->card, "cafe_ccic"); - cap->version = CAFE_VERSION; - cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | - V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; - return 0; -} - - -/* - * The default format we use until somebody says otherwise. - */ -static const struct v4l2_pix_format cafe_def_pix_format = { - .width = VGA_WIDTH, - .height = VGA_HEIGHT, - .pixelformat = V4L2_PIX_FMT_YUYV, - .field = V4L2_FIELD_NONE, - .bytesperline = VGA_WIDTH*2, - .sizeimage = VGA_WIDTH*VGA_HEIGHT*2, -}; - -static const enum v4l2_mbus_pixelcode cafe_def_mbus_code = - V4L2_MBUS_FMT_YUYV8_2X8; - -static int cafe_vidioc_enum_fmt_vid_cap(struct file *filp, - void *priv, struct v4l2_fmtdesc *fmt) -{ - if (fmt->index >= N_CAFE_FMTS) - return -EINVAL; - strlcpy(fmt->description, cafe_formats[fmt->index].desc, - sizeof(fmt->description)); - fmt->pixelformat = cafe_formats[fmt->index].pixelformat; - return 0; -} - -static int cafe_vidioc_try_fmt_vid_cap(struct file *filp, void *priv, - struct v4l2_format *fmt) -{ - struct cafe_camera *cam = priv; - struct cafe_format_struct *f; - struct v4l2_pix_format *pix = &fmt->fmt.pix; - struct v4l2_mbus_framefmt mbus_fmt; - int ret; - - f = cafe_find_format(pix->pixelformat); - pix->pixelformat = f->pixelformat; - v4l2_fill_mbus_format(&mbus_fmt, pix, f->mbus_code); - mutex_lock(&cam->s_mutex); - ret = sensor_call(cam, video, try_mbus_fmt, &mbus_fmt); - mutex_unlock(&cam->s_mutex); - v4l2_fill_pix_format(pix, &mbus_fmt); - pix->bytesperline = pix->width * f->bpp; - pix->sizeimage = pix->height * pix->bytesperline; - return ret; -} - -static int cafe_vidioc_s_fmt_vid_cap(struct file *filp, void *priv, - struct v4l2_format *fmt) -{ - struct cafe_camera *cam = priv; - struct cafe_format_struct *f; - int ret; - - /* - * Can't do anything if the device is not idle - * Also can't if there are streaming buffers in place. - */ - if (cam->state != S_IDLE || cam->n_sbufs > 0) - return -EBUSY; - - f = cafe_find_format(fmt->fmt.pix.pixelformat); - - /* - * See if the formatting works in principle. - */ - ret = cafe_vidioc_try_fmt_vid_cap(filp, priv, fmt); - if (ret) - return ret; - /* - * Now we start to change things for real, so let's do it - * under lock. - */ - mutex_lock(&cam->s_mutex); - cam->pix_format = fmt->fmt.pix; - cam->mbus_code = f->mbus_code; - - /* - * Make sure we have appropriate DMA buffers. - */ - ret = -ENOMEM; - if (cam->nbufs > 0 && cam->dma_buf_size < cam->pix_format.sizeimage) - cafe_free_dma_bufs(cam); - if (cam->nbufs == 0) { - if (cafe_alloc_dma_bufs(cam, 0)) - goto out; - } - /* - * It looks like this might work, so let's program the sensor. - */ - ret = cafe_cam_configure(cam); - if (! ret) - ret = cafe_ctlr_configure(cam); - out: - mutex_unlock(&cam->s_mutex); - return ret; -} - -/* - * Return our stored notion of how the camera is/should be configured. - * The V4l2 spec wants us to be smarter, and actually get this from - * the camera (and not mess with it at open time). Someday. - */ -static int cafe_vidioc_g_fmt_vid_cap(struct file *filp, void *priv, - struct v4l2_format *f) -{ - struct cafe_camera *cam = priv; - - f->fmt.pix = cam->pix_format; - return 0; -} - -/* - * We only have one input - the sensor - so minimize the nonsense here. - */ -static int cafe_vidioc_enum_input(struct file *filp, void *priv, - struct v4l2_input *input) -{ - if (input->index != 0) - return -EINVAL; - - input->type = V4L2_INPUT_TYPE_CAMERA; - input->std = V4L2_STD_ALL; /* Not sure what should go here */ - strcpy(input->name, "Camera"); - return 0; -} - -static int cafe_vidioc_g_input(struct file *filp, void *priv, unsigned int *i) -{ - *i = 0; - return 0; -} - -static int cafe_vidioc_s_input(struct file *filp, void *priv, unsigned int i) -{ - if (i != 0) - return -EINVAL; - return 0; -} - -/* from vivi.c */ -static int cafe_vidioc_s_std(struct file *filp, void *priv, v4l2_std_id *a) -{ - return 0; -} - -/* - * G/S_PARM. Most of this is done by the sensor, but we are - * the level which controls the number of read buffers. - */ -static int cafe_vidioc_g_parm(struct file *filp, void *priv, - struct v4l2_streamparm *parms) -{ - struct cafe_camera *cam = priv; - int ret; - - mutex_lock(&cam->s_mutex); - ret = sensor_call(cam, video, g_parm, parms); - mutex_unlock(&cam->s_mutex); - parms->parm.capture.readbuffers = n_dma_bufs; - return ret; -} - -static int cafe_vidioc_s_parm(struct file *filp, void *priv, - struct v4l2_streamparm *parms) -{ - struct cafe_camera *cam = priv; - int ret; - - mutex_lock(&cam->s_mutex); - ret = sensor_call(cam, video, s_parm, parms); - mutex_unlock(&cam->s_mutex); - parms->parm.capture.readbuffers = n_dma_bufs; - return ret; -} - -static int cafe_vidioc_g_chip_ident(struct file *file, void *priv, - struct v4l2_dbg_chip_ident *chip) -{ - struct cafe_camera *cam = priv; - - chip->ident = V4L2_IDENT_NONE; - chip->revision = 0; - if (v4l2_chip_match_host(&chip->match)) { - chip->ident = V4L2_IDENT_CAFE; - return 0; - } - return sensor_call(cam, core, g_chip_ident, chip); -} - -static int cafe_vidioc_enum_framesizes(struct file *filp, void *priv, - struct v4l2_frmsizeenum *sizes) -{ - struct cafe_camera *cam = priv; - int ret; - - mutex_lock(&cam->s_mutex); - ret = sensor_call(cam, video, enum_framesizes, sizes); - mutex_unlock(&cam->s_mutex); - return ret; -} - -static int cafe_vidioc_enum_frameintervals(struct file *filp, void *priv, - struct v4l2_frmivalenum *interval) -{ - struct cafe_camera *cam = priv; - int ret; - - mutex_lock(&cam->s_mutex); - ret = sensor_call(cam, video, enum_frameintervals, interval); - mutex_unlock(&cam->s_mutex); - return ret; -} - -#ifdef CONFIG_VIDEO_ADV_DEBUG -static int cafe_vidioc_g_register(struct file *file, void *priv, - struct v4l2_dbg_register *reg) -{ - struct cafe_camera *cam = priv; - - if (v4l2_chip_match_host(®->match)) { - reg->val = cafe_reg_read(cam, reg->reg); - reg->size = 4; - return 0; - } - return sensor_call(cam, core, g_register, reg); -} - -static int cafe_vidioc_s_register(struct file *file, void *priv, - struct v4l2_dbg_register *reg) -{ - struct cafe_camera *cam = priv; - - if (v4l2_chip_match_host(®->match)) { - cafe_reg_write(cam, reg->reg, reg->val); - return 0; - } - return sensor_call(cam, core, s_register, reg); -} -#endif - -/* - * This template device holds all of those v4l2 methods; we - * clone it for specific real devices. - */ - -static const struct v4l2_file_operations cafe_v4l_fops = { - .owner = THIS_MODULE, - .open = cafe_v4l_open, - .release = cafe_v4l_release, - .read = cafe_v4l_read, - .poll = cafe_v4l_poll, - .mmap = cafe_v4l_mmap, - .unlocked_ioctl = video_ioctl2, -}; - -static const struct v4l2_ioctl_ops cafe_v4l_ioctl_ops = { - .vidioc_querycap = cafe_vidioc_querycap, - .vidioc_enum_fmt_vid_cap = cafe_vidioc_enum_fmt_vid_cap, - .vidioc_try_fmt_vid_cap = cafe_vidioc_try_fmt_vid_cap, - .vidioc_s_fmt_vid_cap = cafe_vidioc_s_fmt_vid_cap, - .vidioc_g_fmt_vid_cap = cafe_vidioc_g_fmt_vid_cap, - .vidioc_enum_input = cafe_vidioc_enum_input, - .vidioc_g_input = cafe_vidioc_g_input, - .vidioc_s_input = cafe_vidioc_s_input, - .vidioc_s_std = cafe_vidioc_s_std, - .vidioc_reqbufs = cafe_vidioc_reqbufs, - .vidioc_querybuf = cafe_vidioc_querybuf, - .vidioc_qbuf = cafe_vidioc_qbuf, - .vidioc_dqbuf = cafe_vidioc_dqbuf, - .vidioc_streamon = cafe_vidioc_streamon, - .vidioc_streamoff = cafe_vidioc_streamoff, - .vidioc_queryctrl = cafe_vidioc_queryctrl, - .vidioc_g_ctrl = cafe_vidioc_g_ctrl, - .vidioc_s_ctrl = cafe_vidioc_s_ctrl, - .vidioc_g_parm = cafe_vidioc_g_parm, - .vidioc_s_parm = cafe_vidioc_s_parm, - .vidioc_enum_framesizes = cafe_vidioc_enum_framesizes, - .vidioc_enum_frameintervals = cafe_vidioc_enum_frameintervals, - .vidioc_g_chip_ident = cafe_vidioc_g_chip_ident, -#ifdef CONFIG_VIDEO_ADV_DEBUG - .vidioc_g_register = cafe_vidioc_g_register, - .vidioc_s_register = cafe_vidioc_s_register, -#endif -}; - -static struct video_device cafe_v4l_template = { - .name = "cafe", - .tvnorms = V4L2_STD_NTSC_M, - .current_norm = V4L2_STD_NTSC_M, /* make mplayer happy */ - - .fops = &cafe_v4l_fops, - .ioctl_ops = &cafe_v4l_ioctl_ops, - .release = video_device_release_empty, -}; - - -/* ---------------------------------------------------------------------- */ -/* - * Interrupt handler stuff - */ - - - -static void cafe_frame_tasklet(unsigned long data) -{ - struct cafe_camera *cam = (struct cafe_camera *) data; - int i; - unsigned long flags; - struct cafe_sio_buffer *sbuf; - - spin_lock_irqsave(&cam->dev_lock, flags); - for (i = 0; i < cam->nbufs; i++) { - int bufno = cam->next_buf; - if (bufno < 0) { /* "will never happen" */ - cam_err(cam, "No valid bufs in tasklet!\n"); - break; - } - if (++(cam->next_buf) >= cam->nbufs) - cam->next_buf = 0; - if (! test_bit(bufno, &cam->flags)) - continue; - if (list_empty(&cam->sb_avail)) - break; /* Leave it valid, hope for better later */ - clear_bit(bufno, &cam->flags); - sbuf = list_entry(cam->sb_avail.next, - struct cafe_sio_buffer, list); - /* - * Drop the lock during the big copy. This *should* be safe... - */ - spin_unlock_irqrestore(&cam->dev_lock, flags); - memcpy(sbuf->buffer, cam->dma_bufs[bufno], - cam->pix_format.sizeimage); - sbuf->v4lbuf.bytesused = cam->pix_format.sizeimage; - sbuf->v4lbuf.sequence = cam->buf_seq[bufno]; - sbuf->v4lbuf.flags &= ~V4L2_BUF_FLAG_QUEUED; - sbuf->v4lbuf.flags |= V4L2_BUF_FLAG_DONE; - spin_lock_irqsave(&cam->dev_lock, flags); - list_move_tail(&sbuf->list, &cam->sb_full); - } - if (! list_empty(&cam->sb_full)) - wake_up(&cam->iowait); - spin_unlock_irqrestore(&cam->dev_lock, flags); -} - - - -static void cafe_frame_complete(struct cafe_camera *cam, int frame) -{ - /* - * Basic frame housekeeping. - */ - if (test_bit(frame, &cam->flags) && printk_ratelimit()) - cam_err(cam, "Frame overrun on %d, frames lost\n", frame); - set_bit(frame, &cam->flags); - clear_bit(CF_DMA_ACTIVE, &cam->flags); - if (cam->next_buf < 0) - cam->next_buf = frame; - cam->buf_seq[frame] = ++(cam->sequence); - - switch (cam->state) { - /* - * If in single read mode, try going speculative. - */ - case S_SINGLEREAD: - cam->state = S_SPECREAD; - cam->specframes = 0; - wake_up(&cam->iowait); - break; - - /* - * If we are already doing speculative reads, and nobody is - * reading them, just stop. - */ - case S_SPECREAD: - if (++(cam->specframes) >= cam->nbufs) { - cafe_ctlr_stop(cam); - cafe_ctlr_irq_disable(cam); - cam->state = S_IDLE; - } - wake_up(&cam->iowait); - break; - /* - * For the streaming case, we defer the real work to the - * camera tasklet. - * - * FIXME: if the application is not consuming the buffers, - * we should eventually put things on hold and restart in - * vidioc_dqbuf(). - */ - case S_STREAMING: - tasklet_schedule(&cam->s_tasklet); - break; - - default: - cam_err(cam, "Frame interrupt in non-operational state\n"); - break; - } -} - - - - -static void cafe_frame_irq(struct cafe_camera *cam, unsigned int irqs) -{ - unsigned int frame; - - cafe_reg_write(cam, REG_IRQSTAT, FRAMEIRQS); /* Clear'em all */ - /* - * Handle any frame completions. There really should - * not be more than one of these, or we have fallen - * far behind. - */ - for (frame = 0; frame < cam->nbufs; frame++) - if (irqs & (IRQ_EOF0 << frame)) - cafe_frame_complete(cam, frame); - /* - * If a frame starts, note that we have DMA active. This - * code assumes that we won't get multiple frame interrupts - * at once; may want to rethink that. - */ - if (irqs & (IRQ_SOF0 | IRQ_SOF1 | IRQ_SOF2)) - set_bit(CF_DMA_ACTIVE, &cam->flags); -} - - - -static irqreturn_t cafe_irq(int irq, void *data) -{ - struct cafe_camera *cam = data; - unsigned int irqs; - - spin_lock(&cam->dev_lock); - irqs = cafe_reg_read(cam, REG_IRQSTAT); - if ((irqs & ALLIRQS) == 0) { - spin_unlock(&cam->dev_lock); - return IRQ_NONE; - } - if (irqs & FRAMEIRQS) - cafe_frame_irq(cam, irqs); - if (irqs & TWSIIRQS) { - cafe_reg_write(cam, REG_IRQSTAT, TWSIIRQS); - wake_up(&cam->smbus_wait); - } - spin_unlock(&cam->dev_lock); - return IRQ_HANDLED; -} - - -/* -------------------------------------------------------------------------- */ -/* - * PCI interface stuff. - */ - -static const struct dmi_system_id olpc_xo1_dmi[] = { - { - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "OLPC"), - DMI_MATCH(DMI_PRODUCT_NAME, "XO"), - DMI_MATCH(DMI_PRODUCT_VERSION, "1"), - }, - }, - { } -}; - -static int cafe_pci_probe(struct pci_dev *pdev, - const struct pci_device_id *id) -{ - int ret; - struct cafe_camera *cam; - struct ov7670_config sensor_cfg = { - /* This controller only does SMBUS */ - .use_smbus = true, - - /* - * Exclude QCIF mode, because it only captures a tiny portion - * of the sensor FOV - */ - .min_width = 320, - .min_height = 240, - }; - struct i2c_board_info ov7670_info = { - .type = "ov7670", - .addr = 0x42, - .platform_data = &sensor_cfg, - }; - - /* - * Start putting together one of our big camera structures. - */ - ret = -ENOMEM; - cam = kzalloc(sizeof(struct cafe_camera), GFP_KERNEL); - if (cam == NULL) - goto out; - ret = v4l2_device_register(&pdev->dev, &cam->v4l2_dev); - if (ret) - goto out_free; - - mutex_init(&cam->s_mutex); - spin_lock_init(&cam->dev_lock); - cam->state = S_NOTREADY; - cafe_set_config_needed(cam, 1); - init_waitqueue_head(&cam->smbus_wait); - init_waitqueue_head(&cam->iowait); - cam->pdev = pdev; - cam->pix_format = cafe_def_pix_format; - cam->mbus_code = cafe_def_mbus_code; - INIT_LIST_HEAD(&cam->dev_list); - INIT_LIST_HEAD(&cam->sb_avail); - INIT_LIST_HEAD(&cam->sb_full); - tasklet_init(&cam->s_tasklet, cafe_frame_tasklet, (unsigned long) cam); - /* - * Get set up on the PCI bus. - */ - ret = pci_enable_device(pdev); - if (ret) - goto out_unreg; - pci_set_master(pdev); - - ret = -EIO; - cam->regs = pci_iomap(pdev, 0, 0); - if (! cam->regs) { - printk(KERN_ERR "Unable to ioremap cafe-ccic regs\n"); - goto out_unreg; - } - ret = request_irq(pdev->irq, cafe_irq, IRQF_SHARED, "cafe-ccic", cam); - if (ret) - goto out_iounmap; - /* - * Initialize the controller and leave it powered up. It will - * stay that way until the sensor driver shows up. - */ - cafe_ctlr_init(cam); - cafe_ctlr_power_up(cam); - /* - * Set up I2C/SMBUS communications. We have to drop the mutex here - * because the sensor could attach in this call chain, leading to - * unsightly deadlocks. - */ - ret = cafe_smbus_setup(cam); - if (ret) - goto out_freeirq; - - /* Apply XO-1 clock speed */ - if (dmi_check_system(olpc_xo1_dmi)) - sensor_cfg.clock_speed = 45; - - cam->sensor_addr = ov7670_info.addr; - cam->sensor = v4l2_i2c_new_subdev_board(&cam->v4l2_dev, &cam->i2c_adapter, - &ov7670_info, NULL); - if (cam->sensor == NULL) { - ret = -ENODEV; - goto out_smbus; - } - - ret = cafe_cam_init(cam); - if (ret) - goto out_smbus; - - /* - * Get the v4l2 setup done. - */ - mutex_lock(&cam->s_mutex); - cam->vdev = cafe_v4l_template; - cam->vdev.debug = 0; -/* cam->vdev.debug = V4L2_DEBUG_IOCTL_ARG;*/ - cam->vdev.v4l2_dev = &cam->v4l2_dev; - ret = video_register_device(&cam->vdev, VFL_TYPE_GRABBER, -1); - if (ret) - goto out_unlock; - video_set_drvdata(&cam->vdev, cam); - - /* - * If so requested, try to get our DMA buffers now. - */ - if (!alloc_bufs_at_read) { - if (cafe_alloc_dma_bufs(cam, 1)) - cam_warn(cam, "Unable to alloc DMA buffers at load" - " will try again later."); - } - - mutex_unlock(&cam->s_mutex); - return 0; - -out_unlock: - mutex_unlock(&cam->s_mutex); -out_smbus: - cafe_smbus_shutdown(cam); -out_freeirq: - cafe_ctlr_power_down(cam); - free_irq(pdev->irq, cam); -out_iounmap: - pci_iounmap(pdev, cam->regs); -out_free: - v4l2_device_unregister(&cam->v4l2_dev); -out_unreg: - kfree(cam); -out: - return ret; -} - - -/* - * Shut down an initialized device - */ -static void cafe_shutdown(struct cafe_camera *cam) -{ -/* FIXME: Make sure we take care of everything here */ - if (cam->n_sbufs > 0) - /* What if they are still mapped? Shouldn't be, but... */ - cafe_free_sio_buffers(cam); - cafe_ctlr_stop_dma(cam); - cafe_ctlr_power_down(cam); - cafe_smbus_shutdown(cam); - cafe_free_dma_bufs(cam); - free_irq(cam->pdev->irq, cam); - pci_iounmap(cam->pdev, cam->regs); - video_unregister_device(&cam->vdev); -} - - -static void cafe_pci_remove(struct pci_dev *pdev) -{ - struct v4l2_device *v4l2_dev = dev_get_drvdata(&pdev->dev); - struct cafe_camera *cam = to_cam(v4l2_dev); - - if (cam == NULL) { - printk(KERN_WARNING "pci_remove on unknown pdev %p\n", pdev); - return; - } - mutex_lock(&cam->s_mutex); - if (cam->users > 0) - cam_warn(cam, "Removing a device with users!\n"); - cafe_shutdown(cam); - v4l2_device_unregister(&cam->v4l2_dev); - kfree(cam); -/* No unlock - it no longer exists */ -} - - -#ifdef CONFIG_PM -/* - * Basic power management. - */ -static int cafe_pci_suspend(struct pci_dev *pdev, pm_message_t state) -{ - struct v4l2_device *v4l2_dev = dev_get_drvdata(&pdev->dev); - struct cafe_camera *cam = to_cam(v4l2_dev); - int ret; - enum cafe_state cstate; - - ret = pci_save_state(pdev); - if (ret) - return ret; - cstate = cam->state; /* HACK - stop_dma sets to idle */ - cafe_ctlr_stop_dma(cam); - cafe_ctlr_power_down(cam); - pci_disable_device(pdev); - cam->state = cstate; - return 0; -} - - -static int cafe_pci_resume(struct pci_dev *pdev) -{ - struct v4l2_device *v4l2_dev = dev_get_drvdata(&pdev->dev); - struct cafe_camera *cam = to_cam(v4l2_dev); - int ret = 0; - - pci_restore_state(pdev); - ret = pci_enable_device(pdev); - - if (ret) { - cam_warn(cam, "Unable to re-enable device on resume!\n"); - return ret; - } - cafe_ctlr_init(cam); - - mutex_lock(&cam->s_mutex); - if (cam->users > 0) { - cafe_ctlr_power_up(cam); - __cafe_cam_reset(cam); - } else { - cafe_ctlr_power_down(cam); - } - mutex_unlock(&cam->s_mutex); - - set_bit(CF_CONFIG_NEEDED, &cam->flags); - if (cam->state == S_SPECREAD) - cam->state = S_IDLE; /* Don't bother restarting */ - else if (cam->state == S_SINGLEREAD || cam->state == S_STREAMING) - ret = cafe_read_setup(cam, cam->state); - return ret; -} - -#endif /* CONFIG_PM */ - - -static struct pci_device_id cafe_ids[] = { - { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, - PCI_DEVICE_ID_MARVELL_88ALP01_CCIC) }, - { 0, } -}; - -MODULE_DEVICE_TABLE(pci, cafe_ids); - -static struct pci_driver cafe_pci_driver = { - .name = "cafe1000-ccic", - .id_table = cafe_ids, - .probe = cafe_pci_probe, - .remove = cafe_pci_remove, -#ifdef CONFIG_PM - .suspend = cafe_pci_suspend, - .resume = cafe_pci_resume, -#endif -}; - - - - -static int __init cafe_init(void) -{ - int ret; - - printk(KERN_NOTICE "Marvell M88ALP01 'CAFE' Camera Controller version %d\n", - CAFE_VERSION); - ret = pci_register_driver(&cafe_pci_driver); - if (ret) { - printk(KERN_ERR "Unable to register cafe_ccic driver\n"); - goto out; - } - ret = 0; - - out: - return ret; -} - - -static void __exit cafe_exit(void) -{ - pci_unregister_driver(&cafe_pci_driver); -} - -module_init(cafe_init); -module_exit(cafe_exit); diff --git a/drivers/media/video/marvell-ccic/Kconfig b/drivers/media/video/marvell-ccic/Kconfig new file mode 100644 index 000000000000..80136a8771e7 --- /dev/null +++ b/drivers/media/video/marvell-ccic/Kconfig @@ -0,0 +1,9 @@ +config VIDEO_CAFE_CCIC + tristate "Marvell 88ALP01 (Cafe) CMOS Camera Controller support" + depends on PCI && I2C && VIDEO_V4L2 + select VIDEO_OV7670 + ---help--- + This is a video4linux2 driver for the Marvell 88ALP01 integrated + CMOS camera controller. This is the controller found on first- + generation OLPC systems. + diff --git a/drivers/media/video/marvell-ccic/Makefile b/drivers/media/video/marvell-ccic/Makefile new file mode 100644 index 000000000000..123472514051 --- /dev/null +++ b/drivers/media/video/marvell-ccic/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_VIDEO_CAFE_CCIC) += cafe_ccic.o diff --git a/drivers/media/video/marvell-ccic/cafe_ccic-regs.h b/drivers/media/video/marvell-ccic/cafe_ccic-regs.h new file mode 100644 index 000000000000..8e2a87cdc791 --- /dev/null +++ b/drivers/media/video/marvell-ccic/cafe_ccic-regs.h @@ -0,0 +1,166 @@ +/* + * Register definitions for the m88alp01 camera interface. Offsets in bytes + * as given in the spec. + * + * Copyright 2006 One Laptop Per Child Association, Inc. + * + * Written by Jonathan Corbet, corbet@lwn.net. + * + * This file may be distributed under the terms of the GNU General + * Public License, version 2. + */ +#define REG_Y0BAR 0x00 +#define REG_Y1BAR 0x04 +#define REG_Y2BAR 0x08 +/* ... */ + +#define REG_IMGPITCH 0x24 /* Image pitch register */ +#define IMGP_YP_SHFT 2 /* Y pitch params */ +#define IMGP_YP_MASK 0x00003ffc /* Y pitch field */ +#define IMGP_UVP_SHFT 18 /* UV pitch (planar) */ +#define IMGP_UVP_MASK 0x3ffc0000 +#define REG_IRQSTATRAW 0x28 /* RAW IRQ Status */ +#define IRQ_EOF0 0x00000001 /* End of frame 0 */ +#define IRQ_EOF1 0x00000002 /* End of frame 1 */ +#define IRQ_EOF2 0x00000004 /* End of frame 2 */ +#define IRQ_SOF0 0x00000008 /* Start of frame 0 */ +#define IRQ_SOF1 0x00000010 /* Start of frame 1 */ +#define IRQ_SOF2 0x00000020 /* Start of frame 2 */ +#define IRQ_OVERFLOW 0x00000040 /* FIFO overflow */ +#define IRQ_TWSIW 0x00010000 /* TWSI (smbus) write */ +#define IRQ_TWSIR 0x00020000 /* TWSI read */ +#define IRQ_TWSIE 0x00040000 /* TWSI error */ +#define TWSIIRQS (IRQ_TWSIW|IRQ_TWSIR|IRQ_TWSIE) +#define FRAMEIRQS (IRQ_EOF0|IRQ_EOF1|IRQ_EOF2|IRQ_SOF0|IRQ_SOF1|IRQ_SOF2) +#define ALLIRQS (TWSIIRQS|FRAMEIRQS|IRQ_OVERFLOW) +#define REG_IRQMASK 0x2c /* IRQ mask - same bits as IRQSTAT */ +#define REG_IRQSTAT 0x30 /* IRQ status / clear */ + +#define REG_IMGSIZE 0x34 /* Image size */ +#define IMGSZ_V_MASK 0x1fff0000 +#define IMGSZ_V_SHIFT 16 +#define IMGSZ_H_MASK 0x00003fff +#define REG_IMGOFFSET 0x38 /* IMage offset */ + +#define REG_CTRL0 0x3c /* Control 0 */ +#define C0_ENABLE 0x00000001 /* Makes the whole thing go */ + +/* Mask for all the format bits */ +#define C0_DF_MASK 0x00fffffc /* Bits 2-23 */ + +/* RGB ordering */ +#define C0_RGB4_RGBX 0x00000000 +#define C0_RGB4_XRGB 0x00000004 +#define C0_RGB4_BGRX 0x00000008 +#define C0_RGB4_XBGR 0x0000000c +#define C0_RGB5_RGGB 0x00000000 +#define C0_RGB5_GRBG 0x00000004 +#define C0_RGB5_GBRG 0x00000008 +#define C0_RGB5_BGGR 0x0000000c + +/* Spec has two fields for DIN and DOUT, but they must match, so + combine them here. */ +#define C0_DF_YUV 0x00000000 /* Data is YUV */ +#define C0_DF_RGB 0x000000a0 /* ... RGB */ +#define C0_DF_BAYER 0x00000140 /* ... Bayer */ +/* 8-8-8 must be missing from the below - ask */ +#define C0_RGBF_565 0x00000000 +#define C0_RGBF_444 0x00000800 +#define C0_RGB_BGR 0x00001000 /* Blue comes first */ +#define C0_YUV_PLANAR 0x00000000 /* YUV 422 planar format */ +#define C0_YUV_PACKED 0x00008000 /* YUV 422 packed */ +#define C0_YUV_420PL 0x0000a000 /* YUV 420 planar */ +/* Think that 420 packed must be 111 - ask */ +#define C0_YUVE_YUYV 0x00000000 /* Y1CbY0Cr */ +#define C0_YUVE_YVYU 0x00010000 /* Y1CrY0Cb */ +#define C0_YUVE_VYUY 0x00020000 /* CrY1CbY0 */ +#define C0_YUVE_UYVY 0x00030000 /* CbY1CrY0 */ +#define C0_YUVE_XYUV 0x00000000 /* 420: .YUV */ +#define C0_YUVE_XYVU 0x00010000 /* 420: .YVU */ +#define C0_YUVE_XUVY 0x00020000 /* 420: .UVY */ +#define C0_YUVE_XVUY 0x00030000 /* 420: .VUY */ +/* Bayer bits 18,19 if needed */ +#define C0_HPOL_LOW 0x01000000 /* HSYNC polarity active low */ +#define C0_VPOL_LOW 0x02000000 /* VSYNC polarity active low */ +#define C0_VCLK_LOW 0x04000000 /* VCLK on falling edge */ +#define C0_DOWNSCALE 0x08000000 /* Enable downscaler */ +#define C0_SIFM_MASK 0xc0000000 /* SIF mode bits */ +#define C0_SIF_HVSYNC 0x00000000 /* Use H/VSYNC */ +#define CO_SOF_NOSYNC 0x40000000 /* Use inband active signaling */ + + +#define REG_CTRL1 0x40 /* Control 1 */ +#define C1_444ALPHA 0x00f00000 /* Alpha field in RGB444 */ +#define C1_ALPHA_SHFT 20 +#define C1_DMAB32 0x00000000 /* 32-byte DMA burst */ +#define C1_DMAB16 0x02000000 /* 16-byte DMA burst */ +#define C1_DMAB64 0x04000000 /* 64-byte DMA burst */ +#define C1_DMAB_MASK 0x06000000 +#define C1_TWOBUFS 0x08000000 /* Use only two DMA buffers */ +#define C1_PWRDWN 0x10000000 /* Power down */ + +#define REG_CLKCTRL 0x88 /* Clock control */ +#define CLK_DIV_MASK 0x0000ffff /* Upper bits RW "reserved" */ + +#define REG_GPR 0xb4 /* General purpose register. This + controls inputs to the power and reset + pins on the OV7670 used with OLPC; + other deployments could differ. */ +#define GPR_C1EN 0x00000020 /* Pad 1 (power down) enable */ +#define GPR_C0EN 0x00000010 /* Pad 0 (reset) enable */ +#define GPR_C1 0x00000002 /* Control 1 value */ +/* + * Control 0 is wired to reset on OLPC machines. For ov7x sensors, + * it is active low, for 0v6x, instead, it's active high. What + * fun. + */ +#define GPR_C0 0x00000001 /* Control 0 value */ + +#define REG_TWSIC0 0xb8 /* TWSI (smbus) control 0 */ +#define TWSIC0_EN 0x00000001 /* TWSI enable */ +#define TWSIC0_MODE 0x00000002 /* 1 = 16-bit, 0 = 8-bit */ +#define TWSIC0_SID 0x000003fc /* Slave ID */ +#define TWSIC0_SID_SHIFT 2 +#define TWSIC0_CLKDIV 0x0007fc00 /* Clock divider */ +#define TWSIC0_MASKACK 0x00400000 /* Mask ack from sensor */ +#define TWSIC0_OVMAGIC 0x00800000 /* Make it work on OV sensors */ + +#define REG_TWSIC1 0xbc /* TWSI control 1 */ +#define TWSIC1_DATA 0x0000ffff /* Data to/from camchip */ +#define TWSIC1_ADDR 0x00ff0000 /* Address (register) */ +#define TWSIC1_ADDR_SHIFT 16 +#define TWSIC1_READ 0x01000000 /* Set for read op */ +#define TWSIC1_WSTAT 0x02000000 /* Write status */ +#define TWSIC1_RVALID 0x04000000 /* Read data valid */ +#define TWSIC1_ERROR 0x08000000 /* Something screwed up */ + + +#define REG_UBAR 0xc4 /* Upper base address register */ + +/* + * Here's the weird global control registers which are said to live + * way up here. + */ +#define REG_GL_CSR 0x3004 /* Control/status register */ +#define GCSR_SRS 0x00000001 /* SW Reset set */ +#define GCSR_SRC 0x00000002 /* SW Reset clear */ +#define GCSR_MRS 0x00000004 /* Master reset set */ +#define GCSR_MRC 0x00000008 /* HW Reset clear */ +#define GCSR_CCIC_EN 0x00004000 /* CCIC Clock enable */ +#define REG_GL_IMASK 0x300c /* Interrupt mask register */ +#define GIMSK_CCIC_EN 0x00000004 /* CCIC Interrupt enable */ + +#define REG_GL_FCR 0x3038 /* GPIO functional control register */ +#define GFCR_GPIO_ON 0x08 /* Camera GPIO enabled */ +#define REG_GL_GPIOR 0x315c /* GPIO register */ +#define GGPIO_OUT 0x80000 /* GPIO output */ +#define GGPIO_VAL 0x00008 /* Output pin value */ + +#define REG_LEN REG_GL_IMASK + 4 + + +/* + * Useful stuff that probably belongs somewhere global. + */ +#define VGA_WIDTH 640 +#define VGA_HEIGHT 480 diff --git a/drivers/media/video/marvell-ccic/cafe_ccic.c b/drivers/media/video/marvell-ccic/cafe_ccic.c new file mode 100644 index 000000000000..809964ba0160 --- /dev/null +++ b/drivers/media/video/marvell-ccic/cafe_ccic.c @@ -0,0 +1,2267 @@ +/* + * A driver for the CMOS camera controller in the Marvell 88ALP01 "cafe" + * multifunction chip. Currently works with the Omnivision OV7670 + * sensor. + * + * The data sheet for this device can be found at: + * http://www.marvell.com/products/pc_connectivity/88alp01/ + * + * Copyright 2006 One Laptop Per Child Association, Inc. + * Copyright 2006-7 Jonathan Corbet + * + * Written by Jonathan Corbet, corbet@lwn.net. + * + * v4l2_device/v4l2_subdev conversion by: + * Copyright (C) 2009 Hans Verkuil + * + * Note: this conversion is untested! Please contact the linux-media + * mailinglist if you can test this, together with the test results. + * + * This file may be distributed under the terms of the GNU General + * Public License, version 2. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "cafe_ccic-regs.h" + +#define CAFE_VERSION 0x000002 + + +/* + * Parameters. + */ +MODULE_AUTHOR("Jonathan Corbet "); +MODULE_DESCRIPTION("Marvell 88ALP01 CMOS Camera Controller driver"); +MODULE_LICENSE("GPL"); +MODULE_SUPPORTED_DEVICE("Video"); + +/* + * Internal DMA buffer management. Since the controller cannot do S/G I/O, + * we must have physically contiguous buffers to bring frames into. + * These parameters control how many buffers we use, whether we + * allocate them at load time (better chance of success, but nails down + * memory) or when somebody tries to use the camera (riskier), and, + * for load-time allocation, how big they should be. + * + * The controller can cycle through three buffers. We could use + * more by flipping pointers around, but it probably makes little + * sense. + */ + +#define MAX_DMA_BUFS 3 +static int alloc_bufs_at_read; +module_param(alloc_bufs_at_read, bool, 0444); +MODULE_PARM_DESC(alloc_bufs_at_read, + "Non-zero value causes DMA buffers to be allocated when the " + "video capture device is read, rather than at module load " + "time. This saves memory, but decreases the chances of " + "successfully getting those buffers."); + +static int n_dma_bufs = 3; +module_param(n_dma_bufs, uint, 0644); +MODULE_PARM_DESC(n_dma_bufs, + "The number of DMA buffers to allocate. Can be either two " + "(saves memory, makes timing tighter) or three."); + +static int dma_buf_size = VGA_WIDTH * VGA_HEIGHT * 2; /* Worst case */ +module_param(dma_buf_size, uint, 0444); +MODULE_PARM_DESC(dma_buf_size, + "The size of the allocated DMA buffers. If actual operating " + "parameters require larger buffers, an attempt to reallocate " + "will be made."); + +static int min_buffers = 1; +module_param(min_buffers, uint, 0644); +MODULE_PARM_DESC(min_buffers, + "The minimum number of streaming I/O buffers we are willing " + "to work with."); + +static int max_buffers = 10; +module_param(max_buffers, uint, 0644); +MODULE_PARM_DESC(max_buffers, + "The maximum number of streaming I/O buffers an application " + "will be allowed to allocate. These buffers are big and live " + "in vmalloc space."); + +static int flip; +module_param(flip, bool, 0444); +MODULE_PARM_DESC(flip, + "If set, the sensor will be instructed to flip the image " + "vertically."); + + +enum cafe_state { + S_NOTREADY, /* Not yet initialized */ + S_IDLE, /* Just hanging around */ + S_FLAKED, /* Some sort of problem */ + S_SINGLEREAD, /* In read() */ + S_SPECREAD, /* Speculative read (for future read()) */ + S_STREAMING /* Streaming data */ +}; + +/* + * Tracking of streaming I/O buffers. + */ +struct cafe_sio_buffer { + struct list_head list; + struct v4l2_buffer v4lbuf; + char *buffer; /* Where it lives in kernel space */ + int mapcount; + struct cafe_camera *cam; +}; + +/* + * A description of one of our devices. + * Locking: controlled by s_mutex. Certain fields, however, require + * the dev_lock spinlock; they are marked as such by comments. + * dev_lock is also required for access to device registers. + */ +struct cafe_camera +{ + struct v4l2_device v4l2_dev; + enum cafe_state state; + unsigned long flags; /* Buffer status, mainly (dev_lock) */ + int users; /* How many open FDs */ + struct file *owner; /* Who has data access (v4l2) */ + + /* + * Subsystem structures. + */ + struct pci_dev *pdev; + struct video_device vdev; + struct i2c_adapter i2c_adapter; + struct v4l2_subdev *sensor; + unsigned short sensor_addr; + + unsigned char __iomem *regs; + struct list_head dev_list; /* link to other devices */ + + /* DMA buffers */ + unsigned int nbufs; /* How many are alloc'd */ + int next_buf; /* Next to consume (dev_lock) */ + unsigned int dma_buf_size; /* allocated size */ + void *dma_bufs[MAX_DMA_BUFS]; /* Internal buffer addresses */ + dma_addr_t dma_handles[MAX_DMA_BUFS]; /* Buffer bus addresses */ + unsigned int specframes; /* Unconsumed spec frames (dev_lock) */ + unsigned int sequence; /* Frame sequence number */ + unsigned int buf_seq[MAX_DMA_BUFS]; /* Sequence for individual buffers */ + + /* Streaming buffers */ + unsigned int n_sbufs; /* How many we have */ + struct cafe_sio_buffer *sb_bufs; /* The array of housekeeping structs */ + struct list_head sb_avail; /* Available for data (we own) (dev_lock) */ + struct list_head sb_full; /* With data (user space owns) (dev_lock) */ + struct tasklet_struct s_tasklet; + + /* Current operating parameters */ + u32 sensor_type; /* Currently ov7670 only */ + struct v4l2_pix_format pix_format; + enum v4l2_mbus_pixelcode mbus_code; + + /* Locks */ + struct mutex s_mutex; /* Access to this structure */ + spinlock_t dev_lock; /* Access to device */ + + /* Misc */ + wait_queue_head_t smbus_wait; /* Waiting on i2c events */ + wait_queue_head_t iowait; /* Waiting on frame data */ +}; + +/* + * Status flags. Always manipulated with bit operations. + */ +#define CF_BUF0_VALID 0 /* Buffers valid - first three */ +#define CF_BUF1_VALID 1 +#define CF_BUF2_VALID 2 +#define CF_DMA_ACTIVE 3 /* A frame is incoming */ +#define CF_CONFIG_NEEDED 4 /* Must configure hardware */ + +#define sensor_call(cam, o, f, args...) \ + v4l2_subdev_call(cam->sensor, o, f, ##args) + +static inline struct cafe_camera *to_cam(struct v4l2_device *dev) +{ + return container_of(dev, struct cafe_camera, v4l2_dev); +} + +static struct cafe_format_struct { + __u8 *desc; + __u32 pixelformat; + int bpp; /* Bytes per pixel */ + enum v4l2_mbus_pixelcode mbus_code; +} cafe_formats[] = { + { + .desc = "YUYV 4:2:2", + .pixelformat = V4L2_PIX_FMT_YUYV, + .mbus_code = V4L2_MBUS_FMT_YUYV8_2X8, + .bpp = 2, + }, + { + .desc = "RGB 444", + .pixelformat = V4L2_PIX_FMT_RGB444, + .mbus_code = V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE, + .bpp = 2, + }, + { + .desc = "RGB 565", + .pixelformat = V4L2_PIX_FMT_RGB565, + .mbus_code = V4L2_MBUS_FMT_RGB565_2X8_LE, + .bpp = 2, + }, + { + .desc = "Raw RGB Bayer", + .pixelformat = V4L2_PIX_FMT_SBGGR8, + .mbus_code = V4L2_MBUS_FMT_SBGGR8_1X8, + .bpp = 1 + }, +}; +#define N_CAFE_FMTS ARRAY_SIZE(cafe_formats) + +static struct cafe_format_struct *cafe_find_format(u32 pixelformat) +{ + unsigned i; + + for (i = 0; i < N_CAFE_FMTS; i++) + if (cafe_formats[i].pixelformat == pixelformat) + return cafe_formats + i; + /* Not found? Then return the first format. */ + return cafe_formats; +} + +/* + * Start over with DMA buffers - dev_lock needed. + */ +static void cafe_reset_buffers(struct cafe_camera *cam) +{ + int i; + + cam->next_buf = -1; + for (i = 0; i < cam->nbufs; i++) + clear_bit(i, &cam->flags); + cam->specframes = 0; +} + +static inline int cafe_needs_config(struct cafe_camera *cam) +{ + return test_bit(CF_CONFIG_NEEDED, &cam->flags); +} + +static void cafe_set_config_needed(struct cafe_camera *cam, int needed) +{ + if (needed) + set_bit(CF_CONFIG_NEEDED, &cam->flags); + else + clear_bit(CF_CONFIG_NEEDED, &cam->flags); +} + + + + +/* + * Debugging and related. + */ +#define cam_err(cam, fmt, arg...) \ + dev_err(&(cam)->pdev->dev, fmt, ##arg); +#define cam_warn(cam, fmt, arg...) \ + dev_warn(&(cam)->pdev->dev, fmt, ##arg); +#define cam_dbg(cam, fmt, arg...) \ + dev_dbg(&(cam)->pdev->dev, fmt, ##arg); + + +/* ---------------------------------------------------------------------*/ + +/* + * Device register I/O + */ +static inline void cafe_reg_write(struct cafe_camera *cam, unsigned int reg, + unsigned int val) +{ + iowrite32(val, cam->regs + reg); +} + +static inline unsigned int cafe_reg_read(struct cafe_camera *cam, + unsigned int reg) +{ + return ioread32(cam->regs + reg); +} + + +static inline void cafe_reg_write_mask(struct cafe_camera *cam, unsigned int reg, + unsigned int val, unsigned int mask) +{ + unsigned int v = cafe_reg_read(cam, reg); + + v = (v & ~mask) | (val & mask); + cafe_reg_write(cam, reg, v); +} + +static inline void cafe_reg_clear_bit(struct cafe_camera *cam, + unsigned int reg, unsigned int val) +{ + cafe_reg_write_mask(cam, reg, 0, val); +} + +static inline void cafe_reg_set_bit(struct cafe_camera *cam, + unsigned int reg, unsigned int val) +{ + cafe_reg_write_mask(cam, reg, val, val); +} + + + +/* -------------------------------------------------------------------- */ +/* + * The I2C/SMBUS interface to the camera itself starts here. The + * controller handles SMBUS itself, presenting a relatively simple register + * interface; all we have to do is to tell it where to route the data. + */ +#define CAFE_SMBUS_TIMEOUT (HZ) /* generous */ + +static int cafe_smbus_write_done(struct cafe_camera *cam) +{ + unsigned long flags; + int c1; + + /* + * We must delay after the interrupt, or the controller gets confused + * and never does give us good status. Fortunately, we don't do this + * often. + */ + udelay(20); + spin_lock_irqsave(&cam->dev_lock, flags); + c1 = cafe_reg_read(cam, REG_TWSIC1); + spin_unlock_irqrestore(&cam->dev_lock, flags); + return (c1 & (TWSIC1_WSTAT|TWSIC1_ERROR)) != TWSIC1_WSTAT; +} + +static int cafe_smbus_write_data(struct cafe_camera *cam, + u16 addr, u8 command, u8 value) +{ + unsigned int rval; + unsigned long flags; + + spin_lock_irqsave(&cam->dev_lock, flags); + rval = TWSIC0_EN | ((addr << TWSIC0_SID_SHIFT) & TWSIC0_SID); + rval |= TWSIC0_OVMAGIC; /* Make OV sensors work */ + /* + * Marvell sez set clkdiv to all 1's for now. + */ + rval |= TWSIC0_CLKDIV; + cafe_reg_write(cam, REG_TWSIC0, rval); + (void) cafe_reg_read(cam, REG_TWSIC1); /* force write */ + rval = value | ((command << TWSIC1_ADDR_SHIFT) & TWSIC1_ADDR); + cafe_reg_write(cam, REG_TWSIC1, rval); + spin_unlock_irqrestore(&cam->dev_lock, flags); + + /* Unfortunately, reading TWSIC1 too soon after sending a command + * causes the device to die. + * Use a busy-wait because we often send a large quantity of small + * commands at-once; using msleep() would cause a lot of context + * switches which take longer than 2ms, resulting in a noticeable + * boot-time and capture-start delays. + */ + mdelay(2); + + /* + * Another sad fact is that sometimes, commands silently complete but + * cafe_smbus_write_done() never becomes aware of this. + * This happens at random and appears to possible occur with any + * command. + * We don't understand why this is. We work around this issue + * with the timeout in the wait below, assuming that all commands + * complete within the timeout. + */ + wait_event_timeout(cam->smbus_wait, cafe_smbus_write_done(cam), + CAFE_SMBUS_TIMEOUT); + + spin_lock_irqsave(&cam->dev_lock, flags); + rval = cafe_reg_read(cam, REG_TWSIC1); + spin_unlock_irqrestore(&cam->dev_lock, flags); + + if (rval & TWSIC1_WSTAT) { + cam_err(cam, "SMBUS write (%02x/%02x/%02x) timed out\n", addr, + command, value); + return -EIO; + } + if (rval & TWSIC1_ERROR) { + cam_err(cam, "SMBUS write (%02x/%02x/%02x) error\n", addr, + command, value); + return -EIO; + } + return 0; +} + + + +static int cafe_smbus_read_done(struct cafe_camera *cam) +{ + unsigned long flags; + int c1; + + /* + * We must delay after the interrupt, or the controller gets confused + * and never does give us good status. Fortunately, we don't do this + * often. + */ + udelay(20); + spin_lock_irqsave(&cam->dev_lock, flags); + c1 = cafe_reg_read(cam, REG_TWSIC1); + spin_unlock_irqrestore(&cam->dev_lock, flags); + return c1 & (TWSIC1_RVALID|TWSIC1_ERROR); +} + + + +static int cafe_smbus_read_data(struct cafe_camera *cam, + u16 addr, u8 command, u8 *value) +{ + unsigned int rval; + unsigned long flags; + + spin_lock_irqsave(&cam->dev_lock, flags); + rval = TWSIC0_EN | ((addr << TWSIC0_SID_SHIFT) & TWSIC0_SID); + rval |= TWSIC0_OVMAGIC; /* Make OV sensors work */ + /* + * Marvel sez set clkdiv to all 1's for now. + */ + rval |= TWSIC0_CLKDIV; + cafe_reg_write(cam, REG_TWSIC0, rval); + (void) cafe_reg_read(cam, REG_TWSIC1); /* force write */ + rval = TWSIC1_READ | ((command << TWSIC1_ADDR_SHIFT) & TWSIC1_ADDR); + cafe_reg_write(cam, REG_TWSIC1, rval); + spin_unlock_irqrestore(&cam->dev_lock, flags); + + wait_event_timeout(cam->smbus_wait, + cafe_smbus_read_done(cam), CAFE_SMBUS_TIMEOUT); + spin_lock_irqsave(&cam->dev_lock, flags); + rval = cafe_reg_read(cam, REG_TWSIC1); + spin_unlock_irqrestore(&cam->dev_lock, flags); + + if (rval & TWSIC1_ERROR) { + cam_err(cam, "SMBUS read (%02x/%02x) error\n", addr, command); + return -EIO; + } + if (! (rval & TWSIC1_RVALID)) { + cam_err(cam, "SMBUS read (%02x/%02x) timed out\n", addr, + command); + return -EIO; + } + *value = rval & 0xff; + return 0; +} + +/* + * Perform a transfer over SMBUS. This thing is called under + * the i2c bus lock, so we shouldn't race with ourselves... + */ +static int cafe_smbus_xfer(struct i2c_adapter *adapter, u16 addr, + unsigned short flags, char rw, u8 command, + int size, union i2c_smbus_data *data) +{ + struct v4l2_device *v4l2_dev = i2c_get_adapdata(adapter); + struct cafe_camera *cam = to_cam(v4l2_dev); + int ret = -EINVAL; + + /* + * This interface would appear to only do byte data ops. OK + * it can do word too, but the cam chip has no use for that. + */ + if (size != I2C_SMBUS_BYTE_DATA) { + cam_err(cam, "funky xfer size %d\n", size); + return -EINVAL; + } + + if (rw == I2C_SMBUS_WRITE) + ret = cafe_smbus_write_data(cam, addr, command, data->byte); + else if (rw == I2C_SMBUS_READ) + ret = cafe_smbus_read_data(cam, addr, command, &data->byte); + return ret; +} + + +static void cafe_smbus_enable_irq(struct cafe_camera *cam) +{ + unsigned long flags; + + spin_lock_irqsave(&cam->dev_lock, flags); + cafe_reg_set_bit(cam, REG_IRQMASK, TWSIIRQS); + spin_unlock_irqrestore(&cam->dev_lock, flags); +} + +static u32 cafe_smbus_func(struct i2c_adapter *adapter) +{ + return I2C_FUNC_SMBUS_READ_BYTE_DATA | + I2C_FUNC_SMBUS_WRITE_BYTE_DATA; +} + +static struct i2c_algorithm cafe_smbus_algo = { + .smbus_xfer = cafe_smbus_xfer, + .functionality = cafe_smbus_func +}; + +/* Somebody is on the bus */ +static void cafe_ctlr_stop_dma(struct cafe_camera *cam); +static void cafe_ctlr_power_down(struct cafe_camera *cam); + +static int cafe_smbus_setup(struct cafe_camera *cam) +{ + struct i2c_adapter *adap = &cam->i2c_adapter; + int ret; + + cafe_smbus_enable_irq(cam); + adap->owner = THIS_MODULE; + adap->algo = &cafe_smbus_algo; + strcpy(adap->name, "cafe_ccic"); + adap->dev.parent = &cam->pdev->dev; + i2c_set_adapdata(adap, &cam->v4l2_dev); + ret = i2c_add_adapter(adap); + if (ret) + printk(KERN_ERR "Unable to register cafe i2c adapter\n"); + return ret; +} + +static void cafe_smbus_shutdown(struct cafe_camera *cam) +{ + i2c_del_adapter(&cam->i2c_adapter); +} + + +/* ------------------------------------------------------------------- */ +/* + * Deal with the controller. + */ + +/* + * Do everything we think we need to have the interface operating + * according to the desired format. + */ +static void cafe_ctlr_dma(struct cafe_camera *cam) +{ + /* + * Store the first two Y buffers (we aren't supporting + * planar formats for now, so no UV bufs). Then either + * set the third if it exists, or tell the controller + * to just use two. + */ + cafe_reg_write(cam, REG_Y0BAR, cam->dma_handles[0]); + cafe_reg_write(cam, REG_Y1BAR, cam->dma_handles[1]); + if (cam->nbufs > 2) { + cafe_reg_write(cam, REG_Y2BAR, cam->dma_handles[2]); + cafe_reg_clear_bit(cam, REG_CTRL1, C1_TWOBUFS); + } + else + cafe_reg_set_bit(cam, REG_CTRL1, C1_TWOBUFS); + cafe_reg_write(cam, REG_UBAR, 0); /* 32 bits only for now */ +} + +static void cafe_ctlr_image(struct cafe_camera *cam) +{ + int imgsz; + struct v4l2_pix_format *fmt = &cam->pix_format; + + imgsz = ((fmt->height << IMGSZ_V_SHIFT) & IMGSZ_V_MASK) | + (fmt->bytesperline & IMGSZ_H_MASK); + cafe_reg_write(cam, REG_IMGSIZE, imgsz); + cafe_reg_write(cam, REG_IMGOFFSET, 0); + /* YPITCH just drops the last two bits */ + cafe_reg_write_mask(cam, REG_IMGPITCH, fmt->bytesperline, + IMGP_YP_MASK); + /* + * Tell the controller about the image format we are using. + */ + switch (cam->pix_format.pixelformat) { + case V4L2_PIX_FMT_YUYV: + cafe_reg_write_mask(cam, REG_CTRL0, + C0_DF_YUV|C0_YUV_PACKED|C0_YUVE_YUYV, + C0_DF_MASK); + break; + + case V4L2_PIX_FMT_RGB444: + cafe_reg_write_mask(cam, REG_CTRL0, + C0_DF_RGB|C0_RGBF_444|C0_RGB4_XRGB, + C0_DF_MASK); + /* Alpha value? */ + break; + + case V4L2_PIX_FMT_RGB565: + cafe_reg_write_mask(cam, REG_CTRL0, + C0_DF_RGB|C0_RGBF_565|C0_RGB5_BGGR, + C0_DF_MASK); + break; + + default: + cam_err(cam, "Unknown format %x\n", cam->pix_format.pixelformat); + break; + } + /* + * Make sure it knows we want to use hsync/vsync. + */ + cafe_reg_write_mask(cam, REG_CTRL0, C0_SIF_HVSYNC, + C0_SIFM_MASK); +} + + +/* + * Configure the controller for operation; caller holds the + * device mutex. + */ +static int cafe_ctlr_configure(struct cafe_camera *cam) +{ + unsigned long flags; + + spin_lock_irqsave(&cam->dev_lock, flags); + cafe_ctlr_dma(cam); + cafe_ctlr_image(cam); + cafe_set_config_needed(cam, 0); + spin_unlock_irqrestore(&cam->dev_lock, flags); + return 0; +} + +static void cafe_ctlr_irq_enable(struct cafe_camera *cam) +{ + /* + * Clear any pending interrupts, since we do not + * expect to have I/O active prior to enabling. + */ + cafe_reg_write(cam, REG_IRQSTAT, FRAMEIRQS); + cafe_reg_set_bit(cam, REG_IRQMASK, FRAMEIRQS); +} + +static void cafe_ctlr_irq_disable(struct cafe_camera *cam) +{ + cafe_reg_clear_bit(cam, REG_IRQMASK, FRAMEIRQS); +} + +/* + * Make the controller start grabbing images. Everything must + * be set up before doing this. + */ +static void cafe_ctlr_start(struct cafe_camera *cam) +{ + /* set_bit performs a read, so no other barrier should be + needed here */ + cafe_reg_set_bit(cam, REG_CTRL0, C0_ENABLE); +} + +static void cafe_ctlr_stop(struct cafe_camera *cam) +{ + cafe_reg_clear_bit(cam, REG_CTRL0, C0_ENABLE); +} + +static void cafe_ctlr_init(struct cafe_camera *cam) +{ + unsigned long flags; + + spin_lock_irqsave(&cam->dev_lock, flags); + /* + * Added magic to bring up the hardware on the B-Test board + */ + cafe_reg_write(cam, 0x3038, 0x8); + cafe_reg_write(cam, 0x315c, 0x80008); + /* + * Go through the dance needed to wake the device up. + * Note that these registers are global and shared + * with the NAND and SD devices. Interaction between the + * three still needs to be examined. + */ + cafe_reg_write(cam, REG_GL_CSR, GCSR_SRS|GCSR_MRS); /* Needed? */ + cafe_reg_write(cam, REG_GL_CSR, GCSR_SRC|GCSR_MRC); + cafe_reg_write(cam, REG_GL_CSR, GCSR_SRC|GCSR_MRS); + /* + * Here we must wait a bit for the controller to come around. + */ + spin_unlock_irqrestore(&cam->dev_lock, flags); + msleep(5); + spin_lock_irqsave(&cam->dev_lock, flags); + + cafe_reg_write(cam, REG_GL_CSR, GCSR_CCIC_EN|GCSR_SRC|GCSR_MRC); + cafe_reg_set_bit(cam, REG_GL_IMASK, GIMSK_CCIC_EN); + /* + * Make sure it's not powered down. + */ + cafe_reg_clear_bit(cam, REG_CTRL1, C1_PWRDWN); + /* + * Turn off the enable bit. It sure should be off anyway, + * but it's good to be sure. + */ + cafe_reg_clear_bit(cam, REG_CTRL0, C0_ENABLE); + /* + * Mask all interrupts. + */ + cafe_reg_write(cam, REG_IRQMASK, 0); + /* + * Clock the sensor appropriately. Controller clock should + * be 48MHz, sensor "typical" value is half that. + */ + cafe_reg_write_mask(cam, REG_CLKCTRL, 2, CLK_DIV_MASK); + spin_unlock_irqrestore(&cam->dev_lock, flags); +} + + +/* + * Stop the controller, and don't return until we're really sure that no + * further DMA is going on. + */ +static void cafe_ctlr_stop_dma(struct cafe_camera *cam) +{ + unsigned long flags; + + /* + * Theory: stop the camera controller (whether it is operating + * or not). Delay briefly just in case we race with the SOF + * interrupt, then wait until no DMA is active. + */ + spin_lock_irqsave(&cam->dev_lock, flags); + cafe_ctlr_stop(cam); + spin_unlock_irqrestore(&cam->dev_lock, flags); + mdelay(1); + wait_event_timeout(cam->iowait, + !test_bit(CF_DMA_ACTIVE, &cam->flags), HZ); + if (test_bit(CF_DMA_ACTIVE, &cam->flags)) + cam_err(cam, "Timeout waiting for DMA to end\n"); + /* This would be bad news - what now? */ + spin_lock_irqsave(&cam->dev_lock, flags); + cam->state = S_IDLE; + cafe_ctlr_irq_disable(cam); + spin_unlock_irqrestore(&cam->dev_lock, flags); +} + +/* + * Power up and down. + */ +static void cafe_ctlr_power_up(struct cafe_camera *cam) +{ + unsigned long flags; + + spin_lock_irqsave(&cam->dev_lock, flags); + cafe_reg_clear_bit(cam, REG_CTRL1, C1_PWRDWN); + /* + * Part one of the sensor dance: turn the global + * GPIO signal on. + */ + cafe_reg_write(cam, REG_GL_FCR, GFCR_GPIO_ON); + cafe_reg_write(cam, REG_GL_GPIOR, GGPIO_OUT|GGPIO_VAL); + /* + * Put the sensor into operational mode (assumes OLPC-style + * wiring). Control 0 is reset - set to 1 to operate. + * Control 1 is power down, set to 0 to operate. + */ + cafe_reg_write(cam, REG_GPR, GPR_C1EN|GPR_C0EN); /* pwr up, reset */ +/* mdelay(1); */ /* Marvell says 1ms will do it */ + cafe_reg_write(cam, REG_GPR, GPR_C1EN|GPR_C0EN|GPR_C0); +/* mdelay(1); */ /* Enough? */ + spin_unlock_irqrestore(&cam->dev_lock, flags); + msleep(5); /* Just to be sure */ +} + +static void cafe_ctlr_power_down(struct cafe_camera *cam) +{ + unsigned long flags; + + spin_lock_irqsave(&cam->dev_lock, flags); + cafe_reg_write(cam, REG_GPR, GPR_C1EN|GPR_C0EN|GPR_C1); + cafe_reg_write(cam, REG_GL_FCR, GFCR_GPIO_ON); + cafe_reg_write(cam, REG_GL_GPIOR, GGPIO_OUT); + cafe_reg_set_bit(cam, REG_CTRL1, C1_PWRDWN); + spin_unlock_irqrestore(&cam->dev_lock, flags); +} + +/* -------------------------------------------------------------------- */ +/* + * Communications with the sensor. + */ + +static int __cafe_cam_reset(struct cafe_camera *cam) +{ + return sensor_call(cam, core, reset, 0); +} + +/* + * We have found the sensor on the i2c. Let's try to have a + * conversation. + */ +static int cafe_cam_init(struct cafe_camera *cam) +{ + struct v4l2_dbg_chip_ident chip; + int ret; + + mutex_lock(&cam->s_mutex); + if (cam->state != S_NOTREADY) + cam_warn(cam, "Cam init with device in funky state %d", + cam->state); + ret = __cafe_cam_reset(cam); + if (ret) + goto out; + chip.ident = V4L2_IDENT_NONE; + chip.match.type = V4L2_CHIP_MATCH_I2C_ADDR; + chip.match.addr = cam->sensor_addr; + ret = sensor_call(cam, core, g_chip_ident, &chip); + if (ret) + goto out; + cam->sensor_type = chip.ident; + if (cam->sensor_type != V4L2_IDENT_OV7670) { + cam_err(cam, "Unsupported sensor type 0x%x", cam->sensor_type); + ret = -EINVAL; + goto out; + } +/* Get/set parameters? */ + ret = 0; + cam->state = S_IDLE; + out: + cafe_ctlr_power_down(cam); + mutex_unlock(&cam->s_mutex); + return ret; +} + +/* + * Configure the sensor to match the parameters we have. Caller should + * hold s_mutex + */ +static int cafe_cam_set_flip(struct cafe_camera *cam) +{ + struct v4l2_control ctrl; + + memset(&ctrl, 0, sizeof(ctrl)); + ctrl.id = V4L2_CID_VFLIP; + ctrl.value = flip; + return sensor_call(cam, core, s_ctrl, &ctrl); +} + + +static int cafe_cam_configure(struct cafe_camera *cam) +{ + struct v4l2_mbus_framefmt mbus_fmt; + int ret; + + v4l2_fill_mbus_format(&mbus_fmt, &cam->pix_format, cam->mbus_code); + ret = sensor_call(cam, core, init, 0); + if (ret == 0) + ret = sensor_call(cam, video, s_mbus_fmt, &mbus_fmt); + /* + * OV7670 does weird things if flip is set *before* format... + */ + ret += cafe_cam_set_flip(cam); + return ret; +} + +/* -------------------------------------------------------------------- */ +/* + * DMA buffer management. These functions need s_mutex held. + */ + +/* FIXME: this is inefficient as hell, since dma_alloc_coherent just + * does a get_free_pages() call, and we waste a good chunk of an orderN + * allocation. Should try to allocate the whole set in one chunk. + */ +static int cafe_alloc_dma_bufs(struct cafe_camera *cam, int loadtime) +{ + int i; + + cafe_set_config_needed(cam, 1); + if (loadtime) + cam->dma_buf_size = dma_buf_size; + else + cam->dma_buf_size = cam->pix_format.sizeimage; + if (n_dma_bufs > 3) + n_dma_bufs = 3; + + cam->nbufs = 0; + for (i = 0; i < n_dma_bufs; i++) { + cam->dma_bufs[i] = dma_alloc_coherent(&cam->pdev->dev, + cam->dma_buf_size, cam->dma_handles + i, + GFP_KERNEL); + if (cam->dma_bufs[i] == NULL) { + cam_warn(cam, "Failed to allocate DMA buffer\n"); + break; + } + /* For debug, remove eventually */ + memset(cam->dma_bufs[i], 0xcc, cam->dma_buf_size); + (cam->nbufs)++; + } + + switch (cam->nbufs) { + case 1: + dma_free_coherent(&cam->pdev->dev, cam->dma_buf_size, + cam->dma_bufs[0], cam->dma_handles[0]); + cam->nbufs = 0; + case 0: + cam_err(cam, "Insufficient DMA buffers, cannot operate\n"); + return -ENOMEM; + + case 2: + if (n_dma_bufs > 2) + cam_warn(cam, "Will limp along with only 2 buffers\n"); + break; + } + return 0; +} + +static void cafe_free_dma_bufs(struct cafe_camera *cam) +{ + int i; + + for (i = 0; i < cam->nbufs; i++) { + dma_free_coherent(&cam->pdev->dev, cam->dma_buf_size, + cam->dma_bufs[i], cam->dma_handles[i]); + cam->dma_bufs[i] = NULL; + } + cam->nbufs = 0; +} + + + + + +/* ----------------------------------------------------------------------- */ +/* + * Here starts the V4L2 interface code. + */ + +/* + * Read an image from the device. + */ +static ssize_t cafe_deliver_buffer(struct cafe_camera *cam, + char __user *buffer, size_t len, loff_t *pos) +{ + int bufno; + unsigned long flags; + + spin_lock_irqsave(&cam->dev_lock, flags); + if (cam->next_buf < 0) { + cam_err(cam, "deliver_buffer: No next buffer\n"); + spin_unlock_irqrestore(&cam->dev_lock, flags); + return -EIO; + } + bufno = cam->next_buf; + clear_bit(bufno, &cam->flags); + if (++(cam->next_buf) >= cam->nbufs) + cam->next_buf = 0; + if (! test_bit(cam->next_buf, &cam->flags)) + cam->next_buf = -1; + cam->specframes = 0; + spin_unlock_irqrestore(&cam->dev_lock, flags); + + if (len > cam->pix_format.sizeimage) + len = cam->pix_format.sizeimage; + if (copy_to_user(buffer, cam->dma_bufs[bufno], len)) + return -EFAULT; + (*pos) += len; + return len; +} + +/* + * Get everything ready, and start grabbing frames. + */ +static int cafe_read_setup(struct cafe_camera *cam, enum cafe_state state) +{ + int ret; + unsigned long flags; + + /* + * Configuration. If we still don't have DMA buffers, + * make one last, desperate attempt. + */ + if (cam->nbufs == 0) + if (cafe_alloc_dma_bufs(cam, 0)) + return -ENOMEM; + + if (cafe_needs_config(cam)) { + cafe_cam_configure(cam); + ret = cafe_ctlr_configure(cam); + if (ret) + return ret; + } + + /* + * Turn it loose. + */ + spin_lock_irqsave(&cam->dev_lock, flags); + cafe_reset_buffers(cam); + cafe_ctlr_irq_enable(cam); + cam->state = state; + cafe_ctlr_start(cam); + spin_unlock_irqrestore(&cam->dev_lock, flags); + return 0; +} + + +static ssize_t cafe_v4l_read(struct file *filp, + char __user *buffer, size_t len, loff_t *pos) +{ + struct cafe_camera *cam = filp->private_data; + int ret = 0; + + /* + * Perhaps we're in speculative read mode and already + * have data? + */ + mutex_lock(&cam->s_mutex); + if (cam->state == S_SPECREAD) { + if (cam->next_buf >= 0) { + ret = cafe_deliver_buffer(cam, buffer, len, pos); + if (ret != 0) + goto out_unlock; + } + } else if (cam->state == S_FLAKED || cam->state == S_NOTREADY) { + ret = -EIO; + goto out_unlock; + } else if (cam->state != S_IDLE) { + ret = -EBUSY; + goto out_unlock; + } + + /* + * v4l2: multiple processes can open the device, but only + * one gets to grab data from it. + */ + if (cam->owner && cam->owner != filp) { + ret = -EBUSY; + goto out_unlock; + } + cam->owner = filp; + + /* + * Do setup if need be. + */ + if (cam->state != S_SPECREAD) { + ret = cafe_read_setup(cam, S_SINGLEREAD); + if (ret) + goto out_unlock; + } + /* + * Wait for something to happen. This should probably + * be interruptible (FIXME). + */ + wait_event_timeout(cam->iowait, cam->next_buf >= 0, HZ); + if (cam->next_buf < 0) { + cam_err(cam, "read() operation timed out\n"); + cafe_ctlr_stop_dma(cam); + ret = -EIO; + goto out_unlock; + } + /* + * Give them their data and we should be done. + */ + ret = cafe_deliver_buffer(cam, buffer, len, pos); + + out_unlock: + mutex_unlock(&cam->s_mutex); + return ret; +} + + + + + + + + +/* + * Streaming I/O support. + */ + + + +static int cafe_vidioc_streamon(struct file *filp, void *priv, + enum v4l2_buf_type type) +{ + struct cafe_camera *cam = filp->private_data; + int ret = -EINVAL; + + if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + goto out; + mutex_lock(&cam->s_mutex); + if (cam->state != S_IDLE || cam->n_sbufs == 0) + goto out_unlock; + + cam->sequence = 0; + ret = cafe_read_setup(cam, S_STREAMING); + + out_unlock: + mutex_unlock(&cam->s_mutex); + out: + return ret; +} + + +static int cafe_vidioc_streamoff(struct file *filp, void *priv, + enum v4l2_buf_type type) +{ + struct cafe_camera *cam = filp->private_data; + int ret = -EINVAL; + + if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + goto out; + mutex_lock(&cam->s_mutex); + if (cam->state != S_STREAMING) + goto out_unlock; + + cafe_ctlr_stop_dma(cam); + ret = 0; + + out_unlock: + mutex_unlock(&cam->s_mutex); + out: + return ret; +} + + + +static int cafe_setup_siobuf(struct cafe_camera *cam, int index) +{ + struct cafe_sio_buffer *buf = cam->sb_bufs + index; + + INIT_LIST_HEAD(&buf->list); + buf->v4lbuf.length = PAGE_ALIGN(cam->pix_format.sizeimage); + buf->buffer = vmalloc_user(buf->v4lbuf.length); + if (buf->buffer == NULL) + return -ENOMEM; + buf->mapcount = 0; + buf->cam = cam; + + buf->v4lbuf.index = index; + buf->v4lbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + buf->v4lbuf.field = V4L2_FIELD_NONE; + buf->v4lbuf.memory = V4L2_MEMORY_MMAP; + /* + * Offset: must be 32-bit even on a 64-bit system. videobuf-dma-sg + * just uses the length times the index, but the spec warns + * against doing just that - vma merging problems. So we + * leave a gap between each pair of buffers. + */ + buf->v4lbuf.m.offset = 2*index*buf->v4lbuf.length; + return 0; +} + +static int cafe_free_sio_buffers(struct cafe_camera *cam) +{ + int i; + + /* + * If any buffers are mapped, we cannot free them at all. + */ + for (i = 0; i < cam->n_sbufs; i++) + if (cam->sb_bufs[i].mapcount > 0) + return -EBUSY; + /* + * OK, let's do it. + */ + for (i = 0; i < cam->n_sbufs; i++) + vfree(cam->sb_bufs[i].buffer); + cam->n_sbufs = 0; + kfree(cam->sb_bufs); + cam->sb_bufs = NULL; + INIT_LIST_HEAD(&cam->sb_avail); + INIT_LIST_HEAD(&cam->sb_full); + return 0; +} + + + +static int cafe_vidioc_reqbufs(struct file *filp, void *priv, + struct v4l2_requestbuffers *req) +{ + struct cafe_camera *cam = filp->private_data; + int ret = 0; /* Silence warning */ + + /* + * Make sure it's something we can do. User pointers could be + * implemented without great pain, but that's not been done yet. + */ + if (req->memory != V4L2_MEMORY_MMAP) + return -EINVAL; + /* + * If they ask for zero buffers, they really want us to stop streaming + * (if it's happening) and free everything. Should we check owner? + */ + mutex_lock(&cam->s_mutex); + if (req->count == 0) { + if (cam->state == S_STREAMING) + cafe_ctlr_stop_dma(cam); + ret = cafe_free_sio_buffers (cam); + goto out; + } + /* + * Device needs to be idle and working. We *could* try to do the + * right thing in S_SPECREAD by shutting things down, but it + * probably doesn't matter. + */ + if (cam->state != S_IDLE || (cam->owner && cam->owner != filp)) { + ret = -EBUSY; + goto out; + } + cam->owner = filp; + + if (req->count < min_buffers) + req->count = min_buffers; + else if (req->count > max_buffers) + req->count = max_buffers; + if (cam->n_sbufs > 0) { + ret = cafe_free_sio_buffers(cam); + if (ret) + goto out; + } + + cam->sb_bufs = kzalloc(req->count*sizeof(struct cafe_sio_buffer), + GFP_KERNEL); + if (cam->sb_bufs == NULL) { + ret = -ENOMEM; + goto out; + } + for (cam->n_sbufs = 0; cam->n_sbufs < req->count; (cam->n_sbufs++)) { + ret = cafe_setup_siobuf(cam, cam->n_sbufs); + if (ret) + break; + } + + if (cam->n_sbufs == 0) /* no luck at all - ret already set */ + kfree(cam->sb_bufs); + req->count = cam->n_sbufs; /* In case of partial success */ + + out: + mutex_unlock(&cam->s_mutex); + return ret; +} + + +static int cafe_vidioc_querybuf(struct file *filp, void *priv, + struct v4l2_buffer *buf) +{ + struct cafe_camera *cam = filp->private_data; + int ret = -EINVAL; + + mutex_lock(&cam->s_mutex); + if (buf->index >= cam->n_sbufs) + goto out; + *buf = cam->sb_bufs[buf->index].v4lbuf; + ret = 0; + out: + mutex_unlock(&cam->s_mutex); + return ret; +} + +static int cafe_vidioc_qbuf(struct file *filp, void *priv, + struct v4l2_buffer *buf) +{ + struct cafe_camera *cam = filp->private_data; + struct cafe_sio_buffer *sbuf; + int ret = -EINVAL; + unsigned long flags; + + mutex_lock(&cam->s_mutex); + if (buf->index >= cam->n_sbufs) + goto out; + sbuf = cam->sb_bufs + buf->index; + if (sbuf->v4lbuf.flags & V4L2_BUF_FLAG_QUEUED) { + ret = 0; /* Already queued?? */ + goto out; + } + if (sbuf->v4lbuf.flags & V4L2_BUF_FLAG_DONE) { + /* Spec doesn't say anything, seems appropriate tho */ + ret = -EBUSY; + goto out; + } + sbuf->v4lbuf.flags |= V4L2_BUF_FLAG_QUEUED; + spin_lock_irqsave(&cam->dev_lock, flags); + list_add(&sbuf->list, &cam->sb_avail); + spin_unlock_irqrestore(&cam->dev_lock, flags); + ret = 0; + out: + mutex_unlock(&cam->s_mutex); + return ret; +} + +static int cafe_vidioc_dqbuf(struct file *filp, void *priv, + struct v4l2_buffer *buf) +{ + struct cafe_camera *cam = filp->private_data; + struct cafe_sio_buffer *sbuf; + int ret = -EINVAL; + unsigned long flags; + + mutex_lock(&cam->s_mutex); + if (cam->state != S_STREAMING) + goto out_unlock; + if (list_empty(&cam->sb_full) && filp->f_flags & O_NONBLOCK) { + ret = -EAGAIN; + goto out_unlock; + } + + while (list_empty(&cam->sb_full) && cam->state == S_STREAMING) { + mutex_unlock(&cam->s_mutex); + if (wait_event_interruptible(cam->iowait, + !list_empty(&cam->sb_full))) { + ret = -ERESTARTSYS; + goto out; + } + mutex_lock(&cam->s_mutex); + } + + if (cam->state != S_STREAMING) + ret = -EINTR; + else { + spin_lock_irqsave(&cam->dev_lock, flags); + /* Should probably recheck !list_empty() here */ + sbuf = list_entry(cam->sb_full.next, + struct cafe_sio_buffer, list); + list_del_init(&sbuf->list); + spin_unlock_irqrestore(&cam->dev_lock, flags); + sbuf->v4lbuf.flags &= ~V4L2_BUF_FLAG_DONE; + *buf = sbuf->v4lbuf; + ret = 0; + } + + out_unlock: + mutex_unlock(&cam->s_mutex); + out: + return ret; +} + + + +static void cafe_v4l_vm_open(struct vm_area_struct *vma) +{ + struct cafe_sio_buffer *sbuf = vma->vm_private_data; + /* + * Locking: done under mmap_sem, so we don't need to + * go back to the camera lock here. + */ + sbuf->mapcount++; +} + + +static void cafe_v4l_vm_close(struct vm_area_struct *vma) +{ + struct cafe_sio_buffer *sbuf = vma->vm_private_data; + + mutex_lock(&sbuf->cam->s_mutex); + sbuf->mapcount--; + /* Docs say we should stop I/O too... */ + if (sbuf->mapcount == 0) + sbuf->v4lbuf.flags &= ~V4L2_BUF_FLAG_MAPPED; + mutex_unlock(&sbuf->cam->s_mutex); +} + +static const struct vm_operations_struct cafe_v4l_vm_ops = { + .open = cafe_v4l_vm_open, + .close = cafe_v4l_vm_close +}; + + +static int cafe_v4l_mmap(struct file *filp, struct vm_area_struct *vma) +{ + struct cafe_camera *cam = filp->private_data; + unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; + int ret = -EINVAL; + int i; + struct cafe_sio_buffer *sbuf = NULL; + + if (! (vma->vm_flags & VM_WRITE) || ! (vma->vm_flags & VM_SHARED)) + return -EINVAL; + /* + * Find the buffer they are looking for. + */ + mutex_lock(&cam->s_mutex); + for (i = 0; i < cam->n_sbufs; i++) + if (cam->sb_bufs[i].v4lbuf.m.offset == offset) { + sbuf = cam->sb_bufs + i; + break; + } + if (sbuf == NULL) + goto out; + + ret = remap_vmalloc_range(vma, sbuf->buffer, 0); + if (ret) + goto out; + vma->vm_flags |= VM_DONTEXPAND; + vma->vm_private_data = sbuf; + vma->vm_ops = &cafe_v4l_vm_ops; + sbuf->v4lbuf.flags |= V4L2_BUF_FLAG_MAPPED; + cafe_v4l_vm_open(vma); + ret = 0; + out: + mutex_unlock(&cam->s_mutex); + return ret; +} + + + +static int cafe_v4l_open(struct file *filp) +{ + struct cafe_camera *cam = video_drvdata(filp); + + filp->private_data = cam; + + mutex_lock(&cam->s_mutex); + if (cam->users == 0) { + cafe_ctlr_power_up(cam); + __cafe_cam_reset(cam); + cafe_set_config_needed(cam, 1); + /* FIXME make sure this is complete */ + } + (cam->users)++; + mutex_unlock(&cam->s_mutex); + return 0; +} + + +static int cafe_v4l_release(struct file *filp) +{ + struct cafe_camera *cam = filp->private_data; + + mutex_lock(&cam->s_mutex); + (cam->users)--; + if (filp == cam->owner) { + cafe_ctlr_stop_dma(cam); + cafe_free_sio_buffers(cam); + cam->owner = NULL; + } + if (cam->users == 0) { + cafe_ctlr_power_down(cam); + if (alloc_bufs_at_read) + cafe_free_dma_bufs(cam); + } + mutex_unlock(&cam->s_mutex); + return 0; +} + + + +static unsigned int cafe_v4l_poll(struct file *filp, + struct poll_table_struct *pt) +{ + struct cafe_camera *cam = filp->private_data; + + poll_wait(filp, &cam->iowait, pt); + if (cam->next_buf >= 0) + return POLLIN | POLLRDNORM; + return 0; +} + + + +static int cafe_vidioc_queryctrl(struct file *filp, void *priv, + struct v4l2_queryctrl *qc) +{ + struct cafe_camera *cam = priv; + int ret; + + mutex_lock(&cam->s_mutex); + ret = sensor_call(cam, core, queryctrl, qc); + mutex_unlock(&cam->s_mutex); + return ret; +} + + +static int cafe_vidioc_g_ctrl(struct file *filp, void *priv, + struct v4l2_control *ctrl) +{ + struct cafe_camera *cam = priv; + int ret; + + mutex_lock(&cam->s_mutex); + ret = sensor_call(cam, core, g_ctrl, ctrl); + mutex_unlock(&cam->s_mutex); + return ret; +} + + +static int cafe_vidioc_s_ctrl(struct file *filp, void *priv, + struct v4l2_control *ctrl) +{ + struct cafe_camera *cam = priv; + int ret; + + mutex_lock(&cam->s_mutex); + ret = sensor_call(cam, core, s_ctrl, ctrl); + mutex_unlock(&cam->s_mutex); + return ret; +} + + + + + +static int cafe_vidioc_querycap(struct file *file, void *priv, + struct v4l2_capability *cap) +{ + strcpy(cap->driver, "cafe_ccic"); + strcpy(cap->card, "cafe_ccic"); + cap->version = CAFE_VERSION; + cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | + V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; + return 0; +} + + +/* + * The default format we use until somebody says otherwise. + */ +static const struct v4l2_pix_format cafe_def_pix_format = { + .width = VGA_WIDTH, + .height = VGA_HEIGHT, + .pixelformat = V4L2_PIX_FMT_YUYV, + .field = V4L2_FIELD_NONE, + .bytesperline = VGA_WIDTH*2, + .sizeimage = VGA_WIDTH*VGA_HEIGHT*2, +}; + +static const enum v4l2_mbus_pixelcode cafe_def_mbus_code = + V4L2_MBUS_FMT_YUYV8_2X8; + +static int cafe_vidioc_enum_fmt_vid_cap(struct file *filp, + void *priv, struct v4l2_fmtdesc *fmt) +{ + if (fmt->index >= N_CAFE_FMTS) + return -EINVAL; + strlcpy(fmt->description, cafe_formats[fmt->index].desc, + sizeof(fmt->description)); + fmt->pixelformat = cafe_formats[fmt->index].pixelformat; + return 0; +} + +static int cafe_vidioc_try_fmt_vid_cap(struct file *filp, void *priv, + struct v4l2_format *fmt) +{ + struct cafe_camera *cam = priv; + struct cafe_format_struct *f; + struct v4l2_pix_format *pix = &fmt->fmt.pix; + struct v4l2_mbus_framefmt mbus_fmt; + int ret; + + f = cafe_find_format(pix->pixelformat); + pix->pixelformat = f->pixelformat; + v4l2_fill_mbus_format(&mbus_fmt, pix, f->mbus_code); + mutex_lock(&cam->s_mutex); + ret = sensor_call(cam, video, try_mbus_fmt, &mbus_fmt); + mutex_unlock(&cam->s_mutex); + v4l2_fill_pix_format(pix, &mbus_fmt); + pix->bytesperline = pix->width * f->bpp; + pix->sizeimage = pix->height * pix->bytesperline; + return ret; +} + +static int cafe_vidioc_s_fmt_vid_cap(struct file *filp, void *priv, + struct v4l2_format *fmt) +{ + struct cafe_camera *cam = priv; + struct cafe_format_struct *f; + int ret; + + /* + * Can't do anything if the device is not idle + * Also can't if there are streaming buffers in place. + */ + if (cam->state != S_IDLE || cam->n_sbufs > 0) + return -EBUSY; + + f = cafe_find_format(fmt->fmt.pix.pixelformat); + + /* + * See if the formatting works in principle. + */ + ret = cafe_vidioc_try_fmt_vid_cap(filp, priv, fmt); + if (ret) + return ret; + /* + * Now we start to change things for real, so let's do it + * under lock. + */ + mutex_lock(&cam->s_mutex); + cam->pix_format = fmt->fmt.pix; + cam->mbus_code = f->mbus_code; + + /* + * Make sure we have appropriate DMA buffers. + */ + ret = -ENOMEM; + if (cam->nbufs > 0 && cam->dma_buf_size < cam->pix_format.sizeimage) + cafe_free_dma_bufs(cam); + if (cam->nbufs == 0) { + if (cafe_alloc_dma_bufs(cam, 0)) + goto out; + } + /* + * It looks like this might work, so let's program the sensor. + */ + ret = cafe_cam_configure(cam); + if (! ret) + ret = cafe_ctlr_configure(cam); + out: + mutex_unlock(&cam->s_mutex); + return ret; +} + +/* + * Return our stored notion of how the camera is/should be configured. + * The V4l2 spec wants us to be smarter, and actually get this from + * the camera (and not mess with it at open time). Someday. + */ +static int cafe_vidioc_g_fmt_vid_cap(struct file *filp, void *priv, + struct v4l2_format *f) +{ + struct cafe_camera *cam = priv; + + f->fmt.pix = cam->pix_format; + return 0; +} + +/* + * We only have one input - the sensor - so minimize the nonsense here. + */ +static int cafe_vidioc_enum_input(struct file *filp, void *priv, + struct v4l2_input *input) +{ + if (input->index != 0) + return -EINVAL; + + input->type = V4L2_INPUT_TYPE_CAMERA; + input->std = V4L2_STD_ALL; /* Not sure what should go here */ + strcpy(input->name, "Camera"); + return 0; +} + +static int cafe_vidioc_g_input(struct file *filp, void *priv, unsigned int *i) +{ + *i = 0; + return 0; +} + +static int cafe_vidioc_s_input(struct file *filp, void *priv, unsigned int i) +{ + if (i != 0) + return -EINVAL; + return 0; +} + +/* from vivi.c */ +static int cafe_vidioc_s_std(struct file *filp, void *priv, v4l2_std_id *a) +{ + return 0; +} + +/* + * G/S_PARM. Most of this is done by the sensor, but we are + * the level which controls the number of read buffers. + */ +static int cafe_vidioc_g_parm(struct file *filp, void *priv, + struct v4l2_streamparm *parms) +{ + struct cafe_camera *cam = priv; + int ret; + + mutex_lock(&cam->s_mutex); + ret = sensor_call(cam, video, g_parm, parms); + mutex_unlock(&cam->s_mutex); + parms->parm.capture.readbuffers = n_dma_bufs; + return ret; +} + +static int cafe_vidioc_s_parm(struct file *filp, void *priv, + struct v4l2_streamparm *parms) +{ + struct cafe_camera *cam = priv; + int ret; + + mutex_lock(&cam->s_mutex); + ret = sensor_call(cam, video, s_parm, parms); + mutex_unlock(&cam->s_mutex); + parms->parm.capture.readbuffers = n_dma_bufs; + return ret; +} + +static int cafe_vidioc_g_chip_ident(struct file *file, void *priv, + struct v4l2_dbg_chip_ident *chip) +{ + struct cafe_camera *cam = priv; + + chip->ident = V4L2_IDENT_NONE; + chip->revision = 0; + if (v4l2_chip_match_host(&chip->match)) { + chip->ident = V4L2_IDENT_CAFE; + return 0; + } + return sensor_call(cam, core, g_chip_ident, chip); +} + +static int cafe_vidioc_enum_framesizes(struct file *filp, void *priv, + struct v4l2_frmsizeenum *sizes) +{ + struct cafe_camera *cam = priv; + int ret; + + mutex_lock(&cam->s_mutex); + ret = sensor_call(cam, video, enum_framesizes, sizes); + mutex_unlock(&cam->s_mutex); + return ret; +} + +static int cafe_vidioc_enum_frameintervals(struct file *filp, void *priv, + struct v4l2_frmivalenum *interval) +{ + struct cafe_camera *cam = priv; + int ret; + + mutex_lock(&cam->s_mutex); + ret = sensor_call(cam, video, enum_frameintervals, interval); + mutex_unlock(&cam->s_mutex); + return ret; +} + +#ifdef CONFIG_VIDEO_ADV_DEBUG +static int cafe_vidioc_g_register(struct file *file, void *priv, + struct v4l2_dbg_register *reg) +{ + struct cafe_camera *cam = priv; + + if (v4l2_chip_match_host(®->match)) { + reg->val = cafe_reg_read(cam, reg->reg); + reg->size = 4; + return 0; + } + return sensor_call(cam, core, g_register, reg); +} + +static int cafe_vidioc_s_register(struct file *file, void *priv, + struct v4l2_dbg_register *reg) +{ + struct cafe_camera *cam = priv; + + if (v4l2_chip_match_host(®->match)) { + cafe_reg_write(cam, reg->reg, reg->val); + return 0; + } + return sensor_call(cam, core, s_register, reg); +} +#endif + +/* + * This template device holds all of those v4l2 methods; we + * clone it for specific real devices. + */ + +static const struct v4l2_file_operations cafe_v4l_fops = { + .owner = THIS_MODULE, + .open = cafe_v4l_open, + .release = cafe_v4l_release, + .read = cafe_v4l_read, + .poll = cafe_v4l_poll, + .mmap = cafe_v4l_mmap, + .unlocked_ioctl = video_ioctl2, +}; + +static const struct v4l2_ioctl_ops cafe_v4l_ioctl_ops = { + .vidioc_querycap = cafe_vidioc_querycap, + .vidioc_enum_fmt_vid_cap = cafe_vidioc_enum_fmt_vid_cap, + .vidioc_try_fmt_vid_cap = cafe_vidioc_try_fmt_vid_cap, + .vidioc_s_fmt_vid_cap = cafe_vidioc_s_fmt_vid_cap, + .vidioc_g_fmt_vid_cap = cafe_vidioc_g_fmt_vid_cap, + .vidioc_enum_input = cafe_vidioc_enum_input, + .vidioc_g_input = cafe_vidioc_g_input, + .vidioc_s_input = cafe_vidioc_s_input, + .vidioc_s_std = cafe_vidioc_s_std, + .vidioc_reqbufs = cafe_vidioc_reqbufs, + .vidioc_querybuf = cafe_vidioc_querybuf, + .vidioc_qbuf = cafe_vidioc_qbuf, + .vidioc_dqbuf = cafe_vidioc_dqbuf, + .vidioc_streamon = cafe_vidioc_streamon, + .vidioc_streamoff = cafe_vidioc_streamoff, + .vidioc_queryctrl = cafe_vidioc_queryctrl, + .vidioc_g_ctrl = cafe_vidioc_g_ctrl, + .vidioc_s_ctrl = cafe_vidioc_s_ctrl, + .vidioc_g_parm = cafe_vidioc_g_parm, + .vidioc_s_parm = cafe_vidioc_s_parm, + .vidioc_enum_framesizes = cafe_vidioc_enum_framesizes, + .vidioc_enum_frameintervals = cafe_vidioc_enum_frameintervals, + .vidioc_g_chip_ident = cafe_vidioc_g_chip_ident, +#ifdef CONFIG_VIDEO_ADV_DEBUG + .vidioc_g_register = cafe_vidioc_g_register, + .vidioc_s_register = cafe_vidioc_s_register, +#endif +}; + +static struct video_device cafe_v4l_template = { + .name = "cafe", + .tvnorms = V4L2_STD_NTSC_M, + .current_norm = V4L2_STD_NTSC_M, /* make mplayer happy */ + + .fops = &cafe_v4l_fops, + .ioctl_ops = &cafe_v4l_ioctl_ops, + .release = video_device_release_empty, +}; + + +/* ---------------------------------------------------------------------- */ +/* + * Interrupt handler stuff + */ + + + +static void cafe_frame_tasklet(unsigned long data) +{ + struct cafe_camera *cam = (struct cafe_camera *) data; + int i; + unsigned long flags; + struct cafe_sio_buffer *sbuf; + + spin_lock_irqsave(&cam->dev_lock, flags); + for (i = 0; i < cam->nbufs; i++) { + int bufno = cam->next_buf; + if (bufno < 0) { /* "will never happen" */ + cam_err(cam, "No valid bufs in tasklet!\n"); + break; + } + if (++(cam->next_buf) >= cam->nbufs) + cam->next_buf = 0; + if (! test_bit(bufno, &cam->flags)) + continue; + if (list_empty(&cam->sb_avail)) + break; /* Leave it valid, hope for better later */ + clear_bit(bufno, &cam->flags); + sbuf = list_entry(cam->sb_avail.next, + struct cafe_sio_buffer, list); + /* + * Drop the lock during the big copy. This *should* be safe... + */ + spin_unlock_irqrestore(&cam->dev_lock, flags); + memcpy(sbuf->buffer, cam->dma_bufs[bufno], + cam->pix_format.sizeimage); + sbuf->v4lbuf.bytesused = cam->pix_format.sizeimage; + sbuf->v4lbuf.sequence = cam->buf_seq[bufno]; + sbuf->v4lbuf.flags &= ~V4L2_BUF_FLAG_QUEUED; + sbuf->v4lbuf.flags |= V4L2_BUF_FLAG_DONE; + spin_lock_irqsave(&cam->dev_lock, flags); + list_move_tail(&sbuf->list, &cam->sb_full); + } + if (! list_empty(&cam->sb_full)) + wake_up(&cam->iowait); + spin_unlock_irqrestore(&cam->dev_lock, flags); +} + + + +static void cafe_frame_complete(struct cafe_camera *cam, int frame) +{ + /* + * Basic frame housekeeping. + */ + if (test_bit(frame, &cam->flags) && printk_ratelimit()) + cam_err(cam, "Frame overrun on %d, frames lost\n", frame); + set_bit(frame, &cam->flags); + clear_bit(CF_DMA_ACTIVE, &cam->flags); + if (cam->next_buf < 0) + cam->next_buf = frame; + cam->buf_seq[frame] = ++(cam->sequence); + + switch (cam->state) { + /* + * If in single read mode, try going speculative. + */ + case S_SINGLEREAD: + cam->state = S_SPECREAD; + cam->specframes = 0; + wake_up(&cam->iowait); + break; + + /* + * If we are already doing speculative reads, and nobody is + * reading them, just stop. + */ + case S_SPECREAD: + if (++(cam->specframes) >= cam->nbufs) { + cafe_ctlr_stop(cam); + cafe_ctlr_irq_disable(cam); + cam->state = S_IDLE; + } + wake_up(&cam->iowait); + break; + /* + * For the streaming case, we defer the real work to the + * camera tasklet. + * + * FIXME: if the application is not consuming the buffers, + * we should eventually put things on hold and restart in + * vidioc_dqbuf(). + */ + case S_STREAMING: + tasklet_schedule(&cam->s_tasklet); + break; + + default: + cam_err(cam, "Frame interrupt in non-operational state\n"); + break; + } +} + + + + +static void cafe_frame_irq(struct cafe_camera *cam, unsigned int irqs) +{ + unsigned int frame; + + cafe_reg_write(cam, REG_IRQSTAT, FRAMEIRQS); /* Clear'em all */ + /* + * Handle any frame completions. There really should + * not be more than one of these, or we have fallen + * far behind. + */ + for (frame = 0; frame < cam->nbufs; frame++) + if (irqs & (IRQ_EOF0 << frame)) + cafe_frame_complete(cam, frame); + /* + * If a frame starts, note that we have DMA active. This + * code assumes that we won't get multiple frame interrupts + * at once; may want to rethink that. + */ + if (irqs & (IRQ_SOF0 | IRQ_SOF1 | IRQ_SOF2)) + set_bit(CF_DMA_ACTIVE, &cam->flags); +} + + + +static irqreturn_t cafe_irq(int irq, void *data) +{ + struct cafe_camera *cam = data; + unsigned int irqs; + + spin_lock(&cam->dev_lock); + irqs = cafe_reg_read(cam, REG_IRQSTAT); + if ((irqs & ALLIRQS) == 0) { + spin_unlock(&cam->dev_lock); + return IRQ_NONE; + } + if (irqs & FRAMEIRQS) + cafe_frame_irq(cam, irqs); + if (irqs & TWSIIRQS) { + cafe_reg_write(cam, REG_IRQSTAT, TWSIIRQS); + wake_up(&cam->smbus_wait); + } + spin_unlock(&cam->dev_lock); + return IRQ_HANDLED; +} + + +/* -------------------------------------------------------------------------- */ +/* + * PCI interface stuff. + */ + +static const struct dmi_system_id olpc_xo1_dmi[] = { + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "OLPC"), + DMI_MATCH(DMI_PRODUCT_NAME, "XO"), + DMI_MATCH(DMI_PRODUCT_VERSION, "1"), + }, + }, + { } +}; + +static int cafe_pci_probe(struct pci_dev *pdev, + const struct pci_device_id *id) +{ + int ret; + struct cafe_camera *cam; + struct ov7670_config sensor_cfg = { + /* This controller only does SMBUS */ + .use_smbus = true, + + /* + * Exclude QCIF mode, because it only captures a tiny portion + * of the sensor FOV + */ + .min_width = 320, + .min_height = 240, + }; + struct i2c_board_info ov7670_info = { + .type = "ov7670", + .addr = 0x42, + .platform_data = &sensor_cfg, + }; + + /* + * Start putting together one of our big camera structures. + */ + ret = -ENOMEM; + cam = kzalloc(sizeof(struct cafe_camera), GFP_KERNEL); + if (cam == NULL) + goto out; + ret = v4l2_device_register(&pdev->dev, &cam->v4l2_dev); + if (ret) + goto out_free; + + mutex_init(&cam->s_mutex); + spin_lock_init(&cam->dev_lock); + cam->state = S_NOTREADY; + cafe_set_config_needed(cam, 1); + init_waitqueue_head(&cam->smbus_wait); + init_waitqueue_head(&cam->iowait); + cam->pdev = pdev; + cam->pix_format = cafe_def_pix_format; + cam->mbus_code = cafe_def_mbus_code; + INIT_LIST_HEAD(&cam->dev_list); + INIT_LIST_HEAD(&cam->sb_avail); + INIT_LIST_HEAD(&cam->sb_full); + tasklet_init(&cam->s_tasklet, cafe_frame_tasklet, (unsigned long) cam); + /* + * Get set up on the PCI bus. + */ + ret = pci_enable_device(pdev); + if (ret) + goto out_unreg; + pci_set_master(pdev); + + ret = -EIO; + cam->regs = pci_iomap(pdev, 0, 0); + if (! cam->regs) { + printk(KERN_ERR "Unable to ioremap cafe-ccic regs\n"); + goto out_unreg; + } + ret = request_irq(pdev->irq, cafe_irq, IRQF_SHARED, "cafe-ccic", cam); + if (ret) + goto out_iounmap; + /* + * Initialize the controller and leave it powered up. It will + * stay that way until the sensor driver shows up. + */ + cafe_ctlr_init(cam); + cafe_ctlr_power_up(cam); + /* + * Set up I2C/SMBUS communications. We have to drop the mutex here + * because the sensor could attach in this call chain, leading to + * unsightly deadlocks. + */ + ret = cafe_smbus_setup(cam); + if (ret) + goto out_freeirq; + + /* Apply XO-1 clock speed */ + if (dmi_check_system(olpc_xo1_dmi)) + sensor_cfg.clock_speed = 45; + + cam->sensor_addr = ov7670_info.addr; + cam->sensor = v4l2_i2c_new_subdev_board(&cam->v4l2_dev, &cam->i2c_adapter, + &ov7670_info, NULL); + if (cam->sensor == NULL) { + ret = -ENODEV; + goto out_smbus; + } + + ret = cafe_cam_init(cam); + if (ret) + goto out_smbus; + + /* + * Get the v4l2 setup done. + */ + mutex_lock(&cam->s_mutex); + cam->vdev = cafe_v4l_template; + cam->vdev.debug = 0; +/* cam->vdev.debug = V4L2_DEBUG_IOCTL_ARG;*/ + cam->vdev.v4l2_dev = &cam->v4l2_dev; + ret = video_register_device(&cam->vdev, VFL_TYPE_GRABBER, -1); + if (ret) + goto out_unlock; + video_set_drvdata(&cam->vdev, cam); + + /* + * If so requested, try to get our DMA buffers now. + */ + if (!alloc_bufs_at_read) { + if (cafe_alloc_dma_bufs(cam, 1)) + cam_warn(cam, "Unable to alloc DMA buffers at load" + " will try again later."); + } + + mutex_unlock(&cam->s_mutex); + return 0; + +out_unlock: + mutex_unlock(&cam->s_mutex); +out_smbus: + cafe_smbus_shutdown(cam); +out_freeirq: + cafe_ctlr_power_down(cam); + free_irq(pdev->irq, cam); +out_iounmap: + pci_iounmap(pdev, cam->regs); +out_free: + v4l2_device_unregister(&cam->v4l2_dev); +out_unreg: + kfree(cam); +out: + return ret; +} + + +/* + * Shut down an initialized device + */ +static void cafe_shutdown(struct cafe_camera *cam) +{ +/* FIXME: Make sure we take care of everything here */ + if (cam->n_sbufs > 0) + /* What if they are still mapped? Shouldn't be, but... */ + cafe_free_sio_buffers(cam); + cafe_ctlr_stop_dma(cam); + cafe_ctlr_power_down(cam); + cafe_smbus_shutdown(cam); + cafe_free_dma_bufs(cam); + free_irq(cam->pdev->irq, cam); + pci_iounmap(cam->pdev, cam->regs); + video_unregister_device(&cam->vdev); +} + + +static void cafe_pci_remove(struct pci_dev *pdev) +{ + struct v4l2_device *v4l2_dev = dev_get_drvdata(&pdev->dev); + struct cafe_camera *cam = to_cam(v4l2_dev); + + if (cam == NULL) { + printk(KERN_WARNING "pci_remove on unknown pdev %p\n", pdev); + return; + } + mutex_lock(&cam->s_mutex); + if (cam->users > 0) + cam_warn(cam, "Removing a device with users!\n"); + cafe_shutdown(cam); + v4l2_device_unregister(&cam->v4l2_dev); + kfree(cam); +/* No unlock - it no longer exists */ +} + + +#ifdef CONFIG_PM +/* + * Basic power management. + */ +static int cafe_pci_suspend(struct pci_dev *pdev, pm_message_t state) +{ + struct v4l2_device *v4l2_dev = dev_get_drvdata(&pdev->dev); + struct cafe_camera *cam = to_cam(v4l2_dev); + int ret; + enum cafe_state cstate; + + ret = pci_save_state(pdev); + if (ret) + return ret; + cstate = cam->state; /* HACK - stop_dma sets to idle */ + cafe_ctlr_stop_dma(cam); + cafe_ctlr_power_down(cam); + pci_disable_device(pdev); + cam->state = cstate; + return 0; +} + + +static int cafe_pci_resume(struct pci_dev *pdev) +{ + struct v4l2_device *v4l2_dev = dev_get_drvdata(&pdev->dev); + struct cafe_camera *cam = to_cam(v4l2_dev); + int ret = 0; + + pci_restore_state(pdev); + ret = pci_enable_device(pdev); + + if (ret) { + cam_warn(cam, "Unable to re-enable device on resume!\n"); + return ret; + } + cafe_ctlr_init(cam); + + mutex_lock(&cam->s_mutex); + if (cam->users > 0) { + cafe_ctlr_power_up(cam); + __cafe_cam_reset(cam); + } else { + cafe_ctlr_power_down(cam); + } + mutex_unlock(&cam->s_mutex); + + set_bit(CF_CONFIG_NEEDED, &cam->flags); + if (cam->state == S_SPECREAD) + cam->state = S_IDLE; /* Don't bother restarting */ + else if (cam->state == S_SINGLEREAD || cam->state == S_STREAMING) + ret = cafe_read_setup(cam, cam->state); + return ret; +} + +#endif /* CONFIG_PM */ + + +static struct pci_device_id cafe_ids[] = { + { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, + PCI_DEVICE_ID_MARVELL_88ALP01_CCIC) }, + { 0, } +}; + +MODULE_DEVICE_TABLE(pci, cafe_ids); + +static struct pci_driver cafe_pci_driver = { + .name = "cafe1000-ccic", + .id_table = cafe_ids, + .probe = cafe_pci_probe, + .remove = cafe_pci_remove, +#ifdef CONFIG_PM + .suspend = cafe_pci_suspend, + .resume = cafe_pci_resume, +#endif +}; + + + + +static int __init cafe_init(void) +{ + int ret; + + printk(KERN_NOTICE "Marvell M88ALP01 'CAFE' Camera Controller version %d\n", + CAFE_VERSION); + ret = pci_register_driver(&cafe_pci_driver); + if (ret) { + printk(KERN_ERR "Unable to register cafe_ccic driver\n"); + goto out; + } + ret = 0; + + out: + return ret; +} + + +static void __exit cafe_exit(void) +{ + pci_unregister_driver(&cafe_pci_driver); +} + +module_init(cafe_init); +module_exit(cafe_exit); diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c index d4e7c11553c3..8aa058531280 100644 --- a/drivers/media/video/ov7670.c +++ b/drivers/media/video/ov7670.c @@ -19,8 +19,7 @@ #include #include #include - -#include "ov7670.h" +#include MODULE_AUTHOR("Jonathan Corbet "); MODULE_DESCRIPTION("A low-level driver for OmniVision ov7670 sensors"); diff --git a/drivers/media/video/ov7670.h b/drivers/media/video/ov7670.h deleted file mode 100644 index b133bc123031..000000000000 --- a/drivers/media/video/ov7670.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * A V4L2 driver for OmniVision OV7670 cameras. - * - * Copyright 2010 One Laptop Per Child - * - * This file may be distributed under the terms of the GNU General - * Public License, version 2. - */ - -#ifndef __OV7670_H -#define __OV7670_H - -struct ov7670_config { - int min_width; /* Filter out smaller sizes */ - int min_height; /* Filter out smaller sizes */ - int clock_speed; /* External clock speed (MHz) */ - bool use_smbus; /* Use smbus I/O instead of I2C */ -}; - -#endif diff --git a/include/media/ov7670.h b/include/media/ov7670.h new file mode 100644 index 000000000000..b133bc123031 --- /dev/null +++ b/include/media/ov7670.h @@ -0,0 +1,20 @@ +/* + * A V4L2 driver for OmniVision OV7670 cameras. + * + * Copyright 2010 One Laptop Per Child + * + * This file may be distributed under the terms of the GNU General + * Public License, version 2. + */ + +#ifndef __OV7670_H +#define __OV7670_H + +struct ov7670_config { + int min_width; /* Filter out smaller sizes */ + int min_height; /* Filter out smaller sizes */ + int clock_speed; /* External clock speed (MHz) */ + bool use_smbus; /* Use smbus I/O instead of I2C */ +}; + +#endif -- cgit v1.2.3 From abfa3df36c01a32b081fb448750181af76eb9d55 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Sat, 11 Jun 2011 14:46:43 -0300 Subject: [media] marvell-cam: Separate out the Marvell camera core There will eventually be multiple users of the core camera controller, so separate it from the bus/platform/i2c stuff. I've tried to do the minimal set of changes to get the driver functioning in this configuration; I did clean up a bunch of old checkpatch gripes in the process. This driver works like the old one did on OLPC XO 1 systems. Cc: Daniel Drake Signed-off-by: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/marvell-ccic/Makefile | 1 + drivers/media/video/marvell-ccic/cafe-driver.c | 570 ++++++ drivers/media/video/marvell-ccic/cafe_ccic-regs.h | 166 -- drivers/media/video/marvell-ccic/cafe_ccic.c | 2267 --------------------- drivers/media/video/marvell-ccic/mcam-core.c | 1689 +++++++++++++++ drivers/media/video/marvell-ccic/mcam-core.h | 311 +++ 6 files changed, 2571 insertions(+), 2433 deletions(-) create mode 100644 drivers/media/video/marvell-ccic/cafe-driver.c delete mode 100644 drivers/media/video/marvell-ccic/cafe_ccic-regs.h delete mode 100644 drivers/media/video/marvell-ccic/cafe_ccic.c create mode 100644 drivers/media/video/marvell-ccic/mcam-core.c create mode 100644 drivers/media/video/marvell-ccic/mcam-core.h diff --git a/drivers/media/video/marvell-ccic/Makefile b/drivers/media/video/marvell-ccic/Makefile index 123472514051..462b385c6234 100644 --- a/drivers/media/video/marvell-ccic/Makefile +++ b/drivers/media/video/marvell-ccic/Makefile @@ -1 +1,2 @@ obj-$(CONFIG_VIDEO_CAFE_CCIC) += cafe_ccic.o +cafe_ccic-y := cafe-driver.o mcam-core.o diff --git a/drivers/media/video/marvell-ccic/cafe-driver.c b/drivers/media/video/marvell-ccic/cafe-driver.c new file mode 100644 index 000000000000..3f38f2a0643f --- /dev/null +++ b/drivers/media/video/marvell-ccic/cafe-driver.c @@ -0,0 +1,570 @@ +/* + * A driver for the CMOS camera controller in the Marvell 88ALP01 "cafe" + * multifunction chip. Currently works with the Omnivision OV7670 + * sensor. + * + * The data sheet for this device can be found at: + * http://www.marvell.com/products/pc_connectivity/88alp01/ + * + * Copyright 2006-11 One Laptop Per Child Association, Inc. + * Copyright 2006-11 Jonathan Corbet + * + * Written by Jonathan Corbet, corbet@lwn.net. + * + * v4l2_device/v4l2_subdev conversion by: + * Copyright (C) 2009 Hans Verkuil + * + * Note: this conversion is untested! Please contact the linux-media + * mailinglist if you can test this, together with the test results. + * + * This file may be distributed under the terms of the GNU General + * Public License, version 2. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mcam-core.h" + +#define CAFE_VERSION 0x000002 + + +/* + * Parameters. + */ +MODULE_AUTHOR("Jonathan Corbet "); +MODULE_DESCRIPTION("Marvell 88ALP01 CMOS Camera Controller driver"); +MODULE_LICENSE("GPL"); +MODULE_SUPPORTED_DEVICE("Video"); + + + + +struct cafe_camera { + int registered; /* Fully initialized? */ + struct mcam_camera mcam; + struct pci_dev *pdev; + wait_queue_head_t smbus_wait; /* Waiting on i2c events */ +}; + +/* + * Debugging and related. + */ +#define cam_err(cam, fmt, arg...) \ + dev_err(&(cam)->pdev->dev, fmt, ##arg); +#define cam_warn(cam, fmt, arg...) \ + dev_warn(&(cam)->pdev->dev, fmt, ##arg); + +/* -------------------------------------------------------------------- */ +/* + * The I2C/SMBUS interface to the camera itself starts here. The + * controller handles SMBUS itself, presenting a relatively simple register + * interface; all we have to do is to tell it where to route the data. + */ +#define CAFE_SMBUS_TIMEOUT (HZ) /* generous */ + +static inline struct cafe_camera *to_cam(struct v4l2_device *dev) +{ + struct mcam_camera *m = container_of(dev, struct mcam_camera, v4l2_dev); + return container_of(m, struct cafe_camera, mcam); +} + + +static int cafe_smbus_write_done(struct mcam_camera *mcam) +{ + unsigned long flags; + int c1; + + /* + * We must delay after the interrupt, or the controller gets confused + * and never does give us good status. Fortunately, we don't do this + * often. + */ + udelay(20); + spin_lock_irqsave(&mcam->dev_lock, flags); + c1 = mcam_reg_read(mcam, REG_TWSIC1); + spin_unlock_irqrestore(&mcam->dev_lock, flags); + return (c1 & (TWSIC1_WSTAT|TWSIC1_ERROR)) != TWSIC1_WSTAT; +} + +static int cafe_smbus_write_data(struct cafe_camera *cam, + u16 addr, u8 command, u8 value) +{ + unsigned int rval; + unsigned long flags; + struct mcam_camera *mcam = &cam->mcam; + + spin_lock_irqsave(&mcam->dev_lock, flags); + rval = TWSIC0_EN | ((addr << TWSIC0_SID_SHIFT) & TWSIC0_SID); + rval |= TWSIC0_OVMAGIC; /* Make OV sensors work */ + /* + * Marvell sez set clkdiv to all 1's for now. + */ + rval |= TWSIC0_CLKDIV; + mcam_reg_write(mcam, REG_TWSIC0, rval); + (void) mcam_reg_read(mcam, REG_TWSIC1); /* force write */ + rval = value | ((command << TWSIC1_ADDR_SHIFT) & TWSIC1_ADDR); + mcam_reg_write(mcam, REG_TWSIC1, rval); + spin_unlock_irqrestore(&mcam->dev_lock, flags); + + /* Unfortunately, reading TWSIC1 too soon after sending a command + * causes the device to die. + * Use a busy-wait because we often send a large quantity of small + * commands at-once; using msleep() would cause a lot of context + * switches which take longer than 2ms, resulting in a noticeable + * boot-time and capture-start delays. + */ + mdelay(2); + + /* + * Another sad fact is that sometimes, commands silently complete but + * cafe_smbus_write_done() never becomes aware of this. + * This happens at random and appears to possible occur with any + * command. + * We don't understand why this is. We work around this issue + * with the timeout in the wait below, assuming that all commands + * complete within the timeout. + */ + wait_event_timeout(cam->smbus_wait, cafe_smbus_write_done(mcam), + CAFE_SMBUS_TIMEOUT); + + spin_lock_irqsave(&mcam->dev_lock, flags); + rval = mcam_reg_read(mcam, REG_TWSIC1); + spin_unlock_irqrestore(&mcam->dev_lock, flags); + + if (rval & TWSIC1_WSTAT) { + cam_err(cam, "SMBUS write (%02x/%02x/%02x) timed out\n", addr, + command, value); + return -EIO; + } + if (rval & TWSIC1_ERROR) { + cam_err(cam, "SMBUS write (%02x/%02x/%02x) error\n", addr, + command, value); + return -EIO; + } + return 0; +} + + + +static int cafe_smbus_read_done(struct mcam_camera *mcam) +{ + unsigned long flags; + int c1; + + /* + * We must delay after the interrupt, or the controller gets confused + * and never does give us good status. Fortunately, we don't do this + * often. + */ + udelay(20); + spin_lock_irqsave(&mcam->dev_lock, flags); + c1 = mcam_reg_read(mcam, REG_TWSIC1); + spin_unlock_irqrestore(&mcam->dev_lock, flags); + return c1 & (TWSIC1_RVALID|TWSIC1_ERROR); +} + + + +static int cafe_smbus_read_data(struct cafe_camera *cam, + u16 addr, u8 command, u8 *value) +{ + unsigned int rval; + unsigned long flags; + struct mcam_camera *mcam = &cam->mcam; + + spin_lock_irqsave(&mcam->dev_lock, flags); + rval = TWSIC0_EN | ((addr << TWSIC0_SID_SHIFT) & TWSIC0_SID); + rval |= TWSIC0_OVMAGIC; /* Make OV sensors work */ + /* + * Marvel sez set clkdiv to all 1's for now. + */ + rval |= TWSIC0_CLKDIV; + mcam_reg_write(mcam, REG_TWSIC0, rval); + (void) mcam_reg_read(mcam, REG_TWSIC1); /* force write */ + rval = TWSIC1_READ | ((command << TWSIC1_ADDR_SHIFT) & TWSIC1_ADDR); + mcam_reg_write(mcam, REG_TWSIC1, rval); + spin_unlock_irqrestore(&mcam->dev_lock, flags); + + wait_event_timeout(cam->smbus_wait, + cafe_smbus_read_done(mcam), CAFE_SMBUS_TIMEOUT); + spin_lock_irqsave(&mcam->dev_lock, flags); + rval = mcam_reg_read(mcam, REG_TWSIC1); + spin_unlock_irqrestore(&mcam->dev_lock, flags); + + if (rval & TWSIC1_ERROR) { + cam_err(cam, "SMBUS read (%02x/%02x) error\n", addr, command); + return -EIO; + } + if (!(rval & TWSIC1_RVALID)) { + cam_err(cam, "SMBUS read (%02x/%02x) timed out\n", addr, + command); + return -EIO; + } + *value = rval & 0xff; + return 0; +} + +/* + * Perform a transfer over SMBUS. This thing is called under + * the i2c bus lock, so we shouldn't race with ourselves... + */ +static int cafe_smbus_xfer(struct i2c_adapter *adapter, u16 addr, + unsigned short flags, char rw, u8 command, + int size, union i2c_smbus_data *data) +{ + struct cafe_camera *cam = i2c_get_adapdata(adapter); + int ret = -EINVAL; + + /* + * This interface would appear to only do byte data ops. OK + * it can do word too, but the cam chip has no use for that. + */ + if (size != I2C_SMBUS_BYTE_DATA) { + cam_err(cam, "funky xfer size %d\n", size); + return -EINVAL; + } + + if (rw == I2C_SMBUS_WRITE) + ret = cafe_smbus_write_data(cam, addr, command, data->byte); + else if (rw == I2C_SMBUS_READ) + ret = cafe_smbus_read_data(cam, addr, command, &data->byte); + return ret; +} + + +static void cafe_smbus_enable_irq(struct cafe_camera *cam) +{ + unsigned long flags; + + spin_lock_irqsave(&cam->mcam.dev_lock, flags); + mcam_reg_set_bit(&cam->mcam, REG_IRQMASK, TWSIIRQS); + spin_unlock_irqrestore(&cam->mcam.dev_lock, flags); +} + +static u32 cafe_smbus_func(struct i2c_adapter *adapter) +{ + return I2C_FUNC_SMBUS_READ_BYTE_DATA | + I2C_FUNC_SMBUS_WRITE_BYTE_DATA; +} + +static struct i2c_algorithm cafe_smbus_algo = { + .smbus_xfer = cafe_smbus_xfer, + .functionality = cafe_smbus_func +}; + +static int cafe_smbus_setup(struct cafe_camera *cam) +{ + struct i2c_adapter *adap = &cam->mcam.i2c_adapter; + int ret; + + cafe_smbus_enable_irq(cam); + adap->owner = THIS_MODULE; + adap->algo = &cafe_smbus_algo; + strcpy(adap->name, "cafe_ccic"); + adap->dev.parent = &cam->pdev->dev; + i2c_set_adapdata(adap, cam); + ret = i2c_add_adapter(adap); + if (ret) + printk(KERN_ERR "Unable to register cafe i2c adapter\n"); + return ret; +} + +static void cafe_smbus_shutdown(struct cafe_camera *cam) +{ + i2c_del_adapter(&cam->mcam.i2c_adapter); +} + + +/* + * Controller-level stuff + */ + +static void cafe_ctlr_init(struct mcam_camera *mcam) +{ + unsigned long flags; + + spin_lock_irqsave(&mcam->dev_lock, flags); + /* + * Added magic to bring up the hardware on the B-Test board + */ + mcam_reg_write(mcam, 0x3038, 0x8); + mcam_reg_write(mcam, 0x315c, 0x80008); + /* + * Go through the dance needed to wake the device up. + * Note that these registers are global and shared + * with the NAND and SD devices. Interaction between the + * three still needs to be examined. + */ + mcam_reg_write(mcam, REG_GL_CSR, GCSR_SRS|GCSR_MRS); /* Needed? */ + mcam_reg_write(mcam, REG_GL_CSR, GCSR_SRC|GCSR_MRC); + mcam_reg_write(mcam, REG_GL_CSR, GCSR_SRC|GCSR_MRS); + /* + * Here we must wait a bit for the controller to come around. + */ + spin_unlock_irqrestore(&mcam->dev_lock, flags); + msleep(5); + spin_lock_irqsave(&mcam->dev_lock, flags); + + mcam_reg_write(mcam, REG_GL_CSR, GCSR_CCIC_EN|GCSR_SRC|GCSR_MRC); + mcam_reg_set_bit(mcam, REG_GL_IMASK, GIMSK_CCIC_EN); + /* + * Mask all interrupts. + */ + mcam_reg_write(mcam, REG_IRQMASK, 0); + spin_unlock_irqrestore(&mcam->dev_lock, flags); +} + + +static void cafe_ctlr_power_up(struct mcam_camera *mcam) +{ + /* + * Part one of the sensor dance: turn the global + * GPIO signal on. + */ + mcam_reg_write(mcam, REG_GL_FCR, GFCR_GPIO_ON); + mcam_reg_write(mcam, REG_GL_GPIOR, GGPIO_OUT|GGPIO_VAL); + /* + * Put the sensor into operational mode (assumes OLPC-style + * wiring). Control 0 is reset - set to 1 to operate. + * Control 1 is power down, set to 0 to operate. + */ + mcam_reg_write(mcam, REG_GPR, GPR_C1EN|GPR_C0EN); /* pwr up, reset */ + mcam_reg_write(mcam, REG_GPR, GPR_C1EN|GPR_C0EN|GPR_C0); +} + +static void cafe_ctlr_power_down(struct mcam_camera *mcam) +{ + mcam_reg_write(mcam, REG_GPR, GPR_C1EN|GPR_C0EN|GPR_C1); + mcam_reg_write(mcam, REG_GL_FCR, GFCR_GPIO_ON); + mcam_reg_write(mcam, REG_GL_GPIOR, GGPIO_OUT); +} + + + +/* + * The platform interrupt handler. + */ +static irqreturn_t cafe_irq(int irq, void *data) +{ + struct cafe_camera *cam = data; + struct mcam_camera *mcam = &cam->mcam; + unsigned int irqs, handled; + + spin_lock(&mcam->dev_lock); + irqs = mcam_reg_read(mcam, REG_IRQSTAT); + handled = cam->registered && mccic_irq(mcam, irqs); + if (irqs & TWSIIRQS) { + mcam_reg_write(mcam, REG_IRQSTAT, TWSIIRQS); + wake_up(&cam->smbus_wait); + handled = 1; + } + spin_unlock(&mcam->dev_lock); + return IRQ_RETVAL(handled); +} + + +/* -------------------------------------------------------------------------- */ +/* + * PCI interface stuff. + */ + +static int cafe_pci_probe(struct pci_dev *pdev, + const struct pci_device_id *id) +{ + int ret; + struct cafe_camera *cam; + struct mcam_camera *mcam; + + /* + * Start putting together one of our big camera structures. + */ + ret = -ENOMEM; + cam = kzalloc(sizeof(struct cafe_camera), GFP_KERNEL); + if (cam == NULL) + goto out; + cam->pdev = pdev; + mcam = &cam->mcam; + mcam->chip_id = V4L2_IDENT_CAFE; + spin_lock_init(&mcam->dev_lock); + init_waitqueue_head(&cam->smbus_wait); + mcam->plat_power_up = cafe_ctlr_power_up; + mcam->plat_power_down = cafe_ctlr_power_down; + mcam->dev = &pdev->dev; + /* + * Get set up on the PCI bus. + */ + ret = pci_enable_device(pdev); + if (ret) + goto out_free; + pci_set_master(pdev); + + ret = -EIO; + mcam->regs = pci_iomap(pdev, 0, 0); + if (!mcam->regs) { + printk(KERN_ERR "Unable to ioremap cafe-ccic regs\n"); + goto out_disable; + } + ret = request_irq(pdev->irq, cafe_irq, IRQF_SHARED, "cafe-ccic", cam); + if (ret) + goto out_iounmap; + + /* + * Initialize the controller and leave it powered up. It will + * stay that way until the sensor driver shows up. + */ + cafe_ctlr_init(mcam); + cafe_ctlr_power_up(mcam); + /* + * Set up I2C/SMBUS communications. We have to drop the mutex here + * because the sensor could attach in this call chain, leading to + * unsightly deadlocks. + */ + ret = cafe_smbus_setup(cam); + if (ret) + goto out_pdown; + + ret = mccic_register(mcam); + if (ret == 0) { + cam->registered = 1; + return 0; + } + + cafe_smbus_shutdown(cam); +out_pdown: + cafe_ctlr_power_down(mcam); + free_irq(pdev->irq, cam); +out_iounmap: + pci_iounmap(pdev, mcam->regs); +out_disable: + pci_disable_device(pdev); +out_free: + kfree(cam); +out: + return ret; +} + + +/* + * Shut down an initialized device + */ +static void cafe_shutdown(struct cafe_camera *cam) +{ + mccic_shutdown(&cam->mcam); + cafe_smbus_shutdown(cam); + free_irq(cam->pdev->irq, cam); + pci_iounmap(cam->pdev, cam->mcam.regs); +} + + +static void cafe_pci_remove(struct pci_dev *pdev) +{ + struct v4l2_device *v4l2_dev = dev_get_drvdata(&pdev->dev); + struct cafe_camera *cam = to_cam(v4l2_dev); + + if (cam == NULL) { + printk(KERN_WARNING "pci_remove on unknown pdev %p\n", pdev); + return; + } + cafe_shutdown(cam); + kfree(cam); +} + + +#ifdef CONFIG_PM +/* + * Basic power management. + */ +static int cafe_pci_suspend(struct pci_dev *pdev, pm_message_t state) +{ + struct v4l2_device *v4l2_dev = dev_get_drvdata(&pdev->dev); + struct cafe_camera *cam = to_cam(v4l2_dev); + int ret; + + ret = pci_save_state(pdev); + if (ret) + return ret; + mccic_suspend(&cam->mcam); + pci_disable_device(pdev); + return 0; +} + + +static int cafe_pci_resume(struct pci_dev *pdev) +{ + struct v4l2_device *v4l2_dev = dev_get_drvdata(&pdev->dev); + struct cafe_camera *cam = to_cam(v4l2_dev); + int ret = 0; + + pci_restore_state(pdev); + ret = pci_enable_device(pdev); + + if (ret) { + cam_warn(cam, "Unable to re-enable device on resume!\n"); + return ret; + } + cafe_ctlr_init(&cam->mcam); + return mccic_resume(&cam->mcam); +} + +#endif /* CONFIG_PM */ + +static struct pci_device_id cafe_ids[] = { + { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, + PCI_DEVICE_ID_MARVELL_88ALP01_CCIC) }, + { 0, } +}; + +MODULE_DEVICE_TABLE(pci, cafe_ids); + +static struct pci_driver cafe_pci_driver = { + .name = "cafe1000-ccic", + .id_table = cafe_ids, + .probe = cafe_pci_probe, + .remove = cafe_pci_remove, +#ifdef CONFIG_PM + .suspend = cafe_pci_suspend, + .resume = cafe_pci_resume, +#endif +}; + + + + +static int __init cafe_init(void) +{ + int ret; + + printk(KERN_NOTICE "Marvell M88ALP01 'CAFE' Camera Controller version %d\n", + CAFE_VERSION); + ret = pci_register_driver(&cafe_pci_driver); + if (ret) { + printk(KERN_ERR "Unable to register cafe_ccic driver\n"); + goto out; + } + ret = 0; + +out: + return ret; +} + + +static void __exit cafe_exit(void) +{ + pci_unregister_driver(&cafe_pci_driver); +} + +module_init(cafe_init); +module_exit(cafe_exit); diff --git a/drivers/media/video/marvell-ccic/cafe_ccic-regs.h b/drivers/media/video/marvell-ccic/cafe_ccic-regs.h deleted file mode 100644 index 8e2a87cdc791..000000000000 --- a/drivers/media/video/marvell-ccic/cafe_ccic-regs.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Register definitions for the m88alp01 camera interface. Offsets in bytes - * as given in the spec. - * - * Copyright 2006 One Laptop Per Child Association, Inc. - * - * Written by Jonathan Corbet, corbet@lwn.net. - * - * This file may be distributed under the terms of the GNU General - * Public License, version 2. - */ -#define REG_Y0BAR 0x00 -#define REG_Y1BAR 0x04 -#define REG_Y2BAR 0x08 -/* ... */ - -#define REG_IMGPITCH 0x24 /* Image pitch register */ -#define IMGP_YP_SHFT 2 /* Y pitch params */ -#define IMGP_YP_MASK 0x00003ffc /* Y pitch field */ -#define IMGP_UVP_SHFT 18 /* UV pitch (planar) */ -#define IMGP_UVP_MASK 0x3ffc0000 -#define REG_IRQSTATRAW 0x28 /* RAW IRQ Status */ -#define IRQ_EOF0 0x00000001 /* End of frame 0 */ -#define IRQ_EOF1 0x00000002 /* End of frame 1 */ -#define IRQ_EOF2 0x00000004 /* End of frame 2 */ -#define IRQ_SOF0 0x00000008 /* Start of frame 0 */ -#define IRQ_SOF1 0x00000010 /* Start of frame 1 */ -#define IRQ_SOF2 0x00000020 /* Start of frame 2 */ -#define IRQ_OVERFLOW 0x00000040 /* FIFO overflow */ -#define IRQ_TWSIW 0x00010000 /* TWSI (smbus) write */ -#define IRQ_TWSIR 0x00020000 /* TWSI read */ -#define IRQ_TWSIE 0x00040000 /* TWSI error */ -#define TWSIIRQS (IRQ_TWSIW|IRQ_TWSIR|IRQ_TWSIE) -#define FRAMEIRQS (IRQ_EOF0|IRQ_EOF1|IRQ_EOF2|IRQ_SOF0|IRQ_SOF1|IRQ_SOF2) -#define ALLIRQS (TWSIIRQS|FRAMEIRQS|IRQ_OVERFLOW) -#define REG_IRQMASK 0x2c /* IRQ mask - same bits as IRQSTAT */ -#define REG_IRQSTAT 0x30 /* IRQ status / clear */ - -#define REG_IMGSIZE 0x34 /* Image size */ -#define IMGSZ_V_MASK 0x1fff0000 -#define IMGSZ_V_SHIFT 16 -#define IMGSZ_H_MASK 0x00003fff -#define REG_IMGOFFSET 0x38 /* IMage offset */ - -#define REG_CTRL0 0x3c /* Control 0 */ -#define C0_ENABLE 0x00000001 /* Makes the whole thing go */ - -/* Mask for all the format bits */ -#define C0_DF_MASK 0x00fffffc /* Bits 2-23 */ - -/* RGB ordering */ -#define C0_RGB4_RGBX 0x00000000 -#define C0_RGB4_XRGB 0x00000004 -#define C0_RGB4_BGRX 0x00000008 -#define C0_RGB4_XBGR 0x0000000c -#define C0_RGB5_RGGB 0x00000000 -#define C0_RGB5_GRBG 0x00000004 -#define C0_RGB5_GBRG 0x00000008 -#define C0_RGB5_BGGR 0x0000000c - -/* Spec has two fields for DIN and DOUT, but they must match, so - combine them here. */ -#define C0_DF_YUV 0x00000000 /* Data is YUV */ -#define C0_DF_RGB 0x000000a0 /* ... RGB */ -#define C0_DF_BAYER 0x00000140 /* ... Bayer */ -/* 8-8-8 must be missing from the below - ask */ -#define C0_RGBF_565 0x00000000 -#define C0_RGBF_444 0x00000800 -#define C0_RGB_BGR 0x00001000 /* Blue comes first */ -#define C0_YUV_PLANAR 0x00000000 /* YUV 422 planar format */ -#define C0_YUV_PACKED 0x00008000 /* YUV 422 packed */ -#define C0_YUV_420PL 0x0000a000 /* YUV 420 planar */ -/* Think that 420 packed must be 111 - ask */ -#define C0_YUVE_YUYV 0x00000000 /* Y1CbY0Cr */ -#define C0_YUVE_YVYU 0x00010000 /* Y1CrY0Cb */ -#define C0_YUVE_VYUY 0x00020000 /* CrY1CbY0 */ -#define C0_YUVE_UYVY 0x00030000 /* CbY1CrY0 */ -#define C0_YUVE_XYUV 0x00000000 /* 420: .YUV */ -#define C0_YUVE_XYVU 0x00010000 /* 420: .YVU */ -#define C0_YUVE_XUVY 0x00020000 /* 420: .UVY */ -#define C0_YUVE_XVUY 0x00030000 /* 420: .VUY */ -/* Bayer bits 18,19 if needed */ -#define C0_HPOL_LOW 0x01000000 /* HSYNC polarity active low */ -#define C0_VPOL_LOW 0x02000000 /* VSYNC polarity active low */ -#define C0_VCLK_LOW 0x04000000 /* VCLK on falling edge */ -#define C0_DOWNSCALE 0x08000000 /* Enable downscaler */ -#define C0_SIFM_MASK 0xc0000000 /* SIF mode bits */ -#define C0_SIF_HVSYNC 0x00000000 /* Use H/VSYNC */ -#define CO_SOF_NOSYNC 0x40000000 /* Use inband active signaling */ - - -#define REG_CTRL1 0x40 /* Control 1 */ -#define C1_444ALPHA 0x00f00000 /* Alpha field in RGB444 */ -#define C1_ALPHA_SHFT 20 -#define C1_DMAB32 0x00000000 /* 32-byte DMA burst */ -#define C1_DMAB16 0x02000000 /* 16-byte DMA burst */ -#define C1_DMAB64 0x04000000 /* 64-byte DMA burst */ -#define C1_DMAB_MASK 0x06000000 -#define C1_TWOBUFS 0x08000000 /* Use only two DMA buffers */ -#define C1_PWRDWN 0x10000000 /* Power down */ - -#define REG_CLKCTRL 0x88 /* Clock control */ -#define CLK_DIV_MASK 0x0000ffff /* Upper bits RW "reserved" */ - -#define REG_GPR 0xb4 /* General purpose register. This - controls inputs to the power and reset - pins on the OV7670 used with OLPC; - other deployments could differ. */ -#define GPR_C1EN 0x00000020 /* Pad 1 (power down) enable */ -#define GPR_C0EN 0x00000010 /* Pad 0 (reset) enable */ -#define GPR_C1 0x00000002 /* Control 1 value */ -/* - * Control 0 is wired to reset on OLPC machines. For ov7x sensors, - * it is active low, for 0v6x, instead, it's active high. What - * fun. - */ -#define GPR_C0 0x00000001 /* Control 0 value */ - -#define REG_TWSIC0 0xb8 /* TWSI (smbus) control 0 */ -#define TWSIC0_EN 0x00000001 /* TWSI enable */ -#define TWSIC0_MODE 0x00000002 /* 1 = 16-bit, 0 = 8-bit */ -#define TWSIC0_SID 0x000003fc /* Slave ID */ -#define TWSIC0_SID_SHIFT 2 -#define TWSIC0_CLKDIV 0x0007fc00 /* Clock divider */ -#define TWSIC0_MASKACK 0x00400000 /* Mask ack from sensor */ -#define TWSIC0_OVMAGIC 0x00800000 /* Make it work on OV sensors */ - -#define REG_TWSIC1 0xbc /* TWSI control 1 */ -#define TWSIC1_DATA 0x0000ffff /* Data to/from camchip */ -#define TWSIC1_ADDR 0x00ff0000 /* Address (register) */ -#define TWSIC1_ADDR_SHIFT 16 -#define TWSIC1_READ 0x01000000 /* Set for read op */ -#define TWSIC1_WSTAT 0x02000000 /* Write status */ -#define TWSIC1_RVALID 0x04000000 /* Read data valid */ -#define TWSIC1_ERROR 0x08000000 /* Something screwed up */ - - -#define REG_UBAR 0xc4 /* Upper base address register */ - -/* - * Here's the weird global control registers which are said to live - * way up here. - */ -#define REG_GL_CSR 0x3004 /* Control/status register */ -#define GCSR_SRS 0x00000001 /* SW Reset set */ -#define GCSR_SRC 0x00000002 /* SW Reset clear */ -#define GCSR_MRS 0x00000004 /* Master reset set */ -#define GCSR_MRC 0x00000008 /* HW Reset clear */ -#define GCSR_CCIC_EN 0x00004000 /* CCIC Clock enable */ -#define REG_GL_IMASK 0x300c /* Interrupt mask register */ -#define GIMSK_CCIC_EN 0x00000004 /* CCIC Interrupt enable */ - -#define REG_GL_FCR 0x3038 /* GPIO functional control register */ -#define GFCR_GPIO_ON 0x08 /* Camera GPIO enabled */ -#define REG_GL_GPIOR 0x315c /* GPIO register */ -#define GGPIO_OUT 0x80000 /* GPIO output */ -#define GGPIO_VAL 0x00008 /* Output pin value */ - -#define REG_LEN REG_GL_IMASK + 4 - - -/* - * Useful stuff that probably belongs somewhere global. - */ -#define VGA_WIDTH 640 -#define VGA_HEIGHT 480 diff --git a/drivers/media/video/marvell-ccic/cafe_ccic.c b/drivers/media/video/marvell-ccic/cafe_ccic.c deleted file mode 100644 index 809964ba0160..000000000000 --- a/drivers/media/video/marvell-ccic/cafe_ccic.c +++ /dev/null @@ -1,2267 +0,0 @@ -/* - * A driver for the CMOS camera controller in the Marvell 88ALP01 "cafe" - * multifunction chip. Currently works with the Omnivision OV7670 - * sensor. - * - * The data sheet for this device can be found at: - * http://www.marvell.com/products/pc_connectivity/88alp01/ - * - * Copyright 2006 One Laptop Per Child Association, Inc. - * Copyright 2006-7 Jonathan Corbet - * - * Written by Jonathan Corbet, corbet@lwn.net. - * - * v4l2_device/v4l2_subdev conversion by: - * Copyright (C) 2009 Hans Verkuil - * - * Note: this conversion is untested! Please contact the linux-media - * mailinglist if you can test this, together with the test results. - * - * This file may be distributed under the terms of the GNU General - * Public License, version 2. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "cafe_ccic-regs.h" - -#define CAFE_VERSION 0x000002 - - -/* - * Parameters. - */ -MODULE_AUTHOR("Jonathan Corbet "); -MODULE_DESCRIPTION("Marvell 88ALP01 CMOS Camera Controller driver"); -MODULE_LICENSE("GPL"); -MODULE_SUPPORTED_DEVICE("Video"); - -/* - * Internal DMA buffer management. Since the controller cannot do S/G I/O, - * we must have physically contiguous buffers to bring frames into. - * These parameters control how many buffers we use, whether we - * allocate them at load time (better chance of success, but nails down - * memory) or when somebody tries to use the camera (riskier), and, - * for load-time allocation, how big they should be. - * - * The controller can cycle through three buffers. We could use - * more by flipping pointers around, but it probably makes little - * sense. - */ - -#define MAX_DMA_BUFS 3 -static int alloc_bufs_at_read; -module_param(alloc_bufs_at_read, bool, 0444); -MODULE_PARM_DESC(alloc_bufs_at_read, - "Non-zero value causes DMA buffers to be allocated when the " - "video capture device is read, rather than at module load " - "time. This saves memory, but decreases the chances of " - "successfully getting those buffers."); - -static int n_dma_bufs = 3; -module_param(n_dma_bufs, uint, 0644); -MODULE_PARM_DESC(n_dma_bufs, - "The number of DMA buffers to allocate. Can be either two " - "(saves memory, makes timing tighter) or three."); - -static int dma_buf_size = VGA_WIDTH * VGA_HEIGHT * 2; /* Worst case */ -module_param(dma_buf_size, uint, 0444); -MODULE_PARM_DESC(dma_buf_size, - "The size of the allocated DMA buffers. If actual operating " - "parameters require larger buffers, an attempt to reallocate " - "will be made."); - -static int min_buffers = 1; -module_param(min_buffers, uint, 0644); -MODULE_PARM_DESC(min_buffers, - "The minimum number of streaming I/O buffers we are willing " - "to work with."); - -static int max_buffers = 10; -module_param(max_buffers, uint, 0644); -MODULE_PARM_DESC(max_buffers, - "The maximum number of streaming I/O buffers an application " - "will be allowed to allocate. These buffers are big and live " - "in vmalloc space."); - -static int flip; -module_param(flip, bool, 0444); -MODULE_PARM_DESC(flip, - "If set, the sensor will be instructed to flip the image " - "vertically."); - - -enum cafe_state { - S_NOTREADY, /* Not yet initialized */ - S_IDLE, /* Just hanging around */ - S_FLAKED, /* Some sort of problem */ - S_SINGLEREAD, /* In read() */ - S_SPECREAD, /* Speculative read (for future read()) */ - S_STREAMING /* Streaming data */ -}; - -/* - * Tracking of streaming I/O buffers. - */ -struct cafe_sio_buffer { - struct list_head list; - struct v4l2_buffer v4lbuf; - char *buffer; /* Where it lives in kernel space */ - int mapcount; - struct cafe_camera *cam; -}; - -/* - * A description of one of our devices. - * Locking: controlled by s_mutex. Certain fields, however, require - * the dev_lock spinlock; they are marked as such by comments. - * dev_lock is also required for access to device registers. - */ -struct cafe_camera -{ - struct v4l2_device v4l2_dev; - enum cafe_state state; - unsigned long flags; /* Buffer status, mainly (dev_lock) */ - int users; /* How many open FDs */ - struct file *owner; /* Who has data access (v4l2) */ - - /* - * Subsystem structures. - */ - struct pci_dev *pdev; - struct video_device vdev; - struct i2c_adapter i2c_adapter; - struct v4l2_subdev *sensor; - unsigned short sensor_addr; - - unsigned char __iomem *regs; - struct list_head dev_list; /* link to other devices */ - - /* DMA buffers */ - unsigned int nbufs; /* How many are alloc'd */ - int next_buf; /* Next to consume (dev_lock) */ - unsigned int dma_buf_size; /* allocated size */ - void *dma_bufs[MAX_DMA_BUFS]; /* Internal buffer addresses */ - dma_addr_t dma_handles[MAX_DMA_BUFS]; /* Buffer bus addresses */ - unsigned int specframes; /* Unconsumed spec frames (dev_lock) */ - unsigned int sequence; /* Frame sequence number */ - unsigned int buf_seq[MAX_DMA_BUFS]; /* Sequence for individual buffers */ - - /* Streaming buffers */ - unsigned int n_sbufs; /* How many we have */ - struct cafe_sio_buffer *sb_bufs; /* The array of housekeeping structs */ - struct list_head sb_avail; /* Available for data (we own) (dev_lock) */ - struct list_head sb_full; /* With data (user space owns) (dev_lock) */ - struct tasklet_struct s_tasklet; - - /* Current operating parameters */ - u32 sensor_type; /* Currently ov7670 only */ - struct v4l2_pix_format pix_format; - enum v4l2_mbus_pixelcode mbus_code; - - /* Locks */ - struct mutex s_mutex; /* Access to this structure */ - spinlock_t dev_lock; /* Access to device */ - - /* Misc */ - wait_queue_head_t smbus_wait; /* Waiting on i2c events */ - wait_queue_head_t iowait; /* Waiting on frame data */ -}; - -/* - * Status flags. Always manipulated with bit operations. - */ -#define CF_BUF0_VALID 0 /* Buffers valid - first three */ -#define CF_BUF1_VALID 1 -#define CF_BUF2_VALID 2 -#define CF_DMA_ACTIVE 3 /* A frame is incoming */ -#define CF_CONFIG_NEEDED 4 /* Must configure hardware */ - -#define sensor_call(cam, o, f, args...) \ - v4l2_subdev_call(cam->sensor, o, f, ##args) - -static inline struct cafe_camera *to_cam(struct v4l2_device *dev) -{ - return container_of(dev, struct cafe_camera, v4l2_dev); -} - -static struct cafe_format_struct { - __u8 *desc; - __u32 pixelformat; - int bpp; /* Bytes per pixel */ - enum v4l2_mbus_pixelcode mbus_code; -} cafe_formats[] = { - { - .desc = "YUYV 4:2:2", - .pixelformat = V4L2_PIX_FMT_YUYV, - .mbus_code = V4L2_MBUS_FMT_YUYV8_2X8, - .bpp = 2, - }, - { - .desc = "RGB 444", - .pixelformat = V4L2_PIX_FMT_RGB444, - .mbus_code = V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE, - .bpp = 2, - }, - { - .desc = "RGB 565", - .pixelformat = V4L2_PIX_FMT_RGB565, - .mbus_code = V4L2_MBUS_FMT_RGB565_2X8_LE, - .bpp = 2, - }, - { - .desc = "Raw RGB Bayer", - .pixelformat = V4L2_PIX_FMT_SBGGR8, - .mbus_code = V4L2_MBUS_FMT_SBGGR8_1X8, - .bpp = 1 - }, -}; -#define N_CAFE_FMTS ARRAY_SIZE(cafe_formats) - -static struct cafe_format_struct *cafe_find_format(u32 pixelformat) -{ - unsigned i; - - for (i = 0; i < N_CAFE_FMTS; i++) - if (cafe_formats[i].pixelformat == pixelformat) - return cafe_formats + i; - /* Not found? Then return the first format. */ - return cafe_formats; -} - -/* - * Start over with DMA buffers - dev_lock needed. - */ -static void cafe_reset_buffers(struct cafe_camera *cam) -{ - int i; - - cam->next_buf = -1; - for (i = 0; i < cam->nbufs; i++) - clear_bit(i, &cam->flags); - cam->specframes = 0; -} - -static inline int cafe_needs_config(struct cafe_camera *cam) -{ - return test_bit(CF_CONFIG_NEEDED, &cam->flags); -} - -static void cafe_set_config_needed(struct cafe_camera *cam, int needed) -{ - if (needed) - set_bit(CF_CONFIG_NEEDED, &cam->flags); - else - clear_bit(CF_CONFIG_NEEDED, &cam->flags); -} - - - - -/* - * Debugging and related. - */ -#define cam_err(cam, fmt, arg...) \ - dev_err(&(cam)->pdev->dev, fmt, ##arg); -#define cam_warn(cam, fmt, arg...) \ - dev_warn(&(cam)->pdev->dev, fmt, ##arg); -#define cam_dbg(cam, fmt, arg...) \ - dev_dbg(&(cam)->pdev->dev, fmt, ##arg); - - -/* ---------------------------------------------------------------------*/ - -/* - * Device register I/O - */ -static inline void cafe_reg_write(struct cafe_camera *cam, unsigned int reg, - unsigned int val) -{ - iowrite32(val, cam->regs + reg); -} - -static inline unsigned int cafe_reg_read(struct cafe_camera *cam, - unsigned int reg) -{ - return ioread32(cam->regs + reg); -} - - -static inline void cafe_reg_write_mask(struct cafe_camera *cam, unsigned int reg, - unsigned int val, unsigned int mask) -{ - unsigned int v = cafe_reg_read(cam, reg); - - v = (v & ~mask) | (val & mask); - cafe_reg_write(cam, reg, v); -} - -static inline void cafe_reg_clear_bit(struct cafe_camera *cam, - unsigned int reg, unsigned int val) -{ - cafe_reg_write_mask(cam, reg, 0, val); -} - -static inline void cafe_reg_set_bit(struct cafe_camera *cam, - unsigned int reg, unsigned int val) -{ - cafe_reg_write_mask(cam, reg, val, val); -} - - - -/* -------------------------------------------------------------------- */ -/* - * The I2C/SMBUS interface to the camera itself starts here. The - * controller handles SMBUS itself, presenting a relatively simple register - * interface; all we have to do is to tell it where to route the data. - */ -#define CAFE_SMBUS_TIMEOUT (HZ) /* generous */ - -static int cafe_smbus_write_done(struct cafe_camera *cam) -{ - unsigned long flags; - int c1; - - /* - * We must delay after the interrupt, or the controller gets confused - * and never does give us good status. Fortunately, we don't do this - * often. - */ - udelay(20); - spin_lock_irqsave(&cam->dev_lock, flags); - c1 = cafe_reg_read(cam, REG_TWSIC1); - spin_unlock_irqrestore(&cam->dev_lock, flags); - return (c1 & (TWSIC1_WSTAT|TWSIC1_ERROR)) != TWSIC1_WSTAT; -} - -static int cafe_smbus_write_data(struct cafe_camera *cam, - u16 addr, u8 command, u8 value) -{ - unsigned int rval; - unsigned long flags; - - spin_lock_irqsave(&cam->dev_lock, flags); - rval = TWSIC0_EN | ((addr << TWSIC0_SID_SHIFT) & TWSIC0_SID); - rval |= TWSIC0_OVMAGIC; /* Make OV sensors work */ - /* - * Marvell sez set clkdiv to all 1's for now. - */ - rval |= TWSIC0_CLKDIV; - cafe_reg_write(cam, REG_TWSIC0, rval); - (void) cafe_reg_read(cam, REG_TWSIC1); /* force write */ - rval = value | ((command << TWSIC1_ADDR_SHIFT) & TWSIC1_ADDR); - cafe_reg_write(cam, REG_TWSIC1, rval); - spin_unlock_irqrestore(&cam->dev_lock, flags); - - /* Unfortunately, reading TWSIC1 too soon after sending a command - * causes the device to die. - * Use a busy-wait because we often send a large quantity of small - * commands at-once; using msleep() would cause a lot of context - * switches which take longer than 2ms, resulting in a noticeable - * boot-time and capture-start delays. - */ - mdelay(2); - - /* - * Another sad fact is that sometimes, commands silently complete but - * cafe_smbus_write_done() never becomes aware of this. - * This happens at random and appears to possible occur with any - * command. - * We don't understand why this is. We work around this issue - * with the timeout in the wait below, assuming that all commands - * complete within the timeout. - */ - wait_event_timeout(cam->smbus_wait, cafe_smbus_write_done(cam), - CAFE_SMBUS_TIMEOUT); - - spin_lock_irqsave(&cam->dev_lock, flags); - rval = cafe_reg_read(cam, REG_TWSIC1); - spin_unlock_irqrestore(&cam->dev_lock, flags); - - if (rval & TWSIC1_WSTAT) { - cam_err(cam, "SMBUS write (%02x/%02x/%02x) timed out\n", addr, - command, value); - return -EIO; - } - if (rval & TWSIC1_ERROR) { - cam_err(cam, "SMBUS write (%02x/%02x/%02x) error\n", addr, - command, value); - return -EIO; - } - return 0; -} - - - -static int cafe_smbus_read_done(struct cafe_camera *cam) -{ - unsigned long flags; - int c1; - - /* - * We must delay after the interrupt, or the controller gets confused - * and never does give us good status. Fortunately, we don't do this - * often. - */ - udelay(20); - spin_lock_irqsave(&cam->dev_lock, flags); - c1 = cafe_reg_read(cam, REG_TWSIC1); - spin_unlock_irqrestore(&cam->dev_lock, flags); - return c1 & (TWSIC1_RVALID|TWSIC1_ERROR); -} - - - -static int cafe_smbus_read_data(struct cafe_camera *cam, - u16 addr, u8 command, u8 *value) -{ - unsigned int rval; - unsigned long flags; - - spin_lock_irqsave(&cam->dev_lock, flags); - rval = TWSIC0_EN | ((addr << TWSIC0_SID_SHIFT) & TWSIC0_SID); - rval |= TWSIC0_OVMAGIC; /* Make OV sensors work */ - /* - * Marvel sez set clkdiv to all 1's for now. - */ - rval |= TWSIC0_CLKDIV; - cafe_reg_write(cam, REG_TWSIC0, rval); - (void) cafe_reg_read(cam, REG_TWSIC1); /* force write */ - rval = TWSIC1_READ | ((command << TWSIC1_ADDR_SHIFT) & TWSIC1_ADDR); - cafe_reg_write(cam, REG_TWSIC1, rval); - spin_unlock_irqrestore(&cam->dev_lock, flags); - - wait_event_timeout(cam->smbus_wait, - cafe_smbus_read_done(cam), CAFE_SMBUS_TIMEOUT); - spin_lock_irqsave(&cam->dev_lock, flags); - rval = cafe_reg_read(cam, REG_TWSIC1); - spin_unlock_irqrestore(&cam->dev_lock, flags); - - if (rval & TWSIC1_ERROR) { - cam_err(cam, "SMBUS read (%02x/%02x) error\n", addr, command); - return -EIO; - } - if (! (rval & TWSIC1_RVALID)) { - cam_err(cam, "SMBUS read (%02x/%02x) timed out\n", addr, - command); - return -EIO; - } - *value = rval & 0xff; - return 0; -} - -/* - * Perform a transfer over SMBUS. This thing is called under - * the i2c bus lock, so we shouldn't race with ourselves... - */ -static int cafe_smbus_xfer(struct i2c_adapter *adapter, u16 addr, - unsigned short flags, char rw, u8 command, - int size, union i2c_smbus_data *data) -{ - struct v4l2_device *v4l2_dev = i2c_get_adapdata(adapter); - struct cafe_camera *cam = to_cam(v4l2_dev); - int ret = -EINVAL; - - /* - * This interface would appear to only do byte data ops. OK - * it can do word too, but the cam chip has no use for that. - */ - if (size != I2C_SMBUS_BYTE_DATA) { - cam_err(cam, "funky xfer size %d\n", size); - return -EINVAL; - } - - if (rw == I2C_SMBUS_WRITE) - ret = cafe_smbus_write_data(cam, addr, command, data->byte); - else if (rw == I2C_SMBUS_READ) - ret = cafe_smbus_read_data(cam, addr, command, &data->byte); - return ret; -} - - -static void cafe_smbus_enable_irq(struct cafe_camera *cam) -{ - unsigned long flags; - - spin_lock_irqsave(&cam->dev_lock, flags); - cafe_reg_set_bit(cam, REG_IRQMASK, TWSIIRQS); - spin_unlock_irqrestore(&cam->dev_lock, flags); -} - -static u32 cafe_smbus_func(struct i2c_adapter *adapter) -{ - return I2C_FUNC_SMBUS_READ_BYTE_DATA | - I2C_FUNC_SMBUS_WRITE_BYTE_DATA; -} - -static struct i2c_algorithm cafe_smbus_algo = { - .smbus_xfer = cafe_smbus_xfer, - .functionality = cafe_smbus_func -}; - -/* Somebody is on the bus */ -static void cafe_ctlr_stop_dma(struct cafe_camera *cam); -static void cafe_ctlr_power_down(struct cafe_camera *cam); - -static int cafe_smbus_setup(struct cafe_camera *cam) -{ - struct i2c_adapter *adap = &cam->i2c_adapter; - int ret; - - cafe_smbus_enable_irq(cam); - adap->owner = THIS_MODULE; - adap->algo = &cafe_smbus_algo; - strcpy(adap->name, "cafe_ccic"); - adap->dev.parent = &cam->pdev->dev; - i2c_set_adapdata(adap, &cam->v4l2_dev); - ret = i2c_add_adapter(adap); - if (ret) - printk(KERN_ERR "Unable to register cafe i2c adapter\n"); - return ret; -} - -static void cafe_smbus_shutdown(struct cafe_camera *cam) -{ - i2c_del_adapter(&cam->i2c_adapter); -} - - -/* ------------------------------------------------------------------- */ -/* - * Deal with the controller. - */ - -/* - * Do everything we think we need to have the interface operating - * according to the desired format. - */ -static void cafe_ctlr_dma(struct cafe_camera *cam) -{ - /* - * Store the first two Y buffers (we aren't supporting - * planar formats for now, so no UV bufs). Then either - * set the third if it exists, or tell the controller - * to just use two. - */ - cafe_reg_write(cam, REG_Y0BAR, cam->dma_handles[0]); - cafe_reg_write(cam, REG_Y1BAR, cam->dma_handles[1]); - if (cam->nbufs > 2) { - cafe_reg_write(cam, REG_Y2BAR, cam->dma_handles[2]); - cafe_reg_clear_bit(cam, REG_CTRL1, C1_TWOBUFS); - } - else - cafe_reg_set_bit(cam, REG_CTRL1, C1_TWOBUFS); - cafe_reg_write(cam, REG_UBAR, 0); /* 32 bits only for now */ -} - -static void cafe_ctlr_image(struct cafe_camera *cam) -{ - int imgsz; - struct v4l2_pix_format *fmt = &cam->pix_format; - - imgsz = ((fmt->height << IMGSZ_V_SHIFT) & IMGSZ_V_MASK) | - (fmt->bytesperline & IMGSZ_H_MASK); - cafe_reg_write(cam, REG_IMGSIZE, imgsz); - cafe_reg_write(cam, REG_IMGOFFSET, 0); - /* YPITCH just drops the last two bits */ - cafe_reg_write_mask(cam, REG_IMGPITCH, fmt->bytesperline, - IMGP_YP_MASK); - /* - * Tell the controller about the image format we are using. - */ - switch (cam->pix_format.pixelformat) { - case V4L2_PIX_FMT_YUYV: - cafe_reg_write_mask(cam, REG_CTRL0, - C0_DF_YUV|C0_YUV_PACKED|C0_YUVE_YUYV, - C0_DF_MASK); - break; - - case V4L2_PIX_FMT_RGB444: - cafe_reg_write_mask(cam, REG_CTRL0, - C0_DF_RGB|C0_RGBF_444|C0_RGB4_XRGB, - C0_DF_MASK); - /* Alpha value? */ - break; - - case V4L2_PIX_FMT_RGB565: - cafe_reg_write_mask(cam, REG_CTRL0, - C0_DF_RGB|C0_RGBF_565|C0_RGB5_BGGR, - C0_DF_MASK); - break; - - default: - cam_err(cam, "Unknown format %x\n", cam->pix_format.pixelformat); - break; - } - /* - * Make sure it knows we want to use hsync/vsync. - */ - cafe_reg_write_mask(cam, REG_CTRL0, C0_SIF_HVSYNC, - C0_SIFM_MASK); -} - - -/* - * Configure the controller for operation; caller holds the - * device mutex. - */ -static int cafe_ctlr_configure(struct cafe_camera *cam) -{ - unsigned long flags; - - spin_lock_irqsave(&cam->dev_lock, flags); - cafe_ctlr_dma(cam); - cafe_ctlr_image(cam); - cafe_set_config_needed(cam, 0); - spin_unlock_irqrestore(&cam->dev_lock, flags); - return 0; -} - -static void cafe_ctlr_irq_enable(struct cafe_camera *cam) -{ - /* - * Clear any pending interrupts, since we do not - * expect to have I/O active prior to enabling. - */ - cafe_reg_write(cam, REG_IRQSTAT, FRAMEIRQS); - cafe_reg_set_bit(cam, REG_IRQMASK, FRAMEIRQS); -} - -static void cafe_ctlr_irq_disable(struct cafe_camera *cam) -{ - cafe_reg_clear_bit(cam, REG_IRQMASK, FRAMEIRQS); -} - -/* - * Make the controller start grabbing images. Everything must - * be set up before doing this. - */ -static void cafe_ctlr_start(struct cafe_camera *cam) -{ - /* set_bit performs a read, so no other barrier should be - needed here */ - cafe_reg_set_bit(cam, REG_CTRL0, C0_ENABLE); -} - -static void cafe_ctlr_stop(struct cafe_camera *cam) -{ - cafe_reg_clear_bit(cam, REG_CTRL0, C0_ENABLE); -} - -static void cafe_ctlr_init(struct cafe_camera *cam) -{ - unsigned long flags; - - spin_lock_irqsave(&cam->dev_lock, flags); - /* - * Added magic to bring up the hardware on the B-Test board - */ - cafe_reg_write(cam, 0x3038, 0x8); - cafe_reg_write(cam, 0x315c, 0x80008); - /* - * Go through the dance needed to wake the device up. - * Note that these registers are global and shared - * with the NAND and SD devices. Interaction between the - * three still needs to be examined. - */ - cafe_reg_write(cam, REG_GL_CSR, GCSR_SRS|GCSR_MRS); /* Needed? */ - cafe_reg_write(cam, REG_GL_CSR, GCSR_SRC|GCSR_MRC); - cafe_reg_write(cam, REG_GL_CSR, GCSR_SRC|GCSR_MRS); - /* - * Here we must wait a bit for the controller to come around. - */ - spin_unlock_irqrestore(&cam->dev_lock, flags); - msleep(5); - spin_lock_irqsave(&cam->dev_lock, flags); - - cafe_reg_write(cam, REG_GL_CSR, GCSR_CCIC_EN|GCSR_SRC|GCSR_MRC); - cafe_reg_set_bit(cam, REG_GL_IMASK, GIMSK_CCIC_EN); - /* - * Make sure it's not powered down. - */ - cafe_reg_clear_bit(cam, REG_CTRL1, C1_PWRDWN); - /* - * Turn off the enable bit. It sure should be off anyway, - * but it's good to be sure. - */ - cafe_reg_clear_bit(cam, REG_CTRL0, C0_ENABLE); - /* - * Mask all interrupts. - */ - cafe_reg_write(cam, REG_IRQMASK, 0); - /* - * Clock the sensor appropriately. Controller clock should - * be 48MHz, sensor "typical" value is half that. - */ - cafe_reg_write_mask(cam, REG_CLKCTRL, 2, CLK_DIV_MASK); - spin_unlock_irqrestore(&cam->dev_lock, flags); -} - - -/* - * Stop the controller, and don't return until we're really sure that no - * further DMA is going on. - */ -static void cafe_ctlr_stop_dma(struct cafe_camera *cam) -{ - unsigned long flags; - - /* - * Theory: stop the camera controller (whether it is operating - * or not). Delay briefly just in case we race with the SOF - * interrupt, then wait until no DMA is active. - */ - spin_lock_irqsave(&cam->dev_lock, flags); - cafe_ctlr_stop(cam); - spin_unlock_irqrestore(&cam->dev_lock, flags); - mdelay(1); - wait_event_timeout(cam->iowait, - !test_bit(CF_DMA_ACTIVE, &cam->flags), HZ); - if (test_bit(CF_DMA_ACTIVE, &cam->flags)) - cam_err(cam, "Timeout waiting for DMA to end\n"); - /* This would be bad news - what now? */ - spin_lock_irqsave(&cam->dev_lock, flags); - cam->state = S_IDLE; - cafe_ctlr_irq_disable(cam); - spin_unlock_irqrestore(&cam->dev_lock, flags); -} - -/* - * Power up and down. - */ -static void cafe_ctlr_power_up(struct cafe_camera *cam) -{ - unsigned long flags; - - spin_lock_irqsave(&cam->dev_lock, flags); - cafe_reg_clear_bit(cam, REG_CTRL1, C1_PWRDWN); - /* - * Part one of the sensor dance: turn the global - * GPIO signal on. - */ - cafe_reg_write(cam, REG_GL_FCR, GFCR_GPIO_ON); - cafe_reg_write(cam, REG_GL_GPIOR, GGPIO_OUT|GGPIO_VAL); - /* - * Put the sensor into operational mode (assumes OLPC-style - * wiring). Control 0 is reset - set to 1 to operate. - * Control 1 is power down, set to 0 to operate. - */ - cafe_reg_write(cam, REG_GPR, GPR_C1EN|GPR_C0EN); /* pwr up, reset */ -/* mdelay(1); */ /* Marvell says 1ms will do it */ - cafe_reg_write(cam, REG_GPR, GPR_C1EN|GPR_C0EN|GPR_C0); -/* mdelay(1); */ /* Enough? */ - spin_unlock_irqrestore(&cam->dev_lock, flags); - msleep(5); /* Just to be sure */ -} - -static void cafe_ctlr_power_down(struct cafe_camera *cam) -{ - unsigned long flags; - - spin_lock_irqsave(&cam->dev_lock, flags); - cafe_reg_write(cam, REG_GPR, GPR_C1EN|GPR_C0EN|GPR_C1); - cafe_reg_write(cam, REG_GL_FCR, GFCR_GPIO_ON); - cafe_reg_write(cam, REG_GL_GPIOR, GGPIO_OUT); - cafe_reg_set_bit(cam, REG_CTRL1, C1_PWRDWN); - spin_unlock_irqrestore(&cam->dev_lock, flags); -} - -/* -------------------------------------------------------------------- */ -/* - * Communications with the sensor. - */ - -static int __cafe_cam_reset(struct cafe_camera *cam) -{ - return sensor_call(cam, core, reset, 0); -} - -/* - * We have found the sensor on the i2c. Let's try to have a - * conversation. - */ -static int cafe_cam_init(struct cafe_camera *cam) -{ - struct v4l2_dbg_chip_ident chip; - int ret; - - mutex_lock(&cam->s_mutex); - if (cam->state != S_NOTREADY) - cam_warn(cam, "Cam init with device in funky state %d", - cam->state); - ret = __cafe_cam_reset(cam); - if (ret) - goto out; - chip.ident = V4L2_IDENT_NONE; - chip.match.type = V4L2_CHIP_MATCH_I2C_ADDR; - chip.match.addr = cam->sensor_addr; - ret = sensor_call(cam, core, g_chip_ident, &chip); - if (ret) - goto out; - cam->sensor_type = chip.ident; - if (cam->sensor_type != V4L2_IDENT_OV7670) { - cam_err(cam, "Unsupported sensor type 0x%x", cam->sensor_type); - ret = -EINVAL; - goto out; - } -/* Get/set parameters? */ - ret = 0; - cam->state = S_IDLE; - out: - cafe_ctlr_power_down(cam); - mutex_unlock(&cam->s_mutex); - return ret; -} - -/* - * Configure the sensor to match the parameters we have. Caller should - * hold s_mutex - */ -static int cafe_cam_set_flip(struct cafe_camera *cam) -{ - struct v4l2_control ctrl; - - memset(&ctrl, 0, sizeof(ctrl)); - ctrl.id = V4L2_CID_VFLIP; - ctrl.value = flip; - return sensor_call(cam, core, s_ctrl, &ctrl); -} - - -static int cafe_cam_configure(struct cafe_camera *cam) -{ - struct v4l2_mbus_framefmt mbus_fmt; - int ret; - - v4l2_fill_mbus_format(&mbus_fmt, &cam->pix_format, cam->mbus_code); - ret = sensor_call(cam, core, init, 0); - if (ret == 0) - ret = sensor_call(cam, video, s_mbus_fmt, &mbus_fmt); - /* - * OV7670 does weird things if flip is set *before* format... - */ - ret += cafe_cam_set_flip(cam); - return ret; -} - -/* -------------------------------------------------------------------- */ -/* - * DMA buffer management. These functions need s_mutex held. - */ - -/* FIXME: this is inefficient as hell, since dma_alloc_coherent just - * does a get_free_pages() call, and we waste a good chunk of an orderN - * allocation. Should try to allocate the whole set in one chunk. - */ -static int cafe_alloc_dma_bufs(struct cafe_camera *cam, int loadtime) -{ - int i; - - cafe_set_config_needed(cam, 1); - if (loadtime) - cam->dma_buf_size = dma_buf_size; - else - cam->dma_buf_size = cam->pix_format.sizeimage; - if (n_dma_bufs > 3) - n_dma_bufs = 3; - - cam->nbufs = 0; - for (i = 0; i < n_dma_bufs; i++) { - cam->dma_bufs[i] = dma_alloc_coherent(&cam->pdev->dev, - cam->dma_buf_size, cam->dma_handles + i, - GFP_KERNEL); - if (cam->dma_bufs[i] == NULL) { - cam_warn(cam, "Failed to allocate DMA buffer\n"); - break; - } - /* For debug, remove eventually */ - memset(cam->dma_bufs[i], 0xcc, cam->dma_buf_size); - (cam->nbufs)++; - } - - switch (cam->nbufs) { - case 1: - dma_free_coherent(&cam->pdev->dev, cam->dma_buf_size, - cam->dma_bufs[0], cam->dma_handles[0]); - cam->nbufs = 0; - case 0: - cam_err(cam, "Insufficient DMA buffers, cannot operate\n"); - return -ENOMEM; - - case 2: - if (n_dma_bufs > 2) - cam_warn(cam, "Will limp along with only 2 buffers\n"); - break; - } - return 0; -} - -static void cafe_free_dma_bufs(struct cafe_camera *cam) -{ - int i; - - for (i = 0; i < cam->nbufs; i++) { - dma_free_coherent(&cam->pdev->dev, cam->dma_buf_size, - cam->dma_bufs[i], cam->dma_handles[i]); - cam->dma_bufs[i] = NULL; - } - cam->nbufs = 0; -} - - - - - -/* ----------------------------------------------------------------------- */ -/* - * Here starts the V4L2 interface code. - */ - -/* - * Read an image from the device. - */ -static ssize_t cafe_deliver_buffer(struct cafe_camera *cam, - char __user *buffer, size_t len, loff_t *pos) -{ - int bufno; - unsigned long flags; - - spin_lock_irqsave(&cam->dev_lock, flags); - if (cam->next_buf < 0) { - cam_err(cam, "deliver_buffer: No next buffer\n"); - spin_unlock_irqrestore(&cam->dev_lock, flags); - return -EIO; - } - bufno = cam->next_buf; - clear_bit(bufno, &cam->flags); - if (++(cam->next_buf) >= cam->nbufs) - cam->next_buf = 0; - if (! test_bit(cam->next_buf, &cam->flags)) - cam->next_buf = -1; - cam->specframes = 0; - spin_unlock_irqrestore(&cam->dev_lock, flags); - - if (len > cam->pix_format.sizeimage) - len = cam->pix_format.sizeimage; - if (copy_to_user(buffer, cam->dma_bufs[bufno], len)) - return -EFAULT; - (*pos) += len; - return len; -} - -/* - * Get everything ready, and start grabbing frames. - */ -static int cafe_read_setup(struct cafe_camera *cam, enum cafe_state state) -{ - int ret; - unsigned long flags; - - /* - * Configuration. If we still don't have DMA buffers, - * make one last, desperate attempt. - */ - if (cam->nbufs == 0) - if (cafe_alloc_dma_bufs(cam, 0)) - return -ENOMEM; - - if (cafe_needs_config(cam)) { - cafe_cam_configure(cam); - ret = cafe_ctlr_configure(cam); - if (ret) - return ret; - } - - /* - * Turn it loose. - */ - spin_lock_irqsave(&cam->dev_lock, flags); - cafe_reset_buffers(cam); - cafe_ctlr_irq_enable(cam); - cam->state = state; - cafe_ctlr_start(cam); - spin_unlock_irqrestore(&cam->dev_lock, flags); - return 0; -} - - -static ssize_t cafe_v4l_read(struct file *filp, - char __user *buffer, size_t len, loff_t *pos) -{ - struct cafe_camera *cam = filp->private_data; - int ret = 0; - - /* - * Perhaps we're in speculative read mode and already - * have data? - */ - mutex_lock(&cam->s_mutex); - if (cam->state == S_SPECREAD) { - if (cam->next_buf >= 0) { - ret = cafe_deliver_buffer(cam, buffer, len, pos); - if (ret != 0) - goto out_unlock; - } - } else if (cam->state == S_FLAKED || cam->state == S_NOTREADY) { - ret = -EIO; - goto out_unlock; - } else if (cam->state != S_IDLE) { - ret = -EBUSY; - goto out_unlock; - } - - /* - * v4l2: multiple processes can open the device, but only - * one gets to grab data from it. - */ - if (cam->owner && cam->owner != filp) { - ret = -EBUSY; - goto out_unlock; - } - cam->owner = filp; - - /* - * Do setup if need be. - */ - if (cam->state != S_SPECREAD) { - ret = cafe_read_setup(cam, S_SINGLEREAD); - if (ret) - goto out_unlock; - } - /* - * Wait for something to happen. This should probably - * be interruptible (FIXME). - */ - wait_event_timeout(cam->iowait, cam->next_buf >= 0, HZ); - if (cam->next_buf < 0) { - cam_err(cam, "read() operation timed out\n"); - cafe_ctlr_stop_dma(cam); - ret = -EIO; - goto out_unlock; - } - /* - * Give them their data and we should be done. - */ - ret = cafe_deliver_buffer(cam, buffer, len, pos); - - out_unlock: - mutex_unlock(&cam->s_mutex); - return ret; -} - - - - - - - - -/* - * Streaming I/O support. - */ - - - -static int cafe_vidioc_streamon(struct file *filp, void *priv, - enum v4l2_buf_type type) -{ - struct cafe_camera *cam = filp->private_data; - int ret = -EINVAL; - - if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) - goto out; - mutex_lock(&cam->s_mutex); - if (cam->state != S_IDLE || cam->n_sbufs == 0) - goto out_unlock; - - cam->sequence = 0; - ret = cafe_read_setup(cam, S_STREAMING); - - out_unlock: - mutex_unlock(&cam->s_mutex); - out: - return ret; -} - - -static int cafe_vidioc_streamoff(struct file *filp, void *priv, - enum v4l2_buf_type type) -{ - struct cafe_camera *cam = filp->private_data; - int ret = -EINVAL; - - if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) - goto out; - mutex_lock(&cam->s_mutex); - if (cam->state != S_STREAMING) - goto out_unlock; - - cafe_ctlr_stop_dma(cam); - ret = 0; - - out_unlock: - mutex_unlock(&cam->s_mutex); - out: - return ret; -} - - - -static int cafe_setup_siobuf(struct cafe_camera *cam, int index) -{ - struct cafe_sio_buffer *buf = cam->sb_bufs + index; - - INIT_LIST_HEAD(&buf->list); - buf->v4lbuf.length = PAGE_ALIGN(cam->pix_format.sizeimage); - buf->buffer = vmalloc_user(buf->v4lbuf.length); - if (buf->buffer == NULL) - return -ENOMEM; - buf->mapcount = 0; - buf->cam = cam; - - buf->v4lbuf.index = index; - buf->v4lbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - buf->v4lbuf.field = V4L2_FIELD_NONE; - buf->v4lbuf.memory = V4L2_MEMORY_MMAP; - /* - * Offset: must be 32-bit even on a 64-bit system. videobuf-dma-sg - * just uses the length times the index, but the spec warns - * against doing just that - vma merging problems. So we - * leave a gap between each pair of buffers. - */ - buf->v4lbuf.m.offset = 2*index*buf->v4lbuf.length; - return 0; -} - -static int cafe_free_sio_buffers(struct cafe_camera *cam) -{ - int i; - - /* - * If any buffers are mapped, we cannot free them at all. - */ - for (i = 0; i < cam->n_sbufs; i++) - if (cam->sb_bufs[i].mapcount > 0) - return -EBUSY; - /* - * OK, let's do it. - */ - for (i = 0; i < cam->n_sbufs; i++) - vfree(cam->sb_bufs[i].buffer); - cam->n_sbufs = 0; - kfree(cam->sb_bufs); - cam->sb_bufs = NULL; - INIT_LIST_HEAD(&cam->sb_avail); - INIT_LIST_HEAD(&cam->sb_full); - return 0; -} - - - -static int cafe_vidioc_reqbufs(struct file *filp, void *priv, - struct v4l2_requestbuffers *req) -{ - struct cafe_camera *cam = filp->private_data; - int ret = 0; /* Silence warning */ - - /* - * Make sure it's something we can do. User pointers could be - * implemented without great pain, but that's not been done yet. - */ - if (req->memory != V4L2_MEMORY_MMAP) - return -EINVAL; - /* - * If they ask for zero buffers, they really want us to stop streaming - * (if it's happening) and free everything. Should we check owner? - */ - mutex_lock(&cam->s_mutex); - if (req->count == 0) { - if (cam->state == S_STREAMING) - cafe_ctlr_stop_dma(cam); - ret = cafe_free_sio_buffers (cam); - goto out; - } - /* - * Device needs to be idle and working. We *could* try to do the - * right thing in S_SPECREAD by shutting things down, but it - * probably doesn't matter. - */ - if (cam->state != S_IDLE || (cam->owner && cam->owner != filp)) { - ret = -EBUSY; - goto out; - } - cam->owner = filp; - - if (req->count < min_buffers) - req->count = min_buffers; - else if (req->count > max_buffers) - req->count = max_buffers; - if (cam->n_sbufs > 0) { - ret = cafe_free_sio_buffers(cam); - if (ret) - goto out; - } - - cam->sb_bufs = kzalloc(req->count*sizeof(struct cafe_sio_buffer), - GFP_KERNEL); - if (cam->sb_bufs == NULL) { - ret = -ENOMEM; - goto out; - } - for (cam->n_sbufs = 0; cam->n_sbufs < req->count; (cam->n_sbufs++)) { - ret = cafe_setup_siobuf(cam, cam->n_sbufs); - if (ret) - break; - } - - if (cam->n_sbufs == 0) /* no luck at all - ret already set */ - kfree(cam->sb_bufs); - req->count = cam->n_sbufs; /* In case of partial success */ - - out: - mutex_unlock(&cam->s_mutex); - return ret; -} - - -static int cafe_vidioc_querybuf(struct file *filp, void *priv, - struct v4l2_buffer *buf) -{ - struct cafe_camera *cam = filp->private_data; - int ret = -EINVAL; - - mutex_lock(&cam->s_mutex); - if (buf->index >= cam->n_sbufs) - goto out; - *buf = cam->sb_bufs[buf->index].v4lbuf; - ret = 0; - out: - mutex_unlock(&cam->s_mutex); - return ret; -} - -static int cafe_vidioc_qbuf(struct file *filp, void *priv, - struct v4l2_buffer *buf) -{ - struct cafe_camera *cam = filp->private_data; - struct cafe_sio_buffer *sbuf; - int ret = -EINVAL; - unsigned long flags; - - mutex_lock(&cam->s_mutex); - if (buf->index >= cam->n_sbufs) - goto out; - sbuf = cam->sb_bufs + buf->index; - if (sbuf->v4lbuf.flags & V4L2_BUF_FLAG_QUEUED) { - ret = 0; /* Already queued?? */ - goto out; - } - if (sbuf->v4lbuf.flags & V4L2_BUF_FLAG_DONE) { - /* Spec doesn't say anything, seems appropriate tho */ - ret = -EBUSY; - goto out; - } - sbuf->v4lbuf.flags |= V4L2_BUF_FLAG_QUEUED; - spin_lock_irqsave(&cam->dev_lock, flags); - list_add(&sbuf->list, &cam->sb_avail); - spin_unlock_irqrestore(&cam->dev_lock, flags); - ret = 0; - out: - mutex_unlock(&cam->s_mutex); - return ret; -} - -static int cafe_vidioc_dqbuf(struct file *filp, void *priv, - struct v4l2_buffer *buf) -{ - struct cafe_camera *cam = filp->private_data; - struct cafe_sio_buffer *sbuf; - int ret = -EINVAL; - unsigned long flags; - - mutex_lock(&cam->s_mutex); - if (cam->state != S_STREAMING) - goto out_unlock; - if (list_empty(&cam->sb_full) && filp->f_flags & O_NONBLOCK) { - ret = -EAGAIN; - goto out_unlock; - } - - while (list_empty(&cam->sb_full) && cam->state == S_STREAMING) { - mutex_unlock(&cam->s_mutex); - if (wait_event_interruptible(cam->iowait, - !list_empty(&cam->sb_full))) { - ret = -ERESTARTSYS; - goto out; - } - mutex_lock(&cam->s_mutex); - } - - if (cam->state != S_STREAMING) - ret = -EINTR; - else { - spin_lock_irqsave(&cam->dev_lock, flags); - /* Should probably recheck !list_empty() here */ - sbuf = list_entry(cam->sb_full.next, - struct cafe_sio_buffer, list); - list_del_init(&sbuf->list); - spin_unlock_irqrestore(&cam->dev_lock, flags); - sbuf->v4lbuf.flags &= ~V4L2_BUF_FLAG_DONE; - *buf = sbuf->v4lbuf; - ret = 0; - } - - out_unlock: - mutex_unlock(&cam->s_mutex); - out: - return ret; -} - - - -static void cafe_v4l_vm_open(struct vm_area_struct *vma) -{ - struct cafe_sio_buffer *sbuf = vma->vm_private_data; - /* - * Locking: done under mmap_sem, so we don't need to - * go back to the camera lock here. - */ - sbuf->mapcount++; -} - - -static void cafe_v4l_vm_close(struct vm_area_struct *vma) -{ - struct cafe_sio_buffer *sbuf = vma->vm_private_data; - - mutex_lock(&sbuf->cam->s_mutex); - sbuf->mapcount--; - /* Docs say we should stop I/O too... */ - if (sbuf->mapcount == 0) - sbuf->v4lbuf.flags &= ~V4L2_BUF_FLAG_MAPPED; - mutex_unlock(&sbuf->cam->s_mutex); -} - -static const struct vm_operations_struct cafe_v4l_vm_ops = { - .open = cafe_v4l_vm_open, - .close = cafe_v4l_vm_close -}; - - -static int cafe_v4l_mmap(struct file *filp, struct vm_area_struct *vma) -{ - struct cafe_camera *cam = filp->private_data; - unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; - int ret = -EINVAL; - int i; - struct cafe_sio_buffer *sbuf = NULL; - - if (! (vma->vm_flags & VM_WRITE) || ! (vma->vm_flags & VM_SHARED)) - return -EINVAL; - /* - * Find the buffer they are looking for. - */ - mutex_lock(&cam->s_mutex); - for (i = 0; i < cam->n_sbufs; i++) - if (cam->sb_bufs[i].v4lbuf.m.offset == offset) { - sbuf = cam->sb_bufs + i; - break; - } - if (sbuf == NULL) - goto out; - - ret = remap_vmalloc_range(vma, sbuf->buffer, 0); - if (ret) - goto out; - vma->vm_flags |= VM_DONTEXPAND; - vma->vm_private_data = sbuf; - vma->vm_ops = &cafe_v4l_vm_ops; - sbuf->v4lbuf.flags |= V4L2_BUF_FLAG_MAPPED; - cafe_v4l_vm_open(vma); - ret = 0; - out: - mutex_unlock(&cam->s_mutex); - return ret; -} - - - -static int cafe_v4l_open(struct file *filp) -{ - struct cafe_camera *cam = video_drvdata(filp); - - filp->private_data = cam; - - mutex_lock(&cam->s_mutex); - if (cam->users == 0) { - cafe_ctlr_power_up(cam); - __cafe_cam_reset(cam); - cafe_set_config_needed(cam, 1); - /* FIXME make sure this is complete */ - } - (cam->users)++; - mutex_unlock(&cam->s_mutex); - return 0; -} - - -static int cafe_v4l_release(struct file *filp) -{ - struct cafe_camera *cam = filp->private_data; - - mutex_lock(&cam->s_mutex); - (cam->users)--; - if (filp == cam->owner) { - cafe_ctlr_stop_dma(cam); - cafe_free_sio_buffers(cam); - cam->owner = NULL; - } - if (cam->users == 0) { - cafe_ctlr_power_down(cam); - if (alloc_bufs_at_read) - cafe_free_dma_bufs(cam); - } - mutex_unlock(&cam->s_mutex); - return 0; -} - - - -static unsigned int cafe_v4l_poll(struct file *filp, - struct poll_table_struct *pt) -{ - struct cafe_camera *cam = filp->private_data; - - poll_wait(filp, &cam->iowait, pt); - if (cam->next_buf >= 0) - return POLLIN | POLLRDNORM; - return 0; -} - - - -static int cafe_vidioc_queryctrl(struct file *filp, void *priv, - struct v4l2_queryctrl *qc) -{ - struct cafe_camera *cam = priv; - int ret; - - mutex_lock(&cam->s_mutex); - ret = sensor_call(cam, core, queryctrl, qc); - mutex_unlock(&cam->s_mutex); - return ret; -} - - -static int cafe_vidioc_g_ctrl(struct file *filp, void *priv, - struct v4l2_control *ctrl) -{ - struct cafe_camera *cam = priv; - int ret; - - mutex_lock(&cam->s_mutex); - ret = sensor_call(cam, core, g_ctrl, ctrl); - mutex_unlock(&cam->s_mutex); - return ret; -} - - -static int cafe_vidioc_s_ctrl(struct file *filp, void *priv, - struct v4l2_control *ctrl) -{ - struct cafe_camera *cam = priv; - int ret; - - mutex_lock(&cam->s_mutex); - ret = sensor_call(cam, core, s_ctrl, ctrl); - mutex_unlock(&cam->s_mutex); - return ret; -} - - - - - -static int cafe_vidioc_querycap(struct file *file, void *priv, - struct v4l2_capability *cap) -{ - strcpy(cap->driver, "cafe_ccic"); - strcpy(cap->card, "cafe_ccic"); - cap->version = CAFE_VERSION; - cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | - V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; - return 0; -} - - -/* - * The default format we use until somebody says otherwise. - */ -static const struct v4l2_pix_format cafe_def_pix_format = { - .width = VGA_WIDTH, - .height = VGA_HEIGHT, - .pixelformat = V4L2_PIX_FMT_YUYV, - .field = V4L2_FIELD_NONE, - .bytesperline = VGA_WIDTH*2, - .sizeimage = VGA_WIDTH*VGA_HEIGHT*2, -}; - -static const enum v4l2_mbus_pixelcode cafe_def_mbus_code = - V4L2_MBUS_FMT_YUYV8_2X8; - -static int cafe_vidioc_enum_fmt_vid_cap(struct file *filp, - void *priv, struct v4l2_fmtdesc *fmt) -{ - if (fmt->index >= N_CAFE_FMTS) - return -EINVAL; - strlcpy(fmt->description, cafe_formats[fmt->index].desc, - sizeof(fmt->description)); - fmt->pixelformat = cafe_formats[fmt->index].pixelformat; - return 0; -} - -static int cafe_vidioc_try_fmt_vid_cap(struct file *filp, void *priv, - struct v4l2_format *fmt) -{ - struct cafe_camera *cam = priv; - struct cafe_format_struct *f; - struct v4l2_pix_format *pix = &fmt->fmt.pix; - struct v4l2_mbus_framefmt mbus_fmt; - int ret; - - f = cafe_find_format(pix->pixelformat); - pix->pixelformat = f->pixelformat; - v4l2_fill_mbus_format(&mbus_fmt, pix, f->mbus_code); - mutex_lock(&cam->s_mutex); - ret = sensor_call(cam, video, try_mbus_fmt, &mbus_fmt); - mutex_unlock(&cam->s_mutex); - v4l2_fill_pix_format(pix, &mbus_fmt); - pix->bytesperline = pix->width * f->bpp; - pix->sizeimage = pix->height * pix->bytesperline; - return ret; -} - -static int cafe_vidioc_s_fmt_vid_cap(struct file *filp, void *priv, - struct v4l2_format *fmt) -{ - struct cafe_camera *cam = priv; - struct cafe_format_struct *f; - int ret; - - /* - * Can't do anything if the device is not idle - * Also can't if there are streaming buffers in place. - */ - if (cam->state != S_IDLE || cam->n_sbufs > 0) - return -EBUSY; - - f = cafe_find_format(fmt->fmt.pix.pixelformat); - - /* - * See if the formatting works in principle. - */ - ret = cafe_vidioc_try_fmt_vid_cap(filp, priv, fmt); - if (ret) - return ret; - /* - * Now we start to change things for real, so let's do it - * under lock. - */ - mutex_lock(&cam->s_mutex); - cam->pix_format = fmt->fmt.pix; - cam->mbus_code = f->mbus_code; - - /* - * Make sure we have appropriate DMA buffers. - */ - ret = -ENOMEM; - if (cam->nbufs > 0 && cam->dma_buf_size < cam->pix_format.sizeimage) - cafe_free_dma_bufs(cam); - if (cam->nbufs == 0) { - if (cafe_alloc_dma_bufs(cam, 0)) - goto out; - } - /* - * It looks like this might work, so let's program the sensor. - */ - ret = cafe_cam_configure(cam); - if (! ret) - ret = cafe_ctlr_configure(cam); - out: - mutex_unlock(&cam->s_mutex); - return ret; -} - -/* - * Return our stored notion of how the camera is/should be configured. - * The V4l2 spec wants us to be smarter, and actually get this from - * the camera (and not mess with it at open time). Someday. - */ -static int cafe_vidioc_g_fmt_vid_cap(struct file *filp, void *priv, - struct v4l2_format *f) -{ - struct cafe_camera *cam = priv; - - f->fmt.pix = cam->pix_format; - return 0; -} - -/* - * We only have one input - the sensor - so minimize the nonsense here. - */ -static int cafe_vidioc_enum_input(struct file *filp, void *priv, - struct v4l2_input *input) -{ - if (input->index != 0) - return -EINVAL; - - input->type = V4L2_INPUT_TYPE_CAMERA; - input->std = V4L2_STD_ALL; /* Not sure what should go here */ - strcpy(input->name, "Camera"); - return 0; -} - -static int cafe_vidioc_g_input(struct file *filp, void *priv, unsigned int *i) -{ - *i = 0; - return 0; -} - -static int cafe_vidioc_s_input(struct file *filp, void *priv, unsigned int i) -{ - if (i != 0) - return -EINVAL; - return 0; -} - -/* from vivi.c */ -static int cafe_vidioc_s_std(struct file *filp, void *priv, v4l2_std_id *a) -{ - return 0; -} - -/* - * G/S_PARM. Most of this is done by the sensor, but we are - * the level which controls the number of read buffers. - */ -static int cafe_vidioc_g_parm(struct file *filp, void *priv, - struct v4l2_streamparm *parms) -{ - struct cafe_camera *cam = priv; - int ret; - - mutex_lock(&cam->s_mutex); - ret = sensor_call(cam, video, g_parm, parms); - mutex_unlock(&cam->s_mutex); - parms->parm.capture.readbuffers = n_dma_bufs; - return ret; -} - -static int cafe_vidioc_s_parm(struct file *filp, void *priv, - struct v4l2_streamparm *parms) -{ - struct cafe_camera *cam = priv; - int ret; - - mutex_lock(&cam->s_mutex); - ret = sensor_call(cam, video, s_parm, parms); - mutex_unlock(&cam->s_mutex); - parms->parm.capture.readbuffers = n_dma_bufs; - return ret; -} - -static int cafe_vidioc_g_chip_ident(struct file *file, void *priv, - struct v4l2_dbg_chip_ident *chip) -{ - struct cafe_camera *cam = priv; - - chip->ident = V4L2_IDENT_NONE; - chip->revision = 0; - if (v4l2_chip_match_host(&chip->match)) { - chip->ident = V4L2_IDENT_CAFE; - return 0; - } - return sensor_call(cam, core, g_chip_ident, chip); -} - -static int cafe_vidioc_enum_framesizes(struct file *filp, void *priv, - struct v4l2_frmsizeenum *sizes) -{ - struct cafe_camera *cam = priv; - int ret; - - mutex_lock(&cam->s_mutex); - ret = sensor_call(cam, video, enum_framesizes, sizes); - mutex_unlock(&cam->s_mutex); - return ret; -} - -static int cafe_vidioc_enum_frameintervals(struct file *filp, void *priv, - struct v4l2_frmivalenum *interval) -{ - struct cafe_camera *cam = priv; - int ret; - - mutex_lock(&cam->s_mutex); - ret = sensor_call(cam, video, enum_frameintervals, interval); - mutex_unlock(&cam->s_mutex); - return ret; -} - -#ifdef CONFIG_VIDEO_ADV_DEBUG -static int cafe_vidioc_g_register(struct file *file, void *priv, - struct v4l2_dbg_register *reg) -{ - struct cafe_camera *cam = priv; - - if (v4l2_chip_match_host(®->match)) { - reg->val = cafe_reg_read(cam, reg->reg); - reg->size = 4; - return 0; - } - return sensor_call(cam, core, g_register, reg); -} - -static int cafe_vidioc_s_register(struct file *file, void *priv, - struct v4l2_dbg_register *reg) -{ - struct cafe_camera *cam = priv; - - if (v4l2_chip_match_host(®->match)) { - cafe_reg_write(cam, reg->reg, reg->val); - return 0; - } - return sensor_call(cam, core, s_register, reg); -} -#endif - -/* - * This template device holds all of those v4l2 methods; we - * clone it for specific real devices. - */ - -static const struct v4l2_file_operations cafe_v4l_fops = { - .owner = THIS_MODULE, - .open = cafe_v4l_open, - .release = cafe_v4l_release, - .read = cafe_v4l_read, - .poll = cafe_v4l_poll, - .mmap = cafe_v4l_mmap, - .unlocked_ioctl = video_ioctl2, -}; - -static const struct v4l2_ioctl_ops cafe_v4l_ioctl_ops = { - .vidioc_querycap = cafe_vidioc_querycap, - .vidioc_enum_fmt_vid_cap = cafe_vidioc_enum_fmt_vid_cap, - .vidioc_try_fmt_vid_cap = cafe_vidioc_try_fmt_vid_cap, - .vidioc_s_fmt_vid_cap = cafe_vidioc_s_fmt_vid_cap, - .vidioc_g_fmt_vid_cap = cafe_vidioc_g_fmt_vid_cap, - .vidioc_enum_input = cafe_vidioc_enum_input, - .vidioc_g_input = cafe_vidioc_g_input, - .vidioc_s_input = cafe_vidioc_s_input, - .vidioc_s_std = cafe_vidioc_s_std, - .vidioc_reqbufs = cafe_vidioc_reqbufs, - .vidioc_querybuf = cafe_vidioc_querybuf, - .vidioc_qbuf = cafe_vidioc_qbuf, - .vidioc_dqbuf = cafe_vidioc_dqbuf, - .vidioc_streamon = cafe_vidioc_streamon, - .vidioc_streamoff = cafe_vidioc_streamoff, - .vidioc_queryctrl = cafe_vidioc_queryctrl, - .vidioc_g_ctrl = cafe_vidioc_g_ctrl, - .vidioc_s_ctrl = cafe_vidioc_s_ctrl, - .vidioc_g_parm = cafe_vidioc_g_parm, - .vidioc_s_parm = cafe_vidioc_s_parm, - .vidioc_enum_framesizes = cafe_vidioc_enum_framesizes, - .vidioc_enum_frameintervals = cafe_vidioc_enum_frameintervals, - .vidioc_g_chip_ident = cafe_vidioc_g_chip_ident, -#ifdef CONFIG_VIDEO_ADV_DEBUG - .vidioc_g_register = cafe_vidioc_g_register, - .vidioc_s_register = cafe_vidioc_s_register, -#endif -}; - -static struct video_device cafe_v4l_template = { - .name = "cafe", - .tvnorms = V4L2_STD_NTSC_M, - .current_norm = V4L2_STD_NTSC_M, /* make mplayer happy */ - - .fops = &cafe_v4l_fops, - .ioctl_ops = &cafe_v4l_ioctl_ops, - .release = video_device_release_empty, -}; - - -/* ---------------------------------------------------------------------- */ -/* - * Interrupt handler stuff - */ - - - -static void cafe_frame_tasklet(unsigned long data) -{ - struct cafe_camera *cam = (struct cafe_camera *) data; - int i; - unsigned long flags; - struct cafe_sio_buffer *sbuf; - - spin_lock_irqsave(&cam->dev_lock, flags); - for (i = 0; i < cam->nbufs; i++) { - int bufno = cam->next_buf; - if (bufno < 0) { /* "will never happen" */ - cam_err(cam, "No valid bufs in tasklet!\n"); - break; - } - if (++(cam->next_buf) >= cam->nbufs) - cam->next_buf = 0; - if (! test_bit(bufno, &cam->flags)) - continue; - if (list_empty(&cam->sb_avail)) - break; /* Leave it valid, hope for better later */ - clear_bit(bufno, &cam->flags); - sbuf = list_entry(cam->sb_avail.next, - struct cafe_sio_buffer, list); - /* - * Drop the lock during the big copy. This *should* be safe... - */ - spin_unlock_irqrestore(&cam->dev_lock, flags); - memcpy(sbuf->buffer, cam->dma_bufs[bufno], - cam->pix_format.sizeimage); - sbuf->v4lbuf.bytesused = cam->pix_format.sizeimage; - sbuf->v4lbuf.sequence = cam->buf_seq[bufno]; - sbuf->v4lbuf.flags &= ~V4L2_BUF_FLAG_QUEUED; - sbuf->v4lbuf.flags |= V4L2_BUF_FLAG_DONE; - spin_lock_irqsave(&cam->dev_lock, flags); - list_move_tail(&sbuf->list, &cam->sb_full); - } - if (! list_empty(&cam->sb_full)) - wake_up(&cam->iowait); - spin_unlock_irqrestore(&cam->dev_lock, flags); -} - - - -static void cafe_frame_complete(struct cafe_camera *cam, int frame) -{ - /* - * Basic frame housekeeping. - */ - if (test_bit(frame, &cam->flags) && printk_ratelimit()) - cam_err(cam, "Frame overrun on %d, frames lost\n", frame); - set_bit(frame, &cam->flags); - clear_bit(CF_DMA_ACTIVE, &cam->flags); - if (cam->next_buf < 0) - cam->next_buf = frame; - cam->buf_seq[frame] = ++(cam->sequence); - - switch (cam->state) { - /* - * If in single read mode, try going speculative. - */ - case S_SINGLEREAD: - cam->state = S_SPECREAD; - cam->specframes = 0; - wake_up(&cam->iowait); - break; - - /* - * If we are already doing speculative reads, and nobody is - * reading them, just stop. - */ - case S_SPECREAD: - if (++(cam->specframes) >= cam->nbufs) { - cafe_ctlr_stop(cam); - cafe_ctlr_irq_disable(cam); - cam->state = S_IDLE; - } - wake_up(&cam->iowait); - break; - /* - * For the streaming case, we defer the real work to the - * camera tasklet. - * - * FIXME: if the application is not consuming the buffers, - * we should eventually put things on hold and restart in - * vidioc_dqbuf(). - */ - case S_STREAMING: - tasklet_schedule(&cam->s_tasklet); - break; - - default: - cam_err(cam, "Frame interrupt in non-operational state\n"); - break; - } -} - - - - -static void cafe_frame_irq(struct cafe_camera *cam, unsigned int irqs) -{ - unsigned int frame; - - cafe_reg_write(cam, REG_IRQSTAT, FRAMEIRQS); /* Clear'em all */ - /* - * Handle any frame completions. There really should - * not be more than one of these, or we have fallen - * far behind. - */ - for (frame = 0; frame < cam->nbufs; frame++) - if (irqs & (IRQ_EOF0 << frame)) - cafe_frame_complete(cam, frame); - /* - * If a frame starts, note that we have DMA active. This - * code assumes that we won't get multiple frame interrupts - * at once; may want to rethink that. - */ - if (irqs & (IRQ_SOF0 | IRQ_SOF1 | IRQ_SOF2)) - set_bit(CF_DMA_ACTIVE, &cam->flags); -} - - - -static irqreturn_t cafe_irq(int irq, void *data) -{ - struct cafe_camera *cam = data; - unsigned int irqs; - - spin_lock(&cam->dev_lock); - irqs = cafe_reg_read(cam, REG_IRQSTAT); - if ((irqs & ALLIRQS) == 0) { - spin_unlock(&cam->dev_lock); - return IRQ_NONE; - } - if (irqs & FRAMEIRQS) - cafe_frame_irq(cam, irqs); - if (irqs & TWSIIRQS) { - cafe_reg_write(cam, REG_IRQSTAT, TWSIIRQS); - wake_up(&cam->smbus_wait); - } - spin_unlock(&cam->dev_lock); - return IRQ_HANDLED; -} - - -/* -------------------------------------------------------------------------- */ -/* - * PCI interface stuff. - */ - -static const struct dmi_system_id olpc_xo1_dmi[] = { - { - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "OLPC"), - DMI_MATCH(DMI_PRODUCT_NAME, "XO"), - DMI_MATCH(DMI_PRODUCT_VERSION, "1"), - }, - }, - { } -}; - -static int cafe_pci_probe(struct pci_dev *pdev, - const struct pci_device_id *id) -{ - int ret; - struct cafe_camera *cam; - struct ov7670_config sensor_cfg = { - /* This controller only does SMBUS */ - .use_smbus = true, - - /* - * Exclude QCIF mode, because it only captures a tiny portion - * of the sensor FOV - */ - .min_width = 320, - .min_height = 240, - }; - struct i2c_board_info ov7670_info = { - .type = "ov7670", - .addr = 0x42, - .platform_data = &sensor_cfg, - }; - - /* - * Start putting together one of our big camera structures. - */ - ret = -ENOMEM; - cam = kzalloc(sizeof(struct cafe_camera), GFP_KERNEL); - if (cam == NULL) - goto out; - ret = v4l2_device_register(&pdev->dev, &cam->v4l2_dev); - if (ret) - goto out_free; - - mutex_init(&cam->s_mutex); - spin_lock_init(&cam->dev_lock); - cam->state = S_NOTREADY; - cafe_set_config_needed(cam, 1); - init_waitqueue_head(&cam->smbus_wait); - init_waitqueue_head(&cam->iowait); - cam->pdev = pdev; - cam->pix_format = cafe_def_pix_format; - cam->mbus_code = cafe_def_mbus_code; - INIT_LIST_HEAD(&cam->dev_list); - INIT_LIST_HEAD(&cam->sb_avail); - INIT_LIST_HEAD(&cam->sb_full); - tasklet_init(&cam->s_tasklet, cafe_frame_tasklet, (unsigned long) cam); - /* - * Get set up on the PCI bus. - */ - ret = pci_enable_device(pdev); - if (ret) - goto out_unreg; - pci_set_master(pdev); - - ret = -EIO; - cam->regs = pci_iomap(pdev, 0, 0); - if (! cam->regs) { - printk(KERN_ERR "Unable to ioremap cafe-ccic regs\n"); - goto out_unreg; - } - ret = request_irq(pdev->irq, cafe_irq, IRQF_SHARED, "cafe-ccic", cam); - if (ret) - goto out_iounmap; - /* - * Initialize the controller and leave it powered up. It will - * stay that way until the sensor driver shows up. - */ - cafe_ctlr_init(cam); - cafe_ctlr_power_up(cam); - /* - * Set up I2C/SMBUS communications. We have to drop the mutex here - * because the sensor could attach in this call chain, leading to - * unsightly deadlocks. - */ - ret = cafe_smbus_setup(cam); - if (ret) - goto out_freeirq; - - /* Apply XO-1 clock speed */ - if (dmi_check_system(olpc_xo1_dmi)) - sensor_cfg.clock_speed = 45; - - cam->sensor_addr = ov7670_info.addr; - cam->sensor = v4l2_i2c_new_subdev_board(&cam->v4l2_dev, &cam->i2c_adapter, - &ov7670_info, NULL); - if (cam->sensor == NULL) { - ret = -ENODEV; - goto out_smbus; - } - - ret = cafe_cam_init(cam); - if (ret) - goto out_smbus; - - /* - * Get the v4l2 setup done. - */ - mutex_lock(&cam->s_mutex); - cam->vdev = cafe_v4l_template; - cam->vdev.debug = 0; -/* cam->vdev.debug = V4L2_DEBUG_IOCTL_ARG;*/ - cam->vdev.v4l2_dev = &cam->v4l2_dev; - ret = video_register_device(&cam->vdev, VFL_TYPE_GRABBER, -1); - if (ret) - goto out_unlock; - video_set_drvdata(&cam->vdev, cam); - - /* - * If so requested, try to get our DMA buffers now. - */ - if (!alloc_bufs_at_read) { - if (cafe_alloc_dma_bufs(cam, 1)) - cam_warn(cam, "Unable to alloc DMA buffers at load" - " will try again later."); - } - - mutex_unlock(&cam->s_mutex); - return 0; - -out_unlock: - mutex_unlock(&cam->s_mutex); -out_smbus: - cafe_smbus_shutdown(cam); -out_freeirq: - cafe_ctlr_power_down(cam); - free_irq(pdev->irq, cam); -out_iounmap: - pci_iounmap(pdev, cam->regs); -out_free: - v4l2_device_unregister(&cam->v4l2_dev); -out_unreg: - kfree(cam); -out: - return ret; -} - - -/* - * Shut down an initialized device - */ -static void cafe_shutdown(struct cafe_camera *cam) -{ -/* FIXME: Make sure we take care of everything here */ - if (cam->n_sbufs > 0) - /* What if they are still mapped? Shouldn't be, but... */ - cafe_free_sio_buffers(cam); - cafe_ctlr_stop_dma(cam); - cafe_ctlr_power_down(cam); - cafe_smbus_shutdown(cam); - cafe_free_dma_bufs(cam); - free_irq(cam->pdev->irq, cam); - pci_iounmap(cam->pdev, cam->regs); - video_unregister_device(&cam->vdev); -} - - -static void cafe_pci_remove(struct pci_dev *pdev) -{ - struct v4l2_device *v4l2_dev = dev_get_drvdata(&pdev->dev); - struct cafe_camera *cam = to_cam(v4l2_dev); - - if (cam == NULL) { - printk(KERN_WARNING "pci_remove on unknown pdev %p\n", pdev); - return; - } - mutex_lock(&cam->s_mutex); - if (cam->users > 0) - cam_warn(cam, "Removing a device with users!\n"); - cafe_shutdown(cam); - v4l2_device_unregister(&cam->v4l2_dev); - kfree(cam); -/* No unlock - it no longer exists */ -} - - -#ifdef CONFIG_PM -/* - * Basic power management. - */ -static int cafe_pci_suspend(struct pci_dev *pdev, pm_message_t state) -{ - struct v4l2_device *v4l2_dev = dev_get_drvdata(&pdev->dev); - struct cafe_camera *cam = to_cam(v4l2_dev); - int ret; - enum cafe_state cstate; - - ret = pci_save_state(pdev); - if (ret) - return ret; - cstate = cam->state; /* HACK - stop_dma sets to idle */ - cafe_ctlr_stop_dma(cam); - cafe_ctlr_power_down(cam); - pci_disable_device(pdev); - cam->state = cstate; - return 0; -} - - -static int cafe_pci_resume(struct pci_dev *pdev) -{ - struct v4l2_device *v4l2_dev = dev_get_drvdata(&pdev->dev); - struct cafe_camera *cam = to_cam(v4l2_dev); - int ret = 0; - - pci_restore_state(pdev); - ret = pci_enable_device(pdev); - - if (ret) { - cam_warn(cam, "Unable to re-enable device on resume!\n"); - return ret; - } - cafe_ctlr_init(cam); - - mutex_lock(&cam->s_mutex); - if (cam->users > 0) { - cafe_ctlr_power_up(cam); - __cafe_cam_reset(cam); - } else { - cafe_ctlr_power_down(cam); - } - mutex_unlock(&cam->s_mutex); - - set_bit(CF_CONFIG_NEEDED, &cam->flags); - if (cam->state == S_SPECREAD) - cam->state = S_IDLE; /* Don't bother restarting */ - else if (cam->state == S_SINGLEREAD || cam->state == S_STREAMING) - ret = cafe_read_setup(cam, cam->state); - return ret; -} - -#endif /* CONFIG_PM */ - - -static struct pci_device_id cafe_ids[] = { - { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, - PCI_DEVICE_ID_MARVELL_88ALP01_CCIC) }, - { 0, } -}; - -MODULE_DEVICE_TABLE(pci, cafe_ids); - -static struct pci_driver cafe_pci_driver = { - .name = "cafe1000-ccic", - .id_table = cafe_ids, - .probe = cafe_pci_probe, - .remove = cafe_pci_remove, -#ifdef CONFIG_PM - .suspend = cafe_pci_suspend, - .resume = cafe_pci_resume, -#endif -}; - - - - -static int __init cafe_init(void) -{ - int ret; - - printk(KERN_NOTICE "Marvell M88ALP01 'CAFE' Camera Controller version %d\n", - CAFE_VERSION); - ret = pci_register_driver(&cafe_pci_driver); - if (ret) { - printk(KERN_ERR "Unable to register cafe_ccic driver\n"); - goto out; - } - ret = 0; - - out: - return ret; -} - - -static void __exit cafe_exit(void) -{ - pci_unregister_driver(&cafe_pci_driver); -} - -module_init(cafe_init); -module_exit(cafe_exit); diff --git a/drivers/media/video/marvell-ccic/mcam-core.c b/drivers/media/video/marvell-ccic/mcam-core.c new file mode 100644 index 000000000000..18fce9e69f38 --- /dev/null +++ b/drivers/media/video/marvell-ccic/mcam-core.c @@ -0,0 +1,1689 @@ +/* + * The Marvell camera core. This device appears in a number of settings, + * so it needs platform-specific support outside of the core. + * + * Copyright 2011 Jonathan Corbet corbet@lwn.net + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mcam-core.h" + + +/* + * Internal DMA buffer management. Since the controller cannot do S/G I/O, + * we must have physically contiguous buffers to bring frames into. + * These parameters control how many buffers we use, whether we + * allocate them at load time (better chance of success, but nails down + * memory) or when somebody tries to use the camera (riskier), and, + * for load-time allocation, how big they should be. + * + * The controller can cycle through three buffers. We could use + * more by flipping pointers around, but it probably makes little + * sense. + */ + +static int alloc_bufs_at_read; +module_param(alloc_bufs_at_read, bool, 0444); +MODULE_PARM_DESC(alloc_bufs_at_read, + "Non-zero value causes DMA buffers to be allocated when the " + "video capture device is read, rather than at module load " + "time. This saves memory, but decreases the chances of " + "successfully getting those buffers."); + +static int n_dma_bufs = 3; +module_param(n_dma_bufs, uint, 0644); +MODULE_PARM_DESC(n_dma_bufs, + "The number of DMA buffers to allocate. Can be either two " + "(saves memory, makes timing tighter) or three."); + +static int dma_buf_size = VGA_WIDTH * VGA_HEIGHT * 2; /* Worst case */ +module_param(dma_buf_size, uint, 0444); +MODULE_PARM_DESC(dma_buf_size, + "The size of the allocated DMA buffers. If actual operating " + "parameters require larger buffers, an attempt to reallocate " + "will be made."); + +static int min_buffers = 1; +module_param(min_buffers, uint, 0644); +MODULE_PARM_DESC(min_buffers, + "The minimum number of streaming I/O buffers we are willing " + "to work with."); + +static int max_buffers = 10; +module_param(max_buffers, uint, 0644); +MODULE_PARM_DESC(max_buffers, + "The maximum number of streaming I/O buffers an application " + "will be allowed to allocate. These buffers are big and live " + "in vmalloc space."); + +static int flip; +module_param(flip, bool, 0444); +MODULE_PARM_DESC(flip, + "If set, the sensor will be instructed to flip the image " + "vertically."); + +/* + * Status flags. Always manipulated with bit operations. + */ +#define CF_BUF0_VALID 0 /* Buffers valid - first three */ +#define CF_BUF1_VALID 1 +#define CF_BUF2_VALID 2 +#define CF_DMA_ACTIVE 3 /* A frame is incoming */ +#define CF_CONFIG_NEEDED 4 /* Must configure hardware */ + +#define sensor_call(cam, o, f, args...) \ + v4l2_subdev_call(cam->sensor, o, f, ##args) + +static struct mcam_format_struct { + __u8 *desc; + __u32 pixelformat; + int bpp; /* Bytes per pixel */ + enum v4l2_mbus_pixelcode mbus_code; +} mcam_formats[] = { + { + .desc = "YUYV 4:2:2", + .pixelformat = V4L2_PIX_FMT_YUYV, + .mbus_code = V4L2_MBUS_FMT_YUYV8_2X8, + .bpp = 2, + }, + { + .desc = "RGB 444", + .pixelformat = V4L2_PIX_FMT_RGB444, + .mbus_code = V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE, + .bpp = 2, + }, + { + .desc = "RGB 565", + .pixelformat = V4L2_PIX_FMT_RGB565, + .mbus_code = V4L2_MBUS_FMT_RGB565_2X8_LE, + .bpp = 2, + }, + { + .desc = "Raw RGB Bayer", + .pixelformat = V4L2_PIX_FMT_SBGGR8, + .mbus_code = V4L2_MBUS_FMT_SBGGR8_1X8, + .bpp = 1 + }, +}; +#define N_MCAM_FMTS ARRAY_SIZE(mcam_formats) + +static struct mcam_format_struct *mcam_find_format(u32 pixelformat) +{ + unsigned i; + + for (i = 0; i < N_MCAM_FMTS; i++) + if (mcam_formats[i].pixelformat == pixelformat) + return mcam_formats + i; + /* Not found? Then return the first format. */ + return mcam_formats; +} + +/* + * Start over with DMA buffers - dev_lock needed. + */ +static void mcam_reset_buffers(struct mcam_camera *cam) +{ + int i; + + cam->next_buf = -1; + for (i = 0; i < cam->nbufs; i++) + clear_bit(i, &cam->flags); + cam->specframes = 0; +} + +static inline int mcam_needs_config(struct mcam_camera *cam) +{ + return test_bit(CF_CONFIG_NEEDED, &cam->flags); +} + +static void mcam_set_config_needed(struct mcam_camera *cam, int needed) +{ + if (needed) + set_bit(CF_CONFIG_NEEDED, &cam->flags); + else + clear_bit(CF_CONFIG_NEEDED, &cam->flags); +} + + +/* + * Debugging and related. FIXME these are broken + */ +#define cam_err(cam, fmt, arg...) \ + dev_err((cam)->dev, fmt, ##arg); +#define cam_warn(cam, fmt, arg...) \ + dev_warn((cam)->dev, fmt, ##arg); +#define cam_dbg(cam, fmt, arg...) \ + dev_dbg((cam)->dev, fmt, ##arg); + + + +/* ------------------------------------------------------------------- */ +/* + * Deal with the controller. + */ + +/* + * Do everything we think we need to have the interface operating + * according to the desired format. + */ +static void mcam_ctlr_dma(struct mcam_camera *cam) +{ + /* + * Store the first two Y buffers (we aren't supporting + * planar formats for now, so no UV bufs). Then either + * set the third if it exists, or tell the controller + * to just use two. + */ + mcam_reg_write(cam, REG_Y0BAR, cam->dma_handles[0]); + mcam_reg_write(cam, REG_Y1BAR, cam->dma_handles[1]); + if (cam->nbufs > 2) { + mcam_reg_write(cam, REG_Y2BAR, cam->dma_handles[2]); + mcam_reg_clear_bit(cam, REG_CTRL1, C1_TWOBUFS); + } else + mcam_reg_set_bit(cam, REG_CTRL1, C1_TWOBUFS); + mcam_reg_write(cam, REG_UBAR, 0); /* 32 bits only for now */ +} + +static void mcam_ctlr_image(struct mcam_camera *cam) +{ + int imgsz; + struct v4l2_pix_format *fmt = &cam->pix_format; + + imgsz = ((fmt->height << IMGSZ_V_SHIFT) & IMGSZ_V_MASK) | + (fmt->bytesperline & IMGSZ_H_MASK); + mcam_reg_write(cam, REG_IMGSIZE, imgsz); + mcam_reg_write(cam, REG_IMGOFFSET, 0); + /* YPITCH just drops the last two bits */ + mcam_reg_write_mask(cam, REG_IMGPITCH, fmt->bytesperline, + IMGP_YP_MASK); + /* + * Tell the controller about the image format we are using. + */ + switch (cam->pix_format.pixelformat) { + case V4L2_PIX_FMT_YUYV: + mcam_reg_write_mask(cam, REG_CTRL0, + C0_DF_YUV|C0_YUV_PACKED|C0_YUVE_YUYV, + C0_DF_MASK); + break; + + case V4L2_PIX_FMT_RGB444: + mcam_reg_write_mask(cam, REG_CTRL0, + C0_DF_RGB|C0_RGBF_444|C0_RGB4_XRGB, + C0_DF_MASK); + /* Alpha value? */ + break; + + case V4L2_PIX_FMT_RGB565: + mcam_reg_write_mask(cam, REG_CTRL0, + C0_DF_RGB|C0_RGBF_565|C0_RGB5_BGGR, + C0_DF_MASK); + break; + + default: + cam_err(cam, "Unknown format %x\n", cam->pix_format.pixelformat); + break; + } + /* + * Make sure it knows we want to use hsync/vsync. + */ + mcam_reg_write_mask(cam, REG_CTRL0, C0_SIF_HVSYNC, + C0_SIFM_MASK); +} + + +/* + * Configure the controller for operation; caller holds the + * device mutex. + */ +static int mcam_ctlr_configure(struct mcam_camera *cam) +{ + unsigned long flags; + + spin_lock_irqsave(&cam->dev_lock, flags); + mcam_ctlr_dma(cam); + mcam_ctlr_image(cam); + mcam_set_config_needed(cam, 0); + spin_unlock_irqrestore(&cam->dev_lock, flags); + return 0; +} + +static void mcam_ctlr_irq_enable(struct mcam_camera *cam) +{ + /* + * Clear any pending interrupts, since we do not + * expect to have I/O active prior to enabling. + */ + mcam_reg_write(cam, REG_IRQSTAT, FRAMEIRQS); + mcam_reg_set_bit(cam, REG_IRQMASK, FRAMEIRQS); +} + +static void mcam_ctlr_irq_disable(struct mcam_camera *cam) +{ + mcam_reg_clear_bit(cam, REG_IRQMASK, FRAMEIRQS); +} + +/* + * Make the controller start grabbing images. Everything must + * be set up before doing this. + */ +static void mcam_ctlr_start(struct mcam_camera *cam) +{ + /* set_bit performs a read, so no other barrier should be + needed here */ + mcam_reg_set_bit(cam, REG_CTRL0, C0_ENABLE); +} + +static void mcam_ctlr_stop(struct mcam_camera *cam) +{ + mcam_reg_clear_bit(cam, REG_CTRL0, C0_ENABLE); +} + +static void mcam_ctlr_init(struct mcam_camera *cam) +{ + unsigned long flags; + + spin_lock_irqsave(&cam->dev_lock, flags); + /* + * Make sure it's not powered down. + */ + mcam_reg_clear_bit(cam, REG_CTRL1, C1_PWRDWN); + /* + * Turn off the enable bit. It sure should be off anyway, + * but it's good to be sure. + */ + mcam_reg_clear_bit(cam, REG_CTRL0, C0_ENABLE); + /* + * Clock the sensor appropriately. Controller clock should + * be 48MHz, sensor "typical" value is half that. + */ + mcam_reg_write_mask(cam, REG_CLKCTRL, 2, CLK_DIV_MASK); + spin_unlock_irqrestore(&cam->dev_lock, flags); +} + + +/* + * Stop the controller, and don't return until we're really sure that no + * further DMA is going on. + */ +static void mcam_ctlr_stop_dma(struct mcam_camera *cam) +{ + unsigned long flags; + + /* + * Theory: stop the camera controller (whether it is operating + * or not). Delay briefly just in case we race with the SOF + * interrupt, then wait until no DMA is active. + */ + spin_lock_irqsave(&cam->dev_lock, flags); + mcam_ctlr_stop(cam); + spin_unlock_irqrestore(&cam->dev_lock, flags); + mdelay(1); + wait_event_timeout(cam->iowait, + !test_bit(CF_DMA_ACTIVE, &cam->flags), HZ); + if (test_bit(CF_DMA_ACTIVE, &cam->flags)) + cam_err(cam, "Timeout waiting for DMA to end\n"); + /* This would be bad news - what now? */ + spin_lock_irqsave(&cam->dev_lock, flags); + cam->state = S_IDLE; + mcam_ctlr_irq_disable(cam); + spin_unlock_irqrestore(&cam->dev_lock, flags); +} + +/* + * Power up and down. + */ +static void mcam_ctlr_power_up(struct mcam_camera *cam) +{ + unsigned long flags; + + spin_lock_irqsave(&cam->dev_lock, flags); + mcam_reg_clear_bit(cam, REG_CTRL1, C1_PWRDWN); + cam->plat_power_up(cam); + spin_unlock_irqrestore(&cam->dev_lock, flags); + msleep(5); /* Just to be sure */ +} + +static void mcam_ctlr_power_down(struct mcam_camera *cam) +{ + unsigned long flags; + + spin_lock_irqsave(&cam->dev_lock, flags); + cam->plat_power_down(cam); + mcam_reg_set_bit(cam, REG_CTRL1, C1_PWRDWN); + spin_unlock_irqrestore(&cam->dev_lock, flags); +} + +/* -------------------------------------------------------------------- */ +/* + * Communications with the sensor. + */ + +static int __mcam_cam_reset(struct mcam_camera *cam) +{ + return sensor_call(cam, core, reset, 0); +} + +/* + * We have found the sensor on the i2c. Let's try to have a + * conversation. + */ +static int mcam_cam_init(struct mcam_camera *cam) +{ + struct v4l2_dbg_chip_ident chip; + int ret; + + mutex_lock(&cam->s_mutex); + if (cam->state != S_NOTREADY) + cam_warn(cam, "Cam init with device in funky state %d", + cam->state); + ret = __mcam_cam_reset(cam); + if (ret) + goto out; + chip.ident = V4L2_IDENT_NONE; + chip.match.type = V4L2_CHIP_MATCH_I2C_ADDR; + chip.match.addr = cam->sensor_addr; + ret = sensor_call(cam, core, g_chip_ident, &chip); + if (ret) + goto out; + cam->sensor_type = chip.ident; + if (cam->sensor_type != V4L2_IDENT_OV7670) { + cam_err(cam, "Unsupported sensor type 0x%x", cam->sensor_type); + ret = -EINVAL; + goto out; + } +/* Get/set parameters? */ + ret = 0; + cam->state = S_IDLE; +out: + mcam_ctlr_power_down(cam); + mutex_unlock(&cam->s_mutex); + return ret; +} + +/* + * Configure the sensor to match the parameters we have. Caller should + * hold s_mutex + */ +static int mcam_cam_set_flip(struct mcam_camera *cam) +{ + struct v4l2_control ctrl; + + memset(&ctrl, 0, sizeof(ctrl)); + ctrl.id = V4L2_CID_VFLIP; + ctrl.value = flip; + return sensor_call(cam, core, s_ctrl, &ctrl); +} + + +static int mcam_cam_configure(struct mcam_camera *cam) +{ + struct v4l2_mbus_framefmt mbus_fmt; + int ret; + + v4l2_fill_mbus_format(&mbus_fmt, &cam->pix_format, cam->mbus_code); + ret = sensor_call(cam, core, init, 0); + if (ret == 0) + ret = sensor_call(cam, video, s_mbus_fmt, &mbus_fmt); + /* + * OV7670 does weird things if flip is set *before* format... + */ + ret += mcam_cam_set_flip(cam); + return ret; +} + +/* -------------------------------------------------------------------- */ +/* + * DMA buffer management. These functions need s_mutex held. + */ + +/* FIXME: this is inefficient as hell, since dma_alloc_coherent just + * does a get_free_pages() call, and we waste a good chunk of an orderN + * allocation. Should try to allocate the whole set in one chunk. + */ +static int mcam_alloc_dma_bufs(struct mcam_camera *cam, int loadtime) +{ + int i; + + mcam_set_config_needed(cam, 1); + if (loadtime) + cam->dma_buf_size = dma_buf_size; + else + cam->dma_buf_size = cam->pix_format.sizeimage; + if (n_dma_bufs > 3) + n_dma_bufs = 3; + + cam->nbufs = 0; + for (i = 0; i < n_dma_bufs; i++) { + cam->dma_bufs[i] = dma_alloc_coherent(cam->dev, + cam->dma_buf_size, cam->dma_handles + i, + GFP_KERNEL); + if (cam->dma_bufs[i] == NULL) { + cam_warn(cam, "Failed to allocate DMA buffer\n"); + break; + } + /* For debug, remove eventually */ + memset(cam->dma_bufs[i], 0xcc, cam->dma_buf_size); + (cam->nbufs)++; + } + + switch (cam->nbufs) { + case 1: + dma_free_coherent(cam->dev, cam->dma_buf_size, + cam->dma_bufs[0], cam->dma_handles[0]); + cam->nbufs = 0; + case 0: + cam_err(cam, "Insufficient DMA buffers, cannot operate\n"); + return -ENOMEM; + + case 2: + if (n_dma_bufs > 2) + cam_warn(cam, "Will limp along with only 2 buffers\n"); + break; + } + return 0; +} + +static void mcam_free_dma_bufs(struct mcam_camera *cam) +{ + int i; + + for (i = 0; i < cam->nbufs; i++) { + dma_free_coherent(cam->dev, cam->dma_buf_size, + cam->dma_bufs[i], cam->dma_handles[i]); + cam->dma_bufs[i] = NULL; + } + cam->nbufs = 0; +} + + + + + +/* ----------------------------------------------------------------------- */ +/* + * Here starts the V4L2 interface code. + */ + +/* + * Read an image from the device. + */ +static ssize_t mcam_deliver_buffer(struct mcam_camera *cam, + char __user *buffer, size_t len, loff_t *pos) +{ + int bufno; + unsigned long flags; + + spin_lock_irqsave(&cam->dev_lock, flags); + if (cam->next_buf < 0) { + cam_err(cam, "deliver_buffer: No next buffer\n"); + spin_unlock_irqrestore(&cam->dev_lock, flags); + return -EIO; + } + bufno = cam->next_buf; + clear_bit(bufno, &cam->flags); + if (++(cam->next_buf) >= cam->nbufs) + cam->next_buf = 0; + if (!test_bit(cam->next_buf, &cam->flags)) + cam->next_buf = -1; + cam->specframes = 0; + spin_unlock_irqrestore(&cam->dev_lock, flags); + + if (len > cam->pix_format.sizeimage) + len = cam->pix_format.sizeimage; + if (copy_to_user(buffer, cam->dma_bufs[bufno], len)) + return -EFAULT; + (*pos) += len; + return len; +} + +/* + * Get everything ready, and start grabbing frames. + */ +static int mcam_read_setup(struct mcam_camera *cam, enum mcam_state state) +{ + int ret; + unsigned long flags; + + /* + * Configuration. If we still don't have DMA buffers, + * make one last, desperate attempt. + */ + if (cam->nbufs == 0) + if (mcam_alloc_dma_bufs(cam, 0)) + return -ENOMEM; + + if (mcam_needs_config(cam)) { + mcam_cam_configure(cam); + ret = mcam_ctlr_configure(cam); + if (ret) + return ret; + } + + /* + * Turn it loose. + */ + spin_lock_irqsave(&cam->dev_lock, flags); + mcam_reset_buffers(cam); + mcam_ctlr_irq_enable(cam); + cam->state = state; + mcam_ctlr_start(cam); + spin_unlock_irqrestore(&cam->dev_lock, flags); + return 0; +} + + +static ssize_t mcam_v4l_read(struct file *filp, + char __user *buffer, size_t len, loff_t *pos) +{ + struct mcam_camera *cam = filp->private_data; + int ret = 0; + + /* + * Perhaps we're in speculative read mode and already + * have data? + */ + mutex_lock(&cam->s_mutex); + if (cam->state == S_SPECREAD) { + if (cam->next_buf >= 0) { + ret = mcam_deliver_buffer(cam, buffer, len, pos); + if (ret != 0) + goto out_unlock; + } + } else if (cam->state == S_FLAKED || cam->state == S_NOTREADY) { + ret = -EIO; + goto out_unlock; + } else if (cam->state != S_IDLE) { + ret = -EBUSY; + goto out_unlock; + } + + /* + * v4l2: multiple processes can open the device, but only + * one gets to grab data from it. + */ + if (cam->owner && cam->owner != filp) { + ret = -EBUSY; + goto out_unlock; + } + cam->owner = filp; + + /* + * Do setup if need be. + */ + if (cam->state != S_SPECREAD) { + ret = mcam_read_setup(cam, S_SINGLEREAD); + if (ret) + goto out_unlock; + } + /* + * Wait for something to happen. This should probably + * be interruptible (FIXME). + */ + wait_event_timeout(cam->iowait, cam->next_buf >= 0, HZ); + if (cam->next_buf < 0) { + cam_err(cam, "read() operation timed out\n"); + mcam_ctlr_stop_dma(cam); + ret = -EIO; + goto out_unlock; + } + /* + * Give them their data and we should be done. + */ + ret = mcam_deliver_buffer(cam, buffer, len, pos); + +out_unlock: + mutex_unlock(&cam->s_mutex); + return ret; +} + + + + + + + + +/* + * Streaming I/O support. + */ + + + +static int mcam_vidioc_streamon(struct file *filp, void *priv, + enum v4l2_buf_type type) +{ + struct mcam_camera *cam = filp->private_data; + int ret = -EINVAL; + + if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + goto out; + mutex_lock(&cam->s_mutex); + if (cam->state != S_IDLE || cam->n_sbufs == 0) + goto out_unlock; + + cam->sequence = 0; + ret = mcam_read_setup(cam, S_STREAMING); + +out_unlock: + mutex_unlock(&cam->s_mutex); +out: + return ret; +} + + +static int mcam_vidioc_streamoff(struct file *filp, void *priv, + enum v4l2_buf_type type) +{ + struct mcam_camera *cam = filp->private_data; + int ret = -EINVAL; + + if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + goto out; + mutex_lock(&cam->s_mutex); + if (cam->state != S_STREAMING) + goto out_unlock; + + mcam_ctlr_stop_dma(cam); + ret = 0; + +out_unlock: + mutex_unlock(&cam->s_mutex); +out: + return ret; +} + + + +static int mcam_setup_siobuf(struct mcam_camera *cam, int index) +{ + struct mcam_sio_buffer *buf = cam->sb_bufs + index; + + INIT_LIST_HEAD(&buf->list); + buf->v4lbuf.length = PAGE_ALIGN(cam->pix_format.sizeimage); + buf->buffer = vmalloc_user(buf->v4lbuf.length); + if (buf->buffer == NULL) + return -ENOMEM; + buf->mapcount = 0; + buf->cam = cam; + + buf->v4lbuf.index = index; + buf->v4lbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + buf->v4lbuf.field = V4L2_FIELD_NONE; + buf->v4lbuf.memory = V4L2_MEMORY_MMAP; + /* + * Offset: must be 32-bit even on a 64-bit system. videobuf-dma-sg + * just uses the length times the index, but the spec warns + * against doing just that - vma merging problems. So we + * leave a gap between each pair of buffers. + */ + buf->v4lbuf.m.offset = 2*index*buf->v4lbuf.length; + return 0; +} + +static int mcam_free_sio_buffers(struct mcam_camera *cam) +{ + int i; + + /* + * If any buffers are mapped, we cannot free them at all. + */ + for (i = 0; i < cam->n_sbufs; i++) + if (cam->sb_bufs[i].mapcount > 0) + return -EBUSY; + /* + * OK, let's do it. + */ + for (i = 0; i < cam->n_sbufs; i++) + vfree(cam->sb_bufs[i].buffer); + cam->n_sbufs = 0; + kfree(cam->sb_bufs); + cam->sb_bufs = NULL; + INIT_LIST_HEAD(&cam->sb_avail); + INIT_LIST_HEAD(&cam->sb_full); + return 0; +} + + + +static int mcam_vidioc_reqbufs(struct file *filp, void *priv, + struct v4l2_requestbuffers *req) +{ + struct mcam_camera *cam = filp->private_data; + int ret = 0; /* Silence warning */ + + /* + * Make sure it's something we can do. User pointers could be + * implemented without great pain, but that's not been done yet. + */ + if (req->memory != V4L2_MEMORY_MMAP) + return -EINVAL; + /* + * If they ask for zero buffers, they really want us to stop streaming + * (if it's happening) and free everything. Should we check owner? + */ + mutex_lock(&cam->s_mutex); + if (req->count == 0) { + if (cam->state == S_STREAMING) + mcam_ctlr_stop_dma(cam); + ret = mcam_free_sio_buffers(cam); + goto out; + } + /* + * Device needs to be idle and working. We *could* try to do the + * right thing in S_SPECREAD by shutting things down, but it + * probably doesn't matter. + */ + if (cam->state != S_IDLE || (cam->owner && cam->owner != filp)) { + ret = -EBUSY; + goto out; + } + cam->owner = filp; + + if (req->count < min_buffers) + req->count = min_buffers; + else if (req->count > max_buffers) + req->count = max_buffers; + if (cam->n_sbufs > 0) { + ret = mcam_free_sio_buffers(cam); + if (ret) + goto out; + } + + cam->sb_bufs = kzalloc(req->count*sizeof(struct mcam_sio_buffer), + GFP_KERNEL); + if (cam->sb_bufs == NULL) { + ret = -ENOMEM; + goto out; + } + for (cam->n_sbufs = 0; cam->n_sbufs < req->count; (cam->n_sbufs++)) { + ret = mcam_setup_siobuf(cam, cam->n_sbufs); + if (ret) + break; + } + + if (cam->n_sbufs == 0) /* no luck at all - ret already set */ + kfree(cam->sb_bufs); + req->count = cam->n_sbufs; /* In case of partial success */ + +out: + mutex_unlock(&cam->s_mutex); + return ret; +} + + +static int mcam_vidioc_querybuf(struct file *filp, void *priv, + struct v4l2_buffer *buf) +{ + struct mcam_camera *cam = filp->private_data; + int ret = -EINVAL; + + mutex_lock(&cam->s_mutex); + if (buf->index >= cam->n_sbufs) + goto out; + *buf = cam->sb_bufs[buf->index].v4lbuf; + ret = 0; +out: + mutex_unlock(&cam->s_mutex); + return ret; +} + +static int mcam_vidioc_qbuf(struct file *filp, void *priv, + struct v4l2_buffer *buf) +{ + struct mcam_camera *cam = filp->private_data; + struct mcam_sio_buffer *sbuf; + int ret = -EINVAL; + unsigned long flags; + + mutex_lock(&cam->s_mutex); + if (buf->index >= cam->n_sbufs) + goto out; + sbuf = cam->sb_bufs + buf->index; + if (sbuf->v4lbuf.flags & V4L2_BUF_FLAG_QUEUED) { + ret = 0; /* Already queued?? */ + goto out; + } + if (sbuf->v4lbuf.flags & V4L2_BUF_FLAG_DONE) { + /* Spec doesn't say anything, seems appropriate tho */ + ret = -EBUSY; + goto out; + } + sbuf->v4lbuf.flags |= V4L2_BUF_FLAG_QUEUED; + spin_lock_irqsave(&cam->dev_lock, flags); + list_add(&sbuf->list, &cam->sb_avail); + spin_unlock_irqrestore(&cam->dev_lock, flags); + ret = 0; +out: + mutex_unlock(&cam->s_mutex); + return ret; +} + +static int mcam_vidioc_dqbuf(struct file *filp, void *priv, + struct v4l2_buffer *buf) +{ + struct mcam_camera *cam = filp->private_data; + struct mcam_sio_buffer *sbuf; + int ret = -EINVAL; + unsigned long flags; + + mutex_lock(&cam->s_mutex); + if (cam->state != S_STREAMING) + goto out_unlock; + if (list_empty(&cam->sb_full) && filp->f_flags & O_NONBLOCK) { + ret = -EAGAIN; + goto out_unlock; + } + + while (list_empty(&cam->sb_full) && cam->state == S_STREAMING) { + mutex_unlock(&cam->s_mutex); + if (wait_event_interruptible(cam->iowait, + !list_empty(&cam->sb_full))) { + ret = -ERESTARTSYS; + goto out; + } + mutex_lock(&cam->s_mutex); + } + + if (cam->state != S_STREAMING) + ret = -EINTR; + else { + spin_lock_irqsave(&cam->dev_lock, flags); + /* Should probably recheck !list_empty() here */ + sbuf = list_entry(cam->sb_full.next, + struct mcam_sio_buffer, list); + list_del_init(&sbuf->list); + spin_unlock_irqrestore(&cam->dev_lock, flags); + sbuf->v4lbuf.flags &= ~V4L2_BUF_FLAG_DONE; + *buf = sbuf->v4lbuf; + ret = 0; + } + +out_unlock: + mutex_unlock(&cam->s_mutex); +out: + return ret; +} + + + +static void mcam_v4l_vm_open(struct vm_area_struct *vma) +{ + struct mcam_sio_buffer *sbuf = vma->vm_private_data; + /* + * Locking: done under mmap_sem, so we don't need to + * go back to the camera lock here. + */ + sbuf->mapcount++; +} + + +static void mcam_v4l_vm_close(struct vm_area_struct *vma) +{ + struct mcam_sio_buffer *sbuf = vma->vm_private_data; + + mutex_lock(&sbuf->cam->s_mutex); + sbuf->mapcount--; + /* Docs say we should stop I/O too... */ + if (sbuf->mapcount == 0) + sbuf->v4lbuf.flags &= ~V4L2_BUF_FLAG_MAPPED; + mutex_unlock(&sbuf->cam->s_mutex); +} + +static const struct vm_operations_struct mcam_v4l_vm_ops = { + .open = mcam_v4l_vm_open, + .close = mcam_v4l_vm_close +}; + + +static int mcam_v4l_mmap(struct file *filp, struct vm_area_struct *vma) +{ + struct mcam_camera *cam = filp->private_data; + unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; + int ret = -EINVAL; + int i; + struct mcam_sio_buffer *sbuf = NULL; + + if (!(vma->vm_flags & VM_WRITE) || !(vma->vm_flags & VM_SHARED)) + return -EINVAL; + /* + * Find the buffer they are looking for. + */ + mutex_lock(&cam->s_mutex); + for (i = 0; i < cam->n_sbufs; i++) + if (cam->sb_bufs[i].v4lbuf.m.offset == offset) { + sbuf = cam->sb_bufs + i; + break; + } + if (sbuf == NULL) + goto out; + + ret = remap_vmalloc_range(vma, sbuf->buffer, 0); + if (ret) + goto out; + vma->vm_flags |= VM_DONTEXPAND; + vma->vm_private_data = sbuf; + vma->vm_ops = &mcam_v4l_vm_ops; + sbuf->v4lbuf.flags |= V4L2_BUF_FLAG_MAPPED; + mcam_v4l_vm_open(vma); + ret = 0; +out: + mutex_unlock(&cam->s_mutex); + return ret; +} + + + +static int mcam_v4l_open(struct file *filp) +{ + struct mcam_camera *cam = video_drvdata(filp); + + filp->private_data = cam; + + mutex_lock(&cam->s_mutex); + if (cam->users == 0) { + mcam_ctlr_power_up(cam); + __mcam_cam_reset(cam); + mcam_set_config_needed(cam, 1); + /* FIXME make sure this is complete */ + } + (cam->users)++; + mutex_unlock(&cam->s_mutex); + return 0; +} + + +static int mcam_v4l_release(struct file *filp) +{ + struct mcam_camera *cam = filp->private_data; + + mutex_lock(&cam->s_mutex); + (cam->users)--; + if (filp == cam->owner) { + mcam_ctlr_stop_dma(cam); + mcam_free_sio_buffers(cam); + cam->owner = NULL; + } + if (cam->users == 0) { + mcam_ctlr_power_down(cam); + if (alloc_bufs_at_read) + mcam_free_dma_bufs(cam); + } + mutex_unlock(&cam->s_mutex); + return 0; +} + + + +static unsigned int mcam_v4l_poll(struct file *filp, + struct poll_table_struct *pt) +{ + struct mcam_camera *cam = filp->private_data; + + poll_wait(filp, &cam->iowait, pt); + if (cam->next_buf >= 0) + return POLLIN | POLLRDNORM; + return 0; +} + + + +static int mcam_vidioc_queryctrl(struct file *filp, void *priv, + struct v4l2_queryctrl *qc) +{ + struct mcam_camera *cam = priv; + int ret; + + mutex_lock(&cam->s_mutex); + ret = sensor_call(cam, core, queryctrl, qc); + mutex_unlock(&cam->s_mutex); + return ret; +} + + +static int mcam_vidioc_g_ctrl(struct file *filp, void *priv, + struct v4l2_control *ctrl) +{ + struct mcam_camera *cam = priv; + int ret; + + mutex_lock(&cam->s_mutex); + ret = sensor_call(cam, core, g_ctrl, ctrl); + mutex_unlock(&cam->s_mutex); + return ret; +} + + +static int mcam_vidioc_s_ctrl(struct file *filp, void *priv, + struct v4l2_control *ctrl) +{ + struct mcam_camera *cam = priv; + int ret; + + mutex_lock(&cam->s_mutex); + ret = sensor_call(cam, core, s_ctrl, ctrl); + mutex_unlock(&cam->s_mutex); + return ret; +} + + + + + +static int mcam_vidioc_querycap(struct file *file, void *priv, + struct v4l2_capability *cap) +{ + strcpy(cap->driver, "marvell_ccic"); + strcpy(cap->card, "marvell_ccic"); + cap->version = 1; + cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | + V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; + return 0; +} + + +/* + * The default format we use until somebody says otherwise. + */ +static const struct v4l2_pix_format mcam_def_pix_format = { + .width = VGA_WIDTH, + .height = VGA_HEIGHT, + .pixelformat = V4L2_PIX_FMT_YUYV, + .field = V4L2_FIELD_NONE, + .bytesperline = VGA_WIDTH*2, + .sizeimage = VGA_WIDTH*VGA_HEIGHT*2, +}; + +static const enum v4l2_mbus_pixelcode mcam_def_mbus_code = + V4L2_MBUS_FMT_YUYV8_2X8; + +static int mcam_vidioc_enum_fmt_vid_cap(struct file *filp, + void *priv, struct v4l2_fmtdesc *fmt) +{ + if (fmt->index >= N_MCAM_FMTS) + return -EINVAL; + strlcpy(fmt->description, mcam_formats[fmt->index].desc, + sizeof(fmt->description)); + fmt->pixelformat = mcam_formats[fmt->index].pixelformat; + return 0; +} + +static int mcam_vidioc_try_fmt_vid_cap(struct file *filp, void *priv, + struct v4l2_format *fmt) +{ + struct mcam_camera *cam = priv; + struct mcam_format_struct *f; + struct v4l2_pix_format *pix = &fmt->fmt.pix; + struct v4l2_mbus_framefmt mbus_fmt; + int ret; + + f = mcam_find_format(pix->pixelformat); + pix->pixelformat = f->pixelformat; + v4l2_fill_mbus_format(&mbus_fmt, pix, f->mbus_code); + mutex_lock(&cam->s_mutex); + ret = sensor_call(cam, video, try_mbus_fmt, &mbus_fmt); + mutex_unlock(&cam->s_mutex); + v4l2_fill_pix_format(pix, &mbus_fmt); + pix->bytesperline = pix->width * f->bpp; + pix->sizeimage = pix->height * pix->bytesperline; + return ret; +} + +static int mcam_vidioc_s_fmt_vid_cap(struct file *filp, void *priv, + struct v4l2_format *fmt) +{ + struct mcam_camera *cam = priv; + struct mcam_format_struct *f; + int ret; + + /* + * Can't do anything if the device is not idle + * Also can't if there are streaming buffers in place. + */ + if (cam->state != S_IDLE || cam->n_sbufs > 0) + return -EBUSY; + + f = mcam_find_format(fmt->fmt.pix.pixelformat); + + /* + * See if the formatting works in principle. + */ + ret = mcam_vidioc_try_fmt_vid_cap(filp, priv, fmt); + if (ret) + return ret; + /* + * Now we start to change things for real, so let's do it + * under lock. + */ + mutex_lock(&cam->s_mutex); + cam->pix_format = fmt->fmt.pix; + cam->mbus_code = f->mbus_code; + + /* + * Make sure we have appropriate DMA buffers. + */ + ret = -ENOMEM; + if (cam->nbufs > 0 && cam->dma_buf_size < cam->pix_format.sizeimage) + mcam_free_dma_bufs(cam); + if (cam->nbufs == 0) { + if (mcam_alloc_dma_bufs(cam, 0)) + goto out; + } + /* + * It looks like this might work, so let's program the sensor. + */ + ret = mcam_cam_configure(cam); + if (!ret) + ret = mcam_ctlr_configure(cam); +out: + mutex_unlock(&cam->s_mutex); + return ret; +} + +/* + * Return our stored notion of how the camera is/should be configured. + * The V4l2 spec wants us to be smarter, and actually get this from + * the camera (and not mess with it at open time). Someday. + */ +static int mcam_vidioc_g_fmt_vid_cap(struct file *filp, void *priv, + struct v4l2_format *f) +{ + struct mcam_camera *cam = priv; + + f->fmt.pix = cam->pix_format; + return 0; +} + +/* + * We only have one input - the sensor - so minimize the nonsense here. + */ +static int mcam_vidioc_enum_input(struct file *filp, void *priv, + struct v4l2_input *input) +{ + if (input->index != 0) + return -EINVAL; + + input->type = V4L2_INPUT_TYPE_CAMERA; + input->std = V4L2_STD_ALL; /* Not sure what should go here */ + strcpy(input->name, "Camera"); + return 0; +} + +static int mcam_vidioc_g_input(struct file *filp, void *priv, unsigned int *i) +{ + *i = 0; + return 0; +} + +static int mcam_vidioc_s_input(struct file *filp, void *priv, unsigned int i) +{ + if (i != 0) + return -EINVAL; + return 0; +} + +/* from vivi.c */ +static int mcam_vidioc_s_std(struct file *filp, void *priv, v4l2_std_id *a) +{ + return 0; +} + +/* + * G/S_PARM. Most of this is done by the sensor, but we are + * the level which controls the number of read buffers. + */ +static int mcam_vidioc_g_parm(struct file *filp, void *priv, + struct v4l2_streamparm *parms) +{ + struct mcam_camera *cam = priv; + int ret; + + mutex_lock(&cam->s_mutex); + ret = sensor_call(cam, video, g_parm, parms); + mutex_unlock(&cam->s_mutex); + parms->parm.capture.readbuffers = n_dma_bufs; + return ret; +} + +static int mcam_vidioc_s_parm(struct file *filp, void *priv, + struct v4l2_streamparm *parms) +{ + struct mcam_camera *cam = priv; + int ret; + + mutex_lock(&cam->s_mutex); + ret = sensor_call(cam, video, s_parm, parms); + mutex_unlock(&cam->s_mutex); + parms->parm.capture.readbuffers = n_dma_bufs; + return ret; +} + +static int mcam_vidioc_g_chip_ident(struct file *file, void *priv, + struct v4l2_dbg_chip_ident *chip) +{ + struct mcam_camera *cam = priv; + + chip->ident = V4L2_IDENT_NONE; + chip->revision = 0; + if (v4l2_chip_match_host(&chip->match)) { + chip->ident = cam->chip_id; + return 0; + } + return sensor_call(cam, core, g_chip_ident, chip); +} + +static int mcam_vidioc_enum_framesizes(struct file *filp, void *priv, + struct v4l2_frmsizeenum *sizes) +{ + struct mcam_camera *cam = priv; + int ret; + + mutex_lock(&cam->s_mutex); + ret = sensor_call(cam, video, enum_framesizes, sizes); + mutex_unlock(&cam->s_mutex); + return ret; +} + +static int mcam_vidioc_enum_frameintervals(struct file *filp, void *priv, + struct v4l2_frmivalenum *interval) +{ + struct mcam_camera *cam = priv; + int ret; + + mutex_lock(&cam->s_mutex); + ret = sensor_call(cam, video, enum_frameintervals, interval); + mutex_unlock(&cam->s_mutex); + return ret; +} + +#ifdef CONFIG_VIDEO_ADV_DEBUG +static int mcam_vidioc_g_register(struct file *file, void *priv, + struct v4l2_dbg_register *reg) +{ + struct mcam_camera *cam = priv; + + if (v4l2_chip_match_host(®->match)) { + reg->val = mcam_reg_read(cam, reg->reg); + reg->size = 4; + return 0; + } + return sensor_call(cam, core, g_register, reg); +} + +static int mcam_vidioc_s_register(struct file *file, void *priv, + struct v4l2_dbg_register *reg) +{ + struct mcam_camera *cam = priv; + + if (v4l2_chip_match_host(®->match)) { + mcam_reg_write(cam, reg->reg, reg->val); + return 0; + } + return sensor_call(cam, core, s_register, reg); +} +#endif + +/* + * This template device holds all of those v4l2 methods; we + * clone it for specific real devices. + */ + +static const struct v4l2_file_operations mcam_v4l_fops = { + .owner = THIS_MODULE, + .open = mcam_v4l_open, + .release = mcam_v4l_release, + .read = mcam_v4l_read, + .poll = mcam_v4l_poll, + .mmap = mcam_v4l_mmap, + .unlocked_ioctl = video_ioctl2, +}; + +static const struct v4l2_ioctl_ops mcam_v4l_ioctl_ops = { + .vidioc_querycap = mcam_vidioc_querycap, + .vidioc_enum_fmt_vid_cap = mcam_vidioc_enum_fmt_vid_cap, + .vidioc_try_fmt_vid_cap = mcam_vidioc_try_fmt_vid_cap, + .vidioc_s_fmt_vid_cap = mcam_vidioc_s_fmt_vid_cap, + .vidioc_g_fmt_vid_cap = mcam_vidioc_g_fmt_vid_cap, + .vidioc_enum_input = mcam_vidioc_enum_input, + .vidioc_g_input = mcam_vidioc_g_input, + .vidioc_s_input = mcam_vidioc_s_input, + .vidioc_s_std = mcam_vidioc_s_std, + .vidioc_reqbufs = mcam_vidioc_reqbufs, + .vidioc_querybuf = mcam_vidioc_querybuf, + .vidioc_qbuf = mcam_vidioc_qbuf, + .vidioc_dqbuf = mcam_vidioc_dqbuf, + .vidioc_streamon = mcam_vidioc_streamon, + .vidioc_streamoff = mcam_vidioc_streamoff, + .vidioc_queryctrl = mcam_vidioc_queryctrl, + .vidioc_g_ctrl = mcam_vidioc_g_ctrl, + .vidioc_s_ctrl = mcam_vidioc_s_ctrl, + .vidioc_g_parm = mcam_vidioc_g_parm, + .vidioc_s_parm = mcam_vidioc_s_parm, + .vidioc_enum_framesizes = mcam_vidioc_enum_framesizes, + .vidioc_enum_frameintervals = mcam_vidioc_enum_frameintervals, + .vidioc_g_chip_ident = mcam_vidioc_g_chip_ident, +#ifdef CONFIG_VIDEO_ADV_DEBUG + .vidioc_g_register = mcam_vidioc_g_register, + .vidioc_s_register = mcam_vidioc_s_register, +#endif +}; + +static struct video_device mcam_v4l_template = { + .name = "mcam", + .tvnorms = V4L2_STD_NTSC_M, + .current_norm = V4L2_STD_NTSC_M, /* make mplayer happy */ + + .fops = &mcam_v4l_fops, + .ioctl_ops = &mcam_v4l_ioctl_ops, + .release = video_device_release_empty, +}; + +/* ---------------------------------------------------------------------- */ +/* + * Interrupt handler stuff + */ + + + +static void mcam_frame_tasklet(unsigned long data) +{ + struct mcam_camera *cam = (struct mcam_camera *) data; + int i; + unsigned long flags; + struct mcam_sio_buffer *sbuf; + + spin_lock_irqsave(&cam->dev_lock, flags); + for (i = 0; i < cam->nbufs; i++) { + int bufno = cam->next_buf; + if (bufno < 0) { /* "will never happen" */ + cam_err(cam, "No valid bufs in tasklet!\n"); + break; + } + if (++(cam->next_buf) >= cam->nbufs) + cam->next_buf = 0; + if (!test_bit(bufno, &cam->flags)) + continue; + if (list_empty(&cam->sb_avail)) + break; /* Leave it valid, hope for better later */ + clear_bit(bufno, &cam->flags); + sbuf = list_entry(cam->sb_avail.next, + struct mcam_sio_buffer, list); + /* + * Drop the lock during the big copy. This *should* be safe... + */ + spin_unlock_irqrestore(&cam->dev_lock, flags); + memcpy(sbuf->buffer, cam->dma_bufs[bufno], + cam->pix_format.sizeimage); + sbuf->v4lbuf.bytesused = cam->pix_format.sizeimage; + sbuf->v4lbuf.sequence = cam->buf_seq[bufno]; + sbuf->v4lbuf.flags &= ~V4L2_BUF_FLAG_QUEUED; + sbuf->v4lbuf.flags |= V4L2_BUF_FLAG_DONE; + spin_lock_irqsave(&cam->dev_lock, flags); + list_move_tail(&sbuf->list, &cam->sb_full); + } + if (!list_empty(&cam->sb_full)) + wake_up(&cam->iowait); + spin_unlock_irqrestore(&cam->dev_lock, flags); +} + + + +static void mcam_frame_complete(struct mcam_camera *cam, int frame) +{ + /* + * Basic frame housekeeping. + */ + if (test_bit(frame, &cam->flags) && printk_ratelimit()) + cam_err(cam, "Frame overrun on %d, frames lost\n", frame); + set_bit(frame, &cam->flags); + clear_bit(CF_DMA_ACTIVE, &cam->flags); + if (cam->next_buf < 0) + cam->next_buf = frame; + cam->buf_seq[frame] = ++(cam->sequence); + + switch (cam->state) { + /* + * If in single read mode, try going speculative. + */ + case S_SINGLEREAD: + cam->state = S_SPECREAD; + cam->specframes = 0; + wake_up(&cam->iowait); + break; + + /* + * If we are already doing speculative reads, and nobody is + * reading them, just stop. + */ + case S_SPECREAD: + if (++(cam->specframes) >= cam->nbufs) { + mcam_ctlr_stop(cam); + mcam_ctlr_irq_disable(cam); + cam->state = S_IDLE; + } + wake_up(&cam->iowait); + break; + /* + * For the streaming case, we defer the real work to the + * camera tasklet. + * + * FIXME: if the application is not consuming the buffers, + * we should eventually put things on hold and restart in + * vidioc_dqbuf(). + */ + case S_STREAMING: + tasklet_schedule(&cam->s_tasklet); + break; + + default: + cam_err(cam, "Frame interrupt in non-operational state\n"); + break; + } +} + + + + +int mccic_irq(struct mcam_camera *cam, unsigned int irqs) +{ + unsigned int frame, handled = 0; + + mcam_reg_write(cam, REG_IRQSTAT, FRAMEIRQS); /* Clear'em all */ + /* + * Handle any frame completions. There really should + * not be more than one of these, or we have fallen + * far behind. + */ + for (frame = 0; frame < cam->nbufs; frame++) + if (irqs & (IRQ_EOF0 << frame)) { + mcam_frame_complete(cam, frame); + handled = 1; + } + /* + * If a frame starts, note that we have DMA active. This + * code assumes that we won't get multiple frame interrupts + * at once; may want to rethink that. + */ + if (irqs & (IRQ_SOF0 | IRQ_SOF1 | IRQ_SOF2)) { + set_bit(CF_DMA_ACTIVE, &cam->flags); + handled = 1; + } + return handled; +} + +/* + * Registration and such. + */ + +/* FIXME this is really platform stuff */ +static const struct dmi_system_id olpc_xo1_dmi[] = { + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "OLPC"), + DMI_MATCH(DMI_PRODUCT_NAME, "XO"), + DMI_MATCH(DMI_PRODUCT_VERSION, "1"), + }, + }, + { } +}; + +static struct ov7670_config sensor_cfg = { + /* This controller only does SMBUS */ + .use_smbus = true, + + /* + * Exclude QCIF mode, because it only captures a tiny portion + * of the sensor FOV + */ + .min_width = 320, + .min_height = 240, +}; + + +int mccic_register(struct mcam_camera *cam) +{ + struct i2c_board_info ov7670_info = { + .type = "ov7670", + .addr = 0x42, + .platform_data = &sensor_cfg, + }; + int ret; + + /* + * Register with V4L + */ + ret = v4l2_device_register(cam->dev, &cam->v4l2_dev); + if (ret) + return ret; + + mutex_init(&cam->s_mutex); + cam->state = S_NOTREADY; + mcam_set_config_needed(cam, 1); + init_waitqueue_head(&cam->iowait); + cam->pix_format = mcam_def_pix_format; + cam->mbus_code = mcam_def_mbus_code; + INIT_LIST_HEAD(&cam->dev_list); + INIT_LIST_HEAD(&cam->sb_avail); + INIT_LIST_HEAD(&cam->sb_full); + tasklet_init(&cam->s_tasklet, mcam_frame_tasklet, (unsigned long) cam); + + mcam_ctlr_init(cam); + + /* Apply XO-1 clock speed */ + if (dmi_check_system(olpc_xo1_dmi)) + sensor_cfg.clock_speed = 45; + + /* + * Try to find the sensor. + */ + cam->sensor_addr = ov7670_info.addr; + cam->sensor = v4l2_i2c_new_subdev_board(&cam->v4l2_dev, + &cam->i2c_adapter, &ov7670_info, NULL); + if (cam->sensor == NULL) { + ret = -ENODEV; + goto out_unregister; + } + + ret = mcam_cam_init(cam); + if (ret) + goto out_unregister; + /* + * Get the v4l2 setup done. + */ + mutex_lock(&cam->s_mutex); + cam->vdev = mcam_v4l_template; + cam->vdev.debug = 0; + cam->vdev.v4l2_dev = &cam->v4l2_dev; + ret = video_register_device(&cam->vdev, VFL_TYPE_GRABBER, -1); + if (ret) + goto out; + video_set_drvdata(&cam->vdev, cam); + + /* + * If so requested, try to get our DMA buffers now. + */ + if (!alloc_bufs_at_read) { + if (mcam_alloc_dma_bufs(cam, 1)) + cam_warn(cam, "Unable to alloc DMA buffers at load" + " will try again later."); + } + +out: + mutex_unlock(&cam->s_mutex); + return ret; +out_unregister: + v4l2_device_unregister(&cam->v4l2_dev); + return ret; +} + + +void mccic_shutdown(struct mcam_camera *cam) +{ + if (cam->users > 0) + cam_warn(cam, "Removing a device with users!\n"); + if (cam->n_sbufs > 0) + /* What if they are still mapped? Shouldn't be, but... */ + mcam_free_sio_buffers(cam); + mcam_ctlr_stop_dma(cam); + mcam_ctlr_power_down(cam); + mcam_free_dma_bufs(cam); + video_unregister_device(&cam->vdev); + v4l2_device_unregister(&cam->v4l2_dev); +} + +/* + * Power management + */ +#ifdef CONFIG_PM + +void mccic_suspend(struct mcam_camera *cam) +{ + enum mcam_state cstate = cam->state; + + mcam_ctlr_stop_dma(cam); + mcam_ctlr_power_down(cam); + cam->state = cstate; +} + +int mccic_resume(struct mcam_camera *cam) +{ + int ret = 0; + + mutex_lock(&cam->s_mutex); + if (cam->users > 0) { + mcam_ctlr_power_up(cam); + __mcam_cam_reset(cam); + } else { + mcam_ctlr_power_down(cam); + } + mutex_unlock(&cam->s_mutex); + + set_bit(CF_CONFIG_NEEDED, &cam->flags); + if (cam->state == S_SPECREAD) + cam->state = S_IDLE; /* Don't bother restarting */ + else if (cam->state == S_SINGLEREAD || cam->state == S_STREAMING) + ret = mcam_read_setup(cam, cam->state); + return ret; +} +#endif /* CONFIG_PM */ diff --git a/drivers/media/video/marvell-ccic/mcam-core.h b/drivers/media/video/marvell-ccic/mcam-core.h new file mode 100644 index 000000000000..0b55b8e6bb7e --- /dev/null +++ b/drivers/media/video/marvell-ccic/mcam-core.h @@ -0,0 +1,311 @@ +/* + * Marvell camera core structures. + * + * Copyright 2011 Jonathan Corbet corbet@lwn.net + */ + +/* + * Tracking of streaming I/O buffers. + * FIXME doesn't belong in this file + */ +struct mcam_sio_buffer { + struct list_head list; + struct v4l2_buffer v4lbuf; + char *buffer; /* Where it lives in kernel space */ + int mapcount; + struct mcam_camera *cam; +}; + +enum mcam_state { + S_NOTREADY, /* Not yet initialized */ + S_IDLE, /* Just hanging around */ + S_FLAKED, /* Some sort of problem */ + S_SINGLEREAD, /* In read() */ + S_SPECREAD, /* Speculative read (for future read()) */ + S_STREAMING /* Streaming data */ +}; +#define MAX_DMA_BUFS 3 + +/* + * A description of one of our devices. + * Locking: controlled by s_mutex. Certain fields, however, require + * the dev_lock spinlock; they are marked as such by comments. + * dev_lock is also required for access to device registers. + */ +struct mcam_camera { + /* + * These fields should be set by the platform code prior to + * calling mcam_register(). + */ + struct i2c_adapter i2c_adapter; + unsigned char __iomem *regs; + spinlock_t dev_lock; + struct device *dev; /* For messages, dma alloc */ + unsigned int chip_id; + + /* + * Callbacks from the core to the platform code. + */ + void (*plat_power_up) (struct mcam_camera *cam); + void (*plat_power_down) (struct mcam_camera *cam); + + /* + * Everything below here is private to the mcam core and + * should not be touched by the platform code. + */ + struct v4l2_device v4l2_dev; + enum mcam_state state; + unsigned long flags; /* Buffer status, mainly (dev_lock) */ + int users; /* How many open FDs */ + struct file *owner; /* Who has data access (v4l2) */ + + /* + * Subsystem structures. + */ + struct video_device vdev; + struct v4l2_subdev *sensor; + unsigned short sensor_addr; + + struct list_head dev_list; /* link to other devices */ + + /* DMA buffers */ + unsigned int nbufs; /* How many are alloc'd */ + int next_buf; /* Next to consume (dev_lock) */ + unsigned int dma_buf_size; /* allocated size */ + void *dma_bufs[MAX_DMA_BUFS]; /* Internal buffer addresses */ + dma_addr_t dma_handles[MAX_DMA_BUFS]; /* Buffer bus addresses */ + unsigned int specframes; /* Unconsumed spec frames (dev_lock) */ + unsigned int sequence; /* Frame sequence number */ + unsigned int buf_seq[MAX_DMA_BUFS]; /* Sequence for individual buffers */ + + /* Streaming buffers */ + unsigned int n_sbufs; /* How many we have */ + struct mcam_sio_buffer *sb_bufs; /* The array of housekeeping structs */ + struct list_head sb_avail; /* Available for data (we own) (dev_lock) */ + struct list_head sb_full; /* With data (user space owns) (dev_lock) */ + struct tasklet_struct s_tasklet; + + /* Current operating parameters */ + u32 sensor_type; /* Currently ov7670 only */ + struct v4l2_pix_format pix_format; + enum v4l2_mbus_pixelcode mbus_code; + + /* Locks */ + struct mutex s_mutex; /* Access to this structure */ + + /* Misc */ + wait_queue_head_t iowait; /* Waiting on frame data */ +}; + + +/* + * Register I/O functions. These are here because the platform code + * may legitimately need to mess with the register space. + */ +/* + * Device register I/O + */ +static inline void mcam_reg_write(struct mcam_camera *cam, unsigned int reg, + unsigned int val) +{ + iowrite32(val, cam->regs + reg); +} + +static inline unsigned int mcam_reg_read(struct mcam_camera *cam, + unsigned int reg) +{ + return ioread32(cam->regs + reg); +} + + +static inline void mcam_reg_write_mask(struct mcam_camera *cam, unsigned int reg, + unsigned int val, unsigned int mask) +{ + unsigned int v = mcam_reg_read(cam, reg); + + v = (v & ~mask) | (val & mask); + mcam_reg_write(cam, reg, v); +} + +static inline void mcam_reg_clear_bit(struct mcam_camera *cam, + unsigned int reg, unsigned int val) +{ + mcam_reg_write_mask(cam, reg, 0, val); +} + +static inline void mcam_reg_set_bit(struct mcam_camera *cam, + unsigned int reg, unsigned int val) +{ + mcam_reg_write_mask(cam, reg, val, val); +} + +/* + * Functions for use by platform code. + */ +int mccic_register(struct mcam_camera *cam); +int mccic_irq(struct mcam_camera *cam, unsigned int irqs); +void mccic_shutdown(struct mcam_camera *cam); +#ifdef CONFIG_PM +void mccic_suspend(struct mcam_camera *cam); +int mccic_resume(struct mcam_camera *cam); +#endif + +/* + * Register definitions for the m88alp01 camera interface. Offsets in bytes + * as given in the spec. + */ +#define REG_Y0BAR 0x00 +#define REG_Y1BAR 0x04 +#define REG_Y2BAR 0x08 +/* ... */ + +#define REG_IMGPITCH 0x24 /* Image pitch register */ +#define IMGP_YP_SHFT 2 /* Y pitch params */ +#define IMGP_YP_MASK 0x00003ffc /* Y pitch field */ +#define IMGP_UVP_SHFT 18 /* UV pitch (planar) */ +#define IMGP_UVP_MASK 0x3ffc0000 +#define REG_IRQSTATRAW 0x28 /* RAW IRQ Status */ +#define IRQ_EOF0 0x00000001 /* End of frame 0 */ +#define IRQ_EOF1 0x00000002 /* End of frame 1 */ +#define IRQ_EOF2 0x00000004 /* End of frame 2 */ +#define IRQ_SOF0 0x00000008 /* Start of frame 0 */ +#define IRQ_SOF1 0x00000010 /* Start of frame 1 */ +#define IRQ_SOF2 0x00000020 /* Start of frame 2 */ +#define IRQ_OVERFLOW 0x00000040 /* FIFO overflow */ +#define IRQ_TWSIW 0x00010000 /* TWSI (smbus) write */ +#define IRQ_TWSIR 0x00020000 /* TWSI read */ +#define IRQ_TWSIE 0x00040000 /* TWSI error */ +#define TWSIIRQS (IRQ_TWSIW|IRQ_TWSIR|IRQ_TWSIE) +#define FRAMEIRQS (IRQ_EOF0|IRQ_EOF1|IRQ_EOF2|IRQ_SOF0|IRQ_SOF1|IRQ_SOF2) +#define ALLIRQS (TWSIIRQS|FRAMEIRQS|IRQ_OVERFLOW) +#define REG_IRQMASK 0x2c /* IRQ mask - same bits as IRQSTAT */ +#define REG_IRQSTAT 0x30 /* IRQ status / clear */ + +#define REG_IMGSIZE 0x34 /* Image size */ +#define IMGSZ_V_MASK 0x1fff0000 +#define IMGSZ_V_SHIFT 16 +#define IMGSZ_H_MASK 0x00003fff +#define REG_IMGOFFSET 0x38 /* IMage offset */ + +#define REG_CTRL0 0x3c /* Control 0 */ +#define C0_ENABLE 0x00000001 /* Makes the whole thing go */ + +/* Mask for all the format bits */ +#define C0_DF_MASK 0x00fffffc /* Bits 2-23 */ + +/* RGB ordering */ +#define C0_RGB4_RGBX 0x00000000 +#define C0_RGB4_XRGB 0x00000004 +#define C0_RGB4_BGRX 0x00000008 +#define C0_RGB4_XBGR 0x0000000c +#define C0_RGB5_RGGB 0x00000000 +#define C0_RGB5_GRBG 0x00000004 +#define C0_RGB5_GBRG 0x00000008 +#define C0_RGB5_BGGR 0x0000000c + +/* Spec has two fields for DIN and DOUT, but they must match, so + combine them here. */ +#define C0_DF_YUV 0x00000000 /* Data is YUV */ +#define C0_DF_RGB 0x000000a0 /* ... RGB */ +#define C0_DF_BAYER 0x00000140 /* ... Bayer */ +/* 8-8-8 must be missing from the below - ask */ +#define C0_RGBF_565 0x00000000 +#define C0_RGBF_444 0x00000800 +#define C0_RGB_BGR 0x00001000 /* Blue comes first */ +#define C0_YUV_PLANAR 0x00000000 /* YUV 422 planar format */ +#define C0_YUV_PACKED 0x00008000 /* YUV 422 packed */ +#define C0_YUV_420PL 0x0000a000 /* YUV 420 planar */ +/* Think that 420 packed must be 111 - ask */ +#define C0_YUVE_YUYV 0x00000000 /* Y1CbY0Cr */ +#define C0_YUVE_YVYU 0x00010000 /* Y1CrY0Cb */ +#define C0_YUVE_VYUY 0x00020000 /* CrY1CbY0 */ +#define C0_YUVE_UYVY 0x00030000 /* CbY1CrY0 */ +#define C0_YUVE_XYUV 0x00000000 /* 420: .YUV */ +#define C0_YUVE_XYVU 0x00010000 /* 420: .YVU */ +#define C0_YUVE_XUVY 0x00020000 /* 420: .UVY */ +#define C0_YUVE_XVUY 0x00030000 /* 420: .VUY */ +/* Bayer bits 18,19 if needed */ +#define C0_HPOL_LOW 0x01000000 /* HSYNC polarity active low */ +#define C0_VPOL_LOW 0x02000000 /* VSYNC polarity active low */ +#define C0_VCLK_LOW 0x04000000 /* VCLK on falling edge */ +#define C0_DOWNSCALE 0x08000000 /* Enable downscaler */ +#define C0_SIFM_MASK 0xc0000000 /* SIF mode bits */ +#define C0_SIF_HVSYNC 0x00000000 /* Use H/VSYNC */ +#define CO_SOF_NOSYNC 0x40000000 /* Use inband active signaling */ + + +#define REG_CTRL1 0x40 /* Control 1 */ +#define C1_444ALPHA 0x00f00000 /* Alpha field in RGB444 */ +#define C1_ALPHA_SHFT 20 +#define C1_DMAB32 0x00000000 /* 32-byte DMA burst */ +#define C1_DMAB16 0x02000000 /* 16-byte DMA burst */ +#define C1_DMAB64 0x04000000 /* 64-byte DMA burst */ +#define C1_DMAB_MASK 0x06000000 +#define C1_TWOBUFS 0x08000000 /* Use only two DMA buffers */ +#define C1_PWRDWN 0x10000000 /* Power down */ + +#define REG_CLKCTRL 0x88 /* Clock control */ +#define CLK_DIV_MASK 0x0000ffff /* Upper bits RW "reserved" */ + +#define REG_GPR 0xb4 /* General purpose register. This + controls inputs to the power and reset + pins on the OV7670 used with OLPC; + other deployments could differ. */ +#define GPR_C1EN 0x00000020 /* Pad 1 (power down) enable */ +#define GPR_C0EN 0x00000010 /* Pad 0 (reset) enable */ +#define GPR_C1 0x00000002 /* Control 1 value */ +/* + * Control 0 is wired to reset on OLPC machines. For ov7x sensors, + * it is active low, for 0v6x, instead, it's active high. What + * fun. + */ +#define GPR_C0 0x00000001 /* Control 0 value */ + +#define REG_TWSIC0 0xb8 /* TWSI (smbus) control 0 */ +#define TWSIC0_EN 0x00000001 /* TWSI enable */ +#define TWSIC0_MODE 0x00000002 /* 1 = 16-bit, 0 = 8-bit */ +#define TWSIC0_SID 0x000003fc /* Slave ID */ +#define TWSIC0_SID_SHIFT 2 +#define TWSIC0_CLKDIV 0x0007fc00 /* Clock divider */ +#define TWSIC0_MASKACK 0x00400000 /* Mask ack from sensor */ +#define TWSIC0_OVMAGIC 0x00800000 /* Make it work on OV sensors */ + +#define REG_TWSIC1 0xbc /* TWSI control 1 */ +#define TWSIC1_DATA 0x0000ffff /* Data to/from camchip */ +#define TWSIC1_ADDR 0x00ff0000 /* Address (register) */ +#define TWSIC1_ADDR_SHIFT 16 +#define TWSIC1_READ 0x01000000 /* Set for read op */ +#define TWSIC1_WSTAT 0x02000000 /* Write status */ +#define TWSIC1_RVALID 0x04000000 /* Read data valid */ +#define TWSIC1_ERROR 0x08000000 /* Something screwed up */ + + +#define REG_UBAR 0xc4 /* Upper base address register */ + +/* + * Here's the weird global control registers which are said to live + * way up here. + */ +#define REG_GL_CSR 0x3004 /* Control/status register */ +#define GCSR_SRS 0x00000001 /* SW Reset set */ +#define GCSR_SRC 0x00000002 /* SW Reset clear */ +#define GCSR_MRS 0x00000004 /* Master reset set */ +#define GCSR_MRC 0x00000008 /* HW Reset clear */ +#define GCSR_CCIC_EN 0x00004000 /* CCIC Clock enable */ +#define REG_GL_IMASK 0x300c /* Interrupt mask register */ +#define GIMSK_CCIC_EN 0x00000004 /* CCIC Interrupt enable */ + +#define REG_GL_FCR 0x3038 /* GPIO functional control register */ +#define GFCR_GPIO_ON 0x08 /* Camera GPIO enabled */ +#define REG_GL_GPIOR 0x315c /* GPIO register */ +#define GGPIO_OUT 0x80000 /* GPIO output */ +#define GGPIO_VAL 0x00008 /* Output pin value */ + +#define REG_LEN (REG_GL_IMASK + 4) + + +/* + * Useful stuff that probably belongs somewhere global. + */ +#define VGA_WIDTH 640 +#define VGA_HEIGHT 480 -- cgit v1.2.3 From 2164b5af1dd42ebb7b5aa6bbcf9d9c3c067db246 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Sat, 11 Jun 2011 14:46:44 -0300 Subject: [media] marvell-cam: Pass sensor parameters from the platform Depending on the controller, the ov7670 sensor may be told to work with a different clock speed or to use the SMBUS protocol. Remove the wired-in code and pass that information from the platform layer. The Cafe driver now just assumes it's running on an OLPC XO 1; I do not believe it has ever run anywhere else. Cc: Daniel Drake Signed-off-by: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/marvell-ccic/cafe-driver.c | 6 ++++++ drivers/media/video/marvell-ccic/mcam-core.c | 22 ++-------------------- drivers/media/video/marvell-ccic/mcam-core.h | 2 ++ 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/drivers/media/video/marvell-ccic/cafe-driver.c b/drivers/media/video/marvell-ccic/cafe-driver.c index 3f38f2a0643f..08edf950dabf 100644 --- a/drivers/media/video/marvell-ccic/cafe-driver.c +++ b/drivers/media/video/marvell-ccic/cafe-driver.c @@ -403,6 +403,12 @@ static int cafe_pci_probe(struct pci_dev *pdev, mcam->plat_power_up = cafe_ctlr_power_up; mcam->plat_power_down = cafe_ctlr_power_down; mcam->dev = &pdev->dev; + /* + * Set the clock speed for the XO 1; I don't believe this + * driver has ever run anywhere else. + */ + mcam->clock_speed = 45; + mcam->use_smbus = 1; /* * Get set up on the PCI bus. */ diff --git a/drivers/media/video/marvell-ccic/mcam-core.c b/drivers/media/video/marvell-ccic/mcam-core.c index 18fce9e69f38..0d6023435557 100644 --- a/drivers/media/video/marvell-ccic/mcam-core.c +++ b/drivers/media/video/marvell-ccic/mcam-core.c @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -1536,22 +1535,7 @@ int mccic_irq(struct mcam_camera *cam, unsigned int irqs) * Registration and such. */ -/* FIXME this is really platform stuff */ -static const struct dmi_system_id olpc_xo1_dmi[] = { - { - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "OLPC"), - DMI_MATCH(DMI_PRODUCT_NAME, "XO"), - DMI_MATCH(DMI_PRODUCT_VERSION, "1"), - }, - }, - { } -}; - static struct ov7670_config sensor_cfg = { - /* This controller only does SMBUS */ - .use_smbus = true, - /* * Exclude QCIF mode, because it only captures a tiny portion * of the sensor FOV @@ -1590,13 +1574,11 @@ int mccic_register(struct mcam_camera *cam) mcam_ctlr_init(cam); - /* Apply XO-1 clock speed */ - if (dmi_check_system(olpc_xo1_dmi)) - sensor_cfg.clock_speed = 45; - /* * Try to find the sensor. */ + sensor_cfg.clock_speed = cam->clock_speed; + sensor_cfg.use_smbus = cam->use_smbus; cam->sensor_addr = ov7670_info.addr; cam->sensor = v4l2_i2c_new_subdev_board(&cam->v4l2_dev, &cam->i2c_adapter, &ov7670_info, NULL); diff --git a/drivers/media/video/marvell-ccic/mcam-core.h b/drivers/media/video/marvell-ccic/mcam-core.h index 0b55b8e6bb7e..21485e7ec8f2 100644 --- a/drivers/media/video/marvell-ccic/mcam-core.h +++ b/drivers/media/video/marvell-ccic/mcam-core.h @@ -42,6 +42,8 @@ struct mcam_camera { spinlock_t dev_lock; struct device *dev; /* For messages, dma alloc */ unsigned int chip_id; + short int clock_speed; /* Sensor clock speed, default 30 */ + short int use_smbus; /* SMBUS or straight I2c? */ /* * Callbacks from the core to the platform code. -- cgit v1.2.3 From 9eefa7dc0136bec7739f42b0630c46cd02af377b Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Sat, 11 Jun 2011 14:46:45 -0300 Subject: [media] marvell-cam: Remove the "untested" comment This code is, indeed, tested :) Signed-off-by: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/marvell-ccic/cafe-driver.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/media/video/marvell-ccic/cafe-driver.c b/drivers/media/video/marvell-ccic/cafe-driver.c index 08edf950dabf..91ba74b3f55a 100644 --- a/drivers/media/video/marvell-ccic/cafe-driver.c +++ b/drivers/media/video/marvell-ccic/cafe-driver.c @@ -14,9 +14,6 @@ * v4l2_device/v4l2_subdev conversion by: * Copyright (C) 2009 Hans Verkuil * - * Note: this conversion is untested! Please contact the linux-media - * mailinglist if you can test this, together with the test results. - * * This file may be distributed under the terms of the GNU General * Public License, version 2. */ -- cgit v1.2.3 From f8ff6a96cd6e9f7dc8b606f302129f99bcb82674 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Sat, 11 Jun 2011 14:46:46 -0300 Subject: [media] marvell-cam: Move Cafe-specific register definitions to cafe-driver.c Nobody else ever needs to see these, so let's hide them. Signed-off-by: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/marvell-ccic/cafe-driver.c | 63 ++++++++++++++++++++++++++ drivers/media/video/marvell-ccic/mcam-core.h | 56 +---------------------- 2 files changed, 64 insertions(+), 55 deletions(-) diff --git a/drivers/media/video/marvell-ccic/cafe-driver.c b/drivers/media/video/marvell-ccic/cafe-driver.c index 91ba74b3f55a..1027265d46ab 100644 --- a/drivers/media/video/marvell-ccic/cafe-driver.c +++ b/drivers/media/video/marvell-ccic/cafe-driver.c @@ -56,6 +56,69 @@ struct cafe_camera { wait_queue_head_t smbus_wait; /* Waiting on i2c events */ }; +/* + * Most of the camera controller registers are defined in mcam-core.h, + * but the Cafe platform has some additional registers of its own; + * they are described here. + */ + +/* + * "General purpose register" has a couple of GPIOs used for sensor + * power and reset on OLPC XO 1.0 systems. + */ +#define REG_GPR 0xb4 +#define GPR_C1EN 0x00000020 /* Pad 1 (power down) enable */ +#define GPR_C0EN 0x00000010 /* Pad 0 (reset) enable */ +#define GPR_C1 0x00000002 /* Control 1 value */ +/* + * Control 0 is wired to reset on OLPC machines. For ov7x sensors, + * it is active low. + */ +#define GPR_C0 0x00000001 /* Control 0 value */ + +/* + * These registers control the SMBUS module for communicating + * with the sensor. + */ +#define REG_TWSIC0 0xb8 /* TWSI (smbus) control 0 */ +#define TWSIC0_EN 0x00000001 /* TWSI enable */ +#define TWSIC0_MODE 0x00000002 /* 1 = 16-bit, 0 = 8-bit */ +#define TWSIC0_SID 0x000003fc /* Slave ID */ +#define TWSIC0_SID_SHIFT 2 +#define TWSIC0_CLKDIV 0x0007fc00 /* Clock divider */ +#define TWSIC0_MASKACK 0x00400000 /* Mask ack from sensor */ +#define TWSIC0_OVMAGIC 0x00800000 /* Make it work on OV sensors */ + +#define REG_TWSIC1 0xbc /* TWSI control 1 */ +#define TWSIC1_DATA 0x0000ffff /* Data to/from camchip */ +#define TWSIC1_ADDR 0x00ff0000 /* Address (register) */ +#define TWSIC1_ADDR_SHIFT 16 +#define TWSIC1_READ 0x01000000 /* Set for read op */ +#define TWSIC1_WSTAT 0x02000000 /* Write status */ +#define TWSIC1_RVALID 0x04000000 /* Read data valid */ +#define TWSIC1_ERROR 0x08000000 /* Something screwed up */ + +/* + * Here's the weird global control registers + */ +#define REG_GL_CSR 0x3004 /* Control/status register */ +#define GCSR_SRS 0x00000001 /* SW Reset set */ +#define GCSR_SRC 0x00000002 /* SW Reset clear */ +#define GCSR_MRS 0x00000004 /* Master reset set */ +#define GCSR_MRC 0x00000008 /* HW Reset clear */ +#define GCSR_CCIC_EN 0x00004000 /* CCIC Clock enable */ +#define REG_GL_IMASK 0x300c /* Interrupt mask register */ +#define GIMSK_CCIC_EN 0x00000004 /* CCIC Interrupt enable */ + +#define REG_GL_FCR 0x3038 /* GPIO functional control register */ +#define GFCR_GPIO_ON 0x08 /* Camera GPIO enabled */ +#define REG_GL_GPIOR 0x315c /* GPIO register */ +#define GGPIO_OUT 0x80000 /* GPIO output */ +#define GGPIO_VAL 0x00008 /* Output pin value */ + +#define REG_LEN (REG_GL_IMASK + 4) + + /* * Debugging and related. */ diff --git a/drivers/media/video/marvell-ccic/mcam-core.h b/drivers/media/video/marvell-ccic/mcam-core.h index 21485e7ec8f2..e8a7de05100b 100644 --- a/drivers/media/video/marvell-ccic/mcam-core.h +++ b/drivers/media/video/marvell-ccic/mcam-core.h @@ -249,63 +249,9 @@ int mccic_resume(struct mcam_camera *cam); #define REG_CLKCTRL 0x88 /* Clock control */ #define CLK_DIV_MASK 0x0000ffff /* Upper bits RW "reserved" */ -#define REG_GPR 0xb4 /* General purpose register. This - controls inputs to the power and reset - pins on the OV7670 used with OLPC; - other deployments could differ. */ -#define GPR_C1EN 0x00000020 /* Pad 1 (power down) enable */ -#define GPR_C0EN 0x00000010 /* Pad 0 (reset) enable */ -#define GPR_C1 0x00000002 /* Control 1 value */ -/* - * Control 0 is wired to reset on OLPC machines. For ov7x sensors, - * it is active low, for 0v6x, instead, it's active high. What - * fun. - */ -#define GPR_C0 0x00000001 /* Control 0 value */ - -#define REG_TWSIC0 0xb8 /* TWSI (smbus) control 0 */ -#define TWSIC0_EN 0x00000001 /* TWSI enable */ -#define TWSIC0_MODE 0x00000002 /* 1 = 16-bit, 0 = 8-bit */ -#define TWSIC0_SID 0x000003fc /* Slave ID */ -#define TWSIC0_SID_SHIFT 2 -#define TWSIC0_CLKDIV 0x0007fc00 /* Clock divider */ -#define TWSIC0_MASKACK 0x00400000 /* Mask ack from sensor */ -#define TWSIC0_OVMAGIC 0x00800000 /* Make it work on OV sensors */ - -#define REG_TWSIC1 0xbc /* TWSI control 1 */ -#define TWSIC1_DATA 0x0000ffff /* Data to/from camchip */ -#define TWSIC1_ADDR 0x00ff0000 /* Address (register) */ -#define TWSIC1_ADDR_SHIFT 16 -#define TWSIC1_READ 0x01000000 /* Set for read op */ -#define TWSIC1_WSTAT 0x02000000 /* Write status */ -#define TWSIC1_RVALID 0x04000000 /* Read data valid */ -#define TWSIC1_ERROR 0x08000000 /* Something screwed up */ - - +/* This appears to be a Cafe-only register */ #define REG_UBAR 0xc4 /* Upper base address register */ -/* - * Here's the weird global control registers which are said to live - * way up here. - */ -#define REG_GL_CSR 0x3004 /* Control/status register */ -#define GCSR_SRS 0x00000001 /* SW Reset set */ -#define GCSR_SRC 0x00000002 /* SW Reset clear */ -#define GCSR_MRS 0x00000004 /* Master reset set */ -#define GCSR_MRC 0x00000008 /* HW Reset clear */ -#define GCSR_CCIC_EN 0x00004000 /* CCIC Clock enable */ -#define REG_GL_IMASK 0x300c /* Interrupt mask register */ -#define GIMSK_CCIC_EN 0x00000004 /* CCIC Interrupt enable */ - -#define REG_GL_FCR 0x3038 /* GPIO functional control register */ -#define GFCR_GPIO_ON 0x08 /* Camera GPIO enabled */ -#define REG_GL_GPIOR 0x315c /* GPIO register */ -#define GGPIO_OUT 0x80000 /* GPIO output */ -#define GGPIO_VAL 0x00008 /* Output pin value */ - -#define REG_LEN (REG_GL_IMASK + 4) - - /* * Useful stuff that probably belongs somewhere global. */ -- cgit v1.2.3 From 1c68f889c3287bd9beedd23164804e7e09c6566b Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Sat, 11 Jun 2011 14:46:47 -0300 Subject: [media] marvell-cam: Right-shift i2c slave ID's in the cafe driver This makes the cafe i2c implement consistent with the rest of Linux so that the core can use the same slave ID everywhere. Signed-off-by: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/marvell-ccic/cafe-driver.c | 9 ++++++++- drivers/media/video/marvell-ccic/mcam-core.c | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/marvell-ccic/cafe-driver.c b/drivers/media/video/marvell-ccic/cafe-driver.c index 1027265d46ab..3dbc7e55499d 100644 --- a/drivers/media/video/marvell-ccic/cafe-driver.c +++ b/drivers/media/video/marvell-ccic/cafe-driver.c @@ -84,7 +84,14 @@ struct cafe_camera { #define TWSIC0_EN 0x00000001 /* TWSI enable */ #define TWSIC0_MODE 0x00000002 /* 1 = 16-bit, 0 = 8-bit */ #define TWSIC0_SID 0x000003fc /* Slave ID */ -#define TWSIC0_SID_SHIFT 2 +/* + * Subtle trickery: the slave ID field starts with bit 2. But the + * Linux i2c stack wants to treat the bottommost bit as a separate + * read/write bit, which is why slave ID's are usually presented + * >>1. For consistency with that behavior, we shift over three + * bits instead of two. + */ +#define TWSIC0_SID_SHIFT 3 #define TWSIC0_CLKDIV 0x0007fc00 /* Clock divider */ #define TWSIC0_MASKACK 0x00400000 /* Mask ack from sensor */ #define TWSIC0_OVMAGIC 0x00800000 /* Make it work on OV sensors */ diff --git a/drivers/media/video/marvell-ccic/mcam-core.c b/drivers/media/video/marvell-ccic/mcam-core.c index 0d6023435557..d5f18a300094 100644 --- a/drivers/media/video/marvell-ccic/mcam-core.c +++ b/drivers/media/video/marvell-ccic/mcam-core.c @@ -1549,7 +1549,7 @@ int mccic_register(struct mcam_camera *cam) { struct i2c_board_info ov7670_info = { .type = "ov7670", - .addr = 0x42, + .addr = 0x42 >> 1, .platform_data = &sensor_cfg, }; int ret; -- cgit v1.2.3 From 595a93a47a3b7dc1be84160fbd73b1406074f411 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Sat, 11 Jun 2011 14:46:48 -0300 Subject: [media] marvell-cam: Allocate the i2c adapter in the platform driver The upcoming mmp-camera driver will need an i2c_adapter structure allocated externally, so change the core adapter to a pointer and require the platform code to fill it in. Signed-off-by: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/marvell-ccic/cafe-driver.c | 9 +++++++-- drivers/media/video/marvell-ccic/mcam-core.c | 2 +- drivers/media/video/marvell-ccic/mcam-core.h | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/marvell-ccic/cafe-driver.c b/drivers/media/video/marvell-ccic/cafe-driver.c index 3dbc7e55499d..6a29cc1c45a5 100644 --- a/drivers/media/video/marvell-ccic/cafe-driver.c +++ b/drivers/media/video/marvell-ccic/cafe-driver.c @@ -334,9 +334,13 @@ static struct i2c_algorithm cafe_smbus_algo = { static int cafe_smbus_setup(struct cafe_camera *cam) { - struct i2c_adapter *adap = &cam->mcam.i2c_adapter; + struct i2c_adapter *adap; int ret; + adap = kzalloc(sizeof(*adap), GFP_KERNEL); + if (adap == NULL) + return -ENOMEM; + cam->mcam.i2c_adapter = adap; cafe_smbus_enable_irq(cam); adap->owner = THIS_MODULE; adap->algo = &cafe_smbus_algo; @@ -351,7 +355,8 @@ static int cafe_smbus_setup(struct cafe_camera *cam) static void cafe_smbus_shutdown(struct cafe_camera *cam) { - i2c_del_adapter(&cam->mcam.i2c_adapter); + i2c_del_adapter(cam->mcam.i2c_adapter); + kfree(cam->mcam.i2c_adapter); } diff --git a/drivers/media/video/marvell-ccic/mcam-core.c b/drivers/media/video/marvell-ccic/mcam-core.c index d5f18a300094..014b70b5a9b8 100644 --- a/drivers/media/video/marvell-ccic/mcam-core.c +++ b/drivers/media/video/marvell-ccic/mcam-core.c @@ -1581,7 +1581,7 @@ int mccic_register(struct mcam_camera *cam) sensor_cfg.use_smbus = cam->use_smbus; cam->sensor_addr = ov7670_info.addr; cam->sensor = v4l2_i2c_new_subdev_board(&cam->v4l2_dev, - &cam->i2c_adapter, &ov7670_info, NULL); + cam->i2c_adapter, &ov7670_info, NULL); if (cam->sensor == NULL) { ret = -ENODEV; goto out_unregister; diff --git a/drivers/media/video/marvell-ccic/mcam-core.h b/drivers/media/video/marvell-ccic/mcam-core.h index e8a7de05100b..5effa8203412 100644 --- a/drivers/media/video/marvell-ccic/mcam-core.h +++ b/drivers/media/video/marvell-ccic/mcam-core.h @@ -37,7 +37,7 @@ struct mcam_camera { * These fields should be set by the platform code prior to * calling mcam_register(). */ - struct i2c_adapter i2c_adapter; + struct i2c_adapter *i2c_adapter; unsigned char __iomem *regs; spinlock_t dev_lock; struct device *dev; /* For messages, dma alloc */ -- cgit v1.2.3 From 67a8dbbc4e04cd256987b189352472a59aff73be Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Sat, 11 Jun 2011 14:46:49 -0300 Subject: [media] marvell-cam: Basic working MMP camera driver Now we have a camera working over the marvell cam controller core. It works like the cafe driver and has all the same limitations, contiguous DMA only being one of them. But it's a start. Signed-off-by: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/Makefile | 1 + drivers/media/video/marvell-ccic/Kconfig | 11 + drivers/media/video/marvell-ccic/Makefile | 4 + drivers/media/video/marvell-ccic/mcam-core.c | 28 ++- drivers/media/video/marvell-ccic/mmp-driver.c | 339 ++++++++++++++++++++++++++ include/media/mmp-camera.h | 9 + include/media/v4l2-chip-ident.h | 3 +- 7 files changed, 386 insertions(+), 9 deletions(-) create mode 100644 drivers/media/video/marvell-ccic/mmp-driver.c create mode 100644 include/media/mmp-camera.h diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 42b6a7a64821..89478f01731b 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -128,6 +128,7 @@ obj-$(CONFIG_VIDEO_M32R_AR_M64278) += arv.o obj-$(CONFIG_VIDEO_CX2341X) += cx2341x.o obj-$(CONFIG_VIDEO_CAFE_CCIC) += marvell-ccic/ +obj-$(CONFIG_VIDEO_MMP_CAMERA) += marvell-ccic/ obj-$(CONFIG_VIDEO_VIA_CAMERA) += via-camera.o diff --git a/drivers/media/video/marvell-ccic/Kconfig b/drivers/media/video/marvell-ccic/Kconfig index 80136a8771e7..b4f72605997c 100644 --- a/drivers/media/video/marvell-ccic/Kconfig +++ b/drivers/media/video/marvell-ccic/Kconfig @@ -7,3 +7,14 @@ config VIDEO_CAFE_CCIC CMOS camera controller. This is the controller found on first- generation OLPC systems. +config VIDEO_MMP_CAMERA + tristate "Marvell Armada 610 integrated camera controller support" + depends on ARCH_MMP && I2C && VIDEO_V4L2 + select VIDEO_OV7670 + select I2C_GPIO + ---help--- + This is a Video4Linux2 driver for the integrated camera + controller found on Marvell Armada 610 application + processors (and likely beyond). This is the controller found + in OLPC XO 1.75 systems. + diff --git a/drivers/media/video/marvell-ccic/Makefile b/drivers/media/video/marvell-ccic/Makefile index 462b385c6234..05a792c579a2 100644 --- a/drivers/media/video/marvell-ccic/Makefile +++ b/drivers/media/video/marvell-ccic/Makefile @@ -1,2 +1,6 @@ obj-$(CONFIG_VIDEO_CAFE_CCIC) += cafe_ccic.o cafe_ccic-y := cafe-driver.o mcam-core.o + +obj-$(CONFIG_VIDEO_MMP_CAMERA) += mmp_camera.o +mmp_camera-y := mmp-driver.o mcam-core.o + diff --git a/drivers/media/video/marvell-ccic/mcam-core.c b/drivers/media/video/marvell-ccic/mcam-core.c index 014b70b5a9b8..3e6a5e8b0cd1 100644 --- a/drivers/media/video/marvell-ccic/mcam-core.c +++ b/drivers/media/video/marvell-ccic/mcam-core.c @@ -167,7 +167,7 @@ static void mcam_set_config_needed(struct mcam_camera *cam, int needed) /* - * Debugging and related. FIXME these are broken + * Debugging and related. */ #define cam_err(cam, fmt, arg...) \ dev_err((cam)->dev, fmt, ##arg); @@ -202,7 +202,8 @@ static void mcam_ctlr_dma(struct mcam_camera *cam) mcam_reg_clear_bit(cam, REG_CTRL1, C1_TWOBUFS); } else mcam_reg_set_bit(cam, REG_CTRL1, C1_TWOBUFS); - mcam_reg_write(cam, REG_UBAR, 0); /* 32 bits only for now */ + if (cam->chip_id == V4L2_IDENT_CAFE) + mcam_reg_write(cam, REG_UBAR, 0); /* 32 bits only */ } static void mcam_ctlr_image(struct mcam_camera *cam) @@ -358,8 +359,8 @@ static void mcam_ctlr_power_up(struct mcam_camera *cam) unsigned long flags; spin_lock_irqsave(&cam->dev_lock, flags); - mcam_reg_clear_bit(cam, REG_CTRL1, C1_PWRDWN); cam->plat_power_up(cam); + mcam_reg_clear_bit(cam, REG_CTRL1, C1_PWRDWN); spin_unlock_irqrestore(&cam->dev_lock, flags); msleep(5); /* Just to be sure */ } @@ -369,8 +370,13 @@ static void mcam_ctlr_power_down(struct mcam_camera *cam) unsigned long flags; spin_lock_irqsave(&cam->dev_lock, flags); - cam->plat_power_down(cam); + /* + * School of hard knocks department: be sure we do any register + * twiddling on the controller *before* calling the platform + * power down routine. + */ mcam_reg_set_bit(cam, REG_CTRL1, C1_PWRDWN); + cam->plat_power_down(cam); spin_unlock_irqrestore(&cam->dev_lock, flags); } @@ -1622,14 +1628,20 @@ out_unregister: void mccic_shutdown(struct mcam_camera *cam) { - if (cam->users > 0) + /* + * If we have no users (and we really, really should have no + * users) the device will already be powered down. Trying to + * take it down again will wedge the machine, which is frowned + * upon. + */ + if (cam->users > 0) { cam_warn(cam, "Removing a device with users!\n"); + mcam_ctlr_power_down(cam); + } + mcam_free_dma_bufs(cam); if (cam->n_sbufs > 0) /* What if they are still mapped? Shouldn't be, but... */ mcam_free_sio_buffers(cam); - mcam_ctlr_stop_dma(cam); - mcam_ctlr_power_down(cam); - mcam_free_dma_bufs(cam); video_unregister_device(&cam->vdev); v4l2_device_unregister(&cam->v4l2_dev); } diff --git a/drivers/media/video/marvell-ccic/mmp-driver.c b/drivers/media/video/marvell-ccic/mmp-driver.c new file mode 100644 index 000000000000..ac9976f23a61 --- /dev/null +++ b/drivers/media/video/marvell-ccic/mmp-driver.c @@ -0,0 +1,339 @@ +/* + * Support for the camera device found on Marvell MMP processors; known + * to work with the Armada 610 as used in the OLPC 1.75 system. + * + * Copyright 2011 Jonathan Corbet + * + * This file may be distributed under the terms of the GNU General + * Public License, version 2. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mcam-core.h" + +MODULE_AUTHOR("Jonathan Corbet "); +MODULE_LICENSE("GPL"); + +struct mmp_camera { + void *power_regs; + struct platform_device *pdev; + struct mcam_camera mcam; + struct list_head devlist; + int irq; +}; + +static inline struct mmp_camera *mcam_to_cam(struct mcam_camera *mcam) +{ + return container_of(mcam, struct mmp_camera, mcam); +} + +/* + * A silly little infrastructure so we can keep track of our devices. + * Chances are that we will never have more than one of them, but + * the Armada 610 *does* have two controllers... + */ + +static LIST_HEAD(mmpcam_devices); +static struct mutex mmpcam_devices_lock; + +static void mmpcam_add_device(struct mmp_camera *cam) +{ + mutex_lock(&mmpcam_devices_lock); + list_add(&cam->devlist, &mmpcam_devices); + mutex_unlock(&mmpcam_devices_lock); +} + +static void mmpcam_remove_device(struct mmp_camera *cam) +{ + mutex_lock(&mmpcam_devices_lock); + list_del(&cam->devlist); + mutex_unlock(&mmpcam_devices_lock); +} + +/* + * Platform dev remove passes us a platform_device, and there's + * no handy unused drvdata to stash a backpointer in. So just + * dig it out of our list. + */ +static struct mmp_camera *mmpcam_find_device(struct platform_device *pdev) +{ + struct mmp_camera *cam; + + mutex_lock(&mmpcam_devices_lock); + list_for_each_entry(cam, &mmpcam_devices, devlist) { + if (cam->pdev == pdev) { + mutex_unlock(&mmpcam_devices_lock); + return cam; + } + } + mutex_unlock(&mmpcam_devices_lock); + return NULL; +} + + + + +/* + * Power-related registers; this almost certainly belongs + * somewhere else. + * + * ARMADA 610 register manual, sec 7.2.1, p1842. + */ +#define CPU_SUBSYS_PMU_BASE 0xd4282800 +#define REG_CCIC_DCGCR 0x28 /* CCIC dyn clock gate ctrl reg */ +#define REG_CCIC_CRCR 0x50 /* CCIC clk reset ctrl reg */ + +/* + * Power control. + */ +static void mmpcam_power_up(struct mcam_camera *mcam) +{ + struct mmp_camera *cam = mcam_to_cam(mcam); + struct mmp_camera_platform_data *pdata; +/* + * Turn on power and clocks to the controller. + */ + iowrite32(0x3f, cam->power_regs + REG_CCIC_DCGCR); + iowrite32(0x3805b, cam->power_regs + REG_CCIC_CRCR); + mdelay(1); +/* + * Provide power to the sensor. + */ + mcam_reg_write(mcam, REG_CLKCTRL, 0x60000002); + pdata = cam->pdev->dev.platform_data; + gpio_set_value(pdata->sensor_power_gpio, 1); + mdelay(5); + mcam_reg_clear_bit(mcam, REG_CTRL1, 0x10000000); + gpio_set_value(pdata->sensor_reset_gpio, 0); /* reset is active low */ + mdelay(5); + gpio_set_value(pdata->sensor_reset_gpio, 1); /* reset is active low */ + mdelay(5); +} + +static void mmpcam_power_down(struct mcam_camera *mcam) +{ + struct mmp_camera *cam = mcam_to_cam(mcam); + struct mmp_camera_platform_data *pdata; +/* + * Turn off clocks and set reset lines + */ + iowrite32(0, cam->power_regs + REG_CCIC_DCGCR); + iowrite32(0, cam->power_regs + REG_CCIC_CRCR); +/* + * Shut down the sensor. + */ + pdata = cam->pdev->dev.platform_data; + gpio_set_value(pdata->sensor_power_gpio, 0); + gpio_set_value(pdata->sensor_reset_gpio, 0); +} + + +static irqreturn_t mmpcam_irq(int irq, void *data) +{ + struct mcam_camera *mcam = data; + unsigned int irqs, handled; + + spin_lock(&mcam->dev_lock); + irqs = mcam_reg_read(mcam, REG_IRQSTAT); + handled = mccic_irq(mcam, irqs); + spin_unlock(&mcam->dev_lock); + return IRQ_RETVAL(handled); +} + + +static int mmpcam_probe(struct platform_device *pdev) +{ + struct mmp_camera *cam; + struct mcam_camera *mcam; + struct resource *res; + struct mmp_camera_platform_data *pdata; + int ret; + + cam = kzalloc(sizeof(*cam), GFP_KERNEL); + if (cam == NULL) + return -ENOMEM; + cam->pdev = pdev; + INIT_LIST_HEAD(&cam->devlist); + + mcam = &cam->mcam; + mcam->platform = MHP_Armada610; + mcam->plat_power_up = mmpcam_power_up; + mcam->plat_power_down = mmpcam_power_down; + mcam->dev = &pdev->dev; + mcam->use_smbus = 0; + mcam->chip_id = V4L2_IDENT_ARMADA610; + spin_lock_init(&mcam->dev_lock); + /* + * Get our I/O memory. + */ + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (res == NULL) { + dev_err(&pdev->dev, "no iomem resource!\n"); + ret = -ENODEV; + goto out_free; + } + mcam->regs = ioremap(res->start, resource_size(res)); + if (mcam->regs == NULL) { + dev_err(&pdev->dev, "MMIO ioremap fail\n"); + ret = -ENODEV; + goto out_free; + } + /* + * Power/clock memory is elsewhere; get it too. Perhaps this + * should really be managed outside of this driver? + */ + res = platform_get_resource(pdev, IORESOURCE_MEM, 1); + if (res == NULL) { + dev_err(&pdev->dev, "no power resource!\n"); + ret = -ENODEV; + goto out_unmap1; + } + cam->power_regs = ioremap(res->start, resource_size(res)); + if (cam->power_regs == NULL) { + dev_err(&pdev->dev, "power MMIO ioremap fail\n"); + ret = -ENODEV; + goto out_unmap1; + } + /* + * Find the i2c adapter. This assumes, of course, that the + * i2c bus is already up and functioning. + */ + pdata = pdev->dev.platform_data; + mcam->i2c_adapter = platform_get_drvdata(pdata->i2c_device); + if (mcam->i2c_adapter == NULL) { + ret = -ENODEV; + dev_err(&pdev->dev, "No i2c adapter\n"); + goto out_unmap2; + } + /* + * Sensor GPIO pins. + */ + ret = gpio_request(pdata->sensor_power_gpio, "cam-power"); + if (ret) { + dev_err(&pdev->dev, "Can't get sensor power gpio %d", + pdata->sensor_power_gpio); + goto out_unmap2; + } + gpio_direction_output(pdata->sensor_power_gpio, 0); + ret = gpio_request(pdata->sensor_reset_gpio, "cam-reset"); + if (ret) { + dev_err(&pdev->dev, "Can't get sensor reset gpio %d", + pdata->sensor_reset_gpio); + goto out_gpio; + } + gpio_direction_output(pdata->sensor_reset_gpio, 0); + /* + * Power the device up and hand it off to the core. + */ + mmpcam_power_up(mcam); + ret = mccic_register(mcam); + if (ret) + goto out_gpio2; + /* + * Finally, set up our IRQ now that the core is ready to + * deal with it. + */ + res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); + if (res == NULL) { + ret = -ENODEV; + goto out_unregister; + } + cam->irq = res->start; + ret = request_irq(cam->irq, mmpcam_irq, IRQF_SHARED, + "mmp-camera", mcam); + if (ret == 0) { + mmpcam_add_device(cam); + return 0; + } + +out_unregister: + mccic_shutdown(mcam); + mmpcam_power_down(mcam); +out_gpio2: + gpio_free(pdata->sensor_reset_gpio); +out_gpio: + gpio_free(pdata->sensor_power_gpio); +out_unmap2: + iounmap(cam->power_regs); +out_unmap1: + iounmap(mcam->regs); +out_free: + kfree(cam); + return ret; +} + + +static int mmpcam_remove(struct mmp_camera *cam) +{ + struct mcam_camera *mcam = &cam->mcam; + struct mmp_camera_platform_data *pdata; + + mmpcam_remove_device(cam); + free_irq(cam->irq, mcam); + mccic_shutdown(mcam); + mmpcam_power_down(mcam); + pdata = cam->pdev->dev.platform_data; + gpio_free(pdata->sensor_reset_gpio); + gpio_free(pdata->sensor_power_gpio); + iounmap(cam->power_regs); + iounmap(mcam->regs); + kfree(cam); + return 0; +} + +static int mmpcam_platform_remove(struct platform_device *pdev) +{ + struct mmp_camera *cam = mmpcam_find_device(pdev); + + if (cam == NULL) + return -ENODEV; + return mmpcam_remove(cam); +} + + +static struct platform_driver mmpcam_driver = { + .probe = mmpcam_probe, + .remove = mmpcam_platform_remove, + .driver = { + .name = "mmp-camera", + .owner = THIS_MODULE + } +}; + + +static int __init mmpcam_init_module(void) +{ + mutex_init(&mmpcam_devices_lock); + return platform_driver_register(&mmpcam_driver); +} + +static void __exit mmpcam_exit_module(void) +{ + platform_driver_unregister(&mmpcam_driver); + /* + * platform_driver_unregister() should have emptied the list + */ + if (!list_empty(&mmpcam_devices)) + printk(KERN_ERR "mmp_camera leaving devices behind\n"); +} + +module_init(mmpcam_init_module); +module_exit(mmpcam_exit_module); diff --git a/include/media/mmp-camera.h b/include/media/mmp-camera.h new file mode 100644 index 000000000000..7611963a257f --- /dev/null +++ b/include/media/mmp-camera.h @@ -0,0 +1,9 @@ +/* + * Information for the Marvell Armada MMP camera + */ + +struct mmp_camera_platform_data { + struct platform_device *i2c_device; + int sensor_power_gpio; + int sensor_reset_gpio; +}; diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h index b3edb67a8311..8717045e4aec 100644 --- a/include/media/v4l2-chip-ident.h +++ b/include/media/v4l2-chip-ident.h @@ -185,8 +185,9 @@ enum { /* module wm8775: just ident 8775 */ V4L2_IDENT_WM8775 = 8775, - /* module cafe_ccic, just ident 8801 */ + /* Marvell controllers starting at 8801 */ V4L2_IDENT_CAFE = 8801, + V4L2_IDENT_ARMADA610 = 8802, /* AKM AK8813/AK8814 */ V4L2_IDENT_AK8813 = 8813, -- cgit v1.2.3 From 00d2e7ad9dd4e88224d091e454371d8a9a80719f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 17 Jun 2011 20:28:51 -0300 Subject: [media] em28xx: Don't initialize a var if won't be using it Fixes most cases of initializing a var but not using it. There are still 3 cases at em28xx-alsa, were those vars should probably be used. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-audio.c | 9 +++++---- drivers/media/video/em28xx/em28xx-cards.c | 3 +-- drivers/media/video/em28xx/em28xx-core.c | 4 ++-- drivers/media/video/em28xx/em28xx-i2c.c | 2 -- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c index 3c48a72eb7de..a24e1770db48 100644 --- a/drivers/media/video/em28xx/em28xx-audio.c +++ b/drivers/media/video/em28xx/em28xx-audio.c @@ -286,10 +286,9 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream *substream) runtime->hw = snd_em28xx_hw_capture; if (dev->alt == 0 && dev->adev.users == 0) { - int errCode; dev->alt = 7; dprintk("changing alternate number to 7\n"); - errCode = usb_set_interface(dev->udev, 0, 7); + usb_set_interface(dev->udev, 0, 7); } dev->adev.users++; @@ -342,6 +341,8 @@ static int snd_em28xx_hw_capture_params(struct snd_pcm_substream *substream, ret = snd_pcm_alloc_vmalloc_buffer(substream, params_buffer_bytes(hw_params)); + if (ret < 0) + return ret; format = params_format(hw_params); rate = params_rate(hw_params); channels = params_channels(hw_params); @@ -393,7 +394,7 @@ static int snd_em28xx_capture_trigger(struct snd_pcm_substream *substream, int cmd) { struct em28xx *dev = snd_pcm_substream_chip(substream); - int retval; + int retval = 0; switch (cmd) { case SNDRV_PCM_TRIGGER_START: @@ -406,7 +407,7 @@ static int snd_em28xx_capture_trigger(struct snd_pcm_substream *substream, retval = -EINVAL; } schedule_work(&dev->wq_trigger); - return 0; + return retval; } static snd_pcm_uframes_t snd_em28xx_capture_pointer(struct snd_pcm_substream diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 7635a45a1220..bbd67d754b59 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -2660,10 +2660,9 @@ void em28xx_card_setup(struct em28xx *dev) .addr = 0xba >> 1, .platform_data = &pdata, }; - struct v4l2_subdev *sd; pdata.xtal = dev->sensor_xtal; - sd = v4l2_i2c_new_subdev_board(&dev->v4l2_dev, &dev->i2c_adap, + v4l2_i2c_new_subdev_board(&dev->v4l2_dev, &dev->i2c_adap, &mt9v011_info, NULL); } diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index e33f145d867a..55d0d9d1019f 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -917,7 +917,7 @@ EXPORT_SYMBOL_GPL(em28xx_set_mode); static void em28xx_irq_callback(struct urb *urb) { struct em28xx *dev = urb->context; - int rc, i; + int i; switch (urb->status) { case 0: /* success */ @@ -934,7 +934,7 @@ static void em28xx_irq_callback(struct urb *urb) /* Copy data from URB */ spin_lock(&dev->slock); - rc = dev->isoc_ctl.isoc_copy(dev, urb); + dev->isoc_ctl.isoc_copy(dev, urb); spin_unlock(&dev->slock); /* Reset urb buffers */ diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index 4739fc7e6eb3..4ece6856fba0 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c @@ -218,9 +218,7 @@ static int em28xx_i2c_recv_bytes(struct em28xx *dev, unsigned char addr, */ static int em28xx_i2c_check_for_device(struct em28xx *dev, unsigned char addr) { - char msg; int ret; - msg = addr; ret = dev->em28xx_read_reg_req(dev, 2, addr); if (ret < 0) { -- cgit v1.2.3 From 0f8a61fc42a618e25c61549590c35c66c63e2ca7 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 18 Jun 2011 07:02:49 -0300 Subject: [media] em28xx: Fix a wrong enum at the ac97 control tables Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-core.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 55d0d9d1019f..7bf3a86902b0 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -314,12 +314,12 @@ int em28xx_write_ac97(struct em28xx *dev, u8 reg, u16 val) return 0; } -struct em28xx_vol_table { +struct em28xx_vol_itable { enum em28xx_amux mux; u8 reg; }; -static struct em28xx_vol_table inputs[] = { +static struct em28xx_vol_itable inputs[] = { { EM28XX_AMUX_VIDEO, AC97_VIDEO_VOL }, { EM28XX_AMUX_LINE_IN, AC97_LINEIN_VOL }, { EM28XX_AMUX_PHONE, AC97_PHONE_VOL }, @@ -403,7 +403,12 @@ static int em28xx_set_audio_source(struct em28xx *dev) return ret; } -static const struct em28xx_vol_table outputs[] = { +struct em28xx_vol_otable { + enum em28xx_aout mux; + u8 reg; +}; + +static const struct em28xx_vol_otable outputs[] = { { EM28XX_AOUT_MASTER, AC97_MASTER_VOL }, { EM28XX_AOUT_LINE, AC97_LINE_LEVEL_VOL }, { EM28XX_AOUT_MONO, AC97_MASTER_MONO_VOL }, -- cgit v1.2.3 From 5b89ecf98998911f397fa913b06ee2304a373e54 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 18 Jun 2011 10:19:11 -0300 Subject: [media] em28xx: Allow to compile it without RC/input support Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/Kconfig | 10 +++++++++- drivers/media/video/em28xx/Makefile | 6 ++++-- drivers/media/video/em28xx/em28xx.h | 17 +++++++++++++++++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/em28xx/Kconfig b/drivers/media/video/em28xx/Kconfig index 3cb78f26df90..49878fd0c8f4 100644 --- a/drivers/media/video/em28xx/Kconfig +++ b/drivers/media/video/em28xx/Kconfig @@ -3,7 +3,6 @@ config VIDEO_EM28XX depends on VIDEO_DEV && I2C select VIDEO_TUNER select VIDEO_TVEEPROM - depends on RC_CORE select VIDEOBUF_VMALLOC select VIDEO_SAA711X if VIDEO_HELPER_CHIPS_AUTO select VIDEO_TVP5150 if VIDEO_HELPER_CHIPS_AUTO @@ -44,3 +43,12 @@ config VIDEO_EM28XX_DVB ---help--- This adds support for DVB cards based on the Empiatech em28xx chips. + +config VIDEO_EM28XX_RC + bool "EM28XX Remote Controller support" + depends on RC_CORE + depends on VIDEO_EM28XX + depends on !(RC_CORE=m && VIDEO_EM28XX=y) + default y + ---help--- + Enables Remote Controller support on em28xx driver. diff --git a/drivers/media/video/em28xx/Makefile b/drivers/media/video/em28xx/Makefile index d0f093d1d0df..38aaa004f57d 100644 --- a/drivers/media/video/em28xx/Makefile +++ b/drivers/media/video/em28xx/Makefile @@ -1,5 +1,7 @@ -em28xx-objs := em28xx-video.o em28xx-i2c.o em28xx-cards.o em28xx-core.o \ - em28xx-input.o em28xx-vbi.o +em28xx-y := em28xx-video.o em28xx-i2c.o em28xx-cards.o +em28xx-y += em28xx-core.o em28xx-vbi.o + +em28xx-$(CONFIG_VIDEO_EM28XX_RC) += em28xx-input.o em28xx-alsa-objs := em28xx-audio.o diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index 28b9954d9326..f9b77b4c90e4 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h @@ -697,6 +697,9 @@ int em28xx_tuner_callback(void *ptr, int component, int command, int arg); void em28xx_release_resources(struct em28xx *dev); /* Provided by em28xx-input.c */ + +#ifdef CONFIG_VIDEO_EM28XX_RC + int em28xx_get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw); int em28xx_get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw); int em28xx_get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key, @@ -709,6 +712,20 @@ void em28xx_deregister_snapshot_button(struct em28xx *dev); int em28xx_ir_init(struct em28xx *dev); int em28xx_ir_fini(struct em28xx *dev); +#else + +#define em28xx_get_key_terratec NULL +#define em28xx_get_key_em_haup NULL +#define em28xx_get_key_pinnacle_usb_grey NULL +#define em28xx_get_key_winfast_usbii_deluxe NULL + +static inline void em28xx_register_snapshot_button(struct em28xx *dev) {} +static inline void em28xx_deregister_snapshot_button(struct em28xx *dev) {} +static inline int em28xx_ir_init(struct em28xx *dev) { return 0; } +static inline int em28xx_ir_fini(struct em28xx *dev) { return 0; } + +#endif + /* Provided by em28xx-vbi.c */ extern struct videobuf_queue_ops em28xx_vbi_qops; -- cgit v1.2.3 From 850d24a5a861238f583f59cd39de4dfe5142a4c9 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 19 Jun 2011 13:06:40 -0300 Subject: [media] em28xx-alsa: add mixer support for AC97 volume controls Export ac97 volume controls via mixer. Pulseaudio will probably handle it very badly, as it has no idea about how volumes are wired, and how are they associated with each TV input. Those wirings are card model dependent, and we don't have the wiring mappings for each supported device. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-audio.c | 103 ++++++++++++++++++++++++++++++ drivers/media/video/em28xx/em28xx-core.c | 2 + 2 files changed, 105 insertions(+) diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c index a24e1770db48..a75c779640df 100644 --- a/drivers/media/video/em28xx/em28xx-audio.c +++ b/drivers/media/video/em28xx/em28xx-audio.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include "em28xx.h" @@ -433,6 +434,92 @@ static struct page *snd_pcm_get_vmalloc_page(struct snd_pcm_substream *subs, return vmalloc_to_page(pageptr); } +/* + * AC97 volume control support + */ +static int em28xx_vol_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *info) +{ + info->type = SNDRV_CTL_ELEM_TYPE_INTEGER; + info->count = 2; + info->value.integer.min = 0; + info->value.integer.max = 0x1f; + + return 0; +} + +/* FIXME: should also add mute controls for each */ + +static int em28xx_vol_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *value) +{ + struct em28xx *dev = snd_kcontrol_chip(kcontrol); + u16 val = (value->value.integer.value[0] & 0x1f) | + (value->value.integer.value[1] & 0x1f) << 8; + int rc; + + mutex_lock(&dev->lock); + rc = em28xx_read_ac97(dev, kcontrol->private_value); + if (rc < 0) + goto err; + + val |= rc & 0x8080; /* Preserve the mute flags */ + + rc = em28xx_write_ac97(dev, kcontrol->private_value, val); + +err: + mutex_unlock(&dev->lock); + return rc; +} + +static int em28xx_vol_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *value) +{ + struct em28xx *dev = snd_kcontrol_chip(kcontrol); + int val; + + mutex_lock(&dev->lock); + val = em28xx_read_ac97(dev, kcontrol->private_value); + mutex_unlock(&dev->lock); + if (val < 0) + return val; + + value->value.integer.value[0] = val & 0x1f; + value->value.integer.value[1] = (val << 8) & 0x1f; + + return 0; +} + +static const DECLARE_TLV_DB_SCALE(em28xx_db_scale, -3450, 150, 0); + +static int em28xx_cvol_new(struct snd_card *card, struct em28xx *dev, + char *name, int id) +{ + int err; + struct snd_kcontrol *kctl; + struct snd_kcontrol_new tmp = { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = name, + .info = em28xx_vol_info, + .get = em28xx_vol_get, + .put = em28xx_vol_put, + .private_value = id, + .tlv.p = em28xx_db_scale, + }; + + kctl = snd_ctl_new1(&tmp, dev); + + err = snd_ctl_add(card, kctl); + if (err < 0) + return err; + + return 0; +} + + +/* + * register/unregister code and data + */ static struct snd_pcm_ops snd_em28xx_pcm_capture = { .open = snd_em28xx_capture_open, .close = snd_em28xx_pcm_close, @@ -489,6 +576,22 @@ static int em28xx_audio_init(struct em28xx *dev) INIT_WORK(&dev->wq_trigger, audio_trigger); + if (dev->audio_mode.ac97 != EM28XX_NO_AC97) { + em28xx_cvol_new(card, dev, "Video", AC97_VIDEO_VOL); + em28xx_cvol_new(card, dev, "Line In", AC97_LINEIN_VOL); + em28xx_cvol_new(card, dev, "Phone", AC97_PHONE_VOL); + em28xx_cvol_new(card, dev, "Microphone", AC97_PHONE_VOL); + em28xx_cvol_new(card, dev, "CD", AC97_CD_VOL); + em28xx_cvol_new(card, dev, "AUX", AC97_AUX_VOL); + em28xx_cvol_new(card, dev, "PCM", AC97_PCM_OUT_VOL); + + em28xx_cvol_new(card, dev, "Master", AC97_MASTER_VOL); + em28xx_cvol_new(card, dev, "Line", AC97_LINE_LEVEL_VOL); + em28xx_cvol_new(card, dev, "Mono", AC97_MASTER_MONO_VOL); + em28xx_cvol_new(card, dev, "LFE", AC97_LFE_MASTER_VOL); + em28xx_cvol_new(card, dev, "Surround", AC97_SURR_MASTER_VOL); + } + err = snd_card_register(card); if (err < 0) { snd_card_free(card); diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 7bf3a86902b0..752d4ed7f828 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -286,6 +286,7 @@ int em28xx_read_ac97(struct em28xx *dev, u8 reg) return ret; return le16_to_cpu(val); } +EXPORT_SYMBOL_GPL(em28xx_read_ac97); /* * em28xx_write_ac97() @@ -313,6 +314,7 @@ int em28xx_write_ac97(struct em28xx *dev, u8 reg, u16 val) return 0; } +EXPORT_SYMBOL_GPL(em28xx_write_ac97); struct em28xx_vol_itable { enum em28xx_amux mux; -- cgit v1.2.3 From 43131a2ca6afbd8dcc940d5ad4b4b1c3d89a658b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 19 Jun 2011 13:08:46 -0300 Subject: [media] em28xx-audio: add support for mute controls Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-audio.c | 87 ++++++++++++++++++++++++++----- 1 file changed, 73 insertions(+), 14 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c index a75c779640df..c7b96b46d346 100644 --- a/drivers/media/video/em28xx/em28xx-audio.c +++ b/drivers/media/video/em28xx/em28xx-audio.c @@ -448,8 +448,6 @@ static int em28xx_vol_info(struct snd_kcontrol *kcontrol, return 0; } -/* FIXME: should also add mute controls for each */ - static int em28xx_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *value) { @@ -463,7 +461,7 @@ static int em28xx_vol_put(struct snd_kcontrol *kcontrol, if (rc < 0) goto err; - val |= rc & 0x8080; /* Preserve the mute flags */ + val |= rc & 0x8000; /* Preserve the mute flag */ rc = em28xx_write_ac97(dev, kcontrol->private_value, val); @@ -490,25 +488,87 @@ static int em28xx_vol_get(struct snd_kcontrol *kcontrol, return 0; } +static int em28xx_vol_put_mute(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *value) +{ + struct em28xx *dev = snd_kcontrol_chip(kcontrol); + u16 val = value->value.integer.value[0]; + int rc; + + mutex_lock(&dev->lock); + rc = em28xx_read_ac97(dev, kcontrol->private_value); + if (rc < 0) + goto err; + + if (val) + rc |= 0x8000; + else + rc &= 0x7f7f; + + rc = em28xx_write_ac97(dev, kcontrol->private_value, rc); + +err: + mutex_unlock(&dev->lock); + return rc; +} + +static int em28xx_vol_get_mute(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *value) +{ + struct em28xx *dev = snd_kcontrol_chip(kcontrol); + int val; + + mutex_lock(&dev->lock); + val = em28xx_read_ac97(dev, kcontrol->private_value); + mutex_unlock(&dev->lock); + if (val < 0) + return val; + + if (val & 0x8000) + value->value.integer.value[0] = 1; + else + value->value.integer.value[0] = 0; + + return 0; +} + static const DECLARE_TLV_DB_SCALE(em28xx_db_scale, -3450, 150, 0); static int em28xx_cvol_new(struct snd_card *card, struct em28xx *dev, char *name, int id) { int err; + char ctl_name[44]; struct snd_kcontrol *kctl; - struct snd_kcontrol_new tmp = { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = name, - .info = em28xx_vol_info, - .get = em28xx_vol_get, - .put = em28xx_vol_put, - .private_value = id, - .tlv.p = em28xx_db_scale, - }; - + struct snd_kcontrol_new tmp; + + memset (&tmp, 0, sizeof(tmp)); + tmp.iface = SNDRV_CTL_ELEM_IFACE_MIXER, + tmp.private_value = id, + tmp.name = ctl_name, + + /* Add Mute Control */ + sprintf(ctl_name, "%s Switch", name); + tmp.get = em28xx_vol_get_mute; + tmp.put = em28xx_vol_put_mute; + tmp.info = snd_ctl_boolean_mono_info; kctl = snd_ctl_new1(&tmp, dev); + err = snd_ctl_add(card, kctl); + if (err < 0) + return err; + memset (&tmp, 0, sizeof(tmp)); + tmp.iface = SNDRV_CTL_ELEM_IFACE_MIXER, + tmp.private_value = id, + tmp.name = ctl_name, + + /* Add Volume Control */ + sprintf(ctl_name, "%s Volume", name); + tmp.get = em28xx_vol_get; + tmp.put = em28xx_vol_put; + tmp.info = em28xx_vol_info; + tmp.tlv.p = em28xx_db_scale, + kctl = snd_ctl_new1(&tmp, dev); err = snd_ctl_add(card, kctl); if (err < 0) return err; @@ -516,7 +576,6 @@ static int em28xx_cvol_new(struct snd_card *card, struct em28xx *dev, return 0; } - /* * register/unregister code and data */ -- cgit v1.2.3 From 71d7d83edc5129509a2cba1cf9848579cf9619e5 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 19 Jun 2011 13:14:07 -0300 Subject: [media] em28xx-audio: volumes are inverted While here, fix volume mask to 5 bits Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-audio.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c index c7b96b46d346..302553a7f83f 100644 --- a/drivers/media/video/em28xx/em28xx-audio.c +++ b/drivers/media/video/em28xx/em28xx-audio.c @@ -452,8 +452,8 @@ static int em28xx_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *value) { struct em28xx *dev = snd_kcontrol_chip(kcontrol); - u16 val = (value->value.integer.value[0] & 0x1f) | - (value->value.integer.value[1] & 0x1f) << 8; + u16 val = (0x1f - (value->value.integer.value[0] & 0x1f)) | + (0x1f - (value->value.integer.value[1] & 0x1f)) << 8; int rc; mutex_lock(&dev->lock); @@ -482,8 +482,8 @@ static int em28xx_vol_get(struct snd_kcontrol *kcontrol, if (val < 0) return val; - value->value.integer.value[0] = val & 0x1f; - value->value.integer.value[1] = (val << 8) & 0x1f; + value->value.integer.value[0] = 0x1f - (val & 0x1f); + value->value.integer.value[1] = 0x1f - ((val << 8) & 0x1f); return 0; } @@ -501,9 +501,9 @@ static int em28xx_vol_put_mute(struct snd_kcontrol *kcontrol, goto err; if (val) - rc |= 0x8000; + rc &= 0x1f1f; else - rc &= 0x7f7f; + rc |= 0x8000; rc = em28xx_write_ac97(dev, kcontrol->private_value, rc); @@ -525,9 +525,9 @@ static int em28xx_vol_get_mute(struct snd_kcontrol *kcontrol, return val; if (val & 0x8000) - value->value.integer.value[0] = 1; - else value->value.integer.value[0] = 0; + else + value->value.integer.value[0] = 1; return 0; } -- cgit v1.2.3 From 66cb6957d338383157d4fdafef7c85e488e9e535 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 18 Jun 2011 11:00:20 -0300 Subject: [media] em28xx-audio: add debug info for the volume control Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-audio.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c index 302553a7f83f..56739a462169 100644 --- a/drivers/media/video/em28xx/em28xx-audio.c +++ b/drivers/media/video/em28xx/em28xx-audio.c @@ -464,6 +464,13 @@ static int em28xx_vol_put(struct snd_kcontrol *kcontrol, val |= rc & 0x8000; /* Preserve the mute flag */ rc = em28xx_write_ac97(dev, kcontrol->private_value, val); + if (rc < 0) + goto err; + + dprintk("%sleft vol %d, right vol %d (0x%04x) to ac97 volume control 0x%04x\n", + (val & 0x8000) ? "muted " : "", + 0x1f - ((val >> 8) & 0x1f), 0x1f - (val & 0x1f), + val, (int)kcontrol->private_value); err: mutex_unlock(&dev->lock); @@ -482,6 +489,11 @@ static int em28xx_vol_get(struct snd_kcontrol *kcontrol, if (val < 0) return val; + dprintk("%sleft vol %d, right vol %d (0x%04x) from ac97 volume control 0x%04x\n", + (val & 0x8000) ? "muted " : "", + 0x1f - ((val >> 8) & 0x1f), 0x1f - (val & 0x1f), + val, (int)kcontrol->private_value); + value->value.integer.value[0] = 0x1f - (val & 0x1f); value->value.integer.value[1] = 0x1f - ((val << 8) & 0x1f); @@ -506,6 +518,13 @@ static int em28xx_vol_put_mute(struct snd_kcontrol *kcontrol, rc |= 0x8000; rc = em28xx_write_ac97(dev, kcontrol->private_value, rc); + if (rc < 0) + goto err; + + dprintk("%sleft vol %d, right vol %d (0x%04x) to ac97 volume control 0x%04x\n", + (val & 0x8000) ? "muted " : "", + 0x1f - ((val >> 8) & 0x1f), 0x1f - (val & 0x1f), + val, (int)kcontrol->private_value); err: mutex_unlock(&dev->lock); @@ -529,6 +548,11 @@ static int em28xx_vol_get_mute(struct snd_kcontrol *kcontrol, else value->value.integer.value[0] = 1; + dprintk("%sleft vol %d, right vol %d (0x%04x) from ac97 volume control 0x%04x\n", + (val & 0x8000) ? "muted " : "", + 0x1f - ((val >> 8) & 0x1f), 0x1f - (val & 0x1f), + val, (int)kcontrol->private_value); + return 0; } @@ -556,6 +580,8 @@ static int em28xx_cvol_new(struct snd_card *card, struct em28xx *dev, err = snd_ctl_add(card, kctl); if (err < 0) return err; + dprintk("Added control %s for ac97 volume control 0x%04x\n", + ctl_name, id); memset (&tmp, 0, sizeof(tmp)); tmp.iface = SNDRV_CTL_ELEM_IFACE_MIXER, @@ -572,6 +598,8 @@ static int em28xx_cvol_new(struct snd_card *card, struct em28xx *dev, err = snd_ctl_add(card, kctl); if (err < 0) return err; + dprintk("Added control %s for ac97 volume control 0x%04x\n", + ctl_name, id); return 0; } -- cgit v1.2.3 From debb7241498001a0da10ee01b72f9ec1f9b1edc8 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 19 Jun 2011 10:15:35 -0300 Subject: [media] em28xx-audio: Properly report failures to start stream If the audio stream fails for any reason, it should: 1) Report an error via dmesg; 2) Mark internally that the stream didn't started. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-audio.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c index 56739a462169..5381f6d7427d 100644 --- a/drivers/media/video/em28xx/em28xx-audio.c +++ b/drivers/media/video/em28xx/em28xx-audio.c @@ -213,9 +213,12 @@ static int em28xx_init_audio_isoc(struct em28xx *dev) for (i = 0; i < EM28XX_AUDIO_BUFS; i++) { errCode = usb_submit_urb(dev->adev.urb[i], GFP_ATOMIC); if (errCode) { + em28xx_errdev("submit of audio urb failed\n"); em28xx_deinit_isoc_audio(dev); + atomic_set(&dev->stream_started, 0); return errCode; } + } return 0; -- cgit v1.2.3 From dff0f8c279e34089128e9687d77bfc72dbb471bd Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 19 Jun 2011 13:39:31 -0300 Subject: [media] em28xx-audio: Some Alsa API fixes Mark the alsa stream with SNDRV_PCM_INFO_BATCH, as the timing to get audio streams can vary. Also, add SNDRV_PCM_TRIGGER for pause/release. while here, fix the stop indicator, to be sure that audio will be properly released at the stop events. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-audio.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c index 5381f6d7427d..47f21a382546 100644 --- a/drivers/media/video/em28xx/em28xx-audio.c +++ b/drivers/media/video/em28xx/em28xx-audio.c @@ -249,6 +249,7 @@ static struct snd_pcm_hardware snd_em28xx_hw_capture = { .info = SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_BATCH | SNDRV_PCM_INFO_MMAP_VALID, .formats = SNDRV_PCM_FMTBIT_S16_LE, @@ -401,11 +402,15 @@ static int snd_em28xx_capture_trigger(struct snd_pcm_substream *substream, int retval = 0; switch (cmd) { + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: /* fall through */ + case SNDRV_PCM_TRIGGER_RESUME: /* fall through */ case SNDRV_PCM_TRIGGER_START: atomic_set(&dev->stream_started, 1); break; + case SNDRV_PCM_TRIGGER_PAUSE_PUSH: /* fall through */ + case SNDRV_PCM_TRIGGER_SUSPEND: /* fall through */ case SNDRV_PCM_TRIGGER_STOP: - atomic_set(&dev->stream_started, 1); + atomic_set(&dev->stream_started, 0); break; default: retval = -EINVAL; -- cgit v1.2.3 From 4f83e7b3ef938eb9a01eadf81a0f3b2c67d3afb6 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 17 Jun 2011 15:15:12 -0300 Subject: [media] em28xx: Add support for devices with a separate audio interface Some devices use a separate interface for the vendor audio class. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-audio.c | 44 +++++++------ drivers/media/video/em28xx/em28xx-cards.c | 102 ++++++++++++++++++++++-------- drivers/media/video/em28xx/em28xx-core.c | 20 +++--- drivers/media/video/em28xx/em28xx.h | 3 + 4 files changed, 109 insertions(+), 60 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c index 47f21a382546..cff0768afbf5 100644 --- a/drivers/media/video/em28xx/em28xx-audio.c +++ b/drivers/media/video/em28xx/em28xx-audio.c @@ -3,9 +3,9 @@ * * Copyright (C) 2006 Markus Rechberger * - * Copyright (C) 2007 Mauro Carvalho Chehab + * Copyright (C) 2007-2011 Mauro Carvalho Chehab * - Port to work with the in-kernel driver - * - Several cleanups + * - Cleanups, fixes, alsa-controls, etc. * * This driver is based on my previous au600 usb pstn audio driver * and inherits all the copyrights @@ -281,23 +281,27 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream *substream) return -ENODEV; } - /* Sets volume, mute, etc */ + runtime->hw = snd_em28xx_hw_capture; + if ((dev->alt == 0 || dev->audio_ifnum) && dev->adev.users == 0) { + if (dev->audio_ifnum) + dev->alt = 1; + else + dev->alt = 7; - dev->mute = 0; - mutex_lock(&dev->lock); - ret = em28xx_audio_analog_set(dev); - if (ret < 0) - goto err; + dprintk("changing alternate number on interface %d to %d\n", + dev->audio_ifnum, dev->alt); + usb_set_interface(dev->udev, dev->audio_ifnum, dev->alt); - runtime->hw = snd_em28xx_hw_capture; - if (dev->alt == 0 && dev->adev.users == 0) { - dev->alt = 7; - dprintk("changing alternate number to 7\n"); - usb_set_interface(dev->udev, 0, 7); - } + /* Sets volume, mute, etc */ + dev->mute = 0; + mutex_lock(&dev->lock); + ret = em28xx_audio_analog_set(dev); + if (ret < 0) + goto err; - dev->adev.users++; - mutex_unlock(&dev->lock); + dev->adev.users++; + mutex_unlock(&dev->lock); + } snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); dev->adev.capture_pcm_substream = substream; @@ -635,17 +639,17 @@ static int em28xx_audio_init(struct em28xx *dev) static int devnr; int err; - if (dev->has_alsa_audio != 1) { + if (!dev->has_alsa_audio || dev->audio_ifnum < 0) { /* This device does not support the extension (in this case the device is expecting the snd-usb-audio module or doesn't have analog audio support at all) */ return 0; } - printk(KERN_INFO "em28xx-audio.c: probing for em28x1 " - "non standard usbaudio\n"); + printk(KERN_INFO "em28xx-audio.c: probing for em28xx Audio Vendor Class\n"); printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus " "Rechberger\n"); + printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2007-2011 Mauro Carvalho Chehab\n"); err = snd_card_create(index[devnr], "Em28xx Audio", THIS_MODULE, 0, &card); @@ -737,7 +741,7 @@ static void __exit em28xx_alsa_unregister(void) MODULE_LICENSE("GPL"); MODULE_AUTHOR("Markus Rechberger "); -MODULE_AUTHOR("Mauro Carvalho Chehab "); +MODULE_AUTHOR("Mauro Carvalho Chehab "); MODULE_DESCRIPTION("Em28xx Audio driver"); module_init(em28xx_alsa_register); diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index bbd67d754b59..c445bea2f27e 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -2846,6 +2846,16 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, } } + if (dev->is_audio_only) { + errCode = em28xx_audio_setup(dev); + if (errCode) + return -ENODEV; + em28xx_add_into_devlist(dev); + em28xx_init_extension(dev); + + return 0; + } + /* Prepopulate cached GPO register content */ retval = em28xx_read_reg(dev, dev->reg_gpo_num); if (retval >= 0) @@ -2946,6 +2956,9 @@ fail_reg_devices: return retval; } +/* high bandwidth multiplier, as encoded in highspeed endpoint descriptors */ +#define hb_mult(wMaxPacketSize) (1 + (((wMaxPacketSize) >> 11) & 0x03)) + /* * em28xx_usb_probe() * checks for supported devices @@ -2955,15 +2968,15 @@ static int em28xx_usb_probe(struct usb_interface *interface, { const struct usb_endpoint_descriptor *endpoint; struct usb_device *udev; - struct usb_interface *uif; struct em28xx *dev = NULL; int retval; - int i, nr, ifnum, isoc_pipe; + bool is_audio_only = false, has_audio = false; + int i, nr, isoc_pipe; + const int ifnum = interface->altsetting[0].desc.bInterfaceNumber; char *speed; char descr[255] = ""; udev = usb_get_dev(interface_to_usbdev(interface)); - ifnum = interface->altsetting[0].desc.bInterfaceNumber; /* Check to see next free device and mark as used */ nr = find_first_zero_bit(&em28xx_devused, EM28XX_MAXBOARDS); @@ -2983,6 +2996,19 @@ static int em28xx_usb_probe(struct usb_interface *interface, goto err; } + /* Get endpoints */ + for (i = 0; i < interface->num_altsetting; i++) { + int ep; + + for (ep = 0; ep < interface->altsetting[i].desc.bNumEndpoints; ep++) { + struct usb_host_endpoint *e; + e = &interface->altsetting[i].endpoint[ep]; + + if (e->desc.bEndpointAddress == 0x83) + has_audio = true; + } + } + endpoint = &interface->cur_altsetting->endpoint[0].desc; /* check if the device has the iso in endpoint at the correct place */ @@ -3002,19 +3028,22 @@ static int em28xx_usb_probe(struct usb_interface *interface, check_interface = 0; if (!check_interface) { - em28xx_err(DRIVER_NAME " video device (%04x:%04x): " - "interface %i, class %i found.\n", - le16_to_cpu(udev->descriptor.idVendor), - le16_to_cpu(udev->descriptor.idProduct), - ifnum, - interface->altsetting[0].desc.bInterfaceClass); - - em28xx_err(DRIVER_NAME " This is an anciliary " - "interface not used by the driver\n"); - - em28xx_devused &= ~(1<descriptor.idVendor), + le16_to_cpu(udev->descriptor.idProduct), + ifnum, + interface->altsetting[0].desc.bInterfaceClass); + em28xx_err(DRIVER_NAME " This is an anciliary " + "interface not used by the driver\n"); + + em28xx_devused &= ~(1<descriptor.idVendor), @@ -3053,6 +3082,11 @@ static int em28xx_usb_probe(struct usb_interface *interface, ifnum, interface->altsetting->desc.bInterfaceNumber); + if (has_audio) + printk(KERN_INFO DRIVER_NAME + ": Audio Vendor Class interface %i found\n", + ifnum); + /* * Make sure we have 480 Mbps of bandwidth, otherwise things like * video stream wouldn't likely work, since 12 Mbps is generally @@ -3088,10 +3122,13 @@ static int em28xx_usb_probe(struct usb_interface *interface, dev->devno = nr; dev->model = id->driver_info; dev->alt = -1; + dev->is_audio_only = is_audio_only; + dev->has_alsa_audio = has_audio; + dev->audio_ifnum = ifnum; /* Checks if audio is provided by some interface */ for (i = 0; i < udev->config->desc.bNumInterfaces; i++) { - uif = udev->config->interface[i]; + struct usb_interface *uif = udev->config->interface[i]; if (uif->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) { dev->has_audio_class = 1; break; @@ -3099,9 +3136,7 @@ static int em28xx_usb_probe(struct usb_interface *interface, } /* compute alternate max packet sizes */ - uif = udev->actconfig->interface[0]; - - dev->num_alt = uif->num_altsetting; + dev->num_alt = interface->num_altsetting; dev->alt_max_pkt_size = kmalloc(32 * dev->num_alt, GFP_KERNEL); if (dev->alt_max_pkt_size == NULL) { @@ -3113,14 +3148,21 @@ static int em28xx_usb_probe(struct usb_interface *interface, } for (i = 0; i < dev->num_alt ; i++) { - u16 tmp = le16_to_cpu(uif->altsetting[i].endpoint[isoc_pipe].desc.wMaxPacketSize); - dev->alt_max_pkt_size[i] = - (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1); + u16 tmp = le16_to_cpu(interface->altsetting[i].endpoint[isoc_pipe].desc.wMaxPacketSize); + unsigned int size = tmp & 0x7ff; + + if (udev->speed == USB_SPEED_HIGH) + size = size * hb_mult(tmp); + + dev->alt_max_pkt_size[i] = size; } if ((card[nr] >= 0) && (card[nr] < em28xx_bcount)) dev->model = card[nr]; + /* save our data pointer in this interface device */ + usb_set_intfdata(interface, dev); + /* allocate device struct */ mutex_init(&dev->lock); mutex_lock(&dev->lock); @@ -3132,9 +3174,6 @@ static int em28xx_usb_probe(struct usb_interface *interface, goto err; } - /* save our data pointer in this interface device */ - usb_set_intfdata(interface, dev); - request_modules(dev); /* Should be the last thing to do, to avoid newer udev's to @@ -3163,6 +3202,13 @@ static void em28xx_usb_disconnect(struct usb_interface *interface) if (!dev) return; + if (dev->is_audio_only) { + mutex_lock(&dev->lock); + em28xx_close_extension(dev); + mutex_unlock(&dev->lock); + return; + } + em28xx_info("disconnecting %s\n", dev->vdev->name); flush_request_modules(dev); diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 752d4ed7f828..16c9b73b1c3f 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -499,17 +499,13 @@ int em28xx_audio_setup(struct em28xx *dev) if (dev->chip_id == CHIP_ID_EM2870 || dev->chip_id == CHIP_ID_EM2874 || dev->chip_id == CHIP_ID_EM28174) { /* Digital only device - don't load any alsa module */ - dev->audio_mode.has_audio = 0; - dev->has_audio_class = 0; - dev->has_alsa_audio = 0; + dev->audio_mode.has_audio = false; + dev->has_audio_class = false; + dev->has_alsa_audio = false; return 0; } - /* If device doesn't support Usb Audio Class, use vendor class */ - if (!dev->has_audio_class) - dev->has_alsa_audio = 1; - - dev->audio_mode.has_audio = 1; + dev->audio_mode.has_audio = true; /* See how this device is configured */ cfg = em28xx_read_reg(dev, EM28XX_R00_CHIPCFG); @@ -519,8 +515,8 @@ int em28xx_audio_setup(struct em28xx *dev) cfg = EM28XX_CHIPCFG_AC97; /* Be conservative */ } else if ((cfg & EM28XX_CHIPCFG_AUDIOMASK) == 0x00) { /* The device doesn't have vendor audio at all */ - dev->has_alsa_audio = 0; - dev->audio_mode.has_audio = 0; + dev->has_alsa_audio = false; + dev->audio_mode.has_audio = false; return 0; } else if ((cfg & EM28XX_CHIPCFG_AUDIOMASK) == EM28XX_CHIPCFG_I2S_3_SAMPRATES) { @@ -549,8 +545,8 @@ int em28xx_audio_setup(struct em28xx *dev) */ em28xx_warn("AC97 chip type couldn't be determined\n"); dev->audio_mode.ac97 = EM28XX_NO_AC97; - dev->has_alsa_audio = 0; - dev->audio_mode.has_audio = 0; + dev->has_alsa_audio = false; + dev->audio_mode.has_audio = false; goto init_audio; } diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index f9b77b4c90e4..e03849fd3717 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h @@ -487,6 +487,8 @@ struct em28xx { int devno; /* marks the number of this device */ enum em28xx_chip_id chip_id; + int audio_ifnum; + struct v4l2_device v4l2_dev; struct em28xx_board board; @@ -503,6 +505,7 @@ struct em28xx { unsigned int has_audio_class:1; unsigned int has_alsa_audio:1; + unsigned int is_audio_only:1; /* Controls audio streaming */ struct work_struct wq_trigger; /* Trigger to start/stop audio for alsa module */ -- cgit v1.2.3 From 0db15d525d2d342de8e983c218198d5708a32004 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 17 Jun 2011 23:18:21 -0300 Subject: [media] em28xx: Mark Kworld 305 as validated This board were used for testing the em28xx-alsa using a separate interface. So, it is obviously validated ;) Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-cards.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index c445bea2f27e..c892a1e4ad85 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -1319,7 +1319,6 @@ struct em28xx_board em28xx_boards[] = { }, [EM2880_BOARD_KWORLD_DVB_305U] = { .name = "KWorld DVB-T 305U", - .valid = EM28XX_BOARD_NOT_VALIDATED, .tuner_type = TUNER_XC2028, .tuner_gpio = default_tuner_gpio, .decoder = EM28XX_TVP5150, -- cgit v1.2.3 From c21973e8aa930fe8a56ed4939ed9b6d640a6b158 Mon Sep 17 00:00:00 2001 From: "istvan_v@mailbox.hu" Date: Tue, 7 Jun 2011 13:12:29 -0300 Subject: [media] cx88: added XC4000 tuner callback and DVB attach functions Added functions for XC4000 tuner reset and attaching DVB frontend. Signed-off-by: Istvan Varga Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx88/cx88-cards.c | 13 +++++++++++++ drivers/media/video/cx88/cx88-dvb.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index 27222c92b603..7ae62cc62cdf 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c @@ -28,6 +28,7 @@ #include "cx88.h" #include "tea5767.h" +#include "xc4000.h" static unsigned int tuner[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET }; static unsigned int radio[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET }; @@ -2948,6 +2949,15 @@ static int cx88_xc2028_tuner_callback(struct cx88_core *core, return -EINVAL; } +static int cx88_xc4000_tuner_callback(struct cx88_core *core, + int command, int arg) +{ + /* Board-specific callbacks */ + switch (core->boardnr) { + } + return -EINVAL; +} + /* ----------------------------------------------------------------------- */ /* Tuner callback function. Currently only needed for the Pinnacle * * PCTV HD 800i with an xc5000 sillicon tuner. This is used for both * @@ -3022,6 +3032,9 @@ int cx88_tuner_callback(void *priv, int component, int command, int arg) case TUNER_XC2028: info_printk(core, "Calling XC2028/3028 callback\n"); return cx88_xc2028_tuner_callback(core, command, arg); + case TUNER_XC4000: + info_printk(core, "Calling XC4000 callback\n"); + return cx88_xc4000_tuner_callback(core, command, arg); case TUNER_XC5000: info_printk(core, "Calling XC5000 callback\n"); return cx88_xc5000_tuner_callback(core, command, arg); diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index c69df7ebb6a7..f0fbff499f01 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c @@ -41,6 +41,7 @@ #include "or51132.h" #include "lgdt330x.h" #include "s5h1409.h" +#include "xc4000.h" #include "xc5000.h" #include "nxt200x.h" #include "cx24123.h" @@ -605,6 +606,39 @@ static int attach_xc3028(u8 addr, struct cx8802_dev *dev) return 0; } +static int attach_xc4000(struct cx8802_dev *dev, struct xc4000_config *cfg) +{ + struct dvb_frontend *fe; + struct videobuf_dvb_frontend *fe0 = NULL; + + /* Get the first frontend */ + fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1); + if (!fe0) + return -EINVAL; + + if (!fe0->dvb.frontend) { + printk(KERN_ERR "%s/2: dvb frontend not attached. " + "Can't attach xc4000\n", + dev->core->name); + return -EINVAL; + } + + fe = dvb_attach(xc4000_attach, fe0->dvb.frontend, &dev->core->i2c_adap, + cfg); + if (!fe) { + printk(KERN_ERR "%s/2: xc4000 attach failed\n", + dev->core->name); + dvb_frontend_detach(fe0->dvb.frontend); + dvb_unregister_frontend(fe0->dvb.frontend); + fe0->dvb.frontend = NULL; + return -EINVAL; + } + + printk(KERN_INFO "%s/2: xc4000 attached\n", dev->core->name); + + return 0; +} + static int cx24116_set_ts_param(struct dvb_frontend *fe, int is_punctured) { -- cgit v1.2.3 From f271a3affae3529c3cb6dc66f3bf0a8aeaebf5d5 Mon Sep 17 00:00:00 2001 From: "istvan_v@mailbox.hu" Date: Tue, 7 Jun 2011 13:14:53 -0300 Subject: [media] cx88: added support for Leadtek WinFast DTV2000 H Plus This patch implements support for the Leadtek WinFast DTV2000 H Plus card with XC4000 tuner (107d:6f42). Signed-off-by: Istvan Varga Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx88/cx88-cards.c | 81 +++++++++++++++++++++++++++++++++++ drivers/media/video/cx88/cx88-dvb.c | 24 ++++++++++- drivers/media/video/cx88/cx88-input.c | 2 + drivers/media/video/cx88/cx88.h | 1 + 4 files changed, 107 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index 7ae62cc62cdf..ca21da12b208 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c @@ -2120,6 +2120,58 @@ static const struct cx88_board cx88_boards[] = { }, .mpeg = CX88_MPEG_DVB, }, + [CX88_BOARD_WINFAST_DTV2000H_PLUS] = { + .name = "Leadtek WinFast DTV2000 H PLUS", + .tuner_type = TUNER_XC4000, + .radio_type = TUNER_XC4000, + .tuner_addr = 0x61, + .radio_addr = 0x61, + /* + * GPIO + * 2: 1: mute audio + * 12: 0: reset XC4000 + * 13: 1: audio input is line in (0: tuner) + * 14: 0: FM radio + * 16: 0: RF input is cable + */ + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 0, + .gpio0 = 0x0403, + .gpio1 = 0xF0D7, + .gpio2 = 0x0101, + .gpio3 = 0x0000, + }, { + .type = CX88_VMUX_CABLE, + .vmux = 0, + .gpio0 = 0x0403, + .gpio1 = 0xF0D7, + .gpio2 = 0x0100, + .gpio3 = 0x0000, + }, { + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0x0403, /* was 0x0407 */ + .gpio1 = 0xF0F7, + .gpio2 = 0x0101, + .gpio3 = 0x0000, + }, { + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0x0403, /* was 0x0407 */ + .gpio1 = 0xF0F7, + .gpio2 = 0x0101, + .gpio3 = 0x0000, + }}, + .radio = { + .type = CX88_RADIO, + .gpio0 = 0x0403, + .gpio1 = 0xF097, + .gpio2 = 0x0100, + .gpio3 = 0x0000, + }, + .mpeg = CX88_MPEG_DVB, + }, [CX88_BOARD_PROF_7301] = { .name = "Prof 7301 DVB-S/S2", .tuner_type = UNSET, @@ -2581,6 +2633,10 @@ static const struct cx88_subid cx88_subids[] = { .subvendor = 0x107d, .subdevice = 0x6654, .card = CX88_BOARD_WINFAST_DTV1800H, + }, { + .subvendor = 0x107d, + .subdevice = 0x6f42, + .card = CX88_BOARD_WINFAST_DTV2000H_PLUS, }, { /* PVR2000 PAL Model [107d:6630] */ .subvendor = 0x107d, @@ -2847,6 +2903,23 @@ static int cx88_xc3028_winfast1800h_callback(struct cx88_core *core, return -EINVAL; } +static int cx88_xc4000_winfast2000h_plus_callback(struct cx88_core *core, + int command, int arg) +{ + switch (command) { + case XC4000_TUNER_RESET: + /* GPIO 12 (xc4000 tuner reset) */ + cx_set(MO_GP1_IO, 0x1010); + mdelay(50); + cx_clear(MO_GP1_IO, 0x10); + mdelay(75); + cx_set(MO_GP1_IO, 0x10); + mdelay(75); + return 0; + } + return -EINVAL; +} + /* ------------------------------------------------------------------- */ /* some Divco specific stuff */ static int cx88_pv_8000gt_callback(struct cx88_core *core, @@ -2954,6 +3027,9 @@ static int cx88_xc4000_tuner_callback(struct cx88_core *core, { /* Board-specific callbacks */ switch (core->boardnr) { + case CX88_BOARD_WINFAST_DTV2000H_PLUS: + return cx88_xc4000_winfast2000h_plus_callback(core, + command, arg); } return -EINVAL; } @@ -3131,6 +3207,11 @@ static void cx88_card_setup_pre_i2c(struct cx88_core *core) mdelay(50); break; + case CX88_BOARD_WINFAST_DTV2000H_PLUS: + cx88_xc4000_winfast2000h_plus_callback(core, + XC4000_TUNER_RESET, 0); + break; + case CX88_BOARD_TWINHAN_VP1027_DVBS: cx_write(MO_GP0_IO, 0x00003230); cx_write(MO_GP0_IO, 0x00003210); diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index f0fbff499f01..c4e20942dcc6 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c @@ -1328,7 +1328,24 @@ static int dvb_register(struct cx8802_dev *dev) goto frontend_detach; } break; - case CX88_BOARD_GENIATECH_X8000_MT: + case CX88_BOARD_WINFAST_DTV2000H_PLUS: + fe0->dvb.frontend = dvb_attach(zl10353_attach, + &cx88_pinnacle_hybrid_pctv, + &core->i2c_adap); + if (fe0->dvb.frontend) { + struct xc4000_config cfg = { + .i2c_address = 0x61, + .default_pm = 0, + .dvb_amplitude = 134, + .set_smoothedcvbs = 1, + .if_khz = 4560 + }; + fe0->dvb.frontend->ops.i2c_gate_ctrl = NULL; + if (attach_xc4000(dev, &cfg) < 0) + goto frontend_detach; + } + break; + case CX88_BOARD_GENIATECH_X8000_MT: dev->ts_gen_cntrl = 0x00; fe0->dvb.frontend = dvb_attach(zl10353_attach, @@ -1611,6 +1628,11 @@ static int cx8802_dvb_advise_acquire(struct cx8802_driver *drv) udelay(1000); break; + case CX88_BOARD_WINFAST_DTV2000H_PLUS: + /* set RF input to AIR for DVB-T (GPIO 16) */ + cx_write(MO_GP2_IO, 0x0101); + break; + default: err = -ENODEV; } diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index 3f442003623d..662438fe9ac1 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c @@ -100,6 +100,7 @@ static void cx88_ir_handle_key(struct cx88_IR *ir) break; case CX88_BOARD_WINFAST_DTV1000: case CX88_BOARD_WINFAST_DTV1800H: + case CX88_BOARD_WINFAST_DTV2000H_PLUS: case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL: gpio = (gpio & 0x6ff) | ((cx_read(MO_GP1_IO) << 8) & 0x900); auxgpio = gpio; @@ -289,6 +290,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) case CX88_BOARD_WINFAST_DTV2000H: case CX88_BOARD_WINFAST_DTV2000H_J: case CX88_BOARD_WINFAST_DTV1800H: + case CX88_BOARD_WINFAST_DTV2000H_PLUS: ir_codes = RC_MAP_WINFAST; ir->gpio_addr = MO_GP0_IO; ir->mask_keycode = 0x8f8; diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index a399a8b086ba..31c2356ea96d 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -242,6 +242,7 @@ extern const struct sram_channel const cx88_sram_channels[]; #define CX88_BOARD_SAMSUNG_SMT_7020 84 #define CX88_BOARD_TWINHAN_VP1027_DVBS 85 #define CX88_BOARD_TEVII_S464 86 +#define CX88_BOARD_WINFAST_DTV2000H_PLUS 87 enum cx88_itype { CX88_VMUX_COMPOSITE1 = 1, -- cgit v1.2.3 From 8eb79c0b9ba602123279bcc0cd65458a0dfcecfc Mon Sep 17 00:00:00 2001 From: "istvan_v@mailbox.hu" Date: Tue, 7 Jun 2011 13:16:56 -0300 Subject: [media] cx88: added support for Leadtek WinFast DTV1800 H with XC4000 tuner This patch implements support for the Leadtek WinFast DTV1800 H card with XC4000 tuner (107d:6f38). Signed-off-by: Istvan Varga Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx88/cx88-cards.c | 48 +++++++++++++++++++++++++++++++++++ drivers/media/video/cx88/cx88-dvb.c | 1 + drivers/media/video/cx88/cx88-input.c | 2 ++ drivers/media/video/cx88/cx88.h | 1 + 4 files changed, 52 insertions(+) diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index ca21da12b208..e2a736ef2a7d 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c @@ -2120,6 +2120,47 @@ static const struct cx88_board cx88_boards[] = { }, .mpeg = CX88_MPEG_DVB, }, + [CX88_BOARD_WINFAST_DTV1800H_XC4000] = { + .name = "Leadtek WinFast DTV1800 H (XC4000)", + .tuner_type = TUNER_XC4000, + .radio_type = TUNER_XC4000, + .tuner_addr = 0x61, + .radio_addr = 0x61, + /* + * GPIO setting + * + * 2: mute (0=off,1=on) + * 12: tuner reset pin + * 13: audio source (0=tuner audio,1=line in) + * 14: FM (0=on,1=off ???) + */ + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 0, + .gpio0 = 0x0400, /* pin 2 = 0 */ + .gpio1 = 0x6040, /* pin 13 = 0, pin 14 = 1 */ + .gpio2 = 0x0000, + }, { + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0x0400, /* pin 2 = 0 */ + .gpio1 = 0x6060, /* pin 13 = 1, pin 14 = 1 */ + .gpio2 = 0x0000, + }, { + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0x0400, /* pin 2 = 0 */ + .gpio1 = 0x6060, /* pin 13 = 1, pin 14 = 1 */ + .gpio2 = 0x0000, + }}, + .radio = { + .type = CX88_RADIO, + .gpio0 = 0x0400, /* pin 2 = 0 */ + .gpio1 = 0x6000, /* pin 13 = 0, pin 14 = 0 */ + .gpio2 = 0x0000, + }, + .mpeg = CX88_MPEG_DVB, + }, [CX88_BOARD_WINFAST_DTV2000H_PLUS] = { .name = "Leadtek WinFast DTV2000 H PLUS", .tuner_type = TUNER_XC4000, @@ -2633,6 +2674,11 @@ static const struct cx88_subid cx88_subids[] = { .subvendor = 0x107d, .subdevice = 0x6654, .card = CX88_BOARD_WINFAST_DTV1800H, + }, { + /* WinFast DTV1800 H with XC4000 tuner */ + .subvendor = 0x107d, + .subdevice = 0x6f38, + .card = CX88_BOARD_WINFAST_DTV1800H_XC4000, }, { .subvendor = 0x107d, .subdevice = 0x6f42, @@ -3027,6 +3073,7 @@ static int cx88_xc4000_tuner_callback(struct cx88_core *core, { /* Board-specific callbacks */ switch (core->boardnr) { + case CX88_BOARD_WINFAST_DTV1800H_XC4000: case CX88_BOARD_WINFAST_DTV2000H_PLUS: return cx88_xc4000_winfast2000h_plus_callback(core, command, arg); @@ -3207,6 +3254,7 @@ static void cx88_card_setup_pre_i2c(struct cx88_core *core) mdelay(50); break; + case CX88_BOARD_WINFAST_DTV1800H_XC4000: case CX88_BOARD_WINFAST_DTV2000H_PLUS: cx88_xc4000_winfast2000h_plus_callback(core, XC4000_TUNER_RESET, 0); diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index c4e20942dcc6..1ed72ce2413c 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c @@ -1328,6 +1328,7 @@ static int dvb_register(struct cx8802_dev *dev) goto frontend_detach; } break; + case CX88_BOARD_WINFAST_DTV1800H_XC4000: case CX88_BOARD_WINFAST_DTV2000H_PLUS: fe0->dvb.frontend = dvb_attach(zl10353_attach, &cx88_pinnacle_hybrid_pctv, diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index 662438fe9ac1..e614201b5ed3 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c @@ -100,6 +100,7 @@ static void cx88_ir_handle_key(struct cx88_IR *ir) break; case CX88_BOARD_WINFAST_DTV1000: case CX88_BOARD_WINFAST_DTV1800H: + case CX88_BOARD_WINFAST_DTV1800H_XC4000: case CX88_BOARD_WINFAST_DTV2000H_PLUS: case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL: gpio = (gpio & 0x6ff) | ((cx_read(MO_GP1_IO) << 8) & 0x900); @@ -290,6 +291,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) case CX88_BOARD_WINFAST_DTV2000H: case CX88_BOARD_WINFAST_DTV2000H_J: case CX88_BOARD_WINFAST_DTV1800H: + case CX88_BOARD_WINFAST_DTV1800H_XC4000: case CX88_BOARD_WINFAST_DTV2000H_PLUS: ir_codes = RC_MAP_WINFAST; ir->gpio_addr = MO_GP0_IO; diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index 31c2356ea96d..5719063d2881 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -243,6 +243,7 @@ extern const struct sram_channel const cx88_sram_channels[]; #define CX88_BOARD_TWINHAN_VP1027_DVBS 85 #define CX88_BOARD_TEVII_S464 86 #define CX88_BOARD_WINFAST_DTV2000H_PLUS 87 +#define CX88_BOARD_WINFAST_DTV1800H_XC4000 88 enum cx88_itype { CX88_VMUX_COMPOSITE1 = 1, -- cgit v1.2.3 From 79a5b9a2d99f9085dd84e796c20756e4e283b6c9 Mon Sep 17 00:00:00 2001 From: "istvan_v@mailbox.hu" Date: Tue, 7 Jun 2011 13:21:02 -0300 Subject: [media] cx88: replaced duplicated code with function call The following patch replaces code to reset the XC3028 tuner with a call to the tuner reset callback. Signed-off-by: Istvan Varga Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx88/cx88-cards.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index e2a736ef2a7d..0d719faafd8a 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c @@ -3245,13 +3245,7 @@ static void cx88_card_setup_pre_i2c(struct cx88_core *core) case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL: case CX88_BOARD_WINFAST_DTV1800H: - /* GPIO 12 (xc3028 tuner reset) */ - cx_set(MO_GP1_IO, 0x1010); - mdelay(50); - cx_clear(MO_GP1_IO, 0x10); - mdelay(50); - cx_set(MO_GP1_IO, 0x10); - mdelay(50); + cx88_xc3028_winfast1800h_callback(core, XC2028_TUNER_RESET, 0); break; case CX88_BOARD_WINFAST_DTV1800H_XC4000: -- cgit v1.2.3 From c3f305aab4b2b4334a46a8cc212f4adf05af6798 Mon Sep 17 00:00:00 2001 From: "Justin P. Mattock" Date: Mon, 6 Jun 2011 13:11:52 -0300 Subject: [media] frontends/s5h1420: Change: clock_settting to clock_setting Changes clock_settting to clock_setting. Note: This could be intentionally set this way from the beginning and/or is a typo. Signed-off-by: Justin P. Mattock Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/s5h1420.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/dvb/frontends/s5h1420.c b/drivers/media/dvb/frontends/s5h1420.c index 17f8cdf8afef..3879d2e378aa 100644 --- a/drivers/media/dvb/frontends/s5h1420.c +++ b/drivers/media/dvb/frontends/s5h1420.c @@ -634,7 +634,7 @@ static int s5h1420_set_frontend(struct dvb_frontend* fe, struct s5h1420_state* state = fe->demodulator_priv; int frequency_delta; struct dvb_frontend_tune_settings fesettings; - uint8_t clock_settting; + uint8_t clock_setting; dprintk("enter %s\n", __func__); @@ -684,19 +684,19 @@ static int s5h1420_set_frontend(struct dvb_frontend* fe, switch (state->fclk) { default: case 88000000: - clock_settting = 80; + clock_setting = 80; break; case 86000000: - clock_settting = 78; + clock_setting = 78; break; case 80000000: - clock_settting = 72; + clock_setting = 72; break; case 59000000: - clock_settting = 51; + clock_setting = 51; break; case 44000000: - clock_settting = 36; + clock_setting = 36; break; } dprintk("pll01: %d, ToneFreq: %d\n", state->fclk/1000000 - 8, (state->fclk + (TONE_FREQ * 32) - 1) / (TONE_FREQ * 32)); -- cgit v1.2.3 From de8ae0d516379ef0e0608415a3979ecdd2462c2e Mon Sep 17 00:00:00 2001 From: Peter Moon Date: Wed, 8 Jun 2011 15:54:19 -0300 Subject: [media] cx231xx: Add support for Hauppauge WinTV USB2-FM This patch adds support for the "Hauppauge WinTV USB2-FM" Analog TV Stick. It includes support for both the PAL and NTSC variants of the device. Signed-off-by: Peter Moon Reviewed-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx231xx/cx231xx-avcore.c | 4 ++ drivers/media/video/cx231xx/cx231xx-cards.c | 74 ++++++++++++++++++++++++++++ drivers/media/video/cx231xx/cx231xx-core.c | 4 ++ drivers/media/video/cx231xx/cx231xx.h | 2 + 4 files changed, 84 insertions(+) diff --git a/drivers/media/video/cx231xx/cx231xx-avcore.c b/drivers/media/video/cx231xx/cx231xx-avcore.c index 8d7813415760..53ff26e7abf7 100644 --- a/drivers/media/video/cx231xx/cx231xx-avcore.c +++ b/drivers/media/video/cx231xx/cx231xx-avcore.c @@ -355,6 +355,8 @@ int cx231xx_afe_update_power_control(struct cx231xx *dev, case CX231XX_BOARD_HAUPPAUGE_EXETER: case CX231XX_BOARD_HAUPPAUGE_USBLIVE2: case CX231XX_BOARD_PV_PLAYTV_USB_HYBRID: + case CX231XX_BOARD_HAUPPAUGE_USB2_FM_PAL: + case CX231XX_BOARD_HAUPPAUGE_USB2_FM_NTSC: if (avmode == POLARIS_AVMODE_ANALOGT_TV) { while (afe_power_status != (FLD_PWRDN_TUNING_BIAS | FLD_PWRDN_ENABLE_PLL)) { @@ -1733,6 +1735,8 @@ int cx231xx_dif_set_standard(struct cx231xx *dev, u32 standard) break; case CX231XX_BOARD_CNXT_RDE_253S: case CX231XX_BOARD_CNXT_RDU_253S: + case CX231XX_BOARD_HAUPPAUGE_USB2_FM_PAL: + case CX231XX_BOARD_HAUPPAUGE_USB2_FM_NTSC: func_mode = 0x01; break; default: diff --git a/drivers/media/video/cx231xx/cx231xx-cards.c b/drivers/media/video/cx231xx/cx231xx-cards.c index 22703815a31f..4b22afee18cf 100644 --- a/drivers/media/video/cx231xx/cx231xx-cards.c +++ b/drivers/media/video/cx231xx/cx231xx-cards.c @@ -532,6 +532,76 @@ struct cx231xx_board cx231xx_boards[] = { .gpio = NULL, } }, }, + [CX231XX_BOARD_HAUPPAUGE_USB2_FM_PAL] = { + .name = "Hauppauge WinTV USB2 FM (PAL)", + .tuner_type = TUNER_NXP_TDA18271, + .tuner_addr = 0x60, + .tuner_gpio = RDE250_XCV_TUNER, + .tuner_sif_gpio = 0x05, + .tuner_scl_gpio = 0x1a, + .tuner_sda_gpio = 0x1b, + .decoder = CX231XX_AVDECODER, + .output_mode = OUT_MODE_VIP11, + .ctl_pin_status_mask = 0xFFFFFFC4, + .agc_analog_digital_select_gpio = 0x0c, + .gpio_pin_status_mask = 0x4001000, + .tuner_i2c_master = 1, + .norm = V4L2_STD_PAL, + + .input = {{ + .type = CX231XX_VMUX_TELEVISION, + .vmux = CX231XX_VIN_3_1, + .amux = CX231XX_AMUX_VIDEO, + .gpio = NULL, + }, { + .type = CX231XX_VMUX_COMPOSITE1, + .vmux = CX231XX_VIN_2_1, + .amux = CX231XX_AMUX_LINE_IN, + .gpio = NULL, + }, { + .type = CX231XX_VMUX_SVIDEO, + .vmux = CX231XX_VIN_1_1 | + (CX231XX_VIN_1_2 << 8) | + CX25840_SVIDEO_ON, + .amux = CX231XX_AMUX_LINE_IN, + .gpio = NULL, + } }, + }, + [CX231XX_BOARD_HAUPPAUGE_USB2_FM_NTSC] = { + .name = "Hauppauge WinTV USB2 FM (NTSC)", + .tuner_type = TUNER_NXP_TDA18271, + .tuner_addr = 0x60, + .tuner_gpio = RDE250_XCV_TUNER, + .tuner_sif_gpio = 0x05, + .tuner_scl_gpio = 0x1a, + .tuner_sda_gpio = 0x1b, + .decoder = CX231XX_AVDECODER, + .output_mode = OUT_MODE_VIP11, + .ctl_pin_status_mask = 0xFFFFFFC4, + .agc_analog_digital_select_gpio = 0x0c, + .gpio_pin_status_mask = 0x4001000, + .tuner_i2c_master = 1, + .norm = V4L2_STD_NTSC, + + .input = {{ + .type = CX231XX_VMUX_TELEVISION, + .vmux = CX231XX_VIN_3_1, + .amux = CX231XX_AMUX_VIDEO, + .gpio = NULL, + }, { + .type = CX231XX_VMUX_COMPOSITE1, + .vmux = CX231XX_VIN_2_1, + .amux = CX231XX_AMUX_LINE_IN, + .gpio = NULL, + }, { + .type = CX231XX_VMUX_SVIDEO, + .vmux = CX231XX_VIN_1_1 | + (CX231XX_VIN_1_2 << 8) | + CX25840_SVIDEO_ON, + .amux = CX231XX_AMUX_LINE_IN, + .gpio = NULL, + } }, + }, }; const unsigned int cx231xx_bcount = ARRAY_SIZE(cx231xx_boards); @@ -553,6 +623,10 @@ struct usb_device_id cx231xx_id_table[] = { .driver_info = CX231XX_BOARD_CNXT_RDE_250}, {USB_DEVICE(0x0572, 0x58A0), .driver_info = CX231XX_BOARD_CNXT_RDU_250}, + {USB_DEVICE(0x2040, 0xb110), + .driver_info = CX231XX_BOARD_HAUPPAUGE_USB2_FM_PAL}, + {USB_DEVICE(0x2040, 0xb111), + .driver_info = CX231XX_BOARD_HAUPPAUGE_USB2_FM_NTSC}, {USB_DEVICE(0x2040, 0xb120), .driver_info = CX231XX_BOARD_HAUPPAUGE_EXETER}, {USB_DEVICE(0x2040, 0xb140), diff --git a/drivers/media/video/cx231xx/cx231xx-core.c b/drivers/media/video/cx231xx/cx231xx-core.c index abe500feb7dd..d4457f9488ee 100644 --- a/drivers/media/video/cx231xx/cx231xx-core.c +++ b/drivers/media/video/cx231xx/cx231xx-core.c @@ -742,6 +742,8 @@ int cx231xx_set_mode(struct cx231xx *dev, enum cx231xx_mode set_mode) case CX231XX_BOARD_CNXT_RDU_253S: case CX231XX_BOARD_HAUPPAUGE_EXETER: case CX231XX_BOARD_PV_PLAYTV_USB_HYBRID: + case CX231XX_BOARD_HAUPPAUGE_USB2_FM_PAL: + case CX231XX_BOARD_HAUPPAUGE_USB2_FM_NTSC: errCode = cx231xx_set_agc_analog_digital_mux_select(dev, 0); break; default: @@ -1381,6 +1383,8 @@ int cx231xx_dev_init(struct cx231xx *dev) case CX231XX_BOARD_CNXT_RDU_253S: case CX231XX_BOARD_HAUPPAUGE_EXETER: case CX231XX_BOARD_PV_PLAYTV_USB_HYBRID: + case CX231XX_BOARD_HAUPPAUGE_USB2_FM_PAL: + case CX231XX_BOARD_HAUPPAUGE_USB2_FM_NTSC: errCode = cx231xx_set_agc_analog_digital_mux_select(dev, 0); break; default: diff --git a/drivers/media/video/cx231xx/cx231xx.h b/drivers/media/video/cx231xx/cx231xx.h index 46dd84067816..b39b85e732e4 100644 --- a/drivers/media/video/cx231xx/cx231xx.h +++ b/drivers/media/video/cx231xx/cx231xx.h @@ -67,6 +67,8 @@ #define CX231XX_BOARD_PV_XCAPTURE_USB 11 #define CX231XX_BOARD_KWORLD_UB430_USB_HYBRID 12 #define CX231XX_BOARD_ICONBIT_U100 13 +#define CX231XX_BOARD_HAUPPAUGE_USB2_FM_PAL 14 +#define CX231XX_BOARD_HAUPPAUGE_USB2_FM_NTSC 15 /* Limits minimum and default number of buffers */ #define CX231XX_MIN_BUF 4 -- cgit v1.2.3 From 9b3d8eccc3024d0bbf1e51845a18f2dbe0db3371 Mon Sep 17 00:00:00 2001 From: Andy Walls Date: Wed, 8 Jun 2011 21:24:25 -0300 Subject: [media] cx23885: Add IR Rx support for HVR-1270 boards Signed-off-by: Andy Walls Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx23885/cx23885-cards.c | 12 +++++++++++- drivers/media/video/cx23885/cx23885-input.c | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c index 934185cca758..74b9d39ff829 100644 --- a/drivers/media/video/cx23885/cx23885-cards.c +++ b/drivers/media/video/cx23885/cx23885-cards.c @@ -1097,12 +1097,19 @@ int cx23885_ir_init(struct cx23885_dev *dev) case CX23885_BOARD_HAUPPAUGE_HVR1800: case CX23885_BOARD_HAUPPAUGE_HVR1200: case CX23885_BOARD_HAUPPAUGE_HVR1400: - case CX23885_BOARD_HAUPPAUGE_HVR1270: case CX23885_BOARD_HAUPPAUGE_HVR1275: case CX23885_BOARD_HAUPPAUGE_HVR1255: case CX23885_BOARD_HAUPPAUGE_HVR1210: /* FIXME: Implement me */ break; + case CX23885_BOARD_HAUPPAUGE_HVR1270: + ret = cx23888_ir_probe(dev); + if (ret) + break; + dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_888_IR); + v4l2_subdev_call(dev->sd_cx25840, core, s_io_pin_config, + ir_rx_pin_cfg_count, ir_rx_pin_cfg); + break; case CX23885_BOARD_HAUPPAUGE_HVR1850: case CX23885_BOARD_HAUPPAUGE_HVR1290: ret = cx23888_ir_probe(dev); @@ -1156,6 +1163,7 @@ int cx23885_ir_init(struct cx23885_dev *dev) void cx23885_ir_fini(struct cx23885_dev *dev) { switch (dev->board) { + case CX23885_BOARD_HAUPPAUGE_HVR1270: case CX23885_BOARD_HAUPPAUGE_HVR1850: case CX23885_BOARD_HAUPPAUGE_HVR1290: cx23885_irq_remove(dev, PCI_MSK_IR); @@ -1199,6 +1207,7 @@ int netup_jtag_io(void *device, int tms, int tdi, int read_tdo) void cx23885_ir_pci_int_enable(struct cx23885_dev *dev) { switch (dev->board) { + case CX23885_BOARD_HAUPPAUGE_HVR1270: case CX23885_BOARD_HAUPPAUGE_HVR1850: case CX23885_BOARD_HAUPPAUGE_HVR1290: if (dev->sd_ir) @@ -1357,6 +1366,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: case CX23885_BOARD_COMPRO_VIDEOMATE_E800: + case CX23885_BOARD_HAUPPAUGE_HVR1270: case CX23885_BOARD_HAUPPAUGE_HVR1850: case CX23885_BOARD_MYGICA_X8506: case CX23885_BOARD_MAGICPRO_PROHDTVE2: diff --git a/drivers/media/video/cx23885/cx23885-input.c b/drivers/media/video/cx23885/cx23885-input.c index 1ca6693cb5f8..ce765e3f77bd 100644 --- a/drivers/media/video/cx23885/cx23885-input.c +++ b/drivers/media/video/cx23885/cx23885-input.c @@ -82,6 +82,7 @@ void cx23885_input_rx_work_handler(struct cx23885_dev *dev, u32 events) return; switch (dev->board) { + case CX23885_BOARD_HAUPPAUGE_HVR1270: case CX23885_BOARD_HAUPPAUGE_HVR1850: case CX23885_BOARD_HAUPPAUGE_HVR1290: case CX23885_BOARD_TEVII_S470: @@ -133,6 +134,7 @@ static int cx23885_input_ir_start(struct cx23885_dev *dev) v4l2_subdev_call(dev->sd_ir, ir, rx_g_parameters, ¶ms); switch (dev->board) { + case CX23885_BOARD_HAUPPAUGE_HVR1270: case CX23885_BOARD_HAUPPAUGE_HVR1850: case CX23885_BOARD_HAUPPAUGE_HVR1290: case CX23885_BOARD_HAUPPAUGE_HVR1250: @@ -260,6 +262,7 @@ int cx23885_input_init(struct cx23885_dev *dev) return -ENODEV; switch (dev->board) { + case CX23885_BOARD_HAUPPAUGE_HVR1270: case CX23885_BOARD_HAUPPAUGE_HVR1850: case CX23885_BOARD_HAUPPAUGE_HVR1290: case CX23885_BOARD_HAUPPAUGE_HVR1250: -- cgit v1.2.3 From 8c528d5e51af26fd71ca6b5e39dfd1b4bd34c505 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 10 Jun 2011 07:43:26 -0300 Subject: [media] media: DVB_NET must depend on DVB_CORE Signed-off-by: Guennadi Liakhovetski Signed-off-by: Mauro Carvalho Chehab --- drivers/media/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index dc61895abcf5..c2ee0aa53db9 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig @@ -87,7 +87,7 @@ config DVB_CORE config DVB_NET bool "DVB Network Support" default (NET && INET) - depends on NET && INET + depends on NET && INET && DVB_CORE help The DVB network support in the DVB core can optionally be disabled if this -- cgit v1.2.3 From 9cd49719fda38613e9d7c712b11a54ea4ea005dc Mon Sep 17 00:00:00 2001 From: Richard Röjfors Date: Fri, 10 Jun 2011 11:48:48 -0300 Subject: [media] radio-timb: Simplified platform data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch simplifies the platform data slightly, by removing unused elements. Signed-off-by: Richard Röjfors Signed-off-by: Mauro Carvalho Chehab --- drivers/mfd/timberdale.c | 8 ++------ include/media/timb_radio.h | 9 ++------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/mfd/timberdale.c b/drivers/mfd/timberdale.c index 69272e4e3459..696879e2eef7 100644 --- a/drivers/mfd/timberdale.c +++ b/drivers/mfd/timberdale.c @@ -287,12 +287,8 @@ static __devinitdata struct i2c_board_info timberdale_saa7706_i2c_board_info = { static __devinitdata struct timb_radio_platform_data timberdale_radio_platform_data = { .i2c_adapter = 0, - .tuner = { - .info = &timberdale_tef6868_i2c_board_info - }, - .dsp = { - .info = &timberdale_saa7706_i2c_board_info - } + .tuner = &timberdale_tef6868_i2c_board_info, + .dsp = &timberdale_saa7706_i2c_board_info }; static const __devinitconst struct resource timberdale_video_resources[] = { diff --git a/include/media/timb_radio.h b/include/media/timb_radio.h index a59a84854dc1..a40a6a348d21 100644 --- a/include/media/timb_radio.h +++ b/include/media/timb_radio.h @@ -23,13 +23,8 @@ struct timb_radio_platform_data { int i2c_adapter; /* I2C adapter where the tuner and dsp are attached */ - struct { - struct i2c_board_info *info; - } tuner; - struct { - const char *module_name; - struct i2c_board_info *info; - } dsp; + struct i2c_board_info *tuner; + struct i2c_board_info *dsp; }; #endif -- cgit v1.2.3 From 6a529c1a4a87e0f5d143ad3bc0d37179332f210e Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Sat, 11 Jun 2011 10:28:59 -0300 Subject: [media] tea575x: allow multiple opens Change locking to allow tea575x-radio device to be opened multiple times. Signed-off-by: Ondrej Zary Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/sound/tea575x-tuner.h | 2 +- sound/i2c/other/tea575x-tuner.c | 22 +++------------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h index 5aa8186e7820..726e94742a5c 100644 --- a/include/sound/tea575x-tuner.h +++ b/include/sound/tea575x-tuner.h @@ -49,7 +49,7 @@ struct snd_tea575x { bool tuned; /* tuned to a station */ unsigned int val; /* hw value */ unsigned long freq; /* frequency */ - unsigned long in_use; /* set if the device is in use */ + struct mutex mutex; struct snd_tea575x_ops *ops; void *private_data; u8 card[32]; diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c index 0d7a659c494c..beb0e86537cd 100644 --- a/sound/i2c/other/tea575x-tuner.c +++ b/sound/i2c/other/tea575x-tuner.c @@ -282,26 +282,9 @@ static int vidioc_s_input(struct file *filp, void *priv, unsigned int i) return 0; } -static int snd_tea575x_exclusive_open(struct file *file) -{ - struct snd_tea575x *tea = video_drvdata(file); - - return test_and_set_bit(0, &tea->in_use) ? -EBUSY : 0; -} - -static int snd_tea575x_exclusive_release(struct file *file) -{ - struct snd_tea575x *tea = video_drvdata(file); - - clear_bit(0, &tea->in_use); - return 0; -} - static const struct v4l2_file_operations tea575x_fops = { .owner = THIS_MODULE, - .open = snd_tea575x_exclusive_open, - .release = snd_tea575x_exclusive_release, - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, }; static const struct v4l2_ioctl_ops tea575x_ioctl_ops = { @@ -340,13 +323,14 @@ int snd_tea575x_init(struct snd_tea575x *tea) if (snd_tea575x_read(tea) != 0x55AA) return -ENODEV; - tea->in_use = 0; tea->val = TEA575X_BIT_BAND_FM | TEA575X_BIT_SEARCH_10_40; tea->freq = 90500 * 16; /* 90.5Mhz default */ snd_tea575x_set_freq(tea); tea->vd = tea575x_radio; video_set_drvdata(&tea->vd, tea); + mutex_init(&tea->mutex); + tea->vd.lock = &tea->mutex; v4l2_ctrl_handler_init(&tea->ctrl_handler, 1); tea->vd.ctrl_handler = &tea->ctrl_handler; -- cgit v1.2.3 From b7a80f341da5d40a4d483f8c9246133c8591de87 Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Sat, 11 Jun 2011 10:37:29 -0300 Subject: [media] tea575x: remove useless input ioctls Remove empty and useless g_input and s_input ioctls. This fixes one fail of v4l2-compliance test. Signed-off-by: Ondrej Zary Signed-off-by: Mauro Carvalho Chehab --- sound/i2c/other/tea575x-tuner.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c index beb0e86537cd..484a35b3715f 100644 --- a/sound/i2c/other/tea575x-tuner.c +++ b/sound/i2c/other/tea575x-tuner.c @@ -269,19 +269,6 @@ static int tea575x_s_ctrl(struct v4l2_ctrl *ctrl) return -EINVAL; } -static int vidioc_g_input(struct file *filp, void *priv, unsigned int *i) -{ - *i = 0; - return 0; -} - -static int vidioc_s_input(struct file *filp, void *priv, unsigned int i) -{ - if (i != 0) - return -EINVAL; - return 0; -} - static const struct v4l2_file_operations tea575x_fops = { .owner = THIS_MODULE, .unlocked_ioctl = video_ioctl2, @@ -293,8 +280,6 @@ static const struct v4l2_ioctl_ops tea575x_ioctl_ops = { .vidioc_s_tuner = vidioc_s_tuner, .vidioc_g_audio = vidioc_g_audio, .vidioc_s_audio = vidioc_s_audio, - .vidioc_g_input = vidioc_g_input, - .vidioc_s_input = vidioc_s_input, .vidioc_g_frequency = vidioc_g_frequency, .vidioc_s_frequency = vidioc_s_frequency, }; -- cgit v1.2.3 From d2434147b30475577615ce261eab796be9f2bb09 Mon Sep 17 00:00:00 2001 From: Bjørn Mork Date: Tue, 14 Jun 2011 09:42:47 -0300 Subject: [media] V4L1 API has been moved into "legacy" on the linuxtv.org site MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bjørn Mork Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/API.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/video4linux/API.html b/Documentation/video4linux/API.html index d72fd2aa9158..256f8efa992c 100644 --- a/Documentation/video4linux/API.html +++ b/Documentation/video4linux/API.html @@ -9,7 +9,7 @@
- V4L original API + V4L original API Obsoleted by V4L2 API -- cgit v1.2.3 From 3e1a4c1ff90002762998e0d13c8edc2e7aa8d736 Mon Sep 17 00:00:00 2001 From: Bjørn Mork Date: Tue, 14 Jun 2011 09:59:14 -0300 Subject: [media] DVB API: Mention the dvbM device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bjørn Mork Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/dvb/intro.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/DocBook/media/dvb/intro.xml b/Documentation/DocBook/media/dvb/intro.xml index 82236396eef3..c75dc7cc3e9b 100644 --- a/Documentation/DocBook/media/dvb/intro.xml +++ b/Documentation/DocBook/media/dvb/intro.xml @@ -154,6 +154,10 @@ are called: +/dev/dvb/adapterN/dvrM, + + + /dev/dvb/adapterN/caM, where N enumerates the DVB PCI cards in a system starting -- cgit v1.2.3 From fe45e2551f565c87559434205963fc56bbe205fa Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Wed, 15 Jun 2011 10:32:06 -0300 Subject: [media] dvb-usb/technisat-usb2: don't use flush_scheduled_work() flush_scheduled_work() is deprecated and scheduled to be removed. technisat-usb2 already sync-cancels the only work item it uses and there's no reason for it to call flush_scheduled_work(). Don't use it. Signed-off-by: Tejun Heo Cc: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/technisat-usb2.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/dvb/dvb-usb/technisat-usb2.c b/drivers/media/dvb/dvb-usb/technisat-usb2.c index 08f8842ad280..473b95ed4d52 100644 --- a/drivers/media/dvb/dvb-usb/technisat-usb2.c +++ b/drivers/media/dvb/dvb-usb/technisat-usb2.c @@ -765,10 +765,8 @@ static void technisat_usb2_disconnect(struct usb_interface *intf) /* work and stuff was only created when the device is is hot-state */ if (dev != NULL) { struct technisat_usb2_state *state = dev->priv; - if (state != NULL) { + if (state != NULL) cancel_delayed_work_sync(&state->green_led_work); - flush_scheduled_work(); - } } dvb_usb_device_exit(intf); -- cgit v1.2.3 From 3735edf9fd8bfa6e31025a7cc73447516278000b Mon Sep 17 00:00:00 2001 From: Greg Dietsche Date: Thu, 16 Jun 2011 13:33:35 -0300 Subject: [media] dvb: remove unnecessary code remove unnecessary code that matches this coccinelle pattern if (...) return ret; return ret; Signed-off-by: Greg Dietsche Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/cx24116.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/media/dvb/frontends/cx24116.c b/drivers/media/dvb/frontends/cx24116.c index 95c6465b87a1..ccd05255d527 100644 --- a/drivers/media/dvb/frontends/cx24116.c +++ b/drivers/media/dvb/frontends/cx24116.c @@ -1452,11 +1452,7 @@ tuned: /* Set/Reset B/W */ cmd.args[0x00] = CMD_BANDWIDTH; cmd.args[0x01] = 0x00; cmd.len = 0x02; - ret = cx24116_cmd_execute(fe, &cmd); - if (ret != 0) - return ret; - - return ret; + return cx24116_cmd_execute(fe, &cmd); } static int cx24116_tune(struct dvb_frontend *fe, struct dvb_frontend_parameters *params, -- cgit v1.2.3 From 9a78efc8fbd6776cd0f704be9cac7b013f3d3d16 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Thu, 16 Jun 2011 16:06:56 -0300 Subject: [media] DVB: dvb-net, make the kconfig text helpful Telling the user they can disable an option if they want is not the much useful. Describe what it is good for instead. The text was derived from Mauro's email. Signed-off-by: Jiri Slaby Cc: Mauro Carvalho Chehab Cc: Hans Petter Selasky Acked-by: Randy Dunlap Acked-by: Hans Petter Selasky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/Kconfig | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index c2ee0aa53db9..9575db429df4 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig @@ -89,11 +89,13 @@ config DVB_NET default (NET && INET) depends on NET && INET && DVB_CORE help - The DVB network support in the DVB core can - optionally be disabled if this - option is set to N. + This option enables DVB Network Support which is a part of the DVB + standard. It is used, for example, by automatic firmware updates used + on Set-Top-Boxes. It can also be used to access the Internet via the + DVB card, if the network provider supports it. - If unsure say Y. + You may want to disable the network support on embedded devices. If + unsure say Y. config VIDEO_MEDIA tristate -- cgit v1.2.3 From a2c25b444e99f2369b29e507568c8703186174d0 Mon Sep 17 00:00:00 2001 From: Manjunath Hadli Date: Fri, 17 Jun 2011 04:01:31 -0300 Subject: [media] davinci vpbe: V4L2 display driver for DM644X SoC This is the display driver for Texas Instruments's DM644X family SoC. This patch contains the main implementation of the driver with the V4L2 interface. The driver implements the streaming model with support for both kernel allocated buffers and user pointers. It also implements all of the necessary IOCTLs necessary and supported by the video display device. Signed-off-by: Manjunath Hadli Acked-by: Muralidharan Karicheri Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/davinci/vpbe_display.c | 1860 ++++++++++++++++++++++++++++ include/media/davinci/vpbe_display.h | 147 +++ include/media/davinci/vpbe_types.h | 91 ++ 3 files changed, 2098 insertions(+) create mode 100644 drivers/media/video/davinci/vpbe_display.c create mode 100644 include/media/davinci/vpbe_display.h create mode 100644 include/media/davinci/vpbe_types.h diff --git a/drivers/media/video/davinci/vpbe_display.c b/drivers/media/video/davinci/vpbe_display.c new file mode 100644 index 000000000000..7f1d83a6d575 --- /dev/null +++ b/drivers/media/video/davinci/vpbe_display.c @@ -0,0 +1,1860 @@ +/* + * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation version 2. + * + * This program is distributed WITHOUT ANY WARRANTY of any + * kind, whether express or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "vpbe_venc_regs.h" + +#define VPBE_DISPLAY_DRIVER "vpbe-v4l2" + +static int debug; + +#define VPBE_DISPLAY_SD_BUF_SIZE (720*576*2) +#define VPBE_DEFAULT_NUM_BUFS 3 + +module_param(debug, int, 0644); + +static int venc_is_second_field(struct vpbe_display *disp_dev) +{ + struct vpbe_device *vpbe_dev = disp_dev->vpbe_dev; + int ret; + int val; + + ret = v4l2_subdev_call(vpbe_dev->venc, + core, + ioctl, + VENC_GET_FLD, + &val); + if (ret < 0) { + v4l2_err(&vpbe_dev->v4l2_dev, + "Error in getting Field ID 0\n"); + } + return val; +} + +static void vpbe_isr_even_field(struct vpbe_display *disp_obj, + struct vpbe_layer *layer) +{ + struct timespec timevalue; + + if (layer->cur_frm == layer->next_frm) + return; + ktime_get_ts(&timevalue); + layer->cur_frm->ts.tv_sec = timevalue.tv_sec; + layer->cur_frm->ts.tv_usec = timevalue.tv_nsec / NSEC_PER_USEC; + layer->cur_frm->state = VIDEOBUF_DONE; + wake_up_interruptible(&layer->cur_frm->done); + /* Make cur_frm pointing to next_frm */ + layer->cur_frm = layer->next_frm; +} + +static void vpbe_isr_odd_field(struct vpbe_display *disp_obj, + struct vpbe_layer *layer) +{ + struct osd_state *osd_device = disp_obj->osd_device; + unsigned long addr; + + spin_lock(&disp_obj->dma_queue_lock); + if (list_empty(&layer->dma_queue) || + (layer->cur_frm != layer->next_frm)) { + spin_unlock(&disp_obj->dma_queue_lock); + return; + } + /* + * one field is displayed configure + * the next frame if it is available + * otherwise hold on current frame + * Get next from the buffer queue + */ + layer->next_frm = list_entry( + layer->dma_queue.next, + struct videobuf_buffer, + queue); + /* Remove that from the buffer queue */ + list_del(&layer->next_frm->queue); + spin_unlock(&disp_obj->dma_queue_lock); + /* Mark state of the frame to active */ + layer->next_frm->state = VIDEOBUF_ACTIVE; + addr = videobuf_to_dma_contig(layer->next_frm); + osd_device->ops.start_layer(osd_device, + layer->layer_info.id, + addr, + disp_obj->cbcr_ofst); +} + +/* interrupt service routine */ +static irqreturn_t venc_isr(int irq, void *arg) +{ + struct vpbe_display *disp_dev = (struct vpbe_display *)arg; + struct vpbe_layer *layer; + static unsigned last_event; + unsigned event = 0; + int fid; + int i; + + if ((NULL == arg) || (NULL == disp_dev->dev[0])) + return IRQ_HANDLED; + + if (venc_is_second_field(disp_dev)) + event |= VENC_SECOND_FIELD; + else + event |= VENC_FIRST_FIELD; + + if (event == (last_event & ~VENC_END_OF_FRAME)) { + /* + * If the display is non-interlaced, then we need to flag the + * end-of-frame event at every interrupt regardless of the + * value of the FIDST bit. We can conclude that the display is + * non-interlaced if the value of the FIDST bit is unchanged + * from the previous interrupt. + */ + event |= VENC_END_OF_FRAME; + } else if (event == VENC_SECOND_FIELD) { + /* end-of-frame for interlaced display */ + event |= VENC_END_OF_FRAME; + } + last_event = event; + + for (i = 0; i < VPBE_DISPLAY_MAX_DEVICES; i++) { + layer = disp_dev->dev[i]; + /* If streaming is started in this layer */ + if (!layer->started) + continue; + + if (layer->layer_first_int) { + layer->layer_first_int = 0; + continue; + } + /* Check the field format */ + if ((V4L2_FIELD_NONE == layer->pix_fmt.field) && + (event & VENC_END_OF_FRAME)) { + /* Progressive mode */ + + vpbe_isr_even_field(disp_dev, layer); + vpbe_isr_odd_field(disp_dev, layer); + } else { + /* Interlaced mode */ + + layer->field_id ^= 1; + if (event & VENC_FIRST_FIELD) + fid = 0; + else + fid = 1; + + /* + * If field id does not match with store + * field id + */ + if (fid != layer->field_id) { + /* Make them in sync */ + layer->field_id = fid; + continue; + } + /* + * device field id and local field id are + * in sync. If this is even field + */ + if (0 == fid) + vpbe_isr_even_field(disp_dev, layer); + else /* odd field */ + vpbe_isr_odd_field(disp_dev, layer); + } + } + + return IRQ_HANDLED; +} + +/* + * vpbe_buffer_prepare() + * This is the callback function called from videobuf_qbuf() function + * the buffer is prepared and user space virtual address is converted into + * physical address + */ +static int vpbe_buffer_prepare(struct videobuf_queue *q, + struct videobuf_buffer *vb, + enum v4l2_field field) +{ + struct vpbe_fh *fh = q->priv_data; + struct vpbe_layer *layer = fh->layer; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + unsigned long addr; + int ret; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, + "vpbe_buffer_prepare\n"); + + /* If buffer is not initialized, initialize it */ + if (VIDEOBUF_NEEDS_INIT == vb->state) { + vb->width = layer->pix_fmt.width; + vb->height = layer->pix_fmt.height; + vb->size = layer->pix_fmt.sizeimage; + vb->field = field; + + ret = videobuf_iolock(q, vb, NULL); + if (ret < 0) { + v4l2_err(&vpbe_dev->v4l2_dev, "Failed to map \ + user address\n"); + return -EINVAL; + } + + addr = videobuf_to_dma_contig(vb); + + if (q->streaming) { + if (!IS_ALIGNED(addr, 8)) { + v4l2_err(&vpbe_dev->v4l2_dev, + "buffer_prepare:offset is \ + not aligned to 32 bytes\n"); + return -EINVAL; + } + } + vb->state = VIDEOBUF_PREPARED; + } + return 0; +} + +/* + * vpbe_buffer_setup() + * This function allocates memory for the buffers + */ +static int vpbe_buffer_setup(struct videobuf_queue *q, + unsigned int *count, + unsigned int *size) +{ + /* Get the file handle object and layer object */ + struct vpbe_fh *fh = q->priv_data; + struct vpbe_layer *layer = fh->layer; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe_buffer_setup\n"); + + *size = layer->pix_fmt.sizeimage; + + /* Store number of buffers allocated in numbuffer member */ + if (*count < VPBE_DEFAULT_NUM_BUFS) + *count = layer->numbuffers = VPBE_DEFAULT_NUM_BUFS; + + return 0; +} + +/* + * vpbe_buffer_queue() + * This function adds the buffer to DMA queue + */ +static void vpbe_buffer_queue(struct videobuf_queue *q, + struct videobuf_buffer *vb) +{ + /* Get the file handle object and layer object */ + struct vpbe_fh *fh = q->priv_data; + struct vpbe_layer *layer = fh->layer; + struct vpbe_display *disp = fh->disp_dev; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + unsigned long flags; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, + "vpbe_buffer_queue\n"); + + /* add the buffer to the DMA queue */ + spin_lock_irqsave(&disp->dma_queue_lock, flags); + list_add_tail(&vb->queue, &layer->dma_queue); + spin_unlock_irqrestore(&disp->dma_queue_lock, flags); + /* Change state of the buffer */ + vb->state = VIDEOBUF_QUEUED; +} + +/* + * vpbe_buffer_release() + * This function is called from the videobuf layer to free memory allocated to + * the buffers + */ +static void vpbe_buffer_release(struct videobuf_queue *q, + struct videobuf_buffer *vb) +{ + /* Get the file handle object and layer object */ + struct vpbe_fh *fh = q->priv_data; + struct vpbe_layer *layer = fh->layer; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, + "vpbe_buffer_release\n"); + + if (V4L2_MEMORY_USERPTR != layer->memory) + videobuf_dma_contig_free(q, vb); + + vb->state = VIDEOBUF_NEEDS_INIT; +} + +static struct videobuf_queue_ops video_qops = { + .buf_setup = vpbe_buffer_setup, + .buf_prepare = vpbe_buffer_prepare, + .buf_queue = vpbe_buffer_queue, + .buf_release = vpbe_buffer_release, +}; + +static +struct vpbe_layer* +_vpbe_display_get_other_win_layer(struct vpbe_display *disp_dev, + struct vpbe_layer *layer) +{ + enum vpbe_display_device_id thiswin, otherwin; + thiswin = layer->device_id; + + otherwin = (thiswin == VPBE_DISPLAY_DEVICE_0) ? + VPBE_DISPLAY_DEVICE_1 : VPBE_DISPLAY_DEVICE_0; + return disp_dev->dev[otherwin]; +} + +static int vpbe_set_osd_display_params(struct vpbe_display *disp_dev, + struct vpbe_layer *layer) +{ + struct osd_layer_config *cfg = &layer->layer_info.config; + struct osd_state *osd_device = disp_dev->osd_device; + struct vpbe_device *vpbe_dev = disp_dev->vpbe_dev; + unsigned long addr; + int ret; + + addr = videobuf_to_dma_contig(layer->cur_frm); + /* Set address in the display registers */ + osd_device->ops.start_layer(osd_device, + layer->layer_info.id, + addr, + disp_dev->cbcr_ofst); + + ret = osd_device->ops.enable_layer(osd_device, + layer->layer_info.id, 0); + if (ret < 0) { + v4l2_err(&vpbe_dev->v4l2_dev, + "Error in enabling osd window layer 0\n"); + return -1; + } + + /* Enable the window */ + layer->layer_info.enable = 1; + if (cfg->pixfmt == PIXFMT_NV12) { + struct vpbe_layer *otherlayer = + _vpbe_display_get_other_win_layer(disp_dev, layer); + + ret = osd_device->ops.enable_layer(osd_device, + otherlayer->layer_info.id, 1); + if (ret < 0) { + v4l2_err(&vpbe_dev->v4l2_dev, + "Error in enabling osd window layer 1\n"); + return -1; + } + otherlayer->layer_info.enable = 1; + } + return 0; +} + +static void +vpbe_disp_calculate_scale_factor(struct vpbe_display *disp_dev, + struct vpbe_layer *layer, + int expected_xsize, int expected_ysize) +{ + struct display_layer_info *layer_info = &layer->layer_info; + struct v4l2_pix_format *pixfmt = &layer->pix_fmt; + struct osd_layer_config *cfg = &layer->layer_info.config; + struct vpbe_device *vpbe_dev = disp_dev->vpbe_dev; + int calculated_xsize; + int h_exp = 0; + int v_exp = 0; + int h_scale; + int v_scale; + + v4l2_std_id standard_id = vpbe_dev->current_timings.timings.std_id; + + /* + * Application initially set the image format. Current display + * size is obtained from the vpbe display controller. expected_xsize + * and expected_ysize are set through S_CROP ioctl. Based on this, + * driver will calculate the scale factors for vertical and + * horizontal direction so that the image is displayed scaled + * and expanded. Application uses expansion to display the image + * in a square pixel. Otherwise it is displayed using displays + * pixel aspect ratio.It is expected that application chooses + * the crop coordinates for cropped or scaled display. if crop + * size is less than the image size, it is displayed cropped or + * it is displayed scaled and/or expanded. + * + * to begin with, set the crop window same as expected. Later we + * will override with scaled window size + */ + + cfg->xsize = pixfmt->width; + cfg->ysize = pixfmt->height; + layer_info->h_zoom = ZOOM_X1; /* no horizontal zoom */ + layer_info->v_zoom = ZOOM_X1; /* no horizontal zoom */ + layer_info->h_exp = H_EXP_OFF; /* no horizontal zoom */ + layer_info->v_exp = V_EXP_OFF; /* no horizontal zoom */ + + if (pixfmt->width < expected_xsize) { + h_scale = vpbe_dev->current_timings.xres / pixfmt->width; + if (h_scale < 2) + h_scale = 1; + else if (h_scale >= 4) + h_scale = 4; + else + h_scale = 2; + cfg->xsize *= h_scale; + if (cfg->xsize < expected_xsize) { + if ((standard_id & V4L2_STD_525_60) || + (standard_id & V4L2_STD_625_50)) { + calculated_xsize = (cfg->xsize * + VPBE_DISPLAY_H_EXP_RATIO_N) / + VPBE_DISPLAY_H_EXP_RATIO_D; + if (calculated_xsize <= expected_xsize) { + h_exp = 1; + cfg->xsize = calculated_xsize; + } + } + } + if (h_scale == 2) + layer_info->h_zoom = ZOOM_X2; + else if (h_scale == 4) + layer_info->h_zoom = ZOOM_X4; + if (h_exp) + layer_info->h_exp = H_EXP_9_OVER_8; + } else { + /* no scaling, only cropping. Set display area to crop area */ + cfg->xsize = expected_xsize; + } + + if (pixfmt->height < expected_ysize) { + v_scale = expected_ysize / pixfmt->height; + if (v_scale < 2) + v_scale = 1; + else if (v_scale >= 4) + v_scale = 4; + else + v_scale = 2; + cfg->ysize *= v_scale; + if (cfg->ysize < expected_ysize) { + if ((standard_id & V4L2_STD_625_50)) { + calculated_xsize = (cfg->ysize * + VPBE_DISPLAY_V_EXP_RATIO_N) / + VPBE_DISPLAY_V_EXP_RATIO_D; + if (calculated_xsize <= expected_ysize) { + v_exp = 1; + cfg->ysize = calculated_xsize; + } + } + } + if (v_scale == 2) + layer_info->v_zoom = ZOOM_X2; + else if (v_scale == 4) + layer_info->v_zoom = ZOOM_X4; + if (v_exp) + layer_info->h_exp = V_EXP_6_OVER_5; + } else { + /* no scaling, only cropping. Set display area to crop area */ + cfg->ysize = expected_ysize; + } + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, + "crop display xsize = %d, ysize = %d\n", + cfg->xsize, cfg->ysize); +} + +static void vpbe_disp_adj_position(struct vpbe_display *disp_dev, + struct vpbe_layer *layer, + int top, int left) +{ + struct osd_layer_config *cfg = &layer->layer_info.config; + struct vpbe_device *vpbe_dev = disp_dev->vpbe_dev; + + cfg->xpos = min((unsigned int)left, + vpbe_dev->current_timings.xres - cfg->xsize); + cfg->ypos = min((unsigned int)top, + vpbe_dev->current_timings.yres - cfg->ysize); + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, + "new xpos = %d, ypos = %d\n", + cfg->xpos, cfg->ypos); +} + +static void vpbe_disp_check_window_params(struct vpbe_display *disp_dev, + struct v4l2_rect *c) +{ + struct vpbe_device *vpbe_dev = disp_dev->vpbe_dev; + + if ((c->width == 0) || + ((c->width + c->left) > vpbe_dev->current_timings.xres)) + c->width = vpbe_dev->current_timings.xres - c->left; + + if ((c->height == 0) || ((c->height + c->top) > + vpbe_dev->current_timings.yres)) + c->height = vpbe_dev->current_timings.yres - c->top; + + /* window height must be even for interlaced display */ + if (vpbe_dev->current_timings.interlaced) + c->height &= (~0x01); + +} + +/** + * vpbe_try_format() + * If user application provides width and height, and have bytesperline set + * to zero, driver calculates bytesperline and sizeimage based on hardware + * limits. + */ +static int vpbe_try_format(struct vpbe_display *disp_dev, + struct v4l2_pix_format *pixfmt, int check) +{ + struct vpbe_device *vpbe_dev = disp_dev->vpbe_dev; + int min_height = 1; + int min_width = 32; + int max_height; + int max_width; + int bpp; + + if ((pixfmt->pixelformat != V4L2_PIX_FMT_UYVY) && + (pixfmt->pixelformat != V4L2_PIX_FMT_NV12)) + /* choose default as V4L2_PIX_FMT_UYVY */ + pixfmt->pixelformat = V4L2_PIX_FMT_UYVY; + + /* Check the field format */ + if ((pixfmt->field != V4L2_FIELD_INTERLACED) && + (pixfmt->field != V4L2_FIELD_NONE)) { + if (vpbe_dev->current_timings.interlaced) + pixfmt->field = V4L2_FIELD_INTERLACED; + else + pixfmt->field = V4L2_FIELD_NONE; + } + + if (pixfmt->field == V4L2_FIELD_INTERLACED) + min_height = 2; + + if (pixfmt->pixelformat == V4L2_PIX_FMT_NV12) + bpp = 1; + else + bpp = 2; + + max_width = vpbe_dev->current_timings.xres; + max_height = vpbe_dev->current_timings.yres; + + min_width /= bpp; + + if (!pixfmt->width || (pixfmt->width < min_width) || + (pixfmt->width > max_width)) { + pixfmt->width = vpbe_dev->current_timings.xres; + } + + if (!pixfmt->height || (pixfmt->height < min_height) || + (pixfmt->height > max_height)) { + pixfmt->height = vpbe_dev->current_timings.yres; + } + + if (pixfmt->bytesperline < (pixfmt->width * bpp)) + pixfmt->bytesperline = pixfmt->width * bpp; + + /* Make the bytesperline 32 byte aligned */ + pixfmt->bytesperline = ((pixfmt->width * bpp + 31) & ~31); + + if (pixfmt->pixelformat == V4L2_PIX_FMT_NV12) + pixfmt->sizeimage = pixfmt->bytesperline * pixfmt->height + + (pixfmt->bytesperline * pixfmt->height >> 1); + else + pixfmt->sizeimage = pixfmt->bytesperline * pixfmt->height; + + return 0; +} + +static int vpbe_display_g_priority(struct file *file, void *priv, + enum v4l2_priority *p) +{ + struct vpbe_fh *fh = file->private_data; + struct vpbe_layer *layer = fh->layer; + + *p = v4l2_prio_max(&layer->prio); + + return 0; +} + +static int vpbe_display_s_priority(struct file *file, void *priv, + enum v4l2_priority p) +{ + struct vpbe_fh *fh = file->private_data; + struct vpbe_layer *layer = fh->layer; + int ret; + + ret = v4l2_prio_change(&layer->prio, &fh->prio, p); + + return ret; +} + +static int vpbe_display_querycap(struct file *file, void *priv, + struct v4l2_capability *cap) +{ + struct vpbe_fh *fh = file->private_data; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + + cap->version = VPBE_DISPLAY_VERSION_CODE; + cap->capabilities = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING; + strlcpy(cap->driver, VPBE_DISPLAY_DRIVER, sizeof(cap->driver)); + strlcpy(cap->bus_info, "platform", sizeof(cap->bus_info)); + strlcpy(cap->card, vpbe_dev->cfg->module_name, sizeof(cap->card)); + + return 0; +} + +static int vpbe_display_s_crop(struct file *file, void *priv, + struct v4l2_crop *crop) +{ + struct vpbe_fh *fh = file->private_data; + struct vpbe_layer *layer = fh->layer; + struct vpbe_display *disp_dev = fh->disp_dev; + struct vpbe_device *vpbe_dev = disp_dev->vpbe_dev; + struct osd_layer_config *cfg = &layer->layer_info.config; + struct osd_state *osd_device = disp_dev->osd_device; + struct v4l2_rect *rect = &crop->c; + int ret; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, + "VIDIOC_S_CROP, layer id = %d\n", layer->device_id); + + if (crop->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) { + v4l2_err(&vpbe_dev->v4l2_dev, "Invalid buf type\n"); + return -EINVAL; + } + + if (rect->top < 0) + rect->top = 0; + if (rect->left < 0) + rect->left = 0; + + vpbe_disp_check_window_params(disp_dev, rect); + + osd_device->ops.get_layer_config(osd_device, + layer->layer_info.id, cfg); + + vpbe_disp_calculate_scale_factor(disp_dev, layer, + rect->width, + rect->height); + vpbe_disp_adj_position(disp_dev, layer, rect->top, + rect->left); + ret = osd_device->ops.set_layer_config(osd_device, + layer->layer_info.id, cfg); + if (ret < 0) { + v4l2_err(&vpbe_dev->v4l2_dev, + "Error in set layer config:\n"); + return -EINVAL; + } + + /* apply zooming and h or v expansion */ + osd_device->ops.set_zoom(osd_device, + layer->layer_info.id, + layer->layer_info.h_zoom, + layer->layer_info.v_zoom); + ret = osd_device->ops.set_vid_expansion(osd_device, + layer->layer_info.h_exp, + layer->layer_info.v_exp); + if (ret < 0) { + v4l2_err(&vpbe_dev->v4l2_dev, + "Error in set vid expansion:\n"); + return -EINVAL; + } + + if ((layer->layer_info.h_zoom != ZOOM_X1) || + (layer->layer_info.v_zoom != ZOOM_X1) || + (layer->layer_info.h_exp != H_EXP_OFF) || + (layer->layer_info.v_exp != V_EXP_OFF)) + /* Enable expansion filter */ + osd_device->ops.set_interpolation_filter(osd_device, 1); + else + osd_device->ops.set_interpolation_filter(osd_device, 0); + + return 0; +} + +static int vpbe_display_g_crop(struct file *file, void *priv, + struct v4l2_crop *crop) +{ + struct vpbe_fh *fh = file->private_data; + struct vpbe_layer *layer = fh->layer; + struct osd_layer_config *cfg = &layer->layer_info.config; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + struct osd_state *osd_device = fh->disp_dev->osd_device; + struct v4l2_rect *rect = &crop->c; + int ret; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, + "VIDIOC_G_CROP, layer id = %d\n", + layer->device_id); + + if (crop->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) { + v4l2_err(&vpbe_dev->v4l2_dev, "Invalid buf type\n"); + ret = -EINVAL; + } + osd_device->ops.get_layer_config(osd_device, + layer->layer_info.id, cfg); + rect->top = cfg->ypos; + rect->left = cfg->xpos; + rect->width = cfg->xsize; + rect->height = cfg->ysize; + + return 0; +} + +static int vpbe_display_cropcap(struct file *file, void *priv, + struct v4l2_cropcap *cropcap) +{ + struct vpbe_fh *fh = file->private_data; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_CROPCAP ioctl\n"); + + cropcap->type = V4L2_BUF_TYPE_VIDEO_OUTPUT; + cropcap->bounds.left = 0; + cropcap->bounds.top = 0; + cropcap->bounds.width = vpbe_dev->current_timings.xres; + cropcap->bounds.height = vpbe_dev->current_timings.yres; + cropcap->pixelaspect = vpbe_dev->current_timings.aspect; + cropcap->defrect = cropcap->bounds; + return 0; +} + +static int vpbe_display_g_fmt(struct file *file, void *priv, + struct v4l2_format *fmt) +{ + struct vpbe_fh *fh = file->private_data; + struct vpbe_layer *layer = fh->layer; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, + "VIDIOC_G_FMT, layer id = %d\n", + layer->device_id); + + /* If buffer type is video output */ + if (V4L2_BUF_TYPE_VIDEO_OUTPUT != fmt->type) { + v4l2_err(&vpbe_dev->v4l2_dev, "invalid type\n"); + return -EINVAL; + } + /* Fill in the information about format */ + fmt->fmt.pix = layer->pix_fmt; + + return 0; +} + +static int vpbe_display_enum_fmt(struct file *file, void *priv, + struct v4l2_fmtdesc *fmt) +{ + struct vpbe_fh *fh = file->private_data; + struct vpbe_layer *layer = fh->layer; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + unsigned int index = 0; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, + "VIDIOC_ENUM_FMT, layer id = %d\n", + layer->device_id); + if (fmt->index > 1) { + v4l2_err(&vpbe_dev->v4l2_dev, "Invalid format index\n"); + return -EINVAL; + } + + /* Fill in the information about format */ + index = fmt->index; + memset(fmt, 0, sizeof(*fmt)); + fmt->index = index; + fmt->type = V4L2_BUF_TYPE_VIDEO_OUTPUT; + if (index == 0) { + strcpy(fmt->description, "YUV 4:2:2 - UYVY"); + fmt->pixelformat = V4L2_PIX_FMT_UYVY; + } else { + strcpy(fmt->description, "Y/CbCr 4:2:0"); + fmt->pixelformat = V4L2_PIX_FMT_NV12; + } + + return 0; +} + +static int vpbe_display_s_fmt(struct file *file, void *priv, + struct v4l2_format *fmt) +{ + struct vpbe_fh *fh = file->private_data; + struct vpbe_layer *layer = fh->layer; + struct vpbe_display *disp_dev = fh->disp_dev; + struct vpbe_device *vpbe_dev = disp_dev->vpbe_dev; + struct osd_layer_config *cfg = &layer->layer_info.config; + struct v4l2_pix_format *pixfmt = &fmt->fmt.pix; + struct osd_state *osd_device = disp_dev->osd_device; + int ret; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, + "VIDIOC_S_FMT, layer id = %d\n", + layer->device_id); + + /* If streaming is started, return error */ + if (layer->started) { + v4l2_err(&vpbe_dev->v4l2_dev, "Streaming is started\n"); + return -EBUSY; + } + if (V4L2_BUF_TYPE_VIDEO_OUTPUT != fmt->type) { + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "invalid type\n"); + return -EINVAL; + } + /* Check for valid pixel format */ + ret = vpbe_try_format(disp_dev, pixfmt, 1); + if (ret) + return ret; + + /* YUV420 is requested, check availability of the + other video window */ + + layer->pix_fmt = *pixfmt; + + /* Get osd layer config */ + osd_device->ops.get_layer_config(osd_device, + layer->layer_info.id, cfg); + /* Store the pixel format in the layer object */ + cfg->xsize = pixfmt->width; + cfg->ysize = pixfmt->height; + cfg->line_length = pixfmt->bytesperline; + cfg->ypos = 0; + cfg->xpos = 0; + cfg->interlaced = vpbe_dev->current_timings.interlaced; + + if (V4L2_PIX_FMT_UYVY == pixfmt->pixelformat) + cfg->pixfmt = PIXFMT_YCbCrI; + + /* Change of the default pixel format for both video windows */ + if (V4L2_PIX_FMT_NV12 == pixfmt->pixelformat) { + struct vpbe_layer *otherlayer; + cfg->pixfmt = PIXFMT_NV12; + otherlayer = _vpbe_display_get_other_win_layer(disp_dev, + layer); + otherlayer->layer_info.config.pixfmt = PIXFMT_NV12; + } + + /* Set the layer config in the osd window */ + ret = osd_device->ops.set_layer_config(osd_device, + layer->layer_info.id, cfg); + if (ret < 0) { + v4l2_err(&vpbe_dev->v4l2_dev, + "Error in S_FMT params:\n"); + return -EINVAL; + } + + /* Readback and fill the local copy of current pix format */ + osd_device->ops.get_layer_config(osd_device, + layer->layer_info.id, cfg); + + return 0; +} + +static int vpbe_display_try_fmt(struct file *file, void *priv, + struct v4l2_format *fmt) +{ + struct vpbe_fh *fh = file->private_data; + struct vpbe_display *disp_dev = fh->disp_dev; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + struct v4l2_pix_format *pixfmt = &fmt->fmt.pix; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_TRY_FMT\n"); + + if (V4L2_BUF_TYPE_VIDEO_OUTPUT != fmt->type) { + v4l2_err(&vpbe_dev->v4l2_dev, "invalid type\n"); + return -EINVAL; + } + + /* Check for valid field format */ + return vpbe_try_format(disp_dev, pixfmt, 0); + +} + +/** + * vpbe_display_s_std - Set the given standard in the encoder + * + * Sets the standard if supported by the current encoder. Return the status. + * 0 - success & -EINVAL on error + */ +static int vpbe_display_s_std(struct file *file, void *priv, + v4l2_std_id *std_id) +{ + struct vpbe_fh *fh = priv; + struct vpbe_layer *layer = fh->layer; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + int ret; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_STD\n"); + + /* If streaming is started, return error */ + if (layer->started) { + v4l2_err(&vpbe_dev->v4l2_dev, "Streaming is started\n"); + return -EBUSY; + } + if (NULL != vpbe_dev->ops.s_std) { + ret = vpbe_dev->ops.s_std(vpbe_dev, std_id); + if (ret) { + v4l2_err(&vpbe_dev->v4l2_dev, + "Failed to set standard for sub devices\n"); + return -EINVAL; + } + } else { + return -EINVAL; + } + + return 0; +} + +/** + * vpbe_display_g_std - Get the standard in the current encoder + * + * Get the standard in the current encoder. Return the status. 0 - success + * -EINVAL on error + */ +static int vpbe_display_g_std(struct file *file, void *priv, + v4l2_std_id *std_id) +{ + struct vpbe_fh *fh = priv; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_G_STD\n"); + + /* Get the standard from the current encoder */ + if (vpbe_dev->current_timings.timings_type & VPBE_ENC_STD) { + *std_id = vpbe_dev->current_timings.timings.std_id; + return 0; + } + + return -EINVAL; +} + +/** + * vpbe_display_enum_output - enumerate outputs + * + * Enumerates the outputs available at the vpbe display + * returns the status, -EINVAL if end of output list + */ +static int vpbe_display_enum_output(struct file *file, void *priv, + struct v4l2_output *output) +{ + struct vpbe_fh *fh = priv; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + int ret; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_ENUM_OUTPUT\n"); + + /* Enumerate outputs */ + + if (NULL == vpbe_dev->ops.enum_outputs) + return -EINVAL; + + ret = vpbe_dev->ops.enum_outputs(vpbe_dev, output); + if (ret) { + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, + "Failed to enumerate outputs\n"); + return -EINVAL; + } + + return 0; +} + +/** + * vpbe_display_s_output - Set output to + * the output specified by the index + */ +static int vpbe_display_s_output(struct file *file, void *priv, + unsigned int i) +{ + struct vpbe_fh *fh = priv; + struct vpbe_layer *layer = fh->layer; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + int ret; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_OUTPUT\n"); + /* If streaming is started, return error */ + if (layer->started) { + v4l2_err(&vpbe_dev->v4l2_dev, "Streaming is started\n"); + return -EBUSY; + } + if (NULL == vpbe_dev->ops.set_output) + return -EINVAL; + + ret = vpbe_dev->ops.set_output(vpbe_dev, i); + if (ret) { + v4l2_err(&vpbe_dev->v4l2_dev, + "Failed to set output for sub devices\n"); + return -EINVAL; + } + + return 0; +} + +/** + * vpbe_display_g_output - Get output from subdevice + * for a given by the index + */ +static int vpbe_display_g_output(struct file *file, void *priv, + unsigned int *i) +{ + struct vpbe_fh *fh = priv; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_G_OUTPUT\n"); + /* Get the standard from the current encoder */ + *i = vpbe_dev->current_out_index; + + return 0; +} + +/** + * vpbe_display_enum_dv_presets - Enumerate the dv presets + * + * enum the preset in the current encoder. Return the status. 0 - success + * -EINVAL on error + */ +static int +vpbe_display_enum_dv_presets(struct file *file, void *priv, + struct v4l2_dv_enum_preset *preset) +{ + struct vpbe_fh *fh = priv; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + int ret; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_ENUM_DV_PRESETS\n"); + + /* Enumerate outputs */ + if (NULL == vpbe_dev->ops.enum_dv_presets) + return -EINVAL; + + ret = vpbe_dev->ops.enum_dv_presets(vpbe_dev, preset); + if (ret) { + v4l2_err(&vpbe_dev->v4l2_dev, + "Failed to enumerate dv presets info\n"); + return -EINVAL; + } + + return 0; +} + +/** + * vpbe_display_s_dv_preset - Set the dv presets + * + * Set the preset in the current encoder. Return the status. 0 - success + * -EINVAL on error + */ +static int +vpbe_display_s_dv_preset(struct file *file, void *priv, + struct v4l2_dv_preset *preset) +{ + struct vpbe_fh *fh = priv; + struct vpbe_layer *layer = fh->layer; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + int ret; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_DV_PRESETS\n"); + + + /* If streaming is started, return error */ + if (layer->started) { + v4l2_err(&vpbe_dev->v4l2_dev, "Streaming is started\n"); + return -EBUSY; + } + + /* Set the given standard in the encoder */ + if (NULL != vpbe_dev->ops.s_dv_preset) + return -EINVAL; + + ret = vpbe_dev->ops.s_dv_preset(vpbe_dev, preset); + if (ret) { + v4l2_err(&vpbe_dev->v4l2_dev, + "Failed to set the dv presets info\n"); + return -EINVAL; + } + /* set the current norm to zero to be consistent. If STD is used + * v4l2 layer will set the norm properly on successful s_std call + */ + layer->video_dev.current_norm = 0; + + return 0; +} + +/** + * vpbe_display_g_dv_preset - Set the dv presets + * + * Get the preset in the current encoder. Return the status. 0 - success + * -EINVAL on error + */ +static int +vpbe_display_g_dv_preset(struct file *file, void *priv, + struct v4l2_dv_preset *dv_preset) +{ + struct vpbe_fh *fh = priv; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_G_DV_PRESETS\n"); + + /* Get the given standard in the encoder */ + + if (vpbe_dev->current_timings.timings_type & + VPBE_ENC_DV_PRESET) { + dv_preset->preset = + vpbe_dev->current_timings.timings.dv_preset; + } else { + return -EINVAL; + } + + return 0; +} + +static int vpbe_display_streamoff(struct file *file, void *priv, + enum v4l2_buf_type buf_type) +{ + struct vpbe_fh *fh = file->private_data; + struct vpbe_layer *layer = fh->layer; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + struct osd_state *osd_device = fh->disp_dev->osd_device; + int ret; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, + "VIDIOC_STREAMOFF,layer id = %d\n", + layer->device_id); + + if (V4L2_BUF_TYPE_VIDEO_OUTPUT != buf_type) { + v4l2_err(&vpbe_dev->v4l2_dev, "Invalid buffer type\n"); + return -EINVAL; + } + + /* If io is allowed for this file handle, return error */ + if (!fh->io_allowed) { + v4l2_err(&vpbe_dev->v4l2_dev, "No io_allowed\n"); + return -EACCES; + } + + /* If streaming is not started, return error */ + if (!layer->started) { + v4l2_err(&vpbe_dev->v4l2_dev, "streaming not started in layer" + " id = %d\n", layer->device_id); + return -EINVAL; + } + + osd_device->ops.disable_layer(osd_device, + layer->layer_info.id); + layer->started = 0; + ret = videobuf_streamoff(&layer->buffer_queue); + + return ret; +} + +static int vpbe_display_streamon(struct file *file, void *priv, + enum v4l2_buf_type buf_type) +{ + struct vpbe_fh *fh = file->private_data; + struct vpbe_layer *layer = fh->layer; + struct vpbe_display *disp_dev = fh->disp_dev; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + struct osd_state *osd_device = disp_dev->osd_device; + int ret; + + osd_device->ops.disable_layer(osd_device, + layer->layer_info.id); + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_STREAMON, layerid=%d\n", + layer->device_id); + + if (V4L2_BUF_TYPE_VIDEO_OUTPUT != buf_type) { + v4l2_err(&vpbe_dev->v4l2_dev, "Invalid buffer type\n"); + return -EINVAL; + } + + /* If file handle is not allowed IO, return error */ + if (!fh->io_allowed) { + v4l2_err(&vpbe_dev->v4l2_dev, "No io_allowed\n"); + return -EACCES; + } + /* If Streaming is already started, return error */ + if (layer->started) { + v4l2_err(&vpbe_dev->v4l2_dev, "layer is already streaming\n"); + return -EBUSY; + } + + /* + * Call videobuf_streamon to start streaming + * in videobuf + */ + ret = videobuf_streamon(&layer->buffer_queue); + if (ret) { + v4l2_err(&vpbe_dev->v4l2_dev, + "error in videobuf_streamon\n"); + return ret; + } + /* If buffer queue is empty, return error */ + if (list_empty(&layer->dma_queue)) { + v4l2_err(&vpbe_dev->v4l2_dev, "buffer queue is empty\n"); + goto streamoff; + } + /* Get the next frame from the buffer queue */ + layer->next_frm = layer->cur_frm = list_entry(layer->dma_queue.next, + struct videobuf_buffer, queue); + /* Remove buffer from the buffer queue */ + list_del(&layer->cur_frm->queue); + /* Mark state of the current frame to active */ + layer->cur_frm->state = VIDEOBUF_ACTIVE; + /* Initialize field_id and started member */ + layer->field_id = 0; + + /* Set parameters in OSD and VENC */ + ret = vpbe_set_osd_display_params(disp_dev, layer); + if (ret < 0) + goto streamoff; + + /* + * if request format is yuv420 semiplanar, need to + * enable both video windows + */ + layer->started = 1; + + layer->layer_first_int = 1; + + return ret; +streamoff: + ret = videobuf_streamoff(&layer->buffer_queue); + return ret; +} + +static int vpbe_display_dqbuf(struct file *file, void *priv, + struct v4l2_buffer *buf) +{ + struct vpbe_fh *fh = file->private_data; + struct vpbe_layer *layer = fh->layer; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + int ret; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, + "VIDIOC_DQBUF, layer id = %d\n", + layer->device_id); + + if (V4L2_BUF_TYPE_VIDEO_OUTPUT != buf->type) { + v4l2_err(&vpbe_dev->v4l2_dev, "Invalid buffer type\n"); + return -EINVAL; + } + /* If this file handle is not allowed to do IO, return error */ + if (!fh->io_allowed) { + v4l2_err(&vpbe_dev->v4l2_dev, "No io_allowed\n"); + return -EACCES; + } + if (file->f_flags & O_NONBLOCK) + /* Call videobuf_dqbuf for non blocking mode */ + ret = videobuf_dqbuf(&layer->buffer_queue, buf, 1); + else + /* Call videobuf_dqbuf for blocking mode */ + ret = videobuf_dqbuf(&layer->buffer_queue, buf, 0); + + return ret; +} + +static int vpbe_display_qbuf(struct file *file, void *priv, + struct v4l2_buffer *p) +{ + struct vpbe_fh *fh = file->private_data; + struct vpbe_layer *layer = fh->layer; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, + "VIDIOC_QBUF, layer id = %d\n", + layer->device_id); + + if (V4L2_BUF_TYPE_VIDEO_OUTPUT != p->type) { + v4l2_err(&vpbe_dev->v4l2_dev, "Invalid buffer type\n"); + return -EINVAL; + } + + /* If this file handle is not allowed to do IO, return error */ + if (!fh->io_allowed) { + v4l2_err(&vpbe_dev->v4l2_dev, "No io_allowed\n"); + return -EACCES; + } + + return videobuf_qbuf(&layer->buffer_queue, p); +} + +static int vpbe_display_querybuf(struct file *file, void *priv, + struct v4l2_buffer *buf) +{ + struct vpbe_fh *fh = file->private_data; + struct vpbe_layer *layer = fh->layer; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + int ret; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, + "VIDIOC_QUERYBUF, layer id = %d\n", + layer->device_id); + + if (V4L2_BUF_TYPE_VIDEO_OUTPUT != buf->type) { + v4l2_err(&vpbe_dev->v4l2_dev, "Invalid buffer type\n"); + return -EINVAL; + } + + /* Call videobuf_querybuf to get information */ + ret = videobuf_querybuf(&layer->buffer_queue, buf); + + return ret; +} + +static int vpbe_display_reqbufs(struct file *file, void *priv, + struct v4l2_requestbuffers *req_buf) +{ + struct vpbe_fh *fh = file->private_data; + struct vpbe_layer *layer = fh->layer; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + int ret; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe_display_reqbufs\n"); + + if (V4L2_BUF_TYPE_VIDEO_OUTPUT != req_buf->type) { + v4l2_err(&vpbe_dev->v4l2_dev, "Invalid buffer type\n"); + return -EINVAL; + } + + /* If io users of the layer is not zero, return error */ + if (0 != layer->io_usrs) { + v4l2_err(&vpbe_dev->v4l2_dev, "not IO user\n"); + return -EBUSY; + } + /* Initialize videobuf queue as per the buffer type */ + videobuf_queue_dma_contig_init(&layer->buffer_queue, + &video_qops, + vpbe_dev->pdev, + &layer->irqlock, + V4L2_BUF_TYPE_VIDEO_OUTPUT, + layer->pix_fmt.field, + sizeof(struct videobuf_buffer), + fh, NULL); + + /* Set io allowed member of file handle to TRUE */ + fh->io_allowed = 1; + /* Increment io usrs member of layer object to 1 */ + layer->io_usrs = 1; + /* Store type of memory requested in layer object */ + layer->memory = req_buf->memory; + /* Initialize buffer queue */ + INIT_LIST_HEAD(&layer->dma_queue); + /* Allocate buffers */ + ret = videobuf_reqbufs(&layer->buffer_queue, req_buf); + + return ret; +} + +/* + * vpbe_display_mmap() + * It is used to map kernel space buffers into user spaces + */ +static int vpbe_display_mmap(struct file *filep, struct vm_area_struct *vma) +{ + /* Get the layer object and file handle object */ + struct vpbe_fh *fh = filep->private_data; + struct vpbe_layer *layer = fh->layer; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe_display_mmap\n"); + + return videobuf_mmap_mapper(&layer->buffer_queue, vma); +} + +/* vpbe_display_poll(): It is used for select/poll system call + */ +static unsigned int vpbe_display_poll(struct file *filep, poll_table *wait) +{ + struct vpbe_fh *fh = filep->private_data; + struct vpbe_layer *layer = fh->layer; + struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; + unsigned int err = 0; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe_display_poll\n"); + if (layer->started) + err = videobuf_poll_stream(filep, &layer->buffer_queue, wait); + return err; +} + +/* + * vpbe_display_open() + * It creates object of file handle structure and stores it in private_data + * member of filepointer + */ +static int vpbe_display_open(struct file *file) +{ + struct vpbe_fh *fh = NULL; + struct vpbe_layer *layer = video_drvdata(file); + struct vpbe_display *disp_dev = layer->disp_dev; + struct vpbe_device *vpbe_dev = disp_dev->vpbe_dev; + struct osd_state *osd_device = disp_dev->osd_device; + int err; + + /* Allocate memory for the file handle object */ + fh = kmalloc(sizeof(struct vpbe_fh), GFP_KERNEL); + if (fh == NULL) { + v4l2_err(&vpbe_dev->v4l2_dev, + "unable to allocate memory for file handle object\n"); + return -ENOMEM; + } + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, + "vpbe display open plane = %d\n", + layer->device_id); + + /* store pointer to fh in private_data member of filep */ + file->private_data = fh; + fh->layer = layer; + fh->disp_dev = disp_dev; + + if (!layer->usrs) { + + /* First claim the layer for this device */ + err = osd_device->ops.request_layer(osd_device, + layer->layer_info.id); + if (err < 0) { + /* Couldn't get layer */ + v4l2_err(&vpbe_dev->v4l2_dev, + "Display Manager failed to allocate layer\n"); + kfree(fh); + return -EINVAL; + } + } + /* Increment layer usrs counter */ + layer->usrs++; + /* Set io_allowed member to false */ + fh->io_allowed = 0; + /* Initialize priority of this instance to default priority */ + fh->prio = V4L2_PRIORITY_UNSET; + v4l2_prio_open(&layer->prio, &fh->prio); + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, + "vpbe display device opened successfully\n"); + return 0; +} + +/* + * vpbe_display_release() + * This function deletes buffer queue, frees the buffers and the davinci + * display file * handle + */ +static int vpbe_display_release(struct file *file) +{ + /* Get the layer object and file handle object */ + struct vpbe_fh *fh = file->private_data; + struct vpbe_layer *layer = fh->layer; + struct osd_layer_config *cfg = &layer->layer_info.config; + struct vpbe_display *disp_dev = fh->disp_dev; + struct vpbe_device *vpbe_dev = disp_dev->vpbe_dev; + struct osd_state *osd_device = disp_dev->osd_device; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe_display_release\n"); + + /* if this instance is doing IO */ + if (fh->io_allowed) { + /* Reset io_usrs member of layer object */ + layer->io_usrs = 0; + + osd_device->ops.disable_layer(osd_device, + layer->layer_info.id); + layer->started = 0; + /* Free buffers allocated */ + videobuf_queue_cancel(&layer->buffer_queue); + videobuf_mmap_free(&layer->buffer_queue); + } + + /* Decrement layer usrs counter */ + layer->usrs--; + /* If this file handle has initialize encoder device, reset it */ + if (!layer->usrs) { + if (cfg->pixfmt == PIXFMT_NV12) { + struct vpbe_layer *otherlayer; + otherlayer = + _vpbe_display_get_other_win_layer(disp_dev, layer); + osd_device->ops.disable_layer(osd_device, + otherlayer->layer_info.id); + osd_device->ops.release_layer(osd_device, + otherlayer->layer_info.id); + } + osd_device->ops.disable_layer(osd_device, + layer->layer_info.id); + osd_device->ops.release_layer(osd_device, + layer->layer_info.id); + } + /* Close the priority */ + v4l2_prio_close(&layer->prio, fh->prio); + file->private_data = NULL; + + /* Free memory allocated to file handle object */ + kfree(fh); + + disp_dev->cbcr_ofst = 0; + + return 0; +} + +#ifdef CONFIG_VIDEO_ADV_DEBUG +static int vpbe_display_g_register(struct file *file, void *priv, + struct v4l2_dbg_register *reg) +{ + struct v4l2_dbg_match *match = ®->match; + + if (match->type >= 2) { + v4l2_subdev_call(vpbe_dev->venc, + core, + g_register, + reg); + } + + return 0; +} + +static int vpbe_display_s_register(struct file *file, void *priv, + struct v4l2_dbg_register *reg) +{ + return 0; +} +#endif + +/* vpbe capture ioctl operations */ +static const struct v4l2_ioctl_ops vpbe_ioctl_ops = { + .vidioc_querycap = vpbe_display_querycap, + .vidioc_g_fmt_vid_out = vpbe_display_g_fmt, + .vidioc_enum_fmt_vid_out = vpbe_display_enum_fmt, + .vidioc_s_fmt_vid_out = vpbe_display_s_fmt, + .vidioc_try_fmt_vid_out = vpbe_display_try_fmt, + .vidioc_reqbufs = vpbe_display_reqbufs, + .vidioc_querybuf = vpbe_display_querybuf, + .vidioc_qbuf = vpbe_display_qbuf, + .vidioc_dqbuf = vpbe_display_dqbuf, + .vidioc_streamon = vpbe_display_streamon, + .vidioc_streamoff = vpbe_display_streamoff, + .vidioc_cropcap = vpbe_display_cropcap, + .vidioc_g_crop = vpbe_display_g_crop, + .vidioc_s_crop = vpbe_display_s_crop, + .vidioc_g_priority = vpbe_display_g_priority, + .vidioc_s_priority = vpbe_display_s_priority, + .vidioc_s_std = vpbe_display_s_std, + .vidioc_g_std = vpbe_display_g_std, + .vidioc_enum_output = vpbe_display_enum_output, + .vidioc_s_output = vpbe_display_s_output, + .vidioc_g_output = vpbe_display_g_output, + .vidioc_s_dv_preset = vpbe_display_s_dv_preset, + .vidioc_g_dv_preset = vpbe_display_g_dv_preset, + .vidioc_enum_dv_presets = vpbe_display_enum_dv_presets, +#ifdef CONFIG_VIDEO_ADV_DEBUG + .vidioc_g_register = vpbe_display_g_register, + .vidioc_s_register = vpbe_display_s_register, +#endif +}; + +static struct v4l2_file_operations vpbe_fops = { + .owner = THIS_MODULE, + .open = vpbe_display_open, + .release = vpbe_display_release, + .unlocked_ioctl = video_ioctl2, + .mmap = vpbe_display_mmap, + .poll = vpbe_display_poll +}; + +static int vpbe_device_get(struct device *dev, void *data) +{ + struct platform_device *pdev = to_platform_device(dev); + struct vpbe_display *vpbe_disp = data; + + if (strcmp("vpbe_controller", pdev->name) == 0) + vpbe_disp->vpbe_dev = platform_get_drvdata(pdev); + + if (strcmp("vpbe-osd", pdev->name) == 0) + vpbe_disp->osd_device = platform_get_drvdata(pdev); + + return 0; +} + +static __devinit int init_vpbe_layer(int i, struct vpbe_display *disp_dev, + struct platform_device *pdev) +{ + struct vpbe_layer *vpbe_display_layer = NULL; + struct video_device *vbd = NULL; + + /* Allocate memory for four plane display objects */ + + disp_dev->dev[i] = + kzalloc(sizeof(struct vpbe_layer), GFP_KERNEL); + + /* If memory allocation fails, return error */ + if (!disp_dev->dev[i]) { + printk(KERN_ERR "ran out of memory\n"); + return -ENOMEM; + } + spin_lock_init(&disp_dev->dev[i]->irqlock); + mutex_init(&disp_dev->dev[i]->opslock); + + /* Get the pointer to the layer object */ + vpbe_display_layer = disp_dev->dev[i]; + vbd = &vpbe_display_layer->video_dev; + /* Initialize field of video device */ + vbd->release = video_device_release_empty; + vbd->fops = &vpbe_fops; + vbd->ioctl_ops = &vpbe_ioctl_ops; + vbd->minor = -1; + vbd->v4l2_dev = &disp_dev->vpbe_dev->v4l2_dev; + vbd->lock = &vpbe_display_layer->opslock; + + if (disp_dev->vpbe_dev->current_timings.timings_type & + VPBE_ENC_STD) { + vbd->tvnorms = (V4L2_STD_525_60 | V4L2_STD_625_50); + vbd->current_norm = + disp_dev->vpbe_dev-> + current_timings.timings.std_id; + } else + vbd->current_norm = 0; + + snprintf(vbd->name, sizeof(vbd->name), + "DaVinci_VPBE Display_DRIVER_V%d.%d.%d", + (VPBE_DISPLAY_VERSION_CODE >> 16) & 0xff, + (VPBE_DISPLAY_VERSION_CODE >> 8) & 0xff, + (VPBE_DISPLAY_VERSION_CODE) & 0xff); + + vpbe_display_layer->device_id = i; + + vpbe_display_layer->layer_info.id = + ((i == VPBE_DISPLAY_DEVICE_0) ? WIN_VID0 : WIN_VID1); + + /* Initialize prio member of layer object */ + v4l2_prio_init(&vpbe_display_layer->prio); + + return 0; +} + +static __devinit int register_device(struct vpbe_layer *vpbe_display_layer, + struct vpbe_display *disp_dev, + struct platform_device *pdev) { + int err; + + v4l2_info(&disp_dev->vpbe_dev->v4l2_dev, + "Trying to register VPBE display device.\n"); + v4l2_info(&disp_dev->vpbe_dev->v4l2_dev, + "layer=%x,layer->video_dev=%x\n", + (int)vpbe_display_layer, + (int)&vpbe_display_layer->video_dev); + + err = video_register_device(&vpbe_display_layer->video_dev, + VFL_TYPE_GRABBER, + -1); + if (err) + return -ENODEV; + + vpbe_display_layer->disp_dev = disp_dev; + /* set the driver data in platform device */ + platform_set_drvdata(pdev, disp_dev); + video_set_drvdata(&vpbe_display_layer->video_dev, + vpbe_display_layer); + + return 0; +} + + + +/* + * vpbe_display_probe() + * This function creates device entries by register itself to the V4L2 driver + * and initializes fields of each layer objects + */ +static __devinit int vpbe_display_probe(struct platform_device *pdev) +{ + struct vpbe_layer *vpbe_display_layer; + struct vpbe_display *disp_dev; + struct resource *res = NULL; + int k; + int i; + int err; + int irq; + + printk(KERN_DEBUG "vpbe_display_probe\n"); + /* Allocate memory for vpbe_display */ + disp_dev = kzalloc(sizeof(struct vpbe_display), GFP_KERNEL); + if (!disp_dev) { + printk(KERN_ERR "ran out of memory\n"); + return -ENOMEM; + } + + spin_lock_init(&disp_dev->dma_queue_lock); + /* + * Scan all the platform devices to find the vpbe + * controller device and get the vpbe_dev object + */ + err = bus_for_each_dev(&platform_bus_type, NULL, disp_dev, + vpbe_device_get); + if (err < 0) + return err; + /* Initialize the vpbe display controller */ + if (NULL != disp_dev->vpbe_dev->ops.initialize) { + err = disp_dev->vpbe_dev->ops.initialize(&pdev->dev, + disp_dev->vpbe_dev); + if (err) { + v4l2_err(&disp_dev->vpbe_dev->v4l2_dev, + "Error initing vpbe\n"); + err = -ENOMEM; + goto probe_out; + } + } + + for (i = 0; i < VPBE_DISPLAY_MAX_DEVICES; i++) { + if (init_vpbe_layer(i, disp_dev, pdev)) { + err = -ENODEV; + goto probe_out; + } + } + + res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); + if (!res) { + v4l2_err(&disp_dev->vpbe_dev->v4l2_dev, + "Unable to get VENC interrupt resource\n"); + err = -ENODEV; + goto probe_out; + } + + irq = res->start; + if (request_irq(irq, venc_isr, IRQF_DISABLED, VPBE_DISPLAY_DRIVER, + disp_dev)) { + v4l2_err(&disp_dev->vpbe_dev->v4l2_dev, + "Unable to request interrupt\n"); + err = -ENODEV; + goto probe_out; + } + + for (i = 0; i < VPBE_DISPLAY_MAX_DEVICES; i++) { + if (register_device(disp_dev->dev[i], disp_dev, pdev)) { + err = -ENODEV; + goto probe_out; + } + } + + printk(KERN_DEBUG "Successfully completed the probing of vpbe v4l2 device\n"); + return 0; + +probe_out: + free_irq(res->start, disp_dev); + for (k = 0; k < VPBE_DISPLAY_MAX_DEVICES; k++) { + /* Get the pointer to the layer object */ + vpbe_display_layer = disp_dev->dev[k]; + /* Unregister video device */ + if (vpbe_display_layer) { + video_unregister_device( + &vpbe_display_layer->video_dev); + kfree(disp_dev->dev[k]); + } + } + kfree(disp_dev); + return err; +} + +/* + * vpbe_display_remove() + * It un-register hardware layer from V4L2 driver + */ +static int vpbe_display_remove(struct platform_device *pdev) +{ + struct vpbe_layer *vpbe_display_layer; + struct vpbe_display *disp_dev = platform_get_drvdata(pdev); + struct vpbe_device *vpbe_dev = disp_dev->vpbe_dev; + struct resource *res; + int i; + + v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe_display_remove\n"); + + /* unregister irq */ + res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); + free_irq(res->start, disp_dev); + + /* deinitialize the vpbe display controller */ + if (NULL != vpbe_dev->ops.deinitialize) + vpbe_dev->ops.deinitialize(&pdev->dev, vpbe_dev); + /* un-register device */ + for (i = 0; i < VPBE_DISPLAY_MAX_DEVICES; i++) { + /* Get the pointer to the layer object */ + vpbe_display_layer = disp_dev->dev[i]; + /* Unregister video device */ + video_unregister_device(&vpbe_display_layer->video_dev); + + } + for (i = 0; i < VPBE_DISPLAY_MAX_DEVICES; i++) { + kfree(disp_dev->dev[i]); + disp_dev->dev[i] = NULL; + } + + return 0; +} + +static struct platform_driver vpbe_display_driver = { + .driver = { + .name = VPBE_DISPLAY_DRIVER, + .owner = THIS_MODULE, + .bus = &platform_bus_type, + }, + .probe = vpbe_display_probe, + .remove = __devexit_p(vpbe_display_remove), +}; + +/* + * vpbe_display_init() + * This function registers device and driver to the kernel, requests irq + * handler and allocates memory for layer objects + */ +static __devinit int vpbe_display_init(void) +{ + int err; + + printk(KERN_DEBUG "vpbe_display_init\n"); + + /* Register driver to the kernel */ + err = platform_driver_register(&vpbe_display_driver); + if (0 != err) + return err; + + printk(KERN_DEBUG "vpbe_display_init:" + "VPBE V4L2 Display Driver V1.0 loaded\n"); + return 0; +} + +/* + * vpbe_display_cleanup() + * This function un-registers device and driver to the kernel, frees requested + * irq handler and de-allocates memory allocated for layer objects. + */ +static void vpbe_display_cleanup(void) +{ + printk(KERN_DEBUG "vpbe_display_cleanup\n"); + + /* platform driver unregister */ + platform_driver_unregister(&vpbe_display_driver); +} + +/* Function for module initialization and cleanup */ +module_init(vpbe_display_init); +module_exit(vpbe_display_cleanup); + +MODULE_DESCRIPTION("TI DM644x/DM355/DM365 VPBE Display controller"); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Texas Instruments"); diff --git a/include/media/davinci/vpbe_display.h b/include/media/davinci/vpbe_display.h new file mode 100644 index 000000000000..dbf6b37682cd --- /dev/null +++ b/include/media/davinci/vpbe_display.h @@ -0,0 +1,147 @@ +/* + * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation version 2. + * + * This program is distributed WITHOUT ANY WARRANTY of any + * kind, whether express or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +#ifndef VPBE_DISPLAY_H +#define VPBE_DISPLAY_H + +/* Header files */ +#include +#include +#include +#include +#include +#include + +#define VPBE_DISPLAY_MAX_DEVICES 2 + +enum vpbe_display_device_id { + VPBE_DISPLAY_DEVICE_0, + VPBE_DISPLAY_DEVICE_1 +}; + +#define VPBE_DISPLAY_DRV_NAME "vpbe-display" + +#define VPBE_DISPLAY_MAJOR_RELEASE 1 +#define VPBE_DISPLAY_MINOR_RELEASE 0 +#define VPBE_DISPLAY_BUILD 1 +#define VPBE_DISPLAY_VERSION_CODE ((VPBE_DISPLAY_MAJOR_RELEASE << 16) | \ + (VPBE_DISPLAY_MINOR_RELEASE << 8) | \ + VPBE_DISPLAY_BUILD) + +#define VPBE_DISPLAY_VALID_FIELD(field) ((V4L2_FIELD_NONE == field) || \ + (V4L2_FIELD_ANY == field) || (V4L2_FIELD_INTERLACED == field)) + +/* Exp ratio numerator and denominator constants */ +#define VPBE_DISPLAY_H_EXP_RATIO_N 9 +#define VPBE_DISPLAY_H_EXP_RATIO_D 8 +#define VPBE_DISPLAY_V_EXP_RATIO_N 6 +#define VPBE_DISPLAY_V_EXP_RATIO_D 5 + +/* Zoom multiplication factor */ +#define VPBE_DISPLAY_ZOOM_4X 4 +#define VPBE_DISPLAY_ZOOM_2X 2 + +/* Structures */ +struct display_layer_info { + int enable; + /* Layer ID used by Display Manager */ + enum osd_layer id; + struct osd_layer_config config; + enum osd_zoom_factor h_zoom; + enum osd_zoom_factor v_zoom; + enum osd_h_exp_ratio h_exp; + enum osd_v_exp_ratio v_exp; +}; + +/* vpbe display object structure */ +struct vpbe_layer { + /* number of buffers in fbuffers */ + unsigned int numbuffers; + /* Pointer to the vpbe_display */ + struct vpbe_display *disp_dev; + /* Pointer pointing to current v4l2_buffer */ + struct videobuf_buffer *cur_frm; + /* Pointer pointing to next v4l2_buffer */ + struct videobuf_buffer *next_frm; + /* videobuf specific parameters + * Buffer queue used in video-buf + */ + struct videobuf_queue buffer_queue; + /* Queue of filled frames */ + struct list_head dma_queue; + /* Used in video-buf */ + spinlock_t irqlock; + /* V4l2 specific parameters */ + /* Identifies video device for this layer */ + struct video_device video_dev; + /* This field keeps track of type of buffer exchange mechanism user + * has selected + */ + enum v4l2_memory memory; + /* Used to keep track of state of the priority */ + struct v4l2_prio_state prio; + /* Used to store pixel format */ + struct v4l2_pix_format pix_fmt; + enum v4l2_field buf_field; + /* Video layer configuration params */ + struct display_layer_info layer_info; + /* vpbe specific parameters + * enable window for display + */ + unsigned char window_enable; + /* number of open instances of the layer */ + unsigned int usrs; + /* number of users performing IO */ + unsigned int io_usrs; + /* Indicates id of the field which is being displayed */ + unsigned int field_id; + /* Indicates whether streaming started */ + unsigned char started; + /* Identifies device object */ + enum vpbe_display_device_id device_id; + /* facilitation of ioctl ops lock by v4l2*/ + struct mutex opslock; + u8 layer_first_int; +}; + +/* vpbe device structure */ +struct vpbe_display { + /* layer specific parameters */ + /* lock for isr updates to buf layers*/ + spinlock_t dma_queue_lock; + /* C-Plane offset from start of y-plane */ + unsigned int cbcr_ofst; + struct vpbe_layer *dev[VPBE_DISPLAY_MAX_DEVICES]; + struct vpbe_device *vpbe_dev; + struct osd_state *osd_device; +}; + +/* File handle structure */ +struct vpbe_fh { + /* vpbe device structure */ + struct vpbe_display *disp_dev; + /* pointer to layer object for opened device */ + struct vpbe_layer *layer; + /* Indicates whether this file handle is doing IO */ + unsigned char io_allowed; + /* Used to keep track priority of this instance */ + enum v4l2_priority prio; +}; + +struct buf_config_params { + unsigned char min_numbuffers; + unsigned char numbuffers[VPBE_DISPLAY_MAX_DEVICES]; + unsigned int min_bufsize[VPBE_DISPLAY_MAX_DEVICES]; + unsigned int layer_bufsize[VPBE_DISPLAY_MAX_DEVICES]; +}; + +#endif /* VPBE_DISPLAY_H */ diff --git a/include/media/davinci/vpbe_types.h b/include/media/davinci/vpbe_types.h new file mode 100644 index 000000000000..727f55170e41 --- /dev/null +++ b/include/media/davinci/vpbe_types.h @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2010 Texas Instruments Inc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * 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 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 _VPBE_TYPES_H +#define _VPBE_TYPES_H + +enum vpbe_version { + VPBE_VERSION_1 = 1, + VPBE_VERSION_2, + VPBE_VERSION_3, +}; + +/* vpbe_timing_type - Timing types used in vpbe device */ +enum vpbe_enc_timings_type { + VPBE_ENC_STD = 0x1, + VPBE_ENC_DV_PRESET = 0x2, + VPBE_ENC_CUSTOM_TIMINGS = 0x4, + /* Used when set timings through FB device interface */ + VPBE_ENC_TIMINGS_INVALID = 0x8, +}; + +union vpbe_timings { + v4l2_std_id std_id; + unsigned int dv_preset; +}; + +/* + * struct vpbe_enc_mode_info + * @name: ptr to name string of the standard, "NTSC", "PAL" etc + * @std: standard or non-standard mode. 1 - standard, 0 - nonstandard + * @interlaced: 1 - interlaced, 0 - non interlaced/progressive + * @xres: x or horizontal resolution of the display + * @yres: y or vertical resolution of the display + * @fps: frame per second + * @left_margin: left margin of the display + * @right_margin: right margin of the display + * @upper_margin: upper margin of the display + * @lower_margin: lower margin of the display + * @hsync_len: h-sync length + * @vsync_len: v-sync length + * @flags: bit field: bit usage is documented below + * + * Description: + * Structure holding timing and resolution information of a standard. + * Used by vpbe_device to set required non-standard timing in the + * venc when lcd controller output is connected to a external encoder. + * A table of timings is maintained in vpbe device to set this in + * venc when external encoder is connected to lcd controller output. + * Encoder may provide a g_dv_timings() API to override these values + * as needed. + * + * Notes + * ------ + * if_type should be used only by encoder manager and encoder. + * flags usage + * b0 (LSB) - hsync polarity, 0 - negative, 1 - positive + * b1 - vsync polarity, 0 - negative, 1 - positive + * b2 - field id polarity, 0 - negative, 1 - positive + */ +struct vpbe_enc_mode_info { + unsigned char *name; + enum vpbe_enc_timings_type timings_type; + union vpbe_timings timings; + unsigned int interlaced; + unsigned int xres; + unsigned int yres; + struct v4l2_fract aspect; + struct v4l2_fract fps; + unsigned int left_margin; + unsigned int right_margin; + unsigned int upper_margin; + unsigned int lower_margin; + unsigned int hsync_len; + unsigned int vsync_len; + unsigned int flags; +}; + +#endif -- cgit v1.2.3 From 66715cdc3224a4e241c1a92856b9a4af3b70e06d Mon Sep 17 00:00:00 2001 From: Manjunath Hadli Date: Fri, 17 Jun 2011 04:01:32 -0300 Subject: [media] davinci vpbe: VPBE display driver This patch implements the core functionality of the display driver, mainly controlling the VENC and other encoders, and acting as the one point interface for the main V4L2 driver. This implements the core of each of the V4L2 IOCTLs. Signed-off-by: Manjunath Hadli Acked-by: Muralidharan Karicheri Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/davinci/vpbe.c | 864 +++++++++++++++++++++++++++++++++++++ include/media/davinci/vpbe.h | 184 ++++++++ 2 files changed, 1048 insertions(+) create mode 100644 drivers/media/video/davinci/vpbe.c create mode 100644 include/media/davinci/vpbe.h diff --git a/drivers/media/video/davinci/vpbe.c b/drivers/media/video/davinci/vpbe.c new file mode 100644 index 000000000000..d773d30de221 --- /dev/null +++ b/drivers/media/video/davinci/vpbe.c @@ -0,0 +1,864 @@ +/* + * Copyright (C) 2010 Texas Instruments Inc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * 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 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 + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#define VPBE_DEFAULT_OUTPUT "Composite" +#define VPBE_DEFAULT_MODE "ntsc" + +static char *def_output = VPBE_DEFAULT_OUTPUT; +static char *def_mode = VPBE_DEFAULT_MODE; +static int debug; + +module_param(def_output, charp, S_IRUGO); +module_param(def_mode, charp, S_IRUGO); +module_param(debug, int, 0644); + +MODULE_PARM_DESC(def_output, "vpbe output name (default:Composite)"); +MODULE_PARM_DESC(def_mode, "vpbe output mode name (default:ntsc"); +MODULE_PARM_DESC(debug, "Debug level 0-1"); + +MODULE_DESCRIPTION("TI DMXXX VPBE Display controller"); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Texas Instruments"); + +/** + * vpbe_current_encoder_info - Get config info for current encoder + * @vpbe_dev - vpbe device ptr + * + * Return ptr to current encoder config info + */ +static struct encoder_config_info* +vpbe_current_encoder_info(struct vpbe_device *vpbe_dev) +{ + struct vpbe_config *cfg = vpbe_dev->cfg; + int index = vpbe_dev->current_sd_index; + + return ((index == 0) ? &cfg->venc : + &cfg->ext_encoders[index-1]); +} + +/** + * vpbe_find_encoder_sd_index - Given a name find encoder sd index + * + * @vpbe_config - ptr to vpbe cfg + * @output_index - index used by application + * + * Return sd index of the encoder + */ +static int vpbe_find_encoder_sd_index(struct vpbe_config *cfg, + int index) +{ + char *encoder_name = cfg->outputs[index].subdev_name; + int i; + + /* Venc is always first */ + if (!strcmp(encoder_name, cfg->venc.module_name)) + return 0; + + for (i = 0; i < cfg->num_ext_encoders; i++) { + if (!strcmp(encoder_name, + cfg->ext_encoders[i].module_name)) + return i+1; + } + + return -EINVAL; +} + +/** + * vpbe_g_cropcap - Get crop capabilities of the display + * @vpbe_dev - vpbe device ptr + * @cropcap - cropcap is a ptr to struct v4l2_cropcap + * + * Update the crop capabilities in crop cap for current + * mode + */ +static int vpbe_g_cropcap(struct vpbe_device *vpbe_dev, + struct v4l2_cropcap *cropcap) +{ + if (NULL == cropcap) + return -EINVAL; + cropcap->bounds.left = 0; + cropcap->bounds.top = 0; + cropcap->bounds.width = vpbe_dev->current_timings.xres; + cropcap->bounds.height = vpbe_dev->current_timings.yres; + cropcap->defrect = cropcap->bounds; + + return 0; +} + +/** + * vpbe_enum_outputs - enumerate outputs + * @vpbe_dev - vpbe device ptr + * @output - ptr to v4l2_output structure + * + * Enumerates the outputs available at the vpbe display + * returns the status, -EINVAL if end of output list + */ +static int vpbe_enum_outputs(struct vpbe_device *vpbe_dev, + struct v4l2_output *output) +{ + struct vpbe_config *cfg = vpbe_dev->cfg; + int temp_index = output->index; + + if (temp_index >= cfg->num_outputs) + return -EINVAL; + + *output = cfg->outputs[temp_index].output; + output->index = temp_index; + + return 0; +} + +static int vpbe_get_mode_info(struct vpbe_device *vpbe_dev, char *mode) +{ + struct vpbe_config *cfg = vpbe_dev->cfg; + struct vpbe_enc_mode_info var; + int curr_output = vpbe_dev->current_out_index; + int i; + + if (NULL == mode) + return -EINVAL; + + for (i = 0; i < cfg->outputs[curr_output].num_modes; i++) { + var = cfg->outputs[curr_output].modes[i]; + if (!strcmp(mode, var.name)) { + vpbe_dev->current_timings = var; + return 0; + } + } + + return -EINVAL; +} + +static int vpbe_get_current_mode_info(struct vpbe_device *vpbe_dev, + struct vpbe_enc_mode_info *mode_info) +{ + if (NULL == mode_info) + return -EINVAL; + + *mode_info = vpbe_dev->current_timings; + + return 0; +} + +static int vpbe_get_dv_preset_info(struct vpbe_device *vpbe_dev, + unsigned int dv_preset) +{ + struct vpbe_config *cfg = vpbe_dev->cfg; + struct vpbe_enc_mode_info var; + int curr_output = vpbe_dev->current_out_index; + int i; + + for (i = 0; i < vpbe_dev->cfg->outputs[curr_output].num_modes; i++) { + var = cfg->outputs[curr_output].modes[i]; + if ((var.timings_type & VPBE_ENC_DV_PRESET) && + (var.timings.dv_preset == dv_preset)) { + vpbe_dev->current_timings = var; + return 0; + } + } + + return -EINVAL; +} + +/* Get std by std id */ +static int vpbe_get_std_info(struct vpbe_device *vpbe_dev, + v4l2_std_id std_id) +{ + struct vpbe_config *cfg = vpbe_dev->cfg; + struct vpbe_enc_mode_info var; + int curr_output = vpbe_dev->current_out_index; + int i; + + for (i = 0; i < vpbe_dev->cfg->outputs[curr_output].num_modes; i++) { + var = cfg->outputs[curr_output].modes[i]; + if ((var.timings_type & VPBE_ENC_STD) && + (var.timings.std_id & std_id)) { + vpbe_dev->current_timings = var; + return 0; + } + } + + return -EINVAL; +} + +static int vpbe_get_std_info_by_name(struct vpbe_device *vpbe_dev, + char *std_name) +{ + struct vpbe_config *cfg = vpbe_dev->cfg; + struct vpbe_enc_mode_info var; + int curr_output = vpbe_dev->current_out_index; + int i; + + for (i = 0; i < vpbe_dev->cfg->outputs[curr_output].num_modes; i++) { + var = cfg->outputs[curr_output].modes[i]; + if (!strcmp(var.name, std_name)) { + vpbe_dev->current_timings = var; + return 0; + } + } + + return -EINVAL; +} + +/** + * vpbe_set_output - Set output + * @vpbe_dev - vpbe device ptr + * @index - index of output + * + * Set vpbe output to the output specified by the index + */ +static int vpbe_set_output(struct vpbe_device *vpbe_dev, int index) +{ + struct encoder_config_info *curr_enc_info = + vpbe_current_encoder_info(vpbe_dev); + struct vpbe_config *cfg = vpbe_dev->cfg; + int enc_out_index; + int sd_index; + int ret = 0; + + if (index >= cfg->num_outputs) + return -EINVAL; + + mutex_lock(&vpbe_dev->lock); + + sd_index = vpbe_dev->current_sd_index; + enc_out_index = cfg->outputs[index].output.index; + /* + * Currently we switch the encoder based on output selected + * by the application. If media controller is implemented later + * there is will be an API added to setup_link between venc + * and external encoder. So in that case below comparison always + * match and encoder will not be switched. But if application + * chose not to use media controller, then this provides current + * way of switching encoder at the venc output. + */ + if (strcmp(curr_enc_info->module_name, + cfg->outputs[index].subdev_name)) { + /* Need to switch the encoder at the output */ + sd_index = vpbe_find_encoder_sd_index(cfg, index); + if (sd_index < 0) { + ret = -EINVAL; + goto out; + } + + if (ret) + goto out; + } + + /* Set output at the encoder */ + ret = v4l2_subdev_call(vpbe_dev->encoders[sd_index], video, + s_routing, 0, enc_out_index, 0); + if (ret) + goto out; + + /* + * It is assumed that venc or extenal encoder will set a default + * mode in the sub device. For external encoder or LCD pannel output, + * we also need to set up the lcd port for the required mode. So setup + * the lcd port for the default mode that is configured in the board + * arch/arm/mach-davinci/board-dm355-evm.setup file for the external + * encoder. + */ + ret = vpbe_get_mode_info(vpbe_dev, + cfg->outputs[index].default_mode); + if (!ret) { + struct osd_state *osd_device = vpbe_dev->osd_device; + + osd_device->ops.set_left_margin(osd_device, + vpbe_dev->current_timings.left_margin); + osd_device->ops.set_top_margin(osd_device, + vpbe_dev->current_timings.upper_margin); + vpbe_dev->current_sd_index = sd_index; + vpbe_dev->current_out_index = index; + } +out: + mutex_unlock(&vpbe_dev->lock); + return ret; +} + +static int vpbe_set_default_output(struct vpbe_device *vpbe_dev) +{ + struct vpbe_config *cfg = vpbe_dev->cfg; + int ret = 0; + int i; + + for (i = 0; i < cfg->num_outputs; i++) { + if (!strcmp(def_output, + cfg->outputs[i].output.name)) { + ret = vpbe_set_output(vpbe_dev, i); + if (!ret) + vpbe_dev->current_out_index = i; + return ret; + } + } + return ret; +} + +/** + * vpbe_get_output - Get output + * @vpbe_dev - vpbe device ptr + * + * return current vpbe output to the the index + */ +static unsigned int vpbe_get_output(struct vpbe_device *vpbe_dev) +{ + return vpbe_dev->current_out_index; +} + +/** + * vpbe_s_dv_preset - Set the given preset timings in the encoder + * + * Sets the preset if supported by the current encoder. Return the status. + * 0 - success & -EINVAL on error + */ +static int vpbe_s_dv_preset(struct vpbe_device *vpbe_dev, + struct v4l2_dv_preset *dv_preset) +{ + struct vpbe_config *cfg = vpbe_dev->cfg; + int out_index = vpbe_dev->current_out_index; + int sd_index = vpbe_dev->current_sd_index; + int ret; + + + if (!(cfg->outputs[out_index].output.capabilities & + V4L2_OUT_CAP_PRESETS)) + return -EINVAL; + + ret = vpbe_get_dv_preset_info(vpbe_dev, dv_preset->preset); + + if (ret) + return ret; + + mutex_lock(&vpbe_dev->lock); + + + ret = v4l2_subdev_call(vpbe_dev->encoders[sd_index], video, + s_dv_preset, dv_preset); + /* set the lcd controller output for the given mode */ + if (!ret) { + struct osd_state *osd_device = vpbe_dev->osd_device; + + osd_device->ops.set_left_margin(osd_device, + vpbe_dev->current_timings.left_margin); + osd_device->ops.set_top_margin(osd_device, + vpbe_dev->current_timings.upper_margin); + } + mutex_unlock(&vpbe_dev->lock); + + return ret; +} + +/** + * vpbe_g_dv_preset - Get the preset in the current encoder + * + * Get the preset in the current encoder. Return the status. 0 - success + * -EINVAL on error + */ +static int vpbe_g_dv_preset(struct vpbe_device *vpbe_dev, + struct v4l2_dv_preset *dv_preset) +{ + if (vpbe_dev->current_timings.timings_type & + VPBE_ENC_DV_PRESET) { + dv_preset->preset = vpbe_dev->current_timings.timings.dv_preset; + return 0; + } + + return -EINVAL; +} + +/** + * vpbe_enum_dv_presets - Enumerate the dv presets in the current encoder + * + * Get the preset in the current encoder. Return the status. 0 - success + * -EINVAL on error + */ +static int vpbe_enum_dv_presets(struct vpbe_device *vpbe_dev, + struct v4l2_dv_enum_preset *preset_info) +{ + struct vpbe_config *cfg = vpbe_dev->cfg; + int out_index = vpbe_dev->current_out_index; + struct vpbe_output *output = &cfg->outputs[out_index]; + int j = 0; + int i; + + if (!(output->output.capabilities & V4L2_OUT_CAP_PRESETS)) + return -EINVAL; + + for (i = 0; i < output->num_modes; i++) { + if (output->modes[i].timings_type == VPBE_ENC_DV_PRESET) { + if (j == preset_info->index) + break; + j++; + } + } + + if (i == output->num_modes) + return -EINVAL; + + return v4l_fill_dv_preset_info(output->modes[i].timings.dv_preset, + preset_info); +} + +/** + * vpbe_s_std - Set the given standard in the encoder + * + * Sets the standard if supported by the current encoder. Return the status. + * 0 - success & -EINVAL on error + */ +static int vpbe_s_std(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id) +{ + struct vpbe_config *cfg = vpbe_dev->cfg; + int out_index = vpbe_dev->current_out_index; + int sd_index = vpbe_dev->current_sd_index; + int ret; + + if (!(cfg->outputs[out_index].output.capabilities & + V4L2_OUT_CAP_STD)) + return -EINVAL; + + ret = vpbe_get_std_info(vpbe_dev, *std_id); + if (ret) + return ret; + + mutex_lock(&vpbe_dev->lock); + + ret = v4l2_subdev_call(vpbe_dev->encoders[sd_index], video, + s_std_output, *std_id); + /* set the lcd controller output for the given mode */ + if (!ret) { + struct osd_state *osd_device = vpbe_dev->osd_device; + + osd_device->ops.set_left_margin(osd_device, + vpbe_dev->current_timings.left_margin); + osd_device->ops.set_top_margin(osd_device, + vpbe_dev->current_timings.upper_margin); + } + mutex_unlock(&vpbe_dev->lock); + + return ret; +} + +/** + * vpbe_g_std - Get the standard in the current encoder + * + * Get the standard in the current encoder. Return the status. 0 - success + * -EINVAL on error + */ +static int vpbe_g_std(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id) +{ + struct vpbe_enc_mode_info cur_timings = vpbe_dev->current_timings; + + if (cur_timings.timings_type & VPBE_ENC_STD) { + *std_id = cur_timings.timings.std_id; + return 0; + } + + return -EINVAL; +} + +/** + * vpbe_set_mode - Set mode in the current encoder using mode info + * + * Use the mode string to decide what timings to set in the encoder + * This is typically useful when fbset command is used to change the current + * timings by specifying a string to indicate the timings. + */ +static int vpbe_set_mode(struct vpbe_device *vpbe_dev, + struct vpbe_enc_mode_info *mode_info) +{ + struct vpbe_enc_mode_info *preset_mode = NULL; + struct vpbe_config *cfg = vpbe_dev->cfg; + struct v4l2_dv_preset dv_preset; + struct osd_state *osd_device; + int out_index = vpbe_dev->current_out_index; + int ret = 0; + int i; + + if ((NULL == mode_info) || (NULL == mode_info->name)) + return -EINVAL; + + for (i = 0; i < cfg->outputs[out_index].num_modes; i++) { + if (!strcmp(mode_info->name, + cfg->outputs[out_index].modes[i].name)) { + preset_mode = &cfg->outputs[out_index].modes[i]; + /* + * it may be one of the 3 timings type. Check and + * invoke right API + */ + if (preset_mode->timings_type & VPBE_ENC_STD) + return vpbe_s_std(vpbe_dev, + &preset_mode->timings.std_id); + if (preset_mode->timings_type & VPBE_ENC_DV_PRESET) { + dv_preset.preset = + preset_mode->timings.dv_preset; + return vpbe_s_dv_preset(vpbe_dev, &dv_preset); + } + } + } + + /* Only custom timing should reach here */ + if (preset_mode == NULL) + return -EINVAL; + + mutex_lock(&vpbe_dev->lock); + + osd_device = vpbe_dev->osd_device; + vpbe_dev->current_timings = *preset_mode; + osd_device->ops.set_left_margin(osd_device, + vpbe_dev->current_timings.left_margin); + osd_device->ops.set_top_margin(osd_device, + vpbe_dev->current_timings.upper_margin); + + mutex_unlock(&vpbe_dev->lock); + + return ret; +} + +static int vpbe_set_default_mode(struct vpbe_device *vpbe_dev) +{ + int ret; + + ret = vpbe_get_std_info_by_name(vpbe_dev, def_mode); + if (ret) + return ret; + + /* set the default mode in the encoder */ + return vpbe_set_mode(vpbe_dev, &vpbe_dev->current_timings); +} + +static int platform_device_get(struct device *dev, void *data) +{ + struct platform_device *pdev = to_platform_device(dev); + struct vpbe_device *vpbe_dev = data; + + if (strcmp("vpbe-osd", pdev->name) == 0) + vpbe_dev->osd_device = platform_get_drvdata(pdev); + + return 0; +} + +/** + * vpbe_initialize() - Initialize the vpbe display controller + * @vpbe_dev - vpbe device ptr + * + * Master frame buffer device drivers calls this to initialize vpbe + * display controller. This will then registers v4l2 device and the sub + * devices and sets a current encoder sub device for display. v4l2 display + * device driver is the master and frame buffer display device driver is + * the slave. Frame buffer display driver checks the initialized during + * probe and exit if not initialized. Returns status. + */ +static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev) +{ + struct encoder_config_info *enc_info; + struct v4l2_subdev **enc_subdev; + struct osd_state *osd_device; + struct i2c_adapter *i2c_adap; + int output_index; + int num_encoders; + int ret = 0; + int err; + int i; + + /* + * v4l2 abd FBDev frame buffer devices will get the vpbe_dev pointer + * from the platform device by iteration of platform drivers and + * matching with device name + */ + if (NULL == vpbe_dev || NULL == dev) { + printk(KERN_ERR "Null device pointers.\n"); + return -ENODEV; + } + + if (vpbe_dev->initialized) + return 0; + + mutex_lock(&vpbe_dev->lock); + + if (strcmp(vpbe_dev->cfg->module_name, "dm644x-vpbe-display") != 0) { + /* We have dac clock available for platform */ + vpbe_dev->dac_clk = clk_get(vpbe_dev->pdev, "vpss_dac"); + if (IS_ERR(vpbe_dev->dac_clk)) { + ret = PTR_ERR(vpbe_dev->dac_clk); + goto vpbe_unlock; + } + if (clk_enable(vpbe_dev->dac_clk)) { + ret = -ENODEV; + goto vpbe_unlock; + } + } + + /* first enable vpss clocks */ + vpss_enable_clock(VPSS_VPBE_CLOCK, 1); + + /* First register a v4l2 device */ + ret = v4l2_device_register(dev, &vpbe_dev->v4l2_dev); + if (ret) { + v4l2_err(dev->driver, + "Unable to register v4l2 device.\n"); + goto vpbe_fail_clock; + } + v4l2_info(&vpbe_dev->v4l2_dev, "vpbe v4l2 device registered\n"); + + err = bus_for_each_dev(&platform_bus_type, NULL, vpbe_dev, + platform_device_get); + if (err < 0) + return err; + + vpbe_dev->venc = venc_sub_dev_init(&vpbe_dev->v4l2_dev, + vpbe_dev->cfg->venc.module_name); + /* register venc sub device */ + if (vpbe_dev->venc == NULL) { + v4l2_err(&vpbe_dev->v4l2_dev, + "vpbe unable to init venc sub device\n"); + ret = -ENODEV; + goto vpbe_fail_v4l2_device; + } + /* initialize osd device */ + osd_device = vpbe_dev->osd_device; + + if (NULL != osd_device->ops.initialize) { + err = osd_device->ops.initialize(osd_device); + if (err) { + v4l2_err(&vpbe_dev->v4l2_dev, + "unable to initialize the OSD device"); + err = -ENOMEM; + goto vpbe_fail_v4l2_device; + } + } + + /* + * Register any external encoders that are configured. At index 0 we + * store venc sd index. + */ + num_encoders = vpbe_dev->cfg->num_ext_encoders + 1; + vpbe_dev->encoders = kmalloc( + sizeof(struct v4l2_subdev *)*num_encoders, + GFP_KERNEL); + if (NULL == vpbe_dev->encoders) { + v4l2_err(&vpbe_dev->v4l2_dev, + "unable to allocate memory for encoders sub devices"); + ret = -ENOMEM; + goto vpbe_fail_v4l2_device; + } + + i2c_adap = i2c_get_adapter(vpbe_dev->cfg->i2c_adapter_id); + for (i = 0; i < (vpbe_dev->cfg->num_ext_encoders + 1); i++) { + if (i == 0) { + /* venc is at index 0 */ + enc_subdev = &vpbe_dev->encoders[i]; + *enc_subdev = vpbe_dev->venc; + continue; + } + enc_info = &vpbe_dev->cfg->ext_encoders[i]; + if (enc_info->is_i2c) { + enc_subdev = &vpbe_dev->encoders[i]; + *enc_subdev = v4l2_i2c_new_subdev_board( + &vpbe_dev->v4l2_dev, i2c_adap, + &enc_info->board_info, NULL); + if (*enc_subdev) + v4l2_info(&vpbe_dev->v4l2_dev, + "v4l2 sub device %s registered\n", + enc_info->module_name); + else { + v4l2_err(&vpbe_dev->v4l2_dev, "encoder %s" + " failed to register", + enc_info->module_name); + ret = -ENODEV; + goto vpbe_fail_sd_register; + } + } else + v4l2_warn(&vpbe_dev->v4l2_dev, "non-i2c encoders" + " currently not supported"); + } + + /* set the current encoder and output to that of venc by default */ + vpbe_dev->current_sd_index = 0; + vpbe_dev->current_out_index = 0; + output_index = 0; + + mutex_unlock(&vpbe_dev->lock); + + printk(KERN_NOTICE "Setting default output to %s\n", def_output); + ret = vpbe_set_default_output(vpbe_dev); + if (ret) { + v4l2_err(&vpbe_dev->v4l2_dev, "Failed to set default output %s", + def_output); + return ret; + } + + printk(KERN_NOTICE "Setting default mode to %s\n", def_mode); + ret = vpbe_set_default_mode(vpbe_dev); + if (ret) { + v4l2_err(&vpbe_dev->v4l2_dev, "Failed to set default mode %s", + def_mode); + return ret; + } + vpbe_dev->initialized = 1; + /* TBD handling of bootargs for default output and mode */ + return 0; + +vpbe_fail_sd_register: + kfree(vpbe_dev->encoders); +vpbe_fail_v4l2_device: + v4l2_device_unregister(&vpbe_dev->v4l2_dev); +vpbe_fail_clock: + if (strcmp(vpbe_dev->cfg->module_name, "dm644x-vpbe-display") != 0) + clk_put(vpbe_dev->dac_clk); +vpbe_unlock: + mutex_unlock(&vpbe_dev->lock); + return ret; +} + +/** + * vpbe_deinitialize() - de-initialize the vpbe display controller + * @dev - Master and slave device ptr + * + * vpbe_master and slave frame buffer devices calls this to de-initialize + * the display controller. It is called when master and slave device + * driver modules are removed and no longer requires the display controller. + */ +static void vpbe_deinitialize(struct device *dev, struct vpbe_device *vpbe_dev) +{ + v4l2_device_unregister(&vpbe_dev->v4l2_dev); + if (strcmp(vpbe_dev->cfg->module_name, "dm644x-vpbe-display") != 0) + clk_put(vpbe_dev->dac_clk); + + kfree(vpbe_dev->encoders); + vpbe_dev->initialized = 0; + /* disable vpss clocks */ + vpss_enable_clock(VPSS_VPBE_CLOCK, 0); +} + +static struct vpbe_device_ops vpbe_dev_ops = { + .g_cropcap = vpbe_g_cropcap, + .enum_outputs = vpbe_enum_outputs, + .set_output = vpbe_set_output, + .get_output = vpbe_get_output, + .s_dv_preset = vpbe_s_dv_preset, + .g_dv_preset = vpbe_g_dv_preset, + .enum_dv_presets = vpbe_enum_dv_presets, + .s_std = vpbe_s_std, + .g_std = vpbe_g_std, + .initialize = vpbe_initialize, + .deinitialize = vpbe_deinitialize, + .get_mode_info = vpbe_get_current_mode_info, + .set_mode = vpbe_set_mode, +}; + +static __devinit int vpbe_probe(struct platform_device *pdev) +{ + struct vpbe_device *vpbe_dev; + struct vpbe_config *cfg; + int ret = -EINVAL; + + if (pdev->dev.platform_data == NULL) { + v4l2_err(pdev->dev.driver, "No platform data\n"); + return -ENODEV; + } + cfg = pdev->dev.platform_data; + + if (!cfg->module_name[0] || + !cfg->osd.module_name[0] || + !cfg->venc.module_name[0]) { + v4l2_err(pdev->dev.driver, "vpbe display module names not" + " defined\n"); + return ret; + } + + vpbe_dev = kzalloc(sizeof(*vpbe_dev), GFP_KERNEL); + if (vpbe_dev == NULL) { + v4l2_err(pdev->dev.driver, "Unable to allocate memory" + " for vpbe_device\n"); + return -ENOMEM; + } + vpbe_dev->cfg = cfg; + vpbe_dev->ops = vpbe_dev_ops; + vpbe_dev->pdev = &pdev->dev; + + if (cfg->outputs->num_modes > 0) + vpbe_dev->current_timings = vpbe_dev->cfg->outputs[0].modes[0]; + else + return -ENODEV; + + /* set the driver data in platform device */ + platform_set_drvdata(pdev, vpbe_dev); + mutex_init(&vpbe_dev->lock); + + return 0; +} + +static int vpbe_remove(struct platform_device *device) +{ + struct vpbe_device *vpbe_dev = platform_get_drvdata(device); + + kfree(vpbe_dev); + + return 0; +} + +static struct platform_driver vpbe_driver = { + .driver = { + .name = "vpbe_controller", + .owner = THIS_MODULE, + }, + .probe = vpbe_probe, + .remove = vpbe_remove, +}; + +/** + * vpbe_init: initialize the vpbe driver + * + * This function registers device and driver to the kernel + */ +static __init int vpbe_init(void) +{ + return platform_driver_register(&vpbe_driver); +} + +/** + * vpbe_cleanup : cleanup function for vpbe driver + * + * This will un-registers the device and driver to the kernel + */ +static void vpbe_cleanup(void) +{ + platform_driver_unregister(&vpbe_driver); +} + +/* Function for module initialization and cleanup */ +module_init(vpbe_init); +module_exit(vpbe_cleanup); diff --git a/include/media/davinci/vpbe.h b/include/media/davinci/vpbe.h new file mode 100644 index 000000000000..8b11fb037980 --- /dev/null +++ b/include/media/davinci/vpbe.h @@ -0,0 +1,184 @@ +/* + * Copyright (C) 2010 Texas Instruments Inc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * 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 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 _VPBE_H +#define _VPBE_H + +#include +#include + +#include +#include +#include +#include +#include +#include + +/* OSD configuration info */ +struct osd_config_info { + char module_name[32]; +}; + +struct vpbe_output { + struct v4l2_output output; + /* + * If output capabilities include dv_preset, list supported presets + * below + */ + char *subdev_name; + /* + * defualt_mode identifies the default timings set at the venc or + * external encoder. + */ + char *default_mode; + /* + * Fields below are used for supporting multiple modes. For example, + * LCD panel might support different modes and they are listed here. + * Similarly for supporting external encoders, lcd controller port + * requires a set of non-standard timing values to be listed here for + * each supported mode since venc is used in non-standard timing mode + * for interfacing with external encoder similar to configuring lcd + * panel timings + */ + unsigned int num_modes; + struct vpbe_enc_mode_info *modes; + /* + * Bus configuration goes here for external encoders. Some encoders + * may require multiple interface types for each of the output. For + * example, SD modes would use YCC8 where as HD mode would use YCC16. + * Not sure if this is needed on a per mode basis instead of per + * output basis. If per mode is needed, we may have to move this to + * mode_info structure + */ +}; + +/* encoder configuration info */ +struct encoder_config_info { + char module_name[32]; + /* Is this an i2c device ? */ + unsigned int is_i2c:1; + /* i2c subdevice board info */ + struct i2c_board_info board_info; +}; + +/* structure for defining vpbe display subsystem components */ +struct vpbe_config { + char module_name[32]; + /* i2c bus adapter no */ + int i2c_adapter_id; + struct osd_config_info osd; + struct encoder_config_info venc; + /* external encoder information goes here */ + int num_ext_encoders; + struct encoder_config_info *ext_encoders; + int num_outputs; + /* Order is venc outputs followed by LCD and then external encoders */ + struct vpbe_output *outputs; +}; + +struct vpbe_device; + +struct vpbe_device_ops { + /* crop cap for the display */ + int (*g_cropcap)(struct vpbe_device *vpbe_dev, + struct v4l2_cropcap *cropcap); + + /* Enumerate the outputs */ + int (*enum_outputs)(struct vpbe_device *vpbe_dev, + struct v4l2_output *output); + + /* Set output to the given index */ + int (*set_output)(struct vpbe_device *vpbe_dev, + int index); + + /* Get current output */ + unsigned int (*get_output)(struct vpbe_device *vpbe_dev); + + /* Set DV preset at current output */ + int (*s_dv_preset)(struct vpbe_device *vpbe_dev, + struct v4l2_dv_preset *dv_preset); + + /* Get DV presets supported at the output */ + int (*g_dv_preset)(struct vpbe_device *vpbe_dev, + struct v4l2_dv_preset *dv_preset); + + /* Enumerate the DV Presets supported at the output */ + int (*enum_dv_presets)(struct vpbe_device *vpbe_dev, + struct v4l2_dv_enum_preset *preset_info); + + /* Set std at the output */ + int (*s_std)(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id); + + /* Get the current std at the output */ + int (*g_std)(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id); + + /* initialize the device */ + int (*initialize)(struct device *dev, struct vpbe_device *vpbe_dev); + + /* De-initialize the device */ + void (*deinitialize)(struct device *dev, struct vpbe_device *vpbe_dev); + + /* Get the current mode info */ + int (*get_mode_info)(struct vpbe_device *vpbe_dev, + struct vpbe_enc_mode_info*); + + /* + * Set the current mode in the encoder. Alternate way of setting + * standard or DV preset or custom timings in the encoder + */ + int (*set_mode)(struct vpbe_device *vpbe_dev, + struct vpbe_enc_mode_info*); + /* Power management operations */ + int (*suspend)(struct vpbe_device *vpbe_dev); + int (*resume)(struct vpbe_device *vpbe_dev); +}; + +/* struct for vpbe device */ +struct vpbe_device { + /* V4l2 device */ + struct v4l2_device v4l2_dev; + /* vpbe dispay controller cfg */ + struct vpbe_config *cfg; + /* parent device */ + struct device *pdev; + /* external encoder v4l2 sub devices */ + struct v4l2_subdev **encoders; + /* current encoder index */ + int current_sd_index; + struct mutex lock; + /* device initialized */ + int initialized; + /* vpbe dac clock */ + struct clk *dac_clk; + /* osd_device pointer */ + struct osd_state *osd_device; + /* + * fields below are accessed by users of vpbe_device. Not the + * ones above + */ + + /* current output */ + int current_out_index; + /* lock used by caller to do atomic operation on vpbe device */ + /* current timings set in the controller */ + struct vpbe_enc_mode_info current_timings; + /* venc sub device */ + struct v4l2_subdev *venc; + /* device operations below */ + struct vpbe_device_ops ops; +}; + +#endif -- cgit v1.2.3 From ff0f23dd0edf4a5bd5fa3ee0eda71d8a1c8201d4 Mon Sep 17 00:00:00 2001 From: Manjunath Hadli Date: Fri, 17 Jun 2011 04:01:33 -0300 Subject: [media] davinci vpbe: OSD(On Screen Display) block This patch implements the functionality of the OSD block of the VPBE. The OSD in total supports 4 planes or Video sources - 2 mainly RGB and 2 Video. The patch implements general handling of all the planes, with specific emphasis on the Video plane capabilities as the Video planes are supported through the V4L2 driver. Signed-off-by: Manjunath Hadli Acked-by: Muralidharan Karicheri Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/davinci/vpbe_osd.c | 1231 +++++++++++++++++++++++++++ drivers/media/video/davinci/vpbe_osd_regs.h | 364 ++++++++ include/media/davinci/vpbe_osd.h | 394 +++++++++ 3 files changed, 1989 insertions(+) create mode 100644 drivers/media/video/davinci/vpbe_osd.c create mode 100644 drivers/media/video/davinci/vpbe_osd_regs.h create mode 100644 include/media/davinci/vpbe_osd.h diff --git a/drivers/media/video/davinci/vpbe_osd.c b/drivers/media/video/davinci/vpbe_osd.c new file mode 100644 index 000000000000..5352884998f5 --- /dev/null +++ b/drivers/media/video/davinci/vpbe_osd.c @@ -0,0 +1,1231 @@ +/* + * Copyright (C) 2007-2010 Texas Instruments Inc + * Copyright (C) 2007 MontaVista Software, Inc. + * + * Andy Lowe (alowe@mvista.com), MontaVista Software + * - Initial version + * Murali Karicheri (mkaricheri@gmail.com), Texas Instruments Ltd. + * - ported to sub device interface + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * 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 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 + * + */ +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include "vpbe_osd_regs.h" + +#define MODULE_NAME VPBE_OSD_SUBDEV_NAME + +/* register access routines */ +static inline u32 osd_read(struct osd_state *sd, u32 offset) +{ + struct osd_state *osd = sd; + + return readl(osd->osd_base + offset); +} + +static inline u32 osd_write(struct osd_state *sd, u32 val, u32 offset) +{ + struct osd_state *osd = sd; + + writel(val, osd->osd_base + offset); + + return val; +} + +static inline u32 osd_set(struct osd_state *sd, u32 mask, u32 offset) +{ + struct osd_state *osd = sd; + + u32 addr = osd->osd_base + offset; + u32 val = readl(addr) | mask; + + writel(val, addr); + + return val; +} + +static inline u32 osd_clear(struct osd_state *sd, u32 mask, u32 offset) +{ + struct osd_state *osd = sd; + + u32 addr = osd->osd_base + offset; + u32 val = readl(addr) & ~mask; + + writel(val, addr); + + return val; +} + +static inline u32 osd_modify(struct osd_state *sd, u32 mask, u32 val, + u32 offset) +{ + struct osd_state *osd = sd; + + u32 addr = osd->osd_base + offset; + u32 new_val = (readl(addr) & ~mask) | (val & mask); + + writel(new_val, addr); + + return new_val; +} + +/* define some macros for layer and pixfmt classification */ +#define is_osd_win(layer) (((layer) == WIN_OSD0) || ((layer) == WIN_OSD1)) +#define is_vid_win(layer) (((layer) == WIN_VID0) || ((layer) == WIN_VID1)) +#define is_rgb_pixfmt(pixfmt) \ + (((pixfmt) == PIXFMT_RGB565) || ((pixfmt) == PIXFMT_RGB888)) +#define is_yc_pixfmt(pixfmt) \ + (((pixfmt) == PIXFMT_YCbCrI) || ((pixfmt) == PIXFMT_YCrCbI) || \ + ((pixfmt) == PIXFMT_NV12)) +#define MAX_WIN_SIZE OSD_VIDWIN0XP_V0X +#define MAX_LINE_LENGTH (OSD_VIDWIN0OFST_V0LO << 5) + +/** + * _osd_dm6446_vid0_pingpong() - field inversion fix for DM6446 + * @sd - ptr to struct osd_state + * @field_inversion - inversion flag + * @fb_base_phys - frame buffer address + * @lconfig - ptr to layer config + * + * This routine implements a workaround for the field signal inversion silicon + * erratum described in Advisory 1.3.8 for the DM6446. The fb_base_phys and + * lconfig parameters apply to the vid0 window. This routine should be called + * whenever the vid0 layer configuration or start address is modified, or when + * the OSD field inversion setting is modified. + * Returns: 1 if the ping-pong buffers need to be toggled in the vsync isr, or + * 0 otherwise + */ +static int _osd_dm6446_vid0_pingpong(struct osd_state *sd, + int field_inversion, + unsigned long fb_base_phys, + const struct osd_layer_config *lconfig) +{ + struct osd_platform_data *pdata; + + pdata = (struct osd_platform_data *)sd->dev->platform_data; + if (pdata->field_inv_wa_enable) { + + if (!field_inversion || !lconfig->interlaced) { + osd_write(sd, fb_base_phys & ~0x1F, OSD_VIDWIN0ADR); + osd_write(sd, fb_base_phys & ~0x1F, OSD_PPVWIN0ADR); + osd_modify(sd, OSD_MISCCTL_PPSW | OSD_MISCCTL_PPRV, 0, + OSD_MISCCTL); + return 0; + } else { + unsigned miscctl = OSD_MISCCTL_PPRV; + + osd_write(sd, + (fb_base_phys & ~0x1F) - lconfig->line_length, + OSD_VIDWIN0ADR); + osd_write(sd, + (fb_base_phys & ~0x1F) + lconfig->line_length, + OSD_PPVWIN0ADR); + osd_modify(sd, + OSD_MISCCTL_PPSW | OSD_MISCCTL_PPRV, miscctl, + OSD_MISCCTL); + + return 1; + } + } + + return 0; +} + +static void _osd_set_field_inversion(struct osd_state *sd, int enable) +{ + unsigned fsinv = 0; + + if (enable) + fsinv = OSD_MODE_FSINV; + + osd_modify(sd, OSD_MODE_FSINV, fsinv, OSD_MODE); +} + +static void _osd_set_blink_attribute(struct osd_state *sd, int enable, + enum osd_blink_interval blink) +{ + u32 osdatrmd = 0; + + if (enable) { + osdatrmd |= OSD_OSDATRMD_BLNK; + osdatrmd |= blink << OSD_OSDATRMD_BLNKINT_SHIFT; + } + /* caller must ensure that OSD1 is configured in attribute mode */ + osd_modify(sd, OSD_OSDATRMD_BLNKINT | OSD_OSDATRMD_BLNK, osdatrmd, + OSD_OSDATRMD); +} + +static void _osd_set_rom_clut(struct osd_state *sd, + enum osd_rom_clut rom_clut) +{ + if (rom_clut == ROM_CLUT0) + osd_clear(sd, OSD_MISCCTL_RSEL, OSD_MISCCTL); + else + osd_set(sd, OSD_MISCCTL_RSEL, OSD_MISCCTL); +} + +static void _osd_set_palette_map(struct osd_state *sd, + enum osd_win_layer osdwin, + unsigned char pixel_value, + unsigned char clut_index, + enum osd_pix_format pixfmt) +{ + static const int map_2bpp[] = { 0, 5, 10, 15 }; + static const int map_1bpp[] = { 0, 15 }; + int bmp_offset; + int bmp_shift; + int bmp_mask; + int bmp_reg; + + switch (pixfmt) { + case PIXFMT_1BPP: + bmp_reg = map_1bpp[pixel_value & 0x1]; + break; + case PIXFMT_2BPP: + bmp_reg = map_2bpp[pixel_value & 0x3]; + break; + case PIXFMT_4BPP: + bmp_reg = pixel_value & 0xf; + break; + default: + return; + } + + switch (osdwin) { + case OSDWIN_OSD0: + bmp_offset = OSD_W0BMP01 + (bmp_reg >> 1) * sizeof(u32); + break; + case OSDWIN_OSD1: + bmp_offset = OSD_W1BMP01 + (bmp_reg >> 1) * sizeof(u32); + break; + default: + return; + } + + if (bmp_reg & 1) { + bmp_shift = 8; + bmp_mask = 0xff << 8; + } else { + bmp_shift = 0; + bmp_mask = 0xff; + } + + osd_modify(sd, bmp_mask, clut_index << bmp_shift, bmp_offset); +} + +static void _osd_set_rec601_attenuation(struct osd_state *sd, + enum osd_win_layer osdwin, int enable) +{ + switch (osdwin) { + case OSDWIN_OSD0: + osd_modify(sd, OSD_OSDWIN0MD_ATN0E, + enable ? OSD_OSDWIN0MD_ATN0E : 0, + OSD_OSDWIN0MD); + break; + case OSDWIN_OSD1: + osd_modify(sd, OSD_OSDWIN1MD_ATN1E, + enable ? OSD_OSDWIN1MD_ATN1E : 0, + OSD_OSDWIN1MD); + break; + } +} + +static void _osd_set_blending_factor(struct osd_state *sd, + enum osd_win_layer osdwin, + enum osd_blending_factor blend) +{ + switch (osdwin) { + case OSDWIN_OSD0: + osd_modify(sd, OSD_OSDWIN0MD_BLND0, + blend << OSD_OSDWIN0MD_BLND0_SHIFT, OSD_OSDWIN0MD); + break; + case OSDWIN_OSD1: + osd_modify(sd, OSD_OSDWIN1MD_BLND1, + blend << OSD_OSDWIN1MD_BLND1_SHIFT, OSD_OSDWIN1MD); + break; + } +} + +static void _osd_enable_color_key(struct osd_state *sd, + enum osd_win_layer osdwin, + unsigned colorkey, + enum osd_pix_format pixfmt) +{ + switch (pixfmt) { + case PIXFMT_RGB565: + osd_write(sd, colorkey & OSD_TRANSPVAL_RGBTRANS, + OSD_TRANSPVAL); + break; + default: + break; + } + + switch (osdwin) { + case OSDWIN_OSD0: + osd_set(sd, OSD_OSDWIN0MD_TE0, OSD_OSDWIN0MD); + break; + case OSDWIN_OSD1: + osd_set(sd, OSD_OSDWIN1MD_TE1, OSD_OSDWIN1MD); + break; + } +} + +static void _osd_disable_color_key(struct osd_state *sd, + enum osd_win_layer osdwin) +{ + switch (osdwin) { + case OSDWIN_OSD0: + osd_clear(sd, OSD_OSDWIN0MD_TE0, OSD_OSDWIN0MD); + break; + case OSDWIN_OSD1: + osd_clear(sd, OSD_OSDWIN1MD_TE1, OSD_OSDWIN1MD); + break; + } +} + +static void _osd_set_osd_clut(struct osd_state *sd, + enum osd_win_layer osdwin, + enum osd_clut clut) +{ + u32 winmd = 0; + + switch (osdwin) { + case OSDWIN_OSD0: + if (clut == RAM_CLUT) + winmd |= OSD_OSDWIN0MD_CLUTS0; + osd_modify(sd, OSD_OSDWIN0MD_CLUTS0, winmd, OSD_OSDWIN0MD); + break; + case OSDWIN_OSD1: + if (clut == RAM_CLUT) + winmd |= OSD_OSDWIN1MD_CLUTS1; + osd_modify(sd, OSD_OSDWIN1MD_CLUTS1, winmd, OSD_OSDWIN1MD); + break; + } +} + +static void _osd_set_zoom(struct osd_state *sd, enum osd_layer layer, + enum osd_zoom_factor h_zoom, + enum osd_zoom_factor v_zoom) +{ + u32 winmd = 0; + + switch (layer) { + case WIN_OSD0: + winmd |= (h_zoom << OSD_OSDWIN0MD_OHZ0_SHIFT); + winmd |= (v_zoom << OSD_OSDWIN0MD_OVZ0_SHIFT); + osd_modify(sd, OSD_OSDWIN0MD_OHZ0 | OSD_OSDWIN0MD_OVZ0, winmd, + OSD_OSDWIN0MD); + break; + case WIN_VID0: + winmd |= (h_zoom << OSD_VIDWINMD_VHZ0_SHIFT); + winmd |= (v_zoom << OSD_VIDWINMD_VVZ0_SHIFT); + osd_modify(sd, OSD_VIDWINMD_VHZ0 | OSD_VIDWINMD_VVZ0, winmd, + OSD_VIDWINMD); + break; + case WIN_OSD1: + winmd |= (h_zoom << OSD_OSDWIN1MD_OHZ1_SHIFT); + winmd |= (v_zoom << OSD_OSDWIN1MD_OVZ1_SHIFT); + osd_modify(sd, OSD_OSDWIN1MD_OHZ1 | OSD_OSDWIN1MD_OVZ1, winmd, + OSD_OSDWIN1MD); + break; + case WIN_VID1: + winmd |= (h_zoom << OSD_VIDWINMD_VHZ1_SHIFT); + winmd |= (v_zoom << OSD_VIDWINMD_VVZ1_SHIFT); + osd_modify(sd, OSD_VIDWINMD_VHZ1 | OSD_VIDWINMD_VVZ1, winmd, + OSD_VIDWINMD); + break; + } +} + +static void _osd_disable_layer(struct osd_state *sd, enum osd_layer layer) +{ + switch (layer) { + case WIN_OSD0: + osd_clear(sd, OSD_OSDWIN0MD_OACT0, OSD_OSDWIN0MD); + break; + case WIN_VID0: + osd_clear(sd, OSD_VIDWINMD_ACT0, OSD_VIDWINMD); + break; + case WIN_OSD1: + /* disable attribute mode as well as disabling the window */ + osd_clear(sd, OSD_OSDWIN1MD_OASW | OSD_OSDWIN1MD_OACT1, + OSD_OSDWIN1MD); + break; + case WIN_VID1: + osd_clear(sd, OSD_VIDWINMD_ACT1, OSD_VIDWINMD); + break; + } +} + +static void osd_disable_layer(struct osd_state *sd, enum osd_layer layer) +{ + struct osd_state *osd = sd; + struct osd_window_state *win = &osd->win[layer]; + unsigned long flags; + + spin_lock_irqsave(&osd->lock, flags); + + if (!win->is_enabled) { + spin_unlock_irqrestore(&osd->lock, flags); + return; + } + win->is_enabled = 0; + + _osd_disable_layer(sd, layer); + + spin_unlock_irqrestore(&osd->lock, flags); +} + +static void _osd_enable_attribute_mode(struct osd_state *sd) +{ + /* enable attribute mode for OSD1 */ + osd_set(sd, OSD_OSDWIN1MD_OASW, OSD_OSDWIN1MD); +} + +static void _osd_enable_layer(struct osd_state *sd, enum osd_layer layer) +{ + switch (layer) { + case WIN_OSD0: + osd_set(sd, OSD_OSDWIN0MD_OACT0, OSD_OSDWIN0MD); + break; + case WIN_VID0: + osd_set(sd, OSD_VIDWINMD_ACT0, OSD_VIDWINMD); + break; + case WIN_OSD1: + /* enable OSD1 and disable attribute mode */ + osd_modify(sd, OSD_OSDWIN1MD_OASW | OSD_OSDWIN1MD_OACT1, + OSD_OSDWIN1MD_OACT1, OSD_OSDWIN1MD); + break; + case WIN_VID1: + osd_set(sd, OSD_VIDWINMD_ACT1, OSD_VIDWINMD); + break; + } +} + +static int osd_enable_layer(struct osd_state *sd, enum osd_layer layer, + int otherwin) +{ + struct osd_state *osd = sd; + struct osd_window_state *win = &osd->win[layer]; + struct osd_layer_config *cfg = &win->lconfig; + unsigned long flags; + + spin_lock_irqsave(&osd->lock, flags); + + /* + * use otherwin flag to know this is the other vid window + * in YUV420 mode, if is, skip this check + */ + if (!otherwin && (!win->is_allocated || + !win->fb_base_phys || + !cfg->line_length || + !cfg->xsize || + !cfg->ysize)) { + spin_unlock_irqrestore(&osd->lock, flags); + return -1; + } + + if (win->is_enabled) { + spin_unlock_irqrestore(&osd->lock, flags); + return 0; + } + win->is_enabled = 1; + + if (cfg->pixfmt != PIXFMT_OSD_ATTR) + _osd_enable_layer(sd, layer); + else { + _osd_enable_attribute_mode(sd); + _osd_set_blink_attribute(sd, osd->is_blinking, osd->blink); + } + + spin_unlock_irqrestore(&osd->lock, flags); + + return 0; +} + +static void _osd_start_layer(struct osd_state *sd, enum osd_layer layer, + unsigned long fb_base_phys, + unsigned long cbcr_ofst) +{ + switch (layer) { + case WIN_OSD0: + osd_write(sd, fb_base_phys & ~0x1F, OSD_OSDWIN0ADR); + break; + case WIN_VID0: + osd_write(sd, fb_base_phys & ~0x1F, OSD_VIDWIN0ADR); + break; + case WIN_OSD1: + osd_write(sd, fb_base_phys & ~0x1F, OSD_OSDWIN1ADR); + break; + case WIN_VID1: + osd_write(sd, fb_base_phys & ~0x1F, OSD_VIDWIN1ADR); + break; + } +} + +static void osd_start_layer(struct osd_state *sd, enum osd_layer layer, + unsigned long fb_base_phys, + unsigned long cbcr_ofst) +{ + struct osd_state *osd = sd; + struct osd_window_state *win = &osd->win[layer]; + struct osd_layer_config *cfg = &win->lconfig; + unsigned long flags; + + spin_lock_irqsave(&osd->lock, flags); + + win->fb_base_phys = fb_base_phys & ~0x1F; + _osd_start_layer(sd, layer, fb_base_phys, cbcr_ofst); + + if (layer == WIN_VID0) { + osd->pingpong = + _osd_dm6446_vid0_pingpong(sd, osd->field_inversion, + win->fb_base_phys, + cfg); + } + + spin_unlock_irqrestore(&osd->lock, flags); +} + +static void osd_get_layer_config(struct osd_state *sd, enum osd_layer layer, + struct osd_layer_config *lconfig) +{ + struct osd_state *osd = sd; + struct osd_window_state *win = &osd->win[layer]; + unsigned long flags; + + spin_lock_irqsave(&osd->lock, flags); + + *lconfig = win->lconfig; + + spin_unlock_irqrestore(&osd->lock, flags); +} + +/** + * try_layer_config() - Try a specific configuration for the layer + * @sd - ptr to struct osd_state + * @layer - layer to configure + * @lconfig - layer configuration to try + * + * If the requested lconfig is completely rejected and the value of lconfig on + * exit is the current lconfig, then try_layer_config() returns 1. Otherwise, + * try_layer_config() returns 0. A return value of 0 does not necessarily mean + * that the value of lconfig on exit is identical to the value of lconfig on + * entry, but merely that it represents a change from the current lconfig. + */ +static int try_layer_config(struct osd_state *sd, enum osd_layer layer, + struct osd_layer_config *lconfig) +{ + struct osd_state *osd = sd; + struct osd_window_state *win = &osd->win[layer]; + int bad_config; + + /* verify that the pixel format is compatible with the layer */ + switch (lconfig->pixfmt) { + case PIXFMT_1BPP: + case PIXFMT_2BPP: + case PIXFMT_4BPP: + case PIXFMT_8BPP: + case PIXFMT_RGB565: + bad_config = !is_osd_win(layer); + break; + case PIXFMT_YCbCrI: + case PIXFMT_YCrCbI: + bad_config = !is_vid_win(layer); + break; + case PIXFMT_RGB888: + bad_config = !is_vid_win(layer); + break; + case PIXFMT_NV12: + bad_config = 1; + break; + case PIXFMT_OSD_ATTR: + bad_config = (layer != WIN_OSD1); + break; + default: + bad_config = 1; + break; + } + if (bad_config) { + /* + * The requested pixel format is incompatible with the layer, + * so keep the current layer configuration. + */ + *lconfig = win->lconfig; + return bad_config; + } + + /* DM6446: */ + /* only one OSD window at a time can use RGB pixel formats */ + if (is_osd_win(layer) && is_rgb_pixfmt(lconfig->pixfmt)) { + enum osd_pix_format pixfmt; + if (layer == WIN_OSD0) + pixfmt = osd->win[WIN_OSD1].lconfig.pixfmt; + else + pixfmt = osd->win[WIN_OSD0].lconfig.pixfmt; + + if (is_rgb_pixfmt(pixfmt)) { + /* + * The other OSD window is already configured for an + * RGB, so keep the current layer configuration. + */ + *lconfig = win->lconfig; + return 1; + } + } + + /* DM6446: only one video window at a time can use RGB888 */ + if (is_vid_win(layer) && lconfig->pixfmt == PIXFMT_RGB888) { + enum osd_pix_format pixfmt; + + if (layer == WIN_VID0) + pixfmt = osd->win[WIN_VID1].lconfig.pixfmt; + else + pixfmt = osd->win[WIN_VID0].lconfig.pixfmt; + + if (pixfmt == PIXFMT_RGB888) { + /* + * The other video window is already configured for + * RGB888, so keep the current layer configuration. + */ + *lconfig = win->lconfig; + return 1; + } + } + + /* window dimensions must be non-zero */ + if (!lconfig->line_length || !lconfig->xsize || !lconfig->ysize) { + *lconfig = win->lconfig; + return 1; + } + + /* round line_length up to a multiple of 32 */ + lconfig->line_length = ((lconfig->line_length + 31) / 32) * 32; + lconfig->line_length = + min(lconfig->line_length, (unsigned)MAX_LINE_LENGTH); + lconfig->xsize = min(lconfig->xsize, (unsigned)MAX_WIN_SIZE); + lconfig->ysize = min(lconfig->ysize, (unsigned)MAX_WIN_SIZE); + lconfig->xpos = min(lconfig->xpos, (unsigned)MAX_WIN_SIZE); + lconfig->ypos = min(lconfig->ypos, (unsigned)MAX_WIN_SIZE); + lconfig->interlaced = (lconfig->interlaced != 0); + if (lconfig->interlaced) { + /* ysize and ypos must be even for interlaced displays */ + lconfig->ysize &= ~1; + lconfig->ypos &= ~1; + } + + return 0; +} + +static void _osd_disable_vid_rgb888(struct osd_state *sd) +{ + /* + * The DM6446 supports RGB888 pixel format in a single video window. + * This routine disables RGB888 pixel format for both video windows. + * The caller must ensure that neither video window is currently + * configured for RGB888 pixel format. + */ + osd_clear(sd, OSD_MISCCTL_RGBEN, OSD_MISCCTL); +} + +static void _osd_enable_vid_rgb888(struct osd_state *sd, + enum osd_layer layer) +{ + /* + * The DM6446 supports RGB888 pixel format in a single video window. + * This routine enables RGB888 pixel format for the specified video + * window. The caller must ensure that the other video window is not + * currently configured for RGB888 pixel format, as this routine will + * disable RGB888 pixel format for the other window. + */ + if (layer == WIN_VID0) { + osd_modify(sd, OSD_MISCCTL_RGBEN | OSD_MISCCTL_RGBWIN, + OSD_MISCCTL_RGBEN, OSD_MISCCTL); + } else if (layer == WIN_VID1) { + osd_modify(sd, OSD_MISCCTL_RGBEN | OSD_MISCCTL_RGBWIN, + OSD_MISCCTL_RGBEN | OSD_MISCCTL_RGBWIN, + OSD_MISCCTL); + } +} + +static void _osd_set_cbcr_order(struct osd_state *sd, + enum osd_pix_format pixfmt) +{ + /* + * The caller must ensure that all windows using YC pixfmt use the same + * Cb/Cr order. + */ + if (pixfmt == PIXFMT_YCbCrI) + osd_clear(sd, OSD_MODE_CS, OSD_MODE); + else if (pixfmt == PIXFMT_YCrCbI) + osd_set(sd, OSD_MODE_CS, OSD_MODE); +} + +static void _osd_set_layer_config(struct osd_state *sd, enum osd_layer layer, + const struct osd_layer_config *lconfig) +{ + u32 winmd = 0, winmd_mask = 0, bmw = 0; + + _osd_set_cbcr_order(sd, lconfig->pixfmt); + + switch (layer) { + case WIN_OSD0: + winmd_mask |= OSD_OSDWIN0MD_RGB0E; + if (lconfig->pixfmt == PIXFMT_RGB565) + winmd |= OSD_OSDWIN0MD_RGB0E; + + winmd_mask |= OSD_OSDWIN0MD_BMW0 | OSD_OSDWIN0MD_OFF0; + + switch (lconfig->pixfmt) { + case PIXFMT_1BPP: + bmw = 0; + break; + case PIXFMT_2BPP: + bmw = 1; + break; + case PIXFMT_4BPP: + bmw = 2; + break; + case PIXFMT_8BPP: + bmw = 3; + break; + default: + break; + } + winmd |= (bmw << OSD_OSDWIN0MD_BMW0_SHIFT); + + if (lconfig->interlaced) + winmd |= OSD_OSDWIN0MD_OFF0; + + osd_modify(sd, winmd_mask, winmd, OSD_OSDWIN0MD); + osd_write(sd, lconfig->line_length >> 5, OSD_OSDWIN0OFST); + osd_write(sd, lconfig->xpos, OSD_OSDWIN0XP); + osd_write(sd, lconfig->xsize, OSD_OSDWIN0XL); + if (lconfig->interlaced) { + osd_write(sd, lconfig->ypos >> 1, OSD_OSDWIN0YP); + osd_write(sd, lconfig->ysize >> 1, OSD_OSDWIN0YL); + } else { + osd_write(sd, lconfig->ypos, OSD_OSDWIN0YP); + osd_write(sd, lconfig->ysize, OSD_OSDWIN0YL); + } + break; + case WIN_VID0: + winmd_mask |= OSD_VIDWINMD_VFF0; + if (lconfig->interlaced) + winmd |= OSD_VIDWINMD_VFF0; + + osd_modify(sd, winmd_mask, winmd, OSD_VIDWINMD); + osd_write(sd, lconfig->line_length >> 5, OSD_VIDWIN0OFST); + osd_write(sd, lconfig->xpos, OSD_VIDWIN0XP); + osd_write(sd, lconfig->xsize, OSD_VIDWIN0XL); + /* + * For YUV420P format the register contents are + * duplicated in both VID registers + */ + if (lconfig->interlaced) { + osd_write(sd, lconfig->ypos >> 1, OSD_VIDWIN0YP); + osd_write(sd, lconfig->ysize >> 1, OSD_VIDWIN0YL); + } else { + osd_write(sd, lconfig->ypos, OSD_VIDWIN0YP); + osd_write(sd, lconfig->ysize, OSD_VIDWIN0YL); + } + break; + case WIN_OSD1: + /* + * The caller must ensure that OSD1 is disabled prior to + * switching from a normal mode to attribute mode or from + * attribute mode to a normal mode. + */ + if (lconfig->pixfmt == PIXFMT_OSD_ATTR) { + winmd_mask |= + OSD_OSDWIN1MD_ATN1E | OSD_OSDWIN1MD_RGB1E | + OSD_OSDWIN1MD_CLUTS1 | + OSD_OSDWIN1MD_BLND1 | OSD_OSDWIN1MD_TE1; + } else { + winmd_mask |= OSD_OSDWIN1MD_RGB1E; + if (lconfig->pixfmt == PIXFMT_RGB565) + winmd |= OSD_OSDWIN1MD_RGB1E; + + winmd_mask |= OSD_OSDWIN1MD_BMW1; + switch (lconfig->pixfmt) { + case PIXFMT_1BPP: + bmw = 0; + break; + case PIXFMT_2BPP: + bmw = 1; + break; + case PIXFMT_4BPP: + bmw = 2; + break; + case PIXFMT_8BPP: + bmw = 3; + break; + default: + break; + } + winmd |= (bmw << OSD_OSDWIN1MD_BMW1_SHIFT); + } + + winmd_mask |= OSD_OSDWIN1MD_OFF1; + if (lconfig->interlaced) + winmd |= OSD_OSDWIN1MD_OFF1; + + osd_modify(sd, winmd_mask, winmd, OSD_OSDWIN1MD); + osd_write(sd, lconfig->line_length >> 5, OSD_OSDWIN1OFST); + osd_write(sd, lconfig->xpos, OSD_OSDWIN1XP); + osd_write(sd, lconfig->xsize, OSD_OSDWIN1XL); + if (lconfig->interlaced) { + osd_write(sd, lconfig->ypos >> 1, OSD_OSDWIN1YP); + osd_write(sd, lconfig->ysize >> 1, OSD_OSDWIN1YL); + } else { + osd_write(sd, lconfig->ypos, OSD_OSDWIN1YP); + osd_write(sd, lconfig->ysize, OSD_OSDWIN1YL); + } + break; + case WIN_VID1: + winmd_mask |= OSD_VIDWINMD_VFF1; + if (lconfig->interlaced) + winmd |= OSD_VIDWINMD_VFF1; + + osd_modify(sd, winmd_mask, winmd, OSD_VIDWINMD); + osd_write(sd, lconfig->line_length >> 5, OSD_VIDWIN1OFST); + osd_write(sd, lconfig->xpos, OSD_VIDWIN1XP); + osd_write(sd, lconfig->xsize, OSD_VIDWIN1XL); + /* + * For YUV420P format the register contents are + * duplicated in both VID registers + */ + osd_modify(sd, OSD_MISCCTL_S420D, ~OSD_MISCCTL_S420D, + OSD_MISCCTL); + + if (lconfig->interlaced) { + osd_write(sd, lconfig->ypos >> 1, OSD_VIDWIN1YP); + osd_write(sd, lconfig->ysize >> 1, OSD_VIDWIN1YL); + } else { + osd_write(sd, lconfig->ypos, OSD_VIDWIN1YP); + osd_write(sd, lconfig->ysize, OSD_VIDWIN1YL); + } + break; + } +} + +static int osd_set_layer_config(struct osd_state *sd, enum osd_layer layer, + struct osd_layer_config *lconfig) +{ + struct osd_state *osd = sd; + struct osd_window_state *win = &osd->win[layer]; + struct osd_layer_config *cfg = &win->lconfig; + unsigned long flags; + int reject_config; + + spin_lock_irqsave(&osd->lock, flags); + + reject_config = try_layer_config(sd, layer, lconfig); + if (reject_config) { + spin_unlock_irqrestore(&osd->lock, flags); + return reject_config; + } + + /* update the current Cb/Cr order */ + if (is_yc_pixfmt(lconfig->pixfmt)) + osd->yc_pixfmt = lconfig->pixfmt; + + /* + * If we are switching OSD1 from normal mode to attribute mode or from + * attribute mode to normal mode, then we must disable the window. + */ + if (layer == WIN_OSD1) { + if (((lconfig->pixfmt == PIXFMT_OSD_ATTR) && + (cfg->pixfmt != PIXFMT_OSD_ATTR)) || + ((lconfig->pixfmt != PIXFMT_OSD_ATTR) && + (cfg->pixfmt == PIXFMT_OSD_ATTR))) { + win->is_enabled = 0; + _osd_disable_layer(sd, layer); + } + } + + _osd_set_layer_config(sd, layer, lconfig); + + if (layer == WIN_OSD1) { + struct osd_osdwin_state *osdwin_state = + &osd->osdwin[OSDWIN_OSD1]; + + if ((lconfig->pixfmt != PIXFMT_OSD_ATTR) && + (cfg->pixfmt == PIXFMT_OSD_ATTR)) { + /* + * We just switched OSD1 from attribute mode to normal + * mode, so we must initialize the CLUT select, the + * blend factor, transparency colorkey enable, and + * attenuation enable (DM6446 only) bits in the + * OSDWIN1MD register. + */ + _osd_set_osd_clut(sd, OSDWIN_OSD1, + osdwin_state->clut); + _osd_set_blending_factor(sd, OSDWIN_OSD1, + osdwin_state->blend); + if (osdwin_state->colorkey_blending) { + _osd_enable_color_key(sd, OSDWIN_OSD1, + osdwin_state-> + colorkey, + lconfig->pixfmt); + } else + _osd_disable_color_key(sd, OSDWIN_OSD1); + _osd_set_rec601_attenuation(sd, OSDWIN_OSD1, + osdwin_state-> + rec601_attenuation); + } else if ((lconfig->pixfmt == PIXFMT_OSD_ATTR) && + (cfg->pixfmt != PIXFMT_OSD_ATTR)) { + /* + * We just switched OSD1 from normal mode to attribute + * mode, so we must initialize the blink enable and + * blink interval bits in the OSDATRMD register. + */ + _osd_set_blink_attribute(sd, osd->is_blinking, + osd->blink); + } + } + + /* + * If we just switched to a 1-, 2-, or 4-bits-per-pixel bitmap format + * then configure a default palette map. + */ + if ((lconfig->pixfmt != cfg->pixfmt) && + ((lconfig->pixfmt == PIXFMT_1BPP) || + (lconfig->pixfmt == PIXFMT_2BPP) || + (lconfig->pixfmt == PIXFMT_4BPP))) { + enum osd_win_layer osdwin = + ((layer == WIN_OSD0) ? OSDWIN_OSD0 : OSDWIN_OSD1); + struct osd_osdwin_state *osdwin_state = + &osd->osdwin[osdwin]; + unsigned char clut_index; + unsigned char clut_entries = 0; + + switch (lconfig->pixfmt) { + case PIXFMT_1BPP: + clut_entries = 2; + break; + case PIXFMT_2BPP: + clut_entries = 4; + break; + case PIXFMT_4BPP: + clut_entries = 16; + break; + default: + break; + } + /* + * The default palette map maps the pixel value to the clut + * index, i.e. pixel value 0 maps to clut entry 0, pixel value + * 1 maps to clut entry 1, etc. + */ + for (clut_index = 0; clut_index < 16; clut_index++) { + osdwin_state->palette_map[clut_index] = clut_index; + if (clut_index < clut_entries) { + _osd_set_palette_map(sd, osdwin, clut_index, + clut_index, + lconfig->pixfmt); + } + } + } + + *cfg = *lconfig; + /* DM6446: configure the RGB888 enable and window selection */ + if (osd->win[WIN_VID0].lconfig.pixfmt == PIXFMT_RGB888) + _osd_enable_vid_rgb888(sd, WIN_VID0); + else if (osd->win[WIN_VID1].lconfig.pixfmt == PIXFMT_RGB888) + _osd_enable_vid_rgb888(sd, WIN_VID1); + else + _osd_disable_vid_rgb888(sd); + + if (layer == WIN_VID0) { + osd->pingpong = + _osd_dm6446_vid0_pingpong(sd, osd->field_inversion, + win->fb_base_phys, + cfg); + } + + spin_unlock_irqrestore(&osd->lock, flags); + + return 0; +} + +static void osd_init_layer(struct osd_state *sd, enum osd_layer layer) +{ + struct osd_state *osd = sd; + struct osd_window_state *win = &osd->win[layer]; + enum osd_win_layer osdwin; + struct osd_osdwin_state *osdwin_state; + struct osd_layer_config *cfg = &win->lconfig; + unsigned long flags; + + spin_lock_irqsave(&osd->lock, flags); + + win->is_enabled = 0; + _osd_disable_layer(sd, layer); + + win->h_zoom = ZOOM_X1; + win->v_zoom = ZOOM_X1; + _osd_set_zoom(sd, layer, win->h_zoom, win->v_zoom); + + win->fb_base_phys = 0; + _osd_start_layer(sd, layer, win->fb_base_phys, 0); + + cfg->line_length = 0; + cfg->xsize = 0; + cfg->ysize = 0; + cfg->xpos = 0; + cfg->ypos = 0; + cfg->interlaced = 0; + switch (layer) { + case WIN_OSD0: + case WIN_OSD1: + osdwin = (layer == WIN_OSD0) ? OSDWIN_OSD0 : OSDWIN_OSD1; + osdwin_state = &osd->osdwin[osdwin]; + /* + * Other code relies on the fact that OSD windows default to a + * bitmap pixel format when they are deallocated, so don't + * change this default pixel format. + */ + cfg->pixfmt = PIXFMT_8BPP; + _osd_set_layer_config(sd, layer, cfg); + osdwin_state->clut = RAM_CLUT; + _osd_set_osd_clut(sd, osdwin, osdwin_state->clut); + osdwin_state->colorkey_blending = 0; + _osd_disable_color_key(sd, osdwin); + osdwin_state->blend = OSD_8_VID_0; + _osd_set_blending_factor(sd, osdwin, osdwin_state->blend); + osdwin_state->rec601_attenuation = 0; + _osd_set_rec601_attenuation(sd, osdwin, + osdwin_state-> + rec601_attenuation); + if (osdwin == OSDWIN_OSD1) { + osd->is_blinking = 0; + osd->blink = BLINK_X1; + } + break; + case WIN_VID0: + case WIN_VID1: + cfg->pixfmt = osd->yc_pixfmt; + _osd_set_layer_config(sd, layer, cfg); + break; + } + + spin_unlock_irqrestore(&osd->lock, flags); +} + +static void osd_release_layer(struct osd_state *sd, enum osd_layer layer) +{ + struct osd_state *osd = sd; + struct osd_window_state *win = &osd->win[layer]; + unsigned long flags; + + spin_lock_irqsave(&osd->lock, flags); + + if (!win->is_allocated) { + spin_unlock_irqrestore(&osd->lock, flags); + return; + } + + spin_unlock_irqrestore(&osd->lock, flags); + osd_init_layer(sd, layer); + spin_lock_irqsave(&osd->lock, flags); + + win->is_allocated = 0; + + spin_unlock_irqrestore(&osd->lock, flags); +} + +static int osd_request_layer(struct osd_state *sd, enum osd_layer layer) +{ + struct osd_state *osd = sd; + struct osd_window_state *win = &osd->win[layer]; + unsigned long flags; + + spin_lock_irqsave(&osd->lock, flags); + + if (win->is_allocated) { + spin_unlock_irqrestore(&osd->lock, flags); + return -1; + } + win->is_allocated = 1; + + spin_unlock_irqrestore(&osd->lock, flags); + + return 0; +} + +static void _osd_init(struct osd_state *sd) +{ + osd_write(sd, 0, OSD_MODE); + osd_write(sd, 0, OSD_VIDWINMD); + osd_write(sd, 0, OSD_OSDWIN0MD); + osd_write(sd, 0, OSD_OSDWIN1MD); + osd_write(sd, 0, OSD_RECTCUR); + osd_write(sd, 0, OSD_MISCCTL); +} + +static void osd_set_left_margin(struct osd_state *sd, u32 val) +{ + osd_write(sd, val, OSD_BASEPX); +} + +static void osd_set_top_margin(struct osd_state *sd, u32 val) +{ + osd_write(sd, val, OSD_BASEPY); +} + +static int osd_initialize(struct osd_state *osd) +{ + if (osd == NULL) + return -ENODEV; + _osd_init(osd); + + /* set default Cb/Cr order */ + osd->yc_pixfmt = PIXFMT_YCbCrI; + + _osd_set_field_inversion(osd, osd->field_inversion); + _osd_set_rom_clut(osd, osd->rom_clut); + + osd_init_layer(osd, WIN_OSD0); + osd_init_layer(osd, WIN_VID0); + osd_init_layer(osd, WIN_OSD1); + osd_init_layer(osd, WIN_VID1); + + return 0; +} + +static const struct vpbe_osd_ops osd_ops = { + .initialize = osd_initialize, + .request_layer = osd_request_layer, + .release_layer = osd_release_layer, + .enable_layer = osd_enable_layer, + .disable_layer = osd_disable_layer, + .set_layer_config = osd_set_layer_config, + .get_layer_config = osd_get_layer_config, + .start_layer = osd_start_layer, + .set_left_margin = osd_set_left_margin, + .set_top_margin = osd_set_top_margin, +}; + +static int osd_probe(struct platform_device *pdev) +{ + struct osd_platform_data *pdata; + struct osd_state *osd; + struct resource *res; + int ret = 0; + + osd = kzalloc(sizeof(struct osd_state), GFP_KERNEL); + if (osd == NULL) + return -ENOMEM; + + osd->dev = &pdev->dev; + pdata = (struct osd_platform_data *)pdev->dev.platform_data; + osd->vpbe_type = (enum vpbe_version)pdata->vpbe_type; + if (NULL == pdev->dev.platform_data) { + dev_err(osd->dev, "No platform data defined for OSD" + " sub device\n"); + ret = -ENOENT; + goto free_mem; + } + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + dev_err(osd->dev, "Unable to get OSD register address map\n"); + ret = -ENODEV; + goto free_mem; + } + osd->osd_base_phys = res->start; + osd->osd_size = res->end - res->start + 1; + if (!request_mem_region(osd->osd_base_phys, osd->osd_size, + MODULE_NAME)) { + dev_err(osd->dev, "Unable to reserve OSD MMIO region\n"); + ret = -ENODEV; + goto free_mem; + } + osd->osd_base = (unsigned long)ioremap_nocache(res->start, + osd->osd_size); + if (!osd->osd_base) { + dev_err(osd->dev, "Unable to map the OSD region\n"); + ret = -ENODEV; + goto release_mem_region; + } + spin_lock_init(&osd->lock); + osd->ops = osd_ops; + platform_set_drvdata(pdev, osd); + dev_notice(osd->dev, "OSD sub device probe success\n"); + return ret; + +release_mem_region: + release_mem_region(osd->osd_base_phys, osd->osd_size); +free_mem: + kfree(osd); + return ret; +} + +static int osd_remove(struct platform_device *pdev) +{ + struct osd_state *osd = platform_get_drvdata(pdev); + + iounmap((void *)osd->osd_base); + release_mem_region(osd->osd_base_phys, osd->osd_size); + kfree(osd); + return 0; +} + +static struct platform_driver osd_driver = { + .probe = osd_probe, + .remove = osd_remove, + .driver = { + .name = MODULE_NAME, + .owner = THIS_MODULE, + }, +}; + +static int osd_init(void) +{ + if (platform_driver_register(&osd_driver)) { + printk(KERN_ERR "Unable to register davinci osd driver\n"); + return -ENODEV; + } + + return 0; +} + +static void osd_exit(void) +{ + platform_driver_unregister(&osd_driver); +} + +module_init(osd_init); +module_exit(osd_exit); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("DaVinci OSD Manager Driver"); +MODULE_AUTHOR("Texas Instruments"); diff --git a/drivers/media/video/davinci/vpbe_osd_regs.h b/drivers/media/video/davinci/vpbe_osd_regs.h new file mode 100644 index 000000000000..584520f3af60 --- /dev/null +++ b/drivers/media/video/davinci/vpbe_osd_regs.h @@ -0,0 +1,364 @@ +/* + * Copyright (C) 2006-2010 Texas Instruments Inc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * 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 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 _VPBE_OSD_REGS_H +#define _VPBE_OSD_REGS_H + +/* VPBE Global Registers */ +#define VPBE_PID 0x0 +#define VPBE_PCR 0x4 + +/* VPSS CLock Registers */ +#define VPSSCLK_PID 0x00 +#define VPSSCLK_CLKCTRL 0x04 + +/* VPSS Buffer Logic Registers */ +#define VPSSBL_PID 0x00 +#define VPSSBL_PCR 0x04 +#define VPSSBL_BCR 0x08 +#define VPSSBL_INTSTAT 0x0C +#define VPSSBL_INTSEL 0x10 +#define VPSSBL_EVTSEL 0x14 +#define VPSSBL_MEMCTRL 0x18 +#define VPSSBL_CCDCMUX 0x1C + +/* DM365 ISP5 system configuration */ +#define ISP5_PID 0x0 +#define ISP5_PCCR 0x4 +#define ISP5_BCR 0x8 +#define ISP5_INTSTAT 0xC +#define ISP5_INTSEL1 0x10 +#define ISP5_INTSEL2 0x14 +#define ISP5_INTSEL3 0x18 +#define ISP5_EVTSEL 0x1c +#define ISP5_CCDCMUX 0x20 + +/* VPBE On-Screen Display Subsystem Registers (OSD) */ +#define OSD_MODE 0x00 +#define OSD_VIDWINMD 0x04 +#define OSD_OSDWIN0MD 0x08 +#define OSD_OSDWIN1MD 0x0C +#define OSD_OSDATRMD 0x0C +#define OSD_RECTCUR 0x10 +#define OSD_VIDWIN0OFST 0x18 +#define OSD_VIDWIN1OFST 0x1C +#define OSD_OSDWIN0OFST 0x20 +#define OSD_OSDWIN1OFST 0x24 +#define OSD_VIDWINADH 0x28 +#define OSD_VIDWIN0ADL 0x2C +#define OSD_VIDWIN0ADR 0x2C +#define OSD_VIDWIN1ADL 0x30 +#define OSD_VIDWIN1ADR 0x30 +#define OSD_OSDWINADH 0x34 +#define OSD_OSDWIN0ADL 0x38 +#define OSD_OSDWIN0ADR 0x38 +#define OSD_OSDWIN1ADL 0x3C +#define OSD_OSDWIN1ADR 0x3C +#define OSD_BASEPX 0x40 +#define OSD_BASEPY 0x44 +#define OSD_VIDWIN0XP 0x48 +#define OSD_VIDWIN0YP 0x4C +#define OSD_VIDWIN0XL 0x50 +#define OSD_VIDWIN0YL 0x54 +#define OSD_VIDWIN1XP 0x58 +#define OSD_VIDWIN1YP 0x5C +#define OSD_VIDWIN1XL 0x60 +#define OSD_VIDWIN1YL 0x64 +#define OSD_OSDWIN0XP 0x68 +#define OSD_OSDWIN0YP 0x6C +#define OSD_OSDWIN0XL 0x70 +#define OSD_OSDWIN0YL 0x74 +#define OSD_OSDWIN1XP 0x78 +#define OSD_OSDWIN1YP 0x7C +#define OSD_OSDWIN1XL 0x80 +#define OSD_OSDWIN1YL 0x84 +#define OSD_CURXP 0x88 +#define OSD_CURYP 0x8C +#define OSD_CURXL 0x90 +#define OSD_CURYL 0x94 +#define OSD_W0BMP01 0xA0 +#define OSD_W0BMP23 0xA4 +#define OSD_W0BMP45 0xA8 +#define OSD_W0BMP67 0xAC +#define OSD_W0BMP89 0xB0 +#define OSD_W0BMPAB 0xB4 +#define OSD_W0BMPCD 0xB8 +#define OSD_W0BMPEF 0xBC +#define OSD_W1BMP01 0xC0 +#define OSD_W1BMP23 0xC4 +#define OSD_W1BMP45 0xC8 +#define OSD_W1BMP67 0xCC +#define OSD_W1BMP89 0xD0 +#define OSD_W1BMPAB 0xD4 +#define OSD_W1BMPCD 0xD8 +#define OSD_W1BMPEF 0xDC +#define OSD_VBNDRY 0xE0 +#define OSD_EXTMODE 0xE4 +#define OSD_MISCCTL 0xE8 +#define OSD_CLUTRAMYCB 0xEC +#define OSD_CLUTRAMCR 0xF0 +#define OSD_TRANSPVAL 0xF4 +#define OSD_TRANSPVALL 0xF4 +#define OSD_TRANSPVALU 0xF8 +#define OSD_TRANSPBMPIDX 0xFC +#define OSD_PPVWIN0ADR 0xFC + +/* bit definitions */ +#define VPBE_PCR_VENC_DIV (1 << 1) +#define VPBE_PCR_CLK_OFF (1 << 0) + +#define VPSSBL_INTSTAT_HSSIINT (1 << 14) +#define VPSSBL_INTSTAT_CFALDINT (1 << 13) +#define VPSSBL_INTSTAT_IPIPE_INT5 (1 << 12) +#define VPSSBL_INTSTAT_IPIPE_INT4 (1 << 11) +#define VPSSBL_INTSTAT_IPIPE_INT3 (1 << 10) +#define VPSSBL_INTSTAT_IPIPE_INT2 (1 << 9) +#define VPSSBL_INTSTAT_IPIPE_INT1 (1 << 8) +#define VPSSBL_INTSTAT_IPIPE_INT0 (1 << 7) +#define VPSSBL_INTSTAT_IPIPEIFINT (1 << 6) +#define VPSSBL_INTSTAT_OSDINT (1 << 5) +#define VPSSBL_INTSTAT_VENCINT (1 << 4) +#define VPSSBL_INTSTAT_H3AINT (1 << 3) +#define VPSSBL_INTSTAT_CCDC_VDINT2 (1 << 2) +#define VPSSBL_INTSTAT_CCDC_VDINT1 (1 << 1) +#define VPSSBL_INTSTAT_CCDC_VDINT0 (1 << 0) + +/* DM365 ISP5 bit definitions */ +#define ISP5_INTSTAT_VENCINT (1 << 21) +#define ISP5_INTSTAT_OSDINT (1 << 20) + +/* VMOD TVTYP options for HDMD=0 */ +#define SDTV_NTSC 0 +#define SDTV_PAL 1 +/* VMOD TVTYP options for HDMD=1 */ +#define HDTV_525P 0 +#define HDTV_625P 1 +#define HDTV_1080I 2 +#define HDTV_720P 3 + +#define OSD_MODE_CS (1 << 15) +#define OSD_MODE_OVRSZ (1 << 14) +#define OSD_MODE_OHRSZ (1 << 13) +#define OSD_MODE_EF (1 << 12) +#define OSD_MODE_VVRSZ (1 << 11) +#define OSD_MODE_VHRSZ (1 << 10) +#define OSD_MODE_FSINV (1 << 9) +#define OSD_MODE_BCLUT (1 << 8) +#define OSD_MODE_CABG_SHIFT 0 +#define OSD_MODE_CABG (0xff << 0) + +#define OSD_VIDWINMD_VFINV (1 << 15) +#define OSD_VIDWINMD_V1EFC (1 << 14) +#define OSD_VIDWINMD_VHZ1_SHIFT 12 +#define OSD_VIDWINMD_VHZ1 (3 << 12) +#define OSD_VIDWINMD_VVZ1_SHIFT 10 +#define OSD_VIDWINMD_VVZ1 (3 << 10) +#define OSD_VIDWINMD_VFF1 (1 << 9) +#define OSD_VIDWINMD_ACT1 (1 << 8) +#define OSD_VIDWINMD_V0EFC (1 << 6) +#define OSD_VIDWINMD_VHZ0_SHIFT 4 +#define OSD_VIDWINMD_VHZ0 (3 << 4) +#define OSD_VIDWINMD_VVZ0_SHIFT 2 +#define OSD_VIDWINMD_VVZ0 (3 << 2) +#define OSD_VIDWINMD_VFF0 (1 << 1) +#define OSD_VIDWINMD_ACT0 (1 << 0) + +#define OSD_OSDWIN0MD_ATN0E (1 << 14) +#define OSD_OSDWIN0MD_RGB0E (1 << 13) +#define OSD_OSDWIN0MD_BMP0MD_SHIFT 13 +#define OSD_OSDWIN0MD_BMP0MD (3 << 13) +#define OSD_OSDWIN0MD_CLUTS0 (1 << 12) +#define OSD_OSDWIN0MD_OHZ0_SHIFT 10 +#define OSD_OSDWIN0MD_OHZ0 (3 << 10) +#define OSD_OSDWIN0MD_OVZ0_SHIFT 8 +#define OSD_OSDWIN0MD_OVZ0 (3 << 8) +#define OSD_OSDWIN0MD_BMW0_SHIFT 6 +#define OSD_OSDWIN0MD_BMW0 (3 << 6) +#define OSD_OSDWIN0MD_BLND0_SHIFT 3 +#define OSD_OSDWIN0MD_BLND0 (7 << 3) +#define OSD_OSDWIN0MD_TE0 (1 << 2) +#define OSD_OSDWIN0MD_OFF0 (1 << 1) +#define OSD_OSDWIN0MD_OACT0 (1 << 0) + +#define OSD_OSDWIN1MD_OASW (1 << 15) +#define OSD_OSDWIN1MD_ATN1E (1 << 14) +#define OSD_OSDWIN1MD_RGB1E (1 << 13) +#define OSD_OSDWIN1MD_BMP1MD_SHIFT 13 +#define OSD_OSDWIN1MD_BMP1MD (3 << 13) +#define OSD_OSDWIN1MD_CLUTS1 (1 << 12) +#define OSD_OSDWIN1MD_OHZ1_SHIFT 10 +#define OSD_OSDWIN1MD_OHZ1 (3 << 10) +#define OSD_OSDWIN1MD_OVZ1_SHIFT 8 +#define OSD_OSDWIN1MD_OVZ1 (3 << 8) +#define OSD_OSDWIN1MD_BMW1_SHIFT 6 +#define OSD_OSDWIN1MD_BMW1 (3 << 6) +#define OSD_OSDWIN1MD_BLND1_SHIFT 3 +#define OSD_OSDWIN1MD_BLND1 (7 << 3) +#define OSD_OSDWIN1MD_TE1 (1 << 2) +#define OSD_OSDWIN1MD_OFF1 (1 << 1) +#define OSD_OSDWIN1MD_OACT1 (1 << 0) + +#define OSD_OSDATRMD_OASW (1 << 15) +#define OSD_OSDATRMD_OHZA_SHIFT 10 +#define OSD_OSDATRMD_OHZA (3 << 10) +#define OSD_OSDATRMD_OVZA_SHIFT 8 +#define OSD_OSDATRMD_OVZA (3 << 8) +#define OSD_OSDATRMD_BLNKINT_SHIFT 6 +#define OSD_OSDATRMD_BLNKINT (3 << 6) +#define OSD_OSDATRMD_OFFA (1 << 1) +#define OSD_OSDATRMD_BLNK (1 << 0) + +#define OSD_RECTCUR_RCAD_SHIFT 8 +#define OSD_RECTCUR_RCAD (0xff << 8) +#define OSD_RECTCUR_CLUTSR (1 << 7) +#define OSD_RECTCUR_RCHW_SHIFT 4 +#define OSD_RECTCUR_RCHW (7 << 4) +#define OSD_RECTCUR_RCVW_SHIFT 1 +#define OSD_RECTCUR_RCVW (7 << 1) +#define OSD_RECTCUR_RCACT (1 << 0) + +#define OSD_VIDWIN0OFST_V0LO (0x1ff << 0) + +#define OSD_VIDWIN1OFST_V1LO (0x1ff << 0) + +#define OSD_OSDWIN0OFST_O0LO (0x1ff << 0) + +#define OSD_OSDWIN1OFST_O1LO (0x1ff << 0) + +#define OSD_WINOFST_AH_SHIFT 9 + +#define OSD_VIDWIN0OFST_V0AH (0xf << 9) +#define OSD_VIDWIN1OFST_V1AH (0xf << 9) +#define OSD_OSDWIN0OFST_O0AH (0xf << 9) +#define OSD_OSDWIN1OFST_O1AH (0xf << 9) + +#define OSD_VIDWINADH_V1AH_SHIFT 8 +#define OSD_VIDWINADH_V1AH (0x7f << 8) +#define OSD_VIDWINADH_V0AH_SHIFT 0 +#define OSD_VIDWINADH_V0AH (0x7f << 0) + +#define OSD_VIDWIN0ADL_V0AL (0xffff << 0) + +#define OSD_VIDWIN1ADL_V1AL (0xffff << 0) + +#define OSD_OSDWINADH_O1AH_SHIFT 8 +#define OSD_OSDWINADH_O1AH (0x7f << 8) +#define OSD_OSDWINADH_O0AH_SHIFT 0 +#define OSD_OSDWINADH_O0AH (0x7f << 0) + +#define OSD_OSDWIN0ADL_O0AL (0xffff << 0) + +#define OSD_OSDWIN1ADL_O1AL (0xffff << 0) + +#define OSD_BASEPX_BPX (0x3ff << 0) + +#define OSD_BASEPY_BPY (0x1ff << 0) + +#define OSD_VIDWIN0XP_V0X (0x7ff << 0) + +#define OSD_VIDWIN0YP_V0Y (0x7ff << 0) + +#define OSD_VIDWIN0XL_V0W (0x7ff << 0) + +#define OSD_VIDWIN0YL_V0H (0x7ff << 0) + +#define OSD_VIDWIN1XP_V1X (0x7ff << 0) + +#define OSD_VIDWIN1YP_V1Y (0x7ff << 0) + +#define OSD_VIDWIN1XL_V1W (0x7ff << 0) + +#define OSD_VIDWIN1YL_V1H (0x7ff << 0) + +#define OSD_OSDWIN0XP_W0X (0x7ff << 0) + +#define OSD_OSDWIN0YP_W0Y (0x7ff << 0) + +#define OSD_OSDWIN0XL_W0W (0x7ff << 0) + +#define OSD_OSDWIN0YL_W0H (0x7ff << 0) + +#define OSD_OSDWIN1XP_W1X (0x7ff << 0) + +#define OSD_OSDWIN1YP_W1Y (0x7ff << 0) + +#define OSD_OSDWIN1XL_W1W (0x7ff << 0) + +#define OSD_OSDWIN1YL_W1H (0x7ff << 0) + +#define OSD_CURXP_RCSX (0x7ff << 0) + +#define OSD_CURYP_RCSY (0x7ff << 0) + +#define OSD_CURXL_RCSW (0x7ff << 0) + +#define OSD_CURYL_RCSH (0x7ff << 0) + +#define OSD_EXTMODE_EXPMDSEL (1 << 15) +#define OSD_EXTMODE_SCRNHEXP_SHIFT 13 +#define OSD_EXTMODE_SCRNHEXP (3 << 13) +#define OSD_EXTMODE_SCRNVEXP (1 << 12) +#define OSD_EXTMODE_OSD1BLDCHR (1 << 11) +#define OSD_EXTMODE_OSD0BLDCHR (1 << 10) +#define OSD_EXTMODE_ATNOSD1EN (1 << 9) +#define OSD_EXTMODE_ATNOSD0EN (1 << 8) +#define OSD_EXTMODE_OSDHRSZ15 (1 << 7) +#define OSD_EXTMODE_VIDHRSZ15 (1 << 6) +#define OSD_EXTMODE_ZMFILV1HEN (1 << 5) +#define OSD_EXTMODE_ZMFILV1VEN (1 << 4) +#define OSD_EXTMODE_ZMFILV0HEN (1 << 3) +#define OSD_EXTMODE_ZMFILV0VEN (1 << 2) +#define OSD_EXTMODE_EXPFILHEN (1 << 1) +#define OSD_EXTMODE_EXPFILVEN (1 << 0) + +#define OSD_MISCCTL_BLDSEL (1 << 15) +#define OSD_MISCCTL_S420D (1 << 14) +#define OSD_MISCCTL_BMAPT (1 << 13) +#define OSD_MISCCTL_DM365M (1 << 12) +#define OSD_MISCCTL_RGBEN (1 << 7) +#define OSD_MISCCTL_RGBWIN (1 << 6) +#define OSD_MISCCTL_DMANG (1 << 6) +#define OSD_MISCCTL_TMON (1 << 5) +#define OSD_MISCCTL_RSEL (1 << 4) +#define OSD_MISCCTL_CPBSY (1 << 3) +#define OSD_MISCCTL_PPSW (1 << 2) +#define OSD_MISCCTL_PPRV (1 << 1) + +#define OSD_CLUTRAMYCB_Y_SHIFT 8 +#define OSD_CLUTRAMYCB_Y (0xff << 8) +#define OSD_CLUTRAMYCB_CB_SHIFT 0 +#define OSD_CLUTRAMYCB_CB (0xff << 0) + +#define OSD_CLUTRAMCR_CR_SHIFT 8 +#define OSD_CLUTRAMCR_CR (0xff << 8) +#define OSD_CLUTRAMCR_CADDR_SHIFT 0 +#define OSD_CLUTRAMCR_CADDR (0xff << 0) + +#define OSD_TRANSPVAL_RGBTRANS (0xffff << 0) + +#define OSD_TRANSPVALL_RGBL (0xffff << 0) + +#define OSD_TRANSPVALU_Y_SHIFT 8 +#define OSD_TRANSPVALU_Y (0xff << 8) +#define OSD_TRANSPVALU_RGBU_SHIFT 0 +#define OSD_TRANSPVALU_RGBU (0xff << 0) + +#define OSD_TRANSPBMPIDX_BMP1_SHIFT 8 +#define OSD_TRANSPBMPIDX_BMP1 (0xff << 8) +#define OSD_TRANSPBMPIDX_BMP0_SHIFT 0 +#define OSD_TRANSPBMPIDX_BMP0 0xff + +#endif /* _DAVINCI_VPBE_H_ */ diff --git a/include/media/davinci/vpbe_osd.h b/include/media/davinci/vpbe_osd.h new file mode 100644 index 000000000000..d7e397a444e6 --- /dev/null +++ b/include/media/davinci/vpbe_osd.h @@ -0,0 +1,394 @@ +/* + * Copyright (C) 2007-2009 Texas Instruments Inc + * Copyright (C) 2007 MontaVista Software, Inc. + * + * Andy Lowe (alowe@mvista.com), MontaVista Software + * - Initial version + * Murali Karicheri (mkaricheri@gmail.com), Texas Instruments Ltd. + * - ported to sub device interface + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2.. + * + * This program is distributed in the hope that it will be useful, + * 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 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 _OSD_H +#define _OSD_H + +#include + +#define VPBE_OSD_SUBDEV_NAME "vpbe-osd" + +/** + * enum osd_layer + * @WIN_OSD0: On-Screen Display Window 0 + * @WIN_VID0: Video Window 0 + * @WIN_OSD1: On-Screen Display Window 1 + * @WIN_VID1: Video Window 1 + * + * Description: + * An enumeration of the osd display layers. + */ +enum osd_layer { + WIN_OSD0, + WIN_VID0, + WIN_OSD1, + WIN_VID1, +}; + +/** + * enum osd_win_layer + * @OSDWIN_OSD0: On-Screen Display Window 0 + * @OSDWIN_OSD1: On-Screen Display Window 1 + * + * Description: + * An enumeration of the OSD Window layers. + */ +enum osd_win_layer { + OSDWIN_OSD0, + OSDWIN_OSD1, +}; + +/** + * enum osd_pix_format + * @PIXFMT_1BPP: 1-bit-per-pixel bitmap + * @PIXFMT_2BPP: 2-bits-per-pixel bitmap + * @PIXFMT_4BPP: 4-bits-per-pixel bitmap + * @PIXFMT_8BPP: 8-bits-per-pixel bitmap + * @PIXFMT_RGB565: 16-bits-per-pixel RGB565 + * @PIXFMT_YCbCrI: YUV 4:2:2 + * @PIXFMT_RGB888: 24-bits-per-pixel RGB888 + * @PIXFMT_YCrCbI: YUV 4:2:2 with chroma swap + * @PIXFMT_NV12: YUV 4:2:0 planar + * @PIXFMT_OSD_ATTR: OSD Attribute Window pixel format (4bpp) + * + * Description: + * An enumeration of the DaVinci pixel formats. + */ +enum osd_pix_format { + PIXFMT_1BPP = 0, + PIXFMT_2BPP, + PIXFMT_4BPP, + PIXFMT_8BPP, + PIXFMT_RGB565, + PIXFMT_YCbCrI, + PIXFMT_RGB888, + PIXFMT_YCrCbI, + PIXFMT_NV12, + PIXFMT_OSD_ATTR, +}; + +/** + * enum osd_h_exp_ratio + * @H_EXP_OFF: no expansion (1/1) + * @H_EXP_9_OVER_8: 9/8 expansion ratio + * @H_EXP_3_OVER_2: 3/2 expansion ratio + * + * Description: + * An enumeration of the available horizontal expansion ratios. + */ +enum osd_h_exp_ratio { + H_EXP_OFF, + H_EXP_9_OVER_8, + H_EXP_3_OVER_2, +}; + +/** + * enum osd_v_exp_ratio + * @V_EXP_OFF: no expansion (1/1) + * @V_EXP_6_OVER_5: 6/5 expansion ratio + * + * Description: + * An enumeration of the available vertical expansion ratios. + */ +enum osd_v_exp_ratio { + V_EXP_OFF, + V_EXP_6_OVER_5, +}; + +/** + * enum osd_zoom_factor + * @ZOOM_X1: no zoom (x1) + * @ZOOM_X2: x2 zoom + * @ZOOM_X4: x4 zoom + * + * Description: + * An enumeration of the available zoom factors. + */ +enum osd_zoom_factor { + ZOOM_X1, + ZOOM_X2, + ZOOM_X4, +}; + +/** + * enum osd_clut + * @ROM_CLUT: ROM CLUT + * @RAM_CLUT: RAM CLUT + * + * Description: + * An enumeration of the available Color Lookup Tables (CLUTs). + */ +enum osd_clut { + ROM_CLUT, + RAM_CLUT, +}; + +/** + * enum osd_rom_clut + * @ROM_CLUT0: Macintosh CLUT + * @ROM_CLUT1: CLUT from DM270 and prior devices + * + * Description: + * An enumeration of the ROM Color Lookup Table (CLUT) options. + */ +enum osd_rom_clut { + ROM_CLUT0, + ROM_CLUT1, +}; + +/** + * enum osd_blending_factor + * @OSD_0_VID_8: OSD pixels are fully transparent + * @OSD_1_VID_7: OSD pixels contribute 1/8, video pixels contribute 7/8 + * @OSD_2_VID_6: OSD pixels contribute 2/8, video pixels contribute 6/8 + * @OSD_3_VID_5: OSD pixels contribute 3/8, video pixels contribute 5/8 + * @OSD_4_VID_4: OSD pixels contribute 4/8, video pixels contribute 4/8 + * @OSD_5_VID_3: OSD pixels contribute 5/8, video pixels contribute 3/8 + * @OSD_6_VID_2: OSD pixels contribute 6/8, video pixels contribute 2/8 + * @OSD_8_VID_0: OSD pixels are fully opaque + * + * Description: + * An enumeration of the DaVinci pixel blending factor options. + */ +enum osd_blending_factor { + OSD_0_VID_8, + OSD_1_VID_7, + OSD_2_VID_6, + OSD_3_VID_5, + OSD_4_VID_4, + OSD_5_VID_3, + OSD_6_VID_2, + OSD_8_VID_0, +}; + +/** + * enum osd_blink_interval + * @BLINK_X1: blink interval is 1 vertical refresh cycle + * @BLINK_X2: blink interval is 2 vertical refresh cycles + * @BLINK_X3: blink interval is 3 vertical refresh cycles + * @BLINK_X4: blink interval is 4 vertical refresh cycles + * + * Description: + * An enumeration of the DaVinci pixel blinking interval options. + */ +enum osd_blink_interval { + BLINK_X1, + BLINK_X2, + BLINK_X3, + BLINK_X4, +}; + +/** + * enum osd_cursor_h_width + * @H_WIDTH_1: horizontal line width is 1 pixel + * @H_WIDTH_4: horizontal line width is 4 pixels + * @H_WIDTH_8: horizontal line width is 8 pixels + * @H_WIDTH_12: horizontal line width is 12 pixels + * @H_WIDTH_16: horizontal line width is 16 pixels + * @H_WIDTH_20: horizontal line width is 20 pixels + * @H_WIDTH_24: horizontal line width is 24 pixels + * @H_WIDTH_28: horizontal line width is 28 pixels + */ +enum osd_cursor_h_width { + H_WIDTH_1, + H_WIDTH_4, + H_WIDTH_8, + H_WIDTH_12, + H_WIDTH_16, + H_WIDTH_20, + H_WIDTH_24, + H_WIDTH_28, +}; + +/** + * enum davinci_cursor_v_width + * @V_WIDTH_1: vertical line width is 1 line + * @V_WIDTH_2: vertical line width is 2 lines + * @V_WIDTH_4: vertical line width is 4 lines + * @V_WIDTH_6: vertical line width is 6 lines + * @V_WIDTH_8: vertical line width is 8 lines + * @V_WIDTH_10: vertical line width is 10 lines + * @V_WIDTH_12: vertical line width is 12 lines + * @V_WIDTH_14: vertical line width is 14 lines + */ +enum osd_cursor_v_width { + V_WIDTH_1, + V_WIDTH_2, + V_WIDTH_4, + V_WIDTH_6, + V_WIDTH_8, + V_WIDTH_10, + V_WIDTH_12, + V_WIDTH_14, +}; + +/** + * struct osd_cursor_config + * @xsize: horizontal size in pixels + * @ysize: vertical size in lines + * @xpos: horizontal offset in pixels from the left edge of the display + * @ypos: vertical offset in lines from the top of the display + * @interlaced: Non-zero if the display is interlaced, or zero otherwise + * @h_width: horizontal line width + * @v_width: vertical line width + * @clut: the CLUT selector (ROM or RAM) for the cursor color + * @clut_index: an index into the CLUT for the cursor color + * + * Description: + * A structure describing the configuration parameters of the hardware + * rectangular cursor. + */ +struct osd_cursor_config { + unsigned xsize; + unsigned ysize; + unsigned xpos; + unsigned ypos; + int interlaced; + enum osd_cursor_h_width h_width; + enum osd_cursor_v_width v_width; + enum osd_clut clut; + unsigned char clut_index; +}; + +/** + * struct osd_layer_config + * @pixfmt: pixel format + * @line_length: offset in bytes between start of each line in memory + * @xsize: number of horizontal pixels displayed per line + * @ysize: number of lines displayed + * @xpos: horizontal offset in pixels from the left edge of the display + * @ypos: vertical offset in lines from the top of the display + * @interlaced: Non-zero if the display is interlaced, or zero otherwise + * + * Description: + * A structure describing the configuration parameters of an On-Screen Display + * (OSD) or video layer related to how the image is stored in memory. + * @line_length must be a multiple of the cache line size (32 bytes). + */ +struct osd_layer_config { + enum osd_pix_format pixfmt; + unsigned line_length; + unsigned xsize; + unsigned ysize; + unsigned xpos; + unsigned ypos; + int interlaced; +}; + +/* parameters that apply on a per-window (OSD or video) basis */ +struct osd_window_state { + int is_allocated; + int is_enabled; + unsigned long fb_base_phys; + enum osd_zoom_factor h_zoom; + enum osd_zoom_factor v_zoom; + struct osd_layer_config lconfig; +}; + +/* parameters that apply on a per-OSD-window basis */ +struct osd_osdwin_state { + enum osd_clut clut; + enum osd_blending_factor blend; + int colorkey_blending; + unsigned colorkey; + int rec601_attenuation; + /* index is pixel value */ + unsigned char palette_map[16]; +}; + +/* hardware rectangular cursor parameters */ +struct osd_cursor_state { + int is_enabled; + struct osd_cursor_config config; +}; + +struct osd_state; + +struct vpbe_osd_ops { + int (*initialize)(struct osd_state *sd); + int (*request_layer)(struct osd_state *sd, enum osd_layer layer); + void (*release_layer)(struct osd_state *sd, enum osd_layer layer); + int (*enable_layer)(struct osd_state *sd, enum osd_layer layer, + int otherwin); + void (*disable_layer)(struct osd_state *sd, enum osd_layer layer); + int (*set_layer_config)(struct osd_state *sd, enum osd_layer layer, + struct osd_layer_config *lconfig); + void (*get_layer_config)(struct osd_state *sd, enum osd_layer layer, + struct osd_layer_config *lconfig); + void (*start_layer)(struct osd_state *sd, enum osd_layer layer, + unsigned long fb_base_phys, + unsigned long cbcr_ofst); + void (*set_left_margin)(struct osd_state *sd, u32 val); + void (*set_top_margin)(struct osd_state *sd, u32 val); + void (*set_interpolation_filter)(struct osd_state *sd, int filter); + int (*set_vid_expansion)(struct osd_state *sd, + enum osd_h_exp_ratio h_exp, + enum osd_v_exp_ratio v_exp); + void (*get_vid_expansion)(struct osd_state *sd, + enum osd_h_exp_ratio *h_exp, + enum osd_v_exp_ratio *v_exp); + void (*set_zoom)(struct osd_state *sd, enum osd_layer layer, + enum osd_zoom_factor h_zoom, + enum osd_zoom_factor v_zoom); +}; + +struct osd_state { + enum vpbe_version vpbe_type; + spinlock_t lock; + struct device *dev; + dma_addr_t osd_base_phys; + unsigned long osd_base; + unsigned long osd_size; + /* 1-->the isr will toggle the VID0 ping-pong buffer */ + int pingpong; + int interpolation_filter; + int field_inversion; + enum osd_h_exp_ratio osd_h_exp; + enum osd_v_exp_ratio osd_v_exp; + enum osd_h_exp_ratio vid_h_exp; + enum osd_v_exp_ratio vid_v_exp; + enum osd_clut backg_clut; + unsigned backg_clut_index; + enum osd_rom_clut rom_clut; + int is_blinking; + /* attribute window blinking enabled */ + enum osd_blink_interval blink; + /* YCbCrI or YCrCbI */ + enum osd_pix_format yc_pixfmt; + /* columns are Y, Cb, Cr */ + unsigned char clut_ram[256][3]; + struct osd_cursor_state cursor; + /* OSD0, VID0, OSD1, VID1 */ + struct osd_window_state win[4]; + /* OSD0, OSD1 */ + struct osd_osdwin_state osdwin[2]; + /* OSD device Operations */ + struct vpbe_osd_ops ops; +}; + +struct osd_platform_data { + enum vpbe_version vpbe_type; + int field_inv_wa_enable; +}; + +#endif -- cgit v1.2.3 From 606b69e9b9442dc283cc2ed1ed73c39f3c5d0ca5 Mon Sep 17 00:00:00 2001 From: Manjunath Hadli Date: Fri, 17 Jun 2011 04:01:34 -0300 Subject: [media] davinci vpbe: VENC( Video Encoder) implementation This patch adds the VENC or the Video encoder, which is responsible for the blending of all source planes and timing generation for Video modes like NTSC, PAL and other digital outputs. the VENC implementation currently supports COMPOSITE and COMPONENT outputs and NTSC and PAL resolutions through the analog DACs. The venc block is implemented as a subdevice, allowing for additional external and internal encoders of other kind to plug-in. Signed-off-by: Manjunath Hadli Acked-by: Muralidharan Karicheri Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/davinci/vpbe_venc.c | 566 +++++++++++++++++++++++++++ drivers/media/video/davinci/vpbe_venc_regs.h | 177 +++++++++ include/media/davinci/vpbe_venc.h | 45 +++ 3 files changed, 788 insertions(+) create mode 100644 drivers/media/video/davinci/vpbe_venc.c create mode 100644 drivers/media/video/davinci/vpbe_venc_regs.h create mode 100644 include/media/davinci/vpbe_venc.h diff --git a/drivers/media/video/davinci/vpbe_venc.c b/drivers/media/video/davinci/vpbe_venc.c new file mode 100644 index 000000000000..03a3e5c65ee7 --- /dev/null +++ b/drivers/media/video/davinci/vpbe_venc.c @@ -0,0 +1,566 @@ +/* + * Copyright (C) 2010 Texas Instruments Inc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * 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 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 + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include "vpbe_venc_regs.h" + +#define MODULE_NAME VPBE_VENC_SUBDEV_NAME + +static int debug = 2; +module_param(debug, int, 0644); +MODULE_PARM_DESC(debug, "Debug level 0-2"); + +struct venc_state { + struct v4l2_subdev sd; + struct venc_callback *callback; + struct venc_platform_data *pdata; + struct device *pdev; + u32 output; + v4l2_std_id std; + spinlock_t lock; + void __iomem *venc_base; + void __iomem *vdaccfg_reg; +}; + +static inline struct venc_state *to_state(struct v4l2_subdev *sd) +{ + return container_of(sd, struct venc_state, sd); +} + +static inline u32 venc_read(struct v4l2_subdev *sd, u32 offset) +{ + struct venc_state *venc = to_state(sd); + + return readl(venc->venc_base + offset); +} + +static inline u32 venc_write(struct v4l2_subdev *sd, u32 offset, u32 val) +{ + struct venc_state *venc = to_state(sd); + + writel(val, (venc->venc_base + offset)); + + return val; +} + +static inline u32 venc_modify(struct v4l2_subdev *sd, u32 offset, + u32 val, u32 mask) +{ + u32 new_val = (venc_read(sd, offset) & ~mask) | (val & mask); + + venc_write(sd, offset, new_val); + + return new_val; +} + +static inline u32 vdaccfg_write(struct v4l2_subdev *sd, u32 val) +{ + struct venc_state *venc = to_state(sd); + + writel(val, venc->vdaccfg_reg); + + val = readl(venc->vdaccfg_reg); + + return val; +} + +/* This function sets the dac of the VPBE for various outputs + */ +static int venc_set_dac(struct v4l2_subdev *sd, u32 out_index) +{ + switch (out_index) { + case 0: + v4l2_dbg(debug, 1, sd, "Setting output to Composite\n"); + venc_write(sd, VENC_DACSEL, 0); + break; + case 1: + v4l2_dbg(debug, 1, sd, "Setting output to S-Video\n"); + venc_write(sd, VENC_DACSEL, 0x210); + break; + case 2: + venc_write(sd, VENC_DACSEL, 0x543); + break; + default: + return -EINVAL; + } + + return 0; +} + +static void venc_enabledigitaloutput(struct v4l2_subdev *sd, int benable) +{ + v4l2_dbg(debug, 2, sd, "venc_enabledigitaloutput\n"); + + if (benable) { + venc_write(sd, VENC_VMOD, 0); + venc_write(sd, VENC_CVBS, 0); + venc_write(sd, VENC_LCDOUT, 0); + venc_write(sd, VENC_HSPLS, 0); + venc_write(sd, VENC_HSTART, 0); + venc_write(sd, VENC_HVALID, 0); + venc_write(sd, VENC_HINT, 0); + venc_write(sd, VENC_VSPLS, 0); + venc_write(sd, VENC_VSTART, 0); + venc_write(sd, VENC_VVALID, 0); + venc_write(sd, VENC_VINT, 0); + venc_write(sd, VENC_YCCCTL, 0); + venc_write(sd, VENC_DACSEL, 0); + + } else { + venc_write(sd, VENC_VMOD, 0); + /* disable VCLK output pin enable */ + venc_write(sd, VENC_VIDCTL, 0x141); + + /* Disable output sync pins */ + venc_write(sd, VENC_SYNCCTL, 0); + + /* Disable DCLOCK */ + venc_write(sd, VENC_DCLKCTL, 0); + venc_write(sd, VENC_DRGBX1, 0x0000057C); + + /* Disable LCD output control (accepting default polarity) */ + venc_write(sd, VENC_LCDOUT, 0); + venc_write(sd, VENC_CMPNT, 0x100); + venc_write(sd, VENC_HSPLS, 0); + venc_write(sd, VENC_HINT, 0); + venc_write(sd, VENC_HSTART, 0); + venc_write(sd, VENC_HVALID, 0); + + venc_write(sd, VENC_VSPLS, 0); + venc_write(sd, VENC_VINT, 0); + venc_write(sd, VENC_VSTART, 0); + venc_write(sd, VENC_VVALID, 0); + + venc_write(sd, VENC_HSDLY, 0); + venc_write(sd, VENC_VSDLY, 0); + + venc_write(sd, VENC_YCCCTL, 0); + venc_write(sd, VENC_VSTARTA, 0); + + /* Set OSD clock and OSD Sync Adavance registers */ + venc_write(sd, VENC_OSDCLK0, 1); + venc_write(sd, VENC_OSDCLK1, 2); + } +} + +/* + * setting NTSC mode + */ +static int venc_set_ntsc(struct v4l2_subdev *sd) +{ + struct venc_state *venc = to_state(sd); + struct venc_platform_data *pdata = venc->pdata; + + v4l2_dbg(debug, 2, sd, "venc_set_ntsc\n"); + + /* Setup clock at VPSS & VENC for SD */ + vpss_enable_clock(VPSS_VENC_CLOCK_SEL, 1); + if (pdata->setup_clock(VPBE_ENC_STD, V4L2_STD_525_60) < 0) + return -EINVAL; + + venc_enabledigitaloutput(sd, 0); + + /* to set VENC CLK DIV to 1 - final clock is 54 MHz */ + venc_modify(sd, VENC_VIDCTL, 0, 1 << 1); + /* Set REC656 Mode */ + venc_write(sd, VENC_YCCCTL, 0x1); + venc_modify(sd, VENC_VDPRO, 0, VENC_VDPRO_DAFRQ); + venc_modify(sd, VENC_VDPRO, 0, VENC_VDPRO_DAUPS); + + venc_write(sd, VENC_VMOD, 0); + venc_modify(sd, VENC_VMOD, (1 << VENC_VMOD_VIE_SHIFT), + VENC_VMOD_VIE); + venc_modify(sd, VENC_VMOD, (0 << VENC_VMOD_VMD), VENC_VMOD_VMD); + venc_modify(sd, VENC_VMOD, (0 << VENC_VMOD_TVTYP_SHIFT), + VENC_VMOD_TVTYP); + venc_write(sd, VENC_DACTST, 0x0); + venc_modify(sd, VENC_VMOD, VENC_VMOD_VENC, VENC_VMOD_VENC); + + return 0; +} + +/* + * setting PAL mode + */ +static int venc_set_pal(struct v4l2_subdev *sd) +{ + struct venc_state *venc = to_state(sd); + + v4l2_dbg(debug, 2, sd, "venc_set_pal\n"); + + /* Setup clock at VPSS & VENC for SD */ + vpss_enable_clock(VPSS_VENC_CLOCK_SEL, 1); + if (venc->pdata->setup_clock(VPBE_ENC_STD, V4L2_STD_625_50) < 0) + return -EINVAL; + + venc_enabledigitaloutput(sd, 0); + + /* to set VENC CLK DIV to 1 - final clock is 54 MHz */ + venc_modify(sd, VENC_VIDCTL, 0, 1 << 1); + /* Set REC656 Mode */ + venc_write(sd, VENC_YCCCTL, 0x1); + + venc_modify(sd, VENC_SYNCCTL, 1 << VENC_SYNCCTL_OVD_SHIFT, + VENC_SYNCCTL_OVD); + venc_write(sd, VENC_VMOD, 0); + venc_modify(sd, VENC_VMOD, + (1 << VENC_VMOD_VIE_SHIFT), + VENC_VMOD_VIE); + venc_modify(sd, VENC_VMOD, + (0 << VENC_VMOD_VMD), VENC_VMOD_VMD); + venc_modify(sd, VENC_VMOD, + (1 << VENC_VMOD_TVTYP_SHIFT), + VENC_VMOD_TVTYP); + venc_write(sd, VENC_DACTST, 0x0); + venc_modify(sd, VENC_VMOD, VENC_VMOD_VENC, VENC_VMOD_VENC); + + return 0; +} + +/* + * venc_set_480p59_94 + * + * This function configures the video encoder to EDTV(525p) component setting. + */ +static int venc_set_480p59_94(struct v4l2_subdev *sd) +{ + struct venc_state *venc = to_state(sd); + struct venc_platform_data *pdata = venc->pdata; + + v4l2_dbg(debug, 2, sd, "venc_set_480p59_94\n"); + + /* Setup clock at VPSS & VENC for SD */ + if (pdata->setup_clock(VPBE_ENC_DV_PRESET, V4L2_DV_480P59_94) < 0) + return -EINVAL; + + venc_enabledigitaloutput(sd, 0); + + venc_write(sd, VENC_OSDCLK0, 0); + venc_write(sd, VENC_OSDCLK1, 1); + venc_modify(sd, VENC_VDPRO, VENC_VDPRO_DAFRQ, + VENC_VDPRO_DAFRQ); + venc_modify(sd, VENC_VDPRO, VENC_VDPRO_DAUPS, + VENC_VDPRO_DAUPS); + venc_write(sd, VENC_VMOD, 0); + venc_modify(sd, VENC_VMOD, (1 << VENC_VMOD_VIE_SHIFT), + VENC_VMOD_VIE); + venc_modify(sd, VENC_VMOD, VENC_VMOD_HDMD, VENC_VMOD_HDMD); + venc_modify(sd, VENC_VMOD, (HDTV_525P << VENC_VMOD_TVTYP_SHIFT), + VENC_VMOD_TVTYP); + venc_modify(sd, VENC_VMOD, VENC_VMOD_VDMD_YCBCR8 << + VENC_VMOD_VDMD_SHIFT, VENC_VMOD_VDMD); + + venc_modify(sd, VENC_VMOD, VENC_VMOD_VENC, VENC_VMOD_VENC); + + return 0; +} + +/* + * venc_set_625p + * + * This function configures the video encoder to HDTV(625p) component setting + */ +static int venc_set_576p50(struct v4l2_subdev *sd) +{ + struct venc_state *venc = to_state(sd); + struct venc_platform_data *pdata = venc->pdata; + + v4l2_dbg(debug, 2, sd, "venc_set_576p50\n"); + + /* Setup clock at VPSS & VENC for SD */ + if (pdata->setup_clock(VPBE_ENC_DV_PRESET, V4L2_DV_576P50) < 0) + return -EINVAL; + + venc_enabledigitaloutput(sd, 0); + + venc_write(sd, VENC_OSDCLK0, 0); + venc_write(sd, VENC_OSDCLK1, 1); + + venc_modify(sd, VENC_VDPRO, VENC_VDPRO_DAFRQ, + VENC_VDPRO_DAFRQ); + venc_modify(sd, VENC_VDPRO, VENC_VDPRO_DAUPS, + VENC_VDPRO_DAUPS); + + venc_write(sd, VENC_VMOD, 0); + venc_modify(sd, VENC_VMOD, (1 << VENC_VMOD_VIE_SHIFT), + VENC_VMOD_VIE); + venc_modify(sd, VENC_VMOD, VENC_VMOD_HDMD, VENC_VMOD_HDMD); + venc_modify(sd, VENC_VMOD, (HDTV_625P << VENC_VMOD_TVTYP_SHIFT), + VENC_VMOD_TVTYP); + + venc_modify(sd, VENC_VMOD, VENC_VMOD_VDMD_YCBCR8 << + VENC_VMOD_VDMD_SHIFT, VENC_VMOD_VDMD); + venc_modify(sd, VENC_VMOD, VENC_VMOD_VENC, VENC_VMOD_VENC); + + return 0; +} + +static int venc_s_std_output(struct v4l2_subdev *sd, v4l2_std_id norm) +{ + v4l2_dbg(debug, 1, sd, "venc_s_std_output\n"); + + if (norm & V4L2_STD_525_60) + return venc_set_ntsc(sd); + else if (norm & V4L2_STD_625_50) + return venc_set_pal(sd); + + return -EINVAL; +} + +static int venc_s_dv_preset(struct v4l2_subdev *sd, + struct v4l2_dv_preset *dv_preset) +{ + v4l2_dbg(debug, 1, sd, "venc_s_dv_preset\n"); + + if (dv_preset->preset == V4L2_DV_576P50) + return venc_set_576p50(sd); + else if (dv_preset->preset == V4L2_DV_480P59_94) + return venc_set_480p59_94(sd); + + return -EINVAL; +} + +static int venc_s_routing(struct v4l2_subdev *sd, u32 input, u32 output, + u32 config) +{ + struct venc_state *venc = to_state(sd); + int ret; + + v4l2_dbg(debug, 1, sd, "venc_s_routing\n"); + + ret = venc_set_dac(sd, output); + if (!ret) + venc->output = output; + + return ret; +} + +static long venc_ioctl(struct v4l2_subdev *sd, + unsigned int cmd, + void *arg) +{ + u32 val; + + switch (cmd) { + case VENC_GET_FLD: + val = venc_read(sd, VENC_VSTAT); + *((int *)arg) = ((val & VENC_VSTAT_FIDST) == + VENC_VSTAT_FIDST); + break; + default: + v4l2_err(sd, "Wrong IOCTL cmd\n"); + break; + } + + return 0; +} + +static const struct v4l2_subdev_core_ops venc_core_ops = { + .ioctl = venc_ioctl, +}; + +static const struct v4l2_subdev_video_ops venc_video_ops = { + .s_routing = venc_s_routing, + .s_std_output = venc_s_std_output, + .s_dv_preset = venc_s_dv_preset, +}; + +static const struct v4l2_subdev_ops venc_ops = { + .core = &venc_core_ops, + .video = &venc_video_ops, +}; + +static int venc_initialize(struct v4l2_subdev *sd) +{ + struct venc_state *venc = to_state(sd); + int ret; + + /* Set default to output to composite and std to NTSC */ + venc->output = 0; + venc->std = V4L2_STD_525_60; + + ret = venc_s_routing(sd, 0, venc->output, 0); + if (ret < 0) { + v4l2_err(sd, "Error setting output during init\n"); + return -EINVAL; + } + + ret = venc_s_std_output(sd, venc->std); + if (ret < 0) { + v4l2_err(sd, "Error setting std during init\n"); + return -EINVAL; + } + + return ret; +} + +static int venc_device_get(struct device *dev, void *data) +{ + struct platform_device *pdev = to_platform_device(dev); + struct venc_state **venc = data; + + if (strcmp(MODULE_NAME, pdev->name) == 0) + *venc = platform_get_drvdata(pdev); + + return 0; +} + +struct v4l2_subdev *venc_sub_dev_init(struct v4l2_device *v4l2_dev, + const char *venc_name) +{ + struct venc_state *venc; + int err; + + err = bus_for_each_dev(&platform_bus_type, NULL, &venc, + venc_device_get); + if (venc == NULL) + return NULL; + + v4l2_subdev_init(&venc->sd, &venc_ops); + + strcpy(venc->sd.name, venc_name); + if (v4l2_device_register_subdev(v4l2_dev, &venc->sd) < 0) { + v4l2_err(v4l2_dev, + "vpbe unable to register venc sub device\n"); + return NULL; + } + if (venc_initialize(&venc->sd)) { + v4l2_err(v4l2_dev, + "vpbe venc initialization failed\n"); + return NULL; + } + + return &venc->sd; +} +EXPORT_SYMBOL(venc_sub_dev_init); + +static int venc_probe(struct platform_device *pdev) +{ + struct venc_state *venc; + struct resource *res; + int ret; + + venc = kzalloc(sizeof(struct venc_state), GFP_KERNEL); + if (venc == NULL) + return -ENOMEM; + + venc->pdev = &pdev->dev; + venc->pdata = pdev->dev.platform_data; + if (NULL == venc->pdata) { + dev_err(venc->pdev, "Unable to get platform data for" + " VENC sub device"); + ret = -ENOENT; + goto free_mem; + } + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + dev_err(venc->pdev, + "Unable to get VENC register address map\n"); + ret = -ENODEV; + goto free_mem; + } + + if (!request_mem_region(res->start, resource_size(res), "venc")) { + dev_err(venc->pdev, "Unable to reserve VENC MMIO region\n"); + ret = -ENODEV; + goto free_mem; + } + + venc->venc_base = ioremap_nocache(res->start, resource_size(res)); + if (!venc->venc_base) { + dev_err(venc->pdev, "Unable to map VENC IO space\n"); + ret = -ENODEV; + goto release_venc_mem_region; + } + + spin_lock_init(&venc->lock); + platform_set_drvdata(pdev, venc); + dev_notice(venc->pdev, "VENC sub device probe success\n"); + return 0; + +release_venc_mem_region: + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + release_mem_region(res->start, resource_size(res)); +free_mem: + kfree(venc); + return ret; +} + +static int venc_remove(struct platform_device *pdev) +{ + struct venc_state *venc = platform_get_drvdata(pdev); + struct resource *res; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + iounmap((void *)venc->venc_base); + release_mem_region(res->start, resource_size(res)); + kfree(venc); + + return 0; +} + +static struct platform_driver venc_driver = { + .probe = venc_probe, + .remove = venc_remove, + .driver = { + .name = MODULE_NAME, + .owner = THIS_MODULE, + }, +}; + +static int venc_init(void) +{ + if (platform_driver_register(&venc_driver)) { + printk(KERN_ERR "Unable to register venc driver\n"); + return -ENODEV; + } + return 0; +} + +static void venc_exit(void) +{ + platform_driver_unregister(&venc_driver); + return; +} + +module_init(venc_init); +module_exit(venc_exit); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("VPBE VENC Driver"); +MODULE_AUTHOR("Texas Instruments"); diff --git a/drivers/media/video/davinci/vpbe_venc_regs.h b/drivers/media/video/davinci/vpbe_venc_regs.h new file mode 100644 index 000000000000..947cb1510776 --- /dev/null +++ b/drivers/media/video/davinci/vpbe_venc_regs.h @@ -0,0 +1,177 @@ +/* + * Copyright (C) 2006-2010 Texas Instruments Inc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2.. + * + * This program is distributed in the hope that it will be useful, + * 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 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 _VPBE_VENC_REGS_H +#define _VPBE_VENC_REGS_H + +/* VPBE Video Encoder / Digital LCD Subsystem Registers (VENC) */ +#define VENC_VMOD 0x00 +#define VENC_VIDCTL 0x04 +#define VENC_VDPRO 0x08 +#define VENC_SYNCCTL 0x0C +#define VENC_HSPLS 0x10 +#define VENC_VSPLS 0x14 +#define VENC_HINT 0x18 +#define VENC_HSTART 0x1C +#define VENC_HVALID 0x20 +#define VENC_VINT 0x24 +#define VENC_VSTART 0x28 +#define VENC_VVALID 0x2C +#define VENC_HSDLY 0x30 +#define VENC_VSDLY 0x34 +#define VENC_YCCCTL 0x38 +#define VENC_RGBCTL 0x3C +#define VENC_RGBCLP 0x40 +#define VENC_LINECTL 0x44 +#define VENC_CULLLINE 0x48 +#define VENC_LCDOUT 0x4C +#define VENC_BRTS 0x50 +#define VENC_BRTW 0x54 +#define VENC_ACCTL 0x58 +#define VENC_PWMP 0x5C +#define VENC_PWMW 0x60 +#define VENC_DCLKCTL 0x64 +#define VENC_DCLKPTN0 0x68 +#define VENC_DCLKPTN1 0x6C +#define VENC_DCLKPTN2 0x70 +#define VENC_DCLKPTN3 0x74 +#define VENC_DCLKPTN0A 0x78 +#define VENC_DCLKPTN1A 0x7C +#define VENC_DCLKPTN2A 0x80 +#define VENC_DCLKPTN3A 0x84 +#define VENC_DCLKHS 0x88 +#define VENC_DCLKHSA 0x8C +#define VENC_DCLKHR 0x90 +#define VENC_DCLKVS 0x94 +#define VENC_DCLKVR 0x98 +#define VENC_CAPCTL 0x9C +#define VENC_CAPDO 0xA0 +#define VENC_CAPDE 0xA4 +#define VENC_ATR0 0xA8 +#define VENC_ATR1 0xAC +#define VENC_ATR2 0xB0 +#define VENC_VSTAT 0xB8 +#define VENC_RAMADR 0xBC +#define VENC_RAMPORT 0xC0 +#define VENC_DACTST 0xC4 +#define VENC_YCOLVL 0xC8 +#define VENC_SCPROG 0xCC +#define VENC_CVBS 0xDC +#define VENC_CMPNT 0xE0 +#define VENC_ETMG0 0xE4 +#define VENC_ETMG1 0xE8 +#define VENC_ETMG2 0xEC +#define VENC_ETMG3 0xF0 +#define VENC_DACSEL 0xF4 +#define VENC_ARGBX0 0x100 +#define VENC_ARGBX1 0x104 +#define VENC_ARGBX2 0x108 +#define VENC_ARGBX3 0x10C +#define VENC_ARGBX4 0x110 +#define VENC_DRGBX0 0x114 +#define VENC_DRGBX1 0x118 +#define VENC_DRGBX2 0x11C +#define VENC_DRGBX3 0x120 +#define VENC_DRGBX4 0x124 +#define VENC_VSTARTA 0x128 +#define VENC_OSDCLK0 0x12C +#define VENC_OSDCLK1 0x130 +#define VENC_HVLDCL0 0x134 +#define VENC_HVLDCL1 0x138 +#define VENC_OSDHADV 0x13C +#define VENC_CLKCTL 0x140 +#define VENC_GAMCTL 0x144 +#define VENC_XHINTVL 0x174 + +/* bit definitions */ +#define VPBE_PCR_VENC_DIV (1 << 1) +#define VPBE_PCR_CLK_OFF (1 << 0) + +#define VENC_VMOD_VDMD_SHIFT 12 +#define VENC_VMOD_VDMD_YCBCR16 0 +#define VENC_VMOD_VDMD_YCBCR8 1 +#define VENC_VMOD_VDMD_RGB666 2 +#define VENC_VMOD_VDMD_RGB8 3 +#define VENC_VMOD_VDMD_EPSON 4 +#define VENC_VMOD_VDMD_CASIO 5 +#define VENC_VMOD_VDMD_UDISPQVGA 6 +#define VENC_VMOD_VDMD_STNLCD 7 +#define VENC_VMOD_VIE_SHIFT 1 +#define VENC_VMOD_VDMD (7 << 12) +#define VENC_VMOD_ITLCL (1 << 11) +#define VENC_VMOD_ITLC (1 << 10) +#define VENC_VMOD_NSIT (1 << 9) +#define VENC_VMOD_HDMD (1 << 8) +#define VENC_VMOD_TVTYP_SHIFT 6 +#define VENC_VMOD_TVTYP (3 << 6) +#define VENC_VMOD_SLAVE (1 << 5) +#define VENC_VMOD_VMD (1 << 4) +#define VENC_VMOD_BLNK (1 << 3) +#define VENC_VMOD_VIE (1 << 1) +#define VENC_VMOD_VENC (1 << 0) + +/* VMOD TVTYP options for HDMD=0 */ +#define SDTV_NTSC 0 +#define SDTV_PAL 1 +/* VMOD TVTYP options for HDMD=1 */ +#define HDTV_525P 0 +#define HDTV_625P 1 +#define HDTV_1080I 2 +#define HDTV_720P 3 + +#define VENC_VIDCTL_VCLKP (1 << 14) +#define VENC_VIDCTL_VCLKE_SHIFT 13 +#define VENC_VIDCTL_VCLKE (1 << 13) +#define VENC_VIDCTL_VCLKZ_SHIFT 12 +#define VENC_VIDCTL_VCLKZ (1 << 12) +#define VENC_VIDCTL_SYDIR_SHIFT 8 +#define VENC_VIDCTL_SYDIR (1 << 8) +#define VENC_VIDCTL_DOMD_SHIFT 4 +#define VENC_VIDCTL_DOMD (3 << 4) +#define VENC_VIDCTL_YCDIR_SHIFT 0 +#define VENC_VIDCTL_YCDIR (1 << 0) + +#define VENC_VDPRO_ATYCC_SHIFT 5 +#define VENC_VDPRO_ATYCC (1 << 5) +#define VENC_VDPRO_ATCOM_SHIFT 4 +#define VENC_VDPRO_ATCOM (1 << 4) +#define VENC_VDPRO_DAFRQ (1 << 3) +#define VENC_VDPRO_DAUPS (1 << 2) +#define VENC_VDPRO_CUPS (1 << 1) +#define VENC_VDPRO_YUPS (1 << 0) + +#define VENC_SYNCCTL_VPL_SHIFT 3 +#define VENC_SYNCCTL_VPL (1 << 3) +#define VENC_SYNCCTL_HPL_SHIFT 2 +#define VENC_SYNCCTL_HPL (1 << 2) +#define VENC_SYNCCTL_SYEV_SHIFT 1 +#define VENC_SYNCCTL_SYEV (1 << 1) +#define VENC_SYNCCTL_SYEH_SHIFT 0 +#define VENC_SYNCCTL_SYEH (1 << 0) +#define VENC_SYNCCTL_OVD_SHIFT 14 +#define VENC_SYNCCTL_OVD (1 << 14) + +#define VENC_DCLKCTL_DCKEC_SHIFT 11 +#define VENC_DCLKCTL_DCKEC (1 << 11) +#define VENC_DCLKCTL_DCKPW_SHIFT 0 +#define VENC_DCLKCTL_DCKPW (0x3f << 0) + +#define VENC_VSTAT_FIDST (1 << 4) + +#define VENC_CMPNT_MRGB_SHIFT 14 +#define VENC_CMPNT_MRGB (1 << 14) + +#endif /* _VPBE_VENC_REGS_H */ diff --git a/include/media/davinci/vpbe_venc.h b/include/media/davinci/vpbe_venc.h new file mode 100644 index 000000000000..426c205831a2 --- /dev/null +++ b/include/media/davinci/vpbe_venc.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2010 Texas Instruments Inc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * 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 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 _VPBE_VENC_H +#define _VPBE_VENC_H + +#include +#include + +#define VPBE_VENC_SUBDEV_NAME "vpbe-venc" + +/* venc events */ +#define VENC_END_OF_FRAME BIT(0) +#define VENC_FIRST_FIELD BIT(1) +#define VENC_SECOND_FIELD BIT(2) + +struct venc_platform_data { + enum vpbe_version venc_type; + int (*setup_clock)(enum vpbe_enc_timings_type type, + unsigned int mode); + /* Number of LCD outputs supported */ + int num_lcd_outputs; +}; + +enum venc_ioctls { + VENC_GET_FLD = 1, +}; + +/* exported functions */ +struct v4l2_subdev *venc_sub_dev_init(struct v4l2_device *v4l2_dev, + const char *venc_name); +#endif -- cgit v1.2.3 From 6783edbc83ddcfff75bc1bcde47dfe95a795f95a Mon Sep 17 00:00:00 2001 From: Manjunath Hadli Date: Fri, 17 Jun 2011 04:01:35 -0300 Subject: [media] davinci vpbe: Build infrastructure for VPBE driver This patch adds the build infra-structure for Davinci VPBE dislay driver. Signed-off-by: Manjunath Hadli Acked-by: Muralidharan Karicheri Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/davinci/Kconfig | 23 +++++++++++++++++++++++ drivers/media/video/davinci/Makefile | 2 ++ 2 files changed, 25 insertions(+) diff --git a/drivers/media/video/davinci/Kconfig b/drivers/media/video/davinci/Kconfig index 6b1954035649..60a456ebdc7c 100644 --- a/drivers/media/video/davinci/Kconfig +++ b/drivers/media/video/davinci/Kconfig @@ -91,3 +91,26 @@ config VIDEO_ISIF To compile this driver as a module, choose M here: the module will be called vpfe. + +config VIDEO_DM644X_VPBE + tristate "DM644X VPBE HW module" + depends on ARCH_DAVINCI_DM644x + select VIDEO_VPSS_SYSTEM + select VIDEOBUF_DMA_CONTIG + help + Enables VPBE modules used for display on a DM644x + SoC. + + To compile this driver as a module, choose M here: the + module will be called vpbe. + + +config VIDEO_VPBE_DISPLAY + tristate "VPBE V4L2 Display driver" + depends on ARCH_DAVINCI_DM644x + select VIDEO_DM644X_VPBE + help + Enables VPBE V4L2 Display driver on a DM644x device + + To compile this driver as a module, choose M here: the + module will be called vpbe_display. diff --git a/drivers/media/video/davinci/Makefile b/drivers/media/video/davinci/Makefile index a37955745aaa..ae7dafb689ab 100644 --- a/drivers/media/video/davinci/Makefile +++ b/drivers/media/video/davinci/Makefile @@ -16,3 +16,5 @@ obj-$(CONFIG_VIDEO_VPFE_CAPTURE) += vpfe_capture.o obj-$(CONFIG_VIDEO_DM6446_CCDC) += dm644x_ccdc.o obj-$(CONFIG_VIDEO_DM355_CCDC) += dm355_ccdc.o obj-$(CONFIG_VIDEO_ISIF) += isif.o +obj-$(CONFIG_VIDEO_DM644X_VPBE) += vpbe.o vpbe_osd.o vpbe_venc.o +obj-$(CONFIG_VIDEO_VPBE_DISPLAY) += vpbe_display.o -- cgit v1.2.3 From af60313d6c686d2729d71bc55c3f60956676c543 Mon Sep 17 00:00:00 2001 From: Manjunath Hadli Date: Fri, 17 Jun 2011 04:01:36 -0300 Subject: [media] davinci vpbe: Readme text for Dm6446 vpbe Please refer to this file for detailed documentation of davinci vpbe v4l2 driver. Signed-off-by: Manjunath Hadli Acked-by: Muralidharan Karicheri Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/README.davinci-vpbe | 93 +++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 Documentation/video4linux/README.davinci-vpbe diff --git a/Documentation/video4linux/README.davinci-vpbe b/Documentation/video4linux/README.davinci-vpbe new file mode 100644 index 000000000000..7a460b0685bb --- /dev/null +++ b/Documentation/video4linux/README.davinci-vpbe @@ -0,0 +1,93 @@ + + VPBE V4L2 driver design + ====================================================================== + + File partitioning + ----------------- + V4L2 display device driver + drivers/media/video/davinci/vpbe_display.c + drivers/media/video/davinci/vpbe_display.h + + VPBE display controller + drivers/media/video/davinci/vpbe.c + drivers/media/video/davinci/vpbe.h + + VPBE venc sub device driver + drivers/media/video/davinci/vpbe_venc.c + drivers/media/video/davinci/vpbe_venc.h + drivers/media/video/davinci/vpbe_venc_regs.h + + VPBE osd driver + drivers/media/video/davinci/vpbe_osd.c + drivers/media/video/davinci/vpbe_osd.h + drivers/media/video/davinci/vpbe_osd_regs.h + + Functional partitioning + ----------------------- + + Consists of the following (in the same order as the list under file + partitioning):- + + 1. V4L2 display driver + Implements creation of video2 and video3 device nodes and + provides v4l2 device interface to manage VID0 and VID1 layers. + + 2. Display controller + Loads up VENC, OSD and external encoders such as ths8200. It provides + a set of API calls to V4L2 drivers to set the output/standards + in the VENC or external sub devices. It also provides + a device object to access the services from OSD subdevice + using sub device ops. The connection of external encoders to VENC LCD + controller port is done at init time based on default output and standard + selection or at run time when application change the output through + V4L2 IOCTLs. + + When connected to an external encoder, vpbe controller is also responsible + for setting up the interface between VENC and external encoders based on + board specific settings (specified in board-xxx-evm.c). This allows + interfacing external encoders such as ths8200. The setup_if_config() + is implemented for this as well as configure_venc() (part of the next patch) + API to set timings in VENC for a specific display resolution. As of this + patch series, the interconnection and enabling and setting of the external + encoders is not present, and would be a part of the next patch series. + + 3. VENC subdevice module + Responsible for setting outputs provided through internal DACs and also + setting timings at LCD controller port when external encoders are connected + at the port or LCD panel timings required. When external encoder/LCD panel + is connected, the timings for a specific standard/preset is retrieved from + the board specific table and the values are used to set the timings in + venc using non-standard timing mode. + + Support LCD Panel displays using the VENC. For example to support a Logic + PD display, it requires setting up the LCD controller port with a set of + timings for the resolution supported and setting the dot clock. So we could + add the available outputs as a board specific entry (i.e add the "LogicPD" + output name to board-xxx-evm.c). A table of timings for various LCDs + supported can be maintained in the board specific setup file to support + various LCD displays.As of this patch a basic driver is present, and this + support for external encoders and displays forms a part of the next + patch series. + + 4. OSD module + OSD module implements all OSD layer management and hardware specific + features. The VPBE module interacts with the OSD for enabling and + disabling appropriate features of the OSD. + + Current status:- + + A fully functional working version of the V4L2 driver is available. This + driver has been tested with NTSC and PAL standards and buffer streaming. + + Following are TBDs. + + vpbe display controller + - Add support for external encoders. + - add support for selecting external encoder as default at probe time. + + vpbe venc sub device + - add timings for supporting ths8200 + - add support for LogicPD LCD. + + FB drivers + - Add support for fbdev drivers.- Ready and part of subsequent patches. -- cgit v1.2.3 From 3751e32961f22e256de85ebd585597ce5875037a Mon Sep 17 00:00:00 2001 From: Sylwester Nawrocki Date: Sat, 18 Jun 2011 05:52:21 -0300 Subject: [media] v4l: Fix minor typos in the documentation Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/v4l/media-ioc-enum-links.xml | 2 +- Documentation/DocBook/media/v4l/subdev-formats.xml | 2 +- Documentation/media-framework.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/DocBook/media/v4l/media-ioc-enum-links.xml b/Documentation/DocBook/media/v4l/media-ioc-enum-links.xml index d2fc73ef8d56..355df43badc5 100644 --- a/Documentation/DocBook/media/v4l/media-ioc-enum-links.xml +++ b/Documentation/DocBook/media/v4l/media-ioc-enum-links.xml @@ -139,7 +139,7 @@
- struct <structname>media_links_desc</structname> + struct <structname>media_link_desc</structname> &cs-str; diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml b/Documentation/DocBook/media/v4l/subdev-formats.xml index bab70711c7c4..49c532ebbbbe 100644 --- a/Documentation/DocBook/media/v4l/subdev-formats.xml +++ b/Documentation/DocBook/media/v4l/subdev-formats.xml @@ -2525,7 +2525,7 @@ Those data formats consist of an ordered sequence of 8-bit bytes obtained from JPEG compression process. Additionally to the - _JPEG prefix the format code is made of + _JPEG postfix the format code is made of the following information. The number of bus samples per entropy encoded byte. diff --git a/Documentation/media-framework.txt b/Documentation/media-framework.txt index 76a2087db205..669b5fb03a86 100644 --- a/Documentation/media-framework.txt +++ b/Documentation/media-framework.txt @@ -310,7 +310,7 @@ is non-immutable. The operation must either configure the hardware or store the configuration information to be applied later. Link configuration must not have any side effect on other links. If an enabled -link at a sink pad prevents another link at the same pad from being disabled, +link at a sink pad prevents another link at the same pad from being enabled, the link_setup operation must return -EBUSY and can't implicitly disable the first enabled link. -- cgit v1.2.3 From b5210fd2c737dd178ff0401a0050dc62148fed60 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Mon, 20 Jun 2011 16:14:36 -0300 Subject: [media] marvell-cam: convert to videobuf2 This is a basic, naive conversion to the videobuf2 infrastructure, removing a lot of code in the process. For now, we're using vmalloc, which is suboptimal, but it does match what the cafe driver did before. In the cafe case, it may have to stay that way just because memory is too tight to do direct streaming; mmp-camera will be able to do better. Signed-off-by: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/marvell-ccic/Kconfig | 2 + drivers/media/video/marvell-ccic/mcam-core.c | 579 +++++++++------------------ drivers/media/video/marvell-ccic/mcam-core.h | 26 +- 3 files changed, 196 insertions(+), 411 deletions(-) diff --git a/drivers/media/video/marvell-ccic/Kconfig b/drivers/media/video/marvell-ccic/Kconfig index b4f72605997c..eb535b10000c 100644 --- a/drivers/media/video/marvell-ccic/Kconfig +++ b/drivers/media/video/marvell-ccic/Kconfig @@ -2,6 +2,7 @@ config VIDEO_CAFE_CCIC tristate "Marvell 88ALP01 (Cafe) CMOS Camera Controller support" depends on PCI && I2C && VIDEO_V4L2 select VIDEO_OV7670 + select VIDEOBUF2_VMALLOC ---help--- This is a video4linux2 driver for the Marvell 88ALP01 integrated CMOS camera controller. This is the controller found on first- @@ -12,6 +13,7 @@ config VIDEO_MMP_CAMERA depends on ARCH_MMP && I2C && VIDEO_V4L2 select VIDEO_OV7670 select I2C_GPIO + select VIDEOBUF2_VMALLOC ---help--- This is a Video4Linux2 driver for the integrated camera controller found on Marvell Armada 610 application diff --git a/drivers/media/video/marvell-ccic/mcam-core.c b/drivers/media/video/marvell-ccic/mcam-core.c index 3e6a5e8b0cd1..055d843f99df 100644 --- a/drivers/media/video/marvell-ccic/mcam-core.c +++ b/drivers/media/video/marvell-ccic/mcam-core.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -149,7 +150,6 @@ static void mcam_reset_buffers(struct mcam_camera *cam) cam->next_buf = -1; for (i = 0; i < cam->nbufs; i++) clear_bit(i, &cam->flags); - cam->specframes = 0; } static inline int mcam_needs_config(struct mcam_camera *cam) @@ -165,6 +165,21 @@ static void mcam_set_config_needed(struct mcam_camera *cam, int needed) clear_bit(CF_CONFIG_NEEDED, &cam->flags); } +/* + * Our buffer type for working with videobuf2. Note that the vb2 + * developers have decreed that struct vb2_buffer must be at the + * beginning of this structure. + */ +struct mcam_vb_buffer { + struct vb2_buffer vb_buf; + struct list_head queue; +}; + +static inline struct mcam_vb_buffer *vb_to_mvb(struct vb2_buffer *vb) +{ + return container_of(vb, struct mcam_vb_buffer, vb_buf); +} + /* * Debugging and related. @@ -339,9 +354,7 @@ static void mcam_ctlr_stop_dma(struct mcam_camera *cam) spin_lock_irqsave(&cam->dev_lock, flags); mcam_ctlr_stop(cam); spin_unlock_irqrestore(&cam->dev_lock, flags); - mdelay(1); - wait_event_timeout(cam->iowait, - !test_bit(CF_DMA_ACTIVE, &cam->flags), HZ); + msleep(10); if (test_bit(CF_DMA_ACTIVE, &cam->flags)) cam_err(cam, "Timeout waiting for DMA to end\n"); /* This would be bad news - what now? */ @@ -524,44 +537,11 @@ static void mcam_free_dma_bufs(struct mcam_camera *cam) - - /* ----------------------------------------------------------------------- */ /* * Here starts the V4L2 interface code. */ -/* - * Read an image from the device. - */ -static ssize_t mcam_deliver_buffer(struct mcam_camera *cam, - char __user *buffer, size_t len, loff_t *pos) -{ - int bufno; - unsigned long flags; - - spin_lock_irqsave(&cam->dev_lock, flags); - if (cam->next_buf < 0) { - cam_err(cam, "deliver_buffer: No next buffer\n"); - spin_unlock_irqrestore(&cam->dev_lock, flags); - return -EIO; - } - bufno = cam->next_buf; - clear_bit(bufno, &cam->flags); - if (++(cam->next_buf) >= cam->nbufs) - cam->next_buf = 0; - if (!test_bit(cam->next_buf, &cam->flags)) - cam->next_buf = -1; - cam->specframes = 0; - spin_unlock_irqrestore(&cam->dev_lock, flags); - - if (len > cam->pix_format.sizeimage) - len = cam->pix_format.sizeimage; - if (copy_to_user(buffer, cam->dma_bufs[bufno], len)) - return -EFAULT; - (*pos) += len; - return len; -} /* * Get everything ready, and start grabbing frames. @@ -598,75 +578,138 @@ static int mcam_read_setup(struct mcam_camera *cam, enum mcam_state state) return 0; } +/* ----------------------------------------------------------------------- */ +/* + * Videobuf2 interface code. + */ -static ssize_t mcam_v4l_read(struct file *filp, - char __user *buffer, size_t len, loff_t *pos) +static int mcam_vb_queue_setup(struct vb2_queue *vq, unsigned int *nbufs, + unsigned int *num_planes, unsigned long sizes[], + void *alloc_ctxs[]) { - struct mcam_camera *cam = filp->private_data; - int ret = 0; + struct mcam_camera *cam = vb2_get_drv_priv(vq); + + sizes[0] = cam->pix_format.sizeimage; + *num_planes = 1; /* Someday we have to support planar formats... */ + if (*nbufs < 2 || *nbufs > 32) + *nbufs = 6; /* semi-arbitrary numbers */ + return 0; +} + +static int mcam_vb_buf_init(struct vb2_buffer *vb) +{ + struct mcam_vb_buffer *mvb = vb_to_mvb(vb); + + INIT_LIST_HEAD(&mvb->queue); + return 0; +} + +static void mcam_vb_buf_queue(struct vb2_buffer *vb) +{ + struct mcam_vb_buffer *mvb = vb_to_mvb(vb); + struct mcam_camera *cam = vb2_get_drv_priv(vb->vb2_queue); + unsigned long flags; + + spin_lock_irqsave(&cam->dev_lock, flags); + list_add(&cam->buffers, &mvb->queue); + spin_unlock_irqrestore(&cam->dev_lock, flags); +} + +/* + * vb2 uses these to release the mutex when waiting in dqbuf. I'm + * not actually sure we need to do this (I'm not sure that vb2_dqbuf() needs + * to be called with the mutex held), but better safe than sorry. + */ +static void mcam_vb_wait_prepare(struct vb2_queue *vq) +{ + struct mcam_camera *cam = vb2_get_drv_priv(vq); + + mutex_unlock(&cam->s_mutex); +} + +static void mcam_vb_wait_finish(struct vb2_queue *vq) +{ + struct mcam_camera *cam = vb2_get_drv_priv(vq); - /* - * Perhaps we're in speculative read mode and already - * have data? - */ mutex_lock(&cam->s_mutex); - if (cam->state == S_SPECREAD) { - if (cam->next_buf >= 0) { - ret = mcam_deliver_buffer(cam, buffer, len, pos); - if (ret != 0) - goto out_unlock; - } - } else if (cam->state == S_FLAKED || cam->state == S_NOTREADY) { - ret = -EIO; - goto out_unlock; - } else if (cam->state != S_IDLE) { - ret = -EBUSY; - goto out_unlock; - } +} - /* - * v4l2: multiple processes can open the device, but only - * one gets to grab data from it. - */ - if (cam->owner && cam->owner != filp) { - ret = -EBUSY; - goto out_unlock; - } - cam->owner = filp; +/* + * These need to be called with the mutex held from vb2 + */ +static int mcam_vb_start_streaming(struct vb2_queue *vq) +{ + struct mcam_camera *cam = vb2_get_drv_priv(vq); + int ret = -EINVAL; - /* - * Do setup if need be. - */ - if (cam->state != S_SPECREAD) { - ret = mcam_read_setup(cam, S_SINGLEREAD); - if (ret) - goto out_unlock; - } - /* - * Wait for something to happen. This should probably - * be interruptible (FIXME). - */ - wait_event_timeout(cam->iowait, cam->next_buf >= 0, HZ); - if (cam->next_buf < 0) { - cam_err(cam, "read() operation timed out\n"); - mcam_ctlr_stop_dma(cam); - ret = -EIO; - goto out_unlock; + if (cam->state == S_IDLE) { + cam->sequence = 0; + ret = mcam_read_setup(cam, S_STREAMING); } + return ret; +} + +static int mcam_vb_stop_streaming(struct vb2_queue *vq) +{ + struct mcam_camera *cam = vb2_get_drv_priv(vq); + unsigned long flags; + + if (cam->state != S_STREAMING) + return -EINVAL; + mcam_ctlr_stop_dma(cam); /* - * Give them their data and we should be done. + * VB2 reclaims the buffers, so we need to forget + * about them. */ - ret = mcam_deliver_buffer(cam, buffer, len, pos); - -out_unlock: - mutex_unlock(&cam->s_mutex); - return ret; + spin_lock_irqsave(&cam->dev_lock, flags); + INIT_LIST_HEAD(&cam->buffers); + spin_unlock_irqrestore(&cam->dev_lock, flags); + return 0; } +static const struct vb2_ops mcam_vb2_ops = { + .queue_setup = mcam_vb_queue_setup, + .buf_init = mcam_vb_buf_init, + .buf_queue = mcam_vb_buf_queue, + .start_streaming = mcam_vb_start_streaming, + .stop_streaming = mcam_vb_stop_streaming, + .wait_prepare = mcam_vb_wait_prepare, + .wait_finish = mcam_vb_wait_finish, +}; +static int mcam_setup_vb2(struct mcam_camera *cam) +{ + struct vb2_queue *vq = &cam->vb_queue; + memset(vq, 0, sizeof(*vq)); + vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + vq->io_modes = VB2_MMAP; /* Add userptr */ + vq->drv_priv = cam; + vq->ops = &mcam_vb2_ops; + vq->mem_ops = &vb2_vmalloc_memops; + vq->buf_struct_size = sizeof(struct mcam_vb_buffer); + return vb2_queue_init(vq); +} + +static void mcam_cleanup_vb2(struct mcam_camera *cam) +{ + vb2_queue_release(&cam->vb_queue); +} + +static ssize_t mcam_v4l_read(struct file *filp, + char __user *buffer, size_t len, loff_t *pos) +{ + struct mcam_camera *cam = filp->private_data; + int ret; + + mutex_lock(&cam->s_mutex); + ret = vb2_read(&cam->vb_queue, buffer, len, pos, + filp->f_flags & O_NONBLOCK); + mutex_unlock(&cam->s_mutex); + return ret; +} @@ -674,26 +717,15 @@ out_unlock: * Streaming I/O support. */ - - static int mcam_vidioc_streamon(struct file *filp, void *priv, enum v4l2_buf_type type) { struct mcam_camera *cam = filp->private_data; - int ret = -EINVAL; + int ret; - if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) - goto out; mutex_lock(&cam->s_mutex); - if (cam->state != S_IDLE || cam->n_sbufs == 0) - goto out_unlock; - - cam->sequence = 0; - ret = mcam_read_setup(cam, S_STREAMING); - -out_unlock: + ret = vb2_streamon(&cam->vb_queue, type); mutex_unlock(&cam->s_mutex); -out: return ret; } @@ -702,137 +734,23 @@ static int mcam_vidioc_streamoff(struct file *filp, void *priv, enum v4l2_buf_type type) { struct mcam_camera *cam = filp->private_data; - int ret = -EINVAL; + int ret; - if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) - goto out; mutex_lock(&cam->s_mutex); - if (cam->state != S_STREAMING) - goto out_unlock; - - mcam_ctlr_stop_dma(cam); - ret = 0; - -out_unlock: + ret = vb2_streamoff(&cam->vb_queue, type); mutex_unlock(&cam->s_mutex); -out: return ret; } - -static int mcam_setup_siobuf(struct mcam_camera *cam, int index) -{ - struct mcam_sio_buffer *buf = cam->sb_bufs + index; - - INIT_LIST_HEAD(&buf->list); - buf->v4lbuf.length = PAGE_ALIGN(cam->pix_format.sizeimage); - buf->buffer = vmalloc_user(buf->v4lbuf.length); - if (buf->buffer == NULL) - return -ENOMEM; - buf->mapcount = 0; - buf->cam = cam; - - buf->v4lbuf.index = index; - buf->v4lbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - buf->v4lbuf.field = V4L2_FIELD_NONE; - buf->v4lbuf.memory = V4L2_MEMORY_MMAP; - /* - * Offset: must be 32-bit even on a 64-bit system. videobuf-dma-sg - * just uses the length times the index, but the spec warns - * against doing just that - vma merging problems. So we - * leave a gap between each pair of buffers. - */ - buf->v4lbuf.m.offset = 2*index*buf->v4lbuf.length; - return 0; -} - -static int mcam_free_sio_buffers(struct mcam_camera *cam) -{ - int i; - - /* - * If any buffers are mapped, we cannot free them at all. - */ - for (i = 0; i < cam->n_sbufs; i++) - if (cam->sb_bufs[i].mapcount > 0) - return -EBUSY; - /* - * OK, let's do it. - */ - for (i = 0; i < cam->n_sbufs; i++) - vfree(cam->sb_bufs[i].buffer); - cam->n_sbufs = 0; - kfree(cam->sb_bufs); - cam->sb_bufs = NULL; - INIT_LIST_HEAD(&cam->sb_avail); - INIT_LIST_HEAD(&cam->sb_full); - return 0; -} - - - static int mcam_vidioc_reqbufs(struct file *filp, void *priv, struct v4l2_requestbuffers *req) { struct mcam_camera *cam = filp->private_data; - int ret = 0; /* Silence warning */ + int ret; - /* - * Make sure it's something we can do. User pointers could be - * implemented without great pain, but that's not been done yet. - */ - if (req->memory != V4L2_MEMORY_MMAP) - return -EINVAL; - /* - * If they ask for zero buffers, they really want us to stop streaming - * (if it's happening) and free everything. Should we check owner? - */ mutex_lock(&cam->s_mutex); - if (req->count == 0) { - if (cam->state == S_STREAMING) - mcam_ctlr_stop_dma(cam); - ret = mcam_free_sio_buffers(cam); - goto out; - } - /* - * Device needs to be idle and working. We *could* try to do the - * right thing in S_SPECREAD by shutting things down, but it - * probably doesn't matter. - */ - if (cam->state != S_IDLE || (cam->owner && cam->owner != filp)) { - ret = -EBUSY; - goto out; - } - cam->owner = filp; - - if (req->count < min_buffers) - req->count = min_buffers; - else if (req->count > max_buffers) - req->count = max_buffers; - if (cam->n_sbufs > 0) { - ret = mcam_free_sio_buffers(cam); - if (ret) - goto out; - } - - cam->sb_bufs = kzalloc(req->count*sizeof(struct mcam_sio_buffer), - GFP_KERNEL); - if (cam->sb_bufs == NULL) { - ret = -ENOMEM; - goto out; - } - for (cam->n_sbufs = 0; cam->n_sbufs < req->count; (cam->n_sbufs++)) { - ret = mcam_setup_siobuf(cam, cam->n_sbufs); - if (ret) - break; - } - - if (cam->n_sbufs == 0) /* no luck at all - ret already set */ - kfree(cam->sb_bufs); - req->count = cam->n_sbufs; /* In case of partial success */ - -out: + ret = vb2_reqbufs(&cam->vb_queue, req); mutex_unlock(&cam->s_mutex); return ret; } @@ -842,14 +760,10 @@ static int mcam_vidioc_querybuf(struct file *filp, void *priv, struct v4l2_buffer *buf) { struct mcam_camera *cam = filp->private_data; - int ret = -EINVAL; + int ret; mutex_lock(&cam->s_mutex); - if (buf->index >= cam->n_sbufs) - goto out; - *buf = cam->sb_bufs[buf->index].v4lbuf; - ret = 0; -out: + ret = vb2_querybuf(&cam->vb_queue, buf); mutex_unlock(&cam->s_mutex); return ret; } @@ -858,29 +772,10 @@ static int mcam_vidioc_qbuf(struct file *filp, void *priv, struct v4l2_buffer *buf) { struct mcam_camera *cam = filp->private_data; - struct mcam_sio_buffer *sbuf; - int ret = -EINVAL; - unsigned long flags; + int ret; mutex_lock(&cam->s_mutex); - if (buf->index >= cam->n_sbufs) - goto out; - sbuf = cam->sb_bufs + buf->index; - if (sbuf->v4lbuf.flags & V4L2_BUF_FLAG_QUEUED) { - ret = 0; /* Already queued?? */ - goto out; - } - if (sbuf->v4lbuf.flags & V4L2_BUF_FLAG_DONE) { - /* Spec doesn't say anything, seems appropriate tho */ - ret = -EBUSY; - goto out; - } - sbuf->v4lbuf.flags |= V4L2_BUF_FLAG_QUEUED; - spin_lock_irqsave(&cam->dev_lock, flags); - list_add(&sbuf->list, &cam->sb_avail); - spin_unlock_irqrestore(&cam->dev_lock, flags); - ret = 0; -out: + ret = vb2_qbuf(&cam->vb_queue, buf); mutex_unlock(&cam->s_mutex); return ret; } @@ -889,111 +784,22 @@ static int mcam_vidioc_dqbuf(struct file *filp, void *priv, struct v4l2_buffer *buf) { struct mcam_camera *cam = filp->private_data; - struct mcam_sio_buffer *sbuf; - int ret = -EINVAL; - unsigned long flags; + int ret; mutex_lock(&cam->s_mutex); - if (cam->state != S_STREAMING) - goto out_unlock; - if (list_empty(&cam->sb_full) && filp->f_flags & O_NONBLOCK) { - ret = -EAGAIN; - goto out_unlock; - } - - while (list_empty(&cam->sb_full) && cam->state == S_STREAMING) { - mutex_unlock(&cam->s_mutex); - if (wait_event_interruptible(cam->iowait, - !list_empty(&cam->sb_full))) { - ret = -ERESTARTSYS; - goto out; - } - mutex_lock(&cam->s_mutex); - } - - if (cam->state != S_STREAMING) - ret = -EINTR; - else { - spin_lock_irqsave(&cam->dev_lock, flags); - /* Should probably recheck !list_empty() here */ - sbuf = list_entry(cam->sb_full.next, - struct mcam_sio_buffer, list); - list_del_init(&sbuf->list); - spin_unlock_irqrestore(&cam->dev_lock, flags); - sbuf->v4lbuf.flags &= ~V4L2_BUF_FLAG_DONE; - *buf = sbuf->v4lbuf; - ret = 0; - } - -out_unlock: + ret = vb2_dqbuf(&cam->vb_queue, buf, filp->f_flags & O_NONBLOCK); mutex_unlock(&cam->s_mutex); -out: return ret; } - -static void mcam_v4l_vm_open(struct vm_area_struct *vma) -{ - struct mcam_sio_buffer *sbuf = vma->vm_private_data; - /* - * Locking: done under mmap_sem, so we don't need to - * go back to the camera lock here. - */ - sbuf->mapcount++; -} - - -static void mcam_v4l_vm_close(struct vm_area_struct *vma) -{ - struct mcam_sio_buffer *sbuf = vma->vm_private_data; - - mutex_lock(&sbuf->cam->s_mutex); - sbuf->mapcount--; - /* Docs say we should stop I/O too... */ - if (sbuf->mapcount == 0) - sbuf->v4lbuf.flags &= ~V4L2_BUF_FLAG_MAPPED; - mutex_unlock(&sbuf->cam->s_mutex); -} - -static const struct vm_operations_struct mcam_v4l_vm_ops = { - .open = mcam_v4l_vm_open, - .close = mcam_v4l_vm_close -}; - - static int mcam_v4l_mmap(struct file *filp, struct vm_area_struct *vma) { struct mcam_camera *cam = filp->private_data; - unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; - int ret = -EINVAL; - int i; - struct mcam_sio_buffer *sbuf = NULL; + int ret; - if (!(vma->vm_flags & VM_WRITE) || !(vma->vm_flags & VM_SHARED)) - return -EINVAL; - /* - * Find the buffer they are looking for. - */ mutex_lock(&cam->s_mutex); - for (i = 0; i < cam->n_sbufs; i++) - if (cam->sb_bufs[i].v4lbuf.m.offset == offset) { - sbuf = cam->sb_bufs + i; - break; - } - if (sbuf == NULL) - goto out; - - ret = remap_vmalloc_range(vma, sbuf->buffer, 0); - if (ret) - goto out; - vma->vm_flags |= VM_DONTEXPAND; - vma->vm_private_data = sbuf; - vma->vm_ops = &mcam_v4l_vm_ops; - sbuf->v4lbuf.flags |= V4L2_BUF_FLAG_MAPPED; - mcam_v4l_vm_open(vma); - ret = 0; -out: + ret = vb2_mmap(&cam->vb_queue, vma); mutex_unlock(&cam->s_mutex); return ret; } @@ -1003,19 +809,23 @@ out: static int mcam_v4l_open(struct file *filp) { struct mcam_camera *cam = video_drvdata(filp); + int ret = 0; filp->private_data = cam; mutex_lock(&cam->s_mutex); if (cam->users == 0) { + ret = mcam_setup_vb2(cam); + if (ret) + goto out; mcam_ctlr_power_up(cam); __mcam_cam_reset(cam); mcam_set_config_needed(cam, 1); - /* FIXME make sure this is complete */ } (cam->users)++; +out: mutex_unlock(&cam->s_mutex); - return 0; + return ret; } @@ -1027,10 +837,10 @@ static int mcam_v4l_release(struct file *filp) (cam->users)--; if (filp == cam->owner) { mcam_ctlr_stop_dma(cam); - mcam_free_sio_buffers(cam); cam->owner = NULL; } if (cam->users == 0) { + mcam_cleanup_vb2(cam); mcam_ctlr_power_down(cam); if (alloc_bufs_at_read) mcam_free_dma_bufs(cam); @@ -1045,11 +855,12 @@ static unsigned int mcam_v4l_poll(struct file *filp, struct poll_table_struct *pt) { struct mcam_camera *cam = filp->private_data; + int ret; - poll_wait(filp, &cam->iowait, pt); - if (cam->next_buf >= 0) - return POLLIN | POLLRDNORM; - return 0; + mutex_lock(&cam->s_mutex); + ret = vb2_poll(&cam->vb_queue, filp, pt); + mutex_unlock(&cam->s_mutex); + return ret; } @@ -1093,9 +904,6 @@ static int mcam_vidioc_s_ctrl(struct file *filp, void *priv, } - - - static int mcam_vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { @@ -1166,7 +974,7 @@ static int mcam_vidioc_s_fmt_vid_cap(struct file *filp, void *priv, * Can't do anything if the device is not idle * Also can't if there are streaming buffers in place. */ - if (cam->state != S_IDLE || cam->n_sbufs > 0) + if (cam->state != S_IDLE || cam->vb_queue.num_buffers > 0) return -EBUSY; f = mcam_find_format(fmt->fmt.pix.pixelformat); @@ -1416,39 +1224,39 @@ static void mcam_frame_tasklet(unsigned long data) struct mcam_camera *cam = (struct mcam_camera *) data; int i; unsigned long flags; - struct mcam_sio_buffer *sbuf; + struct mcam_vb_buffer *buf; spin_lock_irqsave(&cam->dev_lock, flags); for (i = 0; i < cam->nbufs; i++) { int bufno = cam->next_buf; - if (bufno < 0) { /* "will never happen" */ - cam_err(cam, "No valid bufs in tasklet!\n"); - break; - } + + if (cam->state != S_STREAMING || bufno < 0) + break; /* I/O got stopped */ if (++(cam->next_buf) >= cam->nbufs) cam->next_buf = 0; if (!test_bit(bufno, &cam->flags)) continue; - if (list_empty(&cam->sb_avail)) + if (list_empty(&cam->buffers)) break; /* Leave it valid, hope for better later */ clear_bit(bufno, &cam->flags); - sbuf = list_entry(cam->sb_avail.next, - struct mcam_sio_buffer, list); + buf = list_first_entry(&cam->buffers, struct mcam_vb_buffer, + queue); + list_del_init(&buf->queue); /* * Drop the lock during the big copy. This *should* be safe... */ spin_unlock_irqrestore(&cam->dev_lock, flags); - memcpy(sbuf->buffer, cam->dma_bufs[bufno], + memcpy(vb2_plane_vaddr(&buf->vb_buf, 0), cam->dma_bufs[bufno], cam->pix_format.sizeimage); - sbuf->v4lbuf.bytesused = cam->pix_format.sizeimage; - sbuf->v4lbuf.sequence = cam->buf_seq[bufno]; - sbuf->v4lbuf.flags &= ~V4L2_BUF_FLAG_QUEUED; - sbuf->v4lbuf.flags |= V4L2_BUF_FLAG_DONE; + buf->vb_buf.v4l2_buf.bytesused = cam->pix_format.sizeimage; + buf->vb_buf.v4l2_buf.sequence = cam->buf_seq[bufno]; + buf->vb_buf.v4l2_buf.flags &= ~V4L2_BUF_FLAG_QUEUED; + buf->vb_buf.v4l2_buf.flags |= V4L2_BUF_FLAG_DONE; + vb2_set_plane_payload(&buf->vb_buf, 0, + cam->pix_format.sizeimage); + vb2_buffer_done(&buf->vb_buf, VB2_BUF_STATE_DONE); spin_lock_irqsave(&cam->dev_lock, flags); - list_move_tail(&sbuf->list, &cam->sb_full); } - if (!list_empty(&cam->sb_full)) - wake_up(&cam->iowait); spin_unlock_irqrestore(&cam->dev_lock, flags); } @@ -1468,27 +1276,6 @@ static void mcam_frame_complete(struct mcam_camera *cam, int frame) cam->buf_seq[frame] = ++(cam->sequence); switch (cam->state) { - /* - * If in single read mode, try going speculative. - */ - case S_SINGLEREAD: - cam->state = S_SPECREAD; - cam->specframes = 0; - wake_up(&cam->iowait); - break; - - /* - * If we are already doing speculative reads, and nobody is - * reading them, just stop. - */ - case S_SPECREAD: - if (++(cam->specframes) >= cam->nbufs) { - mcam_ctlr_stop(cam); - mcam_ctlr_irq_disable(cam); - cam->state = S_IDLE; - } - wake_up(&cam->iowait); - break; /* * For the streaming case, we defer the real work to the * camera tasklet. @@ -1570,12 +1357,10 @@ int mccic_register(struct mcam_camera *cam) mutex_init(&cam->s_mutex); cam->state = S_NOTREADY; mcam_set_config_needed(cam, 1); - init_waitqueue_head(&cam->iowait); cam->pix_format = mcam_def_pix_format; cam->mbus_code = mcam_def_mbus_code; INIT_LIST_HEAD(&cam->dev_list); - INIT_LIST_HEAD(&cam->sb_avail); - INIT_LIST_HEAD(&cam->sb_full); + INIT_LIST_HEAD(&cam->buffers); tasklet_init(&cam->s_tasklet, mcam_frame_tasklet, (unsigned long) cam); mcam_ctlr_init(cam); @@ -1638,10 +1423,8 @@ void mccic_shutdown(struct mcam_camera *cam) cam_warn(cam, "Removing a device with users!\n"); mcam_ctlr_power_down(cam); } + vb2_queue_release(&cam->vb_queue); mcam_free_dma_bufs(cam); - if (cam->n_sbufs > 0) - /* What if they are still mapped? Shouldn't be, but... */ - mcam_free_sio_buffers(cam); video_unregister_device(&cam->vdev); v4l2_device_unregister(&cam->v4l2_dev); } @@ -1674,9 +1457,7 @@ int mccic_resume(struct mcam_camera *cam) mutex_unlock(&cam->s_mutex); set_bit(CF_CONFIG_NEEDED, &cam->flags); - if (cam->state == S_SPECREAD) - cam->state = S_IDLE; /* Don't bother restarting */ - else if (cam->state == S_SINGLEREAD || cam->state == S_STREAMING) + if (cam->state == S_STREAMING) ret = mcam_read_setup(cam, cam->state); return ret; } diff --git a/drivers/media/video/marvell-ccic/mcam-core.h b/drivers/media/video/marvell-ccic/mcam-core.h index 5effa8203412..f40450cf72a0 100644 --- a/drivers/media/video/marvell-ccic/mcam-core.h +++ b/drivers/media/video/marvell-ccic/mcam-core.h @@ -3,6 +3,13 @@ * * Copyright 2011 Jonathan Corbet corbet@lwn.net */ +#ifndef _MCAM_CORE_H +#define _MCAM_CORE_H + +#include +#include +#include +#include /* * Tracking of streaming I/O buffers. @@ -20,8 +27,6 @@ enum mcam_state { S_NOTREADY, /* Not yet initialized */ S_IDLE, /* Just hanging around */ S_FLAKED, /* Some sort of problem */ - S_SINGLEREAD, /* In read() */ - S_SPECREAD, /* Speculative read (for future read()) */ S_STREAMING /* Streaming data */ }; #define MAX_DMA_BUFS 3 @@ -70,21 +75,19 @@ struct mcam_camera { struct list_head dev_list; /* link to other devices */ + /* Videobuf2 stuff */ + struct vb2_queue vb_queue; + struct list_head buffers; /* Available frames */ + /* DMA buffers */ unsigned int nbufs; /* How many are alloc'd */ int next_buf; /* Next to consume (dev_lock) */ unsigned int dma_buf_size; /* allocated size */ void *dma_bufs[MAX_DMA_BUFS]; /* Internal buffer addresses */ dma_addr_t dma_handles[MAX_DMA_BUFS]; /* Buffer bus addresses */ - unsigned int specframes; /* Unconsumed spec frames (dev_lock) */ unsigned int sequence; /* Frame sequence number */ - unsigned int buf_seq[MAX_DMA_BUFS]; /* Sequence for individual buffers */ + unsigned int buf_seq[MAX_DMA_BUFS]; /* Sequence for individual bufs */ - /* Streaming buffers */ - unsigned int n_sbufs; /* How many we have */ - struct mcam_sio_buffer *sb_bufs; /* The array of housekeeping structs */ - struct list_head sb_avail; /* Available for data (we own) (dev_lock) */ - struct list_head sb_full; /* With data (user space owns) (dev_lock) */ struct tasklet_struct s_tasklet; /* Current operating parameters */ @@ -94,9 +97,6 @@ struct mcam_camera { /* Locks */ struct mutex s_mutex; /* Access to this structure */ - - /* Misc */ - wait_queue_head_t iowait; /* Waiting on frame data */ }; @@ -257,3 +257,5 @@ int mccic_resume(struct mcam_camera *cam); */ #define VGA_WIDTH 640 #define VGA_HEIGHT 480 + +#endif /* _MCAM_CORE_H */ -- cgit v1.2.3 From 362d45b23d997c92ec7313e8eb6374c7b085a28e Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Mon, 20 Jun 2011 16:14:37 -0300 Subject: [media] marvell-cam: include file cleanup Put the includes into a slightly more readable ordering and get rid of a few unneeded ones. Signed-off-by: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/marvell-ccic/mcam-core.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/media/video/marvell-ccic/mcam-core.c b/drivers/media/video/marvell-ccic/mcam-core.c index 055d843f99df..65d9c0fdecae 100644 --- a/drivers/media/video/marvell-ccic/mcam-core.c +++ b/drivers/media/video/marvell-ccic/mcam-core.c @@ -11,22 +11,20 @@ #include #include #include -#include #include -#include -#include -#include -#include -#include #include #include #include #include #include -#include #include -#include #include +#include +#include +#include +#include +#include +#include #include "mcam-core.h" -- cgit v1.2.3 From 9d48a51c272782e646d75e507a66e0532327d9e5 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Mon, 20 Jun 2011 16:14:38 -0300 Subject: [media] marvell-cam: no need to initialize the DMA buffers This was an old debugging thing from years ago. It's only done at initialization time, but it's still unnecessary; take it out. Signed-off-by: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/marvell-ccic/mcam-core.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/media/video/marvell-ccic/mcam-core.c b/drivers/media/video/marvell-ccic/mcam-core.c index 65d9c0fdecae..da7ec2f473ff 100644 --- a/drivers/media/video/marvell-ccic/mcam-core.c +++ b/drivers/media/video/marvell-ccic/mcam-core.c @@ -499,8 +499,6 @@ static int mcam_alloc_dma_bufs(struct mcam_camera *cam, int loadtime) cam_warn(cam, "Failed to allocate DMA buffer\n"); break; } - /* For debug, remove eventually */ - memset(cam->dma_bufs[i], 0xcc, cam->dma_buf_size); (cam->nbufs)++; } -- cgit v1.2.3 From 6c895d548c393d913152195c9e70816e13c64f9f Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Mon, 20 Jun 2011 16:14:39 -0300 Subject: [media] marvell-cam: Don't spam the logs on frame loss The sequence numbers already give that information if user space cares; this is a frequent occurrence on slower machines, alas. Signed-off-by: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/marvell-ccic/mcam-core.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/media/video/marvell-ccic/mcam-core.c b/drivers/media/video/marvell-ccic/mcam-core.c index da7ec2f473ff..ca3c56f05f0d 100644 --- a/drivers/media/video/marvell-ccic/mcam-core.c +++ b/drivers/media/video/marvell-ccic/mcam-core.c @@ -1263,8 +1263,6 @@ static void mcam_frame_complete(struct mcam_camera *cam, int frame) /* * Basic frame housekeeping. */ - if (test_bit(frame, &cam->flags) && printk_ratelimit()) - cam_err(cam, "Frame overrun on %d, frames lost\n", frame); set_bit(frame, &cam->flags); clear_bit(CF_DMA_ACTIVE, &cam->flags); if (cam->next_buf < 0) -- cgit v1.2.3 From a9b36e850782db853b9da050be9ed2050de51ad4 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Mon, 20 Jun 2011 16:14:40 -0300 Subject: [media] marvell-cam: implement contiguous DMA operation The core driver can now operate in either vmalloc or dma-contig modes; obviously the latter is preferable when it is supported. Default is currently vmalloc on all platforms; load the module with buffer_mode=1 for contiguous DMA mode. Signed-off-by: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/marvell-ccic/Kconfig | 1 + drivers/media/video/marvell-ccic/cafe-driver.c | 6 + drivers/media/video/marvell-ccic/mcam-core.c | 230 +++++++++++++++++++------ drivers/media/video/marvell-ccic/mcam-core.h | 21 ++- drivers/media/video/marvell-ccic/mmp-driver.c | 1 + 5 files changed, 205 insertions(+), 54 deletions(-) diff --git a/drivers/media/video/marvell-ccic/Kconfig b/drivers/media/video/marvell-ccic/Kconfig index eb535b10000c..22314a0fa23b 100644 --- a/drivers/media/video/marvell-ccic/Kconfig +++ b/drivers/media/video/marvell-ccic/Kconfig @@ -14,6 +14,7 @@ config VIDEO_MMP_CAMERA select VIDEO_OV7670 select I2C_GPIO select VIDEOBUF2_VMALLOC + select VIDEOBUF2_DMA_CONTIG ---help--- This is a Video4Linux2 driver for the integrated camera controller found on Marvell Armada 610 application diff --git a/drivers/media/video/marvell-ccic/cafe-driver.c b/drivers/media/video/marvell-ccic/cafe-driver.c index 6a29cc1c45a5..d030f9beae88 100644 --- a/drivers/media/video/marvell-ccic/cafe-driver.c +++ b/drivers/media/video/marvell-ccic/cafe-driver.c @@ -481,6 +481,12 @@ static int cafe_pci_probe(struct pci_dev *pdev, */ mcam->clock_speed = 45; mcam->use_smbus = 1; + /* + * Vmalloc mode for buffers is traditional with this driver. + * We *might* be able to run DMA_contig, especially on a system + * with CMA in it. + */ + mcam->buffer_mode = B_vmalloc; /* * Get set up on the PCI bus. */ diff --git a/drivers/media/video/marvell-ccic/mcam-core.c b/drivers/media/video/marvell-ccic/mcam-core.c index ca3c56f05f0d..419b4e5f6988 100644 --- a/drivers/media/video/marvell-ccic/mcam-core.c +++ b/drivers/media/video/marvell-ccic/mcam-core.c @@ -25,9 +25,16 @@ #include #include #include +#include #include "mcam-core.h" +/* + * Basic frame stats - to be deleted shortly + */ +static int frames; +static int singles; +static int delivered; /* * Internal DMA buffer management. Since the controller cannot do S/G I/O, @@ -48,7 +55,8 @@ MODULE_PARM_DESC(alloc_bufs_at_read, "Non-zero value causes DMA buffers to be allocated when the " "video capture device is read, rather than at module load " "time. This saves memory, but decreases the chances of " - "successfully getting those buffers."); + "successfully getting those buffers. This parameter is " + "only used in the vmalloc buffer mode"); static int n_dma_bufs = 3; module_param(n_dma_bufs, uint, 0644); @@ -82,6 +90,13 @@ MODULE_PARM_DESC(flip, "If set, the sensor will be instructed to flip the image " "vertically."); +static int buffer_mode = -1; +module_param(buffer_mode, int, 0444); +MODULE_PARM_DESC(buffer_mode, + "Set the buffer mode to be used; default is to go with what " + "the platform driver asks for. Set to 0 for vmalloc, 1 for " + "DMA contiguous."); + /* * Status flags. Always manipulated with bit operations. */ @@ -90,6 +105,7 @@ MODULE_PARM_DESC(flip, #define CF_BUF2_VALID 2 #define CF_DMA_ACTIVE 3 /* A frame is incoming */ #define CF_CONFIG_NEEDED 4 /* Must configure hardware */ +#define CF_SINGLE_BUFFER 5 /* Running with a single buffer */ #define sensor_call(cam, o, f, args...) \ v4l2_subdev_call(cam->sensor, o, f, ##args) @@ -197,10 +213,9 @@ static inline struct mcam_vb_buffer *vb_to_mvb(struct vb2_buffer *vb) */ /* - * Do everything we think we need to have the interface operating - * according to the desired format. + * Set up DMA buffers when operating in vmalloc mode */ -static void mcam_ctlr_dma(struct mcam_camera *cam) +static void mcam_ctlr_dma_vmalloc(struct mcam_camera *cam) { /* * Store the first two Y buffers (we aren't supporting @@ -219,6 +234,57 @@ static void mcam_ctlr_dma(struct mcam_camera *cam) mcam_reg_write(cam, REG_UBAR, 0); /* 32 bits only */ } +/* + * Set up a contiguous buffer for the given frame. Here also is where + * the underrun strategy is set: if there is no buffer available, reuse + * the buffer from the other BAR and set the CF_SINGLE_BUFFER flag to + * keep the interrupt handler from giving that buffer back to user + * space. In this way, we always have a buffer to DMA to and don't + * have to try to play games stopping and restarting the controller. + */ +static void mcam_set_contig_buffer(struct mcam_camera *cam, int frame) +{ + struct mcam_vb_buffer *buf; + /* + * If there are no available buffers, go into single mode + */ + if (list_empty(&cam->buffers)) { + buf = cam->vb_bufs[frame ^ 0x1]; + cam->vb_bufs[frame] = buf; + mcam_reg_write(cam, frame == 0 ? REG_Y0BAR : REG_Y1BAR, + vb2_dma_contig_plane_paddr(&buf->vb_buf, 0)); + set_bit(CF_SINGLE_BUFFER, &cam->flags); + singles++; + return; + } + /* + * OK, we have a buffer we can use. + */ + buf = list_first_entry(&cam->buffers, struct mcam_vb_buffer, queue); + list_del_init(&buf->queue); + mcam_reg_write(cam, frame == 0 ? REG_Y0BAR : REG_Y1BAR, + vb2_dma_contig_plane_paddr(&buf->vb_buf, 0)); + cam->vb_bufs[frame] = buf; + clear_bit(CF_SINGLE_BUFFER, &cam->flags); +} + +static void mcam_ctlr_dma_contig(struct mcam_camera *cam) +{ + mcam_reg_set_bit(cam, REG_CTRL1, C1_TWOBUFS); + cam->nbufs = 2; + mcam_set_contig_buffer(cam, 0); + mcam_set_contig_buffer(cam, 1); +} + + +static void mcam_ctlr_dma(struct mcam_camera *cam) +{ + if (cam->buffer_mode == B_DMA_contig) + mcam_ctlr_dma_contig(cam); + else + mcam_ctlr_dma_vmalloc(cam); +} + static void mcam_ctlr_image(struct mcam_camera *cam) { int imgsz; @@ -542,7 +608,7 @@ static void mcam_free_dma_bufs(struct mcam_camera *cam) /* * Get everything ready, and start grabbing frames. */ -static int mcam_read_setup(struct mcam_camera *cam, enum mcam_state state) +static int mcam_read_setup(struct mcam_camera *cam) { int ret; unsigned long flags; @@ -551,9 +617,9 @@ static int mcam_read_setup(struct mcam_camera *cam, enum mcam_state state) * Configuration. If we still don't have DMA buffers, * make one last, desperate attempt. */ - if (cam->nbufs == 0) - if (mcam_alloc_dma_bufs(cam, 0)) - return -ENOMEM; + if (cam->buffer_mode == B_vmalloc && cam->nbufs == 0 && + mcam_alloc_dma_bufs(cam, 0)) + return -ENOMEM; if (mcam_needs_config(cam)) { mcam_cam_configure(cam); @@ -568,7 +634,7 @@ static int mcam_read_setup(struct mcam_camera *cam, enum mcam_state state) spin_lock_irqsave(&cam->dev_lock, flags); mcam_reset_buffers(cam); mcam_ctlr_irq_enable(cam); - cam->state = state; + cam->state = S_STREAMING; mcam_ctlr_start(cam); spin_unlock_irqrestore(&cam->dev_lock, flags); return 0; @@ -587,8 +653,10 @@ static int mcam_vb_queue_setup(struct vb2_queue *vq, unsigned int *nbufs, sizes[0] = cam->pix_format.sizeimage; *num_planes = 1; /* Someday we have to support planar formats... */ - if (*nbufs < 2 || *nbufs > 32) - *nbufs = 6; /* semi-arbitrary numbers */ + if (*nbufs < 3 || *nbufs > 32) + *nbufs = 3; /* semi-arbitrary numbers */ + if (cam->buffer_mode == B_DMA_contig) + alloc_ctxs[0] = cam->vb_alloc_ctx; return 0; } @@ -605,10 +673,14 @@ static void mcam_vb_buf_queue(struct vb2_buffer *vb) struct mcam_vb_buffer *mvb = vb_to_mvb(vb); struct mcam_camera *cam = vb2_get_drv_priv(vb->vb2_queue); unsigned long flags; + int start; spin_lock_irqsave(&cam->dev_lock, flags); - list_add(&cam->buffers, &mvb->queue); + start = (cam->state == S_BUFWAIT) && !list_empty(&cam->buffers); + list_add(&mvb->queue, &cam->buffers); spin_unlock_irqrestore(&cam->dev_lock, flags); + if (start) + mcam_read_setup(cam); } /* @@ -636,13 +708,22 @@ static void mcam_vb_wait_finish(struct vb2_queue *vq) static int mcam_vb_start_streaming(struct vb2_queue *vq) { struct mcam_camera *cam = vb2_get_drv_priv(vq); - int ret = -EINVAL; - if (cam->state == S_IDLE) { - cam->sequence = 0; - ret = mcam_read_setup(cam, S_STREAMING); + if (cam->state != S_IDLE) + return -EINVAL; + cam->sequence = 0; + /* + * Videobuf2 sneakily hoards all the buffers and won't + * give them to us until *after* streaming starts. But + * we can't actually start streaming until we have a + * destination. So go into a wait state and hope they + * give us buffers soon. + */ + if (cam->buffer_mode != B_vmalloc && list_empty(&cam->buffers)) { + cam->state = S_BUFWAIT; + return 0; } - return ret; + return mcam_read_setup(cam); } static int mcam_vb_stop_streaming(struct vb2_queue *vq) @@ -650,6 +731,11 @@ static int mcam_vb_stop_streaming(struct vb2_queue *vq) struct mcam_camera *cam = vb2_get_drv_priv(vq); unsigned long flags; + if (cam->state == S_BUFWAIT) { + /* They never gave us buffers */ + cam->state = S_IDLE; + return 0; + } if (cam->state != S_STREAMING) return -EINVAL; mcam_ctlr_stop_dma(cam); @@ -683,7 +769,11 @@ static int mcam_setup_vb2(struct mcam_camera *cam) vq->io_modes = VB2_MMAP; /* Add userptr */ vq->drv_priv = cam; vq->ops = &mcam_vb2_ops; - vq->mem_ops = &vb2_vmalloc_memops; + if (cam->buffer_mode == B_DMA_contig) { + vq->mem_ops = &vb2_dma_contig_memops; + cam->vb_alloc_ctx = vb2_dma_contig_init_ctx(cam->dev); + } else + vq->mem_ops = &vb2_vmalloc_memops; vq->buf_struct_size = sizeof(struct mcam_vb_buffer); return vb2_queue_init(vq); @@ -692,6 +782,8 @@ static int mcam_setup_vb2(struct mcam_camera *cam) static void mcam_cleanup_vb2(struct mcam_camera *cam) { vb2_queue_release(&cam->vb_queue); + if (cam->buffer_mode == B_DMA_contig) + vb2_dma_contig_cleanup_ctx(cam->vb_alloc_ctx); } static ssize_t mcam_v4l_read(struct file *filp, @@ -809,6 +901,7 @@ static int mcam_v4l_open(struct file *filp) filp->private_data = cam; + frames = singles = delivered = 0; mutex_lock(&cam->s_mutex); if (cam->users == 0) { ret = mcam_setup_vb2(cam); @@ -829,6 +922,8 @@ static int mcam_v4l_release(struct file *filp) { struct mcam_camera *cam = filp->private_data; + cam_err(cam, "Release, %d frames, %d singles, %d delivered\n", frames, + singles, delivered); mutex_lock(&cam->s_mutex); (cam->users)--; if (filp == cam->owner) { @@ -838,7 +933,7 @@ static int mcam_v4l_release(struct file *filp) if (cam->users == 0) { mcam_cleanup_vb2(cam); mcam_ctlr_power_down(cam); - if (alloc_bufs_at_read) + if (cam->buffer_mode == B_vmalloc && alloc_bufs_at_read) mcam_free_dma_bufs(cam); } mutex_unlock(&cam->s_mutex); @@ -993,18 +1088,17 @@ static int mcam_vidioc_s_fmt_vid_cap(struct file *filp, void *priv, * Make sure we have appropriate DMA buffers. */ ret = -ENOMEM; - if (cam->nbufs > 0 && cam->dma_buf_size < cam->pix_format.sizeimage) - mcam_free_dma_bufs(cam); - if (cam->nbufs == 0) { - if (mcam_alloc_dma_bufs(cam, 0)) - goto out; + if (cam->buffer_mode == B_vmalloc) { + if (cam->nbufs > 0 && + cam->dma_buf_size < cam->pix_format.sizeimage) + mcam_free_dma_bufs(cam); + if (cam->nbufs == 0) { + if (mcam_alloc_dma_bufs(cam, 0)) + goto out; + } } - /* - * It looks like this might work, so let's program the sensor. - */ - ret = mcam_cam_configure(cam); - if (!ret) - ret = mcam_ctlr_configure(cam); + mcam_set_config_needed(cam, 1); + ret = 0; out: mutex_unlock(&cam->s_mutex); return ret; @@ -1214,7 +1308,20 @@ static struct video_device mcam_v4l_template = { */ +static void mcam_buffer_done(struct mcam_camera *cam, int frame, + struct vb2_buffer *vbuf) +{ + vbuf->v4l2_buf.bytesused = cam->pix_format.sizeimage; + vbuf->v4l2_buf.sequence = cam->buf_seq[frame]; + vbuf->v4l2_buf.flags &= ~V4L2_BUF_FLAG_QUEUED; + vbuf->v4l2_buf.flags |= V4L2_BUF_FLAG_DONE; + vb2_set_plane_payload(vbuf, 0, cam->pix_format.sizeimage); + vb2_buffer_done(vbuf, VB2_BUF_STATE_DONE); +} +/* + * Copy data out to user space in the vmalloc case + */ static void mcam_frame_tasklet(unsigned long data) { struct mcam_camera *cam = (struct mcam_camera *) data; @@ -1232,8 +1339,11 @@ static void mcam_frame_tasklet(unsigned long data) cam->next_buf = 0; if (!test_bit(bufno, &cam->flags)) continue; - if (list_empty(&cam->buffers)) + if (list_empty(&cam->buffers)) { + singles++; break; /* Leave it valid, hope for better later */ + } + delivered++; clear_bit(bufno, &cam->flags); buf = list_first_entry(&cam->buffers, struct mcam_vb_buffer, queue); @@ -1244,18 +1354,25 @@ static void mcam_frame_tasklet(unsigned long data) spin_unlock_irqrestore(&cam->dev_lock, flags); memcpy(vb2_plane_vaddr(&buf->vb_buf, 0), cam->dma_bufs[bufno], cam->pix_format.sizeimage); - buf->vb_buf.v4l2_buf.bytesused = cam->pix_format.sizeimage; - buf->vb_buf.v4l2_buf.sequence = cam->buf_seq[bufno]; - buf->vb_buf.v4l2_buf.flags &= ~V4L2_BUF_FLAG_QUEUED; - buf->vb_buf.v4l2_buf.flags |= V4L2_BUF_FLAG_DONE; - vb2_set_plane_payload(&buf->vb_buf, 0, - cam->pix_format.sizeimage); - vb2_buffer_done(&buf->vb_buf, VB2_BUF_STATE_DONE); + mcam_buffer_done(cam, bufno, &buf->vb_buf); spin_lock_irqsave(&cam->dev_lock, flags); } spin_unlock_irqrestore(&cam->dev_lock, flags); } +/* + * For direct DMA, mark the buffer ready and set up another one. + */ +static void mcam_dma_complete(struct mcam_camera *cam, int frame) +{ + struct mcam_vb_buffer *buf = cam->vb_bufs[frame]; + + if (!test_bit(CF_SINGLE_BUFFER, &cam->flags)) { + delivered++; + mcam_buffer_done(cam, frame, &buf->vb_buf); + } + mcam_set_contig_buffer(cam, frame); +} static void mcam_frame_complete(struct mcam_camera *cam, int frame) @@ -1265,21 +1382,20 @@ static void mcam_frame_complete(struct mcam_camera *cam, int frame) */ set_bit(frame, &cam->flags); clear_bit(CF_DMA_ACTIVE, &cam->flags); - if (cam->next_buf < 0) - cam->next_buf = frame; + cam->next_buf = frame; cam->buf_seq[frame] = ++(cam->sequence); + cam->last_delivered = frame; + frames++; switch (cam->state) { /* - * For the streaming case, we defer the real work to the - * camera tasklet. - * - * FIXME: if the application is not consuming the buffers, - * we should eventually put things on hold and restart in - * vidioc_dqbuf(). + * We're streaming and have a ready frame, hand it back */ case S_STREAMING: - tasklet_schedule(&cam->s_tasklet); + if (cam->buffer_mode == B_vmalloc) + tasklet_schedule(&cam->s_tasklet); + else + mcam_dma_complete(cam, frame); break; default: @@ -1356,7 +1472,18 @@ int mccic_register(struct mcam_camera *cam) INIT_LIST_HEAD(&cam->dev_list); INIT_LIST_HEAD(&cam->buffers); tasklet_init(&cam->s_tasklet, mcam_frame_tasklet, (unsigned long) cam); - + /* + * User space may want to override the asked-for buffer mode; + * here's hoping they know what they're doing. + */ + if (buffer_mode == 0) + cam->buffer_mode = B_vmalloc; + else if (buffer_mode == 1) + cam->buffer_mode = B_DMA_contig; + else if (buffer_mode != -1) + printk(KERN_ERR "marvel-cam: " + "Strange module buffer mode %d - ignoring\n", + buffer_mode); mcam_ctlr_init(cam); /* @@ -1390,7 +1517,7 @@ int mccic_register(struct mcam_camera *cam) /* * If so requested, try to get our DMA buffers now. */ - if (!alloc_bufs_at_read) { + if (cam->buffer_mode == B_vmalloc && !alloc_bufs_at_read) { if (mcam_alloc_dma_bufs(cam, 1)) cam_warn(cam, "Unable to alloc DMA buffers at load" " will try again later."); @@ -1418,7 +1545,8 @@ void mccic_shutdown(struct mcam_camera *cam) mcam_ctlr_power_down(cam); } vb2_queue_release(&cam->vb_queue); - mcam_free_dma_bufs(cam); + if (cam->buffer_mode == B_vmalloc) + mcam_free_dma_bufs(cam); video_unregister_device(&cam->vdev); v4l2_device_unregister(&cam->v4l2_dev); } @@ -1452,7 +1580,7 @@ int mccic_resume(struct mcam_camera *cam) set_bit(CF_CONFIG_NEEDED, &cam->flags); if (cam->state == S_STREAMING) - ret = mcam_read_setup(cam, cam->state); + ret = mcam_read_setup(cam); return ret; } #endif /* CONFIG_PM */ diff --git a/drivers/media/video/marvell-ccic/mcam-core.h b/drivers/media/video/marvell-ccic/mcam-core.h index f40450cf72a0..2e667a05620a 100644 --- a/drivers/media/video/marvell-ccic/mcam-core.h +++ b/drivers/media/video/marvell-ccic/mcam-core.h @@ -27,10 +27,20 @@ enum mcam_state { S_NOTREADY, /* Not yet initialized */ S_IDLE, /* Just hanging around */ S_FLAKED, /* Some sort of problem */ - S_STREAMING /* Streaming data */ + S_STREAMING, /* Streaming data */ + S_BUFWAIT /* streaming requested but no buffers yet */ }; #define MAX_DMA_BUFS 3 +/* + * Different platforms work best with different buffer modes, so we + * let the platform pick. + */ +enum mcam_buffer_mode { + B_vmalloc = 0, + B_DMA_contig +}; + /* * A description of one of our devices. * Locking: controlled by s_mutex. Certain fields, however, require @@ -49,7 +59,7 @@ struct mcam_camera { unsigned int chip_id; short int clock_speed; /* Sensor clock speed, default 30 */ short int use_smbus; /* SMBUS or straight I2c? */ - + enum mcam_buffer_mode buffer_mode; /* * Callbacks from the core to the platform code. */ @@ -79,7 +89,7 @@ struct mcam_camera { struct vb2_queue vb_queue; struct list_head buffers; /* Available frames */ - /* DMA buffers */ + /* DMA buffers - vmalloc mode */ unsigned int nbufs; /* How many are alloc'd */ int next_buf; /* Next to consume (dev_lock) */ unsigned int dma_buf_size; /* allocated size */ @@ -88,6 +98,11 @@ struct mcam_camera { unsigned int sequence; /* Frame sequence number */ unsigned int buf_seq[MAX_DMA_BUFS]; /* Sequence for individual bufs */ + /* DMA buffers - contiguous DMA mode */ + struct mcam_vb_buffer *vb_bufs[MAX_DMA_BUFS]; + struct vb2_alloc_ctx *vb_alloc_ctx; + unsigned short last_delivered; + struct tasklet_struct s_tasklet; /* Current operating parameters */ diff --git a/drivers/media/video/marvell-ccic/mmp-driver.c b/drivers/media/video/marvell-ccic/mmp-driver.c index ac9976f23a61..7b9c48c897e5 100644 --- a/drivers/media/video/marvell-ccic/mmp-driver.c +++ b/drivers/media/video/marvell-ccic/mmp-driver.c @@ -180,6 +180,7 @@ static int mmpcam_probe(struct platform_device *pdev) mcam->dev = &pdev->dev; mcam->use_smbus = 0; mcam->chip_id = V4L2_IDENT_ARMADA610; + mcam->buffer_mode = B_vmalloc; /* Switch to dma */ spin_lock_init(&mcam->dev_lock); /* * Get our I/O memory. -- cgit v1.2.3 From b6dc1bab052891f7cbe158f7146a0f9d55806471 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 25 Jun 2011 14:28:08 -0300 Subject: [media] DocBook/v4l: Remove references to the old V4L1 compat layer The old V4L1 Kernel copatibility layer was removed, but the API spec still says that it is there. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/v4l/compat.xml | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml index 9f7cd4f25792..b010ac6bfd2c 100644 --- a/Documentation/DocBook/media/v4l/compat.xml +++ b/Documentation/DocBook/media/v4l/compat.xml @@ -10,12 +10,10 @@ driver writers to port or update their code.The Video For Linux API was first introduced in Linux 2.1 to unify and replace various TV and radio device related interfaces, developed independently by driver writers in prior years. Starting -with Linux 2.5 the much improved V4L2 API replaces the V4L API, -although existing drivers will continue to support V4L applications in -the future, either directly or through the V4L2 compatibility layer in -the videodev kernel module translating ioctls on -the fly. For a transition period not all drivers will support the V4L2 -API. +with Linux 2.5 the much improved V4L2 API replaces the V4L API. +The support for the old V4L calls were removed from Kernel, but the +library supports the conversion of a V4L +API system call into a V4L2 one.
Opening and Closing Devices @@ -84,12 +82,7 @@ not compatible with V4L or V4L2. , device file. V4L2 drivers may support multiple opens, see for details and consequences. - V4L drivers respond to V4L2 ioctls with an &EINVAL;. The -compatibility layer in the V4L2 videodev module -can translate V4L ioctl requests to their V4L2 counterpart, however a -V4L2 driver usually needs more preparation to become fully V4L -compatible. This is covered in more detail in . + V4L drivers respond to V4L2 ioctls with an &EINVAL;.
-- cgit v1.2.3 From ae6db5154671759426046c2cbc2e20a82ff0feed Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 24 Jun 2011 13:14:14 -0300 Subject: [media] v4l2-ioctl: Add a default value for kernel version Most drivers don't increase kernel versions as newer features are added or bug fixes are solved. So, vidioc_querycap returned value for cap->version is meaningless. Instead of keeping this situation forever, let's add a default value matching the current Linux version. Drivers that want to keep their own version control can still do it, as they can override the default value for cap->version. Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/v4l2-ioctl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 55df1436f835..48b94fcb6a25 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c @@ -16,6 +16,7 @@ #include #include #include +#include #include @@ -605,6 +606,7 @@ static long __video_do_ioctl(struct file *file, if (!ops->vidioc_querycap) break; + cap->version = LINUX_VERSION_CODE; ret = ops->vidioc_querycap(file, fh, cap); if (!ret) dbgarg(cmd, "driver=%s, card=%s, bus=%s, " -- cgit v1.2.3 From d35ebf9558e692299b764163d61420fe5f526c02 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 25 Jun 2011 10:39:36 -0300 Subject: [media] drxd, siano: Remove unused include linux/version.h Both drxd and siano drivers were including linux/version.h without any reason. Probably, this is due to some compatibility code that used to exist before having their support added into the Linux Kernel. Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/drxd_hard.c | 1 - drivers/media/dvb/siano/smscoreapi.h | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/media/dvb/frontends/drxd_hard.c b/drivers/media/dvb/frontends/drxd_hard.c index ea4c1c361d2b..f132e49e48e6 100644 --- a/drivers/media/dvb/frontends/drxd_hard.c +++ b/drivers/media/dvb/frontends/drxd_hard.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include "dvb_frontend.h" diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index 8ecadecaa9d0..c592ae090397 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -22,7 +22,6 @@ along with this program. If not, see . #ifndef __SMS_CORE_API_H__ #define __SMS_CORE_API_H__ -#include #include #include #include -- cgit v1.2.3 From 1990d50b58bef127a647005fdcada6d07081d3ef Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 24 Jun 2011 14:45:49 -0300 Subject: [media] Stop using linux/version.h on most video drivers All the modified drivers didn't have any version increment since Jan, 1 2011. Several of them didn't have any version increment for a long time, even having new features and important bug fixes happening. As we're now filling the QUERYCAP version with the current Kernel Release, we don't need to maintain a per-driver version control anymore. So, let's just use the default. In order to preserve the Kernel module version history, a KERNEL_VERSION() macro were added to all modified drivers, and the extraver number were incremented. I opted to preserve the per-driver version control to a few pwc, pvrusb2, s2255, s5p-fimc and sh_vou. A few drivers are still using the legacy way to handle ioctl's. So, we can't do such change on them, otherwise, they'll break. Those are: uvc, et61x251 and sn9c102. The rationale is that the per-driver version control seems to be actively maintained on those. Yet, I think that the better for them would be to just use the default version numbering, instead of doing that by themselves. While here, removed a few uneeded include linux/version.h Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/arv.c | 5 ++--- drivers/media/video/au0828/au0828-core.c | 1 + drivers/media/video/au0828/au0828-video.c | 5 ----- drivers/media/video/bt8xx/bttv-driver.c | 14 ++++---------- drivers/media/video/bt8xx/bttvp.h | 3 --- drivers/media/video/bw-qcam.c | 3 +-- drivers/media/video/c-qcam.c | 3 +-- drivers/media/video/cpia2/cpia2.h | 5 ----- drivers/media/video/cpia2/cpia2_v4l.c | 12 ++++-------- drivers/media/video/cx231xx/cx231xx-video.c | 14 ++++---------- drivers/media/video/cx231xx/cx231xx.h | 1 - drivers/media/video/cx23885/altera-ci.c | 1 - drivers/media/video/cx23885/cx23885-417.c | 1 - drivers/media/video/cx23885/cx23885-core.c | 13 +++---------- drivers/media/video/cx23885/cx23885-video.c | 1 - drivers/media/video/cx23885/cx23885.h | 3 +-- drivers/media/video/cx88/cx88-alsa.c | 19 ++++--------------- drivers/media/video/cx88/cx88-blackbird.c | 20 +++----------------- drivers/media/video/cx88/cx88-dvb.c | 18 +++--------------- drivers/media/video/cx88/cx88-mpeg.c | 11 +++-------- drivers/media/video/cx88/cx88-video.c | 21 +++------------------ drivers/media/video/cx88/cx88.h | 4 ++-- drivers/media/video/em28xx/em28xx-video.c | 14 +++++--------- drivers/media/video/gspca/gl860/gl860.h | 1 - drivers/media/video/hdpvr/hdpvr-core.c | 1 + drivers/media/video/hdpvr/hdpvr-video.c | 2 -- drivers/media/video/hdpvr/hdpvr.h | 6 ------ drivers/media/video/mem2mem_testdev.c | 4 +--- drivers/media/video/pms.c | 4 +--- drivers/media/video/pwc/pwc-ioctl.h | 1 - drivers/media/video/pwc/pwc.h | 8 ++++---- drivers/media/video/saa7134/saa7134-core.c | 12 ++++-------- drivers/media/video/saa7134/saa7134-empress.c | 1 - drivers/media/video/saa7134/saa7134-video.c | 2 -- drivers/media/video/saa7134/saa7134.h | 3 +-- drivers/media/video/saa7164/saa7164.h | 1 - drivers/media/video/timblogiw.c | 1 - drivers/media/video/tlg2300/pd-common.h | 1 - drivers/media/video/tlg2300/pd-main.c | 1 + drivers/media/video/tlg2300/pd-radio.c | 2 -- drivers/media/video/usbvision/usbvision-video.c | 12 +----------- drivers/media/video/vino.c | 5 +---- drivers/media/video/vivi.c | 14 ++++---------- drivers/media/video/w9966.c | 4 +--- drivers/media/video/zoran/zoran.h | 4 ---- drivers/media/video/zoran/zoran_card.c | 7 +++++-- drivers/media/video/zoran/zoran_driver.c | 3 --- drivers/media/video/zr364xx.c | 6 ++---- 48 files changed, 71 insertions(+), 227 deletions(-) diff --git a/drivers/media/video/arv.c b/drivers/media/video/arv.c index f989f2820d88..b6ed44aebe30 100644 --- a/drivers/media/video/arv.c +++ b/drivers/media/video/arv.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -54,7 +53,7 @@ */ #define USE_INT 0 /* Don't modify */ -#define VERSION "0.04" +#define VERSION "0.0.5" #define ar_inl(addr) inl((unsigned long)(addr)) #define ar_outl(val, addr) outl((unsigned long)(val), (unsigned long)(addr)) @@ -404,7 +403,6 @@ static int ar_querycap(struct file *file, void *priv, strlcpy(vcap->driver, ar->vdev.name, sizeof(vcap->driver)); strlcpy(vcap->card, "Colour AR VGA", sizeof(vcap->card)); strlcpy(vcap->bus_info, "Platform", sizeof(vcap->bus_info)); - vcap->version = KERNEL_VERSION(0, 0, 4); vcap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE; return 0; } @@ -879,3 +877,4 @@ module_exit(ar_cleanup_module); MODULE_AUTHOR("Takeo Takahashi "); MODULE_DESCRIPTION("Colour AR M64278(VGA) for Video4Linux"); MODULE_LICENSE("GPL"); +MODULE_VERSION(VERSION); diff --git a/drivers/media/video/au0828/au0828-core.c b/drivers/media/video/au0828/au0828-core.c index ca342e4c61fc..1e4ce5068ec2 100644 --- a/drivers/media/video/au0828/au0828-core.c +++ b/drivers/media/video/au0828/au0828-core.c @@ -292,3 +292,4 @@ module_exit(au0828_exit); MODULE_DESCRIPTION("Driver for Auvitek AU0828 based products"); MODULE_AUTHOR("Steven Toth "); MODULE_LICENSE("GPL"); +MODULE_VERSION("0.0.2"); diff --git a/drivers/media/video/au0828/au0828-video.c b/drivers/media/video/au0828/au0828-video.c index c03eb29a9ee6..0b3e481ffe8c 100644 --- a/drivers/media/video/au0828/au0828-video.c +++ b/drivers/media/video/au0828/au0828-video.c @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -43,8 +42,6 @@ static DEFINE_MUTEX(au0828_sysfs_lock); -#define AU0828_VERSION_CODE KERNEL_VERSION(0, 0, 1) - /* ------------------------------------------------------------------ Videobuf operations ------------------------------------------------------------------*/ @@ -1254,8 +1251,6 @@ static int vidioc_querycap(struct file *file, void *priv, strlcpy(cap->card, dev->board.name, sizeof(cap->card)); strlcpy(cap->bus_info, dev->v4l2_dev.name, sizeof(cap->bus_info)); - cap->version = AU0828_VERSION_CODE; - /*set the device capabilities */ cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VBI_CAPTURE | diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 834a48394bce..14444de67d5e 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c @@ -57,6 +57,7 @@ #include +#define BTTV_VERSION "0.9.19" unsigned int bttv_num; /* number of Bt848s in use */ struct bttv *bttvs[BTTV_MAX]; @@ -163,6 +164,7 @@ MODULE_PARM_DESC(radio_nr, "radio device numbers"); MODULE_DESCRIPTION("bttv - v4l/v4l2 driver module for bt848/878 based cards"); MODULE_AUTHOR("Ralph Metzler & Marcus Metzler & Gerd Knorr"); MODULE_LICENSE("GPL"); +MODULE_VERSION(BTTV_VERSION); /* ----------------------------------------------------------------------- */ /* sysfs */ @@ -2616,7 +2618,6 @@ static int bttv_querycap(struct file *file, void *priv, strlcpy(cap->card, btv->video_dev->name, sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s", pci_name(btv->c.pci)); - cap->version = BTTV_VERSION_CODE; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VBI_CAPTURE | @@ -3416,7 +3417,6 @@ static int radio_querycap(struct file *file, void *priv, strcpy(cap->driver, "bttv"); strlcpy(cap->card, btv->radio_dev->name, sizeof(cap->card)); sprintf(cap->bus_info, "PCI:%s", pci_name(btv->c.pci)); - cap->version = BTTV_VERSION_CODE; cap->capabilities = V4L2_CAP_TUNER; return 0; @@ -4585,14 +4585,8 @@ static int __init bttv_init_module(void) bttv_num = 0; - printk(KERN_INFO "bttv: driver version %d.%d.%d loaded\n", - (BTTV_VERSION_CODE >> 16) & 0xff, - (BTTV_VERSION_CODE >> 8) & 0xff, - BTTV_VERSION_CODE & 0xff); -#ifdef SNAPSHOT - printk(KERN_INFO "bttv: snapshot date %04d-%02d-%02d\n", - SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100); -#endif + printk(KERN_INFO "bttv: driver version %s loaded\n", + BTTV_VERSION); if (gbuffers < 2 || gbuffers > VIDEO_MAX_FRAME) gbuffers = 2; if (gbufsize > BTTV_MAX_FBUF) diff --git a/drivers/media/video/bt8xx/bttvp.h b/drivers/media/video/bt8xx/bttvp.h index 9b776faf0741..318edf2830b4 100644 --- a/drivers/media/video/bt8xx/bttvp.h +++ b/drivers/media/video/bt8xx/bttvp.h @@ -25,9 +25,6 @@ #ifndef _BTTVP_H_ #define _BTTVP_H_ -#include -#define BTTV_VERSION_CODE KERNEL_VERSION(0,9,18) - #include #include #include diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c index c1193506131c..2fc998e9b2f7 100644 --- a/drivers/media/video/bw-qcam.c +++ b/drivers/media/video/bw-qcam.c @@ -71,7 +71,6 @@ OTHER DEALINGS IN THE SOFTWARE. #include #include #include -#include #include #include #include @@ -647,7 +646,6 @@ static int qcam_querycap(struct file *file, void *priv, strlcpy(vcap->driver, qcam->v4l2_dev.name, sizeof(vcap->driver)); strlcpy(vcap->card, "B&W Quickcam", sizeof(vcap->card)); strlcpy(vcap->bus_info, "parport", sizeof(vcap->bus_info)); - vcap->version = KERNEL_VERSION(0, 0, 2); vcap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE; return 0; } @@ -1092,3 +1090,4 @@ module_init(init_bw_qcams); module_exit(exit_bw_qcams); MODULE_LICENSE("GPL"); +MODULE_VERSION("0.0.3"); diff --git a/drivers/media/video/c-qcam.c b/drivers/media/video/c-qcam.c index 24fc00965a12..b8d800e60056 100644 --- a/drivers/media/video/c-qcam.c +++ b/drivers/media/video/c-qcam.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -517,7 +516,6 @@ static int qcam_querycap(struct file *file, void *priv, strlcpy(vcap->driver, qcam->v4l2_dev.name, sizeof(vcap->driver)); strlcpy(vcap->card, "Color Quickcam", sizeof(vcap->card)); strlcpy(vcap->bus_info, "parport", sizeof(vcap->bus_info)); - vcap->version = KERNEL_VERSION(0, 0, 3); vcap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE; return 0; } @@ -886,6 +884,7 @@ static void __exit cqcam_cleanup(void) MODULE_AUTHOR("Philip Blundell "); MODULE_DESCRIPTION(BANNER); MODULE_LICENSE("GPL"); +MODULE_VERSION("0.0.4"); module_init(cqcam_init); module_exit(cqcam_cleanup); diff --git a/drivers/media/video/cpia2/cpia2.h b/drivers/media/video/cpia2/cpia2.h index 6d6d1843791c..ab252188981b 100644 --- a/drivers/media/video/cpia2/cpia2.h +++ b/drivers/media/video/cpia2/cpia2.h @@ -31,7 +31,6 @@ #ifndef __CPIA2_H__ #define __CPIA2_H__ -#include #include #include #include @@ -43,10 +42,6 @@ /* define for verbose debug output */ //#define _CPIA2_DEBUG_ -#define CPIA2_MAJ_VER 3 -#define CPIA2_MIN_VER 0 -#define CPIA2_PATCH_VER 0 - /*** * Image defines ***/ diff --git a/drivers/media/video/cpia2/cpia2_v4l.c b/drivers/media/video/cpia2/cpia2_v4l.c index 40eb6326e48a..077eb1db80a1 100644 --- a/drivers/media/video/cpia2/cpia2_v4l.c +++ b/drivers/media/video/cpia2/cpia2_v4l.c @@ -29,8 +29,7 @@ * Alan Cox ****************************************************************************/ -#include - +#define CPIA_VERSION "3.0.1" #include #include @@ -80,6 +79,7 @@ MODULE_AUTHOR("Steve Miller (STMicroelectronics) "); MODULE_DESCRIPTION("V4L-driver for STMicroelectronics CPiA2 based cameras"); MODULE_SUPPORTED_DEVICE("video"); MODULE_LICENSE("GPL"); +MODULE_VERSION(CPIA_VERSION); #define ABOUT "V4L-Driver for Vision CPiA2 based cameras" @@ -465,9 +465,6 @@ static int cpia2_querycap(struct file *file, void *fh, struct v4l2_capability *v if (usb_make_path(cam->dev, vc->bus_info, sizeof(vc->bus_info)) <0) memset(vc->bus_info,0, sizeof(vc->bus_info)); - vc->version = KERNEL_VERSION(CPIA2_MAJ_VER, CPIA2_MIN_VER, - CPIA2_PATCH_VER); - vc->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; @@ -1558,8 +1555,8 @@ static void __init check_parameters(void) *****************************************************************************/ static int __init cpia2_init(void) { - LOG("%s v%d.%d.%d\n", - ABOUT, CPIA2_MAJ_VER, CPIA2_MIN_VER, CPIA2_PATCH_VER); + LOG("%s v%s\n", + ABOUT, CPIA_VERSION); check_parameters(); cpia2_usb_init(); return 0; @@ -1579,4 +1576,3 @@ static void __exit cpia2_exit(void) module_init(cpia2_init); module_exit(cpia2_exit); - diff --git a/drivers/media/video/cx231xx/cx231xx-video.c b/drivers/media/video/cx231xx/cx231xx-video.c index a69c24d8db06..21fa54762be7 100644 --- a/drivers/media/video/cx231xx/cx231xx-video.c +++ b/drivers/media/video/cx231xx/cx231xx-video.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -45,7 +44,7 @@ #include "cx231xx.h" #include "cx231xx-vbi.h" -#define CX231XX_VERSION_CODE KERNEL_VERSION(0, 0, 1) +#define CX231XX_VERSION "0.0.2" #define DRIVER_AUTHOR "Srinivasa Deevi " #define DRIVER_DESC "Conexant cx231xx based USB video device driver" @@ -70,6 +69,7 @@ do {\ MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); +MODULE_VERSION(CX231XX_VERSION); static unsigned int card[] = {[0 ... (CX231XX_MAXBOARDS - 1)] = UNSET }; static unsigned int video_nr[] = {[0 ... (CX231XX_MAXBOARDS - 1)] = UNSET }; @@ -1869,8 +1869,6 @@ static int vidioc_querycap(struct file *file, void *priv, strlcpy(cap->card, cx231xx_boards[dev->model].name, sizeof(cap->card)); usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info)); - cap->version = CX231XX_VERSION_CODE; - cap->capabilities = V4L2_CAP_VBI_CAPTURE | #if 0 V4L2_CAP_SLICED_VBI_CAPTURE | @@ -2057,7 +2055,6 @@ static int radio_querycap(struct file *file, void *priv, strlcpy(cap->card, cx231xx_boards[dev->model].name, sizeof(cap->card)); usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info)); - cap->version = CX231XX_VERSION_CODE; cap->capabilities = V4L2_CAP_TUNER; return 0; } @@ -2570,11 +2567,8 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) { int ret; - cx231xx_info("%s: v4l2 driver version %d.%d.%d\n", - dev->name, - (CX231XX_VERSION_CODE >> 16) & 0xff, - (CX231XX_VERSION_CODE >> 8) & 0xff, - CX231XX_VERSION_CODE & 0xff); + cx231xx_info("%s: v4l2 driver version %s\n", + dev->name, CX231XX_VERSION); /* set default norm */ /*dev->norm = cx231xx_video_template.current_norm; */ diff --git a/drivers/media/video/cx231xx/cx231xx.h b/drivers/media/video/cx231xx/cx231xx.h index b39b85e732e4..c8d0d3dee798 100644 --- a/drivers/media/video/cx231xx/cx231xx.h +++ b/drivers/media/video/cx231xx/cx231xx.h @@ -114,7 +114,6 @@ V4L2_STD_PAL_BG | V4L2_STD_PAL_DK | V4L2_STD_PAL_I | \ V4L2_STD_PAL_M | V4L2_STD_PAL_N | V4L2_STD_PAL_Nc | \ V4L2_STD_PAL_60 | V4L2_STD_SECAM_L | V4L2_STD_SECAM_DK) -#define CX231xx_VERSION_CODE KERNEL_VERSION(0, 0, 2) #define SLEEP_S5H1432 30 #define CX23417_OSC_EN 8 diff --git a/drivers/media/video/cx23885/altera-ci.c b/drivers/media/video/cx23885/altera-ci.c index 678539b2acfa..1fa8927f0d36 100644 --- a/drivers/media/video/cx23885/altera-ci.c +++ b/drivers/media/video/cx23885/altera-ci.c @@ -52,7 +52,6 @@ * | DATA7| DATA6| DATA5| DATA4| DATA3| DATA2| DATA1| DATA0| * +-------+-------+-------+-------+-------+-------+-------+-------+ */ -#include #include #include #include "altera-ci.h" diff --git a/drivers/media/video/cx23885/cx23885-417.c b/drivers/media/video/cx23885/cx23885-417.c index 9a98dc55f657..67c4a59bd882 100644 --- a/drivers/media/video/cx23885/cx23885-417.c +++ b/drivers/media/video/cx23885/cx23885-417.c @@ -1359,7 +1359,6 @@ static int vidioc_querycap(struct file *file, void *priv, strlcpy(cap->card, cx23885_boards[tsport->dev->board].name, sizeof(cap->card)); sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci)); - cap->version = CX23885_VERSION_CODE; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c index 419777a832ee..ee41a8882f58 100644 --- a/drivers/media/video/cx23885/cx23885-core.c +++ b/drivers/media/video/cx23885/cx23885-core.c @@ -42,6 +42,7 @@ MODULE_DESCRIPTION("Driver for cx23885 based TV cards"); MODULE_AUTHOR("Steven Toth "); MODULE_LICENSE("GPL"); +MODULE_VERSION(CX23885_VERSION); static unsigned int debug; module_param(debug, int, 0644); @@ -2147,14 +2148,8 @@ static struct pci_driver cx23885_pci_driver = { static int __init cx23885_init(void) { - printk(KERN_INFO "cx23885 driver version %d.%d.%d loaded\n", - (CX23885_VERSION_CODE >> 16) & 0xff, - (CX23885_VERSION_CODE >> 8) & 0xff, - CX23885_VERSION_CODE & 0xff); -#ifdef SNAPSHOT - printk(KERN_INFO "cx23885: snapshot date %04d-%02d-%02d\n", - SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100); -#endif + printk(KERN_INFO "cx23885 driver version %s loaded\n", + CX23885_VERSION); return pci_register_driver(&cx23885_pci_driver); } @@ -2165,5 +2160,3 @@ static void __exit cx23885_fini(void) module_init(cx23885_init); module_exit(cx23885_fini); - -/* ----------------------------------------------------------- */ diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c index ee57f6bedbe3..896bb32dbf03 100644 --- a/drivers/media/video/cx23885/cx23885-video.c +++ b/drivers/media/video/cx23885/cx23885-video.c @@ -1000,7 +1000,6 @@ static int vidioc_querycap(struct file *file, void *priv, strlcpy(cap->card, cx23885_boards[dev->board].name, sizeof(cap->card)); sprintf(cap->bus_info, "PCIe:%s", pci_name(dev->pci)); - cap->version = CX23885_VERSION_CODE; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | diff --git a/drivers/media/video/cx23885/cx23885.h b/drivers/media/video/cx23885/cx23885.h index c186473fc570..01c3b7b8c38e 100644 --- a/drivers/media/video/cx23885/cx23885.h +++ b/drivers/media/video/cx23885/cx23885.h @@ -36,10 +36,9 @@ #include "cx23885-reg.h" #include "media/cx2341x.h" -#include #include -#define CX23885_VERSION_CODE KERNEL_VERSION(0, 0, 2) +#define CX23885_VERSION "0.0.3" #define UNSET (-1U) diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c index 423c1af8a782..68d1240f493c 100644 --- a/drivers/media/video/cx88/cx88-alsa.c +++ b/drivers/media/video/cx88/cx88-alsa.c @@ -113,6 +113,8 @@ MODULE_DESCRIPTION("ALSA driver module for cx2388x based TV cards"); MODULE_AUTHOR("Ricardo Cerqueira"); MODULE_AUTHOR("Mauro Carvalho Chehab "); MODULE_LICENSE("GPL"); +MODULE_VERSION(CX88_VERSION); + MODULE_SUPPORTED_DEVICE("{{Conexant,23881}," "{{Conexant,23882}," "{{Conexant,23883}"); @@ -973,14 +975,8 @@ static struct pci_driver cx88_audio_pci_driver = { */ static int __init cx88_audio_init(void) { - printk(KERN_INFO "cx2388x alsa driver version %d.%d.%d loaded\n", - (CX88_VERSION_CODE >> 16) & 0xff, - (CX88_VERSION_CODE >> 8) & 0xff, - CX88_VERSION_CODE & 0xff); -#ifdef SNAPSHOT - printk(KERN_INFO "cx2388x: snapshot date %04d-%02d-%02d\n", - SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100); -#endif + printk(KERN_INFO "cx2388x alsa driver version %s loaded\n", + CX88_VERSION); return pci_register_driver(&cx88_audio_pci_driver); } @@ -994,10 +990,3 @@ static void __exit cx88_audio_fini(void) module_init(cx88_audio_init); module_exit(cx88_audio_fini); - -/* ----------------------------------------------------------- */ -/* - * Local variables: - * c-basic-offset: 8 - * End: - */ diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index 11e49bbc4a66..e46446a449c0 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c @@ -42,6 +42,7 @@ MODULE_DESCRIPTION("driver for cx2388x/cx23416 based mpeg encoder cards"); MODULE_AUTHOR("Jelle Foks , Gerd Knorr [SuSE Labs]"); MODULE_LICENSE("GPL"); +MODULE_VERSION(CX88_VERSION); static unsigned int mpegbufs = 32; module_param(mpegbufs,int,0644); @@ -730,7 +731,6 @@ static int vidioc_querycap (struct file *file, void *priv, strcpy(cap->driver, "cx88_blackbird"); strlcpy(cap->card, core->board.name, sizeof(cap->card)); sprintf(cap->bus_info,"PCI:%s",pci_name(dev->pci)); - cap->version = CX88_VERSION_CODE; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | @@ -1368,14 +1368,8 @@ static struct cx8802_driver cx8802_blackbird_driver = { static int __init blackbird_init(void) { - printk(KERN_INFO "cx2388x blackbird driver version %d.%d.%d loaded\n", - (CX88_VERSION_CODE >> 16) & 0xff, - (CX88_VERSION_CODE >> 8) & 0xff, - CX88_VERSION_CODE & 0xff); -#ifdef SNAPSHOT - printk(KERN_INFO "cx2388x: snapshot date %04d-%02d-%02d\n", - SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100); -#endif + printk(KERN_INFO "cx2388x blackbird driver version %s loaded\n", + CX88_VERSION); return cx8802_register_driver(&cx8802_blackbird_driver); } @@ -1389,11 +1383,3 @@ module_exit(blackbird_fini); module_param_named(video_debug,cx8802_mpeg_template.debug, int, 0644); MODULE_PARM_DESC(debug,"enable debug messages [video]"); - -/* ----------------------------------------------------------- */ -/* - * Local variables: - * c-basic-offset: 8 - * End: - * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off - */ diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index 1ed72ce2413c..cf3d33ab541b 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c @@ -64,6 +64,7 @@ MODULE_DESCRIPTION("driver for cx2388x based DVB cards"); MODULE_AUTHOR("Chris Pascoe "); MODULE_AUTHOR("Gerd Knorr [SuSE Labs]"); MODULE_LICENSE("GPL"); +MODULE_VERSION(CX88_VERSION); static unsigned int debug; module_param(debug, int, 0644); @@ -1749,14 +1750,8 @@ static struct cx8802_driver cx8802_dvb_driver = { static int __init dvb_init(void) { - printk(KERN_INFO "cx88/2: cx2388x dvb driver version %d.%d.%d loaded\n", - (CX88_VERSION_CODE >> 16) & 0xff, - (CX88_VERSION_CODE >> 8) & 0xff, - CX88_VERSION_CODE & 0xff); -#ifdef SNAPSHOT - printk(KERN_INFO "cx2388x: snapshot date %04d-%02d-%02d\n", - SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100); -#endif + printk(KERN_INFO "cx88/2: cx2388x dvb driver version %s loaded\n", + CX88_VERSION); return cx8802_register_driver(&cx8802_dvb_driver); } @@ -1767,10 +1762,3 @@ static void __exit dvb_fini(void) module_init(dvb_init); module_exit(dvb_fini); - -/* - * Local variables: - * c-basic-offset: 8 - * compile-command: "make DVB=1" - * End: - */ diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index 1a7b983f8297..ccd8797ffc83 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c @@ -39,6 +39,7 @@ MODULE_AUTHOR("Jelle Foks "); MODULE_AUTHOR("Chris Pascoe "); MODULE_AUTHOR("Gerd Knorr [SuSE Labs]"); MODULE_LICENSE("GPL"); +MODULE_VERSION(CX88_VERSION); static unsigned int debug; module_param(debug,int,0644); @@ -890,14 +891,8 @@ static struct pci_driver cx8802_pci_driver = { static int __init cx8802_init(void) { - printk(KERN_INFO "cx88/2: cx2388x MPEG-TS Driver Manager version %d.%d.%d loaded\n", - (CX88_VERSION_CODE >> 16) & 0xff, - (CX88_VERSION_CODE >> 8) & 0xff, - CX88_VERSION_CODE & 0xff); -#ifdef SNAPSHOT - printk(KERN_INFO "cx2388x: snapshot date %04d-%02d-%02d\n", - SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100); -#endif + printk(KERN_INFO "cx88/2: cx2388x MPEG-TS Driver Manager version %s loaded\n", + CX88_VERSION); return pci_register_driver(&cx8802_pci_driver); } diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index cef4f282e5aa..1db97f3a1975 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c @@ -45,6 +45,7 @@ MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards"); MODULE_AUTHOR("Gerd Knorr [SuSE Labs]"); MODULE_LICENSE("GPL"); +MODULE_VERSION(CX88_VERSION); /* ------------------------------------------------------------------ */ @@ -1161,7 +1162,6 @@ static int vidioc_querycap (struct file *file, void *priv, strcpy(cap->driver, "cx8800"); strlcpy(cap->card, core->board.name, sizeof(cap->card)); sprintf(cap->bus_info,"PCI:%s",pci_name(dev->pci)); - cap->version = CX88_VERSION_CODE; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | @@ -1480,7 +1480,6 @@ static int radio_querycap (struct file *file, void *priv, strcpy(cap->driver, "cx8800"); strlcpy(cap->card, core->board.name, sizeof(cap->card)); sprintf(cap->bus_info,"PCI:%s", pci_name(dev->pci)); - cap->version = CX88_VERSION_CODE; cap->capabilities = V4L2_CAP_TUNER; return 0; } @@ -2139,14 +2138,8 @@ static struct pci_driver cx8800_pci_driver = { static int __init cx8800_init(void) { - printk(KERN_INFO "cx88/0: cx2388x v4l2 driver version %d.%d.%d loaded\n", - (CX88_VERSION_CODE >> 16) & 0xff, - (CX88_VERSION_CODE >> 8) & 0xff, - CX88_VERSION_CODE & 0xff); -#ifdef SNAPSHOT - printk(KERN_INFO "cx2388x: snapshot date %04d-%02d-%02d\n", - SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100); -#endif + printk(KERN_INFO "cx88/0: cx2388x v4l2 driver version %s loaded\n", + CX88_VERSION); return pci_register_driver(&cx8800_pci_driver); } @@ -2157,11 +2150,3 @@ static void __exit cx8800_fini(void) module_init(cx8800_init); module_exit(cx8800_fini); - -/* ----------------------------------------------------------- */ -/* - * Local variables: - * c-basic-offset: 8 - * End: - * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off - */ diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index 5719063d2881..425c9fbcc750 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -39,9 +39,9 @@ #include "cx88-reg.h" #include "tuner-xc2028.h" -#include #include -#define CX88_VERSION_CODE KERNEL_VERSION(0, 0, 8) + +#define CX88_VERSION "0.0.9" #define UNSET (-1U) diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 7b6461d2d1ff..d176dc0394e2 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -50,7 +49,8 @@ "Sascha Sommer " #define DRIVER_DESC "Empia em28xx based USB video device driver" -#define EM28XX_VERSION_CODE KERNEL_VERSION(0, 1, 2) + +#define EM28XX_VERSION "0.1.3" #define em28xx_videodbg(fmt, arg...) do {\ if (video_debug) \ @@ -72,6 +72,7 @@ do {\ MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); +MODULE_VERSION(EM28XX_VERSION); static unsigned int video_nr[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = UNSET }; static unsigned int vbi_nr[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = UNSET }; @@ -1757,8 +1758,6 @@ static int vidioc_querycap(struct file *file, void *priv, strlcpy(cap->card, em28xx_boards[dev->model].name, sizeof(cap->card)); usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info)); - cap->version = EM28XX_VERSION_CODE; - cap->capabilities = V4L2_CAP_SLICED_VBI_CAPTURE | V4L2_CAP_VIDEO_CAPTURE | @@ -1976,7 +1975,6 @@ static int radio_querycap(struct file *file, void *priv, strlcpy(cap->card, em28xx_boards[dev->model].name, sizeof(cap->card)); usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info)); - cap->version = EM28XX_VERSION_CODE; cap->capabilities = V4L2_CAP_TUNER; return 0; } @@ -2450,10 +2448,8 @@ int em28xx_register_analog_devices(struct em28xx *dev) u8 val; int ret; - printk(KERN_INFO "%s: v4l2 driver version %d.%d.%d\n", - dev->name, - (EM28XX_VERSION_CODE >> 16) & 0xff, - (EM28XX_VERSION_CODE >> 8) & 0xff, EM28XX_VERSION_CODE & 0xff); + printk(KERN_INFO "%s: v4l2 driver version %s\n", + dev->name, EM28XX_VERSION); /* set default norm */ dev->norm = em28xx_video_template.current_norm; diff --git a/drivers/media/video/gspca/gl860/gl860.h b/drivers/media/video/gspca/gl860/gl860.h index 49ad4acbf602..0330a0293b9c 100644 --- a/drivers/media/video/gspca/gl860/gl860.h +++ b/drivers/media/video/gspca/gl860/gl860.h @@ -18,7 +18,6 @@ */ #ifndef GL860_DEV_H #define GL860_DEV_H -#include #include "gspca.h" diff --git a/drivers/media/video/hdpvr/hdpvr-core.c b/drivers/media/video/hdpvr/hdpvr-core.c index a27d93b503a5..5442a1732260 100644 --- a/drivers/media/video/hdpvr/hdpvr-core.c +++ b/drivers/media/video/hdpvr/hdpvr-core.c @@ -474,5 +474,6 @@ module_init(hdpvr_init); module_exit(hdpvr_exit); MODULE_LICENSE("GPL"); +MODULE_VERSION("0.2.1"); MODULE_AUTHOR("Janne Grunau"); MODULE_DESCRIPTION("Hauppauge HD PVR driver"); diff --git a/drivers/media/video/hdpvr/hdpvr-video.c b/drivers/media/video/hdpvr/hdpvr-video.c index 514aea76eaa5..087f7c08cb85 100644 --- a/drivers/media/video/hdpvr/hdpvr-video.c +++ b/drivers/media/video/hdpvr/hdpvr-video.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include @@ -574,7 +573,6 @@ static int vidioc_querycap(struct file *file, void *priv, strcpy(cap->driver, "hdpvr"); strcpy(cap->card, "Hauppauge HD PVR"); usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info)); - cap->version = HDPVR_VERSION; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE; diff --git a/drivers/media/video/hdpvr/hdpvr.h b/drivers/media/video/hdpvr/hdpvr.h index 072f23c570f3..d6439db1d18b 100644 --- a/drivers/media/video/hdpvr/hdpvr.h +++ b/drivers/media/video/hdpvr/hdpvr.h @@ -18,12 +18,6 @@ #include #include -#define HDPVR_MAJOR_VERSION 0 -#define HDPVR_MINOR_VERSION 2 -#define HDPVR_RELEASE 0 -#define HDPVR_VERSION \ - KERNEL_VERSION(HDPVR_MAJOR_VERSION, HDPVR_MINOR_VERSION, HDPVR_RELEASE) - #define HDPVR_MAX 8 #define HDPVR_I2C_MAX_SIZE 128 diff --git a/drivers/media/video/mem2mem_testdev.c b/drivers/media/video/mem2mem_testdev.c index b03d74e09a3c..166bf9349c10 100644 --- a/drivers/media/video/mem2mem_testdev.c +++ b/drivers/media/video/mem2mem_testdev.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -35,7 +34,7 @@ MODULE_DESCRIPTION("Virtual device for mem2mem framework testing"); MODULE_AUTHOR("Pawel Osciak, "); MODULE_LICENSE("GPL"); - +MODULE_VERSION("0.1.1"); #define MIN_W 32 #define MIN_H 32 @@ -380,7 +379,6 @@ static int vidioc_querycap(struct file *file, void *priv, strncpy(cap->driver, MEM2MEM_NAME, sizeof(cap->driver) - 1); strncpy(cap->card, MEM2MEM_NAME, sizeof(cap->card) - 1); cap->bus_info[0] = 0; - cap->version = KERNEL_VERSION(0, 1, 0); cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING; diff --git a/drivers/media/video/pms.c b/drivers/media/video/pms.c index 7551907f8c28..e753b5e4d2ce 100644 --- a/drivers/media/video/pms.c +++ b/drivers/media/video/pms.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -39,7 +38,7 @@ #include MODULE_LICENSE("GPL"); - +MODULE_VERSION("0.0.4"); #define MOTOROLA 1 #define PHILIPS2 2 /* SAA7191 */ @@ -678,7 +677,6 @@ static int pms_querycap(struct file *file, void *priv, strlcpy(vcap->driver, dev->v4l2_dev.name, sizeof(vcap->driver)); strlcpy(vcap->card, "Mediavision PMS", sizeof(vcap->card)); strlcpy(vcap->bus_info, "ISA", sizeof(vcap->bus_info)); - vcap->version = KERNEL_VERSION(0, 0, 3); vcap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE; return 0; } diff --git a/drivers/media/video/pwc/pwc-ioctl.h b/drivers/media/video/pwc/pwc-ioctl.h index 8c0cae7b3daf..b74fea0a8d34 100644 --- a/drivers/media/video/pwc/pwc-ioctl.h +++ b/drivers/media/video/pwc/pwc-ioctl.h @@ -52,7 +52,6 @@ */ #include -#include /* Enumeration of image sizes */ #define PSZ_SQCIF 0x00 diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h index 083f8b15df73..f5445d960510 100644 --- a/drivers/media/video/pwc/pwc.h +++ b/drivers/media/video/pwc/pwc.h @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -47,9 +46,10 @@ /* Version block */ #define PWC_MAJOR 10 #define PWC_MINOR 0 -#define PWC_EXTRAMINOR 12 -#define PWC_VERSION_CODE KERNEL_VERSION(PWC_MAJOR,PWC_MINOR,PWC_EXTRAMINOR) -#define PWC_VERSION "10.0.14" +#define PWC_EXTRAMINOR 15 + +#define PWC_VERSION_CODE KERNEL_VERSION(PWC_MAJOR, PWC_MINOR, PWC_EXTRAMINOR) +#define PWC_VERSION __stringify(PWC_MAJOR) "." __stringify(PWC_MINOR) "." __stringify(PWC_EXTRAMINOR) #define PWC_NAME "pwc" #define PFX PWC_NAME ": " diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index f9be737ba6f4..ca65cda3e101 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c @@ -39,6 +39,8 @@ MODULE_DESCRIPTION("v4l2 driver module for saa7130/34 based TV cards"); MODULE_AUTHOR("Gerd Knorr [SuSE Labs]"); MODULE_LICENSE("GPL"); +MODULE_VERSION(SAA7134_VERSION); + /* ------------------------------------------------------------------ */ @@ -1332,14 +1334,8 @@ static struct pci_driver saa7134_pci_driver = { static int __init saa7134_init(void) { INIT_LIST_HEAD(&saa7134_devlist); - printk(KERN_INFO "saa7130/34: v4l2 driver version %d.%d.%d loaded\n", - (SAA7134_VERSION_CODE >> 16) & 0xff, - (SAA7134_VERSION_CODE >> 8) & 0xff, - SAA7134_VERSION_CODE & 0xff); -#ifdef SNAPSHOT - printk(KERN_INFO "saa7130/34: snapshot date %04d-%02d-%02d\n", - SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100); -#endif + printk(KERN_INFO "saa7130/34: v4l2 driver version %s loaded\n", + SAA7134_VERSION); return pci_register_driver(&saa7134_pci_driver); } diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index 18294db38a01..dde361a9194e 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c @@ -172,7 +172,6 @@ static int empress_querycap(struct file *file, void *priv, strlcpy(cap->card, saa7134_boards[dev->board].name, sizeof(cap->card)); sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci)); - cap->version = SAA7134_VERSION_CODE; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 776ba2dd7f9f..9cf7914f6f90 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c @@ -1810,7 +1810,6 @@ static int saa7134_querycap(struct file *file, void *priv, strlcpy(cap->card, saa7134_boards[dev->board].name, sizeof(cap->card)); sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci)); - cap->version = SAA7134_VERSION_CODE; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VBI_CAPTURE | @@ -2307,7 +2306,6 @@ static int radio_querycap(struct file *file, void *priv, strcpy(cap->driver, "saa7134"); strlcpy(cap->card, saa7134_boards[dev->board].name, sizeof(cap->card)); sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci)); - cap->version = SAA7134_VERSION_CODE; cap->capabilities = V4L2_CAP_TUNER; return 0; } diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 28eb10398323..bc8d6bba8ee5 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -19,8 +19,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#define SAA7134_VERSION_CODE KERNEL_VERSION(0, 2, 16) +#define SAA7134_VERSION "0, 2, 17" #include #include diff --git a/drivers/media/video/saa7164/saa7164.h b/drivers/media/video/saa7164/saa7164.h index 16745d2fb349..6678bf1e7816 100644 --- a/drivers/media/video/saa7164/saa7164.h +++ b/drivers/media/video/saa7164/saa7164.h @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/media/video/timblogiw.c b/drivers/media/video/timblogiw.c index fc611ebeb82c..84cd1b65b765 100644 --- a/drivers/media/video/timblogiw.c +++ b/drivers/media/video/timblogiw.c @@ -20,7 +20,6 @@ * Timberdale FPGA LogiWin Video In */ -#include #include #include #include diff --git a/drivers/media/video/tlg2300/pd-common.h b/drivers/media/video/tlg2300/pd-common.h index 46066bdc73f9..56564e6aaac2 100644 --- a/drivers/media/video/tlg2300/pd-common.h +++ b/drivers/media/video/tlg2300/pd-common.h @@ -1,7 +1,6 @@ #ifndef PD_COMMON_H #define PD_COMMON_H -#include #include #include #include diff --git a/drivers/media/video/tlg2300/pd-main.c b/drivers/media/video/tlg2300/pd-main.c index 99c81a9a4f46..129f135d5a5f 100644 --- a/drivers/media/video/tlg2300/pd-main.c +++ b/drivers/media/video/tlg2300/pd-main.c @@ -531,3 +531,4 @@ module_exit(poseidon_exit); MODULE_AUTHOR("Telegent Systems"); MODULE_DESCRIPTION("For tlg2300-based USB device "); MODULE_LICENSE("GPL"); +MODULE_VERSION("0.0.2"); diff --git a/drivers/media/video/tlg2300/pd-radio.c b/drivers/media/video/tlg2300/pd-radio.c index fae84c2a0c39..4fad1dfb92cf 100644 --- a/drivers/media/video/tlg2300/pd-radio.c +++ b/drivers/media/video/tlg2300/pd-radio.c @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include @@ -149,7 +148,6 @@ static int vidioc_querycap(struct file *file, void *priv, strlcpy(v->driver, "tele-radio", sizeof(v->driver)); strlcpy(v->card, "Telegent Poseidon", sizeof(v->card)); usb_make_path(p->udev, v->bus_info, sizeof(v->bus_info)); - v->version = KERNEL_VERSION(0, 0, 1); v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO; return 0; } diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index ea8ea8a48dfe..5a74f5e07d7d 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c @@ -45,7 +45,6 @@ * */ -#include #include #include #include @@ -77,15 +76,7 @@ #define DRIVER_ALIAS "USBVision" #define DRIVER_DESC "USBVision USB Video Device Driver for Linux" #define DRIVER_LICENSE "GPL" -#define USBVISION_DRIVER_VERSION_MAJOR 0 -#define USBVISION_DRIVER_VERSION_MINOR 9 -#define USBVISION_DRIVER_VERSION_PATCHLEVEL 10 -#define USBVISION_DRIVER_VERSION KERNEL_VERSION(USBVISION_DRIVER_VERSION_MAJOR,\ -USBVISION_DRIVER_VERSION_MINOR,\ -USBVISION_DRIVER_VERSION_PATCHLEVEL) -#define USBVISION_VERSION_STRING __stringify(USBVISION_DRIVER_VERSION_MAJOR) \ -"." __stringify(USBVISION_DRIVER_VERSION_MINOR) \ -"." __stringify(USBVISION_DRIVER_VERSION_PATCHLEVEL) +#define USBVISION_VERSION_STRING "0.9.11" #define ENABLE_HEXDUMP 0 /* Enable if you need it */ @@ -516,7 +507,6 @@ static int vidioc_querycap(struct file *file, void *priv, usbvision_device_data[usbvision->dev_model].model_string, sizeof(vc->card)); usb_make_path(usbvision->dev, vc->bus_info, sizeof(vc->bus_info)); - vc->version = USBVISION_DRIVER_VERSION; vc->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | diff --git a/drivers/media/video/vino.c b/drivers/media/video/vino.c index d63e9d978493..52a0a3736c82 100644 --- a/drivers/media/video/vino.c +++ b/drivers/media/video/vino.c @@ -36,7 +36,6 @@ #include #include #include -#include #include #include @@ -61,8 +60,7 @@ // #define VINO_DEBUG // #define VINO_DEBUG_INT -#define VINO_MODULE_VERSION "0.0.6" -#define VINO_VERSION_CODE KERNEL_VERSION(0, 0, 6) +#define VINO_MODULE_VERSION "0.0.7" MODULE_DESCRIPTION("SGI VINO Video4Linux2 driver"); MODULE_VERSION(VINO_MODULE_VERSION); @@ -2934,7 +2932,6 @@ static int vino_querycap(struct file *file, void *__fh, strcpy(cap->driver, vino_driver_name); strcpy(cap->card, vino_driver_description); strcpy(cap->bus_info, vino_bus_name); - cap->version = VINO_VERSION_CODE; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index 2238a613d664..3b9db8cbe41c 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -44,15 +43,12 @@ #define MAX_WIDTH 1920 #define MAX_HEIGHT 1200 -#define VIVI_MAJOR_VERSION 0 -#define VIVI_MINOR_VERSION 8 -#define VIVI_RELEASE 0 -#define VIVI_VERSION \ - KERNEL_VERSION(VIVI_MAJOR_VERSION, VIVI_MINOR_VERSION, VIVI_RELEASE) +#define VIVI_VERSION "0.8.1" MODULE_DESCRIPTION("Video Technology Magazine Virtual Video Capture Board"); MODULE_AUTHOR("Mauro Carvalho Chehab, Ted Walther and John Sokol"); MODULE_LICENSE("Dual BSD/GPL"); +MODULE_VERSION(VIVI_VERSION); static unsigned video_nr = -1; module_param(video_nr, uint, 0644); @@ -812,7 +808,6 @@ static int vidioc_querycap(struct file *file, void *priv, strcpy(cap->driver, "vivi"); strcpy(cap->card, "vivi"); strlcpy(cap->bus_info, dev->v4l2_dev.name, sizeof(cap->bus_info)); - cap->version = VIVI_VERSION; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING | \ V4L2_CAP_READWRITE; return 0; @@ -1325,9 +1320,8 @@ static int __init vivi_init(void) } printk(KERN_INFO "Video Technology Magazine Virtual Video " - "Capture Board ver %u.%u.%u successfully loaded.\n", - (VIVI_VERSION >> 16) & 0xFF, (VIVI_VERSION >> 8) & 0xFF, - VIVI_VERSION & 0xFF); + "Capture Board ver %s successfully loaded.\n", + VIVI_VERSION); /* n_devs will reflect the actual number of allocated devices */ n_devs = i; diff --git a/drivers/media/video/w9966.c b/drivers/media/video/w9966.c index fa35639d0c15..453dbbd1e6e8 100644 --- a/drivers/media/video/w9966.c +++ b/drivers/media/video/w9966.c @@ -57,7 +57,6 @@ #include #include #include -#include #include #include #include @@ -127,7 +126,7 @@ struct w9966 { MODULE_AUTHOR("Jakob Kemi "); MODULE_DESCRIPTION("Winbond w9966cf WebCam driver (0.32)"); MODULE_LICENSE("GPL"); - +MODULE_VERSION("0.33.1"); #ifdef MODULE static const char *pardev[] = {[0 ... W9966_MAXCAMS] = ""}; @@ -568,7 +567,6 @@ static int cam_querycap(struct file *file, void *priv, strlcpy(vcap->driver, cam->v4l2_dev.name, sizeof(vcap->driver)); strlcpy(vcap->card, W9966_DRIVERNAME, sizeof(vcap->card)); strlcpy(vcap->bus_info, "parport", sizeof(vcap->bus_info)); - vcap->version = KERNEL_VERSION(0, 33, 0); vcap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE; return 0; } diff --git a/drivers/media/video/zoran/zoran.h b/drivers/media/video/zoran/zoran.h index f3f640014928..d7166afc255e 100644 --- a/drivers/media/video/zoran/zoran.h +++ b/drivers/media/video/zoran/zoran.h @@ -41,10 +41,6 @@ struct zoran_sync { }; -#define MAJOR_VERSION 0 /* driver major version */ -#define MINOR_VERSION 10 /* driver minor version */ -#define RELEASE_VERSION 0 /* release version */ - #define ZORAN_NAME "ZORAN" /* name of the device */ #define ZR_DEVNAME(zr) ((zr)->name) diff --git a/drivers/media/video/zoran/zoran_card.c b/drivers/media/video/zoran/zoran_card.c index 79b04ac0f1ad..c3602d6cd48e 100644 --- a/drivers/media/video/zoran/zoran_card.c +++ b/drivers/media/video/zoran/zoran_card.c @@ -123,9 +123,12 @@ int zr36067_debug = 1; module_param_named(debug, zr36067_debug, int, 0644); MODULE_PARM_DESC(debug, "Debug level (0-5)"); +#define ZORAN_VERSION "0.10.1" + MODULE_DESCRIPTION("Zoran-36057/36067 JPEG codec driver"); MODULE_AUTHOR("Serguei Miridonov"); MODULE_LICENSE("GPL"); +MODULE_VERSION(ZORAN_VERSION); #define ZR_DEVICE(subven, subdev, data) { \ .vendor = PCI_VENDOR_ID_ZORAN, .device = PCI_DEVICE_ID_ZORAN_36057, \ @@ -1459,8 +1462,8 @@ static int __init zoran_init(void) { int res; - printk(KERN_INFO "Zoran MJPEG board driver version %d.%d.%d\n", - MAJOR_VERSION, MINOR_VERSION, RELEASE_VERSION); + printk(KERN_INFO "Zoran MJPEG board driver version %s\n", + ZORAN_VERSION); /* check the parameters we have been given, adjust if necessary */ if (v4l_nbufs < 2) diff --git a/drivers/media/video/zoran/zoran_driver.c b/drivers/media/video/zoran/zoran_driver.c index 2771d818406e..d4d05d2ace65 100644 --- a/drivers/media/video/zoran/zoran_driver.c +++ b/drivers/media/video/zoran/zoran_driver.c @@ -44,7 +44,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include #include #include #include @@ -1538,8 +1537,6 @@ static int zoran_querycap(struct file *file, void *__fh, struct v4l2_capability strncpy(cap->driver, "zoran", sizeof(cap->driver)-1); snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s", pci_name(zr->pci_dev)); - cap->version = KERNEL_VERSION(MAJOR_VERSION, MINOR_VERSION, - RELEASE_VERSION); cap->capabilities = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_VIDEO_OVERLAY; return 0; diff --git a/drivers/media/video/zr364xx.c b/drivers/media/video/zr364xx.c index 7dfb01e9930e..c492846c1c5a 100644 --- a/drivers/media/video/zr364xx.c +++ b/drivers/media/video/zr364xx.c @@ -29,7 +29,6 @@ #include -#include #include #include #include @@ -42,8 +41,7 @@ /* Version Information */ -#define DRIVER_VERSION "v0.73" -#define ZR364XX_VERSION_CODE KERNEL_VERSION(0, 7, 3) +#define DRIVER_VERSION "0.7.4" #define DRIVER_AUTHOR "Antoine Jacquet, http://royale.zerezo.com/" #define DRIVER_DESC "Zoran 364xx" @@ -744,7 +742,6 @@ static int zr364xx_vidioc_querycap(struct file *file, void *priv, strlcpy(cap->card, cam->udev->product, sizeof(cap->card)); strlcpy(cap->bus_info, dev_name(&cam->udev->dev), sizeof(cap->bus_info)); - cap->version = ZR364XX_VERSION_CODE; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; @@ -1721,3 +1718,4 @@ module_exit(zr364xx_exit); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); +MODULE_VERSION(DRIVER_VERSION); -- cgit v1.2.3 From 880c35c5850464c934f02a5ec7d4c1a4df386fce Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 25 Jun 2011 10:07:39 -0300 Subject: [media] pwc: Use the default version for VIDIOC_QUERYCAP After discussing with Hans, change pwc to use the default version control. The only version ever used for pwc driver is 10.0.12, due to commit 2b455db6d456ef2d44808a8377fd3bc832e08317. Changing it to 3.x.y won't conflict with the old version. There's no namespace conflicts in any predictable future. Even on the remote far-away case where we might have a conflict, it will be on just one specific stable Kernel release (Kernel 10.0.12), if we ever have such stable release. So, it is safe and consistent on using 3.x.y numering schema for it. Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pwc/pwc-v4l.c | 1 - drivers/media/video/pwc/pwc.h | 7 +------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c index f85c51249c7b..059bd95c1225 100644 --- a/drivers/media/video/pwc/pwc-v4l.c +++ b/drivers/media/video/pwc/pwc-v4l.c @@ -349,7 +349,6 @@ static int pwc_querycap(struct file *file, void *fh, struct v4l2_capability *cap strcpy(cap->driver, PWC_NAME); strlcpy(cap->card, vdev->name, sizeof(cap->card)); usb_make_path(pdev->udev, cap->bus_info, sizeof(cap->bus_info)); - cap->version = PWC_VERSION_CODE; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING | diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h index f5445d960510..33863b91461c 100644 --- a/drivers/media/video/pwc/pwc.h +++ b/drivers/media/video/pwc/pwc.h @@ -44,12 +44,7 @@ #include /* Version block */ -#define PWC_MAJOR 10 -#define PWC_MINOR 0 -#define PWC_EXTRAMINOR 15 - -#define PWC_VERSION_CODE KERNEL_VERSION(PWC_MAJOR, PWC_MINOR, PWC_EXTRAMINOR) -#define PWC_VERSION __stringify(PWC_MAJOR) "." __stringify(PWC_MINOR) "." __stringify(PWC_EXTRAMINOR) +#define PWC_VERSION "10.0.15" #define PWC_NAME "pwc" #define PFX PWC_NAME ": " -- cgit v1.2.3 From 3c2d464ee8a967ecb2d820ddec42ea431f8bf3b4 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 25 Jun 2011 11:23:01 -0300 Subject: [media] ivtv,cx18: Use default version control for VIDIOC_QUERYCAP After discussing with Andy Walls on irc, we've agreed that this is the best thing to do. No regressions will be introduced, as 3.x.y is greater then the current versions for cx18 and ivtv. Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx18/cx18-driver.h | 1 - drivers/media/video/cx18/cx18-ioctl.c | 1 - drivers/media/video/cx18/cx18-version.h | 8 +------- drivers/media/video/ivtv/ivtv-driver.h | 1 - drivers/media/video/ivtv/ivtv-ioctl.c | 1 - drivers/media/video/ivtv/ivtv-version.h | 7 +------ 6 files changed, 2 insertions(+), 17 deletions(-) diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h index 086427288de8..183420723060 100644 --- a/drivers/media/video/cx18/cx18-driver.h +++ b/drivers/media/video/cx18/cx18-driver.h @@ -25,7 +25,6 @@ #ifndef CX18_DRIVER_H #define CX18_DRIVER_H -#include #include #include #include diff --git a/drivers/media/video/cx18/cx18-ioctl.c b/drivers/media/video/cx18/cx18-ioctl.c index e80134f52ef5..afe0a29e7200 100644 --- a/drivers/media/video/cx18/cx18-ioctl.c +++ b/drivers/media/video/cx18/cx18-ioctl.c @@ -469,7 +469,6 @@ static int cx18_querycap(struct file *file, void *fh, strlcpy(vcap->card, cx->card_name, sizeof(vcap->card)); snprintf(vcap->bus_info, sizeof(vcap->bus_info), "PCI:%s", pci_name(cx->pci_dev)); - vcap->version = CX18_DRIVER_VERSION; /* version */ vcap->capabilities = cx->v4l2_cap; /* capabilities */ return 0; } diff --git a/drivers/media/video/cx18/cx18-version.h b/drivers/media/video/cx18/cx18-version.h index cd189b6bbe20..fed48b6bb67b 100644 --- a/drivers/media/video/cx18/cx18-version.h +++ b/drivers/media/video/cx18/cx18-version.h @@ -23,12 +23,6 @@ #define CX18_VERSION_H #define CX18_DRIVER_NAME "cx18" -#define CX18_DRIVER_VERSION_MAJOR 1 -#define CX18_DRIVER_VERSION_MINOR 5 -#define CX18_DRIVER_VERSION_PATCHLEVEL 0 - -#define CX18_VERSION __stringify(CX18_DRIVER_VERSION_MAJOR) "." __stringify(CX18_DRIVER_VERSION_MINOR) "." __stringify(CX18_DRIVER_VERSION_PATCHLEVEL) -#define CX18_DRIVER_VERSION KERNEL_VERSION(CX18_DRIVER_VERSION_MAJOR, \ - CX18_DRIVER_VERSION_MINOR, CX18_DRIVER_VERSION_PATCHLEVEL) +#define CX18_VERSION "1.5.1" #endif diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h index 84bdf0f42a8e..8f9cc17b518e 100644 --- a/drivers/media/video/ivtv/ivtv-driver.h +++ b/drivers/media/video/ivtv/ivtv-driver.h @@ -36,7 +36,6 @@ * using information provided by Jiun-Kuei Jung @ AVerMedia. */ -#include #include #include #include diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 120c7d8e0895..707399893de1 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c @@ -757,7 +757,6 @@ static int ivtv_querycap(struct file *file, void *fh, struct v4l2_capability *vc strlcpy(vcap->driver, IVTV_DRIVER_NAME, sizeof(vcap->driver)); strlcpy(vcap->card, itv->card_name, sizeof(vcap->card)); snprintf(vcap->bus_info, sizeof(vcap->bus_info), "PCI:%s", pci_name(itv->pdev)); - vcap->version = IVTV_DRIVER_VERSION; /* version */ vcap->capabilities = itv->v4l2_cap; /* capabilities */ return 0; } diff --git a/drivers/media/video/ivtv/ivtv-version.h b/drivers/media/video/ivtv/ivtv-version.h index b67a4048f5aa..a20f346fcad8 100644 --- a/drivers/media/video/ivtv/ivtv-version.h +++ b/drivers/media/video/ivtv/ivtv-version.h @@ -21,11 +21,6 @@ #define IVTV_VERSION_H #define IVTV_DRIVER_NAME "ivtv" -#define IVTV_DRIVER_VERSION_MAJOR 1 -#define IVTV_DRIVER_VERSION_MINOR 4 -#define IVTV_DRIVER_VERSION_PATCHLEVEL 2 - -#define IVTV_VERSION __stringify(IVTV_DRIVER_VERSION_MAJOR) "." __stringify(IVTV_DRIVER_VERSION_MINOR) "." __stringify(IVTV_DRIVER_VERSION_PATCHLEVEL) -#define IVTV_DRIVER_VERSION KERNEL_VERSION(IVTV_DRIVER_VERSION_MAJOR,IVTV_DRIVER_VERSION_MINOR,IVTV_DRIVER_VERSION_PATCHLEVEL) +#define IVTV_VERSION "1.4.3" #endif -- cgit v1.2.3 From 5204cebadd09c5bd7e4fc194b9dfaba9e40c0361 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 25 Jun 2011 12:57:04 -0300 Subject: [media] et61x251: Use LINUX_VERSION_CODE for VIDIOC_QUERYCAP et61x251 doesn't use vidioc_ioctl2. As the API is changing to use a common version for all drivers, we need to expliticly fix this driver. Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/et61x251/et61x251.h | 1 - drivers/media/video/et61x251/et61x251_core.c | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/et61x251/et61x251.h b/drivers/media/video/et61x251/et61x251.h index bf66189cb26d..14bb907d650e 100644 --- a/drivers/media/video/et61x251/et61x251.h +++ b/drivers/media/video/et61x251/et61x251.h @@ -21,7 +21,6 @@ #ifndef _ET61X251_H_ #define _ET61X251_H_ -#include #include #include #include diff --git a/drivers/media/video/et61x251/et61x251_core.c b/drivers/media/video/et61x251/et61x251_core.c index a982750dcef1..d7efb332d4e3 100644 --- a/drivers/media/video/et61x251/et61x251_core.c +++ b/drivers/media/video/et61x251/et61x251_core.c @@ -18,6 +18,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * ***************************************************************************/ +#include #include #include #include @@ -48,8 +49,7 @@ #define ET61X251_MODULE_AUTHOR "(C) 2006-2007 Luca Risolia" #define ET61X251_AUTHOR_EMAIL "" #define ET61X251_MODULE_LICENSE "GPL" -#define ET61X251_MODULE_VERSION "1:1.09" -#define ET61X251_MODULE_VERSION_CODE KERNEL_VERSION(1, 1, 9) +#define ET61X251_MODULE_VERSION "1.1.10" /*****************************************************************************/ @@ -1579,7 +1579,7 @@ et61x251_vidioc_querycap(struct et61x251_device* cam, void __user * arg) { struct v4l2_capability cap = { .driver = "et61x251", - .version = ET61X251_MODULE_VERSION_CODE, + .version = LINUX_VERSION_CODE, .capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | V4L2_CAP_STREAMING, }; -- cgit v1.2.3 From 083774d8b164b87c5595ead0b752236cfd5bf761 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 25 Jun 2011 13:34:24 -0300 Subject: [media] pvrusb2: Use LINUX_VERSION_CODE for VIDIOC_QUERYCAP pvrusb2 doesn't use vidioc_ioctl2. As the API is changing to use a common version for all drivers, we need to expliticly fix this driver. Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pvrusb2/pvrusb2-main.c | 1 + drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/pvrusb2/pvrusb2-main.c b/drivers/media/video/pvrusb2/pvrusb2-main.c index 2254194aad57..c1d9bb61cd77 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-main.c +++ b/drivers/media/video/pvrusb2/pvrusb2-main.c @@ -168,6 +168,7 @@ module_exit(pvr_exit); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); +MODULE_VERSION("0.9.1"); /* diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index 38761142a4d9..573749ab96f5 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c @@ -91,7 +91,7 @@ static struct v4l2_capability pvr_capability ={ .driver = "pvrusb2", .card = "Hauppauge WinTV pvr-usb2", .bus_info = "usb", - .version = KERNEL_VERSION(0, 9, 0), + .version = LINUX_VERSION_CODE, .capabilities = (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER | V4L2_CAP_AUDIO | V4L2_CAP_RADIO | V4L2_CAP_READWRITE), -- cgit v1.2.3 From 6c13b45e57c3b719328e1ead30b07583419ad9a1 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 25 Jun 2011 13:43:22 -0300 Subject: [media] sn9c102: Use LINUX_VERSION_CODE for VIDIOC_QUERYCAP sn9c102 doesn't use vidioc_ioctl2. As the API is changing to use a common version for all drivers, we need to expliticly fix this driver. Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/sn9c102/sn9c102.h | 1 - drivers/media/video/sn9c102/sn9c102_core.c | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/sn9c102/sn9c102.h b/drivers/media/video/sn9c102/sn9c102.h index cbfc44433b99..22ea211ab54f 100644 --- a/drivers/media/video/sn9c102/sn9c102.h +++ b/drivers/media/video/sn9c102/sn9c102.h @@ -21,7 +21,6 @@ #ifndef _SN9C102_H_ #define _SN9C102_H_ -#include #include #include #include diff --git a/drivers/media/video/sn9c102/sn9c102_core.c b/drivers/media/video/sn9c102/sn9c102_core.c index 0e07c493e6f0..d8eece8bba24 100644 --- a/drivers/media/video/sn9c102/sn9c102_core.c +++ b/drivers/media/video/sn9c102/sn9c102_core.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -47,8 +48,7 @@ #define SN9C102_MODULE_AUTHOR "(C) 2004-2007 Luca Risolia" #define SN9C102_AUTHOR_EMAIL "" #define SN9C102_MODULE_LICENSE "GPL" -#define SN9C102_MODULE_VERSION "1:1.47pre49" -#define SN9C102_MODULE_VERSION_CODE KERNEL_VERSION(1, 1, 47) +#define SN9C102_MODULE_VERSION "1:1.48" /*****************************************************************************/ @@ -2158,7 +2158,7 @@ sn9c102_vidioc_querycap(struct sn9c102_device* cam, void __user * arg) { struct v4l2_capability cap = { .driver = "sn9c102", - .version = SN9C102_MODULE_VERSION_CODE, + .version = LINUX_VERSION_CODE, .capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | V4L2_CAP_STREAMING, }; -- cgit v1.2.3 From fd3e5824824d1beaf376cd523c7418c5570851d4 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 25 Jun 2011 13:50:37 -0300 Subject: [media] uvcvideo: Use LINUX_VERSION_CODE for VIDIOC_QUERYCAP uvcvideo doesn't use vidioc_ioctl2. As the API is changing to use a common version for all drivers, we need to expliticly fix this driver. Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/uvc/uvc_driver.c | 3 ++- drivers/media/video/uvc/uvc_v4l2.c | 2 +- drivers/media/video/uvc/uvcvideo.h | 3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/uvc/uvc_driver.c b/drivers/media/video/uvc/uvc_driver.c index b6eae48d7fb8..749c72222665 100644 --- a/drivers/media/video/uvc/uvc_driver.c +++ b/drivers/media/video/uvc/uvc_driver.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -1857,7 +1858,7 @@ static int uvc_probe(struct usb_interface *intf, sizeof(dev->mdev.serial)); strcpy(dev->mdev.bus_info, udev->devpath); dev->mdev.hw_revision = le16_to_cpu(udev->descriptor.bcdDevice); - dev->mdev.driver_version = DRIVER_VERSION_NUMBER; + dev->mdev.driver_version = LINUX_VERSION_CODE; if (media_device_register(&dev->mdev) < 0) goto error; diff --git a/drivers/media/video/uvc/uvc_v4l2.c b/drivers/media/video/uvc/uvc_v4l2.c index 543a80395b7f..cdd967b0a2e9 100644 --- a/drivers/media/video/uvc/uvc_v4l2.c +++ b/drivers/media/video/uvc/uvc_v4l2.c @@ -571,7 +571,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) strlcpy(cap->card, vdev->name, sizeof cap->card); usb_make_path(stream->dev->udev, cap->bus_info, sizeof(cap->bus_info)); - cap->version = DRIVER_VERSION_NUMBER; + cap->version = LINUX_VERSION_CODE; if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; diff --git a/drivers/media/video/uvc/uvcvideo.h b/drivers/media/video/uvc/uvcvideo.h index 20107fd3574d..df32a43ca86a 100644 --- a/drivers/media/video/uvc/uvcvideo.h +++ b/drivers/media/video/uvc/uvcvideo.h @@ -183,8 +183,7 @@ struct uvc_xu_control { * Driver specific constants. */ -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(1, 1, 0) -#define DRIVER_VERSION "v1.1.0" +#define DRIVER_VERSION "1.1.1" /* Number of isochronous URBs. */ #define UVC_URBS 5 -- cgit v1.2.3 From b0eaab765794bf4fdf060c74b21c9851ba3c6907 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 27 Jun 2011 22:28:38 -0300 Subject: [media] gspca: don't include linux/version.h Instead of handling a per-driver driver version, use the per-subsystem one. As reviewed by Jean-Francois Moine : - the 'info' may be simplified: Reviewed-by: Jean-Francois Moine Acked-by: Hans Verkuil Acked-by: Jean-Francois Moine Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/gspca.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index 08ce9948d99b..d0b79a9f88b7 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c @@ -24,7 +24,6 @@ #define MODULE_NAME "gspca" #include -#include #include #include #include @@ -51,11 +50,12 @@ #error "DEF_NURBS too big" #endif +#define DRIVER_VERSION_NUMBER "2.13.0" + MODULE_AUTHOR("Jean-François Moine "); MODULE_DESCRIPTION("GSPCA USB Camera Driver"); MODULE_LICENSE("GPL"); - -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 13, 0) +MODULE_VERSION(DRIVER_VERSION_NUMBER); #ifdef GSPCA_DEBUG int gspca_debug = D_ERR | D_PROBE; @@ -1291,7 +1291,6 @@ static int vidioc_querycap(struct file *file, void *priv, } usb_make_path(gspca_dev->dev, (char *) cap->bus_info, sizeof(cap->bus_info)); - cap->version = DRIVER_VERSION_NUMBER; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING | V4L2_CAP_READWRITE; @@ -2478,10 +2477,7 @@ EXPORT_SYMBOL(gspca_auto_gain_n_exposure); /* -- module insert / remove -- */ static int __init gspca_init(void) { - info("v%d.%d.%d registered", - (DRIVER_VERSION_NUMBER >> 16) & 0xff, - (DRIVER_VERSION_NUMBER >> 8) & 0xff, - DRIVER_VERSION_NUMBER & 0xff); + info("v" DRIVER_VERSION_NUMBER " registered"); return 0; } static void __exit gspca_exit(void) -- cgit v1.2.3 From 64dc3c1a906467d90c24913b0b38dd13d9378f4f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 25 Jun 2011 11:28:37 -0300 Subject: [media] Stop using linux/version.h on the remaining video drivers Standardize the remaining video drivers to return the API version for the VIDIOC_QUERYCAP version, instead of a per-driver version. Those drivers had the version updated more recently or are SoC drivers. Even so, it doesn't sound a good idea to keep a per-driver version control, so, let's use the per-subsystem version control instead. Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/davinci/vpif_capture.c | 9 +++------ drivers/media/video/davinci/vpif_capture.h | 7 +------ drivers/media/video/davinci/vpif_display.c | 9 +++------ drivers/media/video/davinci/vpif_display.h | 8 +------- drivers/media/video/fsl-viu.c | 10 ++-------- drivers/media/video/m5mols/m5mols_capture.c | 2 -- drivers/media/video/m5mols/m5mols_core.c | 1 - drivers/media/video/mx1_camera.c | 5 ++--- drivers/media/video/mx2_camera.c | 5 ++--- drivers/media/video/mx3_camera.c | 3 +-- drivers/media/video/omap1_camera.c | 5 ++--- drivers/media/video/omap24xxcam.c | 5 ++--- drivers/media/video/omap3isp/isp.c | 1 + drivers/media/video/omap3isp/ispvideo.c | 1 - drivers/media/video/omap3isp/ispvideo.h | 3 +-- drivers/media/video/pxa_camera.c | 5 ++--- drivers/media/video/s2255drv.c | 15 ++++----------- drivers/media/video/s5p-fimc/fimc-capture.c | 2 -- drivers/media/video/s5p-fimc/fimc-core.c | 3 +-- drivers/media/video/sh_mobile_ceu_camera.c | 3 +-- drivers/media/video/sh_vou.c | 3 +-- 21 files changed, 30 insertions(+), 75 deletions(-) diff --git a/drivers/media/video/davinci/vpif_capture.c b/drivers/media/video/davinci/vpif_capture.c index d93ad74a34c5..49e4deb50043 100644 --- a/drivers/media/video/davinci/vpif_capture.c +++ b/drivers/media/video/davinci/vpif_capture.c @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -44,6 +43,7 @@ MODULE_DESCRIPTION("TI DaVinci VPIF Capture driver"); MODULE_LICENSE("GPL"); +MODULE_VERSION(VPIF_CAPTURE_VERSION); #define vpif_err(fmt, arg...) v4l2_err(&vpif_obj.v4l2_dev, fmt, ## arg) #define vpif_dbg(level, debug, fmt, arg...) \ @@ -1677,7 +1677,6 @@ static int vpif_querycap(struct file *file, void *priv, { struct vpif_capture_config *config = vpif_dev->platform_data; - cap->version = VPIF_CAPTURE_VERSION_CODE; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; strlcpy(cap->driver, "vpif capture", sizeof(cap->driver)); strlcpy(cap->bus_info, "DM646x Platform", sizeof(cap->bus_info)); @@ -2211,10 +2210,8 @@ static __init int vpif_probe(struct platform_device *pdev) vfd->v4l2_dev = &vpif_obj.v4l2_dev; vfd->release = video_device_release; snprintf(vfd->name, sizeof(vfd->name), - "DM646x_VPIFCapture_DRIVER_V%d.%d.%d", - (VPIF_CAPTURE_VERSION_CODE >> 16) & 0xff, - (VPIF_CAPTURE_VERSION_CODE >> 8) & 0xff, - (VPIF_CAPTURE_VERSION_CODE) & 0xff); + "DM646x_VPIFCapture_DRIVER_V%s", + VPIF_CAPTURE_VERSION); /* Set video_dev to the video device */ ch->video_dev = vfd; } diff --git a/drivers/media/video/davinci/vpif_capture.h b/drivers/media/video/davinci/vpif_capture.h index 7a4196dfdce1..064550f5ce4a 100644 --- a/drivers/media/video/davinci/vpif_capture.h +++ b/drivers/media/video/davinci/vpif_capture.h @@ -23,7 +23,6 @@ /* Header files */ #include -#include #include #include #include @@ -33,11 +32,7 @@ #include "vpif.h" /* Macros */ -#define VPIF_MAJOR_RELEASE 0 -#define VPIF_MINOR_RELEASE 0 -#define VPIF_BUILD 1 -#define VPIF_CAPTURE_VERSION_CODE ((VPIF_MAJOR_RELEASE << 16) | \ - (VPIF_MINOR_RELEASE << 8) | VPIF_BUILD) +#define VPIF_CAPTURE_VERSION "0.0.2" #define VPIF_VALID_FIELD(field) (((V4L2_FIELD_ANY == field) || \ (V4L2_FIELD_NONE == field)) || \ diff --git a/drivers/media/video/davinci/vpif_display.c b/drivers/media/video/davinci/vpif_display.c index cdf659abdc2a..286f02910044 100644 --- a/drivers/media/video/davinci/vpif_display.c +++ b/drivers/media/video/davinci/vpif_display.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include @@ -47,6 +46,7 @@ MODULE_DESCRIPTION("TI DaVinci VPIF Display driver"); MODULE_LICENSE("GPL"); +MODULE_VERSION(VPIF_DISPLAY_VERSION); #define DM646X_V4L2_STD (V4L2_STD_525_60 | V4L2_STD_625_50) @@ -701,7 +701,6 @@ static int vpif_querycap(struct file *file, void *priv, { struct vpif_display_config *config = vpif_dev->platform_data; - cap->version = VPIF_DISPLAY_VERSION_CODE; cap->capabilities = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING; strlcpy(cap->driver, "vpif display", sizeof(cap->driver)); strlcpy(cap->bus_info, "Platform", sizeof(cap->bus_info)); @@ -1740,10 +1739,8 @@ static __init int vpif_probe(struct platform_device *pdev) vfd->v4l2_dev = &vpif_obj.v4l2_dev; vfd->release = video_device_release; snprintf(vfd->name, sizeof(vfd->name), - "DM646x_VPIFDisplay_DRIVER_V%d.%d.%d", - (VPIF_DISPLAY_VERSION_CODE >> 16) & 0xff, - (VPIF_DISPLAY_VERSION_CODE >> 8) & 0xff, - (VPIF_DISPLAY_VERSION_CODE) & 0xff); + "DM646x_VPIFDisplay_DRIVER_V%s", + VPIF_DISPLAY_VERSION); /* Set video_dev to the video device */ ch->video_dev = vfd; diff --git a/drivers/media/video/davinci/vpif_display.h b/drivers/media/video/davinci/vpif_display.h index b53aaa883075..5d1936dafed2 100644 --- a/drivers/media/video/davinci/vpif_display.h +++ b/drivers/media/video/davinci/vpif_display.h @@ -18,7 +18,6 @@ /* Header files */ #include -#include #include #include #include @@ -27,12 +26,7 @@ #include "vpif.h" /* Macros */ -#define VPIF_MAJOR_RELEASE (0) -#define VPIF_MINOR_RELEASE (0) -#define VPIF_BUILD (1) - -#define VPIF_DISPLAY_VERSION_CODE \ - ((VPIF_MAJOR_RELEASE << 16) | (VPIF_MINOR_RELEASE << 8) | VPIF_BUILD) +#define VPIF_DISPLAY_VERSION "0.0.2" #define VPIF_VALID_FIELD(field) \ (((V4L2_FIELD_ANY == field) || (V4L2_FIELD_NONE == field)) || \ diff --git a/drivers/media/video/fsl-viu.c b/drivers/media/video/fsl-viu.c index 908d7012c3f2..27cb197d0bd6 100644 --- a/drivers/media/video/fsl-viu.c +++ b/drivers/media/video/fsl-viu.c @@ -23,19 +23,13 @@ #include #include #include -#include #include #include #include #include #define DRV_NAME "fsl_viu" -#define VIU_MAJOR_VERSION 0 -#define VIU_MINOR_VERSION 5 -#define VIU_RELEASE 0 -#define VIU_VERSION KERNEL_VERSION(VIU_MAJOR_VERSION, \ - VIU_MINOR_VERSION, \ - VIU_RELEASE) +#define VIU_VERSION "0.5.1" #define BUFFER_TIMEOUT msecs_to_jiffies(500) /* 0.5 seconds */ @@ -610,7 +604,6 @@ static int vidioc_querycap(struct file *file, void *priv, { strcpy(cap->driver, "viu"); strcpy(cap->card, "viu"); - cap->version = VIU_VERSION; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_OVERLAY | @@ -1684,3 +1677,4 @@ module_exit(viu_exit); MODULE_DESCRIPTION("Freescale Video-In(VIU)"); MODULE_AUTHOR("Hongjun Chen"); MODULE_LICENSE("GPL"); +MODULE_VERSION(VIU_VERSION); diff --git a/drivers/media/video/m5mols/m5mols_capture.c b/drivers/media/video/m5mols/m5mols_capture.c index d9471928369d..3248ac805711 100644 --- a/drivers/media/video/m5mols/m5mols_capture.c +++ b/drivers/media/video/m5mols/m5mols_capture.c @@ -18,11 +18,9 @@ #include #include #include -#include #include #include #include -#include #include #include #include diff --git a/drivers/media/video/m5mols/m5mols_core.c b/drivers/media/video/m5mols/m5mols_core.c index 43c68f51c5ce..fb8e4a7a9dd2 100644 --- a/drivers/media/video/m5mols/m5mols_core.c +++ b/drivers/media/video/m5mols/m5mols_core.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/media/video/mx1_camera.c b/drivers/media/video/mx1_camera.c index 63f8a0cc33d8..30a1364675c2 100644 --- a/drivers/media/video/mx1_camera.c +++ b/drivers/media/video/mx1_camera.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include @@ -73,7 +72,7 @@ #define CSISR_SOF_INT (1 << 16) #define CSISR_DRDY (1 << 0) -#define VERSION_CODE KERNEL_VERSION(0, 0, 1) +#define DRIVER_VERSION "0.0.2" #define DRIVER_NAME "mx1-camera" #define CSI_IRQ_MASK (CSISR_SFF_OR_INT | CSISR_RFF_OR_INT | \ @@ -676,7 +675,6 @@ static int mx1_camera_querycap(struct soc_camera_host *ici, { /* cap->name is set by the friendly caller:-> */ strlcpy(cap->card, "i.MX1/i.MXL Camera", sizeof(cap->card)); - cap->version = VERSION_CODE; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; return 0; @@ -883,4 +881,5 @@ module_exit(mx1_camera_exit); MODULE_DESCRIPTION("i.MX1/i.MXL SoC Camera Host driver"); MODULE_AUTHOR("Paulius Zaleckas "); MODULE_LICENSE("GPL v2"); +MODULE_VERSION(DRIVER_VERSION); MODULE_ALIAS("platform:" DRIVER_NAME); diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c index 4eab1c620318..e05e80090959 100644 --- a/drivers/media/video/mx2_camera.c +++ b/drivers/media/video/mx2_camera.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -47,7 +46,7 @@ #include #define MX2_CAM_DRV_NAME "mx2-camera" -#define MX2_CAM_VERSION_CODE KERNEL_VERSION(0, 0, 5) +#define MX2_CAM_VERSION "0.0.6" #define MX2_CAM_DRIVER_DESCRIPTION "i.MX2x_Camera" /* reset values */ @@ -1014,7 +1013,6 @@ static int mx2_camera_querycap(struct soc_camera_host *ici, { /* cap->name is set by the friendly caller:-> */ strlcpy(cap->card, MX2_CAM_DRIVER_DESCRIPTION, sizeof(cap->card)); - cap->version = MX2_CAM_VERSION_CODE; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; return 0; @@ -1523,3 +1521,4 @@ module_exit(mx2_camera_exit); MODULE_DESCRIPTION("i.MX27/i.MX25 SoC Camera Host driver"); MODULE_AUTHOR("Sascha Hauer "); MODULE_LICENSE("GPL"); +MODULE_VERSION(MX2_CAM_VERSION); diff --git a/drivers/media/video/mx3_camera.c b/drivers/media/video/mx3_camera.c index c7680eb83664..36f0ed9ca9e1 100644 --- a/drivers/media/video/mx3_camera.c +++ b/drivers/media/video/mx3_camera.c @@ -11,7 +11,6 @@ #include #include -#include #include #include #include @@ -1000,7 +999,6 @@ static int mx3_camera_querycap(struct soc_camera_host *ici, { /* cap->name is set by the firendly caller:-> */ strlcpy(cap->card, "i.MX3x Camera", sizeof(cap->card)); - cap->version = KERNEL_VERSION(0, 2, 2); cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; return 0; @@ -1325,4 +1323,5 @@ module_exit(mx3_camera_exit); MODULE_DESCRIPTION("i.MX3x SoC Camera Host driver"); MODULE_AUTHOR("Guennadi Liakhovetski "); MODULE_LICENSE("GPL v2"); +MODULE_VERSION("0.2.3"); MODULE_ALIAS("platform:" MX3_CAM_DRV_NAME); diff --git a/drivers/media/video/omap1_camera.c b/drivers/media/video/omap1_camera.c index e7cfc85b0a1c..9bfe4c121a5c 100644 --- a/drivers/media/video/omap1_camera.c +++ b/drivers/media/video/omap1_camera.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include @@ -38,7 +37,7 @@ #define DRIVER_NAME "omap1-camera" -#define VERSION_CODE KERNEL_VERSION(0, 0, 1) +#define DRIVER_VERSION "0.0.2" /* @@ -1431,7 +1430,6 @@ static int omap1_cam_querycap(struct soc_camera_host *ici, { /* cap->name is set by the friendly caller:-> */ strlcpy(cap->card, "OMAP1 Camera", sizeof(cap->card)); - cap->version = VERSION_CODE; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; return 0; @@ -1718,4 +1716,5 @@ MODULE_PARM_DESC(sg_mode, "videobuf mode, 0: dma-contig (default), 1: dma-sg"); MODULE_DESCRIPTION("OMAP1 Camera Interface driver"); MODULE_AUTHOR("Janusz Krzysztofik "); MODULE_LICENSE("GPL v2"); +MODULE_LICENSE(DRIVER_VERSION); MODULE_ALIAS("platform:" DRIVER_NAME); diff --git a/drivers/media/video/omap24xxcam.c b/drivers/media/video/omap24xxcam.c index f6626e87dbc5..ba3a8af76a8c 100644 --- a/drivers/media/video/omap24xxcam.c +++ b/drivers/media/video/omap24xxcam.c @@ -31,7 +31,6 @@ #include #include #include /* needed for videobufs */ -#include #include #include #include @@ -43,7 +42,7 @@ #include "omap24xxcam.h" -#define OMAP24XXCAM_VERSION KERNEL_VERSION(0, 0, 0) +#define OMAP24XXCAM_VERSION "0.0.1" #define RESET_TIMEOUT_NS 10000 @@ -993,7 +992,6 @@ static int vidioc_querycap(struct file *file, void *fh, strlcpy(cap->driver, CAM_NAME, sizeof(cap->driver)); strlcpy(cap->card, cam->vfd->name, sizeof(cap->card)); - cap->version = OMAP24XXCAM_VERSION; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; return 0; @@ -1889,6 +1887,7 @@ static void __exit omap24xxcam_cleanup(void) MODULE_AUTHOR("Sakari Ailus "); MODULE_DESCRIPTION("OMAP24xx Video for Linux camera driver"); MODULE_LICENSE("GPL"); +MODULE_VERSION(OMAP24XXCAM_VERSION); module_param(video_nr, int, 0); MODULE_PARM_DESC(video_nr, "Minor number for video device (-1 ==> auto assign)"); diff --git a/drivers/media/video/omap3isp/isp.c b/drivers/media/video/omap3isp/isp.c index 94b6ed89e195..5cea2bbd7014 100644 --- a/drivers/media/video/omap3isp/isp.c +++ b/drivers/media/video/omap3isp/isp.c @@ -2234,3 +2234,4 @@ module_exit(isp_cleanup); MODULE_AUTHOR("Nokia Corporation"); MODULE_DESCRIPTION("TI OMAP3 ISP driver"); MODULE_LICENSE("GPL"); +MODULE_VERSION(ISP_VIDEO_DRIVER_VERSION); diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c index 9cd8f1aa567b..fd965adfd597 100644 --- a/drivers/media/video/omap3isp/ispvideo.c +++ b/drivers/media/video/omap3isp/ispvideo.c @@ -695,7 +695,6 @@ isp_video_querycap(struct file *file, void *fh, struct v4l2_capability *cap) strlcpy(cap->driver, ISP_VIDEO_DRIVER_NAME, sizeof(cap->driver)); strlcpy(cap->card, video->video.name, sizeof(cap->card)); strlcpy(cap->bus_info, "media", sizeof(cap->bus_info)); - cap->version = ISP_VIDEO_DRIVER_VERSION; if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; diff --git a/drivers/media/video/omap3isp/ispvideo.h b/drivers/media/video/omap3isp/ispvideo.h index 911bea64e78a..53160aa24e6e 100644 --- a/drivers/media/video/omap3isp/ispvideo.h +++ b/drivers/media/video/omap3isp/ispvideo.h @@ -27,7 +27,6 @@ #define OMAP3_ISP_VIDEO_H #include -#include #include #include #include @@ -35,7 +34,7 @@ #include "ispqueue.h" #define ISP_VIDEO_DRIVER_NAME "ispvideo" -#define ISP_VIDEO_DRIVER_VERSION KERNEL_VERSION(0, 0, 1) +#define ISP_VIDEO_DRIVER_VERSION "0.0.2" struct isp_device; struct isp_video; diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c index b42bfa5ccdf2..c5b27a4cda30 100644 --- a/drivers/media/video/pxa_camera.c +++ b/drivers/media/video/pxa_camera.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -40,7 +39,7 @@ #include #include -#define PXA_CAM_VERSION_CODE KERNEL_VERSION(0, 0, 5) +#define PXA_CAM_VERSION "0.0.6" #define PXA_CAM_DRV_NAME "pxa27x-camera" /* Camera Interface */ @@ -1578,7 +1577,6 @@ static int pxa_camera_querycap(struct soc_camera_host *ici, { /* cap->name is set by the firendly caller:-> */ strlcpy(cap->card, pxa_cam_driver_description, sizeof(cap->card)); - cap->version = PXA_CAM_VERSION_CODE; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; return 0; @@ -1843,4 +1841,5 @@ module_exit(pxa_camera_exit); MODULE_DESCRIPTION("PXA27x SoC Camera Host driver"); MODULE_AUTHOR("Guennadi Liakhovetski "); MODULE_LICENSE("GPL"); +MODULE_VERSION(PXA_CAM_VERSION); MODULE_ALIAS("platform:" PXA_CAM_DRV_NAME); diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c index 704e2cb1e459..803c9c82e496 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c @@ -42,7 +42,6 @@ #include #include #include -#include #include #include #include @@ -51,12 +50,7 @@ #include #include -#define S2255_MAJOR_VERSION 1 -#define S2255_MINOR_VERSION 22 -#define S2255_RELEASE 0 -#define S2255_VERSION KERNEL_VERSION(S2255_MAJOR_VERSION, \ - S2255_MINOR_VERSION, \ - S2255_RELEASE) +#define S2255_VERSION "1.22.1" #define FIRMWARE_FILE_NAME "f2255usb.bin" /* default JPEG quality */ @@ -851,7 +845,6 @@ static int vidioc_querycap(struct file *file, void *priv, strlcpy(cap->driver, "s2255", sizeof(cap->driver)); strlcpy(cap->card, "s2255", sizeof(cap->card)); usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info)); - cap->version = S2255_VERSION; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; return 0; } @@ -1979,9 +1972,8 @@ static int s2255_probe_v4l(struct s2255_dev *dev) video_device_node_name(&channel->vdev)); } - printk(KERN_INFO "Sensoray 2255 V4L driver Revision: %d.%d\n", - S2255_MAJOR_VERSION, - S2255_MINOR_VERSION); + printk(KERN_INFO "Sensoray 2255 V4L driver Revision: %s\n", + S2255_VERSION); /* if no channels registered, return error and probe will fail*/ if (atomic_read(&dev->num_channels) == 0) { v4l2_device_unregister(&dev->v4l2_dev); @@ -2713,3 +2705,4 @@ module_exit(usb_s2255_exit); MODULE_DESCRIPTION("Sensoray 2255 Video for Linux driver"); MODULE_AUTHOR("Dean Anderson (Sensoray Company Inc.)"); MODULE_LICENSE("GPL"); +MODULE_VERSION(S2255_VERSION); diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index 81b4a826ee5e..0d730e55605d 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c @@ -11,7 +11,6 @@ #include #include -#include #include #include #include @@ -451,7 +450,6 @@ static int fimc_vidioc_querycap_capture(struct file *file, void *priv, strncpy(cap->driver, fimc->pdev->name, sizeof(cap->driver) - 1); strncpy(cap->card, fimc->pdev->name, sizeof(cap->card) - 1); cap->bus_info[0] = 0; - cap->version = KERNEL_VERSION(1, 0, 0); cap->capabilities = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_CAPTURE_MPLANE; diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c index bdf19ada9172..aa550666cc0b 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.c +++ b/drivers/media/video/s5p-fimc/fimc-core.c @@ -12,7 +12,6 @@ #include #include -#include #include #include #include @@ -774,7 +773,6 @@ static int fimc_m2m_querycap(struct file *file, void *priv, strncpy(cap->driver, fimc->pdev->name, sizeof(cap->driver) - 1); strncpy(cap->card, fimc->pdev->name, sizeof(cap->card) - 1); cap->bus_info[0] = 0; - cap->version = KERNEL_VERSION(1, 0, 0); cap->capabilities = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_VIDEO_OUTPUT_MPLANE; @@ -1937,3 +1935,4 @@ module_exit(fimc_exit); MODULE_AUTHOR("Sylwester Nawrocki "); MODULE_DESCRIPTION("S5P FIMC camera host interface/video postprocessor driver"); MODULE_LICENSE("GPL"); +MODULE_VERSION("1.0.1"); diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c index 3ae5c9c58cba..aa48e271ffc9 100644 --- a/drivers/media/video/sh_mobile_ceu_camera.c +++ b/drivers/media/video/sh_mobile_ceu_camera.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -1827,7 +1826,6 @@ static int sh_mobile_ceu_querycap(struct soc_camera_host *ici, struct v4l2_capability *cap) { strlcpy(cap->card, "SuperH_Mobile_CEU", sizeof(cap->card)); - cap->version = KERNEL_VERSION(0, 0, 5); cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; return 0; } @@ -2158,4 +2156,5 @@ module_exit(sh_mobile_ceu_exit); MODULE_DESCRIPTION("SuperH Mobile CEU driver"); MODULE_AUTHOR("Magnus Damm"); MODULE_LICENSE("GPL"); +MODULE_VERSION("0.0.6"); MODULE_ALIAS("platform:sh_mobile_ceu"); diff --git a/drivers/media/video/sh_vou.c b/drivers/media/video/sh_vou.c index 07cf0c6c7c1f..6a729879d89e 100644 --- a/drivers/media/video/sh_vou.c +++ b/drivers/media/video/sh_vou.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include @@ -393,7 +392,6 @@ static int sh_vou_querycap(struct file *file, void *priv, dev_dbg(vou_file->vbq.dev, "%s()\n", __func__); strlcpy(cap->card, "SuperH VOU", sizeof(cap->card)); - cap->version = KERNEL_VERSION(0, 1, 0); cap->capabilities = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING; return 0; } @@ -1490,4 +1488,5 @@ module_exit(sh_vou_exit); MODULE_DESCRIPTION("SuperH VOU driver"); MODULE_AUTHOR("Guennadi Liakhovetski "); MODULE_LICENSE("GPL v2"); +MODULE_VERSION("0.1.0"); MODULE_ALIAS("platform:sh-vou"); -- cgit v1.2.3 From 29834c1ac7589c72996c5d02349d63fd397ef131 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 25 Jun 2011 10:15:42 -0300 Subject: [media] radio: Use the subsystem version control for VIDIOC_QUERYCAP Just like the video drivers, the right thing to do is to use the per-subsystem version control. Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/radio/dsbr100.c | 7 ++----- drivers/media/radio/radio-aimslab.c | 5 +---- drivers/media/radio/radio-aztech.c | 5 +---- drivers/media/radio/radio-cadet.c | 5 +---- drivers/media/radio/radio-gemtek.c | 7 ++----- drivers/media/radio/radio-maxiradio.c | 10 ++++------ drivers/media/radio/radio-mr800.c | 6 ++---- drivers/media/radio/radio-rtrack2.c | 5 +---- drivers/media/radio/radio-sf16fmi.c | 5 +---- drivers/media/radio/radio-tea5764.c | 6 ++---- drivers/media/radio/radio-terratec.c | 5 +---- drivers/media/radio/radio-timb.c | 3 +-- drivers/media/radio/radio-trust.c | 5 +---- drivers/media/radio/radio-typhoon.c | 9 ++++----- drivers/media/radio/radio-zoltrix.c | 5 +---- drivers/media/radio/si470x/radio-si470x-i2c.c | 4 +--- drivers/media/radio/si470x/radio-si470x-usb.c | 2 -- drivers/media/radio/si470x/radio-si470x.h | 1 - drivers/media/radio/wl128x/fmdrv.h | 5 +---- drivers/media/radio/wl128x/fmdrv_v4l2.c | 1 - 20 files changed, 27 insertions(+), 74 deletions(-) diff --git a/drivers/media/radio/dsbr100.c b/drivers/media/radio/dsbr100.c index 3d8cc425fa6b..25e58cbf35f0 100644 --- a/drivers/media/radio/dsbr100.c +++ b/drivers/media/radio/dsbr100.c @@ -102,10 +102,7 @@ /* * Version Information */ -#include /* for KERNEL_VERSION MACRO */ - -#define DRIVER_VERSION "v0.46" -#define RADIO_VERSION KERNEL_VERSION(0, 4, 6) +#define DRIVER_VERSION "0.4.7" #define DRIVER_AUTHOR "Markus Demleitner " #define DRIVER_DESC "D-Link DSB-R100 USB FM radio driver" @@ -335,7 +332,6 @@ static int vidioc_querycap(struct file *file, void *priv, strlcpy(v->driver, "dsbr100", sizeof(v->driver)); strlcpy(v->card, "D-Link R-100 USB FM Radio", sizeof(v->card)); usb_make_path(radio->usbdev, v->bus_info, sizeof(v->bus_info)); - v->version = RADIO_VERSION; v->capabilities = V4L2_CAP_TUNER; return 0; } @@ -647,3 +643,4 @@ module_exit (dsbr100_exit); MODULE_AUTHOR( DRIVER_AUTHOR ); MODULE_DESCRIPTION( DRIVER_DESC ); MODULE_LICENSE("GPL"); +MODULE_VERSION(DRIVER_VERSION); diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c index 4ce10dbeadd8..1c3f8440a55c 100644 --- a/drivers/media/radio/radio-aimslab.c +++ b/drivers/media/radio/radio-aimslab.c @@ -33,7 +33,6 @@ #include /* request_region */ #include /* msleep */ #include /* kernel radio structs */ -#include /* for KERNEL_VERSION MACRO */ #include /* outb, outb_p */ #include #include @@ -41,6 +40,7 @@ MODULE_AUTHOR("M.Kirkwood"); MODULE_DESCRIPTION("A driver for the RadioTrack/RadioReveal radio card."); MODULE_LICENSE("GPL"); +MODULE_VERSION("0.0.3"); #ifndef CONFIG_RADIO_RTRACK_PORT #define CONFIG_RADIO_RTRACK_PORT -1 @@ -53,8 +53,6 @@ module_param(io, int, 0); MODULE_PARM_DESC(io, "I/O address of the RadioTrack card (0x20f or 0x30f)"); module_param(radio_nr, int, 0); -#define RADIO_VERSION KERNEL_VERSION(0, 0, 2) - struct rtrack { struct v4l2_device v4l2_dev; @@ -223,7 +221,6 @@ static int vidioc_querycap(struct file *file, void *priv, strlcpy(v->driver, "radio-aimslab", sizeof(v->driver)); strlcpy(v->card, "RadioTrack", sizeof(v->card)); strlcpy(v->bus_info, "ISA", sizeof(v->bus_info)); - v->version = RADIO_VERSION; v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO; return 0; } diff --git a/drivers/media/radio/radio-aztech.c b/drivers/media/radio/radio-aztech.c index dd8a6ab0d437..eed7b0840734 100644 --- a/drivers/media/radio/radio-aztech.c +++ b/drivers/media/radio/radio-aztech.c @@ -30,7 +30,6 @@ #include /* request_region */ #include /* udelay */ #include /* kernel radio structs */ -#include /* for KERNEL_VERSION MACRO */ #include /* outb, outb_p */ #include #include @@ -38,6 +37,7 @@ MODULE_AUTHOR("Russell Kroll, Quay Lu, Donald Song, Jason Lewis, Scott McGrath, William McGrath"); MODULE_DESCRIPTION("A driver for the Aztech radio card."); MODULE_LICENSE("GPL"); +MODULE_VERSION("0.0.3"); /* acceptable ports: 0x350 (JP3 shorted), 0x358 (JP3 open) */ @@ -53,8 +53,6 @@ module_param(io, int, 0); module_param(radio_nr, int, 0); MODULE_PARM_DESC(io, "I/O address of the Aztech card (0x350 or 0x358)"); -#define RADIO_VERSION KERNEL_VERSION(0, 0, 2) - struct aztech { struct v4l2_device v4l2_dev; @@ -188,7 +186,6 @@ static int vidioc_querycap(struct file *file, void *priv, strlcpy(v->driver, "radio-aztech", sizeof(v->driver)); strlcpy(v->card, "Aztech Radio", sizeof(v->card)); strlcpy(v->bus_info, "ISA", sizeof(v->bus_info)); - v->version = RADIO_VERSION; v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO; return 0; } diff --git a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c index bc9ad0897c55..16a089fad909 100644 --- a/drivers/media/radio/radio-cadet.c +++ b/drivers/media/radio/radio-cadet.c @@ -30,7 +30,6 @@ * Changed API to V4L2 */ -#include #include /* Modules */ #include /* Initdata */ #include /* request_region */ @@ -46,6 +45,7 @@ MODULE_AUTHOR("Fred Gleason, Russell Kroll, Quay Lu, Donald Song, Jason Lewis, Scott McGrath, William McGrath"); MODULE_DESCRIPTION("A driver for the ADS Cadet AM/FM/RDS radio card."); MODULE_LICENSE("GPL"); +MODULE_VERSION("0.3.4"); static int io = -1; /* default to isapnp activation */ static int radio_nr = -1; @@ -54,8 +54,6 @@ module_param(io, int, 0); MODULE_PARM_DESC(io, "I/O address of Cadet card (0x330,0x332,0x334,0x336,0x338,0x33a,0x33c,0x33e)"); module_param(radio_nr, int, 0); -#define CADET_VERSION KERNEL_VERSION(0, 3, 3) - #define RDS_BUFFER 256 #define RDS_RX_FLAG 1 #define MBS_RX_FLAG 2 @@ -361,7 +359,6 @@ static int vidioc_querycap(struct file *file, void *priv, strlcpy(v->driver, "ADS Cadet", sizeof(v->driver)); strlcpy(v->card, "ADS Cadet", sizeof(v->card)); strlcpy(v->bus_info, "ISA", sizeof(v->bus_info)); - v->version = CADET_VERSION; v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO | V4L2_CAP_READWRITE | V4L2_CAP_RDS_CAPTURE; return 0; diff --git a/drivers/media/radio/radio-gemtek.c b/drivers/media/radio/radio-gemtek.c index 259936422e49..edadc8449a3d 100644 --- a/drivers/media/radio/radio-gemtek.c +++ b/drivers/media/radio/radio-gemtek.c @@ -21,21 +21,19 @@ #include /* request_region */ #include /* udelay */ #include /* kernel radio structs */ -#include /* for KERNEL_VERSION MACRO */ #include #include /* outb, outb_p */ #include #include -#define RADIO_VERSION KERNEL_VERSION(0, 0, 3) - /* * Module info. */ -MODULE_AUTHOR("Jonas Munsin, Pekka Seppänen "); +MODULE_AUTHOR("Jonas Munsin, Pekka Seppänen "); MODULE_DESCRIPTION("A driver for the GemTek Radio card."); MODULE_LICENSE("GPL"); +MODULE_VERSION("0.0.4"); /* * Module params. @@ -387,7 +385,6 @@ static int vidioc_querycap(struct file *file, void *priv, strlcpy(v->driver, "radio-gemtek", sizeof(v->driver)); strlcpy(v->card, "GemTek", sizeof(v->card)); strlcpy(v->bus_info, "ISA", sizeof(v->bus_info)); - v->version = RADIO_VERSION; v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO; return 0; } diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c index e83e84003025..f872a54cf3d9 100644 --- a/drivers/media/radio/radio-maxiradio.c +++ b/drivers/media/radio/radio-maxiradio.c @@ -40,15 +40,18 @@ #include #include #include -#include /* for KERNEL_VERSION MACRO */ #include #include #include #include +#define DRIVER_VERSION "0.7.8" + + MODULE_AUTHOR("Dimitromanolakis Apostolos, apdim@grecian.net"); MODULE_DESCRIPTION("Radio driver for the Guillemot Maxi Radio FM2000 radio."); MODULE_LICENSE("GPL"); +MODULE_VERSION(DRIVER_VERSION); static int radio_nr = -1; module_param(radio_nr, int, 0); @@ -58,10 +61,6 @@ static int debug; module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "activates debug info"); -#define DRIVER_VERSION "0.77" - -#define RADIO_VERSION KERNEL_VERSION(0, 7, 7) - #define dprintk(dev, num, fmt, arg...) \ v4l2_dbg(num, debug, &dev->v4l2_dev, fmt, ## arg) @@ -195,7 +194,6 @@ static int vidioc_querycap(struct file *file, void *priv, strlcpy(v->driver, "radio-maxiradio", sizeof(v->driver)); strlcpy(v->card, "Maxi Radio FM2000 radio", sizeof(v->card)); snprintf(v->bus_info, sizeof(v->bus_info), "PCI:%s", pci_name(dev->pdev)); - v->version = RADIO_VERSION; v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO; return 0; } diff --git a/drivers/media/radio/radio-mr800.c b/drivers/media/radio/radio-mr800.c index b3a635b95820..1742bd8110bd 100644 --- a/drivers/media/radio/radio-mr800.c +++ b/drivers/media/radio/radio-mr800.c @@ -63,18 +63,17 @@ #include #include #include -#include /* for KERNEL_VERSION MACRO */ #include /* driver and module definitions */ #define DRIVER_AUTHOR "Alexey Klimov " #define DRIVER_DESC "AverMedia MR 800 USB FM radio driver" -#define DRIVER_VERSION "0.11" -#define RADIO_VERSION KERNEL_VERSION(0, 1, 1) +#define DRIVER_VERSION "0.1.2" MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); +MODULE_VERSION(DRIVER_VERSION); #define USB_AMRADIO_VENDOR 0x07ca #define USB_AMRADIO_PRODUCT 0xb800 @@ -301,7 +300,6 @@ static int vidioc_querycap(struct file *file, void *priv, strlcpy(v->driver, "radio-mr800", sizeof(v->driver)); strlcpy(v->card, "AverMedia MR 800 USB FM Radio", sizeof(v->card)); usb_make_path(radio->usbdev, v->bus_info, sizeof(v->bus_info)); - v->version = RADIO_VERSION; v->capabilities = V4L2_CAP_TUNER; return 0; } diff --git a/drivers/media/radio/radio-rtrack2.c b/drivers/media/radio/radio-rtrack2.c index 8d6ea591bd18..3628be617ee9 100644 --- a/drivers/media/radio/radio-rtrack2.c +++ b/drivers/media/radio/radio-rtrack2.c @@ -15,7 +15,6 @@ #include /* udelay */ #include /* kernel radio structs */ #include -#include /* for KERNEL_VERSION MACRO */ #include /* outb, outb_p */ #include #include @@ -23,6 +22,7 @@ MODULE_AUTHOR("Ben Pfaff"); MODULE_DESCRIPTION("A driver for the RadioTrack II radio card."); MODULE_LICENSE("GPL"); +MODULE_VERSION("0.0.3"); #ifndef CONFIG_RADIO_RTRACK2_PORT #define CONFIG_RADIO_RTRACK2_PORT -1 @@ -35,8 +35,6 @@ module_param(io, int, 0); MODULE_PARM_DESC(io, "I/O address of the RadioTrack card (0x20c or 0x30c)"); module_param(radio_nr, int, 0); -#define RADIO_VERSION KERNEL_VERSION(0, 0, 2) - struct rtrack2 { struct v4l2_device v4l2_dev; @@ -121,7 +119,6 @@ static int vidioc_querycap(struct file *file, void *priv, strlcpy(v->driver, "radio-rtrack2", sizeof(v->driver)); strlcpy(v->card, "RadioTrack II", sizeof(v->card)); strlcpy(v->bus_info, "ISA", sizeof(v->bus_info)); - v->version = RADIO_VERSION; v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO; return 0; } diff --git a/drivers/media/radio/radio-sf16fmi.c b/drivers/media/radio/radio-sf16fmi.c index b5a5f89e238a..22c5743bf9db 100644 --- a/drivers/media/radio/radio-sf16fmi.c +++ b/drivers/media/radio/radio-sf16fmi.c @@ -16,7 +16,6 @@ * Converted to V4L2 API by Mauro Carvalho Chehab */ -#include #include /* __setup */ #include /* Modules */ #include /* Initdata */ @@ -32,6 +31,7 @@ MODULE_AUTHOR("Petr Vandrovec, vandrove@vc.cvut.cz and M. Kirkwood"); MODULE_DESCRIPTION("A driver for the SF16-FMI and SF16-FMP radio."); MODULE_LICENSE("GPL"); +MODULE_VERSION("0.0.3"); static int io = -1; static int radio_nr = -1; @@ -40,8 +40,6 @@ module_param(io, int, 0); MODULE_PARM_DESC(io, "I/O address of the SF16-FMI or SF16-FMP card (0x284 or 0x384)"); module_param(radio_nr, int, 0); -#define RADIO_VERSION KERNEL_VERSION(0, 0, 2) - struct fmi { struct v4l2_device v4l2_dev; @@ -134,7 +132,6 @@ static int vidioc_querycap(struct file *file, void *priv, strlcpy(v->driver, "radio-sf16fmi", sizeof(v->driver)); strlcpy(v->card, "SF16-FMx radio", sizeof(v->card)); strlcpy(v->bus_info, "ISA", sizeof(v->bus_info)); - v->version = RADIO_VERSION; v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO; return 0; } diff --git a/drivers/media/radio/radio-tea5764.c b/drivers/media/radio/radio-tea5764.c index 0e71d816c725..ce75c3ae5670 100644 --- a/drivers/media/radio/radio-tea5764.c +++ b/drivers/media/radio/radio-tea5764.c @@ -39,10 +39,8 @@ #include /* I2C */ #include #include -#include /* for KERNEL_VERSION MACRO */ -#define DRIVER_VERSION "v0.01" -#define RADIO_VERSION KERNEL_VERSION(0, 0, 1) +#define DRIVER_VERSION "0.0.2" #define DRIVER_AUTHOR "Fabio Belavenuto " #define DRIVER_DESC "A driver for the TEA5764 radio chip for EZX Phones." @@ -300,7 +298,6 @@ static int vidioc_querycap(struct file *file, void *priv, strlcpy(v->card, dev->name, sizeof(v->card)); snprintf(v->bus_info, sizeof(v->bus_info), "I2C:%s", dev_name(&dev->dev)); - v->version = RADIO_VERSION; v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO; return 0; } @@ -595,6 +592,7 @@ static void __exit tea5764_exit(void) MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); +MODULE_VERSION(DRIVER_VERSION); module_param(use_xtal, int, 1); MODULE_PARM_DESC(use_xtal, "Chip have a xtal connected in board"); diff --git a/drivers/media/radio/radio-terratec.c b/drivers/media/radio/radio-terratec.c index a32663917059..f2ed9cc3cf3b 100644 --- a/drivers/media/radio/radio-terratec.c +++ b/drivers/media/radio/radio-terratec.c @@ -29,7 +29,6 @@ #include /* request_region */ #include /* kernel radio structs */ #include -#include /* for KERNEL_VERSION MACRO */ #include /* outb, outb_p */ #include #include @@ -37,6 +36,7 @@ MODULE_AUTHOR("R.OFFERMANNS & others"); MODULE_DESCRIPTION("A driver for the TerraTec ActiveRadio Standalone radio card."); MODULE_LICENSE("GPL"); +MODULE_VERSION("0.0.3"); #ifndef CONFIG_RADIO_TERRATEC_PORT #define CONFIG_RADIO_TERRATEC_PORT 0x590 @@ -49,8 +49,6 @@ module_param(io, int, 0); MODULE_PARM_DESC(io, "I/O address of the TerraTec ActiveRadio card (0x590 or 0x591)"); module_param(radio_nr, int, 0); -#define RADIO_VERSION KERNEL_VERSION(0, 0, 2) - static struct v4l2_queryctrl radio_qctrl[] = { { .id = V4L2_CID_AUDIO_MUTE, @@ -205,7 +203,6 @@ static int vidioc_querycap(struct file *file, void *priv, strlcpy(v->driver, "radio-terratec", sizeof(v->driver)); strlcpy(v->card, "ActiveRadio", sizeof(v->card)); strlcpy(v->bus_info, "ISA", sizeof(v->bus_info)); - v->version = RADIO_VERSION; v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO; return 0; } diff --git a/drivers/media/radio/radio-timb.c b/drivers/media/radio/radio-timb.c index a185610b376b..f17b540d68a5 100644 --- a/drivers/media/radio/radio-timb.c +++ b/drivers/media/radio/radio-timb.c @@ -16,7 +16,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include #include #include #include @@ -44,7 +43,6 @@ static int timbradio_vidioc_querycap(struct file *file, void *priv, strlcpy(v->driver, DRIVER_NAME, sizeof(v->driver)); strlcpy(v->card, "Timberdale Radio", sizeof(v->card)); snprintf(v->bus_info, sizeof(v->bus_info), "platform:"DRIVER_NAME); - v->version = KERNEL_VERSION(0, 0, 1); v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO; return 0; } @@ -245,4 +243,5 @@ module_exit(timbradio_exit); MODULE_DESCRIPTION("Timberdale Radio driver"); MODULE_AUTHOR("Mocean Laboratories "); MODULE_LICENSE("GPL v2"); +MODULE_VERSION("0.0.2"); MODULE_ALIAS("platform:"DRIVER_NAME); diff --git a/drivers/media/radio/radio-trust.c b/drivers/media/radio/radio-trust.c index 22fa9cc28abe..b3f45a019d82 100644 --- a/drivers/media/radio/radio-trust.c +++ b/drivers/media/radio/radio-trust.c @@ -19,7 +19,6 @@ #include #include #include -#include /* for KERNEL_VERSION MACRO */ #include #include #include @@ -28,6 +27,7 @@ MODULE_AUTHOR("Eric Lammerts, Russell Kroll, Quay Lu, Donald Song, Jason Lewis, Scott McGrath, William McGrath"); MODULE_DESCRIPTION("A driver for the Trust FM Radio card."); MODULE_LICENSE("GPL"); +MODULE_VERSION("0.0.3"); /* acceptable ports: 0x350 (JP3 shorted), 0x358 (JP3 open) */ @@ -42,8 +42,6 @@ module_param(io, int, 0); MODULE_PARM_DESC(io, "I/O address of the Trust FM Radio card (0x350 or 0x358)"); module_param(radio_nr, int, 0); -#define RADIO_VERSION KERNEL_VERSION(0, 0, 2) - struct trust { struct v4l2_device v4l2_dev; struct video_device vdev; @@ -196,7 +194,6 @@ static int vidioc_querycap(struct file *file, void *priv, strlcpy(v->driver, "radio-trust", sizeof(v->driver)); strlcpy(v->card, "Trust FM Radio", sizeof(v->card)); strlcpy(v->bus_info, "ISA", sizeof(v->bus_info)); - v->version = RADIO_VERSION; v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO; return 0; } diff --git a/drivers/media/radio/radio-typhoon.c b/drivers/media/radio/radio-typhoon.c index 8dbbf08f2207..398726abc0c8 100644 --- a/drivers/media/radio/radio-typhoon.c +++ b/drivers/media/radio/radio-typhoon.c @@ -31,15 +31,17 @@ #include /* Modules */ #include /* Initdata */ #include /* request_region */ -#include /* for KERNEL_VERSION MACRO */ #include /* kernel radio structs */ #include /* outb, outb_p */ #include #include +#define DRIVER_VERSION "0.1.2" + MODULE_AUTHOR("Dr. Henrik Seidel"); MODULE_DESCRIPTION("A driver for the Typhoon radio card (a.k.a. EcoRadio)."); MODULE_LICENSE("GPL"); +MODULE_VERSION(DRIVER_VERSION); #ifndef CONFIG_RADIO_TYPHOON_PORT #define CONFIG_RADIO_TYPHOON_PORT -1 @@ -61,9 +63,7 @@ static unsigned long mutefreq = CONFIG_RADIO_TYPHOON_MUTEFREQ; module_param(mutefreq, ulong, 0); MODULE_PARM_DESC(mutefreq, "Frequency used when muting the card (in kHz)"); -#define RADIO_VERSION KERNEL_VERSION(0, 1, 1) - -#define BANNER "Typhoon Radio Card driver v0.1.1\n" +#define BANNER "Typhoon Radio Card driver v" DRIVER_VERSION "\n" struct typhoon { struct v4l2_device v4l2_dev; @@ -171,7 +171,6 @@ static int vidioc_querycap(struct file *file, void *priv, strlcpy(v->driver, "radio-typhoon", sizeof(v->driver)); strlcpy(v->card, "Typhoon Radio", sizeof(v->card)); strlcpy(v->bus_info, "ISA", sizeof(v->bus_info)); - v->version = RADIO_VERSION; v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO; return 0; } diff --git a/drivers/media/radio/radio-zoltrix.c b/drivers/media/radio/radio-zoltrix.c index af99c5bd88c1..f5613b948203 100644 --- a/drivers/media/radio/radio-zoltrix.c +++ b/drivers/media/radio/radio-zoltrix.c @@ -35,7 +35,6 @@ #include /* udelay, msleep */ #include /* kernel radio structs */ #include -#include /* for KERNEL_VERSION MACRO */ #include /* outb, outb_p */ #include #include @@ -43,6 +42,7 @@ MODULE_AUTHOR("C.van Schaik"); MODULE_DESCRIPTION("A driver for the Zoltrix Radio Plus."); MODULE_LICENSE("GPL"); +MODULE_VERSION("0.0.3"); #ifndef CONFIG_RADIO_ZOLTRIX_PORT #define CONFIG_RADIO_ZOLTRIX_PORT -1 @@ -55,8 +55,6 @@ module_param(io, int, 0); MODULE_PARM_DESC(io, "I/O address of the Zoltrix Radio Plus (0x20c or 0x30c)"); module_param(radio_nr, int, 0); -#define RADIO_VERSION KERNEL_VERSION(0, 0, 2) - struct zoltrix { struct v4l2_device v4l2_dev; struct video_device vdev; @@ -228,7 +226,6 @@ static int vidioc_querycap(struct file *file, void *priv, strlcpy(v->driver, "radio-zoltrix", sizeof(v->driver)); strlcpy(v->card, "Zoltrix Radio", sizeof(v->card)); strlcpy(v->bus_info, "ISA", sizeof(v->bus_info)); - v->version = RADIO_VERSION; v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO; return 0; } diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c index a2a67772c42c..fd3541b0e91c 100644 --- a/drivers/media/radio/si470x/radio-si470x-i2c.c +++ b/drivers/media/radio/si470x/radio-si470x-i2c.c @@ -24,10 +24,9 @@ /* driver definitions */ #define DRIVER_AUTHOR "Joonyoung Shim "; -#define DRIVER_KERNEL_VERSION KERNEL_VERSION(1, 0, 1) #define DRIVER_CARD "Silicon Labs Si470x FM Radio Receiver" #define DRIVER_DESC "I2C radio driver for Si470x FM Radio Receivers" -#define DRIVER_VERSION "1.0.1" +#define DRIVER_VERSION "1.0.2" /* kernel includes */ #include @@ -248,7 +247,6 @@ int si470x_vidioc_querycap(struct file *file, void *priv, { strlcpy(capability->driver, DRIVER_NAME, sizeof(capability->driver)); strlcpy(capability->card, DRIVER_CARD, sizeof(capability->card)); - capability->version = DRIVER_KERNEL_VERSION; capability->capabilities = V4L2_CAP_HW_FREQ_SEEK | V4L2_CAP_TUNER | V4L2_CAP_RADIO; diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c b/drivers/media/radio/si470x/radio-si470x-usb.c index ccefdaea4dc5..4cf537043f99 100644 --- a/drivers/media/radio/si470x/radio-si470x-usb.c +++ b/drivers/media/radio/si470x/radio-si470x-usb.c @@ -29,7 +29,6 @@ /* driver definitions */ #define DRIVER_AUTHOR "Tobias Lorenz " -#define DRIVER_KERNEL_VERSION KERNEL_VERSION(1, 0, 10) #define DRIVER_CARD "Silicon Labs Si470x FM Radio Receiver" #define DRIVER_DESC "USB radio driver for Si470x FM Radio Receivers" #define DRIVER_VERSION "1.0.10" @@ -626,7 +625,6 @@ int si470x_vidioc_querycap(struct file *file, void *priv, strlcpy(capability->card, DRIVER_CARD, sizeof(capability->card)); usb_make_path(radio->usbdev, capability->bus_info, sizeof(capability->bus_info)); - capability->version = DRIVER_KERNEL_VERSION; capability->capabilities = V4L2_CAP_HW_FREQ_SEEK | V4L2_CAP_TUNER | V4L2_CAP_RADIO | V4L2_CAP_RDS_CAPTURE; diff --git a/drivers/media/radio/si470x/radio-si470x.h b/drivers/media/radio/si470x/radio-si470x.h index 68da001b09dc..f300a55ed85c 100644 --- a/drivers/media/radio/si470x/radio-si470x.h +++ b/drivers/media/radio/si470x/radio-si470x.h @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/media/radio/wl128x/fmdrv.h b/drivers/media/radio/wl128x/fmdrv.h index 1a45a5d847b0..d84ad9dad323 100644 --- a/drivers/media/radio/wl128x/fmdrv.h +++ b/drivers/media/radio/wl128x/fmdrv.h @@ -28,14 +28,11 @@ #include #include #include -#include #include #include #include -#define FM_DRV_VERSION "0.10" -/* Should match with FM_DRV_VERSION */ -#define FM_DRV_RADIO_VERSION KERNEL_VERSION(0, 0, 1) +#define FM_DRV_VERSION "0.1.1" #define FM_DRV_NAME "ti_fmdrv" #define FM_DRV_CARD_SHORT_NAME "TI FM Radio" #define FM_DRV_CARD_LONG_NAME "Texas Instruments FM Radio" diff --git a/drivers/media/radio/wl128x/fmdrv_v4l2.c b/drivers/media/radio/wl128x/fmdrv_v4l2.c index 87010724f914..a4f05e018ca6 100644 --- a/drivers/media/radio/wl128x/fmdrv_v4l2.c +++ b/drivers/media/radio/wl128x/fmdrv_v4l2.c @@ -175,7 +175,6 @@ static int fm_v4l2_vidioc_querycap(struct file *file, void *priv, strlcpy(capability->card, FM_DRV_CARD_SHORT_NAME, sizeof(capability->card)); sprintf(capability->bus_info, "UART"); - capability->version = FM_DRV_RADIO_VERSION; capability->capabilities = V4L2_CAP_HW_FREQ_SEEK | V4L2_CAP_TUNER | V4L2_CAP_RADIO | V4L2_CAP_MODULATOR | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | -- cgit v1.2.3 From c20eb18ce1db6792db69f0574f7e955e9f92a213 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 25 Jun 2011 14:11:52 -0300 Subject: [media] DocBook/v4l: Document the new system-wide version behavior Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/v4l/common.xml | 10 +++++++++- Documentation/DocBook/media/v4l/v4l2.xml | 6 ++++++ Documentation/DocBook/media/v4l/vidioc-querycap.xml | 15 +++++++++------ 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/Documentation/DocBook/media/v4l/common.xml b/Documentation/DocBook/media/v4l/common.xml index 9028721438dc..a86f7a045529 100644 --- a/Documentation/DocBook/media/v4l/common.xml +++ b/Documentation/DocBook/media/v4l/common.xml @@ -236,7 +236,15 @@ important parts of the API. The &VIDIOC-QUERYCAP; ioctl is available to check if the kernel device is compatible with this specification, and to query the functions and I/O -methods supported by the device. Other features can be queried +methods supported by the device. + + Starting with kernel version 3.1, VIDIOC-QUERYCAP will return the +V4L2 API version used by the driver, with generally matches the Kernel version. +There's no need of using &VIDIOC-QUERYCAP; to check if an specific ioctl is +supported, the V4L2 core now returns ENOIOCTLCMD if a driver doesn't provide +support for an ioctl. + + Other features can be queried by calling the respective ioctl, for example &VIDIOC-ENUMINPUT; to learn about the number, types and names of video connectors on the device. Although abstraction is a major objective of this API, the diff --git a/Documentation/DocBook/media/v4l/v4l2.xml b/Documentation/DocBook/media/v4l/v4l2.xml index a7fd76d0dac1..c5ee3982cff5 100644 --- a/Documentation/DocBook/media/v4l/v4l2.xml +++ b/Documentation/DocBook/media/v4l/v4l2.xml @@ -127,6 +127,12 @@ structs, ioctls) must be noted in more detail in the history chapter (compat.xml), along with the possible impact on existing drivers and applications. --> + + 3.1 + 2011-06-27 + mcc, po + Documented that VIDIOC_QUERYCAP now returns a per-subsystem version instead of a per-driver one. + 2.6.39 2011-03-01 diff --git a/Documentation/DocBook/media/v4l/vidioc-querycap.xml b/Documentation/DocBook/media/v4l/vidioc-querycap.xml index f29f1b86213c..7aa697323c79 100644 --- a/Documentation/DocBook/media/v4l/vidioc-querycap.xml +++ b/Documentation/DocBook/media/v4l/vidioc-querycap.xml @@ -67,9 +67,8 @@ driver is not compatible with this specification the ioctl returns an Name of the driver, a unique NUL-terminated ASCII string. For example: "bttv". Driver specific applications can use this information to verify the driver identity. It is also useful -to work around known bugs, or to identify drivers in error reports. -The driver version is stored in the version -field.Storing strings in fixed sized arrays is bad +to work around known bugs, or to identify drivers in error reports. +Storing strings in fixed sized arrays is bad practice but unavoidable here. Drivers and applications should take precautions to never read or write beyond the end of the array and to make sure the strings are properly NUL-terminated. @@ -100,9 +99,13 @@ empty string (bus_info[0] = 0). @@ -110,6 +110,11 @@ Foundation. A copy of the license is included in the chapter entitled &sub-media-controller; + +&sub-gen-errors; + + + &sub-fdl-appendix; -- cgit v1.2.3 From 43c1daa47d57197c1491411a9f33189f9ef680dd Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 5 Jul 2011 11:22:28 -0300 Subject: [media] DocBook: Use the generic ioctl error codes for all V4L ioctl's Be sure that all VIDIOC_* ioctl are using the return error macro, and aren't specifying generic error codes internally. Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/v4l/gen-errors.xml | 19 +++++++++++++++++- Documentation/DocBook/media/v4l/vidioc-cropcap.xml | 13 ++---------- .../DocBook/media/v4l/vidioc-dbg-g-chip-ident.xml | 11 +---------- .../DocBook/media/v4l/vidioc-dbg-g-register.xml | 17 ---------------- Documentation/DocBook/media/v4l/vidioc-dqevent.xml | 10 +++------- .../DocBook/media/v4l/vidioc-encoder-cmd.xml | 11 +---------- .../media/v4l/vidioc-enum-frameintervals.xml | 11 ----------- .../DocBook/media/v4l/vidioc-enum-framesizes.xml | 11 ----------- .../DocBook/media/v4l/vidioc-enumaudio.xml | 12 +---------- .../DocBook/media/v4l/vidioc-enumaudioout.xml | 12 +---------- Documentation/DocBook/media/v4l/vidioc-g-audio.xml | 18 +---------------- .../DocBook/media/v4l/vidioc-g-audioout.xml | 18 +---------------- Documentation/DocBook/media/v4l/vidioc-g-crop.xml | 17 ---------------- .../DocBook/media/v4l/vidioc-g-dv-preset.xml | 12 +++-------- .../DocBook/media/v4l/vidioc-g-dv-timings.xml | 11 +++-------- .../DocBook/media/v4l/vidioc-g-enc-index.xml | 17 ---------------- Documentation/DocBook/media/v4l/vidioc-g-fbuf.xml | 19 +----------------- Documentation/DocBook/media/v4l/vidioc-g-fmt.xml | 20 ++----------------- Documentation/DocBook/media/v4l/vidioc-g-input.xml | 19 +----------------- .../DocBook/media/v4l/vidioc-g-jpegcomp.xml | 17 ---------------- .../DocBook/media/v4l/vidioc-g-output.xml | 18 +---------------- Documentation/DocBook/media/v4l/vidioc-g-parm.xml | 17 ---------------- .../DocBook/media/v4l/vidioc-g-priority.xml | 3 +-- .../DocBook/media/v4l/vidioc-g-sliced-vbi-cap.xml | 11 +---------- Documentation/DocBook/media/v4l/vidioc-g-std.xml | 9 +-------- .../DocBook/media/v4l/vidioc-log-status.xml | 17 ---------------- Documentation/DocBook/media/v4l/vidioc-overlay.xml | 11 +---------- Documentation/DocBook/media/v4l/vidioc-qbuf.xml | 17 ---------------- .../DocBook/media/v4l/vidioc-query-dv-preset.xml | 22 --------------------- .../DocBook/media/v4l/vidioc-querycap.xml | 19 ------------------ .../DocBook/media/v4l/vidioc-querystd.xml | 23 ---------------------- Documentation/DocBook/media/v4l/vidioc-reqbufs.xml | 16 --------------- .../DocBook/media/v4l/vidioc-streamon.xml | 14 +++---------- .../DocBook/media/v4l/vidioc-subdev-g-fmt.xml | 3 +++ .../DocBook/media/v4l/vidioc-subscribe-event.xml | 11 +++-------- 35 files changed, 53 insertions(+), 453 deletions(-) diff --git a/Documentation/DocBook/media/v4l/gen-errors.xml b/Documentation/DocBook/media/v4l/gen-errors.xml index 1efc688ad665..6ef476a54016 100644 --- a/Documentation/DocBook/media/v4l/gen-errors.xml +++ b/Documentation/DocBook/media/v4l/gen-errors.xml @@ -10,7 +10,24 @@ The ioctl can't be handled because the device is busy. This is typically return while device is streaming, and an ioctl tried to change something that would affect the stream, or would require the - usage of a hardware resource that was already allocated. + usage of a hardware resource that was already allocated. The ioctl + must not be retried without performing another action to fix the + problem first (typically: stop the stream before retrying). + + + EINVAL + The ioctl is not supported by the driver, actually meaning that + the required functionality is not available. + + + ENOMEM + There's not enough memory to handle the desired operation. + + + ENOSPC + On USB devices, the stream ioctl's can return this error meaning + that this request would overcommit the usb bandwidth reserved + for periodic transfers (up to 80% of the USB bandwidth).
diff --git a/Documentation/DocBook/media/v4l/vidioc-cropcap.xml b/Documentation/DocBook/media/v4l/vidioc-cropcap.xml index 816e90e283c5..b4f2f255211e 100644 --- a/Documentation/DocBook/media/v4l/vidioc-cropcap.xml +++ b/Documentation/DocBook/media/v4l/vidioc-cropcap.xml @@ -156,19 +156,10 @@ on 22 Oct 2002 subject "Re:[V4L][patches!] Re:v4l2/kernel-2.5" --> EINVAL The &v4l2-cropcap; type is -invalid or the ioctl is not supported. This is not permitted for -video capture, output and overlay devices, which must support -VIDIOC_CROPCAP. +invalid. This is not permitted for video capture, output and overlay devices, +which must support VIDIOC_CROPCAP. - - diff --git a/Documentation/DocBook/media/v4l/vidioc-dbg-g-chip-ident.xml b/Documentation/DocBook/media/v4l/vidioc-dbg-g-chip-ident.xml index 4a09e203af0f..4ecd966808de 100644 --- a/Documentation/DocBook/media/v4l/vidioc-dbg-g-chip-ident.xml +++ b/Documentation/DocBook/media/v4l/vidioc-dbg-g-chip-ident.xml @@ -258,18 +258,9 @@ could not identify it. EINVAL - The driver does not support this ioctl, or the -match_type is invalid. + The match_type is invalid. - - diff --git a/Documentation/DocBook/media/v4l/vidioc-dbg-g-register.xml b/Documentation/DocBook/media/v4l/vidioc-dbg-g-register.xml index 980c7f3e2fd6..a44aebc7997a 100644 --- a/Documentation/DocBook/media/v4l/vidioc-dbg-g-register.xml +++ b/Documentation/DocBook/media/v4l/vidioc-dbg-g-register.xml @@ -246,15 +246,6 @@ register. &return-value; - - EINVAL - - The driver does not support this ioctl, or the kernel -was not compiled with the CONFIG_VIDEO_ADV_DEBUG -option, or the match_type is invalid, or the -selected chip or register does not exist. - - EPERM @@ -265,11 +256,3 @@ to execute these ioctls. - - diff --git a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml index b8c4f7657d69..7769642ee431 100644 --- a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml +++ b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml @@ -136,11 +136,7 @@ + + &return-value; + - diff --git a/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml b/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml index b0dde943825c..af7f3f2a36dd 100644 --- a/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml +++ b/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml @@ -180,8 +180,7 @@ Pictures, rather than immediately. EINVAL - The driver does not support this ioctl, or the -cmd field is invalid. + The cmd field is invalid. @@ -194,11 +193,3 @@ the encoder was not running. - - diff --git a/Documentation/DocBook/media/v4l/vidioc-enum-frameintervals.xml b/Documentation/DocBook/media/v4l/vidioc-enum-frameintervals.xml index 3c216e113a54..5fd72c4c33e3 100644 --- a/Documentation/DocBook/media/v4l/vidioc-enum-frameintervals.xml +++ b/Documentation/DocBook/media/v4l/vidioc-enum-frameintervals.xml @@ -254,17 +254,6 @@ enumerated. &return-value; - - See the description section above for a list of return -values that errno can have. - - diff --git a/Documentation/DocBook/media/v4l/vidioc-enum-framesizes.xml b/Documentation/DocBook/media/v4l/vidioc-enum-framesizes.xml index 6afa4542c818..f77a13f486d7 100644 --- a/Documentation/DocBook/media/v4l/vidioc-enum-framesizes.xml +++ b/Documentation/DocBook/media/v4l/vidioc-enum-framesizes.xml @@ -267,16 +267,5 @@ application should zero out all members except for the &return-value; - - See the description section above for a list of return -values that errno can have. - - diff --git a/Documentation/DocBook/media/v4l/vidioc-enumaudio.xml b/Documentation/DocBook/media/v4l/vidioc-enumaudio.xml index 9ae8f2d3a96f..ea816ab2e49e 100644 --- a/Documentation/DocBook/media/v4l/vidioc-enumaudio.xml +++ b/Documentation/DocBook/media/v4l/vidioc-enumaudio.xml @@ -68,19 +68,9 @@ until the driver returns EINVAL. EINVAL - The number of the audio input is out of bounds, or -there are no audio inputs at all and this ioctl is not -supported. + The number of the audio input is out of bounds. - - diff --git a/Documentation/DocBook/media/v4l/vidioc-enumaudioout.xml b/Documentation/DocBook/media/v4l/vidioc-enumaudioout.xml index d3d7c0ab17b8..2e87cedb0d32 100644 --- a/Documentation/DocBook/media/v4l/vidioc-enumaudioout.xml +++ b/Documentation/DocBook/media/v4l/vidioc-enumaudioout.xml @@ -71,19 +71,9 @@ signal to a sound card are not audio outputs in this sense. EINVAL - The number of the audio output is out of bounds, or -there are no audio outputs at all and this ioctl is not -supported. + The number of the audio output is out of bounds. - - diff --git a/Documentation/DocBook/media/v4l/vidioc-g-audio.xml b/Documentation/DocBook/media/v4l/vidioc-g-audio.xml index 65361a8c2b05..d7bb9b3738f6 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-audio.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-audio.xml @@ -164,25 +164,9 @@ tuner. No audio inputs combine with the current video input, or the number of the selected audio input is out of bounds or it does -not combine, or there are no audio inputs at all and the ioctl is not -supported. - - - - EBUSY - - I/O is in progress, the input cannot be -switched. +not combine. - - diff --git a/Documentation/DocBook/media/v4l/vidioc-g-audioout.xml b/Documentation/DocBook/media/v4l/vidioc-g-audioout.xml index 3632730c5c6e..200a2704a970 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-audioout.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-audioout.xml @@ -130,25 +130,9 @@ applications must set the array to zero. No audio outputs combine with the current video output, or the number of the selected audio output is out of bounds or -it does not combine, or there are no audio outputs at all and the -ioctl is not supported. - - - - EBUSY - - I/O is in progress, the output cannot be -switched. +it does not combine. - - diff --git a/Documentation/DocBook/media/v4l/vidioc-g-crop.xml b/Documentation/DocBook/media/v4l/vidioc-g-crop.xml index d235b1dedbed..01a50640dce0 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-crop.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-crop.xml @@ -122,22 +122,5 @@ for &v4l2-cropcap; bounds is used. &return-value; - - - - EINVAL - - Cropping is not supported. - - - - - diff --git a/Documentation/DocBook/media/v4l/vidioc-g-dv-preset.xml b/Documentation/DocBook/media/v4l/vidioc-g-dv-preset.xml index d733721a7519..7940c1149393 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-dv-preset.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-dv-preset.xml @@ -97,14 +97,8 @@ If the preset is not supported, it returns an &EINVAL; - + + + &return-value; - - diff --git a/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml b/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml index d5ec6abf0ce2..4a8648ae9a63 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml @@ -212,12 +212,7 @@ bit 0 (V4L2_DV_VSYNC_POS_POL) is for vertical sync polarity and bit 1 (V4L2_DV_H + + &return-value; + - - diff --git a/Documentation/DocBook/media/v4l/vidioc-g-enc-index.xml b/Documentation/DocBook/media/v4l/vidioc-g-enc-index.xml index 9f242e4b2948..2aef02c9044e 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-enc-index.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-enc-index.xml @@ -192,22 +192,5 @@ this mask to obtain the picture coding type. &return-value; - - - - EINVAL - - The driver does not support this ioctl. - - - - - diff --git a/Documentation/DocBook/media/v4l/vidioc-g-fbuf.xml b/Documentation/DocBook/media/v4l/vidioc-g-fbuf.xml index e7dda4822f04..055718231bc1 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-fbuf.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-fbuf.xml @@ -445,29 +445,12 @@ by a privileged user to negotiate the parameters for a destructive overlay. - - EBUSY - - The framebuffer parameters cannot be changed at this -time because overlay is already enabled, or capturing is enabled -and the hardware cannot capture and overlay simultaneously. - - EINVAL - The ioctl is not supported or the -VIDIOC_S_FBUF parameters are unsuitable. + The VIDIOC_S_FBUF parameters are unsuitable. - - diff --git a/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml b/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml index a4ae59b664eb..17fbda15137b 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml @@ -183,30 +183,14 @@ capture and output devices. &return-value; - - EBUSY - - The data format cannot be changed at this -time, for example because I/O is already in progress. - - EINVAL The &v4l2-format; type -field is invalid, the requested buffer type not supported, or -VIDIOC_TRY_FMT was called and is not -supported with this buffer type. +field is invalid, the requested buffer type not supported, or the +format is not supported with this buffer type. - - diff --git a/Documentation/DocBook/media/v4l/vidioc-g-input.xml b/Documentation/DocBook/media/v4l/vidioc-g-input.xml index ed076e92760d..08ae82f131f2 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-input.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-input.xml @@ -75,26 +75,9 @@ querying or negotiating any other parameters. EINVAL - The number of the video input is out of bounds, or -there are no video inputs at all and this ioctl is not -supported. - - - - EBUSY - - I/O is in progress, the input cannot be -switched. + The number of the video input is out of bounds. - - diff --git a/Documentation/DocBook/media/v4l/vidioc-g-jpegcomp.xml b/Documentation/DocBook/media/v4l/vidioc-g-jpegcomp.xml index 77394b287411..01ea24b84385 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-jpegcomp.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-jpegcomp.xml @@ -159,22 +159,5 @@ to add them. &return-value; - - - - EINVAL - - This ioctl is not supported. - - - - - diff --git a/Documentation/DocBook/media/v4l/vidioc-g-output.xml b/Documentation/DocBook/media/v4l/vidioc-g-output.xml index 3ea8c0ed812e..fd45f1c13ccf 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-output.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-output.xml @@ -76,25 +76,9 @@ negotiating any other parameters. EINVAL The number of the video output is out of bounds, or -there are no video outputs at all and this ioctl is not -supported. - - - - EBUSY - - I/O is in progress, the output cannot be -switched. +there are no video outputs at all. - - diff --git a/Documentation/DocBook/media/v4l/vidioc-g-parm.xml b/Documentation/DocBook/media/v4l/vidioc-g-parm.xml index 392aa9e5571e..19b1d85dd668 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-parm.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-parm.xml @@ -311,22 +311,5 @@ excessive motion blur. &return-value; - - - - EINVAL - - This ioctl is not supported. - - - - - diff --git a/Documentation/DocBook/media/v4l/vidioc-g-priority.xml b/Documentation/DocBook/media/v4l/vidioc-g-priority.xml index 5fb001978645..8f5e3da7002f 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-priority.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-priority.xml @@ -120,8 +120,7 @@ recording. EINVAL - The requested priority value is invalid, or the -driver does not support access priorities. + The requested priority value is invalid. diff --git a/Documentation/DocBook/media/v4l/vidioc-g-sliced-vbi-cap.xml b/Documentation/DocBook/media/v4l/vidioc-g-sliced-vbi-cap.xml index 10e721b17374..71741daaf725 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-sliced-vbi-cap.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-sliced-vbi-cap.xml @@ -246,19 +246,10 @@ line systems. EINVAL - The device does not support sliced VBI capturing or -output, or the value in the type field is + The value in the type field is wrong. - - diff --git a/Documentation/DocBook/media/v4l/vidioc-g-std.xml b/Documentation/DocBook/media/v4l/vidioc-g-std.xml index 912f8513e5da..37996f25b5d4 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-std.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-std.xml @@ -82,14 +82,7 @@ standards. EINVAL - This ioctl is not supported, or the -VIDIOC_S_STD parameter was unsuitable. - - - - EBUSY - - The device is busy and therefore can not change the standard + The VIDIOC_S_STD parameter was unsuitable. diff --git a/Documentation/DocBook/media/v4l/vidioc-log-status.xml b/Documentation/DocBook/media/v4l/vidioc-log-status.xml index 2634b7c88b58..5ded7d35e27b 100644 --- a/Documentation/DocBook/media/v4l/vidioc-log-status.xml +++ b/Documentation/DocBook/media/v4l/vidioc-log-status.xml @@ -37,22 +37,5 @@ was introduced in Linux 2.6.15. &return-value; - - - - EINVAL - - The driver does not support this ioctl. - - - - - diff --git a/Documentation/DocBook/media/v4l/vidioc-overlay.xml b/Documentation/DocBook/media/v4l/vidioc-overlay.xml index 1036c582cc15..250a7de1877f 100644 --- a/Documentation/DocBook/media/v4l/vidioc-overlay.xml +++ b/Documentation/DocBook/media/v4l/vidioc-overlay.xml @@ -65,19 +65,10 @@ EINVAL - Video overlay is not supported, or the -parameters have not been set up. See The overlay parameters have not been set up. See for the necessary steps. - - diff --git a/Documentation/DocBook/media/v4l/vidioc-qbuf.xml b/Documentation/DocBook/media/v4l/vidioc-qbuf.xml index f2b11f8a4031..9caa49af580f 100644 --- a/Documentation/DocBook/media/v4l/vidioc-qbuf.xml +++ b/Documentation/DocBook/media/v4l/vidioc-qbuf.xml @@ -158,15 +158,6 @@ or no buffers have been allocated yet, or the userptr or length are invalid. - - - ENOMEM - - Not enough physical or virtual memory was available to -enqueue a user pointer buffer. - - - EIO VIDIOC_DQBUF failed due to an @@ -184,11 +175,3 @@ continue streaming. - - diff --git a/Documentation/DocBook/media/v4l/vidioc-query-dv-preset.xml b/Documentation/DocBook/media/v4l/vidioc-query-dv-preset.xml index d272f7ab91b8..23b17f604211 100644 --- a/Documentation/DocBook/media/v4l/vidioc-query-dv-preset.xml +++ b/Documentation/DocBook/media/v4l/vidioc-query-dv-preset.xml @@ -61,27 +61,5 @@ returned. &return-value; - - - EINVAL - - This ioctl is not supported. - - - - EBUSY - - The device is busy and therefore can not sense the preset - - - - - diff --git a/Documentation/DocBook/media/v4l/vidioc-querycap.xml b/Documentation/DocBook/media/v4l/vidioc-querycap.xml index 7aa697323c79..e3664d6f2de4 100644 --- a/Documentation/DocBook/media/v4l/vidioc-querycap.xml +++ b/Documentation/DocBook/media/v4l/vidioc-querycap.xml @@ -283,24 +283,5 @@ linkend="mmap">streaming I/O method. &return-value; - - - - EINVAL - - The device is not compatible with this -specification. - - - - - - diff --git a/Documentation/DocBook/media/v4l/vidioc-querystd.xml b/Documentation/DocBook/media/v4l/vidioc-querystd.xml index 1a9e60393091..4b79c7c04ed6 100644 --- a/Documentation/DocBook/media/v4l/vidioc-querystd.xml +++ b/Documentation/DocBook/media/v4l/vidioc-querystd.xml @@ -62,28 +62,5 @@ current video input or output. &return-value; - - - - EINVAL - - This ioctl is not supported. - - - - EBUSY - - The device is busy and therefore can not detect the standard - - - - - diff --git a/Documentation/DocBook/media/v4l/vidioc-reqbufs.xml b/Documentation/DocBook/media/v4l/vidioc-reqbufs.xml index 69800ae23348..7be4b1d29b90 100644 --- a/Documentation/DocBook/media/v4l/vidioc-reqbufs.xml +++ b/Documentation/DocBook/media/v4l/vidioc-reqbufs.xml @@ -121,14 +121,6 @@ higher. This array should be zeroed by applications. &return-value; - - EBUSY - - The driver supports multiple opens and I/O is already -in progress, or reallocation of buffers was attempted although one or -more are still mapped. - - EINVAL @@ -140,11 +132,3 @@ supported. - - diff --git a/Documentation/DocBook/media/v4l/vidioc-streamon.xml b/Documentation/DocBook/media/v4l/vidioc-streamon.xml index 75ed39bf4d2b..81cca4569050 100644 --- a/Documentation/DocBook/media/v4l/vidioc-streamon.xml +++ b/Documentation/DocBook/media/v4l/vidioc-streamon.xml @@ -88,9 +88,9 @@ synchronize with other events. EINVAL - Streaming I/O is not supported, the buffer -type is not supported, or no buffers have -been allocated (memory mapping) or enqueued (output) yet. + The buffertype is not supported, + or no buffers have been allocated (memory mapping) or enqueued + (output) yet. @@ -105,11 +105,3 @@ been allocated (memory mapping) or enqueued (output) yet. - - diff --git a/Documentation/DocBook/media/v4l/vidioc-subdev-g-fmt.xml b/Documentation/DocBook/media/v4l/vidioc-subdev-g-fmt.xml index f367c570c530..a67cde6f8c54 100644 --- a/Documentation/DocBook/media/v4l/vidioc-subdev-g-fmt.xml +++ b/Documentation/DocBook/media/v4l/vidioc-subdev-g-fmt.xml @@ -177,4 +177,7 @@ + + &return-value; + diff --git a/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml b/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml index 25471e8e5da5..69c0d8a2a3d2 100644 --- a/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml +++ b/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml @@ -290,13 +290,8 @@ - + + + &return-value; - -- cgit v1.2.3 From dfcf4f9d97eec997283e41cef2d2b6956c32fecd Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 5 Jul 2011 11:37:58 -0300 Subject: [media] DocBook: Use the generic error code page also for MC API Instead of having their own generic error codes at the MC API, move its section to the generic one and be sure that all media ioctl's will point to it. Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/v4l/gen-errors.xml | 16 +++++++- .../DocBook/media/v4l/media-func-ioctl.xml | 48 +--------------------- .../DocBook/media/v4l/media-ioc-device-info.xml | 3 +- 3 files changed, 18 insertions(+), 49 deletions(-) diff --git a/Documentation/DocBook/media/v4l/gen-errors.xml b/Documentation/DocBook/media/v4l/gen-errors.xml index 6ef476a54016..9bf9ca7f46dc 100644 --- a/Documentation/DocBook/media/v4l/gen-errors.xml +++ b/Documentation/DocBook/media/v4l/gen-errors.xml @@ -5,6 +5,11 @@ &cs-str; + + + EBADF + fd is not a valid open file descriptor. + EBUSY The ioctl can't be handled because the device is busy. This is @@ -14,8 +19,17 @@ must not be retried without performing another action to fix the problem first (typically: stop the stream before retrying). + + EFAULT + fd is not a valid open file descriptor. + EINVAL + One or more of the ioctl parameters are invalid. This is a widely + used error code. See the individual ioctl requests for actual causes. + + + EINVAL or ENOTTY The ioctl is not supported by the driver, actually meaning that the required functionality is not available. @@ -25,7 +39,7 @@ ENOSPC - On USB devices, the stream ioctl's can return this error meaning + On USB devices, the stream ioctl's can return this error, meaning that this request would overcommit the usb bandwidth reserved for periodic transfers (up to 80% of the USB bandwidth). diff --git a/Documentation/DocBook/media/v4l/media-func-ioctl.xml b/Documentation/DocBook/media/v4l/media-func-ioctl.xml index bda8604de15c..e0ee285baf1c 100644 --- a/Documentation/DocBook/media/v4l/media-func-ioctl.xml +++ b/Documentation/DocBook/media/v4l/media-func-ioctl.xml @@ -63,54 +63,10 @@ - Return Value - - ioctl() returns 0 on - success. On failure, -1 is returned, and the - errno variable is set appropriately. Generic error codes - are listed below, and request-specific error codes are listed in the + &return-value; + Request-specific error codes are listed in the individual requests descriptions. When an ioctl that takes an output or read/write parameter fails, the parameter remains unmodified. - - - - EBADF - - fd is not a valid open file descriptor. - - - - - EFAULT - - argp references an inaccessible memory - area. - - - - EINVAL - - The request or the data pointed to by - argp is not valid. This is a very common error - code, see the individual ioctl requests listed in - for actual causes. - - - - ENOMEM - - Insufficient kernel memory was available to complete the - request. - - - - ENOTTY - - fd is not associated with a character - special device. - - - diff --git a/Documentation/DocBook/media/v4l/media-ioc-device-info.xml b/Documentation/DocBook/media/v4l/media-ioc-device-info.xml index 1f3237351bba..2ce521419e67 100644 --- a/Documentation/DocBook/media/v4l/media-ioc-device-info.xml +++ b/Documentation/DocBook/media/v4l/media-ioc-device-info.xml @@ -127,7 +127,6 @@ - Return value - This function doesn't return specific error codes. + &return-value; -- cgit v1.2.3 From 9e1d50756bad35c7e1b566bed9426f68d93135fd Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 5 Jul 2011 11:39:53 -0300 Subject: [media] DocBook/media-ioc-setup-link.xml: Remove EBUSY The EBUSY is already described as a generic error condition, with a similar text. Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/v4l/media-ioc-setup-link.xml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Documentation/DocBook/media/v4l/media-ioc-setup-link.xml b/Documentation/DocBook/media/v4l/media-ioc-setup-link.xml index cec97af4dab4..fc2e522ee65a 100644 --- a/Documentation/DocBook/media/v4l/media-ioc-setup-link.xml +++ b/Documentation/DocBook/media/v4l/media-ioc-setup-link.xml @@ -71,15 +71,6 @@ &return-value; - - EBUSY - - The link properties can't be changed because the link is - currently busy. This can be caused, for instance, by an active media - stream (audio or video) on the link. The ioctl shouldn't be retried if - no other action is performed before to fix the problem. - - EINVAL -- cgit v1.2.3 From 4c14e4a93f02e89e7d0a62604a7652f61057c923 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 5 Jul 2011 11:57:05 -0300 Subject: [media] DocBook: Remove V4L generic error description for ioctl() V4L ioctl function descripton also has a generic error chapter. Remove it, as it is now obsoleted by a general, multi-API generic error descriptions. Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/v4l/func-ioctl.xml | 72 +--------------------- Documentation/DocBook/media/v4l/gen-errors.xml | 10 ++- .../DocBook/media/v4l/media-func-ioctl.xml | 1 + 3 files changed, 13 insertions(+), 70 deletions(-) diff --git a/Documentation/DocBook/media/v4l/func-ioctl.xml b/Documentation/DocBook/media/v4l/func-ioctl.xml index b60fd37a6295..2de64be706f5 100644 --- a/Documentation/DocBook/media/v4l/func-ioctl.xml +++ b/Documentation/DocBook/media/v4l/func-ioctl.xml @@ -64,75 +64,9 @@ their respective function and parameters are specified in - Return Value - - On success the ioctl() function returns -0 and does not reset the -errno variable. On failure --1 is returned, when the ioctl takes an -output or read/write parameter it remains unmodified, and the -errno variable is set appropriately. See below for -possible error codes. Generic errors like EBADF -or EFAULT are not listed in the sections -discussing individual ioctl requests. - Note ioctls may return undefined error codes. Since errors -may have side effects such as a driver reset applications should -abort on unexpected errors. - - - - EBADF - - fd is not a valid open file -descriptor. - - - - EBUSY - - The property cannot be changed right now. Typically -this error code is returned when I/O is in progress or the driver -supports multiple opens and another process locked the property. - - - - EFAULT - - argp references an inaccessible -memory area. - - - - ENOTTY - - fd is not associated with a -character special device. - - - - EINVAL - - The request or the data pointed -to by argp is not valid. This is a very common -error code, see the individual ioctl requests listed in for actual causes. - - - - ENOMEM - - Not enough physical or virtual memory was available to -complete the request. - - - - ERANGE - - The application attempted to set a control with the -&VIDIOC-S-CTRL; ioctl to a value which is out of bounds. - - - + &return-value; + When an ioctl that takes an output or read/write parameter fails, + the parameter remains unmodified. diff --git a/Documentation/DocBook/media/v4l/gen-errors.xml b/Documentation/DocBook/media/v4l/gen-errors.xml index 9bf9ca7f46dc..4268c658652f 100644 --- a/Documentation/DocBook/media/v4l/gen-errors.xml +++ b/Documentation/DocBook/media/v4l/gen-errors.xml @@ -31,7 +31,8 @@ EINVAL or ENOTTY The ioctl is not supported by the driver, actually meaning that - the required functionality is not available. + the required functionality is not available, or the file + descriptor is not for a media device. ENOMEM @@ -46,3 +47,10 @@ + +Note 1: ioctls may return other error codes. Since errors may have side +effects such as a driver reset, applications should abort on unexpected errors. + + +Note 2: Request-specific error codes are listed in the individual +requests descriptions. diff --git a/Documentation/DocBook/media/v4l/media-func-ioctl.xml b/Documentation/DocBook/media/v4l/media-func-ioctl.xml index e0ee285baf1c..39478d0fbcaa 100644 --- a/Documentation/DocBook/media/v4l/media-func-ioctl.xml +++ b/Documentation/DocBook/media/v4l/media-func-ioctl.xml @@ -64,6 +64,7 @@ &return-value; + Request-specific error codes are listed in the individual requests descriptions. When an ioctl that takes an output or read/write parameter fails, -- cgit v1.2.3 From 10dc380f79a9f6f7c34d5a0e92f6b056d9a77d79 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 5 Jul 2011 12:02:12 -0300 Subject: [media] DocBook: Add an error code session for LIRC interface Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/v4l/lirc_device_interface.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/DocBook/media/v4l/lirc_device_interface.xml b/Documentation/DocBook/media/v4l/lirc_device_interface.xml index 0e0453f39e73..a060f3fb6ca0 100644 --- a/Documentation/DocBook/media/v4l/lirc_device_interface.xml +++ b/Documentation/DocBook/media/v4l/lirc_device_interface.xml @@ -248,4 +248,8 @@ on working with the default settings initially.
+ +
+ &return-value; +
-- cgit v1.2.3 From c55d6f8270cab805983aba8cdf1d1980167d3517 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 5 Jul 2011 12:07:54 -0300 Subject: [media] DocBook: Add return error codes to LIRC ioctl session Add a reference for the generic error code chapter to LIRC ioctl description. Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/v4l/lirc_device_interface.xml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Documentation/DocBook/media/v4l/lirc_device_interface.xml b/Documentation/DocBook/media/v4l/lirc_device_interface.xml index a060f3fb6ca0..8d7eb6bf6312 100644 --- a/Documentation/DocBook/media/v4l/lirc_device_interface.xml +++ b/Documentation/DocBook/media/v4l/lirc_device_interface.xml @@ -246,10 +246,8 @@ on working with the default settings initially. - -
-
- &return-value; + &return-value; +
-- cgit v1.2.3 From d316b5fba37621a70893af56968ed899b1179a63 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 6 Jul 2011 12:55:29 -0300 Subject: [media] siano: bad parameter is -EINVAL and not -EFAULT Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index 78765ed28063..7331e8450d1a 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -1147,7 +1147,7 @@ static int smscore_validate_client(struct smscore_device_t *coredev, if (!client) { sms_err("bad parameter."); - return -EFAULT; + return -EINVAL; } registered_client = smscore_find_client(coredev, data_type, id); if (registered_client == client) -- cgit v1.2.3 From 7464aa50c6529c1da6a80496911e16244119fd16 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 6 Jul 2011 12:41:21 -0300 Subject: [media] nxt6000: i2c bus error should return -EIO data from/to userspace. Don't mix it with I2C bus error (-EIO). Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/nxt6000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb/frontends/nxt6000.c b/drivers/media/dvb/frontends/nxt6000.c index a763ec756f7f..6599b8fea9e9 100644 --- a/drivers/media/dvb/frontends/nxt6000.c +++ b/drivers/media/dvb/frontends/nxt6000.c @@ -50,7 +50,7 @@ static int nxt6000_writereg(struct nxt6000_state* state, u8 reg, u8 data) if ((ret = i2c_transfer(state->i2c, &msg, 1)) != 1) dprintk("nxt6000: nxt6000_write error (reg: 0x%02X, data: 0x%02X, ret: %d)\n", reg, data, ret); - return (ret != 1) ? -EFAULT : 0; + return (ret != 1) ? -EIO : 0; } static u8 nxt6000_readreg(struct nxt6000_state* state, u8 reg) -- cgit v1.2.3 From 3de530f805c012d3b58ffdd10e43e3ec7790baa3 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 5 Jul 2011 12:36:01 -0300 Subject: [media] DVB: Point to the generic error chapter Just like the V4L, MC and LIRC API's, point to the generic error chapter for ioctl's. This will allow moving generic error codes to just one place inside all media API's. A latter patch will remove the generic errors from each specific ioctl. Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/dvb/audio.xml | 63 +++++++------------- Documentation/DocBook/media/dvb/ca.xml | 6 +- Documentation/DocBook/media/dvb/demux.xml | 33 ++++------- Documentation/DocBook/media/dvb/dvbproperty.xml | 5 +- Documentation/DocBook/media/dvb/frontend.xml | 58 +++++++----------- Documentation/DocBook/media/dvb/video.xml | 78 +++++++++---------------- Documentation/DocBook/media_api.tmpl | 1 + 7 files changed, 83 insertions(+), 161 deletions(-) diff --git a/Documentation/DocBook/media/dvb/audio.xml b/Documentation/DocBook/media/dvb/audio.xml index c27fe73a4b66..90e9b7fede65 100644 --- a/Documentation/DocBook/media/dvb/audio.xml +++ b/Documentation/DocBook/media/dvb/audio.xml @@ -220,8 +220,7 @@ and right. (blocking mode is the default) -ERRORS - +RETURN VALUE ENODEV @@ -279,8 +278,7 @@ and right. File descriptor returned by a previous call to open(). -ERRORS - +RETURN VALUE EBADF @@ -335,8 +333,7 @@ and right. Size of buf. -ERRORS - +RETURN VALUE EPERM @@ -394,8 +391,7 @@ role="subsection">AUDIO_STOP Equals AUDIO_STOP for this command. -ERRORS - +&return-value-dvb; EBADF @@ -446,8 +442,7 @@ role="subsection">AUDIO_PLAY Equals AUDIO_PLAY for this command. -ERRORS - +&return-value-dvb; EBADF @@ -506,8 +501,7 @@ role="subsection">AUDIO_PAUSE Equals AUDIO_PAUSE for this command. -ERRORS - +&return-value-dvb; EBADF @@ -563,8 +557,7 @@ with AUDIO_PAUSE command. Equals AUDIO_CONTINUE for this command. -ERRORS - +&return-value-dvb; EBADF @@ -627,8 +620,7 @@ role="subsection">AUDIO_SELECT_SOURCE stream. -ERRORS - +&return-value-dvb; EBADF @@ -706,8 +698,7 @@ role="subsection">AUDIO_SET_MUTE FALSE Audio Un-mute -ERRORS - +&return-value-dvb; EBADF @@ -785,8 +776,7 @@ role="subsection">AUDIO_SET_AV_SYNC FALSE AV-sync OFF -ERRORS - +&return-value-dvb; EBADF @@ -868,8 +858,7 @@ role="subsection">AUDIO_SET_BYPASS_MODE FALSE Bypass is enabled -ERRORS - +&return-value-dvb; EBADF @@ -937,8 +926,7 @@ role="subsection">AUDIO_CHANNEL_SELECT stereo). -ERRORS - +&return-value-dvb; EBADF @@ -1005,8 +993,7 @@ role="subsection">AUDIO_GET_STATUS Returns the current state of Audio Device. -ERRORS - +&return-value-dvb; EBADF @@ -1073,8 +1060,7 @@ role="subsection">AUDIO_GET_CAPABILITIES Returns a bit array of supported sound formats. -ERRORS - +&return-value-dvb; EBADF @@ -1132,8 +1118,7 @@ role="subsection">AUDIO_CLEAR_BUFFER Equals AUDIO_CLEAR_BUFFER for this command. -ERRORS - +&return-value-dvb; EBADF @@ -1196,8 +1181,7 @@ role="subsection">AUDIO_SET_ID audio sub-stream id -ERRORS - +&return-value-dvb; EBADF @@ -1262,8 +1246,7 @@ role="subsection">AUDIO_SET_MIXER mixer settings. -ERRORS - +&return-value-dvb; EBADF @@ -1330,8 +1313,7 @@ role="subsection">AUDIO_SET_STREAMTYPE stream type -ERRORS - +&return-value-dvb; EBADF @@ -1390,8 +1372,7 @@ role="subsection">AUDIO_SET_EXT_ID audio sub_stream_id -ERRORS - +&return-value-dvb; EBADF @@ -1451,8 +1432,7 @@ role="subsection">AUDIO_SET_ATTRIBUTES audio attributes according to section ?? -ERRORS - +&return-value-dvb; EBADF @@ -1512,8 +1492,7 @@ role="subsection">AUDIO_SET_KARAOKE karaoke settings according to section ??. -ERRORS - +&return-value-dvb; EBADF diff --git a/Documentation/DocBook/media/dvb/ca.xml b/Documentation/DocBook/media/dvb/ca.xml index a6cb9522f289..5c4adb44b1c1 100644 --- a/Documentation/DocBook/media/dvb/ca.xml +++ b/Documentation/DocBook/media/dvb/ca.xml @@ -158,8 +158,7 @@ typedef struct ca_pid { (blocking mode is the default) -ERRORS - +RETURN VALUE ENODEV @@ -217,8 +216,7 @@ typedef struct ca_pid { File descriptor returned by a previous call to open(). -ERRORS - +RETURN VALUE EBADF diff --git a/Documentation/DocBook/media/dvb/demux.xml b/Documentation/DocBook/media/dvb/demux.xml index 6758739cd611..e5058d7d9213 100644 --- a/Documentation/DocBook/media/dvb/demux.xml +++ b/Documentation/DocBook/media/dvb/demux.xml @@ -239,8 +239,7 @@ typedef enum { (blocking mode is the default) -ERRORS - +RETURN VALUE ENODEV @@ -299,8 +298,7 @@ typedef enum { File descriptor returned by a previous call to open(). -ERRORS - +RETURN VALUE EBADF @@ -381,8 +379,7 @@ typedef enum { Size of buf. -ERRORS - +RETURN VALUE EWOULDBLOCK @@ -485,8 +482,7 @@ typedef enum { Size of buf. -ERRORS - +RETURN VALUE EWOULDBLOCK @@ -553,8 +549,7 @@ typedef enum { Equals DMX_START for this command. -ERRORS - +&return-value-dvb; EBADF @@ -619,8 +614,7 @@ typedef enum { Equals DMX_STOP for this command. -ERRORS - +&return-value-dvb; EBADF @@ -682,8 +676,7 @@ typedef enum { Pointer to structure containing filter parameters. -ERRORS - +&return-value-dvb; EBADF @@ -755,8 +748,7 @@ typedef enum { Pointer to structure containing filter parameters. -ERRORS - +&return-value-dvb; EBADF @@ -827,8 +819,7 @@ typedef enum { Size of circular buffer. -ERRORS - +&return-value-dvb; EBADF @@ -900,8 +891,7 @@ typedef enum { Pointer to the location where the event is to be stored. -ERRORS - +&return-value-dvb; EBADF @@ -974,8 +964,7 @@ typedef enum { Pointer to the location where the stc is to be stored. -ERRORS - +&return-value-dvb; EBADF diff --git a/Documentation/DocBook/media/dvb/dvbproperty.xml b/Documentation/DocBook/media/dvb/dvbproperty.xml index caec58c60032..33274bcc8592 100644 --- a/Documentation/DocBook/media/dvb/dvbproperty.xml +++ b/Documentation/DocBook/media/dvb/dvbproperty.xml @@ -80,7 +80,7 @@ struct dtv_properties { Points to the location where the front-end property commands are stored. -ERRORS +&return-value-dvb; EINVAL Invalid parameter(s) received or number of parameters out of the range. @@ -137,8 +137,7 @@ struct dtv_properties { Points to the location where the front-end property commands are stored. -ERRORS - +&return-value-dvb; EINVAL Invalid parameter(s) received or number of parameters out of the range. diff --git a/Documentation/DocBook/media/dvb/frontend.xml b/Documentation/DocBook/media/dvb/frontend.xml index 304d54ed3cbf..c5a5cb4051be 100644 --- a/Documentation/DocBook/media/dvb/frontend.xml +++ b/Documentation/DocBook/media/dvb/frontend.xml @@ -515,8 +515,7 @@ typedef enum fe_hierarchy { (blocking mode is the default) -ERRORS - +RETURN VALUE ENODEV @@ -576,8 +575,7 @@ typedef enum fe_hierarchy { File descriptor returned by a previous call to open(). -ERRORS - +&return-value-dvb; EBADF @@ -633,8 +631,7 @@ typedef enum fe_hierarchy { to be stored. -ERRORS - +RETURN VALUE EBADF @@ -695,8 +692,7 @@ typedef enum fe_hierarchy { The bit error rate is stored into *ber. -ERRORS - +&return-value-dvb; EBADF @@ -773,8 +769,7 @@ typedef enum fe_hierarchy { -ERRORS - +&return-value-dvb; EBADF @@ -851,8 +846,7 @@ typedef enum fe_hierarchy { The signal strength value is stored into *strength. -ERRORS - +&return-value-dvb; EBADF @@ -936,8 +930,7 @@ typedef enum fe_hierarchy { so far. -ERRORS - +&return-value-dvb; EBADF @@ -1012,8 +1005,7 @@ typedef enum fe_hierarchy { Points to parameters for tuning operation. -ERRORS - +&return-value-dvb; EBADF @@ -1085,8 +1077,7 @@ typedef enum fe_hierarchy { -ERRORS - +&return-value-dvb; @@ -1187,8 +1178,7 @@ typedef enum fe_hierarchy { -ERRORS - +&return-value-dvb; EBADF @@ -1273,8 +1263,7 @@ typedef enum fe_hierarchy { to be stored. -ERRORS - +&return-value-dvb; EBADF @@ -1332,8 +1321,7 @@ typedef enum fe_hierarchy { -ERRORS - +&return-value-dvb; EBADF @@ -1405,8 +1393,7 @@ typedef enum fe_hierarchy { -ERRORS - +&return-value-dvb; EBADF @@ -1493,8 +1480,7 @@ typedef enum fe_hierarchy { Pointer to the command to be received. -ERRORS - +&return-value-dvb; EBADF @@ -1579,8 +1565,7 @@ typedef enum fe_hierarchy { -ERRORS - +&return-value-dvb; EBADF @@ -1663,8 +1648,7 @@ typedef enum fe_hierarchy { The requested tone generation mode (on/off). -ERRORS - +&return-value-dvb; ENODEV @@ -1748,8 +1732,7 @@ typedef enum fe_hierarchy { -ERRORS - +&return-value-dvb; ENODEV @@ -1834,8 +1817,7 @@ typedef enum fe_hierarchy { -ERRORS - +&return-value-dvb; ENODEV @@ -1903,7 +1885,7 @@ FE_TUNE_MODE_ONESHOT When set, this flag will disable any zigzagging or other "n -ERRORS +&return-value-dvb; EINVAL Invalid argument. @@ -1941,7 +1923,7 @@ sends the specified raw cmd to the dish via DISEqC. -ERRORS +&return-value-dvb; There are no errors in use for this call diff --git a/Documentation/DocBook/media/dvb/video.xml b/Documentation/DocBook/media/dvb/video.xml index 539c79b027c3..0b1b662c345b 100644 --- a/Documentation/DocBook/media/dvb/video.xml +++ b/Documentation/DocBook/media/dvb/video.xml @@ -399,8 +399,7 @@ VIDEO_GET_NAVI: (blocking mode is the default) -ERRORS - +RETURN VALUE ENODEV @@ -458,8 +457,7 @@ VIDEO_GET_NAVI: File descriptor returned by a previous call to open(). -ERRORS - +RETURN VALUE EBADF @@ -514,8 +512,7 @@ VIDEO_GET_NAVI: Size of buf. -ERRORS - +RETURN VALUE EPERM @@ -595,8 +592,7 @@ role="subsection">VIDEO_STOP FALSE: Show last decoded frame. -ERRORS - +&return-value-dvb; EBADF @@ -648,8 +644,7 @@ role="subsection">VIDEO_PLAY Equals VIDEO_PLAY for this command. -ERRORS - +&return-value-dvb; EBADF @@ -705,8 +700,7 @@ role="subsection">VIDEO_FREEZE Equals VIDEO_FREEZE for this command. -ERRORS - +&return-value-dvb; EBADF @@ -758,8 +752,7 @@ role="subsection">VIDEO_CONTINUE Equals VIDEO_CONTINUE for this command. -ERRORS - +&return-value-dvb; EBADF @@ -821,8 +814,7 @@ role="subsection">VIDEO_SELECT_SOURCE Indicates which source shall be used for the Video stream. -ERRORS - +&return-value-dvb; EBADF @@ -887,8 +879,7 @@ role="subsection">VIDEO_SET_BLANK FALSE: Show last decoded frame. -ERRORS - +&return-value-dvb; EBADF @@ -955,8 +946,7 @@ role="subsection">VIDEO_GET_STATUS Returns the current status of the Video Device. -ERRORS - +&return-value-dvb; EBADF @@ -1032,8 +1022,7 @@ role="subsection">VIDEO_GET_EVENT stored. -ERRORS - +&return-value-dvb; EBADF @@ -1115,8 +1104,7 @@ role="subsection">VIDEO_SET_DISPLAY_FORMAT Selects the video format to be used. -ERRORS - +&return-value-dvb; EBADF @@ -1185,8 +1173,7 @@ role="subsection">VIDEO_STILLPICTURE Pointer to a location where an I-frame and size is stored. -ERRORS - +&return-value-dvb; EBADF @@ -1252,8 +1239,7 @@ role="subsection">VIDEO_FAST_FORWARD The number of frames to skip. -ERRORS - +&return-value-dvb; EBADF @@ -1326,8 +1312,7 @@ role="subsection">VIDEO_SLOWMOTION The number of times to repeat each frame. -ERRORS - +&return-value-dvb; EBADF @@ -1402,8 +1387,7 @@ role="subsection">VIDEO_GET_CAPABILITIES information. -ERRORS - +&return-value-dvb; EBADF @@ -1462,8 +1446,7 @@ role="subsection">VIDEO_SET_ID video sub-stream id -ERRORS - +&return-value-dvb; EBADF @@ -1520,8 +1503,7 @@ role="subsection">VIDEO_CLEAR_BUFFER Equals VIDEO_CLEAR_BUFFER for this command. -ERRORS - +&return-value-dvb; EBADF @@ -1574,8 +1556,7 @@ role="subsection">VIDEO_SET_STREAMTYPE stream type -ERRORS - +&return-value-dvb; EBADF @@ -1635,8 +1616,7 @@ role="subsection">VIDEO_SET_FORMAT video format of TV as defined in section ??. -ERRORS - +&return-value-dvb; EBADF @@ -1697,8 +1677,7 @@ role="subsection">VIDEO_SET_SYSTEM video system of TV output. -ERRORS - +&return-value-dvb; EBADF @@ -1757,8 +1736,7 @@ role="subsection">VIDEO_SET_HIGHLIGHT SPU Highlight information according to section ??. -ERRORS - +&return-value-dvb; EBADF @@ -1818,8 +1796,7 @@ role="subsection">VIDEO_SET_SPU to section ??. -ERRORS - +&return-value-dvb; EBADF @@ -1879,8 +1856,7 @@ role="subsection">VIDEO_SET_SPU_PALETTE SPU palette according to section ??. -ERRORS - +&return-value-dvb; EBADF @@ -1941,8 +1917,7 @@ role="subsection">VIDEO_GET_NAVI ??. -ERRORS - +&return-value-dvb; EBADF @@ -2003,8 +1978,7 @@ role="subsection">VIDEO_SET_ATTRIBUTES video attributes according to section ??. -ERRORS - +&return-value-dvb; EBADF diff --git a/Documentation/DocBook/media_api.tmpl b/Documentation/DocBook/media_api.tmpl index c273e3c54fc5..4e8e8985cc17 100644 --- a/Documentation/DocBook/media_api.tmpl +++ b/Documentation/DocBook/media_api.tmpl @@ -9,6 +9,7 @@ open()."> 2C"> Return ValueOn success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter."> +RETURN VALUEOn success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter."> 2"> -- cgit v1.2.3 From b424f60c5b728c27b0bd719a907847ad4c0e7e59 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 5 Jul 2011 13:18:15 -0300 Subject: [media] DocBook/audio.xml: Remove generic errors Remove generic errors from ioctl() descriptions. For other ioctl's, there's no generic section. So, just keep whatever is there. Also remove the EINTERNAL error code, as no DVB driver returns it, and this error code is not defined on POSIX or on Linux. Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/dvb/audio.xml | 309 ------------------------- Documentation/DocBook/media/v4l/gen-errors.xml | 4 + 2 files changed, 4 insertions(+), 309 deletions(-) diff --git a/Documentation/DocBook/media/dvb/audio.xml b/Documentation/DocBook/media/dvb/audio.xml index 90e9b7fede65..d64386237207 100644 --- a/Documentation/DocBook/media/dvb/audio.xml +++ b/Documentation/DocBook/media/dvb/audio.xml @@ -227,13 +227,6 @@ and right. Device driver not loaded/available. - - -EINTERNAL - -Internal error. @@ -392,21 +385,6 @@ role="subsection">AUDIO_STOP &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error. - -
AUDIO_PLAY @@ -443,21 +421,6 @@ role="subsection">AUDIO_PLAY &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error. - -
AUDIO_PAUSE @@ -502,22 +465,6 @@ role="subsection">AUDIO_PAUSE &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor. - - -EINTERNAL - -Internal error. - - -
AUDIO_CONTINUE @@ -558,21 +505,6 @@ with AUDIO_PAUSE command. &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor. - - -EINTERNAL - -Internal error. - -
AUDIO_SELECT_SOURCE @@ -621,28 +553,6 @@ role="subsection">AUDIO_SELECT_SOURCE &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor. - - -EINTERNAL - -Internal error. - - -EINVAL - -Illegal input parameter. - -
AUDIO_SET_MUTE @@ -699,28 +609,6 @@ role="subsection">AUDIO_SET_MUTE &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor. - - -EINTERNAL - -Internal error. - - -EINVAL - -Illegal input parameter. - -
AUDIO_SET_AV_SYNC @@ -777,28 +665,6 @@ role="subsection">AUDIO_SET_AV_SYNC &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor. - - -EINTERNAL - -Internal error. - - -EINVAL - -Illegal input parameter. - -
AUDIO_SET_BYPASS_MODE @@ -859,28 +725,6 @@ role="subsection">AUDIO_SET_BYPASS_MODE &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor. - - -EINTERNAL - -Internal error. - - -EINVAL - -Illegal input parameter. - -
AUDIO_CHANNEL_SELECT @@ -927,28 +771,6 @@ role="subsection">AUDIO_CHANNEL_SELECT &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor. - - -EINTERNAL - -Internal error. - - -EINVAL - -Illegal input parameter ch. - -
AUDIO_GET_STATUS @@ -994,28 +816,6 @@ role="subsection">AUDIO_GET_STATUS &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor. - - -EINTERNAL - -Internal error. - - -EFAULT - -status points to invalid address. - -
AUDIO_GET_CAPABILITIES @@ -1061,28 +861,6 @@ role="subsection">AUDIO_GET_CAPABILITIES &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor. - - -EINTERNAL - -Internal error. - - -EFAULT - -cap points to an invalid address. - -
AUDIO_CLEAR_BUFFER @@ -1119,21 +897,6 @@ role="subsection">AUDIO_CLEAR_BUFFER &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor. - - -EINTERNAL - -Internal error. - -
AUDIO_SET_ID @@ -1182,28 +945,6 @@ role="subsection">AUDIO_SET_ID &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor. - - -EINTERNAL - -Internal error. - - -EINVAL - -Invalid sub-stream id. - -
AUDIO_SET_MIXER @@ -1247,28 +988,6 @@ role="subsection">AUDIO_SET_MIXER &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor. - - -EINTERNAL - -Internal error. - - -EFAULT - -mix points to an invalid address. - -
AUDIO_SET_STREAMTYPE @@ -1316,13 +1035,6 @@ role="subsection">AUDIO_SET_STREAMTYPE &return-value-dvb; -EBADF - -fd is not a valid open file descriptor - - EINVAL @@ -1375,13 +1087,6 @@ role="subsection">AUDIO_SET_EXT_ID &return-value-dvb; -EBADF - -fd is not a valid open file descriptor - - EINVAL @@ -1435,13 +1140,6 @@ role="subsection">AUDIO_SET_ATTRIBUTES &return-value-dvb; -EBADF - -fd is not a valid open file descriptor - - EINVAL @@ -1495,13 +1193,6 @@ role="subsection">AUDIO_SET_KARAOKE &return-value-dvb; -EBADF - -fd is not a valid open file descriptor - - EINVAL diff --git a/Documentation/DocBook/media/v4l/gen-errors.xml b/Documentation/DocBook/media/v4l/gen-errors.xml index 4268c658652f..d970f080f88d 100644 --- a/Documentation/DocBook/media/v4l/gen-errors.xml +++ b/Documentation/DocBook/media/v4l/gen-errors.xml @@ -34,6 +34,10 @@ the required functionality is not available, or the file descriptor is not for a media device. + + ENODEV + Device not found or was removed. + ENOMEM There's not enough memory to handle the desired operation. -- cgit v1.2.3 From c1798c90adabf16713086f34a793d89d147022a5 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 5 Jul 2011 13:39:38 -0300 Subject: [media] DocBook/demux.xml: Remove generic errors Remove generic errors from ioctl() descriptions. For other ioctl's, there's no generic section. So, just keep whatever is there. Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/dvb/demux.xml | 88 -------------------------- Documentation/DocBook/media/v4l/gen-errors.xml | 5 ++ 2 files changed, 5 insertions(+), 88 deletions(-) diff --git a/Documentation/DocBook/media/dvb/demux.xml b/Documentation/DocBook/media/dvb/demux.xml index e5058d7d9213..37c17908aa40 100644 --- a/Documentation/DocBook/media/dvb/demux.xml +++ b/Documentation/DocBook/media/dvb/demux.xml @@ -552,13 +552,6 @@ typedef enum { &return-value-dvb; -EBADF - -fd is not a valid file descriptor. - - EINVAL @@ -615,14 +608,6 @@ typedef enum { &return-value-dvb; - -EBADF - -fd is not a valid file descriptor. - -
@@ -677,21 +662,6 @@ typedef enum { &return-value-dvb; - -EBADF - -fd is not a valid file descriptor. - - -EINVAL - -Invalid argument. - -
@@ -751,20 +721,6 @@ typedef enum { &return-value-dvb; -EBADF - -fd is not a valid file descriptor. - - -EINVAL - -Invalid argument. - - EBUSY @@ -820,22 +776,6 @@ typedef enum { &return-value-dvb; - -EBADF - -fd is not a valid file descriptor. - - -ENOMEM - -The driver was not able to allocate a buffer of the - requested size. - -
@@ -894,20 +834,6 @@ typedef enum { &return-value-dvb; -EBADF - -fd is not a valid file descriptor. - - -EFAULT - -ev points to an invalid address. - - EWOULDBLOCK @@ -967,20 +893,6 @@ typedef enum { &return-value-dvb; -EBADF - -fd is not a valid file descriptor. - - -EFAULT - -stc points to an invalid address. - - EINVAL diff --git a/Documentation/DocBook/media/v4l/gen-errors.xml b/Documentation/DocBook/media/v4l/gen-errors.xml index d970f080f88d..c9818799764d 100644 --- a/Documentation/DocBook/media/v4l/gen-errors.xml +++ b/Documentation/DocBook/media/v4l/gen-errors.xml @@ -48,6 +48,11 @@ that this request would overcommit the usb bandwidth reserved for periodic transfers (up to 80% of the USB bandwidth). + + EWOULDBLOCK + Operation would block. Used when the ioctl would need to wait + for an event, but the device was opened in non-blocking mode. + -- cgit v1.2.3 From 16d6c0b02c555b93034ffef4bf1b2d8ae80d8102 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 6 Jul 2011 09:05:41 -0300 Subject: [media] dvb-bt8xx: Don't return -EFAULT when a device is not found When a device (or their PCI structs) are not found, the error should be -ENODEV. -EFAULT is reserved for errors while copying arguments from/to userspace. Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/bt8xx/dvb-bt8xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c index 1e1106dcd063..521d69104982 100644 --- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c +++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c @@ -892,7 +892,7 @@ static int __devinit dvb_bt8xx_probe(struct bttv_sub_device *sub) if (!(bttv_pci_dev = bttv_get_pcidev(card->bttv_nr))) { printk("dvb_bt8xx: no pci device for card %d\n", card->bttv_nr); kfree(card); - return -EFAULT; + return -ENODEV; } if (!(card->bt = dvb_bt8xx_878_match(card->bttv_nr, bttv_pci_dev))) { @@ -902,7 +902,7 @@ static int __devinit dvb_bt8xx_probe(struct bttv_sub_device *sub) "installed, try removing it.\n"); kfree(card); - return -EFAULT; + return -ENODEV; } mutex_init(&card->bt->gpio_lock); -- cgit v1.2.3 From 66b30b5d510f46c47beb330932afdcb7943d1d78 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 6 Jul 2011 13:42:08 -0300 Subject: [media] DocBook/dvb: Use generic descriptions for the frontend API Move generic stuff into gen-errors.xml, and remove them from DVB API. While here, removes two bogus error codes that aren't supported or used on Linux: EINTERNAL and ENOSIGNAL. Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/dvb/dvbproperty.xml | 18 - Documentation/DocBook/media/dvb/frontend.xml | 431 +----------------------- Documentation/DocBook/media/v4l/gen-errors.xml | 24 +- 3 files changed, 24 insertions(+), 449 deletions(-) diff --git a/Documentation/DocBook/media/dvb/dvbproperty.xml b/Documentation/DocBook/media/dvb/dvbproperty.xml index 33274bcc8592..207e1a5bf8f0 100644 --- a/Documentation/DocBook/media/dvb/dvbproperty.xml +++ b/Documentation/DocBook/media/dvb/dvbproperty.xml @@ -82,15 +82,6 @@ struct dtv_properties { &return-value-dvb; - EINVAL - Invalid parameter(s) received or number of parameters out of the range. - - ENOMEM - Out of memory. - - EFAULT - Failure while copying data from/to userspace. - EOPNOTSUPP Property type not supported. @@ -139,15 +130,6 @@ struct dtv_properties { &return-value-dvb; - EINVAL - Invalid parameter(s) received or number of parameters out of the range. - - ENOMEM - Out of memory. - - EFAULT - Failure while copying data from/to userspace. - EOPNOTSUPP Property type not supported. diff --git a/Documentation/DocBook/media/dvb/frontend.xml b/Documentation/DocBook/media/dvb/frontend.xml index c5a5cb4051be..61407eaba020 100644 --- a/Documentation/DocBook/media/dvb/frontend.xml +++ b/Documentation/DocBook/media/dvb/frontend.xml @@ -575,7 +575,7 @@ typedef enum fe_hierarchy { File descriptor returned by a previous call to open(). -&return-value-dvb; +RETURN VALUE EBADF @@ -692,37 +692,8 @@ typedef enum fe_hierarchy { The bit error rate is stored into *ber. + &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor. - - -EFAULT - -ber points to invalid address. - - -ENOSIGNAL - -There is no signal, thus no meaningful bit error rate. Also - returned if the front-end is not turned on. - - -ENOSYS - -Function not available for this device. - -
@@ -770,36 +741,6 @@ typedef enum fe_hierarchy { &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor. - - -EFAULT - -snr points to invalid address. - - -ENOSIGNAL - -There is no signal, thus no meaningful signal strength - value. Also returned if front-end is not turned on. - - -ENOSYS - -Function not available for this device. - -
@@ -846,37 +787,8 @@ typedef enum fe_hierarchy { The signal strength value is stored into *strength. + &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor. - - -EFAULT - -status points to invalid address. - - -ENOSIGNAL - -There is no signal, thus no meaningful signal strength - value. Also returned if front-end is not turned on. - - -ENOSYS - -Function not available for this device. - -
@@ -930,29 +842,8 @@ typedef enum fe_hierarchy { so far. + &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor. - - -EFAULT - -ublocks points to invalid address. - - -ENOSYS - -Function not available for this device. - -
@@ -1005,23 +896,10 @@ typedef enum fe_hierarchy { Points to parameters for tuning operation. + &return-value-dvb; -EBADF - -fd is not a valid open file descriptor. - - -EFAULT - -p points to invalid address. - - EINVAL @@ -1078,23 +956,8 @@ typedef enum fe_hierarchy { &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor. - - -EFAULT - -p points to invalid address. - - EINVAL @@ -1181,20 +1044,6 @@ typedef enum fe_hierarchy { &return-value-dvb; -EBADF - -fd is not a valid open file descriptor. - - -EFAULT - -ev points to invalid address. - - EWOULDBLOCK @@ -1204,11 +1053,6 @@ typedef enum fe_hierarchy { EOVERFLOW - - - Overflow in event queue - one or more events were lost. @@ -1264,21 +1108,6 @@ typedef enum fe_hierarchy { &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor. - - -EFAULT - -info points to invalid address. - -
@@ -1322,28 +1151,6 @@ typedef enum fe_hierarchy { &return-value-dvb; - -EBADF - -fd is not a valid file descriptor. - - -EPERM - -Permission denied (needs read/write access). - - -EINTERNAL - -Internal error in the device driver. - -
@@ -1394,43 +1201,6 @@ typedef enum fe_hierarchy { &return-value-dvb; - -EBADF - -fd is not a valid file descriptor. - - -EFAULT - -Seq points to an invalid address. - - -EINVAL - -The data structure referred to by seq is invalid in some - way. - - -EPERM - -Permission denied (needs read/write access). - - -EINTERNAL - -Internal error in the device driver. - -
@@ -1481,43 +1251,6 @@ typedef enum fe_hierarchy { &return-value-dvb; - -EBADF - -fd is not a valid file descriptor. - - -EFAULT - -Seq points to an invalid address. - - -EINVAL - -The data structure referred to by seq is invalid in some - way. - - -EPERM - -Permission denied (needs read/write access). - - -EINTERNAL - -Internal error in the device driver. - -
@@ -1566,43 +1299,6 @@ typedef enum fe_hierarchy { &return-value-dvb; - -EBADF - -fd is not a valid file descriptor. - - -EFAULT - -Seq points to an invalid address. - - -EINVAL - -The data structure referred to by seq is invalid in some - way. - - -EPERM - -Permission denied (needs read/write access). - - -EINTERNAL - -Internal error in the device driver. - -
@@ -1649,42 +1345,6 @@ typedef enum fe_hierarchy { &return-value-dvb; - -ENODEV - -Device driver not loaded/available. - - -EBUSY - -Device or resource busy. - - -EINVAL - -Invalid argument. - - -EPERM - -File not opened with read permissions. - - -EINTERNAL - -Internal error in the device driver. - -
@@ -1733,42 +1393,6 @@ typedef enum fe_hierarchy { &return-value-dvb; - -ENODEV - -Device driver not loaded/available. - - -EBUSY - -Device or resource busy. - - -EINVAL - -Invalid argument. - - -EPERM - -File not opened with read permissions. - - -EINTERNAL - -Internal error in the device driver. - -
@@ -1818,42 +1442,6 @@ typedef enum fe_hierarchy { &return-value-dvb; - -ENODEV - -Device driver not loaded/available. - - -EBUSY - -Device or resource busy. - - -EINVAL - -Invalid argument. - - -EPERM - -File not opened with read permissions. - - -EINTERNAL - -Internal error in the device driver. - -
@@ -1886,10 +1474,6 @@ FE_TUNE_MODE_ONESHOT When set, this flag will disable any zigzagging or other "n &return-value-dvb; - -EINVAL -Invalid argument. -
@@ -1924,11 +1508,6 @@ sends the specified raw cmd to the dish via DISEqC. &return-value-dvb; - - - There are no errors in use for this call - -
diff --git a/Documentation/DocBook/media/v4l/gen-errors.xml b/Documentation/DocBook/media/v4l/gen-errors.xml index c9818799764d..7c1980e8747b 100644 --- a/Documentation/DocBook/media/v4l/gen-errors.xml +++ b/Documentation/DocBook/media/v4l/gen-errors.xml @@ -8,7 +8,7 @@ EBADF - fd is not a valid open file descriptor. + The file descriptor is not a valid. EBUSY @@ -21,18 +21,21 @@ EFAULT - fd is not a valid open file descriptor. + There was a failure while copying data from/to userspace, + probably caused by an invalid pointer reference. EINVAL - One or more of the ioctl parameters are invalid. This is a widely - used error code. See the individual ioctl requests for actual causes. + One or more of the ioctl parameters are invalid or out of the + allowed range. This is a widely used error code. See the individual + ioctl requests for specific causes. EINVAL or ENOTTY The ioctl is not supported by the driver, actually meaning that the required functionality is not available, or the file - descriptor is not for a media device. + descriptor is not for a media device. The usage of EINVAL is + deprecated and will be fixed on a latter patch. ENODEV @@ -48,6 +51,17 @@ that this request would overcommit the usb bandwidth reserved for periodic transfers (up to 80% of the USB bandwidth). + + ENOSYS or EOPNOTSUPP + Function not available for this device (dvb API only. Will likely + be replaced anytime soon by ENOTTY). + + + EPERM + Permission denied. Can be returned if the device needs write + permission, or some special capabilities is needed + (e. g. root) + EWOULDBLOCK Operation would block. Used when the ioctl would need to wait -- cgit v1.2.3 From c28f53f6cd45de5cefe8dc7479236b745b97d49c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 6 Jul 2011 13:51:51 -0300 Subject: [media] DocBook/dvb: Use generic descriptions for the video API While here, removes the bogus EINTERNAL error codes. Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/dvb/video.xml | 340 ------------------------------ 1 file changed, 340 deletions(-) diff --git a/Documentation/DocBook/media/dvb/video.xml b/Documentation/DocBook/media/dvb/video.xml index 0b1b662c345b..25fb823226b4 100644 --- a/Documentation/DocBook/media/dvb/video.xml +++ b/Documentation/DocBook/media/dvb/video.xml @@ -593,22 +593,6 @@ role="subsection">VIDEO_STOP &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error, possibly in the communication with the - DVB subsystem. - -
VIDEO_PLAY @@ -645,22 +629,6 @@ role="subsection">VIDEO_PLAY &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error, possibly in the communication with the - DVB subsystem. - -
VIDEO_FREEZE @@ -701,22 +669,6 @@ role="subsection">VIDEO_FREEZE &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error, possibly in the communication with the - DVB subsystem. - -
VIDEO_CONTINUE @@ -753,22 +705,6 @@ role="subsection">VIDEO_CONTINUE &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error, possibly in the communication with the - DVB subsystem. - -
VIDEO_SELECT_SOURCE @@ -815,22 +751,6 @@ role="subsection">VIDEO_SELECT_SOURCE &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error, possibly in the communication with the - DVB subsystem. - -
VIDEO_SET_BLANK @@ -880,29 +800,6 @@ role="subsection">VIDEO_SET_BLANK &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error, possibly in the communication with the - DVB subsystem. - - -EINVAL - -Illegal input parameter - -
VIDEO_GET_STATUS @@ -947,29 +844,6 @@ role="subsection">VIDEO_GET_STATUS &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error, possibly in the communication with the - DVB subsystem. - - -EFAULT - -status points to invalid address - -
VIDEO_GET_EVENT @@ -1025,20 +899,6 @@ role="subsection">VIDEO_GET_EVENT &return-value-dvb; -EBADF - -fd is not a valid open file descriptor - - -EFAULT - -ev points to invalid address - - EWOULDBLOCK @@ -1048,11 +908,6 @@ role="subsection">VIDEO_GET_EVENT EOVERFLOW - - - Overflow in event queue - one or more events were lost. @@ -1105,28 +960,6 @@ role="subsection">VIDEO_SET_DISPLAY_FORMAT &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error. - - -EINVAL - -Illegal parameter format. - -
VIDEO_STILLPICTURE @@ -1174,28 +1007,6 @@ role="subsection">VIDEO_STILLPICTURE &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error. - - -EFAULT - -sp points to an invalid iframe. - -
VIDEO_FAST_FORWARD @@ -1242,31 +1053,10 @@ role="subsection">VIDEO_FAST_FORWARD &return-value-dvb; -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error. - - EPERM Mode VIDEO_SOURCE_MEMORY not selected. - - -EINVAL - -Illegal parameter format. @@ -1315,31 +1105,10 @@ role="subsection">VIDEO_SLOWMOTION &return-value-dvb; -EBADF - -fd is not a valid open file descriptor - - -EINTERNAL - -Internal error. - - EPERM Mode VIDEO_SOURCE_MEMORY not selected. - - -EINVAL - -Illegal parameter format. @@ -1388,21 +1157,6 @@ role="subsection">VIDEO_GET_CAPABILITIES &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor - - -EFAULT - -cap points to an invalid iframe. - -
VIDEO_SET_ID @@ -1449,20 +1203,6 @@ role="subsection">VIDEO_SET_ID &return-value-dvb; -EBADF - -fd is not a valid open file descriptor. - - -EINTERNAL - -Internal error. - - EINVAL @@ -1504,14 +1244,6 @@ role="subsection">VIDEO_CLEAR_BUFFER &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor - -
VIDEO_SET_STREAMTYPE @@ -1557,21 +1289,6 @@ role="subsection">VIDEO_SET_STREAMTYPE &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor - - -EINVAL - -type is not a valid or supported stream type. - -
VIDEO_SET_FORMAT @@ -1619,13 +1336,6 @@ role="subsection">VIDEO_SET_FORMAT &return-value-dvb; -EBADF - -fd is not a valid open file descriptor - - EINVAL @@ -1680,13 +1390,6 @@ role="subsection">VIDEO_SET_SYSTEM &return-value-dvb; -EBADF - -fd is not a valid open file descriptor - - EINVAL @@ -1737,21 +1440,6 @@ role="subsection">VIDEO_SET_HIGHLIGHT &return-value-dvb; - -EBADF - -fd is not a valid open file descriptor. - - -EINVAL - -input is not a valid highlight setting. - -
VIDEO_SET_SPU @@ -1799,13 +1487,6 @@ role="subsection">VIDEO_SET_SPU &return-value-dvb; -EBADF - -fd is not a valid open file descriptor - - EINVAL @@ -1859,13 +1540,6 @@ role="subsection">VIDEO_SET_SPU_PALETTE &return-value-dvb; -EBADF - -fd is not a valid open file descriptor - - EINVAL @@ -1920,13 +1594,6 @@ role="subsection">VIDEO_GET_NAVI &return-value-dvb; -EBADF - -fd is not a valid open file descriptor - - EFAULT @@ -1981,13 +1648,6 @@ role="subsection">VIDEO_SET_ATTRIBUTES &return-value-dvb; -EBADF - -fd is not a valid open file descriptor - - EINVAL -- cgit v1.2.3 From 9190d191b1b814dfb488125b54cf0de6eedd9220 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 6 Jul 2011 14:08:08 -0300 Subject: [media] v4l2 core: return -ENOTTY if an ioctl doesn't exist Currently, -EINVAL is used to return either when an IOCTL is not implemented, or if the ioctl was not implemented. Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/v4l/gen-errors.xml | 13 ++++++------- Documentation/DocBook/media/v4l/v4l2.xml | 2 ++ drivers/media/video/v4l2-ioctl.c | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Documentation/DocBook/media/v4l/gen-errors.xml b/Documentation/DocBook/media/v4l/gen-errors.xml index 7c1980e8747b..5bbf3ce1973a 100644 --- a/Documentation/DocBook/media/v4l/gen-errors.xml +++ b/Documentation/DocBook/media/v4l/gen-errors.xml @@ -30,13 +30,6 @@ allowed range. This is a widely used error code. See the individual ioctl requests for specific causes. - - EINVAL or ENOTTY - The ioctl is not supported by the driver, actually meaning that - the required functionality is not available, or the file - descriptor is not for a media device. The usage of EINVAL is - deprecated and will be fixed on a latter patch. - ENODEV Device not found or was removed. @@ -45,6 +38,12 @@ ENOMEM There's not enough memory to handle the desired operation. + + ENOTTY + The ioctl is not supported by the driver, actually meaning that + the required functionality is not available, or the file + descriptor is not for a media device. + ENOSPC On USB devices, the stream ioctl's can return this error, meaning diff --git a/Documentation/DocBook/media/v4l/v4l2.xml b/Documentation/DocBook/media/v4l/v4l2.xml index c5ee3982cff5..43386a6aef76 100644 --- a/Documentation/DocBook/media/v4l/v4l2.xml +++ b/Documentation/DocBook/media/v4l/v4l2.xml @@ -132,7 +132,9 @@ applications. --> 2011-06-27 mcc, po Documented that VIDIOC_QUERYCAP now returns a per-subsystem version instead of a per-driver one. + Standardize an error code for invalid ioctl. + 2.6.39 2011-03-01 diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 29f7a7df34c3..002ce1363443 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c @@ -543,12 +543,12 @@ static long __video_do_ioctl(struct file *file, struct v4l2_fh *vfh = NULL; struct v4l2_format f_copy; int use_fh_prio = 0; - long ret = -EINVAL; + long ret = -ENOTTY; if (ops == NULL) { printk(KERN_WARNING "videodev: \"%s\" has no ioctl_ops.\n", vfd->name); - return -EINVAL; + return ret; } if ((vfd->debug & V4L2_DEBUG_IOCTL) && -- cgit v1.2.3 From 7a286cc1889f14c5c8dbf866718edde100527d8c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 26 Jun 2011 10:18:03 -0300 Subject: [media] return -ENOTTY for unsupported ioctl's at legacy drivers Those drivers are not relying at the V4L2 core to handle the ioctl's. So, we need to manually patch them every time a change goes to the core. Acked-by: Hans Verkuil Acked-By: Mike Isely Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/et61x251/et61x251_core.c | 10 +--------- drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 7 +------ drivers/media/video/sn9c102/sn9c102_core.c | 10 +--------- drivers/media/video/uvc/uvc_v4l2.c | 2 +- 4 files changed, 4 insertions(+), 25 deletions(-) diff --git a/drivers/media/video/et61x251/et61x251_core.c b/drivers/media/video/et61x251/et61x251_core.c index d7efb332d4e3..9a1e80a1e145 100644 --- a/drivers/media/video/et61x251/et61x251_core.c +++ b/drivers/media/video/et61x251/et61x251_core.c @@ -2480,16 +2480,8 @@ static long et61x251_ioctl_v4l2(struct file *filp, case VIDIOC_S_PARM: return et61x251_vidioc_s_parm(cam, arg); - case VIDIOC_G_STD: - case VIDIOC_S_STD: - case VIDIOC_QUERYSTD: - case VIDIOC_ENUMSTD: - case VIDIOC_QUERYMENU: - case VIDIOC_ENUM_FRAMEINTERVALS: - return -EINVAL; - default: - return -EINVAL; + return -ENOTTY; } } diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index 573749ab96f5..e27f8ab76966 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c @@ -369,11 +369,6 @@ static long pvr2_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) break; } - case VIDIOC_S_AUDIO: - { - ret = -EINVAL; - break; - } case VIDIOC_G_TUNER: { struct v4l2_tuner *vt = (struct v4l2_tuner *)arg; @@ -850,7 +845,7 @@ static long pvr2_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) #endif default : - ret = -EINVAL; + ret = -ENOTTY; break; } diff --git a/drivers/media/video/sn9c102/sn9c102_core.c b/drivers/media/video/sn9c102/sn9c102_core.c index d8eece8bba24..16cb07c5c27b 100644 --- a/drivers/media/video/sn9c102/sn9c102_core.c +++ b/drivers/media/video/sn9c102/sn9c102_core.c @@ -3187,16 +3187,8 @@ static long sn9c102_ioctl_v4l2(struct file *filp, case VIDIOC_S_AUDIO: return sn9c102_vidioc_s_audio(cam, arg); - case VIDIOC_G_STD: - case VIDIOC_S_STD: - case VIDIOC_QUERYSTD: - case VIDIOC_ENUMSTD: - case VIDIOC_QUERYMENU: - case VIDIOC_ENUM_FRAMEINTERVALS: - return -EINVAL; - default: - return -EINVAL; + return -ENOTTY; } } diff --git a/drivers/media/video/uvc/uvc_v4l2.c b/drivers/media/video/uvc/uvc_v4l2.c index cdd967b0a2e9..7afb97b2d7b2 100644 --- a/drivers/media/video/uvc/uvc_v4l2.c +++ b/drivers/media/video/uvc/uvc_v4l2.c @@ -83,7 +83,7 @@ static int uvc_ioctl_ctrl_map(struct uvc_video_chain *chain, default: uvc_trace(UVC_TRACE_CONTROL, "Unsupported V4L2 control type " "%u.\n", xmap->v4l2_type); - ret = -EINVAL; + ret = -ENOTTY; goto done; } -- cgit v1.2.3 From 686a9488cd23cce1fa8a6cddde0e7668ae2e74b4 Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Wed, 6 Jul 2011 15:54:48 -0300 Subject: [media] firedtv: change some -EFAULT returns to more fitting error codes Mauro Carvalho Chehab wrote: > I'm validating if all drivers are behaving equally with respect to the > error codes returned to userspace, and double-checking with the API. > > On almost all places, -EFAULT code is used only to indicate when > copy_from_user/copy_to_user fails. However, firedtv uses a lot of > -EFAULT, where it seems to me that other error codes should be used > instead (like -EIO for bus transfer errors and -EINVAL/-ERANGE for > invalid/out of range parameters). This concerns only the CI (CAM) related code of firedtv of which I know little. Let's just pass through the error returns of lower level I/O code where applicable, and -EACCES (permission denied) when a seemingly valid but negative FCP response or an unknown-to-firedtv CA message is received. Signed-off-by: Stefan Richter Cc: Henrik Kurelid Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/firewire/firedtv-avc.c | 2 +- drivers/media/dvb/firewire/firedtv-ci.c | 34 +++++++++++++++----------------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/media/dvb/firewire/firedtv-avc.c b/drivers/media/dvb/firewire/firedtv-avc.c index 21c52e3b522e..489ae8245867 100644 --- a/drivers/media/dvb/firewire/firedtv-avc.c +++ b/drivers/media/dvb/firewire/firedtv-avc.c @@ -1208,7 +1208,7 @@ int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length) if (r->response != AVC_RESPONSE_ACCEPTED) { dev_err(fdtv->device, "CA PMT failed with response 0x%x\n", r->response); - ret = -EFAULT; + ret = -EACCES; } out: mutex_unlock(&fdtv->avc_mutex); diff --git a/drivers/media/dvb/firewire/firedtv-ci.c b/drivers/media/dvb/firewire/firedtv-ci.c index 8ffb565f0704..e5ebdbfe8c19 100644 --- a/drivers/media/dvb/firewire/firedtv-ci.c +++ b/drivers/media/dvb/firewire/firedtv-ci.c @@ -45,11 +45,6 @@ static int fdtv_get_ca_flags(struct firedtv_tuner_status *stat) return flags; } -static int fdtv_ca_reset(struct firedtv *fdtv) -{ - return avc_ca_reset(fdtv) ? -EFAULT : 0; -} - static int fdtv_ca_get_caps(void *arg) { struct ca_caps *cap = arg; @@ -65,12 +60,14 @@ static int fdtv_ca_get_slot_info(struct firedtv *fdtv, void *arg) { struct firedtv_tuner_status stat; struct ca_slot_info *slot = arg; + int err; - if (avc_tuner_status(fdtv, &stat)) - return -EFAULT; + err = avc_tuner_status(fdtv, &stat); + if (err) + return err; if (slot->num != 0) - return -EFAULT; + return -EACCES; slot->type = CA_CI; slot->flags = fdtv_get_ca_flags(&stat); @@ -81,21 +78,21 @@ static int fdtv_ca_app_info(struct firedtv *fdtv, void *arg) { struct ca_msg *reply = arg; - return avc_ca_app_info(fdtv, reply->msg, &reply->length) ? -EFAULT : 0; + return avc_ca_app_info(fdtv, reply->msg, &reply->length); } static int fdtv_ca_info(struct firedtv *fdtv, void *arg) { struct ca_msg *reply = arg; - return avc_ca_info(fdtv, reply->msg, &reply->length) ? -EFAULT : 0; + return avc_ca_info(fdtv, reply->msg, &reply->length); } static int fdtv_ca_get_mmi(struct firedtv *fdtv, void *arg) { struct ca_msg *reply = arg; - return avc_ca_get_mmi(fdtv, reply->msg, &reply->length) ? -EFAULT : 0; + return avc_ca_get_mmi(fdtv, reply->msg, &reply->length); } static int fdtv_ca_get_msg(struct firedtv *fdtv, void *arg) @@ -111,14 +108,15 @@ static int fdtv_ca_get_msg(struct firedtv *fdtv, void *arg) err = fdtv_ca_info(fdtv, arg); break; default: - if (avc_tuner_status(fdtv, &stat)) - err = -EFAULT; - else if (stat.ca_mmi == 1) + err = avc_tuner_status(fdtv, &stat); + if (err) + break; + if (stat.ca_mmi == 1) err = fdtv_ca_get_mmi(fdtv, arg); else { dev_info(fdtv->device, "unhandled CA message 0x%08x\n", fdtv->ca_last_command); - err = -EFAULT; + err = -EACCES; } } fdtv->ca_last_command = 0; @@ -141,7 +139,7 @@ static int fdtv_ca_pmt(struct firedtv *fdtv, void *arg) data_length = msg->msg[3]; } - return avc_ca_pmt(fdtv, &msg->msg[data_pos], data_length) ? -EFAULT : 0; + return avc_ca_pmt(fdtv, &msg->msg[data_pos], data_length); } static int fdtv_ca_send_msg(struct firedtv *fdtv, void *arg) @@ -170,7 +168,7 @@ static int fdtv_ca_send_msg(struct firedtv *fdtv, void *arg) default: dev_err(fdtv->device, "unhandled CA message 0x%08x\n", fdtv->ca_last_command); - err = -EFAULT; + err = -EACCES; } return err; } @@ -184,7 +182,7 @@ static int fdtv_ca_ioctl(struct file *file, unsigned int cmd, void *arg) switch (cmd) { case CA_RESET: - err = fdtv_ca_reset(fdtv); + err = avc_ca_reset(fdtv); break; case CA_GET_CAP: err = fdtv_ca_get_caps(arg); -- cgit v1.2.3 From b877a9a7fb00d96bae4ab49c69f1be65b3e87e61 Mon Sep 17 00:00:00 2001 From: Jean-François Moine Date: Sun, 3 Jul 2011 05:17:27 -0300 Subject: [media] gspca - ov519: Fix sensor detection problems MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The sensor of some webcams could not be detected due to timing problems in sensor register reading. This patch adds bridge register readings before sensor register reading. Signed-off-by: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/ov519.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c index cb42a5182d17..b17c6604eb41 100644 --- a/drivers/media/video/gspca/ov519.c +++ b/drivers/media/video/gspca/ov519.c @@ -2432,9 +2432,12 @@ static int ov518_i2c_r(struct sd *sd, u8 reg) /* Initiate 2-byte write cycle */ reg_w(sd, R518_I2C_CTL, 0x03); + reg_r8(sd, R518_I2C_CTL); /* Initiate 2-byte read cycle */ reg_w(sd, R518_I2C_CTL, 0x05); + reg_r8(sd, R518_I2C_CTL); + value = reg_r(sd, R51x_I2C_DATA); PDEBUG(D_USBI, "ov518_i2c_r %02x %02x", reg, value); return value; -- cgit v1.2.3 From 0fdee88e54f0b8bd737810517ba70bde5fd7a70c Mon Sep 17 00:00:00 2001 From: Jean-François Moine Date: Sun, 3 Jul 2011 05:24:05 -0300 Subject: [media] gspca - ov519: Fix a LED inversion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the webcam 041e:405f, the LED is inverted. Signed-off-by: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/ov519.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c index b17c6604eb41..0800433b2092 100644 --- a/drivers/media/video/gspca/ov519.c +++ b/drivers/media/video/gspca/ov519.c @@ -5006,7 +5006,8 @@ static const struct sd_desc sd_desc = { static const struct usb_device_id device_table[] = { {USB_DEVICE(0x041e, 0x4003), .driver_info = BRIDGE_W9968CF }, {USB_DEVICE(0x041e, 0x4052), .driver_info = BRIDGE_OV519 }, - {USB_DEVICE(0x041e, 0x405f), .driver_info = BRIDGE_OV519 }, + {USB_DEVICE(0x041e, 0x405f), + .driver_info = BRIDGE_OV519 | BRIDGE_INVERT_LED }, {USB_DEVICE(0x041e, 0x4060), .driver_info = BRIDGE_OV519 }, {USB_DEVICE(0x041e, 0x4061), .driver_info = BRIDGE_OV519 }, {USB_DEVICE(0x041e, 0x4064), -- cgit v1.2.3 From 21144ea601f1fea37c7add15a099affec7c08425 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 5 Jun 2011 08:32:27 -0300 Subject: [media] videodev2.h Add SE401 compressed RGB format Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/v4l/pixfmt.xml | 5 +++++ include/linux/videodev2.h | 1 + 2 files changed, 6 insertions(+) diff --git a/Documentation/DocBook/media/v4l/pixfmt.xml b/Documentation/DocBook/media/v4l/pixfmt.xml index 88e5c212140e..804b2e5e0807 100644 --- a/Documentation/DocBook/media/v4l/pixfmt.xml +++ b/Documentation/DocBook/media/v4l/pixfmt.xml @@ -860,6 +860,11 @@ kernel sources in the file Documentation/video4linux/cx2341x/README.hm 'PJPG' Pixart 73xx JPEG format used by the gspca driver. + + V4L2_PIX_FMT_SE401 + 'S401' + Compressed RGB format used by the gspca se401 driver + V4L2_PIX_FMT_SQ905C '905C' diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 2c4e83796301..f002006fc0a9 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -402,6 +402,7 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_CIT_YYVYUY v4l2_fourcc('C', 'I', 'T', 'V') /* one line of Y then 1 line of VYUY */ #define V4L2_PIX_FMT_KONICA420 v4l2_fourcc('K', 'O', 'N', 'I') /* YUV420 planar in blocks of 256 pixels */ #define V4L2_PIX_FMT_JPGL v4l2_fourcc('J', 'P', 'G', 'L') /* JPEG-Lite */ +#define V4L2_PIX_FMT_SE401 v4l2_fourcc('S', '4', '0', '1') /* se401 janggu compressed rgb */ /* * F O R M A T E N U M E R A T I O N -- cgit v1.2.3 From fa4376d28e19b0835f948c5b42f13738f68bd9a1 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 5 Jun 2011 03:44:43 -0300 Subject: [media] gspca: reset image_len to 0 on LAST_PACKET when discarding frame Reset image and image_len to NULL/0 on LAST_PACKET when we're in discard frame mode, just like we do when not discarding the current frame. The new se401 driver uses image_len for SOF/EOF detection and thus depends on this. Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/gspca.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index d0b79a9f88b7..d94c108dd8dc 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c @@ -443,8 +443,11 @@ void gspca_frame_add(struct gspca_dev *gspca_dev, } else { switch (gspca_dev->last_packet_type) { case DISCARD_PACKET: - if (packet_type == LAST_PACKET) + if (packet_type == LAST_PACKET) { gspca_dev->last_packet_type = packet_type; + gspca_dev->image = NULL; + gspca_dev->image_len = 0; + } return; case LAST_PACKET: return; -- cgit v1.2.3 From c27cea03e76f278560be2aa3002adea14733e844 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 5 Jun 2011 07:44:34 -0300 Subject: [media] gspca: Add new se401 camera driver Based on the old v4l1 camera by Jeroen Vreeken driver which recently got removed from the kernel. Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/Kconfig | 10 + drivers/media/video/gspca/Makefile | 2 + drivers/media/video/gspca/se401.c | 774 +++++++++++++++++++++++++++++++++++++ drivers/media/video/gspca/se401.h | 90 +++++ 4 files changed, 876 insertions(+) create mode 100644 drivers/media/video/gspca/se401.c create mode 100644 drivers/media/video/gspca/se401.h diff --git a/drivers/media/video/gspca/Kconfig b/drivers/media/video/gspca/Kconfig index 34ae2c299799..43d9a20caebc 100644 --- a/drivers/media/video/gspca/Kconfig +++ b/drivers/media/video/gspca/Kconfig @@ -179,6 +179,16 @@ config USB_GSPCA_PAC7311 To compile this driver as a module, choose M here: the module will be called gspca_pac7311. +config USB_GSPCA_SE401 + tristate "SE401 USB Camera Driver" + depends on VIDEO_V4L2 && USB_GSPCA + help + Say Y here if you want support for cameras based on the + Endpoints (formerly known as AOX) se401 chip. + + To compile this driver as a module, choose M here: the + module will be called gspca_se401. + config USB_GSPCA_SN9C2028 tristate "SONIX Dual-Mode USB Camera Driver" depends on VIDEO_V4L2 && USB_GSPCA diff --git a/drivers/media/video/gspca/Makefile b/drivers/media/video/gspca/Makefile index 802fbe1bff4a..d6364a86333a 100644 --- a/drivers/media/video/gspca/Makefile +++ b/drivers/media/video/gspca/Makefile @@ -16,6 +16,7 @@ obj-$(CONFIG_USB_GSPCA_OV534_9) += gspca_ov534_9.o obj-$(CONFIG_USB_GSPCA_PAC207) += gspca_pac207.o obj-$(CONFIG_USB_GSPCA_PAC7302) += gspca_pac7302.o obj-$(CONFIG_USB_GSPCA_PAC7311) += gspca_pac7311.o +obj-$(CONFIG_USB_GSPCA_SE401) += gspca_se401.o obj-$(CONFIG_USB_GSPCA_SN9C2028) += gspca_sn9c2028.o obj-$(CONFIG_USB_GSPCA_SN9C20X) += gspca_sn9c20x.o obj-$(CONFIG_USB_GSPCA_SONIXB) += gspca_sonixb.o @@ -58,6 +59,7 @@ gspca_ov534_9-objs := ov534_9.o gspca_pac207-objs := pac207.o gspca_pac7302-objs := pac7302.o gspca_pac7311-objs := pac7311.o +gspca_se401-objs := se401.o gspca_sn9c2028-objs := sn9c2028.o gspca_sn9c20x-objs := sn9c20x.o gspca_sonixb-objs := sonixb.o diff --git a/drivers/media/video/gspca/se401.c b/drivers/media/video/gspca/se401.c new file mode 100644 index 000000000000..4c283c24c752 --- /dev/null +++ b/drivers/media/video/gspca/se401.c @@ -0,0 +1,774 @@ +/* + * GSPCA Endpoints (formerly known as AOX) se401 USB Camera sub Driver + * + * Copyright (C) 2011 Hans de Goede + * + * Based on the v4l1 se401 driver which is: + * + * Copyright (c) 2000 Jeroen B. Vreeken (pe1rxq@amsat.org) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * 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 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 + * + */ + +#define MODULE_NAME "se401" + +#define BULK_SIZE 4096 +#define PACKET_SIZE 1024 +#define READ_REQ_SIZE 64 +#define MAX_MODES ((READ_REQ_SIZE - 6) / 4) +/* The se401 compression algorithm uses a fixed quant factor, which + can be configured by setting the high nibble of the SE401_OPERATINGMODE + feature. This needs to exactly match what is in libv4l! */ +#define SE401_QUANT_FACT 8 + +#include +#include +#include "gspca.h" +#include "se401.h" + +MODULE_AUTHOR("Hans de Goede "); +MODULE_DESCRIPTION("Endpoints se401"); +MODULE_LICENSE("GPL"); + +/* controls */ +enum e_ctrl { + BRIGHTNESS, + GAIN, + EXPOSURE, + FREQ, + NCTRL /* number of controls */ +}; + +/* exposure change state machine states */ +enum { + EXPO_CHANGED, + EXPO_DROP_FRAME, + EXPO_NO_CHANGE, +}; + +/* specific webcam descriptor */ +struct sd { + struct gspca_dev gspca_dev; /* !! must be the first item */ + struct gspca_ctrl ctrls[NCTRL]; + struct v4l2_pix_format fmts[MAX_MODES]; + int pixels_read; + int packet_read; + u8 packet[PACKET_SIZE]; + u8 restart_stream; + u8 button_state; + u8 resetlevel; + u8 resetlevel_frame_count; + int resetlevel_adjust_dir; + int expo_change_state; +}; + +static void setbrightness(struct gspca_dev *gspca_dev); +static void setgain(struct gspca_dev *gspca_dev); +static void setexposure(struct gspca_dev *gspca_dev); + +static const struct ctrl sd_ctrls[NCTRL] = { +[BRIGHTNESS] = { + { + .id = V4L2_CID_BRIGHTNESS, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Brightness", + .minimum = 0, + .maximum = 255, + .step = 1, + .default_value = 15, + }, + .set_control = setbrightness + }, +[GAIN] = { + { + .id = V4L2_CID_GAIN, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Gain", + .minimum = 0, + .maximum = 50, /* Really 63 but > 50 is not pretty */ + .step = 1, + .default_value = 25, + }, + .set_control = setgain + }, +[EXPOSURE] = { + { + .id = V4L2_CID_EXPOSURE, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Exposure", + .minimum = 0, + .maximum = 32767, + .step = 1, + .default_value = 15000, + }, + .set_control = setexposure + }, +[FREQ] = { + { + .id = V4L2_CID_POWER_LINE_FREQUENCY, + .type = V4L2_CTRL_TYPE_MENU, + .name = "Light frequency filter", + .minimum = 0, + .maximum = 2, + .step = 1, + .default_value = 0, + }, + .set_control = setexposure + }, +}; + +static void se401_write_req(struct gspca_dev *gspca_dev, u16 req, u16 value, + int silent) +{ + int err; + + if (gspca_dev->usb_err < 0) + return; + + err = usb_control_msg(gspca_dev->dev, + usb_sndctrlpipe(gspca_dev->dev, 0), req, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + value, 0, NULL, 0, 1000); + if (err < 0) { + if (!silent) + err("write req failed req %#04x val %#04x error %d", + req, value, err); + gspca_dev->usb_err = err; + } +} + +static void se401_read_req(struct gspca_dev *gspca_dev, u16 req, int silent) +{ + int err; + + if (gspca_dev->usb_err < 0) + return; + + if (USB_BUF_SZ < READ_REQ_SIZE) { + err("USB_BUF_SZ too small!!"); + gspca_dev->usb_err = -ENOBUFS; + return; + } + + err = usb_control_msg(gspca_dev->dev, + usb_rcvctrlpipe(gspca_dev->dev, 0), req, + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + 0, 0, gspca_dev->usb_buf, READ_REQ_SIZE, 1000); + if (err < 0) { + if (!silent) + err("read req failed req %#04x error %d", req, err); + gspca_dev->usb_err = err; + } +} + +static void se401_set_feature(struct gspca_dev *gspca_dev, + u16 selector, u16 param) +{ + int err; + + if (gspca_dev->usb_err < 0) + return; + + err = usb_control_msg(gspca_dev->dev, + usb_sndctrlpipe(gspca_dev->dev, 0), + SE401_REQ_SET_EXT_FEATURE, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + param, selector, NULL, 0, 1000); + if (err < 0) { + err("set feature failed sel %#04x param %#04x error %d", + selector, param, err); + gspca_dev->usb_err = err; + } +} + +static int se401_get_feature(struct gspca_dev *gspca_dev, u16 selector) +{ + int err; + + if (gspca_dev->usb_err < 0) + return gspca_dev->usb_err; + + if (USB_BUF_SZ < 2) { + err("USB_BUF_SZ too small!!"); + gspca_dev->usb_err = -ENOBUFS; + return gspca_dev->usb_err; + } + + err = usb_control_msg(gspca_dev->dev, + usb_rcvctrlpipe(gspca_dev->dev, 0), + SE401_REQ_GET_EXT_FEATURE, + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + 0, selector, gspca_dev->usb_buf, 2, 1000); + if (err < 0) { + err("get feature failed sel %#04x error %d", selector, err); + gspca_dev->usb_err = err; + return err; + } + return gspca_dev->usb_buf[0] | (gspca_dev->usb_buf[1] << 8); +} + +static void setbrightness(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + + if (gspca_dev->ctrl_dis & (1 << BRIGHTNESS)) + return; + + /* HDG: this does not seem to do anything on my cam */ + se401_write_req(gspca_dev, SE401_REQ_SET_BRT, + sd->ctrls[BRIGHTNESS].val, 0); +} + +static void setgain(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + u16 gain = 63 - sd->ctrls[GAIN].val; + + /* red color gain */ + se401_set_feature(gspca_dev, HV7131_REG_ARCG, gain); + /* green color gain */ + se401_set_feature(gspca_dev, HV7131_REG_AGCG, gain); + /* blue color gain */ + se401_set_feature(gspca_dev, HV7131_REG_ABCG, gain); +} + +static void setexposure(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + int integration = sd->ctrls[EXPOSURE].val << 6; + u8 expose_h, expose_m, expose_l; + + /* Do this before the set_feature calls, for proper timing wrt + the interrupt driven pkt_scan. Note we may still race but that + is not a big issue, the expo change state machine is merely for + avoiding underexposed frames getting send out, if one sneaks + through so be it */ + sd->expo_change_state = EXPO_CHANGED; + + if (sd->ctrls[FREQ].val == V4L2_CID_POWER_LINE_FREQUENCY_50HZ) + integration = integration - integration % 106667; + if (sd->ctrls[FREQ].val == V4L2_CID_POWER_LINE_FREQUENCY_60HZ) + integration = integration - integration % 88889; + + expose_h = (integration >> 16); + expose_m = (integration >> 8); + expose_l = integration; + + /* integration time low */ + se401_set_feature(gspca_dev, HV7131_REG_TITL, expose_l); + /* integration time mid */ + se401_set_feature(gspca_dev, HV7131_REG_TITM, expose_m); + /* integration time high */ + se401_set_feature(gspca_dev, HV7131_REG_TITU, expose_h); +} + +static int sd_config(struct gspca_dev *gspca_dev, + const struct usb_device_id *id) +{ + struct sd *sd = (struct sd *)gspca_dev; + struct cam *cam = &gspca_dev->cam; + u8 *cd = gspca_dev->usb_buf; + int i, j, n; + int widths[MAX_MODES], heights[MAX_MODES]; + + /* Read the camera descriptor */ + se401_read_req(gspca_dev, SE401_REQ_GET_CAMERA_DESCRIPTOR, 1); + if (gspca_dev->usb_err) { + /* Sometimes after being idle for a while the se401 won't + respond and needs a good kicking */ + usb_reset_device(gspca_dev->dev); + gspca_dev->usb_err = 0; + se401_read_req(gspca_dev, SE401_REQ_GET_CAMERA_DESCRIPTOR, 0); + } + + /* Some cameras start with their LED on */ + se401_write_req(gspca_dev, SE401_REQ_LED_CONTROL, 0, 0); + if (gspca_dev->usb_err) + return gspca_dev->usb_err; + + if (cd[1] != 0x41) { + err("Wrong descriptor type"); + return -ENODEV; + } + + if (!(cd[2] & SE401_FORMAT_BAYER)) { + err("Bayer format not supported!"); + return -ENODEV; + } + + if (cd[3]) + info("ExtraFeatures: %d", cd[3]); + + n = cd[4] | (cd[5] << 8); + if (n > MAX_MODES) { + err("Too many frame sizes"); + return -ENODEV; + } + + for (i = 0; i < n ; i++) { + widths[i] = cd[6 + i * 4 + 0] | (cd[6 + i * 4 + 1] << 8); + heights[i] = cd[6 + i * 4 + 2] | (cd[6 + i * 4 + 3] << 8); + } + + for (i = 0; i < n ; i++) { + sd->fmts[i].width = widths[i]; + sd->fmts[i].height = heights[i]; + sd->fmts[i].field = V4L2_FIELD_NONE; + sd->fmts[i].colorspace = V4L2_COLORSPACE_SRGB; + sd->fmts[i].priv = 1; + + /* janggu compression only works for 1/4th or 1/16th res */ + for (j = 0; j < n; j++) { + if (widths[j] / 2 == widths[i] && + heights[j] / 2 == heights[i]) { + sd->fmts[i].priv = 2; + break; + } + } + /* 1/16th if available too is better then 1/4th, because + we then use a larger area of the sensor */ + for (j = 0; j < n; j++) { + if (widths[j] / 4 == widths[i] && + heights[j] / 4 == heights[i]) { + sd->fmts[i].priv = 4; + break; + } + } + + if (sd->fmts[i].priv == 1) { + /* Not a 1/4th or 1/16th res, use bayer */ + sd->fmts[i].pixelformat = V4L2_PIX_FMT_SBGGR8; + sd->fmts[i].bytesperline = widths[i]; + sd->fmts[i].sizeimage = widths[i] * heights[i]; + info("Frame size: %dx%d bayer", widths[i], heights[i]); + } else { + /* Found a match use janggu compression */ + sd->fmts[i].pixelformat = V4L2_PIX_FMT_SE401; + sd->fmts[i].bytesperline = 0; + sd->fmts[i].sizeimage = widths[i] * heights[i] * 3; + info("Frame size: %dx%d 1/%dth janggu", + widths[i], heights[i], + sd->fmts[i].priv * sd->fmts[i].priv); + } + } + + cam->cam_mode = sd->fmts; + cam->nmodes = n; + cam->bulk = 1; + cam->bulk_size = BULK_SIZE; + cam->bulk_nurbs = 4; + cam->ctrls = sd->ctrls; + gspca_dev->nbalt = 1; /* Ignore the bogus isoc alt settings */ + sd->resetlevel = 0x2d; /* Set initial resetlevel */ + + /* See if the camera supports brightness */ + se401_read_req(gspca_dev, SE401_REQ_GET_BRT, 1); + if (gspca_dev->usb_err) { + gspca_dev->ctrl_dis = (1 << BRIGHTNESS); + gspca_dev->usb_err = 0; + } + + return 0; +} + +/* this function is called at probe and resume time */ +static int sd_init(struct gspca_dev *gspca_dev) +{ + return 0; +} + +/* -- start the camera -- */ +static int sd_start(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *)gspca_dev; + int mult = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv; + int mode = 0; + + se401_write_req(gspca_dev, SE401_REQ_CAMERA_POWER, 1, 1); + if (gspca_dev->usb_err) { + /* Sometimes after being idle for a while the se401 won't + respond and needs a good kicking */ + usb_reset_device(gspca_dev->dev); + gspca_dev->usb_err = 0; + se401_write_req(gspca_dev, SE401_REQ_CAMERA_POWER, 1, 0); + } + se401_write_req(gspca_dev, SE401_REQ_LED_CONTROL, 1, 0); + + se401_set_feature(gspca_dev, HV7131_REG_MODE_B, 0x05); + + /* set size + mode */ + se401_write_req(gspca_dev, SE401_REQ_SET_WIDTH, + gspca_dev->width * mult, 0); + se401_write_req(gspca_dev, SE401_REQ_SET_HEIGHT, + gspca_dev->height * mult, 0); + /* + * HDG: disabled this as it does not seem to do anything + * se401_write_req(gspca_dev, SE401_REQ_SET_OUTPUT_MODE, + * SE401_FORMAT_BAYER, 0); + */ + + switch (mult) { + case 1: /* Raw bayer */ + mode = 0x03; break; + case 2: /* 1/4th janggu */ + mode = SE401_QUANT_FACT << 4; break; + case 4: /* 1/16th janggu */ + mode = (SE401_QUANT_FACT << 4) | 0x02; break; + } + se401_set_feature(gspca_dev, SE401_OPERATINGMODE, mode); + + setbrightness(gspca_dev); + setgain(gspca_dev); + setexposure(gspca_dev); + se401_set_feature(gspca_dev, HV7131_REG_ARLV, sd->resetlevel); + + sd->packet_read = 0; + sd->pixels_read = 0; + sd->restart_stream = 0; + sd->resetlevel_frame_count = 0; + sd->resetlevel_adjust_dir = 0; + sd->expo_change_state = EXPO_NO_CHANGE; + + se401_write_req(gspca_dev, SE401_REQ_START_CONTINUOUS_CAPTURE, 0, 0); + + return gspca_dev->usb_err; +} + +static void sd_stopN(struct gspca_dev *gspca_dev) +{ + se401_write_req(gspca_dev, SE401_REQ_STOP_CONTINUOUS_CAPTURE, 0, 0); + se401_write_req(gspca_dev, SE401_REQ_LED_CONTROL, 0, 0); + se401_write_req(gspca_dev, SE401_REQ_CAMERA_POWER, 0, 0); +} + +static void sd_dq_callback(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *)gspca_dev; + unsigned int ahrc, alrc; + int oldreset, adjust_dir; + + /* Restart the stream if requested do so by pkt_scan */ + if (sd->restart_stream) { + sd_stopN(gspca_dev); + sd_start(gspca_dev); + sd->restart_stream = 0; + } + + /* Automatically adjust sensor reset level + Hyundai have some really nice docs about this and other sensor + related stuff on their homepage: www.hei.co.kr */ + sd->resetlevel_frame_count++; + if (sd->resetlevel_frame_count < 20) + return; + + /* For some reason this normally read-only register doesn't get reset + to zero after reading them just once... */ + se401_get_feature(gspca_dev, HV7131_REG_HIREFNOH); + se401_get_feature(gspca_dev, HV7131_REG_HIREFNOL); + se401_get_feature(gspca_dev, HV7131_REG_LOREFNOH); + se401_get_feature(gspca_dev, HV7131_REG_LOREFNOL); + ahrc = 256*se401_get_feature(gspca_dev, HV7131_REG_HIREFNOH) + + se401_get_feature(gspca_dev, HV7131_REG_HIREFNOL); + alrc = 256*se401_get_feature(gspca_dev, HV7131_REG_LOREFNOH) + + se401_get_feature(gspca_dev, HV7131_REG_LOREFNOL); + + /* Not an exact science, but it seems to work pretty well... */ + oldreset = sd->resetlevel; + if (alrc > 10) { + while (alrc >= 10 && sd->resetlevel < 63) { + sd->resetlevel++; + alrc /= 2; + } + } else if (ahrc > 20) { + while (ahrc >= 20 && sd->resetlevel > 0) { + sd->resetlevel--; + ahrc /= 2; + } + } + /* Detect ping-pong-ing and halve adjustment to avoid overshoot */ + if (sd->resetlevel > oldreset) + adjust_dir = 1; + else + adjust_dir = -1; + if (sd->resetlevel_adjust_dir && + sd->resetlevel_adjust_dir != adjust_dir) + sd->resetlevel = oldreset + (sd->resetlevel - oldreset) / 2; + + if (sd->resetlevel != oldreset) { + sd->resetlevel_adjust_dir = adjust_dir; + se401_set_feature(gspca_dev, HV7131_REG_ARLV, sd->resetlevel); + } + + sd->resetlevel_frame_count = 0; +} + +static void sd_complete_frame(struct gspca_dev *gspca_dev, u8 *data, int len) +{ + struct sd *sd = (struct sd *)gspca_dev; + + switch (sd->expo_change_state) { + case EXPO_CHANGED: + /* The exposure was changed while this frame + was being send, so this frame is ok */ + sd->expo_change_state = EXPO_DROP_FRAME; + break; + case EXPO_DROP_FRAME: + /* The exposure was changed while this frame + was being captured, drop it! */ + gspca_dev->last_packet_type = DISCARD_PACKET; + sd->expo_change_state = EXPO_NO_CHANGE; + break; + case EXPO_NO_CHANGE: + break; + } + gspca_frame_add(gspca_dev, LAST_PACKET, data, len); +} + +static void sd_pkt_scan_janggu(struct gspca_dev *gspca_dev, u8 *data, int len) +{ + struct sd *sd = (struct sd *)gspca_dev; + int imagesize = gspca_dev->width * gspca_dev->height; + int i, plen, bits, pixels, info, count; + + if (sd->restart_stream) + return; + + /* Sometimes a 1024 bytes garbage bulk packet is send between frames */ + if (gspca_dev->last_packet_type == LAST_PACKET && len == 1024) { + gspca_dev->last_packet_type = DISCARD_PACKET; + return; + } + + i = 0; + while (i < len) { + /* Read header if not already be present from prev bulk pkt */ + if (sd->packet_read < 4) { + count = 4 - sd->packet_read; + if (count > len - i) + count = len - i; + memcpy(&sd->packet[sd->packet_read], &data[i], count); + sd->packet_read += count; + i += count; + if (sd->packet_read < 4) + break; + } + bits = sd->packet[3] + (sd->packet[2] << 8); + pixels = sd->packet[1] + ((sd->packet[0] & 0x3f) << 8); + info = (sd->packet[0] & 0xc0) >> 6; + plen = ((bits + 47) >> 4) << 1; + /* Sanity checks */ + if (plen > 1024) { + err("invalid packet len %d restarting stream", plen); + goto error; + } + if (info == 3) { + err("unknown frame info value restarting stream"); + goto error; + } + + /* Read (remainder of) packet contents */ + count = plen - sd->packet_read; + if (count > len - i) + count = len - i; + memcpy(&sd->packet[sd->packet_read], &data[i], count); + sd->packet_read += count; + i += count; + if (sd->packet_read < plen) + break; + + sd->pixels_read += pixels; + sd->packet_read = 0; + + switch (info) { + case 0: /* Frame data */ + gspca_frame_add(gspca_dev, INTER_PACKET, sd->packet, + plen); + break; + case 1: /* EOF */ + if (sd->pixels_read != imagesize) { + err("frame size %d expected %d", + sd->pixels_read, imagesize); + goto error; + } + sd_complete_frame(gspca_dev, sd->packet, plen); + return; /* Discard the rest of the bulk packet !! */ + case 2: /* SOF */ + gspca_frame_add(gspca_dev, FIRST_PACKET, sd->packet, + plen); + sd->pixels_read = pixels; + break; + } + } + return; + +error: + sd->restart_stream = 1; + /* Give userspace a 0 bytes frame, so our dq callback gets + called and it can restart the stream */ + gspca_frame_add(gspca_dev, FIRST_PACKET, NULL, 0); + gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0); +} + +static void sd_pkt_scan_bayer(struct gspca_dev *gspca_dev, u8 *data, int len) +{ + struct cam *cam = &gspca_dev->cam; + int imagesize = cam->cam_mode[gspca_dev->curr_mode].sizeimage; + + if (gspca_dev->image_len == 0) { + gspca_frame_add(gspca_dev, FIRST_PACKET, data, len); + return; + } + + if (gspca_dev->image_len + len >= imagesize) { + sd_complete_frame(gspca_dev, data, len); + return; + } + + gspca_frame_add(gspca_dev, INTER_PACKET, data, len); +} + +static void sd_pkt_scan(struct gspca_dev *gspca_dev, u8 *data, int len) +{ + int mult = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv; + + if (len == 0) + return; + + if (mult == 1) /* mult == 1 means raw bayer */ + sd_pkt_scan_bayer(gspca_dev, data, len); + else + sd_pkt_scan_janggu(gspca_dev, data, len); +} + +static int sd_querymenu(struct gspca_dev *gspca_dev, + struct v4l2_querymenu *menu) +{ + switch (menu->id) { + case V4L2_CID_POWER_LINE_FREQUENCY: + switch (menu->index) { + case V4L2_CID_POWER_LINE_FREQUENCY_DISABLED: + strcpy((char *) menu->name, "NoFliker"); + return 0; + case V4L2_CID_POWER_LINE_FREQUENCY_50HZ: + strcpy((char *) menu->name, "50 Hz"); + return 0; + case V4L2_CID_POWER_LINE_FREQUENCY_60HZ: + strcpy((char *) menu->name, "60 Hz"); + return 0; + } + break; + } + return -EINVAL; +} + +#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE) +static int sd_int_pkt_scan(struct gspca_dev *gspca_dev, u8 *data, int len) +{ + struct sd *sd = (struct sd *)gspca_dev; + u8 state; + + if (len != 2) + return -EINVAL; + + switch (data[0]) { + case 0: + case 1: + state = data[0]; + break; + default: + return -EINVAL; + } + if (sd->button_state != state) { + input_report_key(gspca_dev->input_dev, KEY_CAMERA, state); + input_sync(gspca_dev->input_dev); + sd->button_state = state; + } + + return 0; +} +#endif + +/* sub-driver description */ +static const struct sd_desc sd_desc = { + .name = MODULE_NAME, + .ctrls = sd_ctrls, + .nctrls = ARRAY_SIZE(sd_ctrls), + .config = sd_config, + .init = sd_init, + .start = sd_start, + .stopN = sd_stopN, + .dq_callback = sd_dq_callback, + .pkt_scan = sd_pkt_scan, + .querymenu = sd_querymenu, +#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE) + .int_pkt_scan = sd_int_pkt_scan, +#endif +}; + +/* -- module initialisation -- */ +static const struct usb_device_id device_table[] = { + {USB_DEVICE(0x03e8, 0x0004)}, /* Endpoints/Aox SE401 */ + {USB_DEVICE(0x0471, 0x030b)}, /* Philips PCVC665K */ + {USB_DEVICE(0x047d, 0x5001)}, /* Kensington 67014 */ + {USB_DEVICE(0x047d, 0x5002)}, /* Kensington 6701(5/7) */ + {USB_DEVICE(0x047d, 0x5003)}, /* Kensington 67016 */ + {} +}; +MODULE_DEVICE_TABLE(usb, device_table); + +/* -- device connect -- */ +static int sd_probe(struct usb_interface *intf, + const struct usb_device_id *id) +{ + return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), + THIS_MODULE); +} + +static int sd_pre_reset(struct usb_interface *intf) +{ + return 0; +} + +static int sd_post_reset(struct usb_interface *intf) +{ + return 0; +} + +static struct usb_driver sd_driver = { + .name = MODULE_NAME, + .id_table = device_table, + .probe = sd_probe, + .disconnect = gspca_disconnect, +#ifdef CONFIG_PM + .suspend = gspca_suspend, + .resume = gspca_resume, +#endif + .pre_reset = sd_pre_reset, + .post_reset = sd_post_reset, +}; + +/* -- module insert / remove -- */ +static int __init sd_mod_init(void) +{ + return usb_register(&sd_driver); +} +static void __exit sd_mod_exit(void) +{ + usb_deregister(&sd_driver); +} + +module_init(sd_mod_init); +module_exit(sd_mod_exit); diff --git a/drivers/media/video/gspca/se401.h b/drivers/media/video/gspca/se401.h new file mode 100644 index 000000000000..96d8ebf3cf59 --- /dev/null +++ b/drivers/media/video/gspca/se401.h @@ -0,0 +1,90 @@ +/* + * GSPCA Endpoints (formerly known as AOX) se401 USB Camera sub Driver + * + * Copyright (C) 2011 Hans de Goede + * + * Based on the v4l1 se401 driver which is: + * + * Copyright (c) 2000 Jeroen B. Vreeken (pe1rxq@amsat.org) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * 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 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 + * + */ + +#define SE401_REQ_GET_CAMERA_DESCRIPTOR 0x06 +#define SE401_REQ_START_CONTINUOUS_CAPTURE 0x41 +#define SE401_REQ_STOP_CONTINUOUS_CAPTURE 0x42 +#define SE401_REQ_CAPTURE_FRAME 0x43 +#define SE401_REQ_GET_BRT 0x44 +#define SE401_REQ_SET_BRT 0x45 +#define SE401_REQ_GET_WIDTH 0x4c +#define SE401_REQ_SET_WIDTH 0x4d +#define SE401_REQ_GET_HEIGHT 0x4e +#define SE401_REQ_SET_HEIGHT 0x4f +#define SE401_REQ_GET_OUTPUT_MODE 0x50 +#define SE401_REQ_SET_OUTPUT_MODE 0x51 +#define SE401_REQ_GET_EXT_FEATURE 0x52 +#define SE401_REQ_SET_EXT_FEATURE 0x53 +#define SE401_REQ_CAMERA_POWER 0x56 +#define SE401_REQ_LED_CONTROL 0x57 +#define SE401_REQ_BIOS 0xff + +#define SE401_BIOS_READ 0x07 + +#define SE401_FORMAT_BAYER 0x40 + +/* Hyundai hv7131b registers + 7121 and 7141 should be the same (haven't really checked...) */ +/* Mode registers: */ +#define HV7131_REG_MODE_A 0x00 +#define HV7131_REG_MODE_B 0x01 +#define HV7131_REG_MODE_C 0x02 +/* Frame registers: */ +#define HV7131_REG_FRSU 0x10 +#define HV7131_REG_FRSL 0x11 +#define HV7131_REG_FCSU 0x12 +#define HV7131_REG_FCSL 0x13 +#define HV7131_REG_FWHU 0x14 +#define HV7131_REG_FWHL 0x15 +#define HV7131_REG_FWWU 0x16 +#define HV7131_REG_FWWL 0x17 +/* Timing registers: */ +#define HV7131_REG_THBU 0x20 +#define HV7131_REG_THBL 0x21 +#define HV7131_REG_TVBU 0x22 +#define HV7131_REG_TVBL 0x23 +#define HV7131_REG_TITU 0x25 +#define HV7131_REG_TITM 0x26 +#define HV7131_REG_TITL 0x27 +#define HV7131_REG_TMCD 0x28 +/* Adjust Registers: */ +#define HV7131_REG_ARLV 0x30 +#define HV7131_REG_ARCG 0x31 +#define HV7131_REG_AGCG 0x32 +#define HV7131_REG_ABCG 0x33 +#define HV7131_REG_APBV 0x34 +#define HV7131_REG_ASLP 0x54 +/* Offset Registers: */ +#define HV7131_REG_OFSR 0x50 +#define HV7131_REG_OFSG 0x51 +#define HV7131_REG_OFSB 0x52 +/* REset level statistics registers: */ +#define HV7131_REG_LOREFNOH 0x57 +#define HV7131_REG_LOREFNOL 0x58 +#define HV7131_REG_HIREFNOH 0x59 +#define HV7131_REG_HIREFNOL 0x5a + +/* se401 registers */ +#define SE401_OPERATINGMODE 0x2000 -- cgit v1.2.3 From 2f2ea0f3f25effeaf0d27f5aaad591281fad27e2 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 17 May 2011 09:34:23 -0300 Subject: [media] gspca_sunplus: Fix streaming on logitech quicksmart 420 Don't issue a stream stop to the camera at the end of sd_start, this fixes streaming with this particular model. Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/sunplus.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/media/video/gspca/sunplus.c b/drivers/media/video/gspca/sunplus.c index b089c0d3ee9f..6ec232902183 100644 --- a/drivers/media/video/gspca/sunplus.c +++ b/drivers/media/video/gspca/sunplus.c @@ -247,7 +247,6 @@ static const struct cmd spca504A_clicksmart420_init_data[] = { {0x30, 0x0004, 0x000a}, {0xb0, 0x0001, 0x0000}, - {0xa1, 0x0080, 0x0001}, {0x30, 0x0049, 0x0000}, {0x30, 0x0060, 0x0005}, @@ -256,8 +255,6 @@ static const struct cmd spca504A_clicksmart420_init_data[] = { {0x00, 0x0000, 0x2000}, {0x00, 0x0013, 0x2301}, {0x00, 0x0003, 0x2000}, - {0x00, 0x0000, 0x2000}, - }; /* clicksmart 420 open data ? */ -- cgit v1.2.3 From e7d712cc992a3f22151f15263cbacbb2d38dd371 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 5 Jun 2011 14:58:46 -0300 Subject: [media] gspca: s/strncpy/strlcpy/ Just like in userspace strncpy does not guarantee 0 termination. Use strlcpy instead which does guarantee 0 termination. Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/gspca.c | 6 +++--- drivers/media/video/gspca/t613.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index d94c108dd8dc..5da4879f47f2 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c @@ -1281,10 +1281,10 @@ static int vidioc_querycap(struct file *file, void *priv, ret = -ENODEV; goto out; } - strncpy((char *) cap->driver, gspca_dev->sd_desc->name, + strlcpy((char *) cap->driver, gspca_dev->sd_desc->name, sizeof cap->driver); if (gspca_dev->dev->product != NULL) { - strncpy((char *) cap->card, gspca_dev->dev->product, + strlcpy((char *) cap->card, gspca_dev->dev->product, sizeof cap->card); } else { snprintf((char *) cap->card, sizeof cap->card, @@ -1462,7 +1462,7 @@ static int vidioc_enum_input(struct file *file, void *priv, return -EINVAL; input->type = V4L2_INPUT_TYPE_CAMERA; input->status = gspca_dev->cam.input_flags; - strncpy(input->name, gspca_dev->sd_desc->name, + strlcpy(input->name, gspca_dev->sd_desc->name, sizeof input->name); return 0; } diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c index 7e762d551099..d1d733b9359b 100644 --- a/drivers/media/video/gspca/t613.c +++ b/drivers/media/video/gspca/t613.c @@ -1387,7 +1387,7 @@ static int sd_querymenu(struct gspca_dev *gspca_dev, return 0; case V4L2_CID_EFFECTS: if ((unsigned) menu->index < ARRAY_SIZE(effects_control)) { - strncpy((char *) menu->name, + strlcpy((char *) menu->name, effects_control[menu->index], sizeof menu->name); return 0; -- cgit v1.2.3 From c246412117d871a3a90cd4e8ba2c6dea18a59f71 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 6 Jun 2011 15:25:18 -0300 Subject: [media] pwc: Remove a bunch of bogus sanity checks / don't return EFAULT wrongly The chances if any of these becoming NULL magically are 0% And if they do become NULL oopsing is the right thing to do (so that the user logs a bug with the kernel rather then with whatever app he was using). Returning EFAULT to userspace should only be done when userspace supplies a bad address, not on driver bugs / hw issues, so in the few cases where the check is not bogus return something else. Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pwc/pwc-if.c | 43 +++----------------------------- drivers/media/video/pwc/pwc-uncompress.c | 5 ---- drivers/media/video/pwc/pwc-v4l.c | 2 +- 3 files changed, 5 insertions(+), 45 deletions(-) diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index b0bde5a87c8a..3d3ff6030987 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c @@ -226,9 +226,6 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) PWC_DEBUG_MEMORY(">> pwc_allocate_buffers(pdev = 0x%p)\n", pdev); - if (pdev == NULL) - return -ENXIO; - /* Allocate Isochronuous pipe buffers */ for (i = 0; i < MAX_ISO_BUFS; i++) { if (pdev->sbuf[i].data == NULL) { @@ -306,8 +303,6 @@ static void pwc_free_buffers(struct pwc_device *pdev) PWC_DEBUG_MEMORY("Entering free_buffers(%p).\n", pdev); - if (pdev == NULL) - return; /* Release Iso-pipe buffers */ for (i = 0; i < MAX_ISO_BUFS; i++) if (pdev->sbuf[i].data != NULL) { @@ -783,26 +778,20 @@ int pwc_isoc_init(struct pwc_device *pdev) struct usb_device *udev; struct urb *urb; int i, j, ret; - struct usb_interface *intf; struct usb_host_interface *idesc = NULL; - if (pdev == NULL) - return -EFAULT; if (pdev->iso_init) return 0; pdev->vsync = 0; udev = pdev->udev; /* Get the current alternate interface, adjust packet size */ - if (!udev->actconfig) - return -EFAULT; intf = usb_ifnum_to_if(udev, 0); if (intf) idesc = usb_altnum_to_altsetting(intf, pdev->valternate); - if (!idesc) - return -EFAULT; + return -EIO; /* Search video endpoint */ pdev->vmax_packet_size = -1; @@ -918,8 +907,7 @@ static void pwc_iso_free(struct pwc_device *pdev) void pwc_isoc_cleanup(struct pwc_device *pdev) { PWC_DEBUG_OPEN(">> pwc_isoc_cleanup()\n"); - if (pdev == NULL) - return; + if (pdev->iso_init == 0) return; @@ -1058,7 +1046,6 @@ static int pwc_video_open(struct file *file) PWC_DEBUG_OPEN(">> video_open called(vdev = 0x%p).\n", vdev); pdev = video_get_drvdata(vdev); - BUG_ON(!pdev); if (pdev->vopen) { PWC_DEBUG_OPEN("I'm busy, someone is using the device.\n"); return -EBUSY; @@ -1230,11 +1217,7 @@ static ssize_t pwc_video_read(struct file *file, char __user *buf, PWC_DEBUG_READ("pwc_video_read(vdev=0x%p, buf=%p, count=%zd) called.\n", vdev, buf, count); - if (vdev == NULL) - return -EFAULT; pdev = video_get_drvdata(vdev); - if (pdev == NULL) - return -EFAULT; if (pdev->error_status) { rv = -pdev->error_status; /* Something happened, report what. */ @@ -1279,10 +1262,9 @@ static ssize_t pwc_video_read(struct file *file, char __user *buf, set_current_state(TASK_RUNNING); /* Decompress and release frame */ - if (pwc_handle_frame(pdev)) { - rv = -EFAULT; + rv = pwc_handle_frame(pdev); + if (rv) goto err_out; - } } PWC_DEBUG_READ("Copying data to user space.\n"); @@ -1317,11 +1299,7 @@ static unsigned int pwc_video_poll(struct file *file, poll_table *wait) struct pwc_device *pdev; int ret; - if (vdev == NULL) - return -EFAULT; pdev = video_get_drvdata(vdev); - if (pdev == NULL) - return -EFAULT; /* Start the stream (if not already started) */ ret = pwc_isoc_init(pdev); @@ -1769,18 +1747,6 @@ static void usb_pwc_disconnect(struct usb_interface *intf) mutex_lock(&pdev->modlock); usb_set_intfdata (intf, NULL); - if (pdev == NULL) { - PWC_ERROR("pwc_disconnect() Called without private pointer.\n"); - goto disconnect_out; - } - if (pdev->udev == NULL) { - PWC_ERROR("pwc_disconnect() already called for %p\n", pdev); - goto disconnect_out; - } - if (pdev->udev != interface_to_usbdev(intf)) { - PWC_ERROR("pwc_disconnect() Woops: pointer mismatch udev/pdev.\n"); - goto disconnect_out; - } /* We got unplugged; this is signalled by an EPIPE error code */ pdev->error_status = EPIPE; @@ -1792,7 +1758,6 @@ static void usb_pwc_disconnect(struct usb_interface *intf) /* No need to keep the urbs around after disconnection */ pwc_isoc_cleanup(pdev); -disconnect_out: mutex_unlock(&pdev->modlock); pwc_remove_sysfs_files(pdev); diff --git a/drivers/media/video/pwc/pwc-uncompress.c b/drivers/media/video/pwc/pwc-uncompress.c index 3b73f295f032..4118184951ee 100644 --- a/drivers/media/video/pwc/pwc-uncompress.c +++ b/drivers/media/video/pwc/pwc-uncompress.c @@ -42,12 +42,7 @@ int pwc_decompress(struct pwc_device *pdev) u16 *src; u16 *dsty, *dstu, *dstv; - if (pdev == NULL) - return -EFAULT; - fbuf = pdev->read_frame; - if (fbuf == NULL) - return -EFAULT; image = pdev->image_data; image += pdev->images[pdev->fill_image].offset; diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c index 059bd95c1225..8e72e0f56550 100644 --- a/drivers/media/video/pwc/pwc-v4l.c +++ b/drivers/media/video/pwc/pwc-v4l.c @@ -778,7 +778,7 @@ static int pwc_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf) /* Decompress data in pdev->images[pdev->fill_image] */ ret = pwc_handle_frame(pdev); if (ret) - return -EFAULT; + return ret; PWC_DEBUG_IOCTL("VIDIOC_DQBUF: after pwc_handle_frame\n"); buf->index = pdev->fill_image; -- cgit v1.2.3 From 5f40d915521f5a8ae4551a21871a062201ba9981 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 6 Jun 2011 15:35:54 -0300 Subject: [media] pwc: remove __cplusplus guards from private header Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pwc/pwc.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h index 33863b91461c..421e75b69f29 100644 --- a/drivers/media/video/pwc/pwc.h +++ b/drivers/media/video/pwc/pwc.h @@ -259,10 +259,6 @@ struct pwc_device #endif }; -#ifdef __cplusplus -extern "C" { -#endif - /* Global variables */ #ifdef CONFIG_USB_PWC_DEBUG extern int pwc_trace; @@ -340,10 +336,4 @@ extern const struct v4l2_ioctl_ops pwc_ioctl_ops; /* Expand frame to image, possibly including decompression. Uses read_frame and fill_image */ extern int pwc_decompress(struct pwc_device *pdev); -#ifdef __cplusplus -} -#endif - - #endif -/* vim: set cino= formatoptions=croql cindent shiftwidth=8 tabstop=8: */ -- cgit v1.2.3 From 885fe18f5542fe283a17f70583383c6cadcba1c3 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 6 Jun 2011 15:33:44 -0300 Subject: [media] pwc: Replace private buffer management code with videobuf2 Looking at the pwc buffer management code has made it clear to me it needed some serious fixing. Not only was there a ton of code duplication even internally to pwc (read and mmap wait for frame code was duplicated), the code also was outright buggy. With the worst offender being dqbuf, which just round robin returned all the mmap buffers, without paying any attention to them being queued by the app with qbuf or not. And qbuf itself was a noop. So I set out to fix this and already had some cleanups in place when I read Jonathan Corbet's lwn article on videobuf2, this inspired me to just rip out the buffer management code and replace it with videobuf2, greatly reducing the amount of code, and fixing all bugs in one go: Many thanks to Jonathan for the timely article on this ! Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pwc/Kconfig | 1 + drivers/media/video/pwc/pwc-ctrl.c | 19 +- drivers/media/video/pwc/pwc-if.c | 847 +++++++++---------------------- drivers/media/video/pwc/pwc-misc.c | 4 - drivers/media/video/pwc/pwc-uncompress.c | 11 +- drivers/media/video/pwc/pwc-v4l.c | 125 +---- drivers/media/video/pwc/pwc.h | 76 +-- 7 files changed, 275 insertions(+), 808 deletions(-) diff --git a/drivers/media/video/pwc/Kconfig b/drivers/media/video/pwc/Kconfig index 8da42e4f1ba0..d63d0a850035 100644 --- a/drivers/media/video/pwc/Kconfig +++ b/drivers/media/video/pwc/Kconfig @@ -1,6 +1,7 @@ config USB_PWC tristate "USB Philips Cameras" depends on VIDEO_V4L2 + select VIDEOBUF2_VMALLOC ---help--- Say Y or M here if you want to use one of these Philips & OEM webcams: diff --git a/drivers/media/video/pwc/pwc-ctrl.c b/drivers/media/video/pwc/pwc-ctrl.c index 760b4de13adf..19221cbca8c3 100644 --- a/drivers/media/video/pwc/pwc-ctrl.c +++ b/drivers/media/video/pwc/pwc-ctrl.c @@ -511,13 +511,9 @@ unsigned int pwc_get_fps(struct pwc_device *pdev, unsigned int index, unsigned i return ret; } -#define BLACK_Y 0 -#define BLACK_U 128 -#define BLACK_V 128 - static void pwc_set_image_buffer_size(struct pwc_device *pdev) { - int i, factor = 0; + int factor = 0; /* for V4L2_PIX_FMT_YUV420 */ switch (pdev->pixfmt) { @@ -541,22 +537,9 @@ static void pwc_set_image_buffer_size(struct pwc_device *pdev) */ pdev->offset.x = ((pdev->view.x - pdev->image.x) / 2) & 0xFFFC; pdev->offset.y = ((pdev->view.y - pdev->image.y) / 2) & 0xFFFE; - - /* Fill buffers with black colors */ - for (i = 0; i < pwc_mbufs; i++) { - unsigned char *p = pdev->image_data + pdev->images[i].offset; - memset(p, BLACK_Y, pdev->view.x * pdev->view.y); - p += pdev->view.x * pdev->view.y; - memset(p, BLACK_U, pdev->view.x * pdev->view.y/4); - p += pdev->view.x * pdev->view.y/4; - memset(p, BLACK_V, pdev->view.x * pdev->view.y/4); - } } - - /* BRIGHTNESS */ - int pwc_get_brightness(struct pwc_device *pdev) { char buf; diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index 3d3ff6030987..907db23fdb5d 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c @@ -116,6 +116,7 @@ MODULE_DEVICE_TABLE(usb, pwc_device_table); static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id *id); static void usb_pwc_disconnect(struct usb_interface *intf); +static void pwc_isoc_cleanup(struct pwc_device *pdev); static struct usb_driver pwc_driver = { .name = "Philips webcam", /* name */ @@ -129,8 +130,6 @@ static struct usb_driver pwc_driver = { static int default_size = PSZ_QCIF; static int default_fps = 10; -static int default_fbufs = 3; /* Default number of frame buffers */ - int pwc_mbufs = 2; /* Default number of mmap() buffers */ #ifdef CONFIG_USB_PWC_DEBUG int pwc_trace = PWC_DEBUG_LEVEL; #endif @@ -173,52 +172,6 @@ static struct video_device pwc_template = { /***************************************************************************/ /* Private functions */ -/* Here we want the physical address of the memory. - * This is used when initializing the contents of the area. - */ - - - -static void *pwc_rvmalloc(unsigned long size) -{ - void * mem; - unsigned long adr; - - mem=vmalloc_32(size); - if (!mem) - return NULL; - - memset(mem, 0, size); /* Clear the ram out, no junk to the user */ - adr=(unsigned long) mem; - while (size > 0) - { - SetPageReserved(vmalloc_to_page((void *)adr)); - adr += PAGE_SIZE; - size -= PAGE_SIZE; - } - return mem; -} - -static void pwc_rvfree(void * mem, unsigned long size) -{ - unsigned long adr; - - if (!mem) - return; - - adr=(unsigned long) mem; - while ((long) size > 0) - { - ClearPageReserved(vmalloc_to_page((void *)adr)); - adr += PAGE_SIZE; - size -= PAGE_SIZE; - } - vfree(mem); -} - - - - static int pwc_allocate_buffers(struct pwc_device *pdev) { int i, err; @@ -239,30 +192,6 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) } } - /* Allocate frame buffer structure */ - if (pdev->fbuf == NULL) { - kbuf = kzalloc(default_fbufs * sizeof(struct pwc_frame_buf), GFP_KERNEL); - if (kbuf == NULL) { - PWC_ERROR("Failed to allocate frame buffer structure.\n"); - return -ENOMEM; - } - PWC_DEBUG_MEMORY("Allocated frame buffer structure at %p.\n", kbuf); - pdev->fbuf = kbuf; - } - - /* create frame buffers, and make circular ring */ - for (i = 0; i < default_fbufs; i++) { - if (pdev->fbuf[i].data == NULL) { - kbuf = vzalloc(PWC_FRAME_SIZE); /* need vmalloc since frame buffer > 128K */ - if (kbuf == NULL) { - PWC_ERROR("Failed to allocate frame buffer %d.\n", i); - return -ENOMEM; - } - PWC_DEBUG_MEMORY("Allocated frame buffer %d at %p.\n", i, kbuf); - pdev->fbuf[i].data = kbuf; - } - } - /* Allocate decompressor table space */ if (DEVICE_USE_CODEC1(pdev->type)) err = pwc_dec1_alloc(pdev); @@ -274,25 +203,6 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) return err; } - /* Allocate image buffer; double buffer for mmap() */ - kbuf = pwc_rvmalloc(pwc_mbufs * pdev->len_per_image); - if (kbuf == NULL) { - PWC_ERROR("Failed to allocate image buffer(s). needed (%d)\n", - pwc_mbufs * pdev->len_per_image); - return -ENOMEM; - } - PWC_DEBUG_MEMORY("Allocated image buffer at %p.\n", kbuf); - pdev->image_data = kbuf; - for (i = 0; i < pwc_mbufs; i++) { - pdev->images[i].offset = i * pdev->len_per_image; - pdev->images[i].vma_use_count = 0; - } - for (; i < MAX_IMAGES; i++) { - pdev->images[i].offset = 0; - } - - kbuf = NULL; - PWC_DEBUG_MEMORY("<< pwc_allocate_buffers()\n"); return 0; } @@ -311,19 +221,6 @@ static void pwc_free_buffers(struct pwc_device *pdev) pdev->sbuf[i].data = NULL; } - /* The same for frame buffers */ - if (pdev->fbuf != NULL) { - for (i = 0; i < default_fbufs; i++) { - if (pdev->fbuf[i].data != NULL) { - PWC_DEBUG_MEMORY("Freeing frame buffer %d at %p.\n", i, pdev->fbuf[i].data); - vfree(pdev->fbuf[i].data); - pdev->fbuf[i].data = NULL; - } - } - kfree(pdev->fbuf); - pdev->fbuf = NULL; - } - /* Intermediate decompression buffer & tables */ if (pdev->decompress_data != NULL) { PWC_DEBUG_MEMORY("Freeing decompression buffer at %p.\n", pdev->decompress_data); @@ -331,226 +228,23 @@ static void pwc_free_buffers(struct pwc_device *pdev) pdev->decompress_data = NULL; } - /* Release image buffers */ - if (pdev->image_data != NULL) { - PWC_DEBUG_MEMORY("Freeing image buffer at %p.\n", pdev->image_data); - pwc_rvfree(pdev->image_data, pwc_mbufs * pdev->len_per_image); - } - pdev->image_data = NULL; - PWC_DEBUG_MEMORY("Leaving free_buffers().\n"); } -/* The frame & image buffer mess. - - Yes, this is a mess. Well, it used to be simple, but alas... In this - module, 3 buffers schemes are used to get the data from the USB bus to - the user program. The first scheme involves the ISO buffers (called thus - since they transport ISO data from the USB controller), and not really - interesting. Suffices to say the data from this buffer is quickly - gathered in an interrupt handler (pwc_isoc_handler) and placed into the - frame buffer. - - The frame buffer is the second scheme, and is the central element here. - It collects the data from a single frame from the camera (hence, the - name). Frames are delimited by the USB camera with a short USB packet, - so that's easy to detect. The frame buffers form a list that is filled - by the camera+USB controller and drained by the user process through - either read() or mmap(). - - The image buffer is the third scheme, in which frames are decompressed - and converted into planar format. For mmap() there is more than - one image buffer available. - - The frame buffers provide the image buffering. In case the user process - is a bit slow, this introduces lag and some undesired side-effects. - The problem arises when the frame buffer is full. I used to drop the last - frame, which makes the data in the queue stale very quickly. But dropping - the frame at the head of the queue proved to be a litte bit more difficult. - I tried a circular linked scheme, but this introduced more problems than - it solved. - - Because filling and draining are completely asynchronous processes, this - requires some fiddling with pointers and mutexes. - - Eventually, I came up with a system with 2 lists: an 'empty' frame list - and a 'full' frame list: - * Initially, all frame buffers but one are on the 'empty' list; the one - remaining buffer is our initial fill frame. - * If a frame is needed for filling, we try to take it from the 'empty' - list, unless that list is empty, in which case we take the buffer at - the head of the 'full' list. - * When our fill buffer has been filled, it is appended to the 'full' - list. - * If a frame is needed by read() or mmap(), it is taken from the head of - the 'full' list, handled, and then appended to the 'empty' list. If no - buffer is present on the 'full' list, we wait. - The advantage is that the buffer that is currently being decompressed/ - converted, is on neither list, and thus not in our way (any other scheme - I tried had the problem of old data lingering in the queue). - - Whatever strategy you choose, it always remains a tradeoff: with more - frame buffers the chances of a missed frame are reduced. On the other - hand, on slower machines it introduces lag because the queue will - always be full. - */ - -/** - \brief Find next frame buffer to fill. Take from empty or full list, whichever comes first. - */ -static int pwc_next_fill_frame(struct pwc_device *pdev) +struct pwc_frame_buf *pwc_get_next_fill_buf(struct pwc_device *pdev) { - int ret; - unsigned long flags; - - ret = 0; - spin_lock_irqsave(&pdev->ptrlock, flags); - if (pdev->fill_frame != NULL) { - /* append to 'full' list */ - if (pdev->full_frames == NULL) { - pdev->full_frames = pdev->fill_frame; - pdev->full_frames_tail = pdev->full_frames; - } - else { - pdev->full_frames_tail->next = pdev->fill_frame; - pdev->full_frames_tail = pdev->fill_frame; - } - } - if (pdev->empty_frames != NULL) { - /* We have empty frames available. That's easy */ - pdev->fill_frame = pdev->empty_frames; - pdev->empty_frames = pdev->empty_frames->next; - } - else { - /* Hmm. Take it from the full list */ - /* sanity check */ - if (pdev->full_frames == NULL) { - PWC_ERROR("Neither empty or full frames available!\n"); - spin_unlock_irqrestore(&pdev->ptrlock, flags); - return -EINVAL; - } - pdev->fill_frame = pdev->full_frames; - pdev->full_frames = pdev->full_frames->next; - ret = 1; - } - pdev->fill_frame->next = NULL; - spin_unlock_irqrestore(&pdev->ptrlock, flags); - return ret; -} - - -/** - \brief Reset all buffers, pointers and lists, except for the image_used[] buffer. - - If the image_used[] buffer is cleared too, mmap()/VIDIOCSYNC will run into trouble. - */ -static void pwc_reset_buffers(struct pwc_device *pdev) -{ - int i; - unsigned long flags; - - PWC_DEBUG_MEMORY(">> %s __enter__\n", __func__); - - spin_lock_irqsave(&pdev->ptrlock, flags); - pdev->full_frames = NULL; - pdev->full_frames_tail = NULL; - for (i = 0; i < default_fbufs; i++) { - pdev->fbuf[i].filled = 0; - if (i > 0) - pdev->fbuf[i].next = &pdev->fbuf[i - 1]; - else - pdev->fbuf->next = NULL; - } - pdev->empty_frames = &pdev->fbuf[default_fbufs - 1]; - pdev->empty_frames_tail = pdev->fbuf; - pdev->read_frame = NULL; - pdev->fill_frame = pdev->empty_frames; - pdev->empty_frames = pdev->empty_frames->next; - - pdev->image_read_pos = 0; - pdev->fill_image = 0; - spin_unlock_irqrestore(&pdev->ptrlock, flags); - - PWC_DEBUG_MEMORY("<< %s __leaving__\n", __func__); -} - - -/** - \brief Do all the handling for getting one frame: get pointer, decompress, advance pointers. - */ -int pwc_handle_frame(struct pwc_device *pdev) -{ - int ret = 0; - unsigned long flags; - - spin_lock_irqsave(&pdev->ptrlock, flags); - /* First grab our read_frame; this is removed from all lists, so - we can release the lock after this without problems */ - if (pdev->read_frame != NULL) { - /* This can't theoretically happen */ - PWC_ERROR("Huh? Read frame still in use?\n"); - spin_unlock_irqrestore(&pdev->ptrlock, flags); - return ret; - } - - - if (pdev->full_frames == NULL) { - PWC_ERROR("Woops. No frames ready.\n"); - } - else { - pdev->read_frame = pdev->full_frames; - pdev->full_frames = pdev->full_frames->next; - pdev->read_frame->next = NULL; - } - - if (pdev->read_frame != NULL) { - /* Decompression is a lengthy process, so it's outside of the lock. - This gives the isoc_handler the opportunity to fill more frames - in the mean time. - */ - spin_unlock_irqrestore(&pdev->ptrlock, flags); - ret = pwc_decompress(pdev); - spin_lock_irqsave(&pdev->ptrlock, flags); - - /* We're done with read_buffer, tack it to the end of the empty buffer list */ - if (pdev->empty_frames == NULL) { - pdev->empty_frames = pdev->read_frame; - pdev->empty_frames_tail = pdev->empty_frames; - } - else { - pdev->empty_frames_tail->next = pdev->read_frame; - pdev->empty_frames_tail = pdev->read_frame; - } - pdev->read_frame = NULL; - } - spin_unlock_irqrestore(&pdev->ptrlock, flags); - return ret; -} - -/** - \brief Advance pointers of image buffer (after each user request) -*/ -void pwc_next_image(struct pwc_device *pdev) -{ - pdev->image_used[pdev->fill_image] = 0; - pdev->fill_image = (pdev->fill_image + 1) % pwc_mbufs; -} - -/** - * Print debug information when a frame is discarded because all of our buffer - * is full - */ -static void pwc_frame_dumped(struct pwc_device *pdev) -{ - pdev->vframes_dumped++; - if (pdev->vframe_count < FRAME_LOWMARK) - return; - - if (pdev->vframes_dumped < 20) - PWC_DEBUG_FLOW("Dumping frame %d\n", pdev->vframe_count); - else if (pdev->vframes_dumped == 20) - PWC_DEBUG_FLOW("Dumping frame %d (last message)\n", - pdev->vframe_count); + unsigned long flags = 0; + struct pwc_frame_buf *buf = NULL; + + spin_lock_irqsave(&pdev->queued_bufs_lock, flags); + if (list_empty(&pdev->queued_bufs)) + goto leave; + + buf = list_entry(pdev->queued_bufs.next, struct pwc_frame_buf, list); + list_del(&buf->list); +leave: + spin_unlock_irqrestore(&pdev->queued_bufs_lock, flags); + return buf; } static void pwc_snapshot_button(struct pwc_device *pdev, int down) @@ -570,9 +264,9 @@ static void pwc_snapshot_button(struct pwc_device *pdev, int down) #endif } -static int pwc_rcv_short_packet(struct pwc_device *pdev, const struct pwc_frame_buf *fbuf) +static void pwc_frame_complete(struct pwc_device *pdev) { - int awake = 0; + struct pwc_frame_buf *fbuf = pdev->fill_buf; /* The ToUCam Fun CMOS sensor causes the firmware to send 2 or 3 bogus frames on the USB wire after an exposure change. This conditition is @@ -584,7 +278,6 @@ static int pwc_rcv_short_packet(struct pwc_device *pdev, const struct pwc_frame_ if (ptr[1] == 1 && ptr[0] & 0x10) { PWC_TRACE("Hyundai CMOS sensor bug. Dropping frame.\n"); pdev->drop_frames += 2; - pdev->vframes_error++; } if ((ptr[0] ^ pdev->vmirror) & 0x01) { pwc_snapshot_button(pdev, ptr[0] & 0x01); @@ -607,8 +300,7 @@ static int pwc_rcv_short_packet(struct pwc_device *pdev, const struct pwc_frame_ */ if (fbuf->filled == 4) pdev->drop_frames++; - } - else if (pdev->type == 740 || pdev->type == 720) { + } else if (pdev->type == 740 || pdev->type == 720) { unsigned char *ptr = (unsigned char *)fbuf->data; if ((ptr[0] ^ pdev->vmirror) & 0x01) { pwc_snapshot_button(pdev, ptr[0] & 0x01); @@ -616,33 +308,23 @@ static int pwc_rcv_short_packet(struct pwc_device *pdev, const struct pwc_frame_ pdev->vmirror = ptr[0] & 0x03; } - /* In case we were instructed to drop the frame, do so silently. - The buffer pointers are not updated either (but the counters are reset below). - */ - if (pdev->drop_frames > 0) + /* In case we were instructed to drop the frame, do so silently. */ + if (pdev->drop_frames > 0) { pdev->drop_frames--; - else { + } else { /* Check for underflow first */ if (fbuf->filled < pdev->frame_total_size) { PWC_DEBUG_FLOW("Frame buffer underflow (%d bytes);" " discarded.\n", fbuf->filled); - pdev->vframes_error++; - } - else { - /* Send only once per EOF */ - awake = 1; /* delay wake_ups */ - - /* Find our next frame to fill. This will always succeed, since we - * nick a frame from either empty or full list, but if we had to - * take it from the full list, it means a frame got dropped. - */ - if (pwc_next_fill_frame(pdev)) - pwc_frame_dumped(pdev); - + } else { + fbuf->vb.v4l2_buf.field = V4L2_FIELD_NONE; + fbuf->vb.v4l2_buf.sequence = pdev->vframe_count; + vb2_buffer_done(&fbuf->vb, VB2_BUF_STATE_DONE); + pdev->fill_buf = NULL; + pdev->vsync = 0; } } /* !drop_frames */ pdev->vframe_count++; - return awake; } /* This gets called for the Isochronous pipe (video). This is done in @@ -650,24 +332,20 @@ static int pwc_rcv_short_packet(struct pwc_device *pdev, const struct pwc_frame_ */ static void pwc_isoc_handler(struct urb *urb) { - struct pwc_device *pdev; + struct pwc_device *pdev = (struct pwc_device *)urb->context; int i, fst, flen; - int awake; - struct pwc_frame_buf *fbuf; - unsigned char *fillptr = NULL, *iso_buf = NULL; - - awake = 0; - pdev = (struct pwc_device *)urb->context; - if (pdev == NULL) { - PWC_ERROR("isoc_handler() called with NULL device?!\n"); - return; - } + unsigned char *iso_buf = NULL; - if (urb->status == -ENOENT || urb->status == -ECONNRESET) { + if (urb->status == -ENOENT || urb->status == -ECONNRESET || + urb->status == -ESHUTDOWN) { PWC_DEBUG_OPEN("URB (%p) unlinked %ssynchronuously.\n", urb, urb->status == -ENOENT ? "" : "a"); return; } - if (urb->status != -EINPROGRESS && urb->status != 0) { + + if (pdev->fill_buf == NULL) + pdev->fill_buf = pwc_get_next_fill_buf(pdev); + + if (urb->status != 0) { const char *errmsg; errmsg = "Unknown"; @@ -679,29 +357,21 @@ static void pwc_isoc_handler(struct urb *urb) case -EILSEQ: errmsg = "CRC/Timeout (could be anything)"; break; case -ETIME: errmsg = "Device does not respond"; break; } - PWC_DEBUG_FLOW("pwc_isoc_handler() called with status %d [%s].\n", urb->status, errmsg); - /* Give up after a number of contiguous errors on the USB bus. - Appearantly something is wrong so we simulate an unplug event. - */ + PWC_ERROR("pwc_isoc_handler() called with status %d [%s].\n", + urb->status, errmsg); + /* Give up after a number of contiguous errors */ if (++pdev->visoc_errors > MAX_ISOC_ERRORS) { - PWC_INFO("Too many ISOC errors, bailing out.\n"); - pdev->error_status = EIO; - awake = 1; - wake_up_interruptible(&pdev->frameq); + PWC_ERROR("Too many ISOC errors, bailing out.\n"); + if (pdev->fill_buf) { + vb2_buffer_done(&pdev->fill_buf->vb, + VB2_BUF_STATE_ERROR); + pdev->fill_buf = NULL; + } } - goto handler_end; // ugly, but practical - } - - fbuf = pdev->fill_frame; - if (fbuf == NULL) { - PWC_ERROR("pwc_isoc_handler without valid fill frame.\n"); - awake = 1; + pdev->vsync = 0; /* Drop the current frame */ goto handler_end; } - else { - fillptr = fbuf->data + fbuf->filled; - } /* Reset ISOC error counter. We did get here, after all. */ pdev->visoc_errors = 0; @@ -715,65 +385,50 @@ static void pwc_isoc_handler(struct urb *urb) fst = urb->iso_frame_desc[i].status; flen = urb->iso_frame_desc[i].actual_length; iso_buf = urb->transfer_buffer + urb->iso_frame_desc[i].offset; - if (fst == 0) { - if (flen > 0) { /* if valid data... */ - if (pdev->vsync > 0) { /* ...and we are not sync-hunting... */ - pdev->vsync = 2; - - /* ...copy data to frame buffer, if possible */ - if (flen + fbuf->filled > pdev->frame_total_size) { - PWC_DEBUG_FLOW("Frame buffer overflow (flen = %d, frame_total_size = %d).\n", flen, pdev->frame_total_size); - pdev->vsync = 0; /* Hmm, let's wait for an EOF (end-of-frame) */ - pdev->vframes_error++; - } - else { - memmove(fillptr, iso_buf, flen); - fillptr += flen; - } - } + if (fst != 0) { + PWC_ERROR("Iso frame %d has error %d\n", i, fst); + continue; + } + if (flen > 0 && pdev->vsync) { + struct pwc_frame_buf *fbuf = pdev->fill_buf; + + if (pdev->vsync == 1) { + do_gettimeofday(&fbuf->vb.v4l2_buf.timestamp); + pdev->vsync = 2; + } + + if (flen + fbuf->filled > pdev->frame_total_size) { + PWC_ERROR("Frame overflow (%d > %d)\n", + flen + fbuf->filled, + pdev->frame_total_size); + pdev->vsync = 0; /* Let's wait for an EOF */ + } else { + memcpy(fbuf->data + fbuf->filled, iso_buf, + flen); fbuf->filled += flen; - } /* ..flen > 0 */ - - if (flen < pdev->vlast_packet_size) { - /* Shorter packet... We probably have the end of an image-frame; - wake up read() process and let select()/poll() do something. - Decompression is done in user time over there. - */ - if (pdev->vsync == 2) { - if (pwc_rcv_short_packet(pdev, fbuf)) { - awake = 1; - fbuf = pdev->fill_frame; - } - } - fbuf->filled = 0; - fillptr = fbuf->data; + } + } + if (flen < pdev->vlast_packet_size) { + /* Shorter packet... end of frame */ + if (pdev->vsync == 2) + pwc_frame_complete(pdev); + if (pdev->fill_buf == NULL) + pdev->fill_buf = pwc_get_next_fill_buf(pdev); + if (pdev->fill_buf) { + pdev->fill_buf->filled = 0; pdev->vsync = 1; } - - pdev->vlast_packet_size = flen; - } /* ..status == 0 */ - else { - /* This is normally not interesting to the user, unless - * you are really debugging something, default = 0 */ - static int iso_error; - iso_error++; - if (iso_error < 20) - PWC_DEBUG_FLOW("Iso frame %d of USB has error %d\n", i, fst); } + pdev->vlast_packet_size = flen; } handler_end: - if (awake) - wake_up_interruptible(&pdev->frameq); - - urb->dev = pdev->udev; i = usb_submit_urb(urb, GFP_ATOMIC); if (i != 0) PWC_ERROR("Error (%d) re-submitting urb in pwc_isoc_handler.\n", i); } - -int pwc_isoc_init(struct pwc_device *pdev) +static int pwc_isoc_init(struct pwc_device *pdev) { struct usb_device *udev; struct urb *urb; @@ -784,6 +439,8 @@ int pwc_isoc_init(struct pwc_device *pdev) if (pdev->iso_init) return 0; pdev->vsync = 0; + pdev->fill_buf = NULL; + pdev->vframe_count = 0; udev = pdev->udev; /* Get the current alternate interface, adjust packet size */ @@ -904,7 +561,7 @@ static void pwc_iso_free(struct pwc_device *pdev) } } -void pwc_isoc_cleanup(struct pwc_device *pdev) +static void pwc_isoc_cleanup(struct pwc_device *pdev) { PWC_DEBUG_OPEN(">> pwc_isoc_cleanup()\n"); @@ -926,6 +583,22 @@ void pwc_isoc_cleanup(struct pwc_device *pdev) PWC_DEBUG_OPEN("<< pwc_isoc_cleanup()\n"); } +/* + * Release all queued buffers, no need to take queued_bufs_lock, since all + * iso urbs have been killed when we're called so pwc_isoc_handler won't run. + */ +static void pwc_cleanup_queued_bufs(struct pwc_device *pdev) +{ + while (!list_empty(&pdev->queued_bufs)) { + struct pwc_frame_buf *buf; + + buf = list_entry(pdev->queued_bufs.next, struct pwc_frame_buf, + list); + list_del(&buf->list); + vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR); + } +} + /********* * sysfs *********/ @@ -1086,12 +759,6 @@ static int pwc_video_open(struct file *file) } /* Reset buffers & parameters */ - pwc_reset_buffers(pdev); - for (i = 0; i < pwc_mbufs; i++) - pdev->image_used[i] = 0; - pdev->vframe_count = 0; - pdev->vframes_dumped = 0; - pdev->vframes_error = 0; pdev->visoc_errors = 0; pdev->error_status = 0; pwc_construct(pdev); /* set min/max sizes correct */ @@ -1161,19 +828,12 @@ static int pwc_video_close(struct file *file) if (pdev->vopen == 0) PWC_DEBUG_MODULE("video_close() called on closed device?\n"); - /* Dump statistics, but only if a reasonable amount of frames were - processed (to prevent endless log-entries in case of snap-shot - programs) - */ - if (pdev->vframe_count > 20) - PWC_DEBUG_MODULE("Closing video device: %d frames received, dumped %d frames, %d frames with errors.\n", pdev->vframe_count, pdev->vframes_dumped, pdev->vframes_error); - if (DEVICE_USE_CODEC1(pdev->type)) pwc_dec1_exit(); else pwc_dec23_exit(); - pwc_isoc_cleanup(pdev); + vb2_queue_release(&pdev->vb_queue); pwc_free_buffers(pdev); /* Turn off LEDS and power down camera, but only when not unplugged */ @@ -1193,182 +853,155 @@ static int pwc_video_close(struct file *file) return 0; } -/* - * FIXME: what about two parallel reads ???? - * ANSWER: Not supported. You can't open the device more than once, - despite what the V4L1 interface says. First, I don't see - the need, second there's no mechanism of alerting the - 2nd/3rd/... process of events like changing image size. - And I don't see the point of blocking that for the - 2nd/3rd/... process. - In multi-threaded environments reading parallel from any - device is tricky anyhow. - */ - static ssize_t pwc_video_read(struct file *file, char __user *buf, - size_t count, loff_t *ppos) + size_t count, loff_t *ppos) { struct video_device *vdev = file->private_data; - struct pwc_device *pdev; - int noblock = file->f_flags & O_NONBLOCK; - DECLARE_WAITQUEUE(wait, current); - int bytes_to_read, rv = 0; - void *image_buffer_addr; + struct pwc_device *pdev = video_get_drvdata(vdev); - PWC_DEBUG_READ("pwc_video_read(vdev=0x%p, buf=%p, count=%zd) called.\n", - vdev, buf, count); - pdev = video_get_drvdata(vdev); + if (pdev->error_status) + return -pdev->error_status; - if (pdev->error_status) { - rv = -pdev->error_status; /* Something happened, report what. */ - goto err_out; - } + return vb2_read(&pdev->vb_queue, buf, count, ppos, + file->f_flags & O_NONBLOCK); +} - /* Start the stream (if not already started) */ - rv = pwc_isoc_init(pdev); - if (rv) - goto err_out; - - /* In case we're doing partial reads, we don't have to wait for a frame */ - if (pdev->image_read_pos == 0) { - /* Do wait queueing according to the (doc)book */ - add_wait_queue(&pdev->frameq, &wait); - while (pdev->full_frames == NULL) { - /* Check for unplugged/etc. here */ - if (pdev->error_status) { - remove_wait_queue(&pdev->frameq, &wait); - set_current_state(TASK_RUNNING); - rv = -pdev->error_status ; - goto err_out; - } - if (noblock) { - remove_wait_queue(&pdev->frameq, &wait); - set_current_state(TASK_RUNNING); - rv = -EWOULDBLOCK; - goto err_out; - } - if (signal_pending(current)) { - remove_wait_queue(&pdev->frameq, &wait); - set_current_state(TASK_RUNNING); - rv = -ERESTARTSYS; - goto err_out; - } - mutex_unlock(&pdev->modlock); - schedule(); - set_current_state(TASK_INTERRUPTIBLE); - mutex_lock(&pdev->modlock); - } - remove_wait_queue(&pdev->frameq, &wait); - set_current_state(TASK_RUNNING); +static unsigned int pwc_video_poll(struct file *file, poll_table *wait) +{ + struct video_device *vdev = file->private_data; + struct pwc_device *pdev = video_get_drvdata(vdev); - /* Decompress and release frame */ - rv = pwc_handle_frame(pdev); - if (rv) - goto err_out; - } + if (pdev->error_status) + return POLL_ERR; - PWC_DEBUG_READ("Copying data to user space.\n"); - if (pdev->pixfmt != V4L2_PIX_FMT_YUV420) - bytes_to_read = pdev->frame_size + sizeof(struct pwc_raw_frame); - else - bytes_to_read = pdev->view.size; - - /* copy bytes to user space; we allow for partial reads */ - if (count + pdev->image_read_pos > bytes_to_read) - count = bytes_to_read - pdev->image_read_pos; - image_buffer_addr = pdev->image_data; - image_buffer_addr += pdev->images[pdev->fill_image].offset; - image_buffer_addr += pdev->image_read_pos; - if (copy_to_user(buf, image_buffer_addr, count)) { - rv = -EFAULT; - goto err_out; - } - pdev->image_read_pos += count; - if (pdev->image_read_pos >= bytes_to_read) { /* All data has been read */ - pdev->image_read_pos = 0; - pwc_next_image(pdev); - } - return count; -err_out: - return rv; + return vb2_poll(&pdev->vb_queue, file, wait); } -static unsigned int pwc_video_poll(struct file *file, poll_table *wait) +static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma) { struct video_device *vdev = file->private_data; - struct pwc_device *pdev; - int ret; + struct pwc_device *pdev = video_get_drvdata(vdev); - pdev = video_get_drvdata(vdev); + return vb2_mmap(&pdev->vb_queue, vma); +} - /* Start the stream (if not already started) */ - ret = pwc_isoc_init(pdev); - if (ret) - return ret; +/***************************************************************************/ +/* Videobuf2 operations */ + +static int queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, + unsigned int *nplanes, unsigned long sizes[], + void *alloc_ctxs[]) +{ + struct pwc_device *pdev = vb2_get_drv_priv(vq); - poll_wait(file, &pdev->frameq, wait); + if (*nbuffers < MIN_FRAMES) + *nbuffers = MIN_FRAMES; + else if (*nbuffers > MAX_FRAMES) + *nbuffers = MAX_FRAMES; + + *nplanes = 1; + + sizes[0] = PAGE_ALIGN((pdev->abs_max.x * pdev->abs_max.y * 3) / 2); + + return 0; +} + +static int buffer_init(struct vb2_buffer *vb) +{ + struct pwc_frame_buf *buf = container_of(vb, struct pwc_frame_buf, vb); + + /* need vmalloc since frame buffer > 128K */ + buf->data = vzalloc(PWC_FRAME_SIZE); + if (buf->data == NULL) + return -ENOMEM; + + return 0; +} + +static int buffer_prepare(struct vb2_buffer *vb) +{ + struct pwc_device *pdev = vb2_get_drv_priv(vb->vb2_queue); + + /* Don't allow queing new buffers after device disconnection */ if (pdev->error_status) - return POLLERR; - if (pdev->full_frames != NULL) /* we have frames waiting */ - return (POLLIN | POLLRDNORM); + return -pdev->error_status; return 0; } -static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma) +static int buffer_finish(struct vb2_buffer *vb) { - struct video_device *vdev = file->private_data; - struct pwc_device *pdev; - unsigned long start; - unsigned long size; - unsigned long page, pos = 0; - int index; + struct pwc_device *pdev = vb2_get_drv_priv(vb->vb2_queue); + struct pwc_frame_buf *buf = container_of(vb, struct pwc_frame_buf, vb); - PWC_DEBUG_MEMORY(">> %s\n", __func__); - pdev = video_get_drvdata(vdev); - size = vma->vm_end - vma->vm_start; - start = vma->vm_start; + /* + * Application has called dqbuf and is getting back a buffer we've + * filled, take the pwc data we've stored in buf->data and decompress + * it into a usable format, storing the result in the vb2_buffer + */ + return pwc_decompress(pdev, buf); +} + +static void buffer_cleanup(struct vb2_buffer *vb) +{ + struct pwc_frame_buf *buf = container_of(vb, struct pwc_frame_buf, vb); + + vfree(buf->data); +} + +static void buffer_queue(struct vb2_buffer *vb) +{ + struct pwc_device *pdev = vb2_get_drv_priv(vb->vb2_queue); + struct pwc_frame_buf *buf = container_of(vb, struct pwc_frame_buf, vb); + unsigned long flags = 0; + + spin_lock_irqsave(&pdev->queued_bufs_lock, flags); + list_add_tail(&buf->list, &pdev->queued_bufs); + spin_unlock_irqrestore(&pdev->queued_bufs_lock, flags); +} + +static int start_streaming(struct vb2_queue *vq) +{ + struct pwc_device *pdev = vb2_get_drv_priv(vq); + + return pwc_isoc_init(pdev); +} + +static int stop_streaming(struct vb2_queue *vq) +{ + struct pwc_device *pdev = vb2_get_drv_priv(vq); + + pwc_isoc_cleanup(pdev); + pwc_cleanup_queued_bufs(pdev); - /* Find the idx buffer for this mapping */ - for (index = 0; index < pwc_mbufs; index++) { - pos = pdev->images[index].offset; - if ((pos>>PAGE_SHIFT) == vma->vm_pgoff) - break; - } - if (index == MAX_IMAGES) - return -EINVAL; - if (index == 0) { - /* - * Special case for v4l1. In v4l1, we map only one big buffer, - * but in v4l2 each buffer is mapped - */ - unsigned long total_size; - total_size = pwc_mbufs * pdev->len_per_image; - if (size != pdev->len_per_image && size != total_size) { - PWC_ERROR("Wrong size (%lu) needed to be len_per_image=%d or total_size=%lu\n", - size, pdev->len_per_image, total_size); - return -EINVAL; - } - } else if (size > pdev->len_per_image) - return -EINVAL; - - vma->vm_flags |= VM_IO; /* from 2.6.9-acX */ - - pos += (unsigned long)pdev->image_data; - while (size > 0) { - page = vmalloc_to_pfn((void *)pos); - if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) - return -EAGAIN; - start += PAGE_SIZE; - pos += PAGE_SIZE; - if (size > PAGE_SIZE) - size -= PAGE_SIZE; - else - size = 0; - } return 0; } +static void pwc_lock(struct vb2_queue *vq) +{ + struct pwc_device *pdev = vb2_get_drv_priv(vq); + mutex_lock(&pdev->modlock); +} + +static void pwc_unlock(struct vb2_queue *vq) +{ + struct pwc_device *pdev = vb2_get_drv_priv(vq); + mutex_unlock(&pdev->modlock); +} + +static struct vb2_ops pwc_vb_queue_ops = { + .queue_setup = queue_setup, + .buf_init = buffer_init, + .buf_prepare = buffer_prepare, + .buf_finish = buffer_finish, + .buf_cleanup = buffer_cleanup, + .buf_queue = buffer_queue, + .start_streaming = start_streaming, + .stop_streaming = stop_streaming, + .wait_prepare = pwc_unlock, + .wait_finish = pwc_lock, +}; + /***************************************************************************/ /* USB functions */ @@ -1648,12 +1281,22 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id } mutex_init(&pdev->modlock); - spin_lock_init(&pdev->ptrlock); + spin_lock_init(&pdev->queued_bufs_lock); + INIT_LIST_HEAD(&pdev->queued_bufs); pdev->udev = udev; - init_waitqueue_head(&pdev->frameq); pdev->vcompression = pwc_preferred_compression; + /* Init videobuf2 queue structure */ + memset(&pdev->vb_queue, 0, sizeof(pdev->vb_queue)); + pdev->vb_queue.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + pdev->vb_queue.io_modes = VB2_MMAP | VB2_USERPTR | VB2_READ; + pdev->vb_queue.drv_priv = pdev; + pdev->vb_queue.buf_struct_size = sizeof(struct pwc_frame_buf); + pdev->vb_queue.ops = &pwc_vb_queue_ops; + pdev->vb_queue.mem_ops = &vb2_vmalloc_memops; + vb2_queue_init(&pdev->vb_queue); + /* Init video_device structure */ memcpy(&pdev->vdev, &pwc_template, sizeof(pwc_template)); pdev->vdev.parent = &intf->dev; @@ -1752,11 +1395,9 @@ static void usb_pwc_disconnect(struct usb_interface *intf) pdev->error_status = EPIPE; pdev->unplugged = 1; - /* Alert waiting processes */ - wake_up_interruptible(&pdev->frameq); - /* No need to keep the urbs around after disconnection */ pwc_isoc_cleanup(pdev); + pwc_cleanup_queued_bufs(pdev); mutex_unlock(&pdev->modlock); @@ -1776,8 +1417,6 @@ static void usb_pwc_disconnect(struct usb_interface *intf) static char *size; static int fps; -static int fbufs; -static int mbufs; static int compression = -1; static int leds[2] = { -1, -1 }; static unsigned int leds_nargs; @@ -1786,8 +1425,6 @@ static unsigned int dev_hint_nargs; module_param(size, charp, 0444); module_param(fps, int, 0444); -module_param(fbufs, int, 0444); -module_param(mbufs, int, 0444); #ifdef CONFIG_USB_PWC_DEBUG module_param_named(trace, pwc_trace, int, 0644); #endif @@ -1798,8 +1435,6 @@ module_param_array(dev_hint, charp, &dev_hint_nargs, 0444); MODULE_PARM_DESC(size, "Initial image size. One of sqcif, qsif, qcif, sif, cif, vga"); MODULE_PARM_DESC(fps, "Initial frames per second. Varies with model, useful range 5-30"); -MODULE_PARM_DESC(fbufs, "Number of internal frame buffers to reserve"); -MODULE_PARM_DESC(mbufs, "Number of external (mmap()ed) image buffers"); #ifdef CONFIG_USB_PWC_DEBUG MODULE_PARM_DESC(trace, "For debugging purposes"); #endif @@ -1847,22 +1482,6 @@ static int __init usb_pwc_init(void) } PWC_DEBUG_MODULE("Default image size set to %s [%dx%d].\n", sizenames[default_size], pwc_image_sizes[default_size].x, pwc_image_sizes[default_size].y); } - if (mbufs) { - if (mbufs < 1 || mbufs > MAX_IMAGES) { - PWC_ERROR("Illegal number of mmap() buffers; use a number between 1 and %d.\n", MAX_IMAGES); - return -EINVAL; - } - pwc_mbufs = mbufs; - PWC_DEBUG_MODULE("Number of image buffers set to %d.\n", pwc_mbufs); - } - if (fbufs) { - if (fbufs < 2 || fbufs > MAX_FRAMES) { - PWC_ERROR("Illegal number of frame buffers; use a number between 2 and %d.\n", MAX_FRAMES); - return -EINVAL; - } - default_fbufs = fbufs; - PWC_DEBUG_MODULE("Number of frame buffers set to %d.\n", default_fbufs); - } #ifdef CONFIG_USB_PWC_DEBUG if (pwc_trace >= 0) { PWC_DEBUG_MODULE("Trace options: 0x%04x\n", pwc_trace); diff --git a/drivers/media/video/pwc/pwc-misc.c b/drivers/media/video/pwc/pwc-misc.c index 6af5bb538358..0b031336eab8 100644 --- a/drivers/media/video/pwc/pwc-misc.c +++ b/drivers/media/video/pwc/pwc-misc.c @@ -126,8 +126,4 @@ void pwc_construct(struct pwc_device *pdev) pdev->pixfmt = V4L2_PIX_FMT_YUV420; /* default */ pdev->view_min.size = pdev->view_min.x * pdev->view_min.y; pdev->view_max.size = pdev->view_max.x * pdev->view_max.y; - /* length of image, in YUV format; always allocate enough memory. */ - pdev->len_per_image = PAGE_ALIGN((pdev->abs_max.x * pdev->abs_max.y * 3) / 2); } - - diff --git a/drivers/media/video/pwc/pwc-uncompress.c b/drivers/media/video/pwc/pwc-uncompress.c index 4118184951ee..d110e38c4de0 100644 --- a/drivers/media/video/pwc/pwc-uncompress.c +++ b/drivers/media/video/pwc/pwc-uncompress.c @@ -34,17 +34,14 @@ #include "pwc-dec1.h" #include "pwc-dec23.h" -int pwc_decompress(struct pwc_device *pdev) +int pwc_decompress(struct pwc_device *pdev, struct pwc_frame_buf *fbuf) { - struct pwc_frame_buf *fbuf; int n, line, col, stride; void *yuv, *image; u16 *src; u16 *dsty, *dstu, *dstv; - fbuf = pdev->read_frame; - image = pdev->image_data; - image += pdev->images[pdev->fill_image].offset; + image = vb2_plane_vaddr(&fbuf->vb, 0); yuv = fbuf->data + pdev->frame_header_size; /* Skip header */ @@ -59,9 +56,13 @@ int pwc_decompress(struct pwc_device *pdev) * determine this using the type of the webcam */ memcpy(raw_frame->cmd, pdev->cmd_buf, 4); memcpy(raw_frame+1, yuv, pdev->frame_size); + vb2_set_plane_payload(&fbuf->vb, 0, + pdev->frame_size + sizeof(struct pwc_raw_frame)); return 0; } + vb2_set_plane_payload(&fbuf->vb, 0, pdev->view.size); + if (pdev->vbandlength == 0) { /* Uncompressed mode. * We copy the data into the output buffer, using the viewport diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c index 8e72e0f56550..cda38837adcd 100644 --- a/drivers/media/video/pwc/pwc-v4l.c +++ b/drivers/media/video/pwc/pwc-v4l.c @@ -309,7 +309,7 @@ static int pwc_vidioc_set_fmt(struct pwc_device *pdev, struct v4l2_format *f) pixelformat != V4L2_PIX_FMT_PWC2) return -EINVAL; - if (pdev->iso_init) + if (vb2_is_streaming(&pdev->vb_queue)) return -EBUSY; PWC_DEBUG_IOCTL("Trying to set format to: width=%d height=%d fps=%d " @@ -673,150 +673,47 @@ static int pwc_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f) return pwc_vidioc_set_fmt(pdev, f); } -static int pwc_reqbufs(struct file *file, void *fh, struct v4l2_requestbuffers *rb) +static int pwc_reqbufs(struct file *file, void *fh, + struct v4l2_requestbuffers *rb) { - int nbuffers; - - PWC_DEBUG_IOCTL("ioctl(VIDIOC_REQBUFS) count=%d\n", rb->count); - if (rb->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) - return -EINVAL; - if (rb->memory != V4L2_MEMORY_MMAP) - return -EINVAL; + struct pwc_device *pdev = video_drvdata(file); - nbuffers = rb->count; - if (nbuffers < 2) - nbuffers = 2; - else if (nbuffers > pwc_mbufs) - nbuffers = pwc_mbufs; - /* Force to use our # of buffers */ - rb->count = pwc_mbufs; - return 0; + return vb2_reqbufs(&pdev->vb_queue, rb); } static int pwc_querybuf(struct file *file, void *fh, struct v4l2_buffer *buf) { struct pwc_device *pdev = video_drvdata(file); - int index; - PWC_DEBUG_IOCTL("ioctl(VIDIOC_QUERYBUF) index=%d\n", buf->index); - if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { - PWC_DEBUG_IOCTL("ioctl(VIDIOC_QUERYBUF) Bad type\n"); - return -EINVAL; - } - index = buf->index; - if (index < 0 || index >= pwc_mbufs) { - PWC_DEBUG_IOCTL("ioctl(VIDIOC_QUERYBUF) Bad index %d\n", buf->index); - return -EINVAL; - } - - buf->m.offset = index * pdev->len_per_image; - if (pdev->pixfmt != V4L2_PIX_FMT_YUV420) - buf->bytesused = pdev->frame_size + sizeof(struct pwc_raw_frame); - else - buf->bytesused = pdev->view.size; - buf->field = V4L2_FIELD_NONE; - buf->memory = V4L2_MEMORY_MMAP; - /*buf->flags = V4L2_BUF_FLAG_MAPPED;*/ - buf->length = pdev->len_per_image; - - PWC_DEBUG_READ("VIDIOC_QUERYBUF: index=%d\n", buf->index); - PWC_DEBUG_READ("VIDIOC_QUERYBUF: m.offset=%d\n", buf->m.offset); - PWC_DEBUG_READ("VIDIOC_QUERYBUF: bytesused=%d\n", buf->bytesused); - - return 0; + return vb2_querybuf(&pdev->vb_queue, buf); } static int pwc_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf) { - PWC_DEBUG_IOCTL("ioctl(VIDIOC_QBUF) index=%d\n", buf->index); - if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) - return -EINVAL; - if (buf->memory != V4L2_MEMORY_MMAP) - return -EINVAL; - if (buf->index >= pwc_mbufs) - return -EINVAL; - - buf->flags |= V4L2_BUF_FLAG_QUEUED; - buf->flags &= ~V4L2_BUF_FLAG_DONE; + struct pwc_device *pdev = video_drvdata(file); - return 0; + return vb2_qbuf(&pdev->vb_queue, buf); } static int pwc_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf) { - DECLARE_WAITQUEUE(wait, current); struct pwc_device *pdev = video_drvdata(file); - int ret; - - PWC_DEBUG_IOCTL("ioctl(VIDIOC_DQBUF)\n"); - - if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) - return -EINVAL; - - add_wait_queue(&pdev->frameq, &wait); - while (pdev->full_frames == NULL) { - if (pdev->error_status) { - remove_wait_queue(&pdev->frameq, &wait); - set_current_state(TASK_RUNNING); - return -pdev->error_status; - } - - if (signal_pending(current)) { - remove_wait_queue(&pdev->frameq, &wait); - set_current_state(TASK_RUNNING); - return -ERESTARTSYS; - } - mutex_unlock(&pdev->modlock); - schedule(); - set_current_state(TASK_INTERRUPTIBLE); - mutex_lock(&pdev->modlock); - } - remove_wait_queue(&pdev->frameq, &wait); - set_current_state(TASK_RUNNING); - - PWC_DEBUG_IOCTL("VIDIOC_DQBUF: frame ready.\n"); - /* Decompress data in pdev->images[pdev->fill_image] */ - ret = pwc_handle_frame(pdev); - if (ret) - return ret; - PWC_DEBUG_IOCTL("VIDIOC_DQBUF: after pwc_handle_frame\n"); - - buf->index = pdev->fill_image; - if (pdev->pixfmt != V4L2_PIX_FMT_YUV420) - buf->bytesused = pdev->frame_size + sizeof(struct pwc_raw_frame); - else - buf->bytesused = pdev->view.size; - buf->flags = V4L2_BUF_FLAG_MAPPED; - buf->field = V4L2_FIELD_NONE; - do_gettimeofday(&buf->timestamp); - buf->sequence = 0; - buf->memory = V4L2_MEMORY_MMAP; - buf->m.offset = pdev->fill_image * pdev->len_per_image; - buf->length = pdev->len_per_image; - pwc_next_image(pdev); - - PWC_DEBUG_IOCTL("VIDIOC_DQBUF: buf->index=%d\n", buf->index); - PWC_DEBUG_IOCTL("VIDIOC_DQBUF: buf->length=%d\n", buf->length); - PWC_DEBUG_IOCTL("VIDIOC_DQBUF: m.offset=%d\n", buf->m.offset); - PWC_DEBUG_IOCTL("VIDIOC_DQBUF: bytesused=%d\n", buf->bytesused); - PWC_DEBUG_IOCTL("VIDIOC_DQBUF: leaving\n"); - return 0; + return vb2_dqbuf(&pdev->vb_queue, buf, file->f_flags & O_NONBLOCK); } static int pwc_streamon(struct file *file, void *fh, enum v4l2_buf_type i) { struct pwc_device *pdev = video_drvdata(file); - return pwc_isoc_init(pdev); + return vb2_streamon(&pdev->vb_queue, i); } static int pwc_streamoff(struct file *file, void *fh, enum v4l2_buf_type i) { struct pwc_device *pdev = video_drvdata(file); - pwc_isoc_cleanup(pdev); - return 0; + return vb2_streamoff(&pdev->vb_queue, i); } static int pwc_enum_framesizes(struct file *file, void *fh, diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h index 421e75b69f29..ae92fe211f6d 100644 --- a/drivers/media/video/pwc/pwc.h +++ b/drivers/media/video/pwc/pwc.h @@ -36,6 +36,7 @@ #include #include #include +#include #ifdef CONFIG_USB_PWC_INPUT_EVDEV #include #endif @@ -112,18 +113,17 @@ #define FRAME_LOWMARK 5 /* Size and number of buffers for the ISO pipe. */ -#define MAX_ISO_BUFS 2 +#define MAX_ISO_BUFS 3 #define ISO_FRAMES_PER_DESC 10 #define ISO_MAX_FRAME_SIZE 960 #define ISO_BUFFER_SIZE (ISO_FRAMES_PER_DESC * ISO_MAX_FRAME_SIZE) -/* Frame buffers: contains compressed or uncompressed video data. */ -#define MAX_FRAMES 5 /* Maximum size after decompression is 640x480 YUV data, 1.5 * 640 * 480 */ #define PWC_FRAME_SIZE (460800 + TOUCAM_HEADER_SIZE + TOUCAM_TRAILER_SIZE) -/* Absolute maximum number of buffers available for mmap() */ -#define MAX_IMAGES 10 +/* Absolute minimum and maximum number of buffers available for mmap() */ +#define MIN_FRAMES 2 +#define MAX_FRAMES 16 /* Some macros to quickly find the type of a webcam */ #define DEVICE_USE_CODEC1(x) ((x)<675) @@ -143,16 +143,10 @@ struct pwc_iso_buf /* intermediate buffers with raw data from the USB cam */ struct pwc_frame_buf { - void *data; - volatile int filled; /* number of bytes filled */ - struct pwc_frame_buf *next; /* list */ -}; - -/* additionnal informations used when dealing image between kernel and userland */ -struct pwc_imgbuf -{ - unsigned long offset; /* offset of this buffer in the big array of image_data */ - int vma_use_count; /* count the number of time this memory is mapped */ + struct vb2_buffer vb; /* common v4l buffer stuff -- must be first */ + struct list_head list; + void *data; + int filled; /* number of bytes filled */ }; struct pwc_device @@ -177,8 +171,6 @@ struct pwc_device int vframes, vsize; /* frames-per-second & size (see PSZ_*) */ int pixfmt; /* pixelformat: V4L2_PIX_FMT_YUV420 or raw: _PWC1, _PWC2 */ int vframe_count; /* received frames */ - int vframes_dumped; /* counter for dumped frames */ - int vframes_error; /* frames received in error */ int vmax_packet_size; /* USB maxpacket size */ int vlast_packet_size; /* for frame synchronisation */ int visoc_errors; /* number of contiguous ISOC errors */ @@ -192,35 +184,29 @@ struct pwc_device int cmd_len; unsigned char cmd_buf[13]; - /* The image acquisition requires 3 to 4 steps: - 1. data is gathered in short packets from the USB controller - 2. data is synchronized and packed into a frame buffer - 3a. in case data is compressed, decompress it directly into image buffer - 3b. in case data is uncompressed, copy into image buffer with viewport - 4. data is transferred to the user process - - Note that MAX_ISO_BUFS != MAX_FRAMES != MAX_IMAGES.... - We have in effect a back-to-back-double-buffer system. - */ - /* 1: isoc */ struct pwc_iso_buf sbuf[MAX_ISO_BUFS]; char iso_init; - /* 2: frame */ - struct pwc_frame_buf *fbuf; /* all frames */ - struct pwc_frame_buf *empty_frames, *empty_frames_tail; /* all empty frames */ - struct pwc_frame_buf *full_frames, *full_frames_tail; /* all filled frames */ - struct pwc_frame_buf *fill_frame; /* frame currently being filled */ - struct pwc_frame_buf *read_frame; /* frame currently read by user process */ + /* videobuf2 queue and queued buffers list */ + struct vb2_queue vb_queue; + struct list_head queued_bufs; + spinlock_t queued_bufs_lock; + + /* + * Frame currently being filled, this only gets touched by the + * isoc urb complete handler, and by stream start / stop since + * start / stop touch it before / after starting / killing the urbs + * no locking is needed around this + */ + struct pwc_frame_buf *fill_buf; + int frame_header_size, frame_trailer_size; int frame_size; int frame_total_size; /* including header & trailer */ int drop_frames; - /* 3: decompression */ void *decompress_data; /* private data for decompression engine */ - /* 4: image */ /* We have an 'image' and a 'view', where 'image' is the fixed-size image as delivered by the camera, and 'view' is the size requested by the program. The camera image is centered in this viewport, laced with @@ -232,15 +218,7 @@ struct pwc_device struct pwc_coord image, view; /* image and viewport size */ struct pwc_coord offset; /* offset within the viewport */ - void *image_data; /* total buffer, which is subdivided into ... */ - struct pwc_imgbuf images[MAX_IMAGES];/* ...several images... */ - int fill_image; /* ...which are rotated. */ - int len_per_image; /* length per image */ - int image_read_pos; /* In case we read data in pieces, keep track of were we are in the imagebuffer */ - int image_used[MAX_IMAGES]; /* For MCAPTURE and SYNC */ - struct mutex modlock; /* to prevent races in video_open(), etc */ - spinlock_t ptrlock; /* for manipulating the buffer pointers */ /*** motorized pan/tilt feature */ struct pwc_mpt_range angle_range; @@ -253,7 +231,6 @@ struct pwc_device #endif /*** Misc. data ***/ - wait_queue_head_t frameq; /* When waiting for a frame to finish... */ #if PWC_INT_PIPE void *usb_int_handler; /* for the interrupt endpoint */ #endif @@ -263,13 +240,6 @@ struct pwc_device #ifdef CONFIG_USB_PWC_DEBUG extern int pwc_trace; #endif -extern int pwc_mbufs; - -/** functions in pwc-if.c */ -int pwc_handle_frame(struct pwc_device *pdev); -void pwc_next_image(struct pwc_device *pdev); -int pwc_isoc_init(struct pwc_device *pdev); -void pwc_isoc_cleanup(struct pwc_device *pdev); /** Functions in pwc-misc.c */ /* sizes in pixels */ @@ -334,6 +304,6 @@ extern const struct v4l2_ioctl_ops pwc_ioctl_ops; /** pwc-uncompress.c */ /* Expand frame to image, possibly including decompression. Uses read_frame and fill_image */ -extern int pwc_decompress(struct pwc_device *pdev); +int pwc_decompress(struct pwc_device *pdev, struct pwc_frame_buf *fbuf); #endif -- cgit v1.2.3 From 1a4ede65f30315a31cb9b239bec0d4bb32834691 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sat, 25 Jun 2011 17:10:51 -0300 Subject: [media] pwc: Fix non CodingStyle compliant 3 space indent in pwc.h Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pwc/pwc.h | 131 ++++++++++++++++++++++-------------------- 1 file changed, 68 insertions(+), 63 deletions(-) diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h index ae92fe211f6d..cfe82319f343 100644 --- a/drivers/media/video/pwc/pwc.h +++ b/drivers/media/video/pwc/pwc.h @@ -77,9 +77,9 @@ #define PWC_DEBUG_LEVEL (PWC_DEBUG_LEVEL_MODULE) #define PWC_DEBUG(level, fmt, args...) do {\ - if ((PWC_DEBUG_LEVEL_ ##level) & pwc_trace) \ - printk(KERN_DEBUG PFX fmt, ##args); \ - } while(0) + if ((PWC_DEBUG_LEVEL_ ##level) & pwc_trace) \ + printk(KERN_DEBUG PFX fmt, ##args); \ + } while (0) #define PWC_ERROR(fmt, args...) printk(KERN_ERR PFX fmt, ##args) #define PWC_WARNING(fmt, args...) printk(KERN_WARNING PFX fmt, ##args) @@ -152,40 +152,41 @@ struct pwc_frame_buf struct pwc_device { struct video_device vdev; - - /* Pointer to our usb_device, may be NULL after unplug */ - struct usb_device *udev; - - int type; /* type of cam (645, 646, 675, 680, 690, 720, 730, 740, 750) */ - int release; /* release number */ - int features; /* feature bits */ - char serial[30]; /* serial number (string) */ - int error_status; /* set when something goes wrong with the cam (unplugged, USB errors) */ - int usb_init; /* set when the cam has been initialized over USB */ - - /*** Video data ***/ - int vopen; /* flag */ - int vendpoint; /* video isoc endpoint */ - int vcinterface; /* video control interface */ - int valternate; /* alternate interface needed */ - int vframes, vsize; /* frames-per-second & size (see PSZ_*) */ - int pixfmt; /* pixelformat: V4L2_PIX_FMT_YUV420 or raw: _PWC1, _PWC2 */ - int vframe_count; /* received frames */ - int vmax_packet_size; /* USB maxpacket size */ - int vlast_packet_size; /* for frame synchronisation */ - int visoc_errors; /* number of contiguous ISOC errors */ - int vcompression; /* desired compression factor */ - int vbandlength; /* compressed band length; 0 is uncompressed */ - char vsnapshot; /* snapshot mode */ - char vsync; /* used by isoc handler */ - char vmirror; /* for ToUCaM series */ + struct mutex modlock; + + /* Pointer to our usb_device, may be NULL after unplug */ + struct usb_device *udev; + /* type of cam (645, 646, 675, 680, 690, 720, 730, 740, 750) */ + int type; + int release; /* release number */ + int features; /* feature bits */ + char serial[30]; /* serial number (string) */ + int error_status; /* set when something goes wrong */ + int usb_init; /* set when the cam has been initialized */ + + /*** Video data ***/ + int vopen; /* flag */ + int vendpoint; /* video isoc endpoint */ + int vcinterface; /* video control interface */ + int valternate; /* alternate interface needed */ + int vframes, vsize; /* frames-per-second & size (see PSZ_*) */ + int pixfmt; /* pixelformat: V4L2_PIX_FMT_YUV420 or _PWCX */ + int vframe_count; /* received frames */ + int vmax_packet_size; /* USB maxpacket size */ + int vlast_packet_size; /* for frame synchronisation */ + int visoc_errors; /* number of contiguous ISOC errors */ + int vcompression; /* desired compression factor */ + int vbandlength; /* compressed band length; 0 is uncompressed */ + char vsnapshot; /* snapshot mode */ + char vsync; /* used by isoc handler */ + char vmirror; /* for ToUCaM series */ char unplugged; - int cmd_len; - unsigned char cmd_buf[13]; + int cmd_len; + unsigned char cmd_buf[13]; - struct pwc_iso_buf sbuf[MAX_ISO_BUFS]; - char iso_init; + struct pwc_iso_buf sbuf[MAX_ISO_BUFS]; + char iso_init; /* videobuf2 queue and queued buffers list */ struct vb2_queue vb_queue; @@ -200,39 +201,43 @@ struct pwc_device */ struct pwc_frame_buf *fill_buf; - int frame_header_size, frame_trailer_size; - int frame_size; - int frame_total_size; /* including header & trailer */ - int drop_frames; - - void *decompress_data; /* private data for decompression engine */ - - /* We have an 'image' and a 'view', where 'image' is the fixed-size image - as delivered by the camera, and 'view' is the size requested by the - program. The camera image is centered in this viewport, laced with - a gray or black border. view_min <= image <= view <= view_max; - */ - int image_mask; /* bitmask of supported sizes */ - struct pwc_coord view_min, view_max; /* minimum and maximum viewable sizes */ - struct pwc_coord abs_max; /* maximum supported size with compression */ - struct pwc_coord image, view; /* image and viewport size */ - struct pwc_coord offset; /* offset within the viewport */ - - struct mutex modlock; /* to prevent races in video_open(), etc */ - - /*** motorized pan/tilt feature */ - struct pwc_mpt_range angle_range; - int pan_angle; /* in degrees * 100 */ - int tilt_angle; /* absolute angle; 0,0 is home position */ - int snapshot_button_status; /* set to 1 when the user push the button, reset to 0 when this value is read */ + int frame_header_size, frame_trailer_size; + int frame_size; + int frame_total_size; /* including header & trailer */ + int drop_frames; + + void *decompress_data; /* private data for decompression engine */ + + /* + * We have an 'image' and a 'view', where 'image' is the fixed-size img + * as delivered by the camera, and 'view' is the size requested by the + * program. The camera image is centered in this viewport, laced with + * a gray or black border. view_min <= image <= view <= view_max; + */ + int image_mask; /* supported sizes */ + struct pwc_coord view_min, view_max; /* minimum and maximum view */ + struct pwc_coord abs_max; /* maximum supported size */ + struct pwc_coord image, view; /* image and viewport size */ + struct pwc_coord offset; /* offset of the viewport */ + + /*** motorized pan/tilt feature */ + struct pwc_mpt_range angle_range; + int pan_angle; /* in degrees * 100 */ + int tilt_angle; /* absolute angle; 0,0 is home */ + + /* + * Set to 1 when the user push the button, reset to 0 + * when this value is read from sysfs. + */ + int snapshot_button_status; #ifdef CONFIG_USB_PWC_INPUT_EVDEV - struct input_dev *button_dev; /* webcam snapshot button input */ - char button_phys[64]; + struct input_dev *button_dev; /* webcam snapshot button input */ + char button_phys[64]; #endif - /*** Misc. data ***/ + /*** Misc. data ***/ #if PWC_INT_PIPE - void *usb_int_handler; /* for the interrupt endpoint */ + void *usb_int_handler; /* for the interrupt endpoint */ #endif }; -- cgit v1.2.3 From b824bb4b12548fedd622686d443310d574eb084e Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sat, 25 Jun 2011 17:39:19 -0300 Subject: [media] pwc: Get rid of error_status and unplugged variables Having 2 ways of tracking disconnection is too much, remove both and instead simply set pdev->udev to NULL on disconnect. Also check for pdev->udev being NULL in all possible entry paths. Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pwc/pwc-if.c | 38 +++++++++++++++++--------------------- drivers/media/video/pwc/pwc-v4l.c | 24 ++++++++++++++++++++++++ drivers/media/video/pwc/pwc.h | 2 -- 3 files changed, 41 insertions(+), 23 deletions(-) diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index 907db23fdb5d..6bff33b357b9 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c @@ -570,14 +570,7 @@ static void pwc_isoc_cleanup(struct pwc_device *pdev) pwc_iso_stop(pdev); pwc_iso_free(pdev); - - /* Stop camera, but only if we are sure the camera is still there (unplug - is signalled by EPIPE) - */ - if (pdev->error_status != EPIPE) { - PWC_DEBUG_OPEN("Setting alternate interface 0.\n"); - usb_set_interface(pdev->udev, 0, 0); - } + usb_set_interface(pdev->udev, 0, 0); pdev->iso_init = 0; PWC_DEBUG_OPEN("<< pwc_isoc_cleanup()\n"); @@ -719,6 +712,9 @@ static int pwc_video_open(struct file *file) PWC_DEBUG_OPEN(">> video_open called(vdev = 0x%p).\n", vdev); pdev = video_get_drvdata(vdev); + if (!pdev->udev) + return -ENODEV; + if (pdev->vopen) { PWC_DEBUG_OPEN("I'm busy, someone is using the device.\n"); return -EBUSY; @@ -760,7 +756,6 @@ static int pwc_video_open(struct file *file) /* Reset buffers & parameters */ pdev->visoc_errors = 0; - pdev->error_status = 0; pwc_construct(pdev); /* set min/max sizes correct */ /* Set some defaults */ @@ -837,7 +832,7 @@ static int pwc_video_close(struct file *file) pwc_free_buffers(pdev); /* Turn off LEDS and power down camera, but only when not unplugged */ - if (!pdev->unplugged) { + if (pdev->udev) { /* Turn LEDs off */ if (pwc_set_leds(pdev, 0, 0) < 0) PWC_DEBUG_MODULE("Failed to set LED on/off time.\n"); @@ -859,8 +854,8 @@ static ssize_t pwc_video_read(struct file *file, char __user *buf, struct video_device *vdev = file->private_data; struct pwc_device *pdev = video_get_drvdata(vdev); - if (pdev->error_status) - return -pdev->error_status; + if (!pdev->udev) + return -ENODEV; return vb2_read(&pdev->vb_queue, buf, count, ppos, file->f_flags & O_NONBLOCK); @@ -871,7 +866,7 @@ static unsigned int pwc_video_poll(struct file *file, poll_table *wait) struct video_device *vdev = file->private_data; struct pwc_device *pdev = video_get_drvdata(vdev); - if (pdev->error_status) + if (!pdev->udev) return POLL_ERR; return vb2_poll(&pdev->vb_queue, file, wait); @@ -923,8 +918,8 @@ static int buffer_prepare(struct vb2_buffer *vb) struct pwc_device *pdev = vb2_get_drv_priv(vb->vb2_queue); /* Don't allow queing new buffers after device disconnection */ - if (pdev->error_status) - return -pdev->error_status; + if (!pdev->udev) + return -ENODEV; return 0; } @@ -964,6 +959,9 @@ static int start_streaming(struct vb2_queue *vq) { struct pwc_device *pdev = vb2_get_drv_priv(vq); + if (!pdev->udev) + return -ENODEV; + return pwc_isoc_init(pdev); } @@ -971,7 +969,8 @@ static int stop_streaming(struct vb2_queue *vq) { struct pwc_device *pdev = vb2_get_drv_priv(vq); - pwc_isoc_cleanup(pdev); + if (pdev->udev) + pwc_isoc_cleanup(pdev); pwc_cleanup_queued_bufs(pdev); return 0; @@ -1389,15 +1388,12 @@ static void usb_pwc_disconnect(struct usb_interface *intf) struct pwc_device *pdev = usb_get_intfdata(intf); mutex_lock(&pdev->modlock); - usb_set_intfdata (intf, NULL); - - /* We got unplugged; this is signalled by an EPIPE error code */ - pdev->error_status = EPIPE; - pdev->unplugged = 1; + usb_set_intfdata(intf, NULL); /* No need to keep the urbs around after disconnection */ pwc_isoc_cleanup(pdev); pwc_cleanup_queued_bufs(pdev); + pdev->udev = NULL; mutex_unlock(&pdev->modlock); diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c index cda38837adcd..8bd0a681990d 100644 --- a/drivers/media/video/pwc/pwc-v4l.c +++ b/drivers/media/video/pwc/pwc-v4l.c @@ -288,6 +288,9 @@ static int pwc_vidioc_set_fmt(struct pwc_device *pdev, struct v4l2_format *f) { int ret, fps, snapshot, compression, pixelformat; + if (!pdev->udev) + return -ENODEV; + ret = pwc_vidioc_try_fmt(pdev, f); if (ret<0) return ret; @@ -346,6 +349,9 @@ static int pwc_querycap(struct file *file, void *fh, struct v4l2_capability *cap struct video_device *vdev = video_devdata(file); struct pwc_device *pdev = video_drvdata(file); + if (!pdev->udev) + return -ENODEV; + strcpy(cap->driver, PWC_NAME); strlcpy(cap->card, vdev->name, sizeof(cap->card)); usb_make_path(pdev->udev, cap->bus_info, sizeof(cap->bus_info)); @@ -414,6 +420,9 @@ static int pwc_g_ctrl(struct file *file, void *fh, struct v4l2_control *c) struct pwc_device *pdev = video_drvdata(file); int ret; + if (!pdev->udev) + return -ENODEV; + switch (c->id) { case V4L2_CID_BRIGHTNESS: c->value = pwc_get_brightness(pdev); @@ -517,6 +526,9 @@ static int pwc_s_ctrl(struct file *file, void *fh, struct v4l2_control *c) struct pwc_device *pdev = video_drvdata(file); int ret; + if (!pdev->udev) + return -ENODEV; + switch (c->id) { case V4L2_CID_BRIGHTNESS: c->value <<= 9; @@ -692,6 +704,9 @@ static int pwc_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf) { struct pwc_device *pdev = video_drvdata(file); + if (!pdev->udev) + return -ENODEV; + return vb2_qbuf(&pdev->vb_queue, buf); } @@ -699,6 +714,9 @@ static int pwc_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf) { struct pwc_device *pdev = video_drvdata(file); + if (!pdev->udev) + return -ENODEV; + return vb2_dqbuf(&pdev->vb_queue, buf, file->f_flags & O_NONBLOCK); } @@ -706,6 +724,9 @@ static int pwc_streamon(struct file *file, void *fh, enum v4l2_buf_type i) { struct pwc_device *pdev = video_drvdata(file); + if (!pdev->udev) + return -ENODEV; + return vb2_streamon(&pdev->vb_queue, i); } @@ -713,6 +734,9 @@ static int pwc_streamoff(struct file *file, void *fh, enum v4l2_buf_type i) { struct pwc_device *pdev = video_drvdata(file); + if (!pdev->udev) + return -ENODEV; + return vb2_streamoff(&pdev->vb_queue, i); } diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h index cfe82319f343..13b85246a261 100644 --- a/drivers/media/video/pwc/pwc.h +++ b/drivers/media/video/pwc/pwc.h @@ -161,7 +161,6 @@ struct pwc_device int release; /* release number */ int features; /* feature bits */ char serial[30]; /* serial number (string) */ - int error_status; /* set when something goes wrong */ int usb_init; /* set when the cam has been initialized */ /*** Video data ***/ @@ -180,7 +179,6 @@ struct pwc_device char vsnapshot; /* snapshot mode */ char vsync; /* used by isoc handler */ char vmirror; /* for ToUCaM series */ - char unplugged; int cmd_len; unsigned char cmd_buf[13]; -- cgit v1.2.3 From 52a92547508e7bb62b6325cd2954412a7ab01249 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sat, 25 Jun 2011 17:42:55 -0300 Subject: [media] pwc: Remove some unused PWC_INT_PIPE left overs Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pwc/pwc.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h index 13b85246a261..f4aa386477c8 100644 --- a/drivers/media/video/pwc/pwc.h +++ b/drivers/media/video/pwc/pwc.h @@ -106,9 +106,6 @@ #define FEATURE_CODEC1 0x0002 #define FEATURE_CODEC2 0x0004 -/* Turn certain features on/off */ -#define PWC_INT_PIPE 0 - /* Ignore errors in the first N frames, to allow for startup delays */ #define FRAME_LOWMARK 5 @@ -232,11 +229,6 @@ struct pwc_device struct input_dev *button_dev; /* webcam snapshot button input */ char button_phys[64]; #endif - - /*** Misc. data ***/ -#if PWC_INT_PIPE - void *usb_int_handler; /* for the interrupt endpoint */ -#endif }; /* Global variables */ -- cgit v1.2.3 From 3b4d0ec79113e77b3fe90749ae00bfa015c73048 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 26 Jun 2011 03:51:19 -0300 Subject: [media] pwc: Make power-saving a per device option as vcinterface must be set before calling pwc_camera_power() Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pwc/pwc-ctrl.c | 26 +++++++++++++++-------- drivers/media/video/pwc/pwc-if.c | 43 ++++++++++++++------------------------ drivers/media/video/pwc/pwc.h | 3 ++- 3 files changed, 35 insertions(+), 37 deletions(-) diff --git a/drivers/media/video/pwc/pwc-ctrl.c b/drivers/media/video/pwc/pwc-ctrl.c index 19221cbca8c3..69a1c6f37956 100644 --- a/drivers/media/video/pwc/pwc-ctrl.c +++ b/drivers/media/video/pwc/pwc-ctrl.c @@ -782,29 +782,32 @@ int pwc_get_shutter_speed(struct pwc_device *pdev, int *value) return 0; } - /* POWER */ - -int pwc_camera_power(struct pwc_device *pdev, int power) +void pwc_camera_power(struct pwc_device *pdev, int power) { char buf; + int r; + + if (!pdev->power_save) + return; if (pdev->type < 675 || (pdev->type < 730 && pdev->release < 6)) - return 0; /* Not supported by Nala or Timon < release 6 */ + return; /* Not supported by Nala or Timon < release 6 */ if (power) buf = 0x00; /* active */ else buf = 0xFF; /* power save */ - return send_control_msg(pdev, + r = send_control_msg(pdev, SET_STATUS_CTL, SET_POWER_SAVE_MODE_FORMATTER, &buf, sizeof(buf)); -} - + if (r < 0) + PWC_ERROR("Failed to power %s camera (%d)\n", + power ? "on" : "off", r); +} /* private calls */ - int pwc_restore_user(struct pwc_device *pdev) { return send_control_msg(pdev, @@ -1011,6 +1014,7 @@ static int pwc_get_wb_delay(struct pwc_device *pdev, int *value) int pwc_set_leds(struct pwc_device *pdev, int on_value, int off_value) { unsigned char buf[2]; + int r; if (pdev->type < 730) return 0; @@ -1028,8 +1032,12 @@ int pwc_set_leds(struct pwc_device *pdev, int on_value, int off_value) buf[0] = on_value; buf[1] = off_value; - return send_control_msg(pdev, + r = send_control_msg(pdev, SET_STATUS_CTL, LED_FORMATTER, &buf, sizeof(buf)); + if (r < 0) + PWC_ERROR("Failed to set LED on/off time (%d)\n", r); + + return r; } static int pwc_get_leds(struct pwc_device *pdev, int *on_value, int *off_value) diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index 6bff33b357b9..d2a1f3fc0468 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c @@ -133,7 +133,7 @@ static int default_fps = 10; #ifdef CONFIG_USB_PWC_DEBUG int pwc_trace = PWC_DEBUG_LEVEL; #endif -static int power_save; +static int power_save = -1; static int led_on = 100, led_off; /* defaults to LED that is on while in use */ static int pwc_preferred_compression = 1; /* 0..3 = uncompressed..high */ static struct { @@ -720,7 +720,6 @@ static int pwc_video_open(struct file *file) return -EBUSY; } - pwc_construct(pdev); /* set min/max sizes correct */ if (!pdev->usb_init) { PWC_DEBUG_OPEN("Doing first time initialization.\n"); pdev->usb_init = 1; @@ -735,16 +734,9 @@ static int pwc_video_open(struct file *file) } } - /* Turn on camera */ - if (power_save) { - i = pwc_camera_power(pdev, 1); - if (i < 0) - PWC_DEBUG_OPEN("Failed to restore power to the camera! (%d)\n", i); - } - /* Set LED on/off time */ - if (pwc_set_leds(pdev, led_on, led_off) < 0) - PWC_DEBUG_OPEN("Failed to set LED on/off time.\n"); - + /* Turn on camera and set LEDS on */ + pwc_camera_power(pdev, 1); + pwc_set_leds(pdev, led_on, led_off); /* So far, so good. Allocate memory. */ i = pwc_allocate_buffers(pdev); @@ -756,7 +748,6 @@ static int pwc_video_open(struct file *file) /* Reset buffers & parameters */ pdev->visoc_errors = 0; - pwc_construct(pdev); /* set min/max sizes correct */ /* Set some defaults */ pdev->vsnapshot = 0; @@ -815,7 +806,6 @@ static int pwc_video_close(struct file *file) { struct video_device *vdev = file->private_data; struct pwc_device *pdev; - int i; PWC_DEBUG_OPEN(">> video_close called(vdev = 0x%p).\n", vdev); @@ -833,14 +823,8 @@ static int pwc_video_close(struct file *file) /* Turn off LEDS and power down camera, but only when not unplugged */ if (pdev->udev) { - /* Turn LEDs off */ - if (pwc_set_leds(pdev, 0, 0) < 0) - PWC_DEBUG_MODULE("Failed to set LED on/off time.\n"); - if (power_save) { - i = pwc_camera_power(pdev, 0); - if (i < 0) - PWC_ERROR("Failed to power down camera (%d)\n", i); - } + pwc_set_leds(pdev, 0, 0); + pwc_camera_power(pdev, 0); pdev->vopen--; PWC_DEBUG_OPEN("<< video_close() vopen=%d\n", pdev->vopen); } @@ -1016,6 +1000,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id int hint, rc; int features = 0; int video_nr = -1; /* default: use next available device */ + int my_power_save = power_save; char serial_number[30], *name; vendor_id = le16_to_cpu(udev->descriptor.idVendor); @@ -1133,7 +1118,8 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id PWC_INFO("Logitech QuickCam Zoom (new model) USB webcam detected.\n"); name = "Logitech QuickCam Zoom"; type_id = 740; /* CCD sensor */ - power_save = 1; + if (my_power_save == -1) + my_power_save = 1; break; case 0x08b5: PWC_INFO("Logitech QuickCam Orbit/Sphere USB webcam detected.\n"); @@ -1250,6 +1236,9 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id else return -ENODEV; /* Not any of the know types; but the list keeps growing. */ + if (my_power_save == -1) + my_power_save = 0; + memset(serial_number, 0, 30); usb_string(udev, udev->descriptor.iSerialNumber, serial_number, 29); PWC_DEBUG_PROBE("Device serial number is %s\n", serial_number); @@ -1278,6 +1267,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id pdev->angle_range.tilt_min = -3000; pdev->angle_range.tilt_max = 2500; } + pwc_construct(pdev); /* set min/max sizes correct */ mutex_init(&pdev->modlock); spin_lock_init(&pdev->queued_bufs_lock); @@ -1285,6 +1275,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id pdev->udev = udev; pdev->vcompression = pwc_preferred_compression; + pdev->power_save = my_power_save; /* Init videobuf2 queue structure */ memset(&pdev->vb_queue, 0, sizeof(pdev->vb_queue)); @@ -1424,7 +1415,7 @@ module_param(fps, int, 0444); #ifdef CONFIG_USB_PWC_DEBUG module_param_named(trace, pwc_trace, int, 0644); #endif -module_param(power_save, int, 0444); +module_param(power_save, int, 0644); module_param(compression, int, 0444); module_param_array(leds, int, &leds_nargs, 0444); module_param_array(dev_hint, charp, &dev_hint_nargs, 0444); @@ -1434,7 +1425,7 @@ MODULE_PARM_DESC(fps, "Initial frames per second. Varies with model, useful rang #ifdef CONFIG_USB_PWC_DEBUG MODULE_PARM_DESC(trace, "For debugging purposes"); #endif -MODULE_PARM_DESC(power_save, "Turn power save feature in camera on or off"); +MODULE_PARM_DESC(power_save, "Turn power saving for new cameras on or off"); MODULE_PARM_DESC(compression, "Preferred compression quality. Range 0 (uncompressed) to 3 (high compression)"); MODULE_PARM_DESC(leds, "LED on,off time in milliseconds"); MODULE_PARM_DESC(dev_hint, "Device node hints"); @@ -1491,8 +1482,6 @@ static int __init usb_pwc_init(void) pwc_preferred_compression = compression; PWC_DEBUG_MODULE("Preferred compression set to %d.\n", pwc_preferred_compression); } - if (power_save) - PWC_DEBUG_MODULE("Enabling power save on open/close.\n"); if (leds[0] >= 0) led_on = leds[0]; if (leds[1] >= 0) diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h index f4aa386477c8..7013318997fd 100644 --- a/drivers/media/video/pwc/pwc.h +++ b/drivers/media/video/pwc/pwc.h @@ -176,6 +176,7 @@ struct pwc_device char vsnapshot; /* snapshot mode */ char vsync; /* used by isoc handler */ char vmirror; /* for ToUCaM series */ + char power_save; /* Do powersaving for this cam */ int cmd_len; unsigned char cmd_buf[13]; @@ -290,7 +291,7 @@ extern int pwc_set_dynamic_noise(struct pwc_device *pdev, int noise); extern int pwc_get_dynamic_noise(struct pwc_device *pdev, int *noise); /* Power down or up the camera; not supported by all models */ -extern int pwc_camera_power(struct pwc_device *pdev, int power); +extern void pwc_camera_power(struct pwc_device *pdev, int power); /* Private ioctl()s; see pwc-ioctl.h */ extern long pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg); -- cgit v1.2.3 From 6eba93573d2dda3f627006101c0652faeeaffde6 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 26 Jun 2011 06:49:59 -0300 Subject: [media] pwc: Move various initialization to driver load and / or stream start Doing a bunch of initialization every time /dev/video is opened, and thus for example when the udev rules probe for capabilities makes no sense, do it at driver load, resp. stream start instead. This is a preparation patch for allowing multiple opens of the /dev/video node. Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pwc/pwc-ctrl.c | 28 ++-- drivers/media/video/pwc/pwc-dec1.c | 28 ++-- drivers/media/video/pwc/pwc-dec1.h | 8 +- drivers/media/video/pwc/pwc-dec23.c | 22 --- drivers/media/video/pwc/pwc-dec23.h | 10 -- drivers/media/video/pwc/pwc-if.c | 263 ++++++++++++------------------------ drivers/media/video/pwc/pwc.h | 1 - 7 files changed, 114 insertions(+), 246 deletions(-) diff --git a/drivers/media/video/pwc/pwc-ctrl.c b/drivers/media/video/pwc/pwc-ctrl.c index 69a1c6f37956..9d800c668073 100644 --- a/drivers/media/video/pwc/pwc-ctrl.c +++ b/drivers/media/video/pwc/pwc-ctrl.c @@ -261,8 +261,11 @@ static int set_video_mode_Nala(struct pwc_device *pdev, int size, int frames) PWC_DEBUG_MODULE("Failed to send video command... %d\n", ret); return ret; } - if (pEntry->compressed && pdev->pixfmt == V4L2_PIX_FMT_YUV420) - pwc_dec1_init(pdev->type, pdev->release, buf, pdev->decompress_data); + if (pEntry->compressed && pdev->pixfmt == V4L2_PIX_FMT_YUV420) { + ret = pwc_dec1_init(pdev, pdev->type, pdev->release, buf); + if (ret < 0) + return ret; + } pdev->cmd_len = 3; memcpy(pdev->cmd_buf, buf, 3); @@ -321,8 +324,11 @@ static int set_video_mode_Timon(struct pwc_device *pdev, int size, int frames, i if (ret < 0) return ret; - if (pChoose->bandlength > 0 && pdev->pixfmt == V4L2_PIX_FMT_YUV420) - pwc_dec23_init(pdev, pdev->type, buf); + if (pChoose->bandlength > 0 && pdev->pixfmt == V4L2_PIX_FMT_YUV420) { + ret = pwc_dec23_init(pdev, pdev->type, buf); + if (ret < 0) + return ret; + } pdev->cmd_len = 13; memcpy(pdev->cmd_buf, buf, 13); @@ -394,8 +400,11 @@ static int set_video_mode_Kiara(struct pwc_device *pdev, int size, int frames, i if (ret < 0) return ret; - if (pChoose->bandlength > 0 && pdev->pixfmt == V4L2_PIX_FMT_YUV420) - pwc_dec23_init(pdev, pdev->type, buf); + if (pChoose->bandlength > 0 && pdev->pixfmt == V4L2_PIX_FMT_YUV420) { + ret = pwc_dec23_init(pdev, pdev->type, buf); + if (ret < 0) + return ret; + } pdev->cmd_len = 12; memcpy(pdev->cmd_buf, buf, 12); @@ -452,6 +461,7 @@ int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frame } pdev->view.x = width; pdev->view.y = height; + pdev->vcompression = compression; pdev->frame_total_size = pdev->frame_size + pdev->frame_header_size + pdev->frame_trailer_size; pwc_set_image_buffer_size(pdev); PWC_DEBUG_SIZE("Set viewport to %dx%d, image size is %dx%d.\n", width, height, pwc_image_sizes[size].x, pwc_image_sizes[size].y); @@ -1300,7 +1310,7 @@ static int pwc_mpt_get_status(struct pwc_device *pdev, struct pwc_mpt_status *st return 0; } - +#ifdef CONFIG_USB_PWC_DEBUG int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor) { unsigned char buf; @@ -1323,7 +1333,7 @@ int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor) *sensor = buf; return 0; } - +#endif /* End of Add-Ons */ /* ************************************************* */ @@ -1387,8 +1397,6 @@ long pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) ret = -EINVAL; else ret = pwc_set_video_mode(pdev, pdev->view.x, pdev->view.y, pdev->vframes, ARGR(qual), pdev->vsnapshot); - if (ret >= 0) - pdev->vcompression = ARGR(qual); break; } diff --git a/drivers/media/video/pwc/pwc-dec1.c b/drivers/media/video/pwc/pwc-dec1.c index c29593f589eb..be0e02cb487f 100644 --- a/drivers/media/video/pwc/pwc-dec1.c +++ b/drivers/media/video/pwc/pwc-dec1.c @@ -22,29 +22,19 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - - - #include "pwc-dec1.h" - -void pwc_dec1_init(int type, int release, void *buffer, void *table) +int pwc_dec1_init(struct pwc_device *pwc, int type, int release, void *buffer) { + struct pwc_dec1_private *pdec; -} - -void pwc_dec1_exit(void) -{ + if (pwc->decompress_data == NULL) { + pdec = kmalloc(sizeof(struct pwc_dec1_private), GFP_KERNEL); + if (pdec == NULL) + return -ENOMEM; + pwc->decompress_data = pdec; + } + pdec = pwc->decompress_data; - - -} - -int pwc_dec1_alloc(struct pwc_device *pwc) -{ - pwc->decompress_data = kmalloc(sizeof(struct pwc_dec1_private), GFP_KERNEL); - if (pwc->decompress_data == NULL) - return -ENOMEM; return 0; } - diff --git a/drivers/media/video/pwc/pwc-dec1.h b/drivers/media/video/pwc/pwc-dec1.h index 8b62ddcc5c7e..a57d8601080b 100644 --- a/drivers/media/video/pwc/pwc-dec1.h +++ b/drivers/media/video/pwc/pwc-dec1.h @@ -22,8 +22,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - - #ifndef PWC_DEC1_H #define PWC_DEC1_H @@ -32,12 +30,8 @@ struct pwc_dec1_private { int version; - }; -int pwc_dec1_alloc(struct pwc_device *pwc); -void pwc_dec1_init(int type, int release, void *buffer, void *private_data); -void pwc_dec1_exit(void); +int pwc_dec1_init(struct pwc_device *pwc, int type, int release, void *buffer); #endif - diff --git a/drivers/media/video/pwc/pwc-dec23.c b/drivers/media/video/pwc/pwc-dec23.c index 0c801b8f3eca..06a4e877ba40 100644 --- a/drivers/media/video/pwc/pwc-dec23.c +++ b/drivers/media/video/pwc/pwc-dec23.c @@ -916,27 +916,5 @@ void pwc_dec23_decompress(const struct pwc_device *pwc, pout_planar_v += pwc->view.x; } - } - } - -void pwc_dec23_exit(void) -{ - /* Do nothing */ - -} - -/** - * Allocate a private structure used by lookup table. - * You must call kfree() to free the memory allocated. - */ -int pwc_dec23_alloc(struct pwc_device *pwc) -{ - pwc->decompress_data = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL); - if (pwc->decompress_data == NULL) - return -ENOMEM; - return 0; -} - -/* vim: set cino= formatoptions=croql cindent shiftwidth=8 tabstop=8: */ diff --git a/drivers/media/video/pwc/pwc-dec23.h b/drivers/media/video/pwc/pwc-dec23.h index 1c55298ad153..a0ac4f3dff81 100644 --- a/drivers/media/video/pwc/pwc-dec23.h +++ b/drivers/media/video/pwc/pwc-dec23.h @@ -49,19 +49,9 @@ struct pwc_dec23_private }; - -int pwc_dec23_alloc(struct pwc_device *pwc); int pwc_dec23_init(struct pwc_device *pwc, int type, unsigned char *cmd); -void pwc_dec23_exit(void); void pwc_dec23_decompress(const struct pwc_device *pwc, const void *src, void *dst, int flags); - - - #endif - - -/* vim: set cino= formatoptions=croql cindent shiftwidth=8 tabstop=8: */ - diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index d2a1f3fc0468..b591b723f5a1 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c @@ -2,6 +2,7 @@ USB and Video4Linux interface part. (C) 1999-2004 Nemosoft Unv. (C) 2004-2006 Luc Saillard (luc@saillard.org) + (C) 2011 Hans de Goede NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx driver and thus may have bugs that are not present in the original version. @@ -128,7 +129,6 @@ static struct usb_driver pwc_driver = { #define MAX_DEV_HINTS 20 #define MAX_ISOC_ERRORS 20 -static int default_size = PSZ_QCIF; static int default_fps = 10; #ifdef CONFIG_USB_PWC_DEBUG int pwc_trace = PWC_DEBUG_LEVEL; @@ -172,65 +172,6 @@ static struct video_device pwc_template = { /***************************************************************************/ /* Private functions */ -static int pwc_allocate_buffers(struct pwc_device *pdev) -{ - int i, err; - void *kbuf; - - PWC_DEBUG_MEMORY(">> pwc_allocate_buffers(pdev = 0x%p)\n", pdev); - - /* Allocate Isochronuous pipe buffers */ - for (i = 0; i < MAX_ISO_BUFS; i++) { - if (pdev->sbuf[i].data == NULL) { - kbuf = kzalloc(ISO_BUFFER_SIZE, GFP_KERNEL); - if (kbuf == NULL) { - PWC_ERROR("Failed to allocate iso buffer %d.\n", i); - return -ENOMEM; - } - PWC_DEBUG_MEMORY("Allocated iso buffer at %p.\n", kbuf); - pdev->sbuf[i].data = kbuf; - } - } - - /* Allocate decompressor table space */ - if (DEVICE_USE_CODEC1(pdev->type)) - err = pwc_dec1_alloc(pdev); - else - err = pwc_dec23_alloc(pdev); - - if (err) { - PWC_ERROR("Failed to allocate decompress table.\n"); - return err; - } - - PWC_DEBUG_MEMORY("<< pwc_allocate_buffers()\n"); - return 0; -} - -static void pwc_free_buffers(struct pwc_device *pdev) -{ - int i; - - PWC_DEBUG_MEMORY("Entering free_buffers(%p).\n", pdev); - - /* Release Iso-pipe buffers */ - for (i = 0; i < MAX_ISO_BUFS; i++) - if (pdev->sbuf[i].data != NULL) { - PWC_DEBUG_MEMORY("Freeing ISO buffer at %p.\n", pdev->sbuf[i].data); - kfree(pdev->sbuf[i].data); - pdev->sbuf[i].data = NULL; - } - - /* Intermediate decompression buffer & tables */ - if (pdev->decompress_data != NULL) { - PWC_DEBUG_MEMORY("Freeing decompression buffer at %p.\n", pdev->decompress_data); - kfree(pdev->decompress_data); - pdev->decompress_data = NULL; - } - - PWC_DEBUG_MEMORY("Leaving free_buffers().\n"); -} - struct pwc_frame_buf *pwc_get_next_fill_buf(struct pwc_device *pdev) { unsigned long flags = 0; @@ -435,12 +376,16 @@ static int pwc_isoc_init(struct pwc_device *pdev) int i, j, ret; struct usb_interface *intf; struct usb_host_interface *idesc = NULL; + void *kbuf; if (pdev->iso_init) return 0; + pdev->vsync = 0; + pdev->vlast_packet_size = 0; pdev->fill_buf = NULL; pdev->vframe_count = 0; + pdev->visoc_errors = 0; udev = pdev->udev; /* Get the current alternate interface, adjust packet size */ @@ -471,24 +416,31 @@ static int pwc_isoc_init(struct pwc_device *pdev) if (ret < 0) return ret; + /* Allocate Isochronuous pipe buffers */ + for (i = 0; i < MAX_ISO_BUFS; i++) { + kbuf = kzalloc(ISO_BUFFER_SIZE, GFP_KERNEL); + if (kbuf == NULL) { + PWC_ERROR("Failed to allocate iso buffer %d.\n", i); + pdev->iso_init = 1; + pwc_isoc_cleanup(pdev); + return -ENOMEM; + } + PWC_DEBUG_MEMORY("Allocated iso buffer at %p.\n", kbuf); + pdev->sbuf[i].data = kbuf; + } + + /* Allocate Isochronuous urbs */ for (i = 0; i < MAX_ISO_BUFS; i++) { urb = usb_alloc_urb(ISO_FRAMES_PER_DESC, GFP_KERNEL); if (urb == NULL) { PWC_ERROR("Failed to allocate urb %d\n", i); - ret = -ENOMEM; - break; + pdev->iso_init = 1; + pwc_isoc_cleanup(pdev); + return -ENOMEM; } pdev->sbuf[i].urb = urb; PWC_DEBUG_MEMORY("Allocated URB at 0x%p\n", urb); } - if (ret) { - /* De-allocate in reverse order */ - while (i--) { - usb_free_urb(pdev->sbuf[i].urb); - pdev->sbuf[i].urb = NULL; - } - return ret; - } /* init URB structure */ for (i = 0; i < MAX_ISO_BUFS; i++) { @@ -563,6 +515,8 @@ static void pwc_iso_free(struct pwc_device *pdev) static void pwc_isoc_cleanup(struct pwc_device *pdev) { + int i; + PWC_DEBUG_OPEN(">> pwc_isoc_cleanup()\n"); if (pdev->iso_init == 0) @@ -572,6 +526,16 @@ static void pwc_isoc_cleanup(struct pwc_device *pdev) pwc_iso_free(pdev); usb_set_interface(pdev->udev, 0, 0); + /* Release Iso-pipe buffers */ + for (i = 0; i < MAX_ISO_BUFS; i++) { + if (pdev->sbuf[i].data != NULL) { + PWC_DEBUG_MEMORY("Freeing ISO buffer at %p.\n", + pdev->sbuf[i].data); + kfree(pdev->sbuf[i].data); + pdev->sbuf[i].data = NULL; + } + } + pdev->iso_init = 0; PWC_DEBUG_OPEN("<< pwc_isoc_cleanup()\n"); } @@ -705,7 +669,6 @@ static const char *pwc_sensor_type_to_string(unsigned int sensor_type) static int pwc_video_open(struct file *file) { - int i, ret; struct video_device *vdev = video_devdata(file); struct pwc_device *pdev; @@ -720,68 +683,6 @@ static int pwc_video_open(struct file *file) return -EBUSY; } - if (!pdev->usb_init) { - PWC_DEBUG_OPEN("Doing first time initialization.\n"); - pdev->usb_init = 1; - - /* Query sensor type */ - ret = pwc_get_cmos_sensor(pdev, &i); - if (ret >= 0) - { - PWC_DEBUG_OPEN("This %s camera is equipped with a %s (%d).\n", - pdev->vdev.name, - pwc_sensor_type_to_string(i), i); - } - } - - /* Turn on camera and set LEDS on */ - pwc_camera_power(pdev, 1); - pwc_set_leds(pdev, led_on, led_off); - - /* So far, so good. Allocate memory. */ - i = pwc_allocate_buffers(pdev); - if (i < 0) { - PWC_DEBUG_OPEN("Failed to allocate buffers memory.\n"); - pwc_free_buffers(pdev); - return i; - } - - /* Reset buffers & parameters */ - pdev->visoc_errors = 0; - - /* Set some defaults */ - pdev->vsnapshot = 0; - - /* Set video size, first try the last used video size - (or the default one); if that fails try QCIF/10 or QSIF/10; - it that fails too, give up. - */ - i = pwc_set_video_mode(pdev, pwc_image_sizes[pdev->vsize].x, pwc_image_sizes[pdev->vsize].y, pdev->vframes, pdev->vcompression, 0); - if (i) { - unsigned int default_resolution; - PWC_DEBUG_OPEN("First attempt at set_video_mode failed.\n"); - if (pdev->type>= 730) - default_resolution = PSZ_QSIF; - else - default_resolution = PSZ_QCIF; - - i = pwc_set_video_mode(pdev, - pwc_image_sizes[default_resolution].x, - pwc_image_sizes[default_resolution].y, - 10, - pdev->vcompression, - 0); - } - if (i) { - PWC_DEBUG_OPEN("Second attempt at set_video_mode failed.\n"); - pwc_free_buffers(pdev); - return i; - } - - /* Initialize the webcam to sane value */ - pwc_set_brightness(pdev, 0x7fff); - pwc_set_agc(pdev, 1, 0); - pdev->vopen++; file->private_data = vdev; PWC_DEBUG_OPEN("<< video_open() returns 0.\n"); @@ -798,10 +699,17 @@ static void pwc_video_release(struct video_device *vfd) if (device_hint[hint].pdev == pdev) device_hint[hint].pdev = NULL; + /* Free intermediate decompression buffer & tables */ + if (pdev->decompress_data != NULL) { + PWC_DEBUG_MEMORY("Freeing decompression buffer at %p.\n", + pdev->decompress_data); + kfree(pdev->decompress_data); + pdev->decompress_data = NULL; + } + kfree(pdev); } -/* Note that all cleanup is done in the reverse order as in _open */ static int pwc_video_close(struct file *file) { struct video_device *vdev = file->private_data; @@ -810,25 +718,10 @@ static int pwc_video_close(struct file *file) PWC_DEBUG_OPEN(">> video_close called(vdev = 0x%p).\n", vdev); pdev = video_get_drvdata(vdev); - if (pdev->vopen == 0) - PWC_DEBUG_MODULE("video_close() called on closed device?\n"); - - if (DEVICE_USE_CODEC1(pdev->type)) - pwc_dec1_exit(); - else - pwc_dec23_exit(); - vb2_queue_release(&pdev->vb_queue); - pwc_free_buffers(pdev); - - /* Turn off LEDS and power down camera, but only when not unplugged */ - if (pdev->udev) { - pwc_set_leds(pdev, 0, 0); - pwc_camera_power(pdev, 0); - pdev->vopen--; - PWC_DEBUG_OPEN("<< video_close() vopen=%d\n", pdev->vopen); - } + pdev->vopen--; + PWC_DEBUG_OPEN("<< video_close() vopen=%d\n", pdev->vopen); return 0; } @@ -946,6 +839,16 @@ static int start_streaming(struct vb2_queue *vq) if (!pdev->udev) return -ENODEV; + /* Turn on camera and set LEDS on */ + pwc_camera_power(pdev, 1); + if (pdev->power_save) { + /* Restore video mode */ + pwc_set_video_mode(pdev, pdev->view.x, pdev->view.y, + pdev->vframes, pdev->vcompression, + pdev->vsnapshot); + } + pwc_set_leds(pdev, led_on, led_off); + return pwc_isoc_init(pdev); } @@ -953,8 +856,11 @@ static int stop_streaming(struct vb2_queue *vq) { struct pwc_device *pdev = vb2_get_drv_priv(vq); - if (pdev->udev) + if (pdev->udev) { + pwc_set_leds(pdev, 0, 0); + pwc_camera_power(pdev, 0); pwc_isoc_cleanup(pdev); + } pwc_cleanup_queued_bufs(pdev); return 0; @@ -1253,7 +1159,6 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id return -ENOMEM; } pdev->type = type_id; - pdev->vsize = default_size; pdev->vframes = default_fps; strcpy(pdev->serial, serial_number); pdev->features = features; @@ -1318,8 +1223,29 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id PWC_DEBUG_PROBE("probe() function returning struct at 0x%p.\n", pdev); usb_set_intfdata(intf, pdev); +#ifdef CONFIG_USB_PWC_DEBUG + /* Query sensor type */ + if (pwc_get_cmos_sensor(pdev, &rc) >= 0) { + PWC_DEBUG_OPEN("This %s camera is equipped with a %s (%d).\n", + pdev->vdev.name, + pwc_sensor_type_to_string(rc), rc); + } +#endif + /* Set the leds off */ pwc_set_leds(pdev, 0, 0); + + /* Setup intial videomode */ + rc = pwc_set_video_mode(pdev, pdev->view_max.x, pdev->view_max.y, + pdev->vframes, pdev->vcompression, 0); + if (rc) + goto err_free_mem; + + /* Initialize the webcam to sane values */ + pwc_set_brightness(pdev, 0x7fff); + pwc_set_agc(pdev, 1, 0); + + /* And powerdown the camera until streaming starts */ pwc_camera_power(pdev, 0); rc = video_register_device(&pdev->vdev, VFL_TYPE_GRABBER, video_nr); @@ -1402,7 +1328,6 @@ static void usb_pwc_disconnect(struct usb_interface *intf) * Initialization code & module stuff */ -static char *size; static int fps; static int compression = -1; static int leds[2] = { -1, -1 }; @@ -1410,7 +1335,6 @@ static unsigned int leds_nargs; static char *dev_hint[MAX_DEV_HINTS]; static unsigned int dev_hint_nargs; -module_param(size, charp, 0444); module_param(fps, int, 0444); #ifdef CONFIG_USB_PWC_DEBUG module_param_named(trace, pwc_trace, int, 0644); @@ -1420,7 +1344,6 @@ module_param(compression, int, 0444); module_param_array(leds, int, &leds_nargs, 0444); module_param_array(dev_hint, charp, &dev_hint_nargs, 0444); -MODULE_PARM_DESC(size, "Initial image size. One of sqcif, qsif, qcif, sif, cif, vga"); MODULE_PARM_DESC(fps, "Initial frames per second. Varies with model, useful range 5-30"); #ifdef CONFIG_USB_PWC_DEBUG MODULE_PARM_DESC(trace, "For debugging purposes"); @@ -1438,14 +1361,19 @@ MODULE_VERSION( PWC_VERSION ); static int __init usb_pwc_init(void) { - int i, sz; - char *sizenames[PSZ_MAX] = { "sqcif", "qsif", "qcif", "sif", "cif", "vga" }; + int i; +#ifdef CONFIG_USB_PWC_DEBUG PWC_INFO("Philips webcam module version " PWC_VERSION " loaded.\n"); PWC_INFO("Supports Philips PCA645/646, PCVC675/680/690, PCVC720[40]/730/740/750 & PCVC830/840.\n"); PWC_INFO("Also supports the Askey VC010, various Logitech Quickcams, Samsung MPC-C10 and MPC-C30,\n"); PWC_INFO("the Creative WebCam 5 & Pro Ex, SOTEC Afina Eye and Visionite VCS-UC300 and VCS-UM100.\n"); + if (pwc_trace >= 0) { + PWC_DEBUG_MODULE("Trace options: 0x%04x\n", pwc_trace); + } +#endif + if (fps) { if (fps < 4 || fps > 30) { PWC_ERROR("Framerate out of bounds (4-30).\n"); @@ -1455,25 +1383,6 @@ static int __init usb_pwc_init(void) PWC_DEBUG_MODULE("Default framerate set to %d.\n", default_fps); } - if (size) { - /* string; try matching with array */ - for (sz = 0; sz < PSZ_MAX; sz++) { - if (!strcmp(sizenames[sz], size)) { /* Found! */ - default_size = sz; - break; - } - } - if (sz == PSZ_MAX) { - PWC_ERROR("Size not recognized; try size=[sqcif | qsif | qcif | sif | cif | vga].\n"); - return -EINVAL; - } - PWC_DEBUG_MODULE("Default image size set to %s [%dx%d].\n", sizenames[default_size], pwc_image_sizes[default_size].x, pwc_image_sizes[default_size].y); - } -#ifdef CONFIG_USB_PWC_DEBUG - if (pwc_trace >= 0) { - PWC_DEBUG_MODULE("Trace options: 0x%04x\n", pwc_trace); - } -#endif if (compression >= 0) { if (compression > 3) { PWC_ERROR("Invalid compression setting; use a number between 0 (uncompressed) and 3 (high).\n"); diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h index 7013318997fd..8d82c6aac42c 100644 --- a/drivers/media/video/pwc/pwc.h +++ b/drivers/media/video/pwc/pwc.h @@ -158,7 +158,6 @@ struct pwc_device int release; /* release number */ int features; /* feature bits */ char serial[30]; /* serial number (string) */ - int usb_init; /* set when the cam has been initialized */ /*** Video data ***/ int vopen; /* flag */ -- cgit v1.2.3 From 4fba471e405f8f983085fd9f2fd9637bfc275f8f Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 26 Jun 2011 12:13:44 -0300 Subject: [media] pwc: Allow multiple opens Allow multiple opens of the /dev/video node so that control panel apps can be open to-gether with streaming apps. Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pwc/pwc-if.c | 23 ++++++++++++++--------- drivers/media/video/pwc/pwc-v4l.c | 35 +++++++++++++++++++++++++++-------- drivers/media/video/pwc/pwc.h | 2 +- 3 files changed, 42 insertions(+), 18 deletions(-) diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index b591b723f5a1..a6b5fde5c3ad 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c @@ -678,12 +678,6 @@ static int pwc_video_open(struct file *file) if (!pdev->udev) return -ENODEV; - if (pdev->vopen) { - PWC_DEBUG_OPEN("I'm busy, someone is using the device.\n"); - return -EBUSY; - } - - pdev->vopen++; file->private_data = vdev; PWC_DEBUG_OPEN("<< video_open() returns 0.\n"); return 0; @@ -718,10 +712,12 @@ static int pwc_video_close(struct file *file) PWC_DEBUG_OPEN(">> video_close called(vdev = 0x%p).\n", vdev); pdev = video_get_drvdata(vdev); - vb2_queue_release(&pdev->vb_queue); - pdev->vopen--; + if (pdev->capt_file == file) { + vb2_queue_release(&pdev->vb_queue); + pdev->capt_file = NULL; + } - PWC_DEBUG_OPEN("<< video_close() vopen=%d\n", pdev->vopen); + PWC_DEBUG_OPEN("<< video_close()\n"); return 0; } @@ -734,6 +730,12 @@ static ssize_t pwc_video_read(struct file *file, char __user *buf, if (!pdev->udev) return -ENODEV; + if (pdev->capt_file != NULL && + pdev->capt_file != file) + return -EBUSY; + + pdev->capt_file = file; + return vb2_read(&pdev->vb_queue, buf, count, ppos, file->f_flags & O_NONBLOCK); } @@ -754,6 +756,9 @@ static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma) struct video_device *vdev = file->private_data; struct pwc_device *pdev = video_get_drvdata(vdev); + if (pdev->capt_file != file) + return -EBUSY; + return vb2_mmap(&pdev->vb_queue, vma); } diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c index 8bd0a681990d..834055b71e04 100644 --- a/drivers/media/video/pwc/pwc-v4l.c +++ b/drivers/media/video/pwc/pwc-v4l.c @@ -284,13 +284,21 @@ static int pwc_vidioc_try_fmt(struct pwc_device *pdev, struct v4l2_format *f) } /* ioctl(VIDIOC_SET_FMT) */ -static int pwc_vidioc_set_fmt(struct pwc_device *pdev, struct v4l2_format *f) + +static int pwc_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f) { + struct pwc_device *pdev = video_drvdata(file); int ret, fps, snapshot, compression, pixelformat; if (!pdev->udev) return -ENODEV; + if (pdev->capt_file != NULL && + pdev->capt_file != file) + return -EBUSY; + + pdev->capt_file = file; + ret = pwc_vidioc_try_fmt(pdev, f); if (ret<0) return ret; @@ -678,18 +686,17 @@ static int pwc_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format * return pwc_vidioc_try_fmt(pdev, f); } -static int pwc_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f) -{ - struct pwc_device *pdev = video_drvdata(file); - - return pwc_vidioc_set_fmt(pdev, f); -} - static int pwc_reqbufs(struct file *file, void *fh, struct v4l2_requestbuffers *rb) { struct pwc_device *pdev = video_drvdata(file); + if (pdev->capt_file != NULL && + pdev->capt_file != file) + return -EBUSY; + + pdev->capt_file = file; + return vb2_reqbufs(&pdev->vb_queue, rb); } @@ -707,6 +714,9 @@ static int pwc_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf) if (!pdev->udev) return -ENODEV; + if (pdev->capt_file != file) + return -EBUSY; + return vb2_qbuf(&pdev->vb_queue, buf); } @@ -717,6 +727,9 @@ static int pwc_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf) if (!pdev->udev) return -ENODEV; + if (pdev->capt_file != file) + return -EBUSY; + return vb2_dqbuf(&pdev->vb_queue, buf, file->f_flags & O_NONBLOCK); } @@ -727,6 +740,9 @@ static int pwc_streamon(struct file *file, void *fh, enum v4l2_buf_type i) if (!pdev->udev) return -ENODEV; + if (pdev->capt_file != file) + return -EBUSY; + return vb2_streamon(&pdev->vb_queue, i); } @@ -737,6 +753,9 @@ static int pwc_streamoff(struct file *file, void *fh, enum v4l2_buf_type i) if (!pdev->udev) return -ENODEV; + if (pdev->capt_file != file) + return -EBUSY; + return vb2_streamoff(&pdev->vb_queue, i); } diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h index 8d82c6aac42c..d65cd14ef9f2 100644 --- a/drivers/media/video/pwc/pwc.h +++ b/drivers/media/video/pwc/pwc.h @@ -160,7 +160,7 @@ struct pwc_device char serial[30]; /* serial number (string) */ /*** Video data ***/ - int vopen; /* flag */ + struct file *capt_file; /* file doing video capture */ int vendpoint; /* video isoc endpoint */ int vcinterface; /* video control interface */ int valternate; /* alternate interface needed */ -- cgit v1.2.3 From 04613c5e600e64840e4f753bd881cd5ab96ae403 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 26 Jun 2011 13:57:15 -0300 Subject: [media] pwc: properly allocate dma-able memory for ISO buffers Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pwc/pwc-if.c | 76 ++++++++++++++-------------------------- drivers/media/video/pwc/pwc.h | 11 +----- 2 files changed, 28 insertions(+), 59 deletions(-) diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index a6b5fde5c3ad..4c1c056ffdf4 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c @@ -376,7 +376,6 @@ static int pwc_isoc_init(struct pwc_device *pdev) int i, j, ret; struct usb_interface *intf; struct usb_host_interface *idesc = NULL; - void *kbuf; if (pdev->iso_init) return 0; @@ -416,20 +415,7 @@ static int pwc_isoc_init(struct pwc_device *pdev) if (ret < 0) return ret; - /* Allocate Isochronuous pipe buffers */ - for (i = 0; i < MAX_ISO_BUFS; i++) { - kbuf = kzalloc(ISO_BUFFER_SIZE, GFP_KERNEL); - if (kbuf == NULL) { - PWC_ERROR("Failed to allocate iso buffer %d.\n", i); - pdev->iso_init = 1; - pwc_isoc_cleanup(pdev); - return -ENOMEM; - } - PWC_DEBUG_MEMORY("Allocated iso buffer at %p.\n", kbuf); - pdev->sbuf[i].data = kbuf; - } - - /* Allocate Isochronuous urbs */ + /* Allocate and init Isochronuous urbs */ for (i = 0; i < MAX_ISO_BUFS; i++) { urb = usb_alloc_urb(ISO_FRAMES_PER_DESC, GFP_KERNEL); if (urb == NULL) { @@ -438,19 +424,23 @@ static int pwc_isoc_init(struct pwc_device *pdev) pwc_isoc_cleanup(pdev); return -ENOMEM; } - pdev->sbuf[i].urb = urb; + pdev->urbs[i] = urb; PWC_DEBUG_MEMORY("Allocated URB at 0x%p\n", urb); - } - - /* init URB structure */ - for (i = 0; i < MAX_ISO_BUFS; i++) { - urb = pdev->sbuf[i].urb; urb->interval = 1; // devik urb->dev = udev; urb->pipe = usb_rcvisocpipe(udev, pdev->vendpoint); - urb->transfer_flags = URB_ISO_ASAP; - urb->transfer_buffer = pdev->sbuf[i].data; + urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; + urb->transfer_buffer = usb_alloc_coherent(udev, + ISO_BUFFER_SIZE, + GFP_KERNEL, + &urb->transfer_dma); + if (urb->transfer_buffer == NULL) { + PWC_ERROR("Failed to allocate urb buffer %d\n", i); + pdev->iso_init = 1; + pwc_isoc_cleanup(pdev); + return -ENOMEM; + } urb->transfer_buffer_length = ISO_BUFFER_SIZE; urb->complete = pwc_isoc_handler; urb->context = pdev; @@ -464,14 +454,14 @@ static int pwc_isoc_init(struct pwc_device *pdev) /* link */ for (i = 0; i < MAX_ISO_BUFS; i++) { - ret = usb_submit_urb(pdev->sbuf[i].urb, GFP_KERNEL); + ret = usb_submit_urb(pdev->urbs[i], GFP_KERNEL); if (ret) { PWC_ERROR("isoc_init() submit_urb %d failed with error %d\n", i, ret); pdev->iso_init = 1; pwc_isoc_cleanup(pdev); return ret; } - PWC_DEBUG_MEMORY("URB 0x%p submitted.\n", pdev->sbuf[i].urb); + PWC_DEBUG_MEMORY("URB 0x%p submitted.\n", pdev->urbs[i]); } /* All is done... */ @@ -486,12 +476,9 @@ static void pwc_iso_stop(struct pwc_device *pdev) /* Unlinking ISOC buffers one by one */ for (i = 0; i < MAX_ISO_BUFS; i++) { - struct urb *urb; - - urb = pdev->sbuf[i].urb; - if (urb) { - PWC_DEBUG_MEMORY("Unlinking URB %p\n", urb); - usb_kill_urb(urb); + if (pdev->urbs[i]) { + PWC_DEBUG_MEMORY("Unlinking URB %p\n", pdev->urbs[i]); + usb_kill_urb(pdev->urbs[i]); } } } @@ -502,21 +489,22 @@ static void pwc_iso_free(struct pwc_device *pdev) /* Freeing ISOC buffers one by one */ for (i = 0; i < MAX_ISO_BUFS; i++) { - struct urb *urb; - - urb = pdev->sbuf[i].urb; - if (urb) { + if (pdev->urbs[i]) { PWC_DEBUG_MEMORY("Freeing URB\n"); - usb_free_urb(urb); - pdev->sbuf[i].urb = NULL; + if (pdev->urbs[i]->transfer_buffer) { + usb_free_coherent(pdev->udev, + pdev->urbs[i]->transfer_buffer_length, + pdev->urbs[i]->transfer_buffer, + pdev->urbs[i]->transfer_dma); + } + usb_free_urb(pdev->urbs[i]); + pdev->urbs[i] = NULL; } } } static void pwc_isoc_cleanup(struct pwc_device *pdev) { - int i; - PWC_DEBUG_OPEN(">> pwc_isoc_cleanup()\n"); if (pdev->iso_init == 0) @@ -526,16 +514,6 @@ static void pwc_isoc_cleanup(struct pwc_device *pdev) pwc_iso_free(pdev); usb_set_interface(pdev->udev, 0, 0); - /* Release Iso-pipe buffers */ - for (i = 0; i < MAX_ISO_BUFS; i++) { - if (pdev->sbuf[i].data != NULL) { - PWC_DEBUG_MEMORY("Freeing ISO buffer at %p.\n", - pdev->sbuf[i].data); - kfree(pdev->sbuf[i].data); - pdev->sbuf[i].data = NULL; - } - } - pdev->iso_init = 0; PWC_DEBUG_OPEN("<< pwc_isoc_cleanup()\n"); } diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h index d65cd14ef9f2..1cfb8b475a3f 100644 --- a/drivers/media/video/pwc/pwc.h +++ b/drivers/media/video/pwc/pwc.h @@ -128,15 +128,6 @@ #define DEVICE_USE_CODEC3(x) ((x)>=700) #define DEVICE_USE_CODEC23(x) ((x)>=675) -/* The following structures were based on cpia.h. Why reinvent the wheel? :-) */ -struct pwc_iso_buf -{ - void *data; - int length; - int read; - struct urb *urb; -}; - /* intermediate buffers with raw data from the USB cam */ struct pwc_frame_buf { @@ -180,7 +171,7 @@ struct pwc_device int cmd_len; unsigned char cmd_buf[13]; - struct pwc_iso_buf sbuf[MAX_ISO_BUFS]; + struct urb *urbs[MAX_ISO_BUFS]; char iso_init; /* videobuf2 queue and queued buffers list */ -- cgit v1.2.3 From 6c9cac89c009c049a9ad29cdf0f51892410fe751 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 26 Jun 2011 12:52:01 -0300 Subject: [media] pwc: Replace control code with v4l2-ctrls framework Also remove all the converting from native range to 0-65535 and back that was going on. This is no longer needed now that we no longer support v4l1. Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pwc/pwc-ctrl.c | 729 ++++---------------------- drivers/media/video/pwc/pwc-if.c | 18 +- drivers/media/video/pwc/pwc-v4l.c | 1008 +++++++++++++++++++++--------------- drivers/media/video/pwc/pwc.h | 152 ++++-- 4 files changed, 823 insertions(+), 1084 deletions(-) diff --git a/drivers/media/video/pwc/pwc-ctrl.c b/drivers/media/video/pwc/pwc-ctrl.c index 9d800c668073..8e0cc537e1e4 100644 --- a/drivers/media/video/pwc/pwc-ctrl.c +++ b/drivers/media/video/pwc/pwc-ctrl.c @@ -3,6 +3,7 @@ video modes. (C) 1999-2003 Nemosoft Unv. (C) 2004-2006 Luc Saillard (luc@saillard.org) + (C) 2011 Hans de Goede NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx driver and thus may have bugs that are not present in the original version. @@ -49,55 +50,7 @@ #include "pwc-dec1.h" #include "pwc-dec23.h" -/* Request types: video */ -#define SET_LUM_CTL 0x01 -#define GET_LUM_CTL 0x02 -#define SET_CHROM_CTL 0x03 -#define GET_CHROM_CTL 0x04 -#define SET_STATUS_CTL 0x05 -#define GET_STATUS_CTL 0x06 -#define SET_EP_STREAM_CTL 0x07 -#define GET_EP_STREAM_CTL 0x08 -#define GET_XX_CTL 0x09 -#define SET_XX_CTL 0x0A -#define GET_XY_CTL 0x0B -#define SET_XY_CTL 0x0C -#define SET_MPT_CTL 0x0D -#define GET_MPT_CTL 0x0E - -/* Selectors for the Luminance controls [GS]ET_LUM_CTL */ -#define AGC_MODE_FORMATTER 0x2000 -#define PRESET_AGC_FORMATTER 0x2100 -#define SHUTTER_MODE_FORMATTER 0x2200 -#define PRESET_SHUTTER_FORMATTER 0x2300 -#define PRESET_CONTOUR_FORMATTER 0x2400 -#define AUTO_CONTOUR_FORMATTER 0x2500 -#define BACK_LIGHT_COMPENSATION_FORMATTER 0x2600 -#define CONTRAST_FORMATTER 0x2700 -#define DYNAMIC_NOISE_CONTROL_FORMATTER 0x2800 -#define FLICKERLESS_MODE_FORMATTER 0x2900 -#define AE_CONTROL_SPEED 0x2A00 -#define BRIGHTNESS_FORMATTER 0x2B00 -#define GAMMA_FORMATTER 0x2C00 - -/* Selectors for the Chrominance controls [GS]ET_CHROM_CTL */ -#define WB_MODE_FORMATTER 0x1000 -#define AWB_CONTROL_SPEED_FORMATTER 0x1100 -#define AWB_CONTROL_DELAY_FORMATTER 0x1200 -#define PRESET_MANUAL_RED_GAIN_FORMATTER 0x1300 -#define PRESET_MANUAL_BLUE_GAIN_FORMATTER 0x1400 -#define COLOUR_MODE_FORMATTER 0x1500 -#define SATURATION_MODE_FORMATTER1 0x1600 -#define SATURATION_MODE_FORMATTER2 0x1700 - -/* Selectors for the Status controls [GS]ET_STATUS_CTL */ -#define SAVE_USER_DEFAULTS_FORMATTER 0x0200 -#define RESTORE_USER_DEFAULTS_FORMATTER 0x0300 -#define RESTORE_FACTORY_DEFAULTS_FORMATTER 0x0400 -#define READ_AGC_FORMATTER 0x0500 -#define READ_SHUTTER_FORMATTER 0x0600 -#define READ_RED_GAIN_FORMATTER 0x0700 -#define READ_BLUE_GAIN_FORMATTER 0x0800 +/* Selectors for status controls used only in this file */ #define GET_STATUS_B00 0x0B00 #define SENSOR_TYPE_FORMATTER1 0x0C00 #define GET_STATUS_3000 0x3000 @@ -116,11 +69,6 @@ /* Formatters for the Video Endpoint controls [GS]ET_EP_STREAM_CTL */ #define VIDEO_OUTPUT_CONTROL_FORMATTER 0x0100 -/* Formatters for the motorized pan & tilt [GS]ET_MPT_CTL */ -#define PT_RELATIVE_CONTROL_FORMATTER 0x01 -#define PT_RESET_CONTROL_FORMATTER 0x02 -#define PT_STATUS_FORMATTER 0x03 - static const char *size2name[PSZ_MAX] = { "subQCIF", @@ -160,7 +108,7 @@ static void pwc_set_image_buffer_size(struct pwc_device *pdev); /****************************************************************************/ static int _send_control_msg(struct pwc_device *pdev, - u8 request, u16 value, int index, void *buf, int buflen, int timeout) + u8 request, u16 value, int index, void *buf, int buflen) { int rc; void *kbuf = NULL; @@ -177,7 +125,7 @@ static int _send_control_msg(struct pwc_device *pdev, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, value, index, - kbuf, buflen, timeout); + kbuf, buflen, USB_CTRL_SET_TIMEOUT); kfree(kbuf); return rc; @@ -197,9 +145,13 @@ static int recv_control_msg(struct pwc_device *pdev, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, value, pdev->vcinterface, - kbuf, buflen, 500); + kbuf, buflen, USB_CTRL_GET_TIMEOUT); memcpy(buf, kbuf, buflen); kfree(kbuf); + + if (rc < 0) + PWC_ERROR("recv_control_msg error %d req %02x val %04x\n", + rc, request, value); return rc; } @@ -210,18 +162,16 @@ static inline int send_video_command(struct pwc_device *pdev, SET_EP_STREAM_CTL, VIDEO_OUTPUT_CONTROL_FORMATTER, index, - buf, buflen, 1000); + buf, buflen); } static inline int send_control_msg(struct pwc_device *pdev, u8 request, u16 value, void *buf, int buflen) { return _send_control_msg(pdev, - request, value, pdev->vcinterface, buf, buflen, 500); + request, value, pdev->vcinterface, buf, buflen); } - - static int set_video_mode_Nala(struct pwc_device *pdev, int size, int frames) { unsigned char buf[3]; @@ -549,246 +499,78 @@ static void pwc_set_image_buffer_size(struct pwc_device *pdev) pdev->offset.y = ((pdev->view.y - pdev->image.y) / 2) & 0xFFFE; } -/* BRIGHTNESS */ -int pwc_get_brightness(struct pwc_device *pdev) +int pwc_get_u8_ctrl(struct pwc_device *pdev, u8 request, u16 value, int *data) { - char buf; int ret; + u8 buf; - ret = recv_control_msg(pdev, - GET_LUM_CTL, BRIGHTNESS_FORMATTER, &buf, sizeof(buf)); + ret = recv_control_msg(pdev, request, value, &buf, sizeof(buf)); if (ret < 0) return ret; - return buf; -} - -int pwc_set_brightness(struct pwc_device *pdev, int value) -{ - char buf; - if (value < 0) - value = 0; - if (value > 0xffff) - value = 0xffff; - buf = (value >> 9) & 0x7f; - return send_control_msg(pdev, - SET_LUM_CTL, BRIGHTNESS_FORMATTER, &buf, sizeof(buf)); + *data = buf; + return 0; } -/* CONTRAST */ - -int pwc_get_contrast(struct pwc_device *pdev) +int pwc_set_u8_ctrl(struct pwc_device *pdev, u8 request, u16 value, u8 data) { - char buf; int ret; - ret = recv_control_msg(pdev, - GET_LUM_CTL, CONTRAST_FORMATTER, &buf, sizeof(buf)); + ret = send_control_msg(pdev, request, value, &data, sizeof(data)); if (ret < 0) return ret; - return buf; -} -int pwc_set_contrast(struct pwc_device *pdev, int value) -{ - char buf; - - if (value < 0) - value = 0; - if (value > 0xffff) - value = 0xffff; - buf = (value >> 10) & 0x3f; - return send_control_msg(pdev, - SET_LUM_CTL, CONTRAST_FORMATTER, &buf, sizeof(buf)); + return 0; } -/* GAMMA */ - -int pwc_get_gamma(struct pwc_device *pdev) +int pwc_get_s8_ctrl(struct pwc_device *pdev, u8 request, u16 value, int *data) { - char buf; int ret; + s8 buf; - ret = recv_control_msg(pdev, - GET_LUM_CTL, GAMMA_FORMATTER, &buf, sizeof(buf)); + ret = recv_control_msg(pdev, request, value, &buf, sizeof(buf)); if (ret < 0) return ret; - return buf; -} - -int pwc_set_gamma(struct pwc_device *pdev, int value) -{ - char buf; - - if (value < 0) - value = 0; - if (value > 0xffff) - value = 0xffff; - buf = (value >> 11) & 0x1f; - return send_control_msg(pdev, - SET_LUM_CTL, GAMMA_FORMATTER, &buf, sizeof(buf)); -} - - -/* SATURATION */ - -/* return a value between [-100 , 100] */ -int pwc_get_saturation(struct pwc_device *pdev, int *value) -{ - char buf; - int ret, saturation_register; - if (pdev->type < 675) - return -EINVAL; - if (pdev->type < 730) - saturation_register = SATURATION_MODE_FORMATTER2; - else - saturation_register = SATURATION_MODE_FORMATTER1; - ret = recv_control_msg(pdev, - GET_CHROM_CTL, saturation_register, &buf, sizeof(buf)); - if (ret < 0) - return ret; - *value = (signed)buf; + *data = buf; return 0; } -/* @param value saturation color between [-100 , 100] */ -int pwc_set_saturation(struct pwc_device *pdev, int value) -{ - char buf; - int saturation_register; - - if (pdev->type < 675) - return -EINVAL; - if (value < -100) - value = -100; - if (value > 100) - value = 100; - if (pdev->type < 730) - saturation_register = SATURATION_MODE_FORMATTER2; - else - saturation_register = SATURATION_MODE_FORMATTER1; - return send_control_msg(pdev, - SET_CHROM_CTL, saturation_register, &buf, sizeof(buf)); -} - -/* AGC */ - -int pwc_set_agc(struct pwc_device *pdev, int mode, int value) +int pwc_get_u16_ctrl(struct pwc_device *pdev, u8 request, u16 value, int *data) { - char buf; int ret; + u8 buf[2]; - if (mode) - buf = 0x0; /* auto */ - else - buf = 0xff; /* fixed */ - - ret = send_control_msg(pdev, - SET_LUM_CTL, AGC_MODE_FORMATTER, &buf, sizeof(buf)); - - if (!mode && ret >= 0) { - if (value < 0) - value = 0; - if (value > 0xffff) - value = 0xffff; - buf = (value >> 10) & 0x3F; - ret = send_control_msg(pdev, - SET_LUM_CTL, PRESET_AGC_FORMATTER, &buf, sizeof(buf)); - } + ret = recv_control_msg(pdev, request, value, buf, sizeof(buf)); if (ret < 0) return ret; + + *data = (buf[1] << 8) | buf[0]; return 0; } -int pwc_get_agc(struct pwc_device *pdev, int *value) +int pwc_set_u16_ctrl(struct pwc_device *pdev, u8 request, u16 value, u16 data) { - unsigned char buf; int ret; + u8 buf[2]; - ret = recv_control_msg(pdev, - GET_LUM_CTL, AGC_MODE_FORMATTER, &buf, sizeof(buf)); + buf[0] = data & 0xff; + buf[1] = data >> 8; + ret = send_control_msg(pdev, request, value, buf, sizeof(buf)); if (ret < 0) return ret; - if (buf != 0) { /* fixed */ - ret = recv_control_msg(pdev, - GET_LUM_CTL, PRESET_AGC_FORMATTER, &buf, sizeof(buf)); - if (ret < 0) - return ret; - if (buf > 0x3F) - buf = 0x3F; - *value = (buf << 10); - } - else { /* auto */ - ret = recv_control_msg(pdev, - GET_STATUS_CTL, READ_AGC_FORMATTER, &buf, sizeof(buf)); - if (ret < 0) - return ret; - /* Gah... this value ranges from 0x00 ... 0x9F */ - if (buf > 0x9F) - buf = 0x9F; - *value = -(48 + buf * 409); - } - return 0; } -int pwc_set_shutter_speed(struct pwc_device *pdev, int mode, int value) -{ - char buf[2]; - int speed, ret; - - - if (mode) - buf[0] = 0x0; /* auto */ - else - buf[0] = 0xff; /* fixed */ - - ret = send_control_msg(pdev, - SET_LUM_CTL, SHUTTER_MODE_FORMATTER, &buf, 1); - - if (!mode && ret >= 0) { - if (value < 0) - value = 0; - if (value > 0xffff) - value = 0xffff; - - if (DEVICE_USE_CODEC2(pdev->type)) { - /* speed ranges from 0x0 to 0x290 (656) */ - speed = (value / 100); - buf[1] = speed >> 8; - buf[0] = speed & 0xff; - } else if (DEVICE_USE_CODEC3(pdev->type)) { - /* speed seems to range from 0x0 to 0xff */ - buf[1] = 0; - buf[0] = value >> 8; - } - - ret = send_control_msg(pdev, - SET_LUM_CTL, PRESET_SHUTTER_FORMATTER, - &buf, sizeof(buf)); - } - return ret; -} - -/* This function is not exported to v4l1, so output values between 0 -> 256 */ -int pwc_get_shutter_speed(struct pwc_device *pdev, int *value) +int pwc_button_ctrl(struct pwc_device *pdev, u16 value) { - unsigned char buf[2]; int ret; - ret = recv_control_msg(pdev, - GET_STATUS_CTL, READ_SHUTTER_FORMATTER, &buf, sizeof(buf)); + ret = send_control_msg(pdev, SET_STATUS_CTL, value, NULL, 0); if (ret < 0) return ret; - *value = buf[0] + (buf[1] << 8); - if (DEVICE_USE_CODEC2(pdev->type)) { - /* speed ranges from 0x0 to 0x290 (656) */ - *value *= 256/656; - } else if (DEVICE_USE_CODEC3(pdev->type)) { - /* speed seems to range from 0x0 to 0xff */ - } + return 0; } @@ -817,162 +599,6 @@ void pwc_camera_power(struct pwc_device *pdev, int power) power ? "on" : "off", r); } -/* private calls */ -int pwc_restore_user(struct pwc_device *pdev) -{ - return send_control_msg(pdev, - SET_STATUS_CTL, RESTORE_USER_DEFAULTS_FORMATTER, NULL, 0); -} - -int pwc_save_user(struct pwc_device *pdev) -{ - return send_control_msg(pdev, - SET_STATUS_CTL, SAVE_USER_DEFAULTS_FORMATTER, NULL, 0); -} - -int pwc_restore_factory(struct pwc_device *pdev) -{ - return send_control_msg(pdev, - SET_STATUS_CTL, RESTORE_FACTORY_DEFAULTS_FORMATTER, NULL, 0); -} - - /* ************************************************* */ - /* Patch by Alvarado: (not in the original version */ - - /* - * the camera recognizes modes from 0 to 4: - * - * 00: indoor (incandescant lighting) - * 01: outdoor (sunlight) - * 02: fluorescent lighting - * 03: manual - * 04: auto - */ -int pwc_set_awb(struct pwc_device *pdev, int mode) -{ - char buf; - int ret; - - if (mode < 0) - mode = 0; - - if (mode > 4) - mode = 4; - - buf = mode & 0x07; /* just the lowest three bits */ - - ret = send_control_msg(pdev, - SET_CHROM_CTL, WB_MODE_FORMATTER, &buf, sizeof(buf)); - - if (ret < 0) - return ret; - return 0; -} - -int pwc_get_awb(struct pwc_device *pdev) -{ - unsigned char buf; - int ret; - - ret = recv_control_msg(pdev, - GET_CHROM_CTL, WB_MODE_FORMATTER, &buf, sizeof(buf)); - - if (ret < 0) - return ret; - return buf; -} - -int pwc_set_red_gain(struct pwc_device *pdev, int value) -{ - unsigned char buf; - - if (value < 0) - value = 0; - if (value > 0xffff) - value = 0xffff; - /* only the msb is considered */ - buf = value >> 8; - return send_control_msg(pdev, - SET_CHROM_CTL, PRESET_MANUAL_RED_GAIN_FORMATTER, - &buf, sizeof(buf)); -} - -int pwc_get_red_gain(struct pwc_device *pdev, int *value) -{ - unsigned char buf; - int ret; - - ret = recv_control_msg(pdev, - GET_CHROM_CTL, PRESET_MANUAL_RED_GAIN_FORMATTER, - &buf, sizeof(buf)); - if (ret < 0) - return ret; - *value = buf << 8; - return 0; -} - - -int pwc_set_blue_gain(struct pwc_device *pdev, int value) -{ - unsigned char buf; - - if (value < 0) - value = 0; - if (value > 0xffff) - value = 0xffff; - /* only the msb is considered */ - buf = value >> 8; - return send_control_msg(pdev, - SET_CHROM_CTL, PRESET_MANUAL_BLUE_GAIN_FORMATTER, - &buf, sizeof(buf)); -} - -int pwc_get_blue_gain(struct pwc_device *pdev, int *value) -{ - unsigned char buf; - int ret; - - ret = recv_control_msg(pdev, - GET_CHROM_CTL, PRESET_MANUAL_BLUE_GAIN_FORMATTER, - &buf, sizeof(buf)); - if (ret < 0) - return ret; - *value = buf << 8; - return 0; -} - - -/* The following two functions are different, since they only read the - internal red/blue gains, which may be different from the manual - gains set or read above. - */ -static int pwc_read_red_gain(struct pwc_device *pdev, int *value) -{ - unsigned char buf; - int ret; - - ret = recv_control_msg(pdev, - GET_STATUS_CTL, READ_RED_GAIN_FORMATTER, &buf, sizeof(buf)); - if (ret < 0) - return ret; - *value = buf << 8; - return 0; -} - -static int pwc_read_blue_gain(struct pwc_device *pdev, int *value) -{ - unsigned char buf; - int ret; - - ret = recv_control_msg(pdev, - GET_STATUS_CTL, READ_BLUE_GAIN_FORMATTER, &buf, sizeof(buf)); - if (ret < 0) - return ret; - *value = buf << 8; - return 0; -} - - static int pwc_set_wb_speed(struct pwc_device *pdev, int speed) { unsigned char buf; @@ -1070,164 +696,6 @@ static int pwc_get_leds(struct pwc_device *pdev, int *on_value, int *off_value) return 0; } -int pwc_set_contour(struct pwc_device *pdev, int contour) -{ - unsigned char buf; - int ret; - - if (contour < 0) - buf = 0xff; /* auto contour on */ - else - buf = 0x0; /* auto contour off */ - ret = send_control_msg(pdev, - SET_LUM_CTL, AUTO_CONTOUR_FORMATTER, &buf, sizeof(buf)); - if (ret < 0) - return ret; - - if (contour < 0) - return 0; - if (contour > 0xffff) - contour = 0xffff; - - buf = (contour >> 10); /* contour preset is [0..3f] */ - ret = send_control_msg(pdev, - SET_LUM_CTL, PRESET_CONTOUR_FORMATTER, &buf, sizeof(buf)); - if (ret < 0) - return ret; - return 0; -} - -int pwc_get_contour(struct pwc_device *pdev, int *contour) -{ - unsigned char buf; - int ret; - - ret = recv_control_msg(pdev, - GET_LUM_CTL, AUTO_CONTOUR_FORMATTER, &buf, sizeof(buf)); - if (ret < 0) - return ret; - - if (buf == 0) { - /* auto mode off, query current preset value */ - ret = recv_control_msg(pdev, - GET_LUM_CTL, PRESET_CONTOUR_FORMATTER, - &buf, sizeof(buf)); - if (ret < 0) - return ret; - *contour = buf << 10; - } - else - *contour = -1; - return 0; -} - - -int pwc_set_backlight(struct pwc_device *pdev, int backlight) -{ - unsigned char buf; - - if (backlight) - buf = 0xff; - else - buf = 0x0; - return send_control_msg(pdev, - SET_LUM_CTL, BACK_LIGHT_COMPENSATION_FORMATTER, - &buf, sizeof(buf)); -} - -int pwc_get_backlight(struct pwc_device *pdev, int *backlight) -{ - int ret; - unsigned char buf; - - ret = recv_control_msg(pdev, - GET_LUM_CTL, BACK_LIGHT_COMPENSATION_FORMATTER, - &buf, sizeof(buf)); - if (ret < 0) - return ret; - *backlight = !!buf; - return 0; -} - -int pwc_set_colour_mode(struct pwc_device *pdev, int colour) -{ - unsigned char buf; - - if (colour) - buf = 0xff; - else - buf = 0x0; - return send_control_msg(pdev, - SET_CHROM_CTL, COLOUR_MODE_FORMATTER, &buf, sizeof(buf)); -} - -int pwc_get_colour_mode(struct pwc_device *pdev, int *colour) -{ - int ret; - unsigned char buf; - - ret = recv_control_msg(pdev, - GET_CHROM_CTL, COLOUR_MODE_FORMATTER, &buf, sizeof(buf)); - if (ret < 0) - return ret; - *colour = !!buf; - return 0; -} - - -int pwc_set_flicker(struct pwc_device *pdev, int flicker) -{ - unsigned char buf; - - if (flicker) - buf = 0xff; - else - buf = 0x0; - return send_control_msg(pdev, - SET_LUM_CTL, FLICKERLESS_MODE_FORMATTER, &buf, sizeof(buf)); -} - -int pwc_get_flicker(struct pwc_device *pdev, int *flicker) -{ - int ret; - unsigned char buf; - - ret = recv_control_msg(pdev, - GET_LUM_CTL, FLICKERLESS_MODE_FORMATTER, &buf, sizeof(buf)); - if (ret < 0) - return ret; - *flicker = !!buf; - return 0; -} - -int pwc_set_dynamic_noise(struct pwc_device *pdev, int noise) -{ - unsigned char buf; - - if (noise < 0) - noise = 0; - if (noise > 3) - noise = 3; - buf = noise; - return send_control_msg(pdev, - SET_LUM_CTL, DYNAMIC_NOISE_CONTROL_FORMATTER, - &buf, sizeof(buf)); -} - -int pwc_get_dynamic_noise(struct pwc_device *pdev, int *noise) -{ - int ret; - unsigned char buf; - - ret = recv_control_msg(pdev, - GET_LUM_CTL, DYNAMIC_NOISE_CONTROL_FORMATTER, - &buf, sizeof(buf)); - if (ret < 0) - return ret; - *noise = buf; - return 0; -} - static int _pwc_mpt_reset(struct pwc_device *pdev, int flags) { unsigned char buf; @@ -1357,37 +825,41 @@ int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor) /* copy local variable to arg */ #define ARG_OUT(ARG_name) /* nothing */ +/* + * Our ctrls use native values, but the old custom pwc ioctl interface expects + * values from 0 - 65535, define 2 helper functions to scale things. */ +static int pwc_ioctl_g_ctrl(struct v4l2_ctrl *ctrl) +{ + return v4l2_ctrl_g_ctrl(ctrl) * 65535 / ctrl->maximum; +} + +static int pwc_ioctl_s_ctrl(struct v4l2_ctrl *ctrl, int val) +{ + return v4l2_ctrl_s_ctrl(ctrl, val * ctrl->maximum / 65535); +} + long pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) { long ret = 0; switch(cmd) { case VIDIOCPWCRUSER: - { - if (pwc_restore_user(pdev)) - ret = -EINVAL; + ret = pwc_button_ctrl(pdev, RESTORE_USER_DEFAULTS_FORMATTER); break; - } case VIDIOCPWCSUSER: - { - if (pwc_save_user(pdev)) - ret = -EINVAL; + ret = pwc_button_ctrl(pdev, SAVE_USER_DEFAULTS_FORMATTER); break; - } case VIDIOCPWCFACTORY: - { - if (pwc_restore_factory(pdev)) - ret = -EINVAL; + ret = pwc_button_ctrl(pdev, RESTORE_FACTORY_DEFAULTS_FORMATTER); break; - } case VIDIOCPWCSCQUAL: { ARG_DEF(int, qual) - if (pdev->iso_init) { + if (vb2_is_streaming(&pdev->vb_queue)) { ret = -EBUSY; break; } @@ -1431,71 +903,59 @@ long pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) case VIDIOCPWCSAGC: { ARG_DEF(int, agc) - ARG_IN(agc) - if (pwc_set_agc(pdev, ARGR(agc) < 0 ? 1 : 0, ARGR(agc))) - ret = -EINVAL; + ret = v4l2_ctrl_s_ctrl(pdev->autogain, ARGR(agc) < 0); + if (ret == 0 && ARGR(agc) >= 0) + ret = pwc_ioctl_s_ctrl(pdev->gain, ARGR(agc)); break; } case VIDIOCPWCGAGC: { ARG_DEF(int, agc) - - if (pwc_get_agc(pdev, ARGA(agc))) - ret = -EINVAL; + if (v4l2_ctrl_g_ctrl(pdev->autogain)) + ARGR(agc) = -1; + else + ARGR(agc) = pwc_ioctl_g_ctrl(pdev->gain); ARG_OUT(agc) break; } case VIDIOCPWCSSHUTTER: { - ARG_DEF(int, shutter_speed) - - ARG_IN(shutter_speed) - ret = pwc_set_shutter_speed(pdev, ARGR(shutter_speed) < 0 ? 1 : 0, ARGR(shutter_speed)); + ARG_DEF(int, shutter) + ARG_IN(shutter) + ret = v4l2_ctrl_s_ctrl(pdev->exposure_auto, + /* Menu idx 0 = auto, idx 1 = manual */ + ARGR(shutter) >= 0); + if (ret == 0 && ARGR(shutter) >= 0) + ret = pwc_ioctl_s_ctrl(pdev->exposure, ARGR(shutter)); break; } case VIDIOCPWCSAWB: { ARG_DEF(struct pwc_whitebalance, wb) - ARG_IN(wb) - ret = pwc_set_awb(pdev, ARGR(wb).mode); - if (ret >= 0 && ARGR(wb).mode == PWC_WB_MANUAL) { - pwc_set_red_gain(pdev, ARGR(wb).manual_red); - pwc_set_blue_gain(pdev, ARGR(wb).manual_blue); - } + ret = v4l2_ctrl_s_ctrl(pdev->auto_white_balance, + ARGR(wb).mode); + if (ret == 0 && ARGR(wb).mode == PWC_WB_MANUAL) + ret = pwc_ioctl_s_ctrl(pdev->red_balance, + ARGR(wb).manual_red); + if (ret == 0 && ARGR(wb).mode == PWC_WB_MANUAL) + ret = pwc_ioctl_s_ctrl(pdev->blue_balance, + ARGR(wb).manual_blue); break; } case VIDIOCPWCGAWB: { ARG_DEF(struct pwc_whitebalance, wb) - - memset(ARGA(wb), 0, sizeof(struct pwc_whitebalance)); - ARGR(wb).mode = pwc_get_awb(pdev); - if (ARGR(wb).mode < 0) - ret = -EINVAL; - else { - if (ARGR(wb).mode == PWC_WB_MANUAL) { - ret = pwc_get_red_gain(pdev, &ARGR(wb).manual_red); - if (ret < 0) - break; - ret = pwc_get_blue_gain(pdev, &ARGR(wb).manual_blue); - if (ret < 0) - break; - } - if (ARGR(wb).mode == PWC_WB_AUTO) { - ret = pwc_read_red_gain(pdev, &ARGR(wb).read_red); - if (ret < 0) - break; - ret = pwc_read_blue_gain(pdev, &ARGR(wb).read_blue); - if (ret < 0) - break; - } - } + ARGR(wb).mode = v4l2_ctrl_g_ctrl(pdev->auto_white_balance); + ARGR(wb).manual_red = ARGR(wb).read_red = + pwc_ioctl_g_ctrl(pdev->red_balance); + ARGR(wb).manual_blue = ARGR(wb).read_blue = + pwc_ioctl_g_ctrl(pdev->blue_balance); ARG_OUT(wb) break; } @@ -1549,17 +1009,20 @@ long pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) case VIDIOCPWCSCONTOUR: { ARG_DEF(int, contour) - ARG_IN(contour) - ret = pwc_set_contour(pdev, ARGR(contour)); + ret = v4l2_ctrl_s_ctrl(pdev->autocontour, ARGR(contour) < 0); + if (ret == 0 && ARGR(contour) >= 0) + ret = pwc_ioctl_s_ctrl(pdev->contour, ARGR(contour)); break; } case VIDIOCPWCGCONTOUR: { ARG_DEF(int, contour) - - ret = pwc_get_contour(pdev, ARGA(contour)); + if (v4l2_ctrl_g_ctrl(pdev->autocontour)) + ARGR(contour) = -1; + else + ARGR(contour) = pwc_ioctl_g_ctrl(pdev->contour); ARG_OUT(contour) break; } @@ -1567,17 +1030,15 @@ long pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) case VIDIOCPWCSBACKLIGHT: { ARG_DEF(int, backlight) - ARG_IN(backlight) - ret = pwc_set_backlight(pdev, ARGR(backlight)); + ret = v4l2_ctrl_s_ctrl(pdev->backlight, ARGR(backlight)); break; } case VIDIOCPWCGBACKLIGHT: { ARG_DEF(int, backlight) - - ret = pwc_get_backlight(pdev, ARGA(backlight)); + ARGR(backlight) = v4l2_ctrl_g_ctrl(pdev->backlight); ARG_OUT(backlight) break; } @@ -1585,17 +1046,15 @@ long pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) case VIDIOCPWCSFLICKER: { ARG_DEF(int, flicker) - ARG_IN(flicker) - ret = pwc_set_flicker(pdev, ARGR(flicker)); + ret = v4l2_ctrl_s_ctrl(pdev->flicker, ARGR(flicker)); break; } case VIDIOCPWCGFLICKER: { ARG_DEF(int, flicker) - - ret = pwc_get_flicker(pdev, ARGA(flicker)); + ARGR(flicker) = v4l2_ctrl_g_ctrl(pdev->flicker); ARG_OUT(flicker) break; } @@ -1603,17 +1062,15 @@ long pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) case VIDIOCPWCSDYNNOISE: { ARG_DEF(int, dynnoise) - ARG_IN(dynnoise) - ret = pwc_set_dynamic_noise(pdev, ARGR(dynnoise)); + ret = v4l2_ctrl_s_ctrl(pdev->noise_reduction, ARGR(dynnoise)); break; } case VIDIOCPWCGDYNNOISE: { ARG_DEF(int, dynnoise) - - ret = pwc_get_dynamic_noise(pdev, ARGA(dynnoise)); + ARGR(dynnoise) = v4l2_ctrl_g_ctrl(pdev->noise_reduction); ARG_OUT(dynnoise); break; } diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index 4c1c056ffdf4..1d5a6db915fa 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c @@ -679,6 +679,8 @@ static void pwc_video_release(struct video_device *vfd) pdev->decompress_data = NULL; } + v4l2_ctrl_handler_free(&pdev->ctrl_handler); + kfree(pdev); } @@ -1224,9 +1226,14 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id if (rc) goto err_free_mem; - /* Initialize the webcam to sane values */ - pwc_set_brightness(pdev, 0x7fff); - pwc_set_agc(pdev, 1, 0); + /* Register controls (and read default values from camera */ + rc = pwc_init_controls(pdev); + if (rc) { + PWC_ERROR("Failed to register v4l2 controls (%d).\n", rc); + goto err_free_mem; + } + + pdev->vdev.ctrl_handler = &pdev->ctrl_handler; /* And powerdown the camera until streaming starts */ pwc_camera_power(pdev, 0); @@ -1234,7 +1241,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id rc = video_register_device(&pdev->vdev, VFL_TYPE_GRABBER, video_nr); if (rc < 0) { PWC_ERROR("Failed to register as video device (%d).\n", rc); - goto err_free_mem; + goto err_free_controls; } rc = pwc_create_sysfs_files(pdev); if (rc) @@ -1277,7 +1284,10 @@ err_video_unreg: if (hint < MAX_DEV_HINTS) device_hint[hint].pdev = NULL; video_unregister_device(&pdev->vdev); +err_free_controls: + v4l2_ctrl_handler_free(&pdev->ctrl_handler); err_free_mem: + usb_set_intfdata(intf, NULL); kfree(pdev); return rc; } diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c index 834055b71e04..986dd5d6187a 100644 --- a/drivers/media/video/pwc/pwc-v4l.c +++ b/drivers/media/video/pwc/pwc-v4l.c @@ -2,6 +2,7 @@ USB and Video4Linux interface part. (C) 1999-2004 Nemosoft Unv. (C) 2004-2006 Luc Saillard (luc@saillard.org) + (C) 2011 Hans de Goede NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx driver and thus may have bugs that are not present in the original version. @@ -31,184 +32,314 @@ #include #include #include +#include #include #include "pwc.h" -static struct v4l2_queryctrl pwc_controls[] = { - { - .id = V4L2_CID_BRIGHTNESS, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Brightness", - .minimum = 0, - .maximum = 128, - .step = 1, - .default_value = 64, - }, - { - .id = V4L2_CID_CONTRAST, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Contrast", - .minimum = 0, - .maximum = 64, - .step = 1, - .default_value = 0, - }, - { - .id = V4L2_CID_SATURATION, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Saturation", - .minimum = -100, - .maximum = 100, - .step = 1, - .default_value = 0, - }, - { - .id = V4L2_CID_GAMMA, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Gamma", - .minimum = 0, - .maximum = 32, - .step = 1, - .default_value = 0, - }, - { - .id = V4L2_CID_RED_BALANCE, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Red Gain", - .minimum = 0, - .maximum = 256, - .step = 1, - .default_value = 0, - }, - { - .id = V4L2_CID_BLUE_BALANCE, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Blue Gain", - .minimum = 0, - .maximum = 256, - .step = 1, - .default_value = 0, - }, - { - .id = V4L2_CID_AUTO_WHITE_BALANCE, - .type = V4L2_CTRL_TYPE_BOOLEAN, - .name = "Auto White Balance", - .minimum = 0, - .maximum = 1, - .step = 1, - .default_value = 0, - }, - { - .id = V4L2_CID_EXPOSURE, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Shutter Speed (Exposure)", - .minimum = 0, - .maximum = 256, - .step = 1, - .default_value = 200, - }, - { - .id = V4L2_CID_AUTOGAIN, - .type = V4L2_CTRL_TYPE_BOOLEAN, - .name = "Auto Gain Enabled", - .minimum = 0, - .maximum = 1, - .step = 1, - .default_value = 1, - }, - { - .id = V4L2_CID_GAIN, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Gain Level", - .minimum = 0, - .maximum = 256, - .step = 1, - .default_value = 0, - }, - { - .id = V4L2_CID_PRIVATE_SAVE_USER, - .type = V4L2_CTRL_TYPE_BUTTON, - .name = "Save User Settings", - .minimum = 0, - .maximum = 0, - .step = 0, - .default_value = 0, - }, - { - .id = V4L2_CID_PRIVATE_RESTORE_USER, - .type = V4L2_CTRL_TYPE_BUTTON, - .name = "Restore User Settings", - .minimum = 0, - .maximum = 0, - .step = 0, - .default_value = 0, - }, - { - .id = V4L2_CID_PRIVATE_RESTORE_FACTORY, - .type = V4L2_CTRL_TYPE_BUTTON, - .name = "Restore Factory Settings", - .minimum = 0, - .maximum = 0, - .step = 0, - .default_value = 0, - }, - { - .id = V4L2_CID_PRIVATE_COLOUR_MODE, - .type = V4L2_CTRL_TYPE_BOOLEAN, - .name = "Colour mode", - .minimum = 0, - .maximum = 1, - .step = 1, - .default_value = 0, - }, - { - .id = V4L2_CID_PRIVATE_AUTOCONTOUR, - .type = V4L2_CTRL_TYPE_BOOLEAN, - .name = "Auto contour", - .minimum = 0, - .maximum = 1, - .step = 1, - .default_value = 0, - }, - { - .id = V4L2_CID_PRIVATE_CONTOUR, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Contour", - .minimum = 0, - .maximum = 63, - .step = 1, - .default_value = 0, - }, - { - .id = V4L2_CID_PRIVATE_BACKLIGHT, - .type = V4L2_CTRL_TYPE_BOOLEAN, - .name = "Backlight compensation", - .minimum = 0, - .maximum = 1, - .step = 1, - .default_value = 0, - }, - { - .id = V4L2_CID_PRIVATE_FLICKERLESS, - .type = V4L2_CTRL_TYPE_BOOLEAN, - .name = "Flickerless", - .minimum = 0, - .maximum = 1, - .step = 1, - .default_value = 0, - }, - { - .id = V4L2_CID_PRIVATE_NOISE_REDUCTION, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Noise reduction", - .minimum = 0, - .maximum = 3, - .step = 1, - .default_value = 0, - }, +#define PWC_CID_CUSTOM(ctrl) ((V4L2_CID_USER_BASE | 0xf000) + custom_ ## ctrl) + +static int pwc_g_volatile_ctrl(struct v4l2_ctrl *ctrl); +static int pwc_s_ctrl(struct v4l2_ctrl *ctrl); + +static const struct v4l2_ctrl_ops pwc_ctrl_ops = { + .g_volatile_ctrl = pwc_g_volatile_ctrl, + .s_ctrl = pwc_s_ctrl, +}; + +enum { awb_indoor, awb_outdoor, awb_fl, awb_manual, awb_auto }; +enum { custom_autocontour, custom_contour, custom_noise_reduction, + custom_save_user, custom_restore_user, custom_restore_factory }; + +const char * const pwc_auto_whitebal_qmenu[] = { + "Indoor (Incandescant Lighting) Mode", + "Outdoor (Sunlight) Mode", + "Indoor (Fluorescent Lighting) Mode", + "Manual Mode", + "Auto Mode", + NULL +}; + +static const struct v4l2_ctrl_config pwc_auto_white_balance_cfg = { + .ops = &pwc_ctrl_ops, + .id = V4L2_CID_AUTO_WHITE_BALANCE, + .type = V4L2_CTRL_TYPE_MENU, + .max = awb_auto, + .qmenu = pwc_auto_whitebal_qmenu, +}; + +static const struct v4l2_ctrl_config pwc_autocontour_cfg = { + .ops = &pwc_ctrl_ops, + .id = PWC_CID_CUSTOM(autocontour), + .type = V4L2_CTRL_TYPE_BOOLEAN, + .name = "Auto contour", + .min = 0, + .max = 1, + .step = 1, +}; + +static const struct v4l2_ctrl_config pwc_contour_cfg = { + .ops = &pwc_ctrl_ops, + .id = PWC_CID_CUSTOM(contour), + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Contour", + .min = 0, + .max = 63, + .step = 1, +}; + +static const struct v4l2_ctrl_config pwc_backlight_cfg = { + .ops = &pwc_ctrl_ops, + .id = V4L2_CID_BACKLIGHT_COMPENSATION, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .min = 0, + .max = 1, + .step = 1, }; +static const struct v4l2_ctrl_config pwc_flicker_cfg = { + .ops = &pwc_ctrl_ops, + .id = V4L2_CID_BAND_STOP_FILTER, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .min = 0, + .max = 1, + .step = 1, +}; + +static const struct v4l2_ctrl_config pwc_noise_reduction_cfg = { + .ops = &pwc_ctrl_ops, + .id = PWC_CID_CUSTOM(noise_reduction), + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Dynamic Noise Reduction", + .min = 0, + .max = 3, + .step = 1, +}; + +static const struct v4l2_ctrl_config pwc_save_user_cfg = { + .ops = &pwc_ctrl_ops, + .id = PWC_CID_CUSTOM(save_user), + .type = V4L2_CTRL_TYPE_BUTTON, + .name = "Save User Settings", +}; + +static const struct v4l2_ctrl_config pwc_restore_user_cfg = { + .ops = &pwc_ctrl_ops, + .id = PWC_CID_CUSTOM(restore_user), + .type = V4L2_CTRL_TYPE_BUTTON, + .name = "Restore User Settings", +}; + +static const struct v4l2_ctrl_config pwc_restore_factory_cfg = { + .ops = &pwc_ctrl_ops, + .id = PWC_CID_CUSTOM(restore_factory), + .type = V4L2_CTRL_TYPE_BUTTON, + .name = "Restore Factory Settings", +}; + +int pwc_init_controls(struct pwc_device *pdev) +{ + struct v4l2_ctrl_handler *hdl; + struct v4l2_ctrl_config cfg; + int r, def; + + hdl = &pdev->ctrl_handler; + r = v4l2_ctrl_handler_init(hdl, 20); + if (r) + return r; + + /* Brightness, contrast, saturation, gamma */ + r = pwc_get_u8_ctrl(pdev, GET_LUM_CTL, BRIGHTNESS_FORMATTER, &def); + if (r || def > 127) + def = 63; + pdev->brightness = v4l2_ctrl_new_std(hdl, &pwc_ctrl_ops, + V4L2_CID_BRIGHTNESS, 0, 127, 1, def); + + r = pwc_get_u8_ctrl(pdev, GET_LUM_CTL, CONTRAST_FORMATTER, &def); + if (r || def > 63) + def = 31; + pdev->contrast = v4l2_ctrl_new_std(hdl, &pwc_ctrl_ops, + V4L2_CID_CONTRAST, 0, 63, 1, def); + + if (pdev->type >= 675) { + if (pdev->type < 730) + pdev->saturation_fmt = SATURATION_MODE_FORMATTER2; + else + pdev->saturation_fmt = SATURATION_MODE_FORMATTER1; + r = pwc_get_s8_ctrl(pdev, GET_CHROM_CTL, pdev->saturation_fmt, + &def); + if (r || def < -100 || def > 100) + def = 0; + pdev->saturation = v4l2_ctrl_new_std(hdl, &pwc_ctrl_ops, + V4L2_CID_SATURATION, -100, 100, 1, def); + } + + r = pwc_get_u8_ctrl(pdev, GET_LUM_CTL, GAMMA_FORMATTER, &def); + if (r || def > 31) + def = 15; + pdev->gamma = v4l2_ctrl_new_std(hdl, &pwc_ctrl_ops, + V4L2_CID_GAMMA, 0, 31, 1, def); + + /* auto white balance, red gain, blue gain */ + r = pwc_get_u8_ctrl(pdev, GET_CHROM_CTL, WB_MODE_FORMATTER, &def); + if (r || def > awb_auto) + def = awb_auto; + cfg = pwc_auto_white_balance_cfg; + cfg.name = v4l2_ctrl_get_name(cfg.id); + cfg.def = def; + pdev->auto_white_balance = v4l2_ctrl_new_custom(hdl, &cfg, NULL); + /* check auto controls to avoid NULL deref in v4l2_ctrl_auto_cluster */ + if (!pdev->auto_white_balance) + return hdl->error; + + r = pwc_get_u8_ctrl(pdev, GET_CHROM_CTL, + PRESET_MANUAL_RED_GAIN_FORMATTER, &def); + if (r) + def = 127; + pdev->red_balance = v4l2_ctrl_new_std(hdl, &pwc_ctrl_ops, + V4L2_CID_RED_BALANCE, 0, 255, 1, def); + + r = pwc_get_u8_ctrl(pdev, GET_CHROM_CTL, + PRESET_MANUAL_BLUE_GAIN_FORMATTER, &def); + if (r) + def = 127; + pdev->blue_balance = v4l2_ctrl_new_std(hdl, &pwc_ctrl_ops, + V4L2_CID_BLUE_BALANCE, 0, 255, 1, def); + + v4l2_ctrl_auto_cluster(3, &pdev->auto_white_balance, awb_manual, + pdev->auto_white_balance->cur.val == awb_auto); + + /* autogain, gain */ + r = pwc_get_u8_ctrl(pdev, GET_LUM_CTL, AGC_MODE_FORMATTER, &def); + if (r || (def != 0 && def != 0xff)) + def = 0; + /* Note a register value if 0 means auto gain is on */ + pdev->autogain = v4l2_ctrl_new_std(hdl, &pwc_ctrl_ops, + V4L2_CID_AUTOGAIN, 0, 1, 1, def == 0); + if (!pdev->autogain) + return hdl->error; + + r = pwc_get_u8_ctrl(pdev, GET_LUM_CTL, PRESET_AGC_FORMATTER, &def); + if (r || def > 63) + def = 31; + pdev->gain = v4l2_ctrl_new_std(hdl, &pwc_ctrl_ops, + V4L2_CID_GAIN, 0, 63, 1, def); + + /* auto exposure, exposure */ + if (DEVICE_USE_CODEC2(pdev->type)) { + r = pwc_get_u8_ctrl(pdev, GET_LUM_CTL, SHUTTER_MODE_FORMATTER, + &def); + if (r || (def != 0 && def != 0xff)) + def = 0; + /* + * def = 0 auto, def = ff manual + * menu idx 0 = auto, idx 1 = manual + */ + pdev->exposure_auto = v4l2_ctrl_new_std_menu(hdl, + &pwc_ctrl_ops, + V4L2_CID_EXPOSURE_AUTO, + 1, 0, def != 0); + if (!pdev->exposure_auto) + return hdl->error; + + /* GET_LUM_CTL, PRESET_SHUTTER_FORMATTER is unreliable */ + r = pwc_get_u16_ctrl(pdev, GET_STATUS_CTL, + READ_SHUTTER_FORMATTER, &def); + if (r || def > 655) + def = 655; + pdev->exposure = v4l2_ctrl_new_std(hdl, &pwc_ctrl_ops, + V4L2_CID_EXPOSURE, 0, 655, 1, def); + /* CODEC2: separate auto gain & auto exposure */ + v4l2_ctrl_auto_cluster(2, &pdev->autogain, 0, true); + v4l2_ctrl_auto_cluster(2, &pdev->exposure_auto, + V4L2_EXPOSURE_MANUAL, true); + } else if (DEVICE_USE_CODEC3(pdev->type)) { + /* GET_LUM_CTL, PRESET_SHUTTER_FORMATTER is unreliable */ + r = pwc_get_u16_ctrl(pdev, GET_STATUS_CTL, + READ_SHUTTER_FORMATTER, &def); + if (r || def > 255) + def = 255; + pdev->exposure = v4l2_ctrl_new_std(hdl, &pwc_ctrl_ops, + V4L2_CID_EXPOSURE, 0, 255, 1, def); + /* CODEC3: both gain and exposure controlled by autogain */ + pdev->autogain_expo_cluster[0] = pdev->autogain; + pdev->autogain_expo_cluster[1] = pdev->gain; + pdev->autogain_expo_cluster[2] = pdev->exposure; + v4l2_ctrl_auto_cluster(3, pdev->autogain_expo_cluster, + 0, true); + } + + /* color / bw setting */ + r = pwc_get_u8_ctrl(pdev, GET_CHROM_CTL, COLOUR_MODE_FORMATTER, + &def); + if (r || (def != 0 && def != 0xff)) + def = 0xff; + /* def = 0 bw, def = ff color, menu idx 0 = color, idx 1 = bw */ + pdev->colorfx = v4l2_ctrl_new_std_menu(hdl, &pwc_ctrl_ops, + V4L2_CID_COLORFX, 1, 0, def == 0); + + /* autocontour, contour */ + r = pwc_get_u8_ctrl(pdev, GET_LUM_CTL, AUTO_CONTOUR_FORMATTER, &def); + if (r || (def != 0 && def != 0xff)) + def = 0; + cfg = pwc_autocontour_cfg; + cfg.def = def == 0; + pdev->autocontour = v4l2_ctrl_new_custom(hdl, &cfg, NULL); + if (!pdev->autocontour) + return hdl->error; + + r = pwc_get_u8_ctrl(pdev, GET_LUM_CTL, PRESET_CONTOUR_FORMATTER, &def); + if (r || def > 63) + def = 31; + cfg = pwc_contour_cfg; + cfg.def = def; + pdev->contour = v4l2_ctrl_new_custom(hdl, &cfg, NULL); + + v4l2_ctrl_auto_cluster(2, &pdev->autocontour, 0, false); + + /* backlight */ + r = pwc_get_u8_ctrl(pdev, GET_LUM_CTL, + BACK_LIGHT_COMPENSATION_FORMATTER, &def); + if (r || (def != 0 && def != 0xff)) + def = 0; + cfg = pwc_backlight_cfg; + cfg.name = v4l2_ctrl_get_name(cfg.id); + cfg.def = def == 0; + pdev->backlight = v4l2_ctrl_new_custom(hdl, &cfg, NULL); + + /* flikker rediction */ + r = pwc_get_u8_ctrl(pdev, GET_LUM_CTL, + FLICKERLESS_MODE_FORMATTER, &def); + if (r || (def != 0 && def != 0xff)) + def = 0; + cfg = pwc_flicker_cfg; + cfg.name = v4l2_ctrl_get_name(cfg.id); + cfg.def = def == 0; + pdev->flicker = v4l2_ctrl_new_custom(hdl, &cfg, NULL); + + /* Dynamic noise reduction */ + r = pwc_get_u8_ctrl(pdev, GET_LUM_CTL, + DYNAMIC_NOISE_CONTROL_FORMATTER, &def); + if (r || def > 3) + def = 2; + cfg = pwc_noise_reduction_cfg; + cfg.def = def; + pdev->noise_reduction = v4l2_ctrl_new_custom(hdl, &cfg, NULL); + + /* Save / Restore User / Factory Settings */ + pdev->save_user = v4l2_ctrl_new_custom(hdl, &pwc_save_user_cfg, NULL); + pdev->restore_user = v4l2_ctrl_new_custom(hdl, &pwc_restore_user_cfg, + NULL); + if (pdev->restore_user) + pdev->restore_user->flags = V4L2_CTRL_FLAG_UPDATE; + pdev->restore_factory = v4l2_ctrl_new_custom(hdl, + &pwc_restore_factory_cfg, + NULL); + if (pdev->restore_factory) + pdev->restore_factory->flags = V4L2_CTRL_FLAG_UPDATE; + + return hdl->error; +} static void pwc_vidioc_fill_fmt(const struct pwc_device *pdev, struct v4l2_format *f) { @@ -354,14 +485,13 @@ static int pwc_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f) static int pwc_querycap(struct file *file, void *fh, struct v4l2_capability *cap) { - struct video_device *vdev = video_devdata(file); struct pwc_device *pdev = video_drvdata(file); if (!pdev->udev) return -ENODEV; strcpy(cap->driver, PWC_NAME); - strlcpy(cap->card, vdev->name, sizeof(cap->card)); + strlcpy(cap->card, pdev->vdev.name, sizeof(cap->card)); usb_make_path(pdev->udev, cap->bus_info, sizeof(cap->bus_info)); cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | @@ -390,261 +520,328 @@ static int pwc_s_input(struct file *file, void *fh, unsigned int i) return i ? -EINVAL : 0; } -static int pwc_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *c) +static int pwc_g_volatile_ctrl(struct v4l2_ctrl *ctrl) { - int i, idx; - u32 id; - - id = c->id; - if (id & V4L2_CTRL_FLAG_NEXT_CTRL) { - id &= V4L2_CTRL_ID_MASK; - id++; - idx = -1; - for (i = 0; i < ARRAY_SIZE(pwc_controls); i++) { - if (pwc_controls[i].id < id) - continue; - if (idx >= 0 - && pwc_controls[i].id > pwc_controls[idx].id) - continue; - idx = i; + struct pwc_device *pdev = + container_of(ctrl->handler, struct pwc_device, ctrl_handler); + int ret = 0; + + if (!pdev->udev) + return -ENODEV; + + switch (ctrl->id) { + case V4L2_CID_AUTO_WHITE_BALANCE: + if (pdev->color_bal_valid && time_before(jiffies, + pdev->last_color_bal_update + HZ / 4)) { + pdev->red_balance->val = pdev->last_red_balance; + pdev->blue_balance->val = pdev->last_blue_balance; + break; } - if (idx < 0) - return -EINVAL; - memcpy(c, &pwc_controls[idx], sizeof pwc_controls[0]); - return 0; - } - for (i = 0; i < sizeof(pwc_controls) / sizeof(struct v4l2_queryctrl); i++) { - if (pwc_controls[i].id == c->id) { - PWC_DEBUG_IOCTL("ioctl(VIDIOC_QUERYCTRL) found\n"); - memcpy(c, &pwc_controls[i], sizeof(struct v4l2_queryctrl)); - return 0; + ret = pwc_get_u8_ctrl(pdev, GET_STATUS_CTL, + READ_RED_GAIN_FORMATTER, + &pdev->red_balance->val); + if (ret) + break; + ret = pwc_get_u8_ctrl(pdev, GET_STATUS_CTL, + READ_BLUE_GAIN_FORMATTER, + &pdev->blue_balance->val); + if (ret) + break; + pdev->last_red_balance = pdev->red_balance->val; + pdev->last_blue_balance = pdev->blue_balance->val; + pdev->last_color_bal_update = jiffies; + pdev->color_bal_valid = true; + break; + case V4L2_CID_AUTOGAIN: + if (pdev->gain_valid && time_before(jiffies, + pdev->last_gain_update + HZ / 4)) { + pdev->gain->val = pdev->last_gain; + break; } + ret = pwc_get_u8_ctrl(pdev, GET_STATUS_CTL, + READ_AGC_FORMATTER, &pdev->gain->val); + if (ret) + break; + pdev->last_gain = pdev->gain->val; + pdev->last_gain_update = jiffies; + pdev->gain_valid = true; + if (!DEVICE_USE_CODEC3(pdev->type)) + break; + /* Fall through for CODEC3 where autogain also controls expo */ + case V4L2_CID_EXPOSURE_AUTO: + if (pdev->exposure_valid && time_before(jiffies, + pdev->last_exposure_update + HZ / 4)) { + pdev->exposure->val = pdev->last_exposure; + break; + } + ret = pwc_get_u16_ctrl(pdev, GET_STATUS_CTL, + READ_SHUTTER_FORMATTER, + &pdev->exposure->val); + if (ret) + break; + pdev->last_exposure = pdev->exposure->val; + pdev->last_exposure_update = jiffies; + pdev->exposure_valid = true; + break; + default: + ret = -EINVAL; } - return -EINVAL; + + if (ret) + PWC_ERROR("g_ctrl %s error %d\n", ctrl->name, ret); + + return ret; } -static int pwc_g_ctrl(struct file *file, void *fh, struct v4l2_control *c) +static int pwc_set_awb(struct pwc_device *pdev) { - struct pwc_device *pdev = video_drvdata(file); - int ret; + int ret = 0; + + if (pdev->auto_white_balance->is_new) { + ret = pwc_set_u8_ctrl(pdev, SET_CHROM_CTL, + WB_MODE_FORMATTER, + pdev->auto_white_balance->val); + if (ret) + return ret; + + /* Update val when coming from auto or going to a preset */ + if (pdev->red_balance->is_volatile || + pdev->auto_white_balance->val == awb_indoor || + pdev->auto_white_balance->val == awb_outdoor || + pdev->auto_white_balance->val == awb_fl) { + if (!pdev->red_balance->is_new) + pwc_get_u8_ctrl(pdev, GET_STATUS_CTL, + READ_RED_GAIN_FORMATTER, + &pdev->red_balance->val); + if (!pdev->blue_balance->is_new) + pwc_get_u8_ctrl(pdev, GET_STATUS_CTL, + READ_BLUE_GAIN_FORMATTER, + &pdev->blue_balance->val); + } + if (pdev->auto_white_balance->val == awb_auto) { + pdev->red_balance->is_volatile = true; + pdev->blue_balance->is_volatile = true; + pdev->color_bal_valid = false; /* Force cache update */ + } else { + pdev->red_balance->is_volatile = false; + pdev->blue_balance->is_volatile = false; + } + } - if (!pdev->udev) - return -ENODEV; + if (ret == 0 && pdev->red_balance->is_new) { + if (pdev->auto_white_balance->val != awb_manual) + return -EBUSY; + ret = pwc_set_u8_ctrl(pdev, SET_CHROM_CTL, + PRESET_MANUAL_RED_GAIN_FORMATTER, + pdev->red_balance->val); + } - switch (c->id) { - case V4L2_CID_BRIGHTNESS: - c->value = pwc_get_brightness(pdev); - if (c->value < 0) - return -EINVAL; - return 0; - case V4L2_CID_CONTRAST: - c->value = pwc_get_contrast(pdev); - if (c->value < 0) - return -EINVAL; - return 0; - case V4L2_CID_SATURATION: - ret = pwc_get_saturation(pdev, &c->value); - if (ret < 0) - return -EINVAL; - return 0; - case V4L2_CID_GAMMA: - c->value = pwc_get_gamma(pdev); - if (c->value < 0) - return -EINVAL; - return 0; - case V4L2_CID_RED_BALANCE: - ret = pwc_get_red_gain(pdev, &c->value); - if (ret < 0) - return -EINVAL; - c->value >>= 8; - return 0; - case V4L2_CID_BLUE_BALANCE: - ret = pwc_get_blue_gain(pdev, &c->value); - if (ret < 0) - return -EINVAL; - c->value >>= 8; - return 0; - case V4L2_CID_AUTO_WHITE_BALANCE: - ret = pwc_get_awb(pdev); - if (ret < 0) - return -EINVAL; - c->value = (ret == PWC_WB_MANUAL) ? 0 : 1; - return 0; - case V4L2_CID_GAIN: - ret = pwc_get_agc(pdev, &c->value); - if (ret < 0) - return -EINVAL; - c->value >>= 8; - return 0; - case V4L2_CID_AUTOGAIN: - ret = pwc_get_agc(pdev, &c->value); - if (ret < 0) - return -EINVAL; - c->value = (c->value < 0) ? 1 : 0; - return 0; - case V4L2_CID_EXPOSURE: - ret = pwc_get_shutter_speed(pdev, &c->value); - if (ret < 0) - return -EINVAL; - return 0; - case V4L2_CID_PRIVATE_COLOUR_MODE: - ret = pwc_get_colour_mode(pdev, &c->value); - if (ret < 0) - return -EINVAL; - return 0; - case V4L2_CID_PRIVATE_AUTOCONTOUR: - ret = pwc_get_contour(pdev, &c->value); - if (ret < 0) - return -EINVAL; - c->value = (c->value == -1 ? 1 : 0); - return 0; - case V4L2_CID_PRIVATE_CONTOUR: - ret = pwc_get_contour(pdev, &c->value); - if (ret < 0) - return -EINVAL; - c->value >>= 10; - return 0; - case V4L2_CID_PRIVATE_BACKLIGHT: - ret = pwc_get_backlight(pdev, &c->value); - if (ret < 0) - return -EINVAL; - return 0; - case V4L2_CID_PRIVATE_FLICKERLESS: - ret = pwc_get_flicker(pdev, &c->value); - if (ret < 0) - return -EINVAL; - c->value = (c->value ? 1 : 0); - return 0; - case V4L2_CID_PRIVATE_NOISE_REDUCTION: - ret = pwc_get_dynamic_noise(pdev, &c->value); - if (ret < 0) - return -EINVAL; - return 0; + if (ret == 0 && pdev->blue_balance->is_new) { + if (pdev->auto_white_balance->val != awb_manual) + return -EBUSY; + ret = pwc_set_u8_ctrl(pdev, SET_CHROM_CTL, + PRESET_MANUAL_BLUE_GAIN_FORMATTER, + pdev->blue_balance->val); + } + return ret; +} - case V4L2_CID_PRIVATE_SAVE_USER: - case V4L2_CID_PRIVATE_RESTORE_USER: - case V4L2_CID_PRIVATE_RESTORE_FACTORY: - return -EINVAL; +/* For CODEC2 models which have separate autogain and auto exposure */ +static int pwc_set_autogain(struct pwc_device *pdev) +{ + int ret = 0; + + if (pdev->autogain->is_new) { + ret = pwc_set_u8_ctrl(pdev, SET_LUM_CTL, + AGC_MODE_FORMATTER, + pdev->autogain->val ? 0 : 0xff); + if (ret) + return ret; + if (pdev->autogain->val) + pdev->gain_valid = false; /* Force cache update */ + else if (!pdev->gain->is_new) + pwc_get_u8_ctrl(pdev, GET_STATUS_CTL, + READ_AGC_FORMATTER, + &pdev->gain->val); } - return -EINVAL; + if (ret == 0 && pdev->gain->is_new) { + if (pdev->autogain->val) + return -EBUSY; + ret = pwc_set_u8_ctrl(pdev, SET_LUM_CTL, + PRESET_AGC_FORMATTER, + pdev->gain->val); + } + return ret; } -static int pwc_s_ctrl(struct file *file, void *fh, struct v4l2_control *c) +/* For CODEC2 models which have separate autogain and auto exposure */ +static int pwc_set_exposure_auto(struct pwc_device *pdev) { - struct pwc_device *pdev = video_drvdata(file); - int ret; + int ret = 0; + int is_auto = pdev->exposure_auto->val == V4L2_EXPOSURE_AUTO; + + if (pdev->exposure_auto->is_new) { + ret = pwc_set_u8_ctrl(pdev, SET_LUM_CTL, + SHUTTER_MODE_FORMATTER, + is_auto ? 0 : 0xff); + if (ret) + return ret; + if (is_auto) + pdev->exposure_valid = false; /* Force cache update */ + else if (!pdev->exposure->is_new) + pwc_get_u16_ctrl(pdev, GET_STATUS_CTL, + READ_SHUTTER_FORMATTER, + &pdev->exposure->val); + } + if (ret == 0 && pdev->exposure->is_new) { + if (is_auto) + return -EBUSY; + ret = pwc_set_u16_ctrl(pdev, SET_LUM_CTL, + PRESET_SHUTTER_FORMATTER, + pdev->exposure->val); + } + return ret; +} + +/* For CODEC3 models which have autogain controlling both gain and exposure */ +static int pwc_set_autogain_expo(struct pwc_device *pdev) +{ + int ret = 0; + + if (pdev->autogain->is_new) { + ret = pwc_set_u8_ctrl(pdev, SET_LUM_CTL, + AGC_MODE_FORMATTER, + pdev->autogain->val ? 0 : 0xff); + if (ret) + return ret; + if (pdev->autogain->val) { + pdev->gain_valid = false; /* Force cache update */ + pdev->exposure_valid = false; /* Force cache update */ + } else { + if (!pdev->gain->is_new) + pwc_get_u8_ctrl(pdev, GET_STATUS_CTL, + READ_AGC_FORMATTER, + &pdev->gain->val); + if (!pdev->exposure->is_new) + pwc_get_u16_ctrl(pdev, GET_STATUS_CTL, + READ_SHUTTER_FORMATTER, + &pdev->exposure->val); + } + } + if (ret == 0 && pdev->gain->is_new) { + if (pdev->autogain->val) + return -EBUSY; + ret = pwc_set_u8_ctrl(pdev, SET_LUM_CTL, + PRESET_AGC_FORMATTER, + pdev->gain->val); + } + if (ret == 0 && pdev->exposure->is_new) { + if (pdev->autogain->val) + return -EBUSY; + ret = pwc_set_u16_ctrl(pdev, SET_LUM_CTL, + PRESET_SHUTTER_FORMATTER, + pdev->exposure->val); + } + return ret; +} + +static int pwc_s_ctrl(struct v4l2_ctrl *ctrl) +{ + struct pwc_device *pdev = + container_of(ctrl->handler, struct pwc_device, ctrl_handler); + int ret = 0; if (!pdev->udev) return -ENODEV; - switch (c->id) { + switch (ctrl->id) { case V4L2_CID_BRIGHTNESS: - c->value <<= 9; - ret = pwc_set_brightness(pdev, c->value); - if (ret < 0) - return -EINVAL; - return 0; + ret = pwc_set_u8_ctrl(pdev, SET_LUM_CTL, + BRIGHTNESS_FORMATTER, ctrl->val); + break; case V4L2_CID_CONTRAST: - c->value <<= 10; - ret = pwc_set_contrast(pdev, c->value); - if (ret < 0) - return -EINVAL; - return 0; + ret = pwc_set_u8_ctrl(pdev, SET_LUM_CTL, + CONTRAST_FORMATTER, ctrl->val); + break; case V4L2_CID_SATURATION: - ret = pwc_set_saturation(pdev, c->value); - if (ret < 0) - return -EINVAL; - return 0; + ret = pwc_set_s8_ctrl(pdev, SET_CHROM_CTL, + pdev->saturation_fmt, ctrl->val); + break; case V4L2_CID_GAMMA: - c->value <<= 11; - ret = pwc_set_gamma(pdev, c->value); - if (ret < 0) - return -EINVAL; - return 0; - case V4L2_CID_RED_BALANCE: - c->value <<= 8; - ret = pwc_set_red_gain(pdev, c->value); - if (ret < 0) - return -EINVAL; - return 0; - case V4L2_CID_BLUE_BALANCE: - c->value <<= 8; - ret = pwc_set_blue_gain(pdev, c->value); - if (ret < 0) - return -EINVAL; - return 0; + ret = pwc_set_u8_ctrl(pdev, SET_LUM_CTL, + GAMMA_FORMATTER, ctrl->val); + break; case V4L2_CID_AUTO_WHITE_BALANCE: - c->value = (c->value == 0) ? PWC_WB_MANUAL : PWC_WB_AUTO; - ret = pwc_set_awb(pdev, c->value); - if (ret < 0) - return -EINVAL; - return 0; - case V4L2_CID_EXPOSURE: - c->value <<= 8; - ret = pwc_set_shutter_speed(pdev, c->value ? 0 : 1, c->value); - if (ret < 0) - return -EINVAL; - return 0; + ret = pwc_set_awb(pdev); + break; case V4L2_CID_AUTOGAIN: - /* autogain off means nothing without a gain */ - if (c->value == 0) - return 0; - ret = pwc_set_agc(pdev, c->value, 0); - if (ret < 0) - return -EINVAL; - return 0; - case V4L2_CID_GAIN: - c->value <<= 8; - ret = pwc_set_agc(pdev, 0, c->value); - if (ret < 0) - return -EINVAL; - return 0; - case V4L2_CID_PRIVATE_SAVE_USER: - if (pwc_save_user(pdev)) - return -EINVAL; - return 0; - case V4L2_CID_PRIVATE_RESTORE_USER: - if (pwc_restore_user(pdev)) - return -EINVAL; - return 0; - case V4L2_CID_PRIVATE_RESTORE_FACTORY: - if (pwc_restore_factory(pdev)) - return -EINVAL; - return 0; - case V4L2_CID_PRIVATE_COLOUR_MODE: - ret = pwc_set_colour_mode(pdev, c->value); - if (ret < 0) - return -EINVAL; - return 0; - case V4L2_CID_PRIVATE_AUTOCONTOUR: - c->value = (c->value == 1) ? -1 : 0; - ret = pwc_set_contour(pdev, c->value); - if (ret < 0) - return -EINVAL; - return 0; - case V4L2_CID_PRIVATE_CONTOUR: - c->value <<= 10; - ret = pwc_set_contour(pdev, c->value); - if (ret < 0) - return -EINVAL; - return 0; - case V4L2_CID_PRIVATE_BACKLIGHT: - ret = pwc_set_backlight(pdev, c->value); - if (ret < 0) - return -EINVAL; - return 0; - case V4L2_CID_PRIVATE_FLICKERLESS: - ret = pwc_set_flicker(pdev, c->value); - if (ret < 0) - return -EINVAL; - case V4L2_CID_PRIVATE_NOISE_REDUCTION: - ret = pwc_set_dynamic_noise(pdev, c->value); - if (ret < 0) - return -EINVAL; - return 0; - + if (DEVICE_USE_CODEC2(pdev->type)) + ret = pwc_set_autogain(pdev); + else if (DEVICE_USE_CODEC3(pdev->type)) + ret = pwc_set_autogain_expo(pdev); + else + ret = -EINVAL; + break; + case V4L2_CID_EXPOSURE_AUTO: + if (DEVICE_USE_CODEC2(pdev->type)) + ret = pwc_set_exposure_auto(pdev); + else + ret = -EINVAL; + break; + case V4L2_CID_COLORFX: + ret = pwc_set_u8_ctrl(pdev, SET_CHROM_CTL, + COLOUR_MODE_FORMATTER, + ctrl->val ? 0 : 0xff); + break; + case PWC_CID_CUSTOM(autocontour): + if (pdev->autocontour->is_new) { + ret = pwc_set_u8_ctrl(pdev, SET_LUM_CTL, + AUTO_CONTOUR_FORMATTER, + pdev->autocontour->val ? 0 : 0xff); + } + if (ret == 0 && pdev->contour->is_new) { + if (pdev->autocontour->val) { + ret = -EBUSY; + break; + } + ret = pwc_set_u8_ctrl(pdev, SET_LUM_CTL, + PRESET_CONTOUR_FORMATTER, + pdev->contour->val); + } + break; + case V4L2_CID_BACKLIGHT_COMPENSATION: + ret = pwc_set_u8_ctrl(pdev, SET_LUM_CTL, + BACK_LIGHT_COMPENSATION_FORMATTER, + ctrl->val ? 0 : 0xff); + break; + case V4L2_CID_BAND_STOP_FILTER: + ret = pwc_set_u8_ctrl(pdev, SET_LUM_CTL, + FLICKERLESS_MODE_FORMATTER, + ctrl->val ? 0 : 0xff); + break; + case PWC_CID_CUSTOM(noise_reduction): + ret = pwc_set_u8_ctrl(pdev, SET_LUM_CTL, + DYNAMIC_NOISE_CONTROL_FORMATTER, + ctrl->val); + break; + case PWC_CID_CUSTOM(save_user): + ret = pwc_button_ctrl(pdev, SAVE_USER_DEFAULTS_FORMATTER); + break; + case PWC_CID_CUSTOM(restore_user): + ret = pwc_button_ctrl(pdev, RESTORE_USER_DEFAULTS_FORMATTER); + break; + case PWC_CID_CUSTOM(restore_factory): + ret = pwc_button_ctrl(pdev, + RESTORE_FACTORY_DEFAULTS_FORMATTER); + break; + default: + ret = -EINVAL; } - return -EINVAL; + + if (ret) + PWC_ERROR("s_ctrl %s error %d\n", ctrl->name, ret); + + return ret; } static int pwc_enum_fmt_vid_cap(struct file *file, void *fh, struct v4l2_fmtdesc *f) @@ -835,9 +1032,6 @@ const struct v4l2_ioctl_ops pwc_ioctl_ops = { .vidioc_g_fmt_vid_cap = pwc_g_fmt_vid_cap, .vidioc_s_fmt_vid_cap = pwc_s_fmt_vid_cap, .vidioc_try_fmt_vid_cap = pwc_try_fmt_vid_cap, - .vidioc_queryctrl = pwc_queryctrl, - .vidioc_g_ctrl = pwc_g_ctrl, - .vidioc_s_ctrl = pwc_s_ctrl, .vidioc_reqbufs = pwc_reqbufs, .vidioc_querybuf = pwc_querybuf, .vidioc_qbuf = pwc_qbuf, diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h index 1cfb8b475a3f..601a549988b5 100644 --- a/drivers/media/video/pwc/pwc.h +++ b/drivers/media/video/pwc/pwc.h @@ -36,6 +36,7 @@ #include #include #include +#include #include #ifdef CONFIG_USB_PWC_INPUT_EVDEV #include @@ -128,6 +129,61 @@ #define DEVICE_USE_CODEC3(x) ((x)>=700) #define DEVICE_USE_CODEC23(x) ((x)>=675) +/* Request types: video */ +#define SET_LUM_CTL 0x01 +#define GET_LUM_CTL 0x02 +#define SET_CHROM_CTL 0x03 +#define GET_CHROM_CTL 0x04 +#define SET_STATUS_CTL 0x05 +#define GET_STATUS_CTL 0x06 +#define SET_EP_STREAM_CTL 0x07 +#define GET_EP_STREAM_CTL 0x08 +#define GET_XX_CTL 0x09 +#define SET_XX_CTL 0x0A +#define GET_XY_CTL 0x0B +#define SET_XY_CTL 0x0C +#define SET_MPT_CTL 0x0D +#define GET_MPT_CTL 0x0E + +/* Selectors for the Luminance controls [GS]ET_LUM_CTL */ +#define AGC_MODE_FORMATTER 0x2000 +#define PRESET_AGC_FORMATTER 0x2100 +#define SHUTTER_MODE_FORMATTER 0x2200 +#define PRESET_SHUTTER_FORMATTER 0x2300 +#define PRESET_CONTOUR_FORMATTER 0x2400 +#define AUTO_CONTOUR_FORMATTER 0x2500 +#define BACK_LIGHT_COMPENSATION_FORMATTER 0x2600 +#define CONTRAST_FORMATTER 0x2700 +#define DYNAMIC_NOISE_CONTROL_FORMATTER 0x2800 +#define FLICKERLESS_MODE_FORMATTER 0x2900 +#define AE_CONTROL_SPEED 0x2A00 +#define BRIGHTNESS_FORMATTER 0x2B00 +#define GAMMA_FORMATTER 0x2C00 + +/* Selectors for the Chrominance controls [GS]ET_CHROM_CTL */ +#define WB_MODE_FORMATTER 0x1000 +#define AWB_CONTROL_SPEED_FORMATTER 0x1100 +#define AWB_CONTROL_DELAY_FORMATTER 0x1200 +#define PRESET_MANUAL_RED_GAIN_FORMATTER 0x1300 +#define PRESET_MANUAL_BLUE_GAIN_FORMATTER 0x1400 +#define COLOUR_MODE_FORMATTER 0x1500 +#define SATURATION_MODE_FORMATTER1 0x1600 +#define SATURATION_MODE_FORMATTER2 0x1700 + +/* Selectors for the Status controls [GS]ET_STATUS_CTL */ +#define SAVE_USER_DEFAULTS_FORMATTER 0x0200 +#define RESTORE_USER_DEFAULTS_FORMATTER 0x0300 +#define RESTORE_FACTORY_DEFAULTS_FORMATTER 0x0400 +#define READ_AGC_FORMATTER 0x0500 +#define READ_SHUTTER_FORMATTER 0x0600 +#define READ_RED_GAIN_FORMATTER 0x0700 +#define READ_BLUE_GAIN_FORMATTER 0x0800 + +/* Formatters for the motorized pan & tilt [GS]ET_MPT_CTL */ +#define PT_RELATIVE_CONTROL_FORMATTER 0x01 +#define PT_RESET_CONTROL_FORMATTER 0x02 +#define PT_STATUS_FORMATTER 0x03 + /* intermediate buffers with raw data from the USB cam */ struct pwc_frame_buf { @@ -220,6 +276,55 @@ struct pwc_device struct input_dev *button_dev; /* webcam snapshot button input */ char button_phys[64]; #endif + + /* controls */ + struct v4l2_ctrl_handler ctrl_handler; + u16 saturation_fmt; + struct v4l2_ctrl *brightness; + struct v4l2_ctrl *contrast; + struct v4l2_ctrl *saturation; + struct v4l2_ctrl *gamma; + struct { + /* awb / red-blue balance cluster */ + struct v4l2_ctrl *auto_white_balance; + struct v4l2_ctrl *red_balance; + struct v4l2_ctrl *blue_balance; + /* usb ctrl transfers are slow, so we cache things */ + int color_bal_valid; + unsigned long last_color_bal_update; /* In jiffies */ + s32 last_red_balance; + s32 last_blue_balance; + }; + struct { + /* autogain / gain cluster */ + struct v4l2_ctrl *autogain; + struct v4l2_ctrl *gain; + int gain_valid; + unsigned long last_gain_update; /* In jiffies */ + s32 last_gain; + }; + struct { + /* exposure_auto / exposure cluster */ + struct v4l2_ctrl *exposure_auto; + struct v4l2_ctrl *exposure; + int exposure_valid; + unsigned long last_exposure_update; /* In jiffies */ + s32 last_exposure; + }; + struct v4l2_ctrl *colorfx; + struct { + /* autocontour/contour cluster */ + struct v4l2_ctrl *autocontour; + struct v4l2_ctrl *contour; + }; + struct v4l2_ctrl *backlight; + struct v4l2_ctrl *flicker; + struct v4l2_ctrl *noise_reduction; + struct v4l2_ctrl *save_user; + struct v4l2_ctrl *restore_user; + struct v4l2_ctrl *restore_factory; + /* CODEC3 models have both gain and exposure controlled by autogain */ + struct v4l2_ctrl *autogain_expo_cluster[3]; }; /* Global variables */ @@ -238,47 +343,20 @@ void pwc_construct(struct pwc_device *pdev); /* Request a certain video mode. Returns < 0 if not possible */ extern int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frames, int compression, int snapshot); extern unsigned int pwc_get_fps(struct pwc_device *pdev, unsigned int index, unsigned int size); -/* Calculate the number of bytes per image (not frame) */ extern int pwc_mpt_reset(struct pwc_device *pdev, int flags); extern int pwc_mpt_set_angle(struct pwc_device *pdev, int pan, int tilt); - -/* Various controls; should be obvious. Value 0..65535, or < 0 on error */ -extern int pwc_get_brightness(struct pwc_device *pdev); -extern int pwc_set_brightness(struct pwc_device *pdev, int value); -extern int pwc_get_contrast(struct pwc_device *pdev); -extern int pwc_set_contrast(struct pwc_device *pdev, int value); -extern int pwc_get_gamma(struct pwc_device *pdev); -extern int pwc_set_gamma(struct pwc_device *pdev, int value); -extern int pwc_get_saturation(struct pwc_device *pdev, int *value); -extern int pwc_set_saturation(struct pwc_device *pdev, int value); extern int pwc_set_leds(struct pwc_device *pdev, int on_value, int off_value); extern int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor); -extern int pwc_restore_user(struct pwc_device *pdev); -extern int pwc_save_user(struct pwc_device *pdev); -extern int pwc_restore_factory(struct pwc_device *pdev); - -/* exported for use by v4l2 controls */ -extern int pwc_get_red_gain(struct pwc_device *pdev, int *value); -extern int pwc_set_red_gain(struct pwc_device *pdev, int value); -extern int pwc_get_blue_gain(struct pwc_device *pdev, int *value); -extern int pwc_set_blue_gain(struct pwc_device *pdev, int value); -extern int pwc_get_awb(struct pwc_device *pdev); -extern int pwc_set_awb(struct pwc_device *pdev, int mode); -extern int pwc_set_agc(struct pwc_device *pdev, int mode, int value); -extern int pwc_get_agc(struct pwc_device *pdev, int *value); -extern int pwc_set_shutter_speed(struct pwc_device *pdev, int mode, int value); -extern int pwc_get_shutter_speed(struct pwc_device *pdev, int *value); - -extern int pwc_set_colour_mode(struct pwc_device *pdev, int colour); -extern int pwc_get_colour_mode(struct pwc_device *pdev, int *colour); -extern int pwc_set_contour(struct pwc_device *pdev, int contour); -extern int pwc_get_contour(struct pwc_device *pdev, int *contour); -extern int pwc_set_backlight(struct pwc_device *pdev, int backlight); -extern int pwc_get_backlight(struct pwc_device *pdev, int *backlight); -extern int pwc_set_flicker(struct pwc_device *pdev, int flicker); -extern int pwc_get_flicker(struct pwc_device *pdev, int *flicker); -extern int pwc_set_dynamic_noise(struct pwc_device *pdev, int noise); -extern int pwc_get_dynamic_noise(struct pwc_device *pdev, int *noise); + +/* Control get / set helpers */ +int pwc_get_u8_ctrl(struct pwc_device *pdev, u8 request, u16 value, int *data); +int pwc_set_u8_ctrl(struct pwc_device *pdev, u8 request, u16 value, u8 data); +int pwc_get_s8_ctrl(struct pwc_device *pdev, u8 request, u16 value, int *data); +#define pwc_set_s8_ctrl pwc_set_u8_ctrl +int pwc_get_u16_ctrl(struct pwc_device *pdev, u8 request, u16 value, int *dat); +int pwc_set_u16_ctrl(struct pwc_device *pdev, u8 request, u16 value, u16 data); +int pwc_button_ctrl(struct pwc_device *pdev, u16 value); +int pwc_init_controls(struct pwc_device *pdev); /* Power down or up the camera; not supported by all models */ extern void pwc_camera_power(struct pwc_device *pdev, int power); -- cgit v1.2.3 From c11271349ad5d4647e69e511fc481b2dd390efc4 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 3 Jul 2011 11:50:51 -0300 Subject: [media] pwc: Allow dqbuf / read to complete while waiting for controls Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pwc/pwc-if.c | 3 +++ drivers/media/video/pwc/pwc-v4l.c | 36 ++++++++++++++++++++++++++++++++---- drivers/media/video/pwc/pwc.h | 3 +++ 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index 1d5a6db915fa..fdf113fe51c3 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c @@ -1160,6 +1160,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id pwc_construct(pdev); /* set min/max sizes correct */ mutex_init(&pdev->modlock); + mutex_init(&pdev->udevlock); spin_lock_init(&pdev->queued_bufs_lock); INIT_LIST_HEAD(&pdev->queued_bufs); @@ -1297,6 +1298,7 @@ static void usb_pwc_disconnect(struct usb_interface *intf) { struct pwc_device *pdev = usb_get_intfdata(intf); + mutex_lock(&pdev->udevlock); mutex_lock(&pdev->modlock); usb_set_intfdata(intf, NULL); @@ -1306,6 +1308,7 @@ static void usb_pwc_disconnect(struct usb_interface *intf) pdev->udev = NULL; mutex_unlock(&pdev->modlock); + mutex_unlock(&pdev->udevlock); pwc_remove_sysfs_files(pdev); video_unregister_device(&pdev->vdev); diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c index 986dd5d6187a..537657283e79 100644 --- a/drivers/media/video/pwc/pwc-v4l.c +++ b/drivers/media/video/pwc/pwc-v4l.c @@ -526,8 +526,24 @@ static int pwc_g_volatile_ctrl(struct v4l2_ctrl *ctrl) container_of(ctrl->handler, struct pwc_device, ctrl_handler); int ret = 0; - if (!pdev->udev) - return -ENODEV; + /* + * Sometimes it can take quite long for the pwc to complete usb control + * transfers, so release the modlock to give streaming by another + * process / thread the chance to continue with a dqbuf. + */ + mutex_unlock(&pdev->modlock); + + /* + * Take the udev-lock to protect against the disconnect handler + * completing and setting dev->udev to NULL underneath us. Other code + * does not need to do this since it is protected by the modlock. + */ + mutex_lock(&pdev->udevlock); + + if (!pdev->udev) { + ret = -ENODEV; + goto leave; + } switch (ctrl->id) { case V4L2_CID_AUTO_WHITE_BALANCE: @@ -590,6 +606,9 @@ static int pwc_g_volatile_ctrl(struct v4l2_ctrl *ctrl) if (ret) PWC_ERROR("g_ctrl %s error %d\n", ctrl->name, ret); +leave: + mutex_unlock(&pdev->udevlock); + mutex_lock(&pdev->modlock); return ret; } @@ -751,8 +770,14 @@ static int pwc_s_ctrl(struct v4l2_ctrl *ctrl) container_of(ctrl->handler, struct pwc_device, ctrl_handler); int ret = 0; - if (!pdev->udev) - return -ENODEV; + /* See the comments on locking in pwc_g_volatile_ctrl */ + mutex_unlock(&pdev->modlock); + mutex_lock(&pdev->udevlock); + + if (!pdev->udev) { + ret = -ENODEV; + goto leave; + } switch (ctrl->id) { case V4L2_CID_BRIGHTNESS: @@ -841,6 +866,9 @@ static int pwc_s_ctrl(struct v4l2_ctrl *ctrl) if (ret) PWC_ERROR("s_ctrl %s error %d\n", ctrl->name, ret); +leave: + mutex_unlock(&pdev->udevlock); + mutex_lock(&pdev->modlock); return ret; } diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h index 601a549988b5..e02dbf745155 100644 --- a/drivers/media/video/pwc/pwc.h +++ b/drivers/media/video/pwc/pwc.h @@ -200,6 +200,9 @@ struct pwc_device /* Pointer to our usb_device, may be NULL after unplug */ struct usb_device *udev; + /* Protects the setting of udev to NULL by our disconnect handler */ + struct mutex udevlock; + /* type of cam (645, 646, 675, 680, 690, 720, 730, 740, 750) */ int type; int release; /* release number */ -- cgit v1.2.3 From 294e289602d7827f1389b081535fda3b7553a651 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 3 Jul 2011 12:23:24 -0300 Subject: [media] pwc: Add v4l2 controls for pan/tilt on Logitech QuickCam Orbit/Sphere This makes the API for this: 1) v4l2 spec compliant 2) match that of the UVC Logitech QuickCam Sphere models For now this operates in parellel to the sysfs interface for this, but the intend is to deprecate the sysfs interface and remove it. Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pwc/pwc-ctrl.c | 2 +- drivers/media/video/pwc/pwc-v4l.c | 56 ++++++++++++++++++++++++++++++++++++++ drivers/media/video/pwc/pwc.h | 9 ++++++ 3 files changed, 66 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/pwc/pwc-ctrl.c b/drivers/media/video/pwc/pwc-ctrl.c index 8e0cc537e1e4..d09413c44c86 100644 --- a/drivers/media/video/pwc/pwc-ctrl.c +++ b/drivers/media/video/pwc/pwc-ctrl.c @@ -165,7 +165,7 @@ static inline int send_video_command(struct pwc_device *pdev, buf, buflen); } -static inline int send_control_msg(struct pwc_device *pdev, +int send_control_msg(struct pwc_device *pdev, u8 request, u16 value, void *buf, int buflen) { return _send_control_msg(pdev, diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c index 537657283e79..e9a0e94b9995 100644 --- a/drivers/media/video/pwc/pwc-v4l.c +++ b/drivers/media/video/pwc/pwc-v4l.c @@ -338,6 +338,22 @@ int pwc_init_controls(struct pwc_device *pdev) if (pdev->restore_factory) pdev->restore_factory->flags = V4L2_CTRL_FLAG_UPDATE; + if (!pdev->features & FEATURE_MOTOR_PANTILT) + return hdl->error; + + /* Motor pan / tilt / reset */ + pdev->motor_pan = v4l2_ctrl_new_std(hdl, &pwc_ctrl_ops, + V4L2_CID_PAN_RELATIVE, -4480, 4480, 64, 0); + if (!pdev->motor_pan) + return hdl->error; + pdev->motor_tilt = v4l2_ctrl_new_std(hdl, &pwc_ctrl_ops, + V4L2_CID_TILT_RELATIVE, -1920, 1920, 64, 0); + pdev->motor_pan_reset = v4l2_ctrl_new_std(hdl, &pwc_ctrl_ops, + V4L2_CID_PAN_RESET, 0, 0, 0, 0); + pdev->motor_tilt_reset = v4l2_ctrl_new_std(hdl, &pwc_ctrl_ops, + V4L2_CID_TILT_RESET, 0, 0, 0, 0); + v4l2_ctrl_cluster(4, &pdev->motor_pan); + return hdl->error; } @@ -764,6 +780,43 @@ static int pwc_set_autogain_expo(struct pwc_device *pdev) return ret; } +static int pwc_set_motor(struct pwc_device *pdev) +{ + int ret; + u8 buf[4]; + + buf[0] = 0; + if (pdev->motor_pan_reset->is_new) + buf[0] |= 0x01; + if (pdev->motor_tilt_reset->is_new) + buf[0] |= 0x02; + if (pdev->motor_pan_reset->is_new || pdev->motor_tilt_reset->is_new) { + ret = send_control_msg(pdev, SET_MPT_CTL, + PT_RESET_CONTROL_FORMATTER, buf, 1); + if (ret < 0) + return ret; + } + + memset(buf, 0, sizeof(buf)); + if (pdev->motor_pan->is_new) { + buf[0] = pdev->motor_pan->val & 0xFF; + buf[1] = (pdev->motor_pan->val >> 8); + } + if (pdev->motor_tilt->is_new) { + buf[2] = pdev->motor_tilt->val & 0xFF; + buf[3] = (pdev->motor_tilt->val >> 8); + } + if (pdev->motor_pan->is_new || pdev->motor_tilt->is_new) { + ret = send_control_msg(pdev, SET_MPT_CTL, + PT_RELATIVE_CONTROL_FORMATTER, + buf, sizeof(buf)); + if (ret < 0) + return ret; + } + + return 0; +} + static int pwc_s_ctrl(struct v4l2_ctrl *ctrl) { struct pwc_device *pdev = @@ -859,6 +912,9 @@ static int pwc_s_ctrl(struct v4l2_ctrl *ctrl) ret = pwc_button_ctrl(pdev, RESTORE_FACTORY_DEFAULTS_FORMATTER); break; + case V4L2_CID_PAN_RELATIVE: + ret = pwc_set_motor(pdev); + break; default: ret = -EINVAL; } diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h index e02dbf745155..8f3607be5a71 100644 --- a/drivers/media/video/pwc/pwc.h +++ b/drivers/media/video/pwc/pwc.h @@ -326,6 +326,13 @@ struct pwc_device struct v4l2_ctrl *save_user; struct v4l2_ctrl *restore_user; struct v4l2_ctrl *restore_factory; + struct { + /* motor control cluster */ + struct v4l2_ctrl *motor_pan; + struct v4l2_ctrl *motor_tilt; + struct v4l2_ctrl *motor_pan_reset; + struct v4l2_ctrl *motor_tilt_reset; + }; /* CODEC3 models have both gain and exposure controlled by autogain */ struct v4l2_ctrl *autogain_expo_cluster[3]; }; @@ -350,6 +357,8 @@ extern int pwc_mpt_reset(struct pwc_device *pdev, int flags); extern int pwc_mpt_set_angle(struct pwc_device *pdev, int pan, int tilt); extern int pwc_set_leds(struct pwc_device *pdev, int on_value, int off_value); extern int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor); +extern int send_control_msg(struct pwc_device *pdev, + u8 request, u16 value, void *buf, int buflen); /* Control get / set helpers */ int pwc_get_u8_ctrl(struct pwc_device *pdev, u8 request, u16 value, int *data); -- cgit v1.2.3 From 4bf7c61c8a1b026e4d3944fd58157795da10a246 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 3 Jul 2011 15:02:10 -0300 Subject: [media] pwc: Add a bunch of pwc custom API to feature-removal-schedule.txt Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- Documentation/feature-removal-schedule.txt | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index b1c921c27519..8a988e5708ba 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt @@ -584,6 +584,41 @@ Who: Laurent Pinchart ---------------------------- +What: Support for driver specific ioctls in the pwc driver (everything + defined in media/pwc-ioctl.h) +When: 3.3 +Why: This stems from the v4l1 era, with v4l2 everything can be done with + standardized v4l2 API calls +Who: Hans de Goede + +---------------------------- + +What: Driver specific sysfs API in the pwc driver +When: 3.3 +Why: Setting pan/tilt should be done with v4l2 controls, like with other + cams. The button is available as a standard input device +Who: Hans de Goede + +---------------------------- + +What: Driver specific use of pixfmt.priv in the pwc driver +When: 3.3 +Why: The .priv field never was intended for this, setting a framerate is + support using the standardized S_PARM ioctl +Who: Hans de Goede + +---------------------------- + +What: Software emulation of arbritary resolutions in the pwc driver +When: 3.3 +Why: The pwc driver claims to support any resolution between 160x120 + and 640x480, but emulates this by simply drawing a black border + around the image. Userspace can draw its own black border if it + really wants one. +Who: Hans de Goede + +---------------------------- + What: For VIDIOC_S_FREQUENCY the type field must match the device node's type. If not, return -EINVAL. When: 3.2 -- cgit v1.2.3 From 51886df0ca8bcc42e13cad7bcfc3487268229cea Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 3 Jul 2011 15:52:54 -0300 Subject: [media] pwc: Enable power-management by default on tested models Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pwc/pwc-if.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index fdf113fe51c3..a5fe4a1532ac 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c @@ -999,6 +999,8 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id PWC_INFO("Logitech QuickCam 4000 Pro USB webcam detected.\n"); name = "Logitech QuickCam Pro 4000"; type_id = 740; /* CCD sensor */ + if (my_power_save == -1) + my_power_save = 1; break; case 0x08b3: PWC_INFO("Logitech QuickCam Zoom USB webcam detected.\n"); @@ -1016,6 +1018,8 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id PWC_INFO("Logitech QuickCam Orbit/Sphere USB webcam detected.\n"); name = "Logitech QuickCam Orbit"; type_id = 740; /* CCD sensor */ + if (my_power_save == -1) + my_power_save = 1; features |= FEATURE_MOTOR_PANTILT; break; case 0x08b6: @@ -1070,6 +1074,8 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id PWC_INFO("Creative Labs Webcam 5 detected.\n"); name = "Creative Labs Webcam 5"; type_id = 730; + if (my_power_save == -1) + my_power_save = 1; break; case 0x4011: PWC_INFO("Creative Labs Webcam Pro Ex detected.\n"); -- cgit v1.2.3 From e3aec98c1d3beaba9b96a7f00046bc06e59d6ab9 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 3 Jul 2011 16:26:52 -0300 Subject: [media] pwc: clean-up header files Remove unused pwc-ioctl.h (the copy in include/media is used everywhere) Remove almost empty pwc-uncompress.h, move single define to pwc.h Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pwc/pwc-ctrl.c | 1 - drivers/media/video/pwc/pwc-if.c | 1 - drivers/media/video/pwc/pwc-ioctl.h | 322 ------------------------------- drivers/media/video/pwc/pwc-kiara.c | 1 - drivers/media/video/pwc/pwc-uncompress.c | 1 - drivers/media/video/pwc/pwc-uncompress.h | 40 ---- drivers/media/video/pwc/pwc.h | 4 +- 7 files changed, 3 insertions(+), 367 deletions(-) delete mode 100644 drivers/media/video/pwc/pwc-ioctl.h delete mode 100644 drivers/media/video/pwc/pwc-uncompress.h diff --git a/drivers/media/video/pwc/pwc-ctrl.c b/drivers/media/video/pwc/pwc-ctrl.c index d09413c44c86..3977addf3ba8 100644 --- a/drivers/media/video/pwc/pwc-ctrl.c +++ b/drivers/media/video/pwc/pwc-ctrl.c @@ -44,7 +44,6 @@ #include #include "pwc.h" -#include "pwc-uncompress.h" #include "pwc-kiara.h" #include "pwc-timon.h" #include "pwc-dec1.h" diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index a5fe4a1532ac..51ca3589b1b5 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c @@ -75,7 +75,6 @@ #include "pwc-timon.h" #include "pwc-dec23.h" #include "pwc-dec1.h" -#include "pwc-uncompress.h" /* Function prototypes and driver templates */ diff --git a/drivers/media/video/pwc/pwc-ioctl.h b/drivers/media/video/pwc/pwc-ioctl.h deleted file mode 100644 index b74fea0a8d34..000000000000 --- a/drivers/media/video/pwc/pwc-ioctl.h +++ /dev/null @@ -1,322 +0,0 @@ -#ifndef PWC_IOCTL_H -#define PWC_IOCTL_H - -/* (C) 2001-2004 Nemosoft Unv. - (C) 2004-2006 Luc Saillard (luc@saillard.org) - - NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx - driver and thus may have bugs that are not present in the original version. - Please send bug reports and support requests to . - The decompression routines have been implemented by reverse-engineering the - Nemosoft binary pwcx module. Caveat emptor. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - 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 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 -*/ - -/* This is pwc-ioctl.h belonging to PWC 10.0.10 - It contains structures and defines to communicate from user space - directly to the driver. - */ - -/* - Changes - 2001/08/03 Alvarado Added ioctl constants to access methods for - changing white balance and red/blue gains - 2002/12/15 G. H. Fernandez-Toribio VIDIOCGREALSIZE - 2003/12/13 Nemosft Unv. Some modifications to make interfacing to - PWCX easier - */ - -/* These are private ioctl() commands, specific for the Philips webcams. - They contain functions not found in other webcams, and settings not - specified in the Video4Linux API. - - The #define names are built up like follows: - VIDIOC VIDeo IOCtl prefix - PWC Philps WebCam - G optional: Get - S optional: Set - ... the function - */ - -#include - - /* Enumeration of image sizes */ -#define PSZ_SQCIF 0x00 -#define PSZ_QSIF 0x01 -#define PSZ_QCIF 0x02 -#define PSZ_SIF 0x03 -#define PSZ_CIF 0x04 -#define PSZ_VGA 0x05 -#define PSZ_MAX 6 - - -/* The frame rate is encoded in the video_window.flags parameter using - the upper 16 bits, since some flags are defined nowadays. The following - defines provide a mask and shift to filter out this value. - This value can also be passing using the private flag when using v4l2 and - VIDIOC_S_FMT ioctl. - - In 'Snapshot' mode the camera freezes its automatic exposure and colour - balance controls. - */ -#define PWC_FPS_SHIFT 16 -#define PWC_FPS_MASK 0x00FF0000 -#define PWC_FPS_FRMASK 0x003F0000 -#define PWC_FPS_SNAPSHOT 0x00400000 -#define PWC_QLT_MASK 0x03000000 -#define PWC_QLT_SHIFT 24 - - -/* structure for transferring x & y coordinates */ -struct pwc_coord -{ - int x, y; /* guess what */ - int size; /* size, or offset */ -}; - - -/* Used with VIDIOCPWCPROBE */ -struct pwc_probe -{ - char name[32]; - int type; -}; - -struct pwc_serial -{ - char serial[30]; /* String with serial number. Contains terminating 0 */ -}; - -/* pwc_whitebalance.mode values */ -#define PWC_WB_INDOOR 0 -#define PWC_WB_OUTDOOR 1 -#define PWC_WB_FL 2 -#define PWC_WB_MANUAL 3 -#define PWC_WB_AUTO 4 - -/* Used with VIDIOCPWC[SG]AWB (Auto White Balance). - Set mode to one of the PWC_WB_* values above. - *red and *blue are the respective gains of these colour components inside - the camera; range 0..65535 - When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read; - otherwise undefined. - 'read_red' and 'read_blue' are read-only. -*/ -struct pwc_whitebalance -{ - int mode; - int manual_red, manual_blue; /* R/W */ - int read_red, read_blue; /* R/O */ -}; - -/* - 'control_speed' and 'control_delay' are used in automatic whitebalance mode, - and tell the camera how fast it should react to changes in lighting, and - with how much delay. Valid values are 0..65535. -*/ -struct pwc_wb_speed -{ - int control_speed; - int control_delay; - -}; - -/* Used with VIDIOCPWC[SG]LED */ -struct pwc_leds -{ - int led_on; /* Led on-time; range = 0..25000 */ - int led_off; /* Led off-time; range = 0..25000 */ -}; - -/* Image size (used with GREALSIZE) */ -struct pwc_imagesize -{ - int width; - int height; -}; - -/* Defines and structures for Motorized Pan & Tilt */ -#define PWC_MPT_PAN 0x01 -#define PWC_MPT_TILT 0x02 -#define PWC_MPT_TIMEOUT 0x04 /* for status */ - -/* Set angles; when absolute != 0, the angle is absolute and the - driver calculates the relative offset for you. This can only - be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns - absolute angles. - */ -struct pwc_mpt_angles -{ - int absolute; /* write-only */ - int pan; /* degrees * 100 */ - int tilt; /* degress * 100 */ -}; - -/* Range of angles of the camera, both horizontally and vertically. - */ -struct pwc_mpt_range -{ - int pan_min, pan_max; /* degrees * 100 */ - int tilt_min, tilt_max; -}; - -struct pwc_mpt_status -{ - int status; - int time_pan; - int time_tilt; -}; - - -/* This is used for out-of-kernel decompression. With it, you can get - all the necessary information to initialize and use the decompressor - routines in standalone applications. - */ -struct pwc_video_command -{ - int type; /* camera type (645, 675, 730, etc.) */ - int release; /* release number */ - - int size; /* one of PSZ_* */ - int alternate; - int command_len; /* length of USB video command */ - unsigned char command_buf[13]; /* Actual USB video command */ - int bandlength; /* >0 = compressed */ - int frame_size; /* Size of one (un)compressed frame */ -}; - -/* Flags for PWCX subroutines. Not all modules honour all flags. */ -#define PWCX_FLAG_PLANAR 0x0001 -#define PWCX_FLAG_BAYER 0x0008 - - -/* IOCTL definitions */ - - /* Restore user settings */ -#define VIDIOCPWCRUSER _IO('v', 192) - /* Save user settings */ -#define VIDIOCPWCSUSER _IO('v', 193) - /* Restore factory settings */ -#define VIDIOCPWCFACTORY _IO('v', 194) - - /* You can manipulate the compression factor. A compression preference of 0 - means use uncompressed modes when available; 1 is low compression, 2 is - medium and 3 is high compression preferred. Of course, the higher the - compression, the lower the bandwidth used but more chance of artefacts - in the image. The driver automatically chooses a higher compression when - the preferred mode is not available. - */ - /* Set preferred compression quality (0 = uncompressed, 3 = highest compression) */ -#define VIDIOCPWCSCQUAL _IOW('v', 195, int) - /* Get preferred compression quality */ -#define VIDIOCPWCGCQUAL _IOR('v', 195, int) - - -/* Retrieve serial number of camera */ -#define VIDIOCPWCGSERIAL _IOR('v', 198, struct pwc_serial) - - /* This is a probe function; since so many devices are supported, it - becomes difficult to include all the names in programs that want to - check for the enhanced Philips stuff. So in stead, try this PROBE; - it returns a structure with the original name, and the corresponding - Philips type. - To use, fill the structure with zeroes, call PROBE and if that succeeds, - compare the name with that returned from VIDIOCGCAP; they should be the - same. If so, you can be assured it is a Philips (OEM) cam and the type - is valid. - */ -#define VIDIOCPWCPROBE _IOR('v', 199, struct pwc_probe) - - /* Set AGC (Automatic Gain Control); int < 0 = auto, 0..65535 = fixed */ -#define VIDIOCPWCSAGC _IOW('v', 200, int) - /* Get AGC; int < 0 = auto; >= 0 = fixed, range 0..65535 */ -#define VIDIOCPWCGAGC _IOR('v', 200, int) - /* Set shutter speed; int < 0 = auto; >= 0 = fixed, range 0..65535 */ -#define VIDIOCPWCSSHUTTER _IOW('v', 201, int) - - /* Color compensation (Auto White Balance) */ -#define VIDIOCPWCSAWB _IOW('v', 202, struct pwc_whitebalance) -#define VIDIOCPWCGAWB _IOR('v', 202, struct pwc_whitebalance) - - /* Auto WB speed */ -#define VIDIOCPWCSAWBSPEED _IOW('v', 203, struct pwc_wb_speed) -#define VIDIOCPWCGAWBSPEED _IOR('v', 203, struct pwc_wb_speed) - - /* LEDs on/off/blink; int range 0..65535 */ -#define VIDIOCPWCSLED _IOW('v', 205, struct pwc_leds) -#define VIDIOCPWCGLED _IOR('v', 205, struct pwc_leds) - - /* Contour (sharpness); int < 0 = auto, 0..65536 = fixed */ -#define VIDIOCPWCSCONTOUR _IOW('v', 206, int) -#define VIDIOCPWCGCONTOUR _IOR('v', 206, int) - - /* Backlight compensation; 0 = off, otherwise on */ -#define VIDIOCPWCSBACKLIGHT _IOW('v', 207, int) -#define VIDIOCPWCGBACKLIGHT _IOR('v', 207, int) - - /* Flickerless mode; = 0 off, otherwise on */ -#define VIDIOCPWCSFLICKER _IOW('v', 208, int) -#define VIDIOCPWCGFLICKER _IOR('v', 208, int) - - /* Dynamic noise reduction; 0 off, 3 = high noise reduction */ -#define VIDIOCPWCSDYNNOISE _IOW('v', 209, int) -#define VIDIOCPWCGDYNNOISE _IOR('v', 209, int) - - /* Real image size as used by the camera; tells you whether or not there's a gray border around the image */ -#define VIDIOCPWCGREALSIZE _IOR('v', 210, struct pwc_imagesize) - - /* Motorized pan & tilt functions */ -#define VIDIOCPWCMPTRESET _IOW('v', 211, int) -#define VIDIOCPWCMPTGRANGE _IOR('v', 211, struct pwc_mpt_range) -#define VIDIOCPWCMPTSANGLE _IOW('v', 212, struct pwc_mpt_angles) -#define VIDIOCPWCMPTGANGLE _IOR('v', 212, struct pwc_mpt_angles) -#define VIDIOCPWCMPTSTATUS _IOR('v', 213, struct pwc_mpt_status) - - /* Get the USB set-video command; needed for initializing libpwcx */ -#define VIDIOCPWCGVIDCMD _IOR('v', 215, struct pwc_video_command) -struct pwc_table_init_buffer { - int len; - char *buffer; - -}; -#define VIDIOCPWCGVIDTABLE _IOR('v', 216, struct pwc_table_init_buffer) - -/* - * This is private command used when communicating with v4l2. - * In the future all private ioctl will be remove/replace to - * use interface offer by v4l2. - */ - -#define V4L2_CID_PRIVATE_SAVE_USER (V4L2_CID_PRIVATE_BASE + 0) -#define V4L2_CID_PRIVATE_RESTORE_USER (V4L2_CID_PRIVATE_BASE + 1) -#define V4L2_CID_PRIVATE_RESTORE_FACTORY (V4L2_CID_PRIVATE_BASE + 2) -#define V4L2_CID_PRIVATE_COLOUR_MODE (V4L2_CID_PRIVATE_BASE + 3) -#define V4L2_CID_PRIVATE_AUTOCONTOUR (V4L2_CID_PRIVATE_BASE + 4) -#define V4L2_CID_PRIVATE_CONTOUR (V4L2_CID_PRIVATE_BASE + 5) -#define V4L2_CID_PRIVATE_BACKLIGHT (V4L2_CID_PRIVATE_BASE + 6) -#define V4L2_CID_PRIVATE_FLICKERLESS (V4L2_CID_PRIVATE_BASE + 7) -#define V4L2_CID_PRIVATE_NOISE_REDUCTION (V4L2_CID_PRIVATE_BASE + 8) - -struct pwc_raw_frame { - __le16 type; /* type of the webcam */ - __le16 vbandlength; /* Size of 4lines compressed (used by the decompressor) */ - __u8 cmd[4]; /* the four byte of the command (in case of nala, - only the first 3 bytes is filled) */ - __u8 rawframe[0]; /* frame_size = H/4*vbandlength */ -} __attribute__ ((packed)); - - -#endif diff --git a/drivers/media/video/pwc/pwc-kiara.c b/drivers/media/video/pwc/pwc-kiara.c index f4ae83c0cf2b..e5f4fd817125 100644 --- a/drivers/media/video/pwc/pwc-kiara.c +++ b/drivers/media/video/pwc/pwc-kiara.c @@ -40,7 +40,6 @@ #include "pwc-kiara.h" -#include "pwc-uncompress.h" const unsigned int Kiara_fps_vector[PWC_FPS_MAX_KIARA] = { 5, 10, 15, 20, 25, 30 }; diff --git a/drivers/media/video/pwc/pwc-uncompress.c b/drivers/media/video/pwc/pwc-uncompress.c index d110e38c4de0..51265092bd31 100644 --- a/drivers/media/video/pwc/pwc-uncompress.c +++ b/drivers/media/video/pwc/pwc-uncompress.c @@ -30,7 +30,6 @@ #include #include "pwc.h" -#include "pwc-uncompress.h" #include "pwc-dec1.h" #include "pwc-dec23.h" diff --git a/drivers/media/video/pwc/pwc-uncompress.h b/drivers/media/video/pwc/pwc-uncompress.h deleted file mode 100644 index 43028e74e9e0..000000000000 --- a/drivers/media/video/pwc/pwc-uncompress.h +++ /dev/null @@ -1,40 +0,0 @@ -/* (C) 1999-2003 Nemosoft Unv. - (C) 2004-2006 Luc Saillard (luc@saillard.org) - - NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx - driver and thus may have bugs that are not present in the original version. - Please send bug reports and support requests to . - The decompression routines have been implemented by reverse-engineering the - Nemosoft binary pwcx module. Caveat emptor. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - 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 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 -*/ - -/* This file is the bridge between the kernel module and the plugin; it - describes the structures and datatypes used in both modules. Any - significant change should be reflected by increasing the - pwc_decompressor_version major number. - */ -#ifndef PWC_UNCOMPRESS_H -#define PWC_UNCOMPRESS_H - - -#include - -/* from pwc-dec.h */ -#define PWCX_FLAG_PLANAR 0x0001 -/* */ - -#endif diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h index 8f3607be5a71..0e4e2d7b7872 100644 --- a/drivers/media/video/pwc/pwc.h +++ b/drivers/media/video/pwc/pwc.h @@ -42,7 +42,6 @@ #include #endif -#include "pwc-uncompress.h" #include /* Version block */ @@ -129,6 +128,9 @@ #define DEVICE_USE_CODEC3(x) ((x)>=700) #define DEVICE_USE_CODEC23(x) ((x)>=675) +/* from pwc-dec.h */ +#define PWCX_FLAG_PLANAR 0x0001 + /* Request types: video */ #define SET_LUM_CTL 0x01 #define GET_LUM_CTL 0x02 -- cgit v1.2.3 From adf41b9bc35a7406ead7875f66ee879dbd4cc308 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 5 Jul 2011 06:56:37 -0300 Subject: [media] v4l2-ctrls.c: copy-and-paste error: user_to_new -> new_to_user The new values were never copied to userspace due to this copy and paste error. This was introduced during the rewrite of this part of the code in commit 3219f8a362640b7e4b7e2187b1094c4e46d85aa0. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/v4l2-ctrls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c index 37a50e57f222..1f84b9676f10 100644 --- a/drivers/media/video/v4l2-ctrls.c +++ b/drivers/media/video/v4l2-ctrls.c @@ -1929,7 +1929,7 @@ static int try_set_ext_ctrls(struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl, if (!ret) { idx = i; do { - ret = user_to_new(cs->controls + idx, + ret = new_to_user(cs->controls + idx, helpers[idx].ctrl); idx = helpers[idx].next; } while (!ret && idx); -- cgit v1.2.3 From 639884a6d94ffa16d76b131a55f65748ca0c94f2 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 5 Jul 2011 07:09:26 -0300 Subject: [media] v4l2-ctrls: always send an event if a control changed implicitly By default no control events are sent to the application that caused the control value or flags change (i.e. the control(s) passed to VIDIOC_S_CTRL or VIDIOC_S_EXT_CTRLS). But if a change in one control causes a change in another control that was not part of the control(s) in VIDIOC_S_CTRL or S_EXT_CTRLS, then the application should be notified. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/v4l2-ctrls.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c index 1f84b9676f10..0e8a28f37af9 100644 --- a/drivers/media/video/v4l2-ctrls.c +++ b/drivers/media/video/v4l2-ctrls.c @@ -712,10 +712,15 @@ static void new_to_cur(struct v4l2_fh *fh, struct v4l2_ctrl *ctrl, if (!is_cur_manual(ctrl->cluster[0])) ctrl->flags |= V4L2_CTRL_FLAG_INACTIVE; } - if (changed || update_inactive) + if (changed || update_inactive) { + /* If a control was changed that was not one of the controls + modified by the application, then send the event to all. */ + if (!ctrl->is_new) + fh = NULL; send_event(fh, ctrl, (changed ? V4L2_EVENT_CTRL_CH_VALUE : 0) | (update_inactive ? V4L2_EVENT_CTRL_CH_FLAGS : 0)); + } } /* Copy the current value to the new value */ -- cgit v1.2.3 From ee490b466162925193c847b02aabd6048ff8cbe9 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 5 Jul 2011 07:17:39 -0300 Subject: [media] DocBook: fix typo: vl42_plane_pix_format -> v4l2_plane_pix_format Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/v4l/pixfmt.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/DocBook/media/v4l/pixfmt.xml b/Documentation/DocBook/media/v4l/pixfmt.xml index 804b2e5e0807..389432d780a7 100644 --- a/Documentation/DocBook/media/v4l/pixfmt.xml +++ b/Documentation/DocBook/media/v4l/pixfmt.xml @@ -121,7 +121,7 @@ set this field to zero. an array of v4l2_plane_pix_format structures, describing all planes of that format. - struct <structname>vl42_plane_pix_format</structname> + struct <structname>v4l2_plane_pix_format</structname> &cs-str; -- cgit v1.2.3 From 1de5be5e91ee10d8f42be2aebc1cede718b48d50 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 5 Jul 2011 07:19:23 -0300 Subject: [media] vivi: Fix sleep-in-atomic-context Fix sleep-in-atomic-context bug in vivi: Jun 28 18:14:39 tschai kernel: [ 80.970478] BUG: sleeping function called from invalid context at kernel/mutex.c:271 Jun 28 18:14:39 tschai kernel: [ 80.970483] in_atomic(): 0, irqs_disabled(): 1, pid: 2854, name: vivi-000 Jun 28 18:14:39 tschai kernel: [ 80.970485] INFO: lockdep is turned off. Jun 28 18:14:39 tschai kernel: [ 80.970486] irq event stamp: 0 Jun 28 18:14:39 tschai kernel: [ 80.970487] hardirqs last enabled at (0): [< (null)>] (null) Jun 28 18:14:39 tschai kernel: [ 80.970490] hardirqs last disabled at (0): [] copy_process+0x61b/0x1440 Jun 28 18:14:39 tschai kernel: [ 80.970495] softirqs last enabled at (0): [] copy_process+0x61b/0x1440 Jun 28 18:14:39 tschai kernel: [ 80.970498] softirqs last disabled at (0): [< (null)>] (null) Jun 28 18:14:39 tschai kernel: [ 80.970502] Pid: 2854, comm: vivi-000 Tainted: P 3.0.0-rc1-tschai #372 Jun 28 18:14:39 tschai kernel: [ 80.970504] Call Trace: Jun 28 18:14:39 tschai kernel: [ 80.970509] [] __might_sleep+0xf3/0x130 Jun 28 18:14:39 tschai kernel: [ 80.970512] [] mutex_lock_nested+0x2f/0x60 Jun 28 18:14:39 tschai kernel: [ 80.970517] [] vivi_fillbuff+0x20e/0x3f0 [vivi] Jun 28 18:14:39 tschai kernel: [ 80.970520] [] ? do_raw_spin_lock+0x54/0x150 Jun 28 18:14:39 tschai kernel: [ 80.970524] [] ? read_tsc+0xe/0x20 Jun 28 18:14:39 tschai kernel: [ 80.970528] [] ? getnstimeofday+0x57/0xe0 Jun 28 18:14:39 tschai kernel: [ 80.970531] [] vivi_thread+0x191/0x2f0 [vivi] Jun 28 18:14:39 tschai kernel: [ 80.970534] [] ? try_to_wake_up+0x2d0/0x2d0 Jun 28 18:14:39 tschai kernel: [ 80.970537] [] ? vivi_fillbuff+0x3f0/0x3f0 [vivi] Jun 28 18:14:39 tschai kernel: [ 80.970541] [] kthread+0xb6/0xc0 Jun 28 18:14:39 tschai kernel: [ 80.970544] [] kernel_thread_helper+0x4/0x10 Jun 28 18:14:39 tschai kernel: [ 80.970547] [] ? retint_restore_args+0x13/0x13 Jun 28 18:14:39 tschai kernel: [ 80.970550] [] ? __init_kthread_worker+0x70/0x70 Jun 28 18:14:39 tschai kernel: [ 80.970552] [] ? gs_change+0x13/0x13 This bug was introduced in 2.6.39. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/vivi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index cc1cf6b17183..6e7bf5719b34 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c @@ -529,11 +529,13 @@ static void vivi_thread_tick(struct vivi_dev *dev) spin_lock_irqsave(&dev->slock, flags); if (list_empty(&dma_q->active)) { dprintk(dev, 1, "No active queue to serve\n"); - goto unlock; + spin_unlock_irqrestore(&dev->slock, flags); + return; } buf = list_entry(dma_q->active.next, struct vivi_buffer, list); list_del(&buf->list); + spin_unlock_irqrestore(&dev->slock, flags); do_gettimeofday(&buf->vb.v4l2_buf.timestamp); @@ -543,8 +545,6 @@ static void vivi_thread_tick(struct vivi_dev *dev) vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE); dprintk(dev, 2, "[%p/%d] done\n", buf, buf->vb.v4l2_buf.index); -unlock: - spin_unlock_irqrestore(&dev->slock, flags); } #define frames_to_ms(frames) \ -- cgit v1.2.3 From fa4d7096d1fb7c012ebaacefee132007a21e0965 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 23 May 2011 04:07:05 -0300 Subject: [media] v4l2-ctrls: add new bitmask control type Signed-off-by: Hans Verkuil Reviewed-by: Laurent Pinchart Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/v4l2-common.c | 3 +++ drivers/media/video/v4l2-ctrls.c | 18 +++++++++++++++++- include/linux/videodev2.h | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 06b9f9f82013..5c6100fb4072 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c @@ -105,6 +105,9 @@ int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl, menu_items[ctrl->value][0] == '\0') return -EINVAL; } + if (qctrl->type == V4L2_CTRL_TYPE_BITMASK && + (ctrl->value & ~qctrl->maximum)) + return -ERANGE; return 0; } EXPORT_SYMBOL(v4l2_ctrl_check); diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c index 0e8a28f37af9..86554b5cdca0 100644 --- a/drivers/media/video/v4l2-ctrls.c +++ b/drivers/media/video/v4l2-ctrls.c @@ -805,6 +805,10 @@ static int validate_new_int(const struct v4l2_ctrl *ctrl, s32 *pval) return -EINVAL; return 0; + case V4L2_CTRL_TYPE_BITMASK: + *pval &= ctrl->maximum; + return 0; + case V4L2_CTRL_TYPE_BUTTON: case V4L2_CTRL_TYPE_CTRL_CLASS: *pval = 0; @@ -825,6 +829,7 @@ static int validate_new(const struct v4l2_ctrl *ctrl, struct v4l2_ext_control *c case V4L2_CTRL_TYPE_INTEGER: case V4L2_CTRL_TYPE_BOOLEAN: case V4L2_CTRL_TYPE_MENU: + case V4L2_CTRL_TYPE_BITMASK: case V4L2_CTRL_TYPE_BUTTON: case V4L2_CTRL_TYPE_CTRL_CLASS: return validate_new_int(ctrl, &c->value); @@ -1063,13 +1068,17 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, /* Sanity checks */ if (id == 0 || name == NULL || id >= V4L2_CID_PRIVATE_BASE || - max < min || (type == V4L2_CTRL_TYPE_INTEGER && step == 0) || + (type == V4L2_CTRL_TYPE_BITMASK && max == 0) || (type == V4L2_CTRL_TYPE_MENU && qmenu == NULL) || (type == V4L2_CTRL_TYPE_STRING && max == 0)) { handler_set_err(hdl, -ERANGE); return NULL; } + if (type != V4L2_CTRL_TYPE_BITMASK && max < min) { + handler_set_err(hdl, -ERANGE); + return NULL; + } if ((type == V4L2_CTRL_TYPE_INTEGER || type == V4L2_CTRL_TYPE_MENU || type == V4L2_CTRL_TYPE_BOOLEAN) && @@ -1077,6 +1086,10 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, handler_set_err(hdl, -ERANGE); return NULL; } + if (type == V4L2_CTRL_TYPE_BITMASK && ((def & ~max) || min || step)) { + handler_set_err(hdl, -ERANGE); + return NULL; + } if (type == V4L2_CTRL_TYPE_BUTTON) flags |= V4L2_CTRL_FLAG_WRITE_ONLY; @@ -1357,6 +1370,9 @@ static void log_ctrl(const struct v4l2_ctrl *ctrl, case V4L2_CTRL_TYPE_MENU: printk(KERN_CONT "%s", ctrl->qmenu[ctrl->cur.val]); break; + case V4L2_CTRL_TYPE_BITMASK: + printk(KERN_CONT "0x%08x", ctrl->cur.val); + break; case V4L2_CTRL_TYPE_INTEGER64: printk(KERN_CONT "%lld", ctrl->cur.val64); break; diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index f002006fc0a9..148d1a51ca22 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -1040,6 +1040,7 @@ enum v4l2_ctrl_type { V4L2_CTRL_TYPE_INTEGER64 = 5, V4L2_CTRL_TYPE_CTRL_CLASS = 6, V4L2_CTRL_TYPE_STRING = 7, + V4L2_CTRL_TYPE_BITMASK = 8, }; /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ -- cgit v1.2.3 From b6d17a56c8431810709794ceb44d2454976e3ce1 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 29 Mar 2011 16:33:11 -0300 Subject: [media] vivi: add bitmask test control Signed-off-by: Hans Verkuil Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/vivi.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index 6e7bf5719b34..a848bd2af97f 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c @@ -176,6 +176,7 @@ struct vivi_dev { struct v4l2_ctrl *int64; struct v4l2_ctrl *menu; struct v4l2_ctrl *string; + struct v4l2_ctrl *bitmask; spinlock_t slock; struct mutex mutex; @@ -493,9 +494,10 @@ static void vivi_fillbuff(struct vivi_dev *dev, struct vivi_buffer *buf) snprintf(str, sizeof(str), " autogain %d, gain %3d, volume %3d ", dev->autogain->cur.val, gain, dev->volume->cur.val); gen_text(dev, vbuf, line++ * 16, 16, str); - snprintf(str, sizeof(str), " int32 %d, int64 %lld ", + snprintf(str, sizeof(str), " int32 %d, int64 %lld, bitmask %08x ", dev->int32->cur.val, - dev->int64->cur.val64); + dev->int64->cur.val64, + dev->bitmask->cur.val); gen_text(dev, vbuf, line++ * 16, 16, str); snprintf(str, sizeof(str), " boolean %d, menu %s, string \"%s\" ", dev->boolean->cur.val, @@ -1152,6 +1154,17 @@ static const struct v4l2_ctrl_config vivi_ctrl_string = { .step = 1, }; +static const struct v4l2_ctrl_config vivi_ctrl_bitmask = { + .ops = &vivi_ctrl_ops, + .id = VIVI_CID_CUSTOM_BASE + 6, + .name = "Bitmask", + .type = V4L2_CTRL_TYPE_BITMASK, + .def = 0x80002000, + .min = 0, + .max = 0x80402010, + .step = 0, +}; + static const struct v4l2_file_operations vivi_fops = { .owner = THIS_MODULE, .open = v4l2_fh_open, @@ -1260,6 +1273,7 @@ static int __init vivi_create_instance(int inst) dev->boolean = v4l2_ctrl_new_custom(hdl, &vivi_ctrl_boolean, NULL); dev->menu = v4l2_ctrl_new_custom(hdl, &vivi_ctrl_menu, NULL); dev->string = v4l2_ctrl_new_custom(hdl, &vivi_ctrl_string, NULL); + dev->bitmask = v4l2_ctrl_new_custom(hdl, &vivi_ctrl_bitmask, NULL); if (hdl->error) { ret = hdl->error; goto unreg_dev; -- cgit v1.2.3 From aec67f054205da77f83ba52f83239225d6cbe366 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 23 May 2011 07:36:55 -0300 Subject: [media] DocBook: document V4L2_CTRL_TYPE_BITMASK [mchehab@redhat.com: Fix a merge conflict and make compat.xml coherent with v4l2.xml] Signed-off-by: Hans Verkuil Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/v4l/compat.xml | 10 ++++++++++ Documentation/DocBook/media/v4l/v4l2.xml | 11 ++++++----- Documentation/DocBook/media/v4l/vidioc-queryctrl.xml | 12 +++++++++++- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml index b010ac6bfd2c..d7c015e8df81 100644 --- a/Documentation/DocBook/media/v4l/compat.xml +++ b/Documentation/DocBook/media/v4l/compat.xml @@ -2360,6 +2360,16 @@ that used it. It was originally scheduled for removal in 2.6.35. +
+ V4L2 in Linux 3.1 + + + VIDIOC_QUERYCAP now returns a per-subsystem version instead of a per-driver one. + Standardize an error code for invalid ioctl. + Added V4L2_CTRL_TYPE_BITMASK. + + +
Relation of V4L2 to other Linux multimedia APIs diff --git a/Documentation/DocBook/media/v4l/v4l2.xml b/Documentation/DocBook/media/v4l/v4l2.xml index 43386a6aef76..0d05e8747c12 100644 --- a/Documentation/DocBook/media/v4l/v4l2.xml +++ b/Documentation/DocBook/media/v4l/v4l2.xml @@ -87,7 +87,7 @@ Remote Controller chapter. - Pawel + Pawel Osciak Designed and documented the multi-planar API. @@ -130,9 +130,10 @@ applications. --> 3.1 2011-06-27 - mcc, po - Documented that VIDIOC_QUERYCAP now returns a per-subsystem version instead of a per-driver one. - Standardize an error code for invalid ioctl. + mcc, po, hv + Documented that VIDIOC_QUERYCAP now returns a per-subsystem version instead of a per-driver one. + Standardize an error code for invalid ioctl. + Added V4L2_CTRL_TYPE_BITMASK. @@ -409,7 +410,7 @@ and discussions on the V4L mailing list. Video for Linux Two API Specification - Revision 2.6.39 + Revision 3.1 &sub-common; diff --git a/Documentation/DocBook/media/v4l/vidioc-queryctrl.xml b/Documentation/DocBook/media/v4l/vidioc-queryctrl.xml index 0d5e8283cf32..677ea646c29f 100644 --- a/Documentation/DocBook/media/v4l/vidioc-queryctrl.xml +++ b/Documentation/DocBook/media/v4l/vidioc-queryctrl.xml @@ -156,7 +156,8 @@ signed value. Maximum value, inclusive. This field gives an upper bound for V4L2_CTRL_TYPE_INTEGER controls and the highest valid index for V4L2_CTRL_TYPE_MENU -controls. +controls. For V4L2_CTRL_TYPE_BITMASK controls it is the +set of usable bits. For V4L2_CTRL_TYPE_STRING controls the maximum value gives the maximum length of the string. This length does not include the terminating zero. It may not be valid for any other type of control, including @@ -289,6 +290,15 @@ values which are actually different on the hardware. The control has a menu of N choices. The names of the menu items can be enumerated with the VIDIOC_QUERYMENU ioctl. + + + V4L2_CTRL_TYPE_BITMASK + 0 + n/a + any + A bitmask field. The maximum value is the set of bits that can +be used, all other bits are to be 0. The maximum value is interpreted as a __u32, +allowing the use of bit 31 in the bitmask. V4L2_CTRL_TYPE_BUTTON -- cgit v1.2.3 From 0b159acdd577dfd961ad14177c23e97d3ad33009 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Mon, 21 Mar 2011 12:52:51 -0300 Subject: [media] v4l: Add a class and a set of controls for flash devices Add a control class and a set of controls to support LED and Xenon flash devices. An example of such a device is the adp1653. Signed-off-by: Sakari Ailus Acked-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/v4l2-ctrls.c | 45 ++++++++++++++++++++++++++++++++++++++++ include/linux/videodev2.h | 36 ++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c index 86554b5cdca0..37c064829ea5 100644 --- a/drivers/media/video/v4l2-ctrls.c +++ b/drivers/media/video/v4l2-ctrls.c @@ -238,6 +238,17 @@ const char * const *v4l2_ctrl_get_menu(u32 id) "75 useconds", NULL, }; + static const char * const flash_led_mode[] = { + "Off", + "Flash", + "Torch", + NULL, + }; + static const char * const flash_strobe_source[] = { + "Software", + "External", + NULL, + }; switch (id) { case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ: @@ -278,6 +289,10 @@ const char * const *v4l2_ctrl_get_menu(u32 id) return colorfx; case V4L2_CID_TUNE_PREEMPHASIS: return tune_preemphasis; + case V4L2_CID_FLASH_LED_MODE: + return flash_led_mode; + case V4L2_CID_FLASH_STROBE_SOURCE: + return flash_strobe_source; default: return NULL; } @@ -411,6 +426,21 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_TUNE_POWER_LEVEL: return "Tune Power Level"; case V4L2_CID_TUNE_ANTENNA_CAPACITOR: return "Tune Antenna Capacitor"; + /* Flash controls */ + case V4L2_CID_FLASH_CLASS: return "Flash controls"; + case V4L2_CID_FLASH_LED_MODE: return "LED mode"; + case V4L2_CID_FLASH_STROBE_SOURCE: return "Strobe source"; + case V4L2_CID_FLASH_STROBE: return "Strobe"; + case V4L2_CID_FLASH_STROBE_STOP: return "Stop strobe"; + case V4L2_CID_FLASH_STROBE_STATUS: return "Strobe status"; + case V4L2_CID_FLASH_TIMEOUT: return "Strobe timeout"; + case V4L2_CID_FLASH_INTENSITY: return "Intensity, flash mode"; + case V4L2_CID_FLASH_TORCH_INTENSITY: return "Intensity, torch mode"; + case V4L2_CID_FLASH_INDICATOR_INTENSITY: return "Intensity, indicator"; + case V4L2_CID_FLASH_FAULT: return "Faults"; + case V4L2_CID_FLASH_CHARGE: return "Charge"; + case V4L2_CID_FLASH_READY: return "Ready to strobe"; + default: return NULL; } @@ -445,12 +475,17 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_PILOT_TONE_ENABLED: case V4L2_CID_ILLUMINATORS_1: case V4L2_CID_ILLUMINATORS_2: + case V4L2_CID_FLASH_STROBE_STATUS: + case V4L2_CID_FLASH_CHARGE: + case V4L2_CID_FLASH_READY: *type = V4L2_CTRL_TYPE_BOOLEAN; *min = 0; *max = *step = 1; break; case V4L2_CID_PAN_RESET: case V4L2_CID_TILT_RESET: + case V4L2_CID_FLASH_STROBE: + case V4L2_CID_FLASH_STROBE_STOP: *type = V4L2_CTRL_TYPE_BUTTON; *flags |= V4L2_CTRL_FLAG_WRITE_ONLY; *min = *max = *step = *def = 0; @@ -474,6 +509,8 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_EXPOSURE_AUTO: case V4L2_CID_COLORFX: case V4L2_CID_TUNE_PREEMPHASIS: + case V4L2_CID_FLASH_LED_MODE: + case V4L2_CID_FLASH_STROBE_SOURCE: *type = V4L2_CTRL_TYPE_MENU; break; case V4L2_CID_RDS_TX_PS_NAME: @@ -484,6 +521,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_CAMERA_CLASS: case V4L2_CID_MPEG_CLASS: case V4L2_CID_FM_TX_CLASS: + case V4L2_CID_FLASH_CLASS: *type = V4L2_CTRL_TYPE_CTRL_CLASS; /* You can neither read not write these */ *flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY; @@ -496,6 +534,9 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, /* Max is calculated as RGB888 that is 2^24 */ *max = 0xFFFFFF; break; + case V4L2_CID_FLASH_FAULT: + *type = V4L2_CTRL_TYPE_BITMASK; + break; default: *type = V4L2_CTRL_TYPE_INTEGER; break; @@ -541,6 +582,10 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_ZOOM_RELATIVE: *flags |= V4L2_CTRL_FLAG_WRITE_ONLY; break; + case V4L2_CID_FLASH_STROBE_STATUS: + case V4L2_CID_FLASH_READY: + *flags |= V4L2_CTRL_FLAG_READ_ONLY; + break; } } EXPORT_SYMBOL(v4l2_ctrl_fill); diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 148d1a51ca22..8b1224c1c536 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -1027,6 +1027,7 @@ struct v4l2_ext_controls { #define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */ #define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */ #define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */ +#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */ #define V4L2_CTRL_ID_MASK (0x0fffffff) #define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) @@ -1429,6 +1430,41 @@ enum v4l2_preemphasis { #define V4L2_CID_TUNE_POWER_LEVEL (V4L2_CID_FM_TX_CLASS_BASE + 113) #define V4L2_CID_TUNE_ANTENNA_CAPACITOR (V4L2_CID_FM_TX_CLASS_BASE + 114) +/* Flash and privacy (indicator) light controls */ +#define V4L2_CID_FLASH_CLASS_BASE (V4L2_CTRL_CLASS_FLASH | 0x900) +#define V4L2_CID_FLASH_CLASS (V4L2_CTRL_CLASS_FLASH | 1) + +#define V4L2_CID_FLASH_LED_MODE (V4L2_CID_FLASH_CLASS_BASE + 1) +enum v4l2_flash_led_mode { + V4L2_FLASH_LED_MODE_NONE, + V4L2_FLASH_LED_MODE_FLASH, + V4L2_FLASH_LED_MODE_TORCH, +}; + +#define V4L2_CID_FLASH_STROBE_SOURCE (V4L2_CID_FLASH_CLASS_BASE + 2) +enum v4l2_flash_strobe_source { + V4L2_FLASH_STROBE_SOURCE_SOFTWARE, + V4L2_FLASH_STROBE_SOURCE_EXTERNAL, +}; + +#define V4L2_CID_FLASH_STROBE (V4L2_CID_FLASH_CLASS_BASE + 3) +#define V4L2_CID_FLASH_STROBE_STOP (V4L2_CID_FLASH_CLASS_BASE + 4) +#define V4L2_CID_FLASH_STROBE_STATUS (V4L2_CID_FLASH_CLASS_BASE + 5) + +#define V4L2_CID_FLASH_TIMEOUT (V4L2_CID_FLASH_CLASS_BASE + 6) +#define V4L2_CID_FLASH_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 7) +#define V4L2_CID_FLASH_TORCH_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 8) +#define V4L2_CID_FLASH_INDICATOR_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 9) + +#define V4L2_CID_FLASH_FAULT (V4L2_CID_FLASH_CLASS_BASE + 10) +#define V4L2_FLASH_FAULT_OVER_VOLTAGE (1 << 0) +#define V4L2_FLASH_FAULT_TIMEOUT (1 << 1) +#define V4L2_FLASH_FAULT_OVER_TEMPERATURE (1 << 2) +#define V4L2_FLASH_FAULT_SHORT_CIRCUIT (1 << 3) + +#define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11) +#define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12) + /* * T U N I N G */ -- cgit v1.2.3 From 7ba85fa4fdbbe800e92a937ca567120ef32fe49f Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Wed, 4 May 2011 10:45:58 -0300 Subject: [media] v4l: Add flash control documentation Add documentation for V4L2 flash controls. Signed-off-by: Sakari Ailus Acked-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/v4l/compat.xml | 3 + Documentation/DocBook/media/v4l/controls.xml | 283 +++++++++++++++++++++ .../DocBook/media/v4l/vidioc-g-ext-ctrls.xml | 7 + 3 files changed, 293 insertions(+) diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml index d7c015e8df81..ce1004a7da52 100644 --- a/Documentation/DocBook/media/v4l/compat.xml +++ b/Documentation/DocBook/media/v4l/compat.xml @@ -2475,6 +2475,9 @@ ioctls. &VIDIOC-DBG-G-CHIP-IDENT; ioctl. + + Flash API. +
diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml index a920ee80f640..9155127ed6ab 100644 --- a/Documentation/DocBook/media/v4l/controls.xml +++ b/Documentation/DocBook/media/v4l/controls.xml @@ -2092,6 +2092,289 @@ manually or automatically if set to zero. Unit, range and step are driver-specif For more details about RDS specification, refer to document, from CENELEC. + +
+ Flash Control Reference + + + Experimental + + This is an experimental +interface and may change in the future. + + + + The V4L2 flash controls are intended to provide generic access + to flash controller devices. Flash controller devices are + typically used in digital cameras. + + + + The interface can support both LED and xenon flash devices. As + of writing this, there is no xenon flash driver using this + interface. + + +
+ Supported use cases + +
+ Unsynchronised LED flash (software strobe) + + + Unsynchronised LED flash is controlled directly by the + host as the sensor. The flash must be enabled by the host + before the exposure of the image starts and disabled once + it ends. The host is fully responsible for the timing of + the flash. + + + Example of such device: Nokia N900. +
+ +
+ Synchronised LED flash (hardware strobe) + + + The synchronised LED flash is pre-programmed by the host + (power and timeout) but controlled by the sensor through a + strobe signal from the sensor to the flash. + + + + The sensor controls the flash duration and timing. This + information typically must be made available to the + sensor. + + +
+ +
+ LED flash as torch + + + LED flash may be used as torch in conjunction with another + use case involving camera or individually. + + +
+ +
+ +
+ Flash Control IDs + + + + + + + + + + + ID + Type + Description + + + + + + V4L2_CID_FLASH_CLASS + class + + + The FLASH class descriptor. + + + V4L2_CID_FLASH_LED_MODE + menu + + + Defines the mode of the flash LED, + the high-power white LED attached to the flash controller. + Setting this control may not be possible in presence of + some faults. See V4L2_CID_FLASH_FAULT. + + + + + + V4L2_FLASH_LED_MODE_NONE + Off. + + + V4L2_FLASH_LED_MODE_FLASH + Flash mode. + + + V4L2_FLASH_LED_MODE_TORCH + Torch mode. See V4L2_CID_FLASH_TORCH_INTENSITY. + + + + + + V4L2_CID_FLASH_STROBE_SOURCE + menu + + Defines the source of the flash LED + strobe. + + + + + + V4L2_FLASH_STROBE_SOURCE_SOFTWARE + The flash strobe is triggered by using + the V4L2_CID_FLASH_STROBE control. + + + V4L2_FLASH_STROBE_SOURCE_EXTERNAL + The flash strobe is triggered by an + external source. Typically this is a sensor, + which makes it possible to synchronises the + flash strobe start to exposure start. + + + + + + V4L2_CID_FLASH_STROBE + button + + + Strobe flash. Valid when + V4L2_CID_FLASH_LED_MODE is set to + V4L2_FLASH_LED_MODE_FLASH and V4L2_CID_FLASH_STROBE_SOURCE + is set to V4L2_FLASH_STROBE_SOURCE_SOFTWARE. Setting this + control may not be possible in presence of some faults. + See V4L2_CID_FLASH_FAULT. + + + V4L2_CID_FLASH_STROBE_STOP + button + + Stop flash strobe immediately. + + + V4L2_CID_FLASH_STROBE_STATUS + boolean + + + Strobe status: whether the flash + is strobing at the moment or not. This is a read-only + control. + + + V4L2_CID_FLASH_TIMEOUT + integer + + + Hardware timeout for flash. The + flash strobe is stopped after this period of time has + passed from the start of the strobe. + + + V4L2_CID_FLASH_INTENSITY + integer + + + Intensity of the flash strobe when + the flash LED is in flash mode + (V4L2_FLASH_LED_MODE_FLASH). The unit should be milliamps + (mA) if possible. + + + V4L2_CID_FLASH_TORCH_INTENSITY + integer + + + Intensity of the flash LED in + torch mode (V4L2_FLASH_LED_MODE_TORCH). The unit should be + milliamps (mA) if possible. Setting this control may not + be possible in presence of some faults. See + V4L2_CID_FLASH_FAULT. + + + V4L2_CID_FLASH_INDICATOR_INTENSITY + integer + + + Intensity of the indicator LED. + The indicator LED may be fully independent of the flash + LED. The unit should be microamps (uA) if possible. + + + V4L2_CID_FLASH_FAULT + bitmask + + + Faults related to the flash. The + faults tell about specific problems in the flash chip + itself or the LEDs attached to it. Faults may prevent + further use of some of the flash controls. In particular, + V4L2_CID_FLASH_LED_MODE is set to V4L2_FLASH_LED_MODE_NONE + if the fault affects the flash LED. Exactly which faults + have such an effect is chip dependent. Reading the faults + resets the control and returns the chip to a usable state + if possible. + + + + + + V4L2_FLASH_FAULT_OVER_VOLTAGE + Flash controller voltage to the flash LED + has exceeded the limit specific to the flash + controller. + + + V4L2_FLASH_FAULT_TIMEOUT + The flash strobe was still on when + the timeout set by the user --- + V4L2_CID_FLASH_TIMEOUT control --- has expired. + Not all flash controllers may set this in all + such conditions. + + + V4L2_FLASH_FAULT_OVER_TEMPERATURE + The flash controller has overheated. + + + V4L2_FLASH_FAULT_SHORT_CIRCUIT + The short circuit protection of the flash + controller has been triggered. + + + + + + V4L2_CID_FLASH_CHARGE + boolean + + Enable or disable charging of the xenon + flash capacitor. + + + V4L2_CID_FLASH_READY + boolean + + + Is the flash ready to strobe? + Xenon flashes require their capacitors charged before + strobing. LED flashes often require a cooldown period + after strobe during which another strobe will not be + possible. This is a read-only control. + + + + +
+ +