diff options
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/bt819.h | 33 | ||||
-rw-r--r-- | include/media/cx2341x.h | 6 | ||||
-rw-r--r-- | include/media/cx25840.h | 12 | ||||
-rw-r--r-- | include/media/ir-common.h | 3 | ||||
-rw-r--r-- | include/media/ir-kbd-i2c.h | 3 | ||||
-rw-r--r-- | include/media/ov772x.h | 5 | ||||
-rw-r--r-- | include/media/saa7146.h | 8 | ||||
-rw-r--r-- | include/media/saa7146_vv.h | 17 | ||||
-rw-r--r-- | include/media/sh_mobile_ceu.h | 5 | ||||
-rw-r--r-- | include/media/soc_camera.h | 24 | ||||
-rw-r--r-- | include/media/v4l2-chip-ident.h | 94 | ||||
-rw-r--r-- | include/media/v4l2-common.h | 24 | ||||
-rw-r--r-- | include/media/v4l2-dev.h | 2 | ||||
-rw-r--r-- | include/media/v4l2-device.h | 40 | ||||
-rw-r--r-- | include/media/v4l2-ioctl.h | 2 | ||||
-rw-r--r-- | include/media/v4l2-subdev.h | 22 | ||||
-rw-r--r-- | include/media/videobuf-core.h | 1 |
17 files changed, 243 insertions, 58 deletions
diff --git a/include/media/bt819.h b/include/media/bt819.h new file mode 100644 index 0000000..38f666b --- /dev/null +++ b/include/media/bt819.h @@ -0,0 +1,33 @@ +/* + bt819.h - bt819 notifications + + Copyright (C) 2009 Hans Verkuil (hverkuil@xs4all.nl) + + 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 _BT819_H_ +#define _BT819_H_ + +#include <linux/ioctl.h> + +/* v4l2_device notifications. */ + +/* Needed to reset the FIFO buffer when changing the input + or the video standard. */ +#define BT819_FIFO_RESET_LOW _IO('b', 0) +#define BT819_FIFO_RESET_HIGH _IO('b', 1) + +#endif diff --git a/include/media/cx2341x.h b/include/media/cx2341x.h index 9ec4d58..9ebe855 100644 --- a/include/media/cx2341x.h +++ b/include/media/cx2341x.h @@ -1,5 +1,5 @@ /* - cx23415/6 header containing common defines. + cx23415/6/8 header containing common defines. 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 @@ -28,6 +28,7 @@ enum cx2341x_port { enum cx2341x_cap { CX2341X_CAP_HAS_SLICED_VBI = 1 << 0, CX2341X_CAP_HAS_TS = 1 << 1, + CX2341X_CAP_HAS_AC3 = 1 << 2, }; struct cx2341x_mpeg_params { @@ -47,11 +48,12 @@ struct cx2341x_mpeg_params { enum v4l2_mpeg_audio_sampling_freq audio_sampling_freq; enum v4l2_mpeg_audio_encoding audio_encoding; enum v4l2_mpeg_audio_l2_bitrate audio_l2_bitrate; + enum v4l2_mpeg_audio_ac3_bitrate audio_ac3_bitrate; enum v4l2_mpeg_audio_mode audio_mode; enum v4l2_mpeg_audio_mode_extension audio_mode_extension; enum v4l2_mpeg_audio_emphasis audio_emphasis; enum v4l2_mpeg_audio_crc audio_crc; - u16 audio_properties; + u32 audio_properties; u16 audio_mute; /* video */ diff --git a/include/media/cx25840.h b/include/media/cx25840.h index db431d5..2c3fbaa 100644 --- a/include/media/cx25840.h +++ b/include/media/cx25840.h @@ -21,6 +21,18 @@ #ifndef _CX25840_H_ #define _CX25840_H_ +/* Note that the cx25840 driver requires that the bridge driver calls the + v4l2_subdev's init operation in order to load the driver's firmware. + Without this the audio standard detection will fail and you will + only get mono. + + Since loading the firmware is often problematic when the driver is + compiled into the kernel I recommend postponing calling this function + until the first open of the video device. Another reason for + postponing it is that loading this firmware takes a long time (seconds) + due to the slow i2c bus speed. So it will speed up the boot process if + you can avoid loading the fw as long as the video device isn't used. */ + enum cx25840_video_input { /* Composite video inputs In1-In8 */ CX25840_COMPOSITE1 = 1, diff --git a/include/media/ir-common.h b/include/media/ir-common.h index 5bf2ea0..7b5b91f 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h @@ -111,6 +111,7 @@ extern IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE]; extern IR_KEYTAB_TYPE ir_codes_avermedia[IR_KEYTAB_SIZE]; extern IR_KEYTAB_TYPE ir_codes_avermedia_dvbt[IR_KEYTAB_SIZE]; extern IR_KEYTAB_TYPE ir_codes_avermedia_m135a[IR_KEYTAB_SIZE]; +extern IR_KEYTAB_TYPE ir_codes_avermedia_cardbus[IR_KEYTAB_SIZE]; extern IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE]; extern IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE]; extern IR_KEYTAB_TYPE ir_codes_pixelview_new[IR_KEYTAB_SIZE]; @@ -159,6 +160,8 @@ extern IR_KEYTAB_TYPE ir_codes_real_audio_220_32_keys[IR_KEYTAB_SIZE]; extern IR_KEYTAB_TYPE ir_codes_msi_tvanywhere_plus[IR_KEYTAB_SIZE]; extern IR_KEYTAB_TYPE ir_codes_ati_tv_wonder_hd_600[IR_KEYTAB_SIZE]; extern IR_KEYTAB_TYPE ir_codes_kworld_plus_tv_analog[IR_KEYTAB_SIZE]; +extern IR_KEYTAB_TYPE ir_codes_kaiomy[IR_KEYTAB_SIZE]; +extern IR_KEYTAB_TYPE ir_codes_dm1105_nec[IR_KEYTAB_SIZE]; #endif /* diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h index 00fa57e..07963d7 100644 --- a/include/media/ir-kbd-i2c.h +++ b/include/media/ir-kbd-i2c.h @@ -14,8 +14,7 @@ struct IR_i2c { /* Used to avoid fast repeating */ unsigned char old; - struct work_struct work; - struct timer_list timer; + struct delayed_work work; char phys[32]; int (*get_key)(struct IR_i2c*, u32*, u32*); }; diff --git a/include/media/ov772x.h b/include/media/ov772x.h index e391d55..57db48d 100644 --- a/include/media/ov772x.h +++ b/include/media/ov772x.h @@ -13,8 +13,13 @@ #include <media/soc_camera.h> +/* for flags */ +#define OV772X_FLAG_VFLIP 0x00000001 /* Vertical flip image */ +#define OV772X_FLAG_HFLIP 0x00000002 /* Horizontal flip image */ + struct ov772x_camera_info { unsigned long buswidth; + unsigned long flags; struct soc_camera_link link; }; diff --git a/include/media/saa7146.h b/include/media/saa7146.h index c5a6e22..fff4235 100644 --- a/include/media/saa7146.h +++ b/include/media/saa7146.h @@ -13,6 +13,7 @@ #include <linux/stringify.h> #include <linux/mutex.h> #include <linux/scatterlist.h> +#include <media/v4l2-device.h> #include <linux/vmalloc.h> /* for vmalloc() */ #include <linux/mm.h> /* for vmalloc_to_page() */ @@ -110,6 +111,8 @@ struct saa7146_dev struct list_head item; + struct v4l2_device v4l2_dev; + /* different device locks */ spinlock_t slock; struct mutex lock; @@ -145,6 +148,11 @@ struct saa7146_dev struct saa7146_dma d_rps1; }; +static inline struct saa7146_dev *to_saa7146_dev(struct v4l2_device *v4l2_dev) +{ + return container_of(v4l2_dev, struct saa7146_dev, v4l2_dev); +} + /* from saa7146_i2c.c */ int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c_adapter, u32 bitrate); diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h index c8d0b23..eed5fcc 100644 --- a/include/media/saa7146_vv.h +++ b/include/media/saa7146_vv.h @@ -150,16 +150,6 @@ struct saa7146_vv unsigned int resources; /* resource management for device */ }; -#define SAA7146_EXCLUSIVE 0x1 -#define SAA7146_BEFORE 0x2 -#define SAA7146_AFTER 0x4 - -struct saa7146_extension_ioctls -{ - unsigned int cmd; - int flags; -}; - /* flags */ #define SAA7146_USE_PORT_B_FOR_VBI 0x2 /* use input port b for vbi hardware bug workaround */ @@ -176,8 +166,10 @@ struct saa7146_ext_vv int num_stds; int (*std_callback)(struct saa7146_dev*, struct saa7146_standard *); - struct saa7146_extension_ioctls *ioctls; - long (*ioctl)(struct saa7146_fh *, unsigned int cmd, void *arg); + /* the extension can override this */ + struct v4l2_ioctl_ops ops; + /* pointer to the saa7146 core ops */ + const struct v4l2_ioctl_ops *core_ops; struct v4l2_file_operations vbi_fops; }; @@ -213,6 +205,7 @@ void saa7146_set_hps_source_and_sync(struct saa7146_dev *saa, int source, int sy void saa7146_set_gpio(struct saa7146_dev *saa, u8 pin, u8 data); /* from saa7146_video.c */ +extern const struct v4l2_ioctl_ops saa7146_video_ioctl_ops; extern struct saa7146_use_ops saa7146_video_uops; int saa7146_start_preview(struct saa7146_fh *fh); int saa7146_stop_preview(struct saa7146_fh *fh); diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h index b5dbefe..0f3524c 100644 --- a/include/media/sh_mobile_ceu.h +++ b/include/media/sh_mobile_ceu.h @@ -1,10 +1,11 @@ #ifndef __ASM_SH_MOBILE_CEU_H__ #define __ASM_SH_MOBILE_CEU_H__ -#include <media/soc_camera.h> +#define SH_CEU_FLAG_USE_8BIT_BUS (1 << 0) /* use 8bit bus width */ +#define SH_CEU_FLAG_USE_16BIT_BUS (1 << 1) /* use 16bit bus width */ struct sh_mobile_ceu_info { - unsigned long flags; /* SOCAM_... */ + unsigned long flags; }; #endif /* __ASM_SH_MOBILE_CEU_H__ */ diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index 7440d92..3701368 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h @@ -45,6 +45,7 @@ struct soc_camera_device { int num_formats; struct soc_camera_format_xlate *user_formats; int num_user_formats; + enum v4l2_field field; /* Preserve field over close() */ struct module *owner; void *host_priv; /* Per-device host private data */ /* soc_camera.c private count. Only accessed with .video_lock held */ @@ -74,7 +75,8 @@ struct soc_camera_host_ops { int (*resume)(struct soc_camera_device *); int (*get_formats)(struct soc_camera_device *, int, struct soc_camera_format_xlate *); - int (*set_fmt)(struct soc_camera_device *, __u32, struct v4l2_rect *); + int (*set_crop)(struct soc_camera_device *, struct v4l2_rect *); + int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *); int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *); void (*init_videobuf)(struct videobuf_queue *, struct soc_camera_device *); @@ -93,13 +95,18 @@ struct soc_camera_host_ops { struct soc_camera_link { /* Camera bus id, used to match a camera and a bus */ int bus_id; - /* GPIO number to switch between 8 and 10 bit modes */ - unsigned int gpio; /* Per camera SOCAM_SENSOR_* bus flags */ unsigned long flags; /* Optional callbacks to power on or off and reset the sensor */ int (*power)(struct device *, int); int (*reset)(struct device *); + /* + * some platforms may support different data widths than the sensors + * native ones due to different data line routing. Let the board code + * overwrite the width flags. + */ + int (*set_bus_param)(struct soc_camera_link *, unsigned long flags); + unsigned long (*query_bus_param)(struct soc_camera_link *); }; static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev) @@ -159,7 +166,8 @@ struct soc_camera_ops { int (*release)(struct soc_camera_device *); int (*start_capture)(struct soc_camera_device *); int (*stop_capture)(struct soc_camera_device *); - int (*set_fmt)(struct soc_camera_device *, __u32, struct v4l2_rect *); + int (*set_crop)(struct soc_camera_device *, struct v4l2_rect *); + int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *); int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *); unsigned long (*query_bus_param)(struct soc_camera_device *); int (*set_bus_param)(struct soc_camera_device *, unsigned long); @@ -239,15 +247,19 @@ static inline struct v4l2_queryctrl const *soc_camera_find_qctrl( static inline unsigned long soc_camera_bus_param_compatible( unsigned long camera_flags, unsigned long bus_flags) { - unsigned long common_flags, hsync, vsync, pclk; + unsigned long common_flags, hsync, vsync, pclk, data, buswidth, mode; common_flags = camera_flags & bus_flags; hsync = common_flags & (SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_LOW); vsync = common_flags & (SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW); pclk = common_flags & (SOCAM_PCLK_SAMPLE_RISING | SOCAM_PCLK_SAMPLE_FALLING); + data = common_flags & (SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATA_ACTIVE_LOW); + mode = common_flags & (SOCAM_MASTER | SOCAM_SLAVE); + buswidth = common_flags & SOCAM_DATAWIDTH_MASK; - return (!hsync || !vsync || !pclk) ? 0 : common_flags; + return (!hsync || !vsync || !pclk || !data || !mode || !buswidth) ? 0 : + common_flags; } extern unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl, diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h index 9aaf652..1be461a 100644 --- a/include/media/v4l2-chip-ident.h +++ b/include/media/v4l2-chip-ident.h @@ -37,10 +37,8 @@ enum { /* module saa7110: just ident 100 */ V4L2_IDENT_SAA7110 = 100, - /* module saa7111: just ident 101 */ + /* module saa7115: reserved range 101-149 */ V4L2_IDENT_SAA7111 = 101, - - /* module saa7115: reserved range 102-149 */ V4L2_IDENT_SAA7113 = 103, V4L2_IDENT_SAA7114 = 104, V4L2_IDENT_SAA7115 = 105, @@ -63,44 +61,96 @@ enum { V4L2_IDENT_OV7720 = 251, V4L2_IDENT_OV7725 = 252, - /* Conexant MPEG encoder/decoders: reserved range 410-420 */ + /* module saa7146: reserved range 300-309 */ + V4L2_IDENT_SAA7146 = 300, + + /* Conexant MPEG encoder/decoders: reserved range 400-420 */ + V4L2_IDENT_CX23418_843 = 403, /* Integrated A/V Decoder on the '418 */ V4L2_IDENT_CX23415 = 415, V4L2_IDENT_CX23416 = 416, V4L2_IDENT_CX23418 = 418, + /* module au0828 */ + V4L2_IDENT_AU0828 = 828, + + /* module indycam: just ident 2000 */ + V4L2_IDENT_INDYCAM = 2000, + + /* module bt819: reserved range 810-819 */ + V4L2_IDENT_BT815A = 815, + V4L2_IDENT_BT817A = 817, + V4L2_IDENT_BT819A = 819, + + /* module bt856: just ident 856 */ + V4L2_IDENT_BT856 = 856, + + /* module bt866: just ident 866 */ + V4L2_IDENT_BT866 = 866, + + /* module ks0127: reserved range 1120-1129 */ + V4L2_IDENT_KS0122S = 1122, + V4L2_IDENT_KS0127 = 1127, + V4L2_IDENT_KS0127B = 1128, + /* module vp27smpx: just ident 2700 */ V4L2_IDENT_VP27SMPX = 2700, + /* module vpx3220: reserved range: 3210-3229 */ + V4L2_IDENT_VPX3214C = 3214, + V4L2_IDENT_VPX3216B = 3216, + V4L2_IDENT_VPX3220A = 3220, + /* module tvp5150 */ V4L2_IDENT_TVP5150 = 5150, + /* module saa5246a: just ident 5246 */ + V4L2_IDENT_SAA5246A = 5246, + + /* module saa5249: just ident 5249 */ + V4L2_IDENT_SAA5249 = 5249, + /* module cs5345: just ident 5345 */ V4L2_IDENT_CS5345 = 5345, + /* module tea6415c: just ident 6415 */ + V4L2_IDENT_TEA6415C = 6415, + + /* module tea6420: just ident 6420 */ + V4L2_IDENT_TEA6420 = 6420, + + /* module saa6588: just ident 6588 */ + V4L2_IDENT_SAA6588 = 6588, + /* module saa6752hs: reserved range 6750-6759 */ V4L2_IDENT_SAA6752HS = 6752, V4L2_IDENT_SAA6752HS_AC3 = 6753, + /* module adv7170: just ident 7170 */ + V4L2_IDENT_ADV7170 = 7170, + + /* module adv7175: just ident 7175 */ + V4L2_IDENT_ADV7175 = 7175, + + /* module saa7185: just ident 7185 */ + V4L2_IDENT_SAA7185 = 7185, + + /* module saa7191: just ident 7191 */ + V4L2_IDENT_SAA7191 = 7191, + /* module wm8739: just ident 8739 */ V4L2_IDENT_WM8739 = 8739, /* module wm8775: just ident 8775 */ V4L2_IDENT_WM8775 = 8775, - /* module tw9910: just ident 9910 */ - V4L2_IDENT_TW9910 = 9910, - - /* module cs53132a: just ident 53132 */ - V4L2_IDENT_CS53l32A = 53132, - - /* module upd64031a: just ident 64031 */ - V4L2_IDENT_UPD64031A = 64031, + /* module tda9840: just ident 9840 */ + V4L2_IDENT_TDA9840 = 9840, - /* module upd64083: just ident 64083 */ - V4L2_IDENT_UPD64083 = 64083, + /* module cafe_ccic, just ident 8801 */ + V4L2_IDENT_CAFE = 8801, - /* module m52790: just ident 52790 */ - V4L2_IDENT_M52790 = 52790, + /* module tw9910: just ident 9910 */ + V4L2_IDENT_TW9910 = 9910, /* module msp3400: reserved range 34000-34999 and 44000-44999 */ V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only @@ -178,6 +228,18 @@ enum { V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */ V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */ V4L2_IDENT_MT9T031 = 45020, + + /* module cs53132a: just ident 53132 */ + V4L2_IDENT_CS53l32A = 53132, + + /* module upd64031a: just ident 64031 */ + V4L2_IDENT_UPD64031A = 64031, + + /* module upd64083: just ident 64083 */ + V4L2_IDENT_UPD64083 = 64083, + + /* module m52790: just ident 52790 */ + V4L2_IDENT_M52790 = 52790, }; #endif diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 95e74f1..3a69056 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -102,11 +102,15 @@ int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl, const char *v4l2_ctrl_get_name(u32 id); const char **v4l2_ctrl_get_menu(u32 id); int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def); -int v4l2_ctrl_query_fill_std(struct v4l2_queryctrl *qctrl); int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu, struct v4l2_queryctrl *qctrl, const char **menu_items); #define V4L2_CTRL_MENU_IDS_END (0xffffffff) int v4l2_ctrl_query_menu_valid_items(struct v4l2_querymenu *qmenu, const u32 *ids); + +/* Note: ctrl_classes points to an array of u32 pointers. Each u32 array is a + 0-terminated array of control IDs. Each array must be sorted low to high + and belong to the same control class. The array of u32 pointers must also + be sorted, from low class IDs to high class IDs. */ u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id); /* ------------------------------------------------------------------------- */ @@ -149,6 +153,21 @@ struct v4l2_subdev *v4l2_i2c_new_probed_subdev(struct i2c_adapter *adapter, /* Initialize an v4l2_subdev with data from an i2c_client struct */ void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client, const struct v4l2_subdev_ops *ops); +/* Return i2c client address of v4l2_subdev. */ +unsigned short v4l2_i2c_subdev_addr(struct v4l2_subdev *sd); + +enum v4l2_i2c_tuner_type { + ADDRS_RADIO, /* Radio tuner addresses */ + ADDRS_DEMOD, /* Demod tuner addresses */ + ADDRS_TV, /* TV tuner addresses */ + /* TV tuner addresses if demod is present, this excludes + addresses used by the demodulator from the list of + candidates. */ + ADDRS_TV_WITH_DEMOD, +}; +/* Return a list of I2C tuner addresses to probe. Use only if the tuner + addresses are unknown. */ +const unsigned short *v4l2_i2c_tuner_addrs(enum v4l2_i2c_tuner_type type); /* ------------------------------------------------------------------------- */ @@ -284,4 +303,7 @@ struct v4l2_crystal_freq { a v4l2_gpio struct if a direction is also needed. */ #define VIDIOC_INT_S_GPIO _IOW('d', 117, u32) +/* Get input status. Same as the status field in the v4l2_input struct. */ +#define VIDIOC_INT_G_INPUT_STATUS _IOR('d', 118, u32) + #endif /* V4L2_COMMON_H_ */ diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index e36faab..2058dd4 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h @@ -40,6 +40,8 @@ struct v4l2_file_operations { unsigned int (*poll) (struct file *, struct poll_table_struct *); long (*ioctl) (struct file *, unsigned int, unsigned long); long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); + unsigned long (*get_unmapped_area) (struct file *, unsigned long, + unsigned long, unsigned long, unsigned long); int (*mmap) (struct file *, struct vm_area_struct *); int (*open) (struct file *); int (*release) (struct file *); diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h index 55e41af..0dd3e8e 100644 --- a/include/media/v4l2-device.h +++ b/include/media/v4l2-device.h @@ -33,7 +33,9 @@ #define V4L2_DEVICE_NAME_SIZE (BUS_ID_SIZE + 16) struct v4l2_device { - /* dev->driver_data points to this struct */ + /* dev->driver_data points to this struct. + Note: dev might be NULL if there is no parent device + as is the case with e.g. ISA devices. */ struct device *dev; /* used to keep track of the registered subdevs */ struct list_head subdevs; @@ -42,33 +44,43 @@ struct v4l2_device { spinlock_t lock; /* unique device name, by default the driver name + bus ID */ char name[V4L2_DEVICE_NAME_SIZE]; + /* notify callback called by some sub-devices. */ + void (*notify)(struct v4l2_subdev *sd, + unsigned int notification, void *arg); }; -/* Initialize v4l2_dev and make dev->driver_data point to v4l2_dev */ +/* Initialize v4l2_dev and make dev->driver_data point to v4l2_dev. + dev may be NULL in rare cases (ISA devices). In that case you + must fill in the v4l2_dev->name field before calling this function. */ int __must_check v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev); -/* Set v4l2_dev->dev->driver_data to NULL and unregister all sub-devices */ +/* Set v4l2_dev->dev to NULL. Call when the USB parent disconnects. + Since the parent disappears this ensures that v4l2_dev doesn't have an + invalid parent pointer. */ +void v4l2_device_disconnect(struct v4l2_device *v4l2_dev); +/* Unregister all sub-devices and any other resources related to v4l2_dev. */ void v4l2_device_unregister(struct v4l2_device *v4l2_dev); /* Register a subdev with a v4l2 device. While registered the subdev module is marked as in-use. An error is returned if the module is no longer loaded when you attempt to register it. */ -int __must_check v4l2_device_register_subdev(struct v4l2_device *dev, struct v4l2_subdev *sd); +int __must_check v4l2_device_register_subdev(struct v4l2_device *v4l2_dev, + struct v4l2_subdev *sd); /* Unregister a subdev with a v4l2 device. Can also be called if the subdev wasn't registered. In that case it will do nothing. */ void v4l2_device_unregister_subdev(struct v4l2_subdev *sd); /* Iterate over all subdevs. */ -#define v4l2_device_for_each_subdev(sd, dev) \ - list_for_each_entry(sd, &(dev)->subdevs, list) +#define v4l2_device_for_each_subdev(sd, v4l2_dev) \ + list_for_each_entry(sd, &(v4l2_dev)->subdevs, list) /* Call the specified callback for all subdevs matching the condition. Ignore any errors. Note that you cannot add or delete a subdev while walking the subdevs list. */ -#define __v4l2_device_call_subdevs(dev, cond, o, f, args...) \ +#define __v4l2_device_call_subdevs(v4l2_dev, cond, o, f, args...) \ do { \ struct v4l2_subdev *sd; \ \ - list_for_each_entry(sd, &(dev)->subdevs, list) \ + list_for_each_entry(sd, &(v4l2_dev)->subdevs, list) \ if ((cond) && sd->ops->o && sd->ops->o->f) \ sd->ops->o->f(sd , ##args); \ } while (0) @@ -77,12 +89,12 @@ void v4l2_device_unregister_subdev(struct v4l2_subdev *sd); If the callback returns an error other than 0 or -ENOIOCTLCMD, then return with that error code. Note that you cannot add or delete a subdev while walking the subdevs list. */ -#define __v4l2_device_call_subdevs_until_err(dev, cond, o, f, args...) \ +#define __v4l2_device_call_subdevs_until_err(v4l2_dev, cond, o, f, args...) \ ({ \ struct v4l2_subdev *sd; \ long err = 0; \ \ - list_for_each_entry(sd, &(dev)->subdevs, list) { \ + list_for_each_entry(sd, &(v4l2_dev)->subdevs, list) { \ if ((cond) && sd->ops->o && sd->ops->o->f) \ err = sd->ops->o->f(sd , ##args); \ if (err && err != -ENOIOCTLCMD) \ @@ -94,16 +106,16 @@ void v4l2_device_unregister_subdev(struct v4l2_subdev *sd); /* Call the specified callback for all subdevs matching grp_id (if 0, then match them all). Ignore any errors. Note that you cannot add or delete a subdev while walking the subdevs list. */ -#define v4l2_device_call_all(dev, grpid, o, f, args...) \ - __v4l2_device_call_subdevs(dev, \ +#define v4l2_device_call_all(v4l2_dev, grpid, o, f, args...) \ + __v4l2_device_call_subdevs(v4l2_dev, \ !(grpid) || sd->grp_id == (grpid), o, f , ##args) /* Call the specified callback for all subdevs matching grp_id (if 0, then match them all). If the callback returns an error other than 0 or -ENOIOCTLCMD, then return with that error code. Note that you cannot add or delete a subdev while walking the subdevs list. */ -#define v4l2_device_call_until_err(dev, grpid, o, f, args...) \ - __v4l2_device_call_subdevs_until_err(dev, \ +#define v4l2_device_call_until_err(v4l2_dev, grpid, o, f, args...) \ + __v4l2_device_call_subdevs_until_err(v4l2_dev, \ !(grpid) || sd->grp_id == (grpid), o, f , ##args) #endif diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h index b01c044..7a4529d 100644 --- a/include/media/v4l2-ioctl.h +++ b/include/media/v4l2-ioctl.h @@ -15,6 +15,7 @@ #include <linux/mutex.h> #include <linux/compiler.h> /* need __user */ #ifdef CONFIG_VIDEO_V4L1_COMPAT +#define __MIN_V4L1 #include <linux/videodev.h> #else #include <linux/videodev2.h> @@ -267,6 +268,7 @@ struct v4l2_ioctl_ops { /* Video standard functions */ extern const char *v4l2_norm_to_name(v4l2_std_id id); +extern void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod); extern int v4l2_video_std_construct(struct v4l2_standard *vs, int id, const char *name); /* Prints the ioctl in a human-readable format */ diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 37b09e5..1d181b4 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -78,6 +78,9 @@ struct v4l2_subdev_core_ops { int (*queryctrl)(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc); int (*g_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl); int (*s_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl); + int (*g_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls); + int (*s_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls); + int (*try_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls); int (*querymenu)(struct v4l2_subdev *sd, struct v4l2_querymenu *qm); long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg); #ifdef CONFIG_VIDEO_ADV_DEBUG @@ -112,9 +115,17 @@ struct v4l2_subdev_video_ops { int (*g_vbi_data)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_data *vbi_data); int (*g_sliced_vbi_cap)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_cap *cap); int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std); + int (*querystd)(struct v4l2_subdev *sd, v4l2_std_id *std); + int (*g_input_status)(struct v4l2_subdev *sd, u32 *status); int (*s_stream)(struct v4l2_subdev *sd, int enable); - int (*s_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt); + int (*enum_fmt)(struct v4l2_subdev *sd, struct v4l2_fmtdesc *fmtdesc); int (*g_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt); + int (*try_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt); + int (*s_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt); + int (*g_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); + int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); + int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize); + int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival); }; struct v4l2_subdev_ops { @@ -132,7 +143,7 @@ struct v4l2_subdev_ops { struct v4l2_subdev { struct list_head list; struct module *owner; - struct v4l2_device *dev; + struct v4l2_device *v4l2_dev; const struct v4l2_subdev_ops *ops; /* name must be unique */ char name[V4L2_SUBDEV_NAME_SIZE]; @@ -171,7 +182,7 @@ static inline void v4l2_subdev_init(struct v4l2_subdev *sd, /* ops->core MUST be set */ BUG_ON(!ops || !ops->core); sd->ops = ops; - sd->dev = NULL; + sd->v4l2_dev = NULL; sd->name[0] = '\0'; sd->grp_id = 0; sd->priv = NULL; @@ -186,4 +197,9 @@ static inline void v4l2_subdev_init(struct v4l2_subdev *sd, (!(sd) ? -ENODEV : (((sd) && (sd)->ops->o && (sd)->ops->o->f) ? \ (sd)->ops->o->f((sd) , ##args) : -ENOIOCTLCMD)) +/* Send a notification to v4l2_device. */ +#define v4l2_subdev_notify(sd, notification, arg) \ + ((!(sd) || !(sd)->v4l2_dev || !(sd)->v4l2_dev->notify) ? -ENODEV : \ + (sd)->v4l2_dev->notify((sd), (notification), (arg))) + #endif diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h index 874f134..1c5946c 100644 --- a/include/media/videobuf-core.h +++ b/include/media/videobuf-core.h @@ -18,6 +18,7 @@ #include <linux/poll.h> #ifdef CONFIG_VIDEO_V4L1_COMPAT +#define __MIN_V4L1 #include <linux/videodev.h> #endif #include <linux/videodev2.h> |