diff options
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/ak881x.h | 25 | ||||
-rw-r--r-- | include/media/davinci/vpfe_capture.h | 2 | ||||
-rw-r--r-- | include/media/ir-common.h | 74 | ||||
-rw-r--r-- | include/media/ir-core.h | 142 | ||||
-rw-r--r-- | include/media/ir-kbd-i2c.h | 6 | ||||
-rw-r--r-- | include/media/rc-map.h | 121 | ||||
-rw-r--r-- | include/media/saa7146_vv.h | 1 | ||||
-rw-r--r-- | include/media/sh_vou.h | 34 | ||||
-rw-r--r-- | include/media/soc_camera.h | 12 | ||||
-rw-r--r-- | include/media/v4l2-chip-ident.h | 127 | ||||
-rw-r--r-- | include/media/v4l2-common.h | 27 | ||||
-rw-r--r-- | include/media/v4l2-dev.h | 5 | ||||
-rw-r--r-- | include/media/v4l2-event.h | 67 | ||||
-rw-r--r-- | include/media/v4l2-fh.h | 65 | ||||
-rw-r--r-- | include/media/v4l2-ioctl.h | 7 | ||||
-rw-r--r-- | include/media/v4l2-mem2mem.h | 201 | ||||
-rw-r--r-- | include/media/v4l2-subdev.h | 70 | ||||
-rw-r--r-- | include/media/videobuf-core.h | 35 | ||||
-rw-r--r-- | include/media/videobuf-dma-sg.h | 26 | ||||
-rw-r--r-- | include/media/videobuf-vmalloc.h | 12 |
20 files changed, 822 insertions, 237 deletions
diff --git a/include/media/ak881x.h b/include/media/ak881x.h new file mode 100644 index 000000000000..b7f2add5ce7b --- /dev/null +++ b/include/media/ak881x.h @@ -0,0 +1,25 @@ +/* + * Header for AK8813 / AK8814 TV-ecoders from Asahi Kasei Microsystems Co., Ltd. (AKM) + * + * Copyright (C) 2010, Guennadi Liakhovetski <g.liakhovetski@gmx.de> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef AK881X_H +#define AK881X_H + +#define AK881X_IF_MODE_MASK (3 << 0) +#define AK881X_IF_MODE_BT656 (0 << 0) +#define AK881X_IF_MODE_MASTER (1 << 0) +#define AK881X_IF_MODE_SLAVE (2 << 0) +#define AK881X_FIELD (1 << 2) +#define AK881X_COMPONENT (1 << 3) + +struct ak881x_pdata { + unsigned long flags; +}; + +#endif diff --git a/include/media/davinci/vpfe_capture.h b/include/media/davinci/vpfe_capture.h index 4314a5f6a087..cc973ed845a7 100644 --- a/include/media/davinci/vpfe_capture.h +++ b/include/media/davinci/vpfe_capture.h @@ -94,6 +94,8 @@ struct vpfe_config { /* vpfe clock */ struct clk *vpssclk; struct clk *slaveclk; + /* Function for Clearing the interrupt */ + void (*clr_intr)(int vdint); }; struct vpfe_device { diff --git a/include/media/ir-common.h b/include/media/ir-common.h index c66298062d39..528050e39ad9 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h @@ -50,6 +50,10 @@ struct card_ir { struct ir_input_state ir; char name[32]; char phys[32]; + int users; + + u32 running:1; + struct ir_dev_props props; /* Usual gpio signalling */ @@ -79,6 +83,9 @@ struct card_ir { /* NEC decoding */ u32 nec_gpio; struct tasklet_struct tlet; + + /* IR core raw decoding */ + u32 raw_decode; }; /* Routines from ir-functions.c */ @@ -97,71 +104,4 @@ u32 ir_rc5_decode(unsigned int code); void ir_rc5_timer_end(unsigned long data); void ir_rc5_timer_keyup(unsigned long data); -/* scancode->keycode map tables from ir-keymaps.c */ - -extern struct ir_scancode_table ir_codes_empty_table; -extern struct ir_scancode_table ir_codes_avermedia_table; -extern struct ir_scancode_table ir_codes_avermedia_dvbt_table; -extern struct ir_scancode_table ir_codes_avermedia_m135a_table; -extern struct ir_scancode_table ir_codes_avermedia_cardbus_table; -extern struct ir_scancode_table ir_codes_apac_viewcomp_table; -extern struct ir_scancode_table ir_codes_pixelview_table; -extern struct ir_scancode_table ir_codes_pixelview_new_table; -extern struct ir_scancode_table ir_codes_nebula_table; -extern struct ir_scancode_table ir_codes_dntv_live_dvb_t_table; -extern struct ir_scancode_table ir_codes_iodata_bctv7e_table; -extern struct ir_scancode_table ir_codes_adstech_dvb_t_pci_table; -extern struct ir_scancode_table ir_codes_msi_tvanywhere_table; -extern struct ir_scancode_table ir_codes_cinergy_1400_table; -extern struct ir_scancode_table ir_codes_avertv_303_table; -extern struct ir_scancode_table ir_codes_dntv_live_dvbt_pro_table; -extern struct ir_scancode_table ir_codes_em_terratec_table; -extern struct ir_scancode_table ir_codes_pinnacle_grey_table; -extern struct ir_scancode_table ir_codes_flyvideo_table; -extern struct ir_scancode_table ir_codes_flydvb_table; -extern struct ir_scancode_table ir_codes_cinergy_table; -extern struct ir_scancode_table ir_codes_eztv_table; -extern struct ir_scancode_table ir_codes_avermedia_table; -extern struct ir_scancode_table ir_codes_videomate_tv_pvr_table; -extern struct ir_scancode_table ir_codes_manli_table; -extern struct ir_scancode_table ir_codes_gotview7135_table; -extern struct ir_scancode_table ir_codes_purpletv_table; -extern struct ir_scancode_table ir_codes_pctv_sedna_table; -extern struct ir_scancode_table ir_codes_pv951_table; -extern struct ir_scancode_table ir_codes_rc5_tv_table; -extern struct ir_scancode_table ir_codes_winfast_table; -extern struct ir_scancode_table ir_codes_pinnacle_color_table; -extern struct ir_scancode_table ir_codes_hauppauge_new_table; -extern struct ir_scancode_table ir_codes_rc5_hauppauge_new_table; -extern struct ir_scancode_table ir_codes_npgtech_table; -extern struct ir_scancode_table ir_codes_norwood_table; -extern struct ir_scancode_table ir_codes_proteus_2309_table; -extern struct ir_scancode_table ir_codes_budget_ci_old_table; -extern struct ir_scancode_table ir_codes_asus_pc39_table; -extern struct ir_scancode_table ir_codes_encore_enltv_table; -extern struct ir_scancode_table ir_codes_encore_enltv2_table; -extern struct ir_scancode_table ir_codes_tt_1500_table; -extern struct ir_scancode_table ir_codes_fusionhdtv_mce_table; -extern struct ir_scancode_table ir_codes_behold_table; -extern struct ir_scancode_table ir_codes_behold_columbus_table; -extern struct ir_scancode_table ir_codes_pinnacle_pctv_hd_table; -extern struct ir_scancode_table ir_codes_genius_tvgo_a11mce_table; -extern struct ir_scancode_table ir_codes_powercolor_real_angel_table; -extern struct ir_scancode_table ir_codes_avermedia_a16d_table; -extern struct ir_scancode_table ir_codes_encore_enltv_fm53_table; -extern struct ir_scancode_table ir_codes_real_audio_220_32_keys_table; -extern struct ir_scancode_table ir_codes_msi_tvanywhere_plus_table; -extern struct ir_scancode_table ir_codes_ati_tv_wonder_hd_600_table; -extern struct ir_scancode_table ir_codes_kworld_plus_tv_analog_table; -extern struct ir_scancode_table ir_codes_kaiomy_table; -extern struct ir_scancode_table ir_codes_dm1105_nec_table; -extern struct ir_scancode_table ir_codes_tevii_nec_table; -extern struct ir_scancode_table ir_codes_tbs_nec_table; -extern struct ir_scancode_table ir_codes_evga_indtube_table; -extern struct ir_scancode_table ir_codes_terratec_cinergy_xs_table; -extern struct ir_scancode_table ir_codes_videomate_s350_table; -extern struct ir_scancode_table ir_codes_gadmei_rm008z_table; -extern struct ir_scancode_table ir_codes_nec_terratec_cinergy_xs_table; -extern struct ir_scancode_table ir_codes_winfast_usbii_deluxe_table; -extern struct ir_scancode_table ir_codes_kworld_315u_table; #endif diff --git a/include/media/ir-core.h b/include/media/ir-core.h index 61c223bc3953..ad1303f20e00 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -1,6 +1,8 @@ /* * Remote Controller core header * + * Copyright (C) 2009-2010 by Mauro Carvalho Chehab <mchehab@redhat.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 of the License. @@ -14,61 +16,133 @@ #ifndef _IR_CORE #define _IR_CORE -#include <linux/input.h> #include <linux/spinlock.h> +#include <linux/kfifo.h> +#include <linux/time.h> +#include <linux/timer.h> +#include <media/rc-map.h> extern int ir_core_debug; #define IR_dprintk(level, fmt, arg...) if (ir_core_debug >= level) \ printk(KERN_DEBUG "%s: " fmt , __func__, ## arg) -#define IR_TYPE_UNKNOWN 0 -#define IR_TYPE_RC5 (1 << 0) /* Philips RC5 protocol */ -#define IR_TYPE_PD (1 << 1) /* Pulse distance encoded IR */ -#define IR_TYPE_NEC (1 << 2) -#define IR_TYPE_OTHER (((u64)1) << 63l) - -struct ir_scancode { - u16 scancode; - u32 keycode; -}; - -struct ir_scancode_table { - struct ir_scancode *scan; - int size; - u64 ir_type; - spinlock_t lock; +enum rc_driver_type { + RC_DRIVER_SCANCODE = 0, /* Driver or hardware generates a scancode */ + RC_DRIVER_IR_RAW, /* Needs a Infra-Red pulse/space decoder */ }; +/** + * struct ir_dev_props - Allow caller drivers to set special properties + * @driver_type: specifies if the driver or hardware have already a decoder, + * or if it needs to use the IR raw event decoders to produce a scancode + * @allowed_protos: bitmask with the supported IR_TYPE_* protocols + * @scanmask: some hardware decoders are not capable of providing the full + * scancode to the application. As this is a hardware limit, we can't do + * anything with it. Yet, as the same keycode table can be used with other + * devices, a mask is provided to allow its usage. Drivers should generally + * leave this field in blank + * @priv: driver-specific data, to be used on the callbacks + * @change_protocol: allow changing the protocol used on hardware decoders + * @open: callback to allow drivers to enable polling/irq when IR input device + * is opened. + * @close: callback to allow drivers to disable polling/irq when IR input device + * is opened. + */ struct ir_dev_props { - unsigned long allowed_protos; - void *priv; - int (*change_protocol)(void *priv, u64 ir_type); + enum rc_driver_type driver_type; + unsigned long allowed_protos; + u32 scanmask; + void *priv; + int (*change_protocol)(void *priv, u64 ir_type); + int (*open)(void *priv); + void (*close)(void *priv); }; - struct ir_input_dev { - struct input_dev *dev; /* Input device*/ + struct device dev; /* device */ + char *driver_name; /* Name of the driver module */ struct ir_scancode_table rc_tab; /* scan/key table */ unsigned long devno; /* device number */ - struct attribute_group attr; /* IR attributes */ - struct device *class_dev; /* virtual class dev */ const struct ir_dev_props *props; /* Device properties */ + struct ir_raw_event_ctrl *raw; /* for raw pulse/space events */ + struct input_dev *input_dev; /* the input device associated with this device */ + + /* key info - needed by IR keycode handlers */ + spinlock_t keylock; /* protects the below members */ + bool keypressed; /* current state */ + unsigned long keyup_jiffies; /* when should the current keypress be released? */ + struct timer_list timer_keyup; /* timer for releasing a keypress */ + u32 last_keycode; /* keycode of last command */ + u32 last_scancode; /* scancode of last command */ + u8 last_toggle; /* toggle of last command */ }; -#define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr) -/* Routines from ir-keytable.c */ +enum raw_event_type { + IR_SPACE = (1 << 0), + IR_PULSE = (1 << 1), + IR_START_EVENT = (1 << 2), + IR_STOP_EVENT = (1 << 3), +}; -u32 ir_g_keycode_from_table(struct input_dev *input_dev, - u32 scancode); +#define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr) -int ir_input_register(struct input_dev *dev, +/* From ir-keytable.c */ +int __ir_input_register(struct input_dev *dev, const struct ir_scancode_table *ir_codes, - const struct ir_dev_props *props); + const struct ir_dev_props *props, + const char *driver_name); + +static inline int ir_input_register(struct input_dev *dev, + const char *map_name, + const struct ir_dev_props *props, + const char *driver_name) { + struct ir_scancode_table *ir_codes; + struct ir_input_dev *ir_dev; + int rc; + + if (!map_name) + return -EINVAL; + + ir_codes = get_rc_map(map_name); + if (!ir_codes) + return -EINVAL; + + rc = __ir_input_register(dev, ir_codes, props, driver_name); + if (rc < 0) + return -EINVAL; + + ir_dev = input_get_drvdata(dev); + + if (!rc && ir_dev->props && ir_dev->props->change_protocol) + rc = ir_dev->props->change_protocol(ir_dev->props->priv, + ir_codes->ir_type); + + return rc; +} + void ir_input_unregister(struct input_dev *input_dev); -/* Routines from ir-sysfs.c */ +void ir_repeat(struct input_dev *dev); +void ir_keydown(struct input_dev *dev, int scancode, u8 toggle); +u32 ir_g_keycode_from_table(struct input_dev *input_dev, u32 scancode); + +/* From ir-raw-event.c */ + +struct ir_raw_event { + unsigned pulse:1; + unsigned duration:31; +}; + +#define IR_MAX_DURATION 0x7FFFFFFF /* a bit more than 2 seconds */ -int ir_register_class(struct input_dev *input_dev); -void ir_unregister_class(struct input_dev *input_dev); +void ir_raw_event_handle(struct input_dev *input_dev); +int ir_raw_event_store(struct input_dev *input_dev, struct ir_raw_event *ev); +int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type type); +static inline void ir_raw_event_reset(struct input_dev *input_dev) +{ + struct ir_raw_event ev = { .pulse = false, .duration = 0 }; + ir_raw_event_store(input_dev, &ev); + ir_raw_event_handle(input_dev); +} -#endif +#endif /* _IR_CORE */ diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h index 9142936603cc..0506e45c9a4f 100644 --- a/include/media/ir-kbd-i2c.h +++ b/include/media/ir-kbd-i2c.h @@ -6,7 +6,7 @@ struct IR_i2c; struct IR_i2c { - struct ir_scancode_table *ir_codes; + char *ir_codes; struct i2c_client *c; struct input_dev *input; @@ -34,9 +34,9 @@ enum ir_kbd_get_key_fn { /* Can be passed when instantiating an ir_video i2c device */ struct IR_i2c_init_data { - struct ir_scancode_table *ir_codes; + char *ir_codes; const char *name; - u64 type; /* IR_TYPE_RC5, IR_TYPE_PD, etc */ + u64 type; /* IR_TYPE_RC5, etc */ /* * Specify either a function pointer or a value indicating one of * ir_kbd_i2c's internal get_key functions diff --git a/include/media/rc-map.h b/include/media/rc-map.h new file mode 100644 index 000000000000..5833966a7100 --- /dev/null +++ b/include/media/rc-map.h @@ -0,0 +1,121 @@ +/* + * rc-map.h - define RC map names used by RC drivers + * + * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.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; either version 2 of the License, or + * (at your option) any later version. + */ + +#include <linux/input.h> + +#define IR_TYPE_UNKNOWN 0 +#define IR_TYPE_RC5 (1 << 0) /* Philips RC5 protocol */ +#define IR_TYPE_NEC (1 << 1) +#define IR_TYPE_RC6 (1 << 2) /* Philips RC6 protocol */ +#define IR_TYPE_JVC (1 << 3) /* JVC protocol */ +#define IR_TYPE_SONY (1 << 4) /* Sony12/15/20 protocol */ +#define IR_TYPE_OTHER (1u << 31) + +struct ir_scancode { + u32 scancode; + u32 keycode; +}; + +struct ir_scancode_table { + struct ir_scancode *scan; + unsigned int size; /* Max number of entries */ + unsigned int len; /* Used number of entries */ + unsigned int alloc; /* Size of *scan in bytes */ + u64 ir_type; + char *name; + spinlock_t lock; +}; + +struct rc_keymap { + struct list_head list; + struct ir_scancode_table map; +}; + +/* Routines from rc-map.c */ + +int ir_register_map(struct rc_keymap *map); +void ir_unregister_map(struct rc_keymap *map); +struct ir_scancode_table *get_rc_map(const char *name); +void rc_map_init(void); + +/* Names of the several keytables defined in-kernel */ + +#define RC_MAP_ADSTECH_DVB_T_PCI "rc-adstech-dvb-t-pci" +#define RC_MAP_APAC_VIEWCOMP "rc-apac-viewcomp" +#define RC_MAP_ASUS_PC39 "rc-asus-pc39" +#define RC_MAP_ATI_TV_WONDER_HD_600 "rc-ati-tv-wonder-hd-600" +#define RC_MAP_AVERMEDIA_A16D "rc-avermedia-a16d" +#define RC_MAP_AVERMEDIA_CARDBUS "rc-avermedia-cardbus" +#define RC_MAP_AVERMEDIA_DVBT "rc-avermedia-dvbt" +#define RC_MAP_AVERMEDIA_M135A_RM_JX "rc-avermedia-m135a-rm-jx" +#define RC_MAP_AVERMEDIA "rc-avermedia" +#define RC_MAP_AVERTV_303 "rc-avertv-303" +#define RC_MAP_BEHOLD_COLUMBUS "rc-behold-columbus" +#define RC_MAP_BEHOLD "rc-behold" +#define RC_MAP_BUDGET_CI_OLD "rc-budget-ci-old" +#define RC_MAP_CINERGY_1400 "rc-cinergy-1400" +#define RC_MAP_CINERGY "rc-cinergy" +#define RC_MAP_DM1105_NEC "rc-dm1105-nec" +#define RC_MAP_DNTV_LIVE_DVBT_PRO "rc-dntv-live-dvbt-pro" +#define RC_MAP_DNTV_LIVE_DVB_T "rc-dntv-live-dvb-t" +#define RC_MAP_EMPTY "rc-empty" +#define RC_MAP_EM_TERRATEC "rc-em-terratec" +#define RC_MAP_ENCORE_ENLTV2 "rc-encore-enltv2" +#define RC_MAP_ENCORE_ENLTV_FM53 "rc-encore-enltv-fm53" +#define RC_MAP_ENCORE_ENLTV "rc-encore-enltv" +#define RC_MAP_EVGA_INDTUBE "rc-evga-indtube" +#define RC_MAP_EZTV "rc-eztv" +#define RC_MAP_FLYDVB "rc-flydvb" +#define RC_MAP_FLYVIDEO "rc-flyvideo" +#define RC_MAP_FUSIONHDTV_MCE "rc-fusionhdtv-mce" +#define RC_MAP_GADMEI_RM008Z "rc-gadmei-rm008z" +#define RC_MAP_GENIUS_TVGO_A11MCE "rc-genius-tvgo-a11mce" +#define RC_MAP_GOTVIEW7135 "rc-gotview7135" +#define RC_MAP_HAUPPAUGE_NEW "rc-hauppauge-new" +#define RC_MAP_IMON_MCE "rc-imon-mce" +#define RC_MAP_IMON_PAD "rc-imon-pad" +#define RC_MAP_IODATA_BCTV7E "rc-iodata-bctv7e" +#define RC_MAP_KAIOMY "rc-kaiomy" +#define RC_MAP_KWORLD_315U "rc-kworld-315u" +#define RC_MAP_KWORLD_PLUS_TV_ANALOG "rc-kworld-plus-tv-analog" +#define RC_MAP_MANLI "rc-manli" +#define RC_MAP_MSI_TVANYWHERE_PLUS "rc-msi-tvanywhere-plus" +#define RC_MAP_MSI_TVANYWHERE "rc-msi-tvanywhere" +#define RC_MAP_NEBULA "rc-nebula" +#define RC_MAP_NEC_TERRATEC_CINERGY_XS "rc-nec-terratec-cinergy-xs" +#define RC_MAP_NORWOOD "rc-norwood" +#define RC_MAP_NPGTECH "rc-npgtech" +#define RC_MAP_PCTV_SEDNA "rc-pctv-sedna" +#define RC_MAP_PINNACLE_COLOR "rc-pinnacle-color" +#define RC_MAP_PINNACLE_GREY "rc-pinnacle-grey" +#define RC_MAP_PINNACLE_PCTV_HD "rc-pinnacle-pctv-hd" +#define RC_MAP_PIXELVIEW_NEW "rc-pixelview-new" +#define RC_MAP_PIXELVIEW "rc-pixelview" +#define RC_MAP_PIXELVIEW_MK12 "rc-pixelview-mk12" +#define RC_MAP_POWERCOLOR_REAL_ANGEL "rc-powercolor-real-angel" +#define RC_MAP_PROTEUS_2309 "rc-proteus-2309" +#define RC_MAP_PURPLETV "rc-purpletv" +#define RC_MAP_PV951 "rc-pv951" +#define RC_MAP_RC5_HAUPPAUGE_NEW "rc-rc5-hauppauge-new" +#define RC_MAP_RC5_TV "rc-rc5-tv" +#define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys" +#define RC_MAP_TBS_NEC "rc-tbs-nec" +#define RC_MAP_TERRATEC_CINERGY_XS "rc-terratec-cinergy-xs" +#define RC_MAP_TEVII_NEC "rc-tevii-nec" +#define RC_MAP_TT_1500 "rc-tt-1500" +#define RC_MAP_VIDEOMATE_S350 "rc-videomate-s350" +#define RC_MAP_VIDEOMATE_TV_PVR "rc-videomate-tv-pvr" +#define RC_MAP_WINFAST "rc-winfast" +#define RC_MAP_WINFAST_USBII_DELUXE "rc-winfast-usbii-deluxe" +/* + * Please, do not just append newer Remote Controller names at the end. + * The names should be ordered in alphabetical order + */ diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h index b9da1f5591e7..4aeff96ff7d8 100644 --- a/include/media/saa7146_vv.h +++ b/include/media/saa7146_vv.h @@ -188,7 +188,6 @@ void saa7146_buffer_timeout(unsigned long data); void saa7146_dma_free(struct saa7146_dev* dev,struct videobuf_queue *q, struct saa7146_buf *buf); -int saa7146_vv_devinit(struct saa7146_dev *dev); int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv); int saa7146_vv_release(struct saa7146_dev* dev); diff --git a/include/media/sh_vou.h b/include/media/sh_vou.h new file mode 100644 index 000000000000..a3ef30242b00 --- /dev/null +++ b/include/media/sh_vou.h @@ -0,0 +1,34 @@ +/* + * SuperH Video Output Unit (VOU) driver header + * + * Copyright (C) 2010, Guennadi Liakhovetski <g.liakhovetski@gmx.de> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#ifndef SH_VOU_H +#define SH_VOU_H + +#include <linux/i2c.h> + +/* Bus flags */ +#define SH_VOU_PCLK_FALLING (1 << 0) +#define SH_VOU_HSYNC_LOW (1 << 1) +#define SH_VOU_VSYNC_LOW (1 << 2) + +enum sh_vou_bus_fmt { + SH_VOU_BUS_8BIT, + SH_VOU_BUS_16BIT, + SH_VOU_BUS_BT656, +}; + +struct sh_vou_pdata { + enum sh_vou_bus_fmt bus_fmt; + int i2c_adap; + struct i2c_board_info *board_info; + unsigned long flags; + char *module_name; +}; + +#endif diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index 9d69f01b6fa2..c9a5bbfa6ab5 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h @@ -266,8 +266,8 @@ static inline unsigned long soc_camera_bus_param_compatible( common_flags; } -static inline void soc_camera_limit_side(unsigned int *start, - unsigned int *length, unsigned int start_min, +static inline void soc_camera_limit_side(int *start, int *length, + unsigned int start_min, unsigned int length_min, unsigned int length_max) { if (*length < length_min) @@ -284,4 +284,12 @@ static inline void soc_camera_limit_side(unsigned int *start, extern unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl, unsigned long flags); +/* This is only temporary here - until v4l2-subdev begins to link to video_device */ +#include <linux/i2c.h> +static inline struct video_device *soc_camera_i2c_to_vdev(struct i2c_client *client) +{ + struct soc_camera_device *icd = client->dev.platform_data; + return icd->vdev; +} + #endif diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h index 56abf21dd786..21b4428c12ab 100644 --- a/include/media/v4l2-chip-ident.h +++ b/include/media/v4l2-chip-ident.h @@ -25,6 +25,10 @@ #define V4L2_CHIP_IDENT_H_ /* VIDIOC_DBG_G_CHIP_IDENT: identifies the actual chip installed on the board */ + +/* KEEP THIS LIST ORDERED BY ID! + Otherwise it will be hard to see which ranges are already in use when + adding support to a new chip family. */ enum { /* general idents: reserved range 0-49 */ V4L2_IDENT_NONE = 0, /* No chip matched */ @@ -77,17 +81,14 @@ enum { V4L2_IDENT_CX23417 = 417, 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 au0828 */ + V4L2_IDENT_AU0828 = 828, + /* module bt856: just ident 856 */ V4L2_IDENT_BT856 = 856, @@ -99,6 +100,9 @@ enum { V4L2_IDENT_KS0127 = 1127, V4L2_IDENT_KS0127B = 1128, + /* module indycam: just ident 2000 */ + V4L2_IDENT_INDYCAM = 2000, + /* module vp27smpx: just ident 2700 */ V4L2_IDENT_VP27SMPX = 2700, @@ -162,20 +166,21 @@ enum { /* module saa7706h: just ident 7706 */ V4L2_IDENT_SAA7706H = 7706, + /* module mt9v011, just ident 8243 */ + V4L2_IDENT_MT9V011 = 8243, + /* module wm8739: just ident 8739 */ V4L2_IDENT_WM8739 = 8739, /* module wm8775: just ident 8775 */ V4L2_IDENT_WM8775 = 8775, - /* module tda9840: just ident 9840 */ - V4L2_IDENT_TDA9840 = 9840, - /* module cafe_ccic, just ident 8801 */ V4L2_IDENT_CAFE = 8801, - /* module mt9v011, just ident 8243 */ - V4L2_IDENT_MT9V011 = 8243, + /* AKM AK8813/AK8814 */ + V4L2_IDENT_AK8813 = 8813, + V4L2_IDENT_AK8814 = 8814, /* module cx23885 and cx25840 */ V4L2_IDENT_CX23885 = 8850, @@ -186,6 +191,9 @@ enum { V4L2_IDENT_CX23888_AV = 8881, /* Integrated A/V decoder */ V4L2_IDENT_CX23888_IR = 8882, /* Integrated infrared controller */ + /* module tda9840: just ident 9840 */ + V4L2_IDENT_TDA9840 = 9840, + /* module tw9910: just ident 9910 */ V4L2_IDENT_TW9910 = 9910, @@ -198,72 +206,70 @@ enum { V4L2_IDENT_CX23101 = 23101, V4L2_IDENT_CX23102 = 23102, - /* module msp3400: reserved range 34000-34999 and 44000-44999 */ + /* module msp3400: reserved range 34000-34999 for msp34xx */ V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only use internally (tveeprom.c). */ V4L2_IDENT_MSP3400B = 34002, - V4L2_IDENT_MSP3410B = 34102, - V4L2_IDENT_MSP3400C = 34003, - V4L2_IDENT_MSP3410C = 34103, - V4L2_IDENT_MSP3400D = 34004, - V4L2_IDENT_MSP3410D = 34104, + V4L2_IDENT_MSP3400G = 34007, + V4L2_IDENT_MSP3401G = 34017, + V4L2_IDENT_MSP3402G = 34027, V4L2_IDENT_MSP3405D = 34054, - V4L2_IDENT_MSP3415D = 34154, + V4L2_IDENT_MSP3405G = 34057, V4L2_IDENT_MSP3407D = 34074, - V4L2_IDENT_MSP3417D = 34174, + V4L2_IDENT_MSP3407G = 34077, - V4L2_IDENT_MSP3400G = 34007, + V4L2_IDENT_MSP3410B = 34102, + V4L2_IDENT_MSP3410C = 34103, + V4L2_IDENT_MSP3410D = 34104, V4L2_IDENT_MSP3410G = 34107, - V4L2_IDENT_MSP3420G = 34207, - V4L2_IDENT_MSP3430G = 34307, - V4L2_IDENT_MSP3440G = 34407, - V4L2_IDENT_MSP3450G = 34507, - V4L2_IDENT_MSP3460G = 34607, - - V4L2_IDENT_MSP3401G = 34017, V4L2_IDENT_MSP3411G = 34117, - V4L2_IDENT_MSP3421G = 34217, - V4L2_IDENT_MSP3431G = 34317, - V4L2_IDENT_MSP3441G = 34417, - V4L2_IDENT_MSP3451G = 34517, - V4L2_IDENT_MSP3461G = 34617, - - V4L2_IDENT_MSP3402G = 34027, V4L2_IDENT_MSP3412G = 34127, - V4L2_IDENT_MSP3422G = 34227, - V4L2_IDENT_MSP3442G = 34427, - V4L2_IDENT_MSP3452G = 34527, - - V4L2_IDENT_MSP3405G = 34057, + V4L2_IDENT_MSP3415D = 34154, V4L2_IDENT_MSP3415G = 34157, - V4L2_IDENT_MSP3425G = 34257, - V4L2_IDENT_MSP3435G = 34357, - V4L2_IDENT_MSP3445G = 34457, - V4L2_IDENT_MSP3455G = 34557, - V4L2_IDENT_MSP3465G = 34657, - - V4L2_IDENT_MSP3407G = 34077, + V4L2_IDENT_MSP3417D = 34174, V4L2_IDENT_MSP3417G = 34177, + + V4L2_IDENT_MSP3420G = 34207, + V4L2_IDENT_MSP3421G = 34217, + V4L2_IDENT_MSP3422G = 34227, + V4L2_IDENT_MSP3425G = 34257, V4L2_IDENT_MSP3427G = 34277, + + V4L2_IDENT_MSP3430G = 34307, + V4L2_IDENT_MSP3431G = 34317, + V4L2_IDENT_MSP3435G = 34357, V4L2_IDENT_MSP3437G = 34377, + + V4L2_IDENT_MSP3440G = 34407, + V4L2_IDENT_MSP3441G = 34417, + V4L2_IDENT_MSP3442G = 34427, + V4L2_IDENT_MSP3445G = 34457, V4L2_IDENT_MSP3447G = 34477, + + V4L2_IDENT_MSP3450G = 34507, + V4L2_IDENT_MSP3451G = 34517, + V4L2_IDENT_MSP3452G = 34527, + V4L2_IDENT_MSP3455G = 34557, V4L2_IDENT_MSP3457G = 34577, + + V4L2_IDENT_MSP3460G = 34607, + V4L2_IDENT_MSP3461G = 34617, + V4L2_IDENT_MSP3465G = 34657, V4L2_IDENT_MSP3467G = 34677, - /* module msp3400: reserved range 34000-34999 and 44000-44999 */ + /* module msp3400: reserved range 44000-44999 for msp44xx */ V4L2_IDENT_MSP4400G = 44007, - V4L2_IDENT_MSP4410G = 44107, - V4L2_IDENT_MSP4420G = 44207, - V4L2_IDENT_MSP4440G = 44407, - V4L2_IDENT_MSP4450G = 44507, - V4L2_IDENT_MSP4408G = 44087, + V4L2_IDENT_MSP4410G = 44107, V4L2_IDENT_MSP4418G = 44187, + V4L2_IDENT_MSP4420G = 44207, V4L2_IDENT_MSP4428G = 44287, + V4L2_IDENT_MSP4440G = 44407, V4L2_IDENT_MSP4448G = 44487, + V4L2_IDENT_MSP4450G = 44507, V4L2_IDENT_MSP4458G = 44587, /* Micron CMOS sensor chips: 45000-45099 */ @@ -282,20 +288,27 @@ enum { /* HV7131R CMOS sensor: just ident 46000 */ V4L2_IDENT_HV7131R = 46000, + /* Sharp RJ54N1CB0C, 0xCB0C = 51980 */ + V4L2_IDENT_RJ54N1CB0C = 51980, + + /* module m52790: just ident 52790 */ + V4L2_IDENT_M52790 = 52790, + /* module cs53132a: just ident 53132 */ V4L2_IDENT_CS53l32A = 53132, + /* modules upd61151 MPEG2 encoder: just ident 54000 */ + V4L2_IDENT_UPD61161 = 54000, + /* modules upd61152 MPEG2 encoder with AC3: just ident 54001 */ + V4L2_IDENT_UPD61162 = 54001, + /* 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, - - /* Sharp RJ54N1CB0C, 0xCB0C = 51980 */ - V4L2_IDENT_RJ54N1CB0C = 51980, + /* Don't just add new IDs at the end: KEEP THIS LIST ORDERED BY ID! */ }; #endif diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 1c7b259f341c..98b32645e5a7 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -85,13 +85,13 @@ struct v4l2_prio_state { atomic_t prios[4]; }; -int v4l2_prio_init(struct v4l2_prio_state *global); +void v4l2_prio_init(struct v4l2_prio_state *global); int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local, enum v4l2_priority new); -int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local); -int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local); +void v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local); +void v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority local); enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global); -int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local); +int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority local); /* ------------------------------------------------------------------------- */ @@ -184,6 +184,25 @@ const unsigned short *v4l2_i2c_tuner_addrs(enum v4l2_i2c_tuner_type type); /* ------------------------------------------------------------------------- */ +/* SPI Helper functions */ +#if defined(CONFIG_SPI) + +#include <linux/spi/spi.h> + +struct spi_device; + +/* Load an spi module and return an initialized v4l2_subdev struct. + The client_type argument is the name of the chip that's on the adapter. */ +struct v4l2_subdev *v4l2_spi_new_subdev(struct v4l2_device *v4l2_dev, + struct spi_master *master, struct spi_board_info *info); + +/* Initialize an v4l2_subdev with data from an spi_device struct */ +void v4l2_spi_subdev_init(struct v4l2_subdev *sd, struct spi_device *spi, + const struct v4l2_subdev_ops *ops); +#endif + +/* ------------------------------------------------------------------------- */ + /* Note: these remaining ioctls/structs should be removed as well, but they are still used in tuner-simple.c (TUNER_SET_CONFIG), cx18/ivtv (RESET) and v4l2-int-device.h (v4l2_routing). To remove these ioctls some more cleanup diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index 2dee93892ea2..bebe44b03e0f 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h @@ -32,6 +32,7 @@ struct v4l2_device; Drivers can clear this flag if they want to block all future device access. It is cleared by video_unregister_device. */ #define V4L2_FL_REGISTERED (0) +#define V4L2_FL_USES_V4L2_FH (1) struct v4l2_file_operations { struct module *owner; @@ -77,6 +78,10 @@ struct video_device /* attribute to differentiate multiple indices on one physical device */ int index; + /* V4L2 file handles */ + spinlock_t fh_lock; /* Lock for all v4l2_fhs */ + struct list_head fh_list; /* List of struct v4l2_fh */ + int debug; /* Activates debug level*/ /* Video standard vars */ diff --git a/include/media/v4l2-event.h b/include/media/v4l2-event.h new file mode 100644 index 000000000000..3b86177c8cd2 --- /dev/null +++ b/include/media/v4l2-event.h @@ -0,0 +1,67 @@ +/* + * v4l2-event.h + * + * V4L2 events. + * + * Copyright (C) 2009--2010 Nokia Corporation. + * + * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#ifndef V4L2_EVENT_H +#define V4L2_EVENT_H + +#include <linux/types.h> +#include <linux/videodev2.h> +#include <linux/wait.h> + +struct v4l2_fh; +struct video_device; + +struct v4l2_kevent { + struct list_head list; + struct v4l2_event event; +}; + +struct v4l2_subscribed_event { + struct list_head list; + u32 type; +}; + +struct v4l2_events { + wait_queue_head_t wait; + struct list_head subscribed; /* Subscribed events */ + struct list_head free; /* Events ready for use */ + struct list_head available; /* Dequeueable event */ + unsigned int navailable; + unsigned int nallocated; /* Number of allocated events */ + u32 sequence; +}; + +int v4l2_event_init(struct v4l2_fh *fh); +int v4l2_event_alloc(struct v4l2_fh *fh, unsigned int n); +void v4l2_event_free(struct v4l2_fh *fh); +int v4l2_event_dequeue(struct v4l2_fh *fh, struct v4l2_event *event, + int nonblocking); +void v4l2_event_queue(struct video_device *vdev, const struct v4l2_event *ev); +int v4l2_event_pending(struct v4l2_fh *fh); +int v4l2_event_subscribe(struct v4l2_fh *fh, + struct v4l2_event_subscription *sub); +int v4l2_event_unsubscribe(struct v4l2_fh *fh, + struct v4l2_event_subscription *sub); + +#endif /* V4L2_EVENT_H */ diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h new file mode 100644 index 000000000000..1d72dde320bf --- /dev/null +++ b/include/media/v4l2-fh.h @@ -0,0 +1,65 @@ +/* + * v4l2-fh.h + * + * V4L2 file handle. Store per file handle data for the V4L2 + * framework. Using file handles is optional for the drivers. + * + * Copyright (C) 2009--2010 Nokia Corporation. + * + * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#ifndef V4L2_FH_H +#define V4L2_FH_H + +#include <linux/list.h> + +struct video_device; +struct v4l2_events; + +struct v4l2_fh { + struct list_head list; + struct video_device *vdev; + struct v4l2_events *events; /* events, pending and subscribed */ +}; + +/* + * Initialise the file handle. Parts of the V4L2 framework using the + * file handles should be initialised in this function. Must be called + * from driver's v4l2_file_operations->open() handler if the driver + * uses v4l2_fh. + */ +int v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev); +/* + * Add the fh to the list of file handles on a video_device. The file + * handle must be initialised first. + */ +void v4l2_fh_add(struct v4l2_fh *fh); +/* + * Remove file handle from the list of file handles. Must be called in + * v4l2_file_operations->release() handler if the driver uses v4l2_fh. + */ +void v4l2_fh_del(struct v4l2_fh *fh); +/* + * Release resources related to a file handle. Parts of the V4L2 + * framework using the v4l2_fh must release their resources here, too. + * Must be called in v4l2_file_operations->release() handler if the + * driver uses v4l2_fh. + */ +void v4l2_fh_exit(struct v4l2_fh *fh); + +#endif /* V4L2_EVENT_H */ diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h index e8ba0f2efbae..06daa6e8e051 100644 --- a/include/media/v4l2-ioctl.h +++ b/include/media/v4l2-ioctl.h @@ -21,6 +21,8 @@ #include <linux/videodev2.h> #endif +struct v4l2_fh; + struct v4l2_ioctl_ops { /* ioctl callbacks */ @@ -254,6 +256,11 @@ struct v4l2_ioctl_ops { int (*vidioc_g_dv_timings) (struct file *file, void *fh, struct v4l2_dv_timings *timings); + int (*vidioc_subscribe_event) (struct v4l2_fh *fh, + struct v4l2_event_subscription *sub); + int (*vidioc_unsubscribe_event)(struct v4l2_fh *fh, + struct v4l2_event_subscription *sub); + /* For other private ioctls */ long (*vidioc_default) (struct file *file, void *fh, int cmd, void *arg); diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h new file mode 100644 index 000000000000..8d149f1c58d0 --- /dev/null +++ b/include/media/v4l2-mem2mem.h @@ -0,0 +1,201 @@ +/* + * Memory-to-memory device framework for Video for Linux 2. + * + * Helper functions for devices that use memory buffers for both source + * and destination. + * + * Copyright (c) 2009 Samsung Electronics Co., Ltd. + * Pawel Osciak, <p.osciak@samsung.com> + * Marek Szyprowski, <m.szyprowski@samsung.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; either version 2 of the + * License, or (at your option) any later version + */ + +#ifndef _MEDIA_V4L2_MEM2MEM_H +#define _MEDIA_V4L2_MEM2MEM_H + +#include <media/videobuf-core.h> + +/** + * struct v4l2_m2m_ops - mem-to-mem device driver callbacks + * @device_run: required. Begin the actual job (transaction) inside this + * callback. + * The job does NOT have to end before this callback returns + * (and it will be the usual case). When the job finishes, + * v4l2_m2m_job_finish() has to be called. + * @job_ready: optional. Should return 0 if the driver does not have a job + * fully prepared to run yet (i.e. it will not be able to finish a + * transaction without sleeping). If not provided, it will be + * assumed that one source and one destination buffer are all + * that is required for the driver to perform one full transaction. + * This method may not sleep. + * @job_abort: required. Informs the driver that it has to abort the currently + * running transaction as soon as possible (i.e. as soon as it can + * stop the device safely; e.g. in the next interrupt handler), + * even if the transaction would not have been finished by then. + * After the driver performs the necessary steps, it has to call + * v4l2_m2m_job_finish() (as if the transaction ended normally). + * This function does not have to (and will usually not) wait + * until the device enters a state when it can be stopped. + */ +struct v4l2_m2m_ops { + void (*device_run)(void *priv); + int (*job_ready)(void *priv); + void (*job_abort)(void *priv); +}; + +struct v4l2_m2m_dev; + +struct v4l2_m2m_queue_ctx { +/* private: internal use only */ + struct videobuf_queue q; + + /* Queue for buffers ready to be processed as soon as this + * instance receives access to the device */ + struct list_head rdy_queue; + u8 num_rdy; +}; + +struct v4l2_m2m_ctx { +/* private: internal use only */ + struct v4l2_m2m_dev *m2m_dev; + + /* Capture (output to memory) queue context */ + struct v4l2_m2m_queue_ctx cap_q_ctx; + + /* Output (input from memory) queue context */ + struct v4l2_m2m_queue_ctx out_q_ctx; + + /* For device job queue */ + struct list_head queue; + unsigned long job_flags; + + /* Instance private data */ + void *priv; +}; + +void *v4l2_m2m_get_curr_priv(struct v4l2_m2m_dev *m2m_dev); + +struct videobuf_queue *v4l2_m2m_get_vq(struct v4l2_m2m_ctx *m2m_ctx, + enum v4l2_buf_type type); + +void v4l2_m2m_job_finish(struct v4l2_m2m_dev *m2m_dev, + struct v4l2_m2m_ctx *m2m_ctx); + +int v4l2_m2m_reqbufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, + struct v4l2_requestbuffers *reqbufs); + +int v4l2_m2m_querybuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, + struct v4l2_buffer *buf); + +int v4l2_m2m_qbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, + struct v4l2_buffer *buf); +int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, + struct v4l2_buffer *buf); + +int v4l2_m2m_streamon(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, + enum v4l2_buf_type type); +int v4l2_m2m_streamoff(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, + enum v4l2_buf_type type); + +unsigned int v4l2_m2m_poll(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, + struct poll_table_struct *wait); + +int v4l2_m2m_mmap(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, + struct vm_area_struct *vma); + +struct v4l2_m2m_dev *v4l2_m2m_init(struct v4l2_m2m_ops *m2m_ops); +void v4l2_m2m_release(struct v4l2_m2m_dev *m2m_dev); + +struct v4l2_m2m_ctx *v4l2_m2m_ctx_init(void *priv, struct v4l2_m2m_dev *m2m_dev, + void (*vq_init)(void *priv, struct videobuf_queue *, + enum v4l2_buf_type)); +void v4l2_m2m_ctx_release(struct v4l2_m2m_ctx *m2m_ctx); + +void v4l2_m2m_buf_queue(struct v4l2_m2m_ctx *m2m_ctx, struct videobuf_queue *vq, + struct videobuf_buffer *vb); + +/** + * v4l2_m2m_num_src_bufs_ready() - return the number of source buffers ready for + * use + */ +static inline +unsigned int v4l2_m2m_num_src_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx) +{ + return m2m_ctx->cap_q_ctx.num_rdy; +} + +/** + * v4l2_m2m_num_src_bufs_ready() - return the number of destination buffers + * ready for use + */ +static inline +unsigned int v4l2_m2m_num_dst_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx) +{ + return m2m_ctx->out_q_ctx.num_rdy; +} + +void *v4l2_m2m_next_buf(struct v4l2_m2m_ctx *m2m_ctx, enum v4l2_buf_type type); + +/** + * v4l2_m2m_next_src_buf() - return next source buffer from the list of ready + * buffers + */ +static inline void *v4l2_m2m_next_src_buf(struct v4l2_m2m_ctx *m2m_ctx) +{ + return v4l2_m2m_next_buf(m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT); +} + +/** + * v4l2_m2m_next_dst_buf() - return next destination buffer from the list of + * ready buffers + */ +static inline void *v4l2_m2m_next_dst_buf(struct v4l2_m2m_ctx *m2m_ctx) +{ + return v4l2_m2m_next_buf(m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); +} + +/** + * v4l2_m2m_get_src_vq() - return videobuf_queue for source buffers + */ +static inline +struct videobuf_queue *v4l2_m2m_get_src_vq(struct v4l2_m2m_ctx *m2m_ctx) +{ + return v4l2_m2m_get_vq(m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT); +} + +/** + * v4l2_m2m_get_dst_vq() - return videobuf_queue for destination buffers + */ +static inline +struct videobuf_queue *v4l2_m2m_get_dst_vq(struct v4l2_m2m_ctx *m2m_ctx) +{ + return v4l2_m2m_get_vq(m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); +} + +void *v4l2_m2m_buf_remove(struct v4l2_m2m_ctx *m2m_ctx, + enum v4l2_buf_type type); + +/** + * v4l2_m2m_src_buf_remove() - take off a source buffer from the list of ready + * buffers and return it + */ +static inline void *v4l2_m2m_src_buf_remove(struct v4l2_m2m_ctx *m2m_ctx) +{ + return v4l2_m2m_buf_remove(m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT); +} + +/** + * v4l2_m2m_dst_buf_remove() - take off a destination buffer from the list of + * ready buffers and return it + */ +static inline void *v4l2_m2m_dst_buf_remove(struct v4l2_m2m_ctx *m2m_ctx) +{ + return v4l2_m2m_buf_remove(m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); +} + +#endif /* _MEDIA_V4L2_MEM2MEM_H */ + diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 2bcdca0a57fc..a88889355ae0 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -184,28 +184,6 @@ struct v4l2_subdev_audio_ops { }; /* - decode_vbi_line: video decoders that support sliced VBI need to implement - this ioctl. Field p of the v4l2_sliced_vbi_line struct is set to the - start of the VBI data that was generated by the decoder. The driver - then parses the sliced VBI data and sets the other fields in the - struct accordingly. The pointer p is updated to point to the start of - the payload which can be copied verbatim into the data field of the - v4l2_sliced_vbi_data struct. If no valid VBI data was found, then the - type field is set to 0 on return. - - s_vbi_data: used to generate VBI signals on a video signal. - v4l2_sliced_vbi_data is filled with the data packets that should be - output. Note that if you set the line field to 0, then that VBI signal - is disabled. If no valid VBI data was found, then the type field is - set to 0 on return. - - g_vbi_data: used to obtain the sliced VBI packet from a readback register. - Not all video decoders support this. If no data is available because - the readback register contains invalid or erroneous data -EIO is - returned. Note that you must fill in the 'id' member and the 'field' - member (to determine whether CC data from the first or second field - should be obtained). - s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by video input devices. @@ -243,10 +221,6 @@ struct v4l2_subdev_audio_ops { struct v4l2_subdev_video_ops { int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config); int (*s_crystal_freq)(struct v4l2_subdev *sd, u32 freq, u32 flags); - int (*decode_vbi_line)(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi_line); - int (*s_vbi_data)(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *vbi_data); - 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); @@ -262,6 +236,8 @@ struct v4l2_subdev_video_ops { 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); + int (*enum_dv_presets) (struct v4l2_subdev *sd, + struct v4l2_dv_enum_preset *preset); int (*s_dv_preset)(struct v4l2_subdev *sd, struct v4l2_dv_preset *preset); int (*query_dv_preset)(struct v4l2_subdev *sd, @@ -280,6 +256,45 @@ struct v4l2_subdev_video_ops { struct v4l2_mbus_framefmt *fmt); }; +/* + decode_vbi_line: video decoders that support sliced VBI need to implement + this ioctl. Field p of the v4l2_sliced_vbi_line struct is set to the + start of the VBI data that was generated by the decoder. The driver + then parses the sliced VBI data and sets the other fields in the + struct accordingly. The pointer p is updated to point to the start of + the payload which can be copied verbatim into the data field of the + v4l2_sliced_vbi_data struct. If no valid VBI data was found, then the + type field is set to 0 on return. + + s_vbi_data: used to generate VBI signals on a video signal. + v4l2_sliced_vbi_data is filled with the data packets that should be + output. Note that if you set the line field to 0, then that VBI signal + is disabled. If no valid VBI data was found, then the type field is + set to 0 on return. + + g_vbi_data: used to obtain the sliced VBI packet from a readback register. + Not all video decoders support this. If no data is available because + the readback register contains invalid or erroneous data -EIO is + returned. Note that you must fill in the 'id' member and the 'field' + member (to determine whether CC data from the first or second field + should be obtained). + + s_raw_fmt: setup the video encoder/decoder for raw VBI. + + g_sliced_fmt: retrieve the current sliced VBI settings. + + s_sliced_fmt: setup the sliced VBI settings. + */ +struct v4l2_subdev_vbi_ops { + int (*decode_vbi_line)(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi_line); + int (*s_vbi_data)(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *vbi_data); + 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_raw_fmt)(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt); + int (*g_sliced_fmt)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt); + int (*s_sliced_fmt)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt); +}; + /** * struct v4l2_subdev_sensor_ops - v4l2-subdev sensor operations * @g_skip_top_lines: number of lines at the top of the image to be skipped. @@ -379,6 +394,7 @@ struct v4l2_subdev_ops { const struct v4l2_subdev_tuner_ops *tuner; const struct v4l2_subdev_audio_ops *audio; const struct v4l2_subdev_video_ops *video; + const struct v4l2_subdev_vbi_ops *vbi; const struct v4l2_subdev_ir_ops *ir; const struct v4l2_subdev_sensor_ops *sensor; }; @@ -387,6 +403,8 @@ struct v4l2_subdev_ops { /* Set this flag if this subdev is a i2c device. */ #define V4L2_SUBDEV_FL_IS_I2C (1U << 0) +/* Set this flag if this subdev is a spi device. */ +#define V4L2_SUBDEV_FL_IS_SPI (1U << 1) /* Each instance of a subdev driver should create this struct, either stand-alone or embedded in a larger struct. diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h index 316fdccdcaa0..f91a736c133d 100644 --- a/include/media/videobuf-core.h +++ b/include/media/videobuf-core.h @@ -127,30 +127,16 @@ struct videobuf_queue_ops { struct videobuf_qtype_ops { u32 magic; - void *(*alloc) (size_t size); - void *(*vmalloc) (struct videobuf_buffer *buf); - int (*iolock) (struct videobuf_queue* q, + struct videobuf_buffer *(*alloc)(size_t size); + void *(*vaddr) (struct videobuf_buffer *buf); + int (*iolock) (struct videobuf_queue *q, struct videobuf_buffer *vb, struct v4l2_framebuffer *fbuf); - int (*mmap) (struct videobuf_queue *q, - unsigned int *count, - unsigned int *size, - enum v4l2_memory memory); - int (*sync) (struct videobuf_queue* q, + int (*sync) (struct videobuf_queue *q, struct videobuf_buffer *buf); - int (*video_copy_to_user)(struct videobuf_queue *q, - char __user *data, - size_t count, - int nonblocking); - int (*copy_stream) (struct videobuf_queue *q, - char __user *data, - size_t count, - size_t pos, - int vbihack, - int nonblocking); - int (*mmap_free) (struct videobuf_queue *q); int (*mmap_mapper) (struct videobuf_queue *q, - struct vm_area_struct *vma); + struct videobuf_buffer *buf, + struct vm_area_struct *vma); }; struct videobuf_queue { @@ -171,7 +157,6 @@ struct videobuf_queue { unsigned int streaming:1; unsigned int reading:1; - unsigned int is_mmapped:1; /* capture via mmap() + ioctl(QBUF/DQBUF) */ struct list_head stream; @@ -185,14 +170,14 @@ struct videobuf_queue { }; int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr); -int videobuf_iolock(struct videobuf_queue* q, struct videobuf_buffer *vb, +int videobuf_iolock(struct videobuf_queue *q, struct videobuf_buffer *vb, struct v4l2_framebuffer *fbuf); -void *videobuf_alloc(struct videobuf_queue* q); +struct videobuf_buffer *videobuf_alloc(struct videobuf_queue *q); /* Used on videobuf-dvb */ -void *videobuf_queue_to_vmalloc (struct videobuf_queue* q, - struct videobuf_buffer *buf); +void *videobuf_queue_to_vaddr(struct videobuf_queue *q, + struct videobuf_buffer *buf); void videobuf_queue_core_init(struct videobuf_queue *q, const struct videobuf_queue_ops *ops, diff --git a/include/media/videobuf-dma-sg.h b/include/media/videobuf-dma-sg.h index 53e72f787175..a195f3b9c00a 100644 --- a/include/media/videobuf-dma-sg.h +++ b/include/media/videobuf-dma-sg.h @@ -17,6 +17,8 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 */ +#ifndef _VIDEOBUF_DMA_SG_H +#define _VIDEOBUF_DMA_SG_H #include <media/videobuf-core.h> @@ -27,14 +29,14 @@ * block (NULL on errors). Memory for the scatterlist is allocated * using kmalloc. The caller must free the memory. */ -struct scatterlist* videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages); +struct scatterlist *videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages); /* * Return a scatterlist for a an array of userpages (NULL on errors). * Memory for the scatterlist is allocated using kmalloc. The caller * must free the memory. */ -struct scatterlist* videobuf_pages_to_sg(struct page **pages, int nr_pages, +struct scatterlist *videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset); /* --------------------------------------------------------------------- */ @@ -78,8 +80,7 @@ struct videobuf_dmabuf { int direction; }; -struct videobuf_dma_sg_memory -{ +struct videobuf_dma_sg_memory { u32 magic; /* for mmap'ed buffers */ @@ -95,14 +96,13 @@ int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction, dma_addr_t addr, int nr_pages); int videobuf_dma_free(struct videobuf_dmabuf *dma); -int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma); -int videobuf_dma_sync(struct videobuf_queue* q,struct videobuf_dmabuf *dma); -int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma); -struct videobuf_dmabuf *videobuf_to_dma (struct videobuf_buffer *buf); +int videobuf_dma_map(struct videobuf_queue *q, struct videobuf_dmabuf *dma); +int videobuf_dma_unmap(struct videobuf_queue *q, struct videobuf_dmabuf *dma); +struct videobuf_dmabuf *videobuf_to_dma(struct videobuf_buffer *buf); void *videobuf_sg_alloc(size_t size); -void videobuf_queue_sg_init(struct videobuf_queue* q, +void videobuf_queue_sg_init(struct videobuf_queue *q, const struct videobuf_queue_ops *ops, struct device *dev, spinlock_t *irqlock, @@ -111,9 +111,11 @@ void videobuf_queue_sg_init(struct videobuf_queue* q, unsigned int msize, void *priv); - /*FIXME: these variants are used only on *-alsa code, where videobuf is - * used without queue - */ +/*FIXME: these variants are used only on *-alsa code, where videobuf is + * used without queue + */ int videobuf_sg_dma_map(struct device *dev, struct videobuf_dmabuf *dma); int videobuf_sg_dma_unmap(struct device *dev, struct videobuf_dmabuf *dma); +#endif /* _VIDEOBUF_DMA_SG_H */ + diff --git a/include/media/videobuf-vmalloc.h b/include/media/videobuf-vmalloc.h index 4b419a257a7d..851eb1a2ff2a 100644 --- a/include/media/videobuf-vmalloc.h +++ b/include/media/videobuf-vmalloc.h @@ -19,17 +19,17 @@ /* --------------------------------------------------------------------- */ -struct videobuf_vmalloc_memory -{ +struct videobuf_vmalloc_memory { u32 magic; void *vmalloc; - /* remap_vmalloc_range seems to need to run after mmap() on some cases */ + /* remap_vmalloc_range seems to need to run + * after mmap() on some cases */ struct vm_area_struct *vma; }; -void videobuf_queue_vmalloc_init(struct videobuf_queue* q, +void videobuf_queue_vmalloc_init(struct videobuf_queue *q, const struct videobuf_queue_ops *ops, struct device *dev, spinlock_t *irqlock, @@ -38,8 +38,8 @@ void videobuf_queue_vmalloc_init(struct videobuf_queue* q, unsigned int msize, void *priv); -void *videobuf_to_vmalloc (struct videobuf_buffer *buf); +void *videobuf_to_vmalloc(struct videobuf_buffer *buf); -void videobuf_vmalloc_free (struct videobuf_buffer *buf); +void videobuf_vmalloc_free(struct videobuf_buffer *buf); #endif |