/* SPDX-License-Identifier: GPL-2.0+ */ /* * em28xx.h - driver for Empia EM2800/EM2820/2840 USB video capture devices * * Copyright (C) 2005 Markus Rechberger <mrechberger@gmail.com> * Ludovico Cavedon <cavedon@sssup.it> * Mauro Carvalho Chehab <mchehab@kernel.org> * Copyright (C) 2012 Frank Schäfer <fschaefer.oss@googlemail.com> * * Based on the em2800 driver from Sascha Sommer <saschasommer@freenet.de>
*/
/* maximum number of em28xx boards */ #define EM28XX_MAXBOARDS DVB_MAX_ADAPTERS /* All adapters could be em28xx */
/* maximum number of frames that can be queued */ #define EM28XX_NUM_FRAMES 5 /* number of frames that get used for v4l2_read() */ #define EM28XX_NUM_READ_FRAMES 2
/* number of buffers for isoc transfers */ #define EM28XX_NUM_BUFS 5 #define EM28XX_DVB_NUM_BUFS 5
/* max number of I2C buses on em28xx devices */ #define NUM_I2C_BUSES 2
/* * isoc transfers: number of packets for each buffer * windows requests only 64 packets .. so we better do the same * this is what I found out for all alternate numbers there!
*/ #define EM28XX_NUM_ISOC_PACKETS 64 #define EM28XX_DVB_NUM_ISOC_PACKETS 64
/** * struct em28xx_usb_bufs - Contains URB-related buffer data * * @max_pkt_size: max packet size of isoc transaction * @num_packets: number of packets in each buffer * @num_bufs: number of allocated urb * @urb: urb for isoc/bulk transfers * @buf: transfer buffers for isoc/bulk transfer
*/ struct em28xx_usb_bufs { int max_pkt_size; int num_packets; int num_bufs; struct urb **urb; char **buf;
};
/** * struct em28xx_usb_ctl - Contains URB-related buffer data * * @analog_bufs: isoc/bulk transfer buffers for analog mode * @digital_bufs: isoc/bulk transfer buffers for digital mode * @vid_buf: Stores already requested video buffers * @vbi_buf: Stores already requested VBI buffers * @urb_data_copy: copy data from URB
*/ struct em28xx_usb_ctl { struct em28xx_usb_bufs analog_bufs; struct em28xx_usb_bufs digital_bufs; struct em28xx_buffer *vid_buf; struct em28xx_buffer *vbi_buf; int (*urb_data_copy)(struct em28xx *dev, struct urb *urb);
};
/** * struct em28xx_fmt - Struct to enumberate video formats * * @fourcc: v4l2 format id * @depth: mean number of bits to represent a pixel * @reg: em28xx register value to set it
*/ struct em28xx_fmt {
u32 fourcc; int depth; int reg;
};
/** * struct em28xx_buffer- buffer for storing one video frame * * @vb: common v4l buffer stuff * @list: List to associate it with the other buffers * @mem: pointer to the buffer, as returned by vb2_plane_vaddr() * @length: length of the buffer, as returned by vb2_plane_size() * @top_field: If non-zero, indicate that the buffer is the top field * @pos: Indicate the next position of the buffer to be filled. * @vb_buf: pointer to vmalloc memory address in vb * * .. note:: * * in interlaced mode, @pos is reset to zero at the start of each new * field (not frame !)
*/ struct em28xx_buffer { struct vb2_v4l2_buffer vb; /* must be first */
/** * enum em28xx_amux - describes the type of audio input used by em28xx * * @EM28XX_AMUX_UNUSED: * Used only on em28xx dev->map field, in order to mark an entry * as unused. * @EM28XX_AMUX_VIDEO: * On devices without AC97, this is the only value that it is currently * allowed. * On devices with AC97, it corresponds to the AC97 mixer "Video" control. * @EM28XX_AMUX_LINE_IN: * Only for devices with AC97. Corresponds to AC97 mixer "Line In". * @EM28XX_AMUX_VIDEO2: * Only for devices with AC97. It means that em28xx should use "Line In" * And AC97 should use the "Video" mixer control. * @EM28XX_AMUX_PHONE: * Only for devices with AC97. Corresponds to AC97 mixer "Phone". * @EM28XX_AMUX_MIC: * Only for devices with AC97. Corresponds to AC97 mixer "Mic". * @EM28XX_AMUX_CD: * Only for devices with AC97. Corresponds to AC97 mixer "CD". * @EM28XX_AMUX_AUX: * Only for devices with AC97. Corresponds to AC97 mixer "Aux". * @EM28XX_AMUX_PCM_OUT: * Only for devices with AC97. Corresponds to AC97 mixer "PCM out". * * The em28xx chip itself has only two audio inputs: tuner and line in. * On almost all devices, only the tuner input is used. * * However, on most devices, an auxiliary AC97 codec device is used, * usually connected to the em28xx tuner input (except for * @EM28XX_AMUX_LINE_IN). * * The AC97 device typically have several different inputs and outputs. * The exact number and description depends on their model. * * It is possible to AC97 to mixer more than one different entries at the * same time, via the alsa mux.
*/ enum em28xx_amux {
EM28XX_AMUX_UNUSED = -1,
EM28XX_AMUX_VIDEO = 0,
EM28XX_AMUX_LINE_IN,
enum em28xx_led_role {
EM28XX_LED_ANALOG_CAPTURING = 0,
EM28XX_LED_DIGITAL_CAPTURING,
EM28XX_LED_DIGITAL_CAPTURING_TS2,
EM28XX_LED_ILLUMINATION,
EM28XX_NUM_LED_ROLES, /* must be the last */
};
spinlock_t slock; /* Protects em28xx video/vbi/dvb IRQ stream data */
// usb transfer struct usb_interface *intf; // the usb interface
u8 ifnum; // number of the assigned usb interface
u8 analog_ep_isoc; // address of isoc endpoint for analog
u8 analog_ep_bulk; // address of bulk endpoint for analog
u8 dvb_ep_isoc_ts2; // address of isoc endpoint for DVB TS2
u8 dvb_ep_bulk_ts2; // address of bulk endpoint for DVB TS2
u8 dvb_ep_isoc; // address of isoc endpoint for DVB
u8 dvb_ep_bulk; // address of bulk endpoint for DVB int alt; // alternate setting int max_pkt_size; // max packet size of the selected ep at alt int packet_multiplier; // multiplier for wMaxPacketSize, used for // URB buffer size definition int num_alt; // number of alternative settings unsignedint *alt_max_pkt_size_isoc; // array of isoc wMaxPacketSize unsignedint analog_xfer_bulk:1; // use bulk instead of isoc // transfers for analog int dvb_alt_isoc; // alternate setting for DVB isoc transfers unsignedint dvb_max_pkt_size_isoc; // isoc max packet size of the // selected DVB ep at dvb_alt unsignedint dvb_max_pkt_size_isoc_ts2; // isoc max packet size of the // selected DVB ep at dvb_alt unsignedint dvb_xfer_bulk:1; // use bulk instead of isoc // transfers for DVB char urb_buf[URB_MAX_CTRL_SIZE]; // urb control msg buffer
// helper funcs that call usb_control_msg int (*em28xx_write_regs)(struct em28xx *dev, u16 reg, char *buf, int len); int (*em28xx_read_reg)(struct em28xx *dev, u16 reg); int (*em28xx_read_reg_req_len)(struct em28xx *dev, u8 req, u16 reg, char *buf, int len); int (*em28xx_write_regs_req)(struct em28xx *dev, u8 req, u16 reg, char *buf, int len); int (*em28xx_read_reg_req)(struct em28xx *dev, u8 req, u16 reg);
enum em28xx_mode mode;
// Button state polling struct delayed_work buttons_query_work;
u8 button_polling_addresses[EM28XX_NUM_BUTTON_ADDRESSES_MAX];
u8 button_polling_last_values[EM28XX_NUM_BUTTON_ADDRESSES_MAX];
u8 num_button_polling_addresses;
u16 button_polling_interval; // [ms] // Snapshot button input device char snapshot_button_path[30]; // path of the input dev struct input_dev *sbutton_input_dev;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.