summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/em28xx/em28xx.h
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/em28xx/em28xx.h')
-rw-r--r--linux/drivers/media/video/em28xx/em28xx.h101
1 files changed, 72 insertions, 29 deletions
diff --git a/linux/drivers/media/video/em28xx/em28xx.h b/linux/drivers/media/video/em28xx/em28xx.h
index 5e5f4e7a9..a483a3668 100644
--- a/linux/drivers/media/video/em28xx/em28xx.h
+++ b/linux/drivers/media/video/em28xx/em28xx.h
@@ -154,10 +154,17 @@ enum enum28xx_itype {
EM28XX_RADIO,
};
+enum em28xx_amux {
+ EM28XX_AMUX_VIDEO,
+ EM28XX_AMUX_LINE_IN,
+ EM28XX_AMUX_AC97_VIDEO,
+ EM28XX_AMUX_AC97_LINE_IN,
+};
+
struct em28xx_input {
enum enum28xx_itype type;
unsigned int vmux;
- unsigned int amux;
+ enum em28xx_amux amux;
};
#define INPUT(nr) (&em28xx_boards[dev->model].input[nr])
@@ -174,16 +181,20 @@ struct em28xx_board {
int tuner_type;
/* i2c flags */
- unsigned int is_em2800;
unsigned int tda9887_conf;
+ unsigned int is_em2800:1;
unsigned int has_tuner:1;
unsigned int has_msp34xx:1;
unsigned int mts_firmware:1;
+ unsigned int has_12mhz_i2s:1;
+
+ unsigned int analog_gpio;
enum em28xx_decoder decoder;
struct em28xx_input input[MAX_EM28XX_INPUT];
+ struct em28xx_input radio;
};
struct em28xx_eeprom {
@@ -207,20 +218,53 @@ enum em28xx_dev_state {
DEV_MISCONFIGURED = 0x04,
};
+#define EM28XX_AUDIO_BUFS 5
+#define EM28XX_NUM_AUDIO_PACKETS 64
+#define EM28XX_AUDIO_MAX_PACKET_SIZE 196 /* static value */
+#define EM28XX_CAPTURE_STREAM_EN 1
+#define EM28XX_AUDIO 0x10
+
+struct em28xx_audio {
+ char name[50];
+ char *transfer_buffer[EM28XX_AUDIO_BUFS];
+ struct urb *urb[EM28XX_AUDIO_BUFS];
+ struct usb_device *udev;
+ unsigned int capture_transfer_done;
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 16)
+ snd_pcm_substream_t *capture_pcm_substream;
+#else
+ struct snd_pcm_substream *capture_pcm_substream;
+#endif
+
+ unsigned int hwptr_done_capture;
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 16)
+ snd_card_t *sndcard;
+#else
+ struct snd_card *sndcard;
+#endif
+
+ int users, shutdown;
+ enum em28xx_stream_state capture_stream;
+ spinlock_t slock;
+};
+
/* main device struct */
struct em28xx {
/* generic device properties */
char name[30]; /* name (including minor) of the device */
int model; /* index in the device_data struct */
int devno; /* marks the number of this device */
- unsigned int is_em2800;
- int video_inputs; /* number of video inputs */
- struct list_head devlist;
+ unsigned int analog_gpio;
+ unsigned int is_em2800:1;
unsigned int has_tuner:1;
unsigned int has_msp34xx:1;
unsigned int has_tda9887:1;
-
unsigned int stream_on:1; /* Locks streams */
+ unsigned int has_audio_class:1;
+ unsigned int has_12mhz_i2s:1;
+
+ int video_inputs; /* number of video inputs */
+ struct list_head devlist;
u32 i2s_speed; /* I2S speed for audio digital stream */
@@ -260,11 +304,15 @@ struct em28xx {
unsigned long hash; /* eeprom hash - for boards with generic ID */
unsigned long i2c_hash; /* i2c devicelist hash - for boards with generic ID */
+ struct em28xx_audio *adev;
+
/* states */
enum em28xx_dev_state state;
enum em28xx_stream_state stream;
enum em28xx_io_method io;
+ struct work_struct request_module_wk;
+
/* locks */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
struct mutex lock;
@@ -275,6 +323,7 @@ struct em28xx {
struct list_head inqueue, outqueue;
wait_queue_head_t open, wait_frame, wait_stream;
struct video_device *vbi_dev;
+ struct video_device *radio_dev;
unsigned char eedata[256];
@@ -300,6 +349,15 @@ struct em28xx {
struct em28xx_fh {
struct em28xx *dev;
unsigned int stream_on:1; /* Locks streams */
+ int radio;
+};
+
+struct em28xx_ops {
+ struct list_head next;
+ char *name;
+ int id;
+ int (*init)(struct em28xx *);
+ int (*fini)(struct em28xx *);
};
/* Provided by em28xx-i2c.c */
@@ -328,8 +386,9 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf,
int em28xx_write_regs(struct em28xx *dev, u16 reg, char *buf, int len);
int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val,
u8 bitmask);
-int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 * val);
+int em28xx_set_audio_source(struct em28xx *dev);
int em28xx_audio_analog_set(struct em28xx *dev);
+
int em28xx_colorlevels_set_default(struct em28xx *dev);
int em28xx_capture_start(struct em28xx *dev, int start);
int em28xx_outfmt_set_yuv422(struct em28xx *dev);
@@ -338,6 +397,10 @@ int em28xx_init_isoc(struct em28xx *dev);
void em28xx_uninit_isoc(struct em28xx *dev);
int em28xx_set_alternate(struct em28xx *dev);
+/* Provided by em28xx-video.c */
+int em28xx_register_extension(struct em28xx_ops *dev);
+void em28xx_unregister_extension(struct em28xx_ops *dev);
+
/* Provided by em28xx-cards.c */
extern int em2800_variant_detect(struct usb_device* udev,int model);
extern void em28xx_pre_card_setup(struct em28xx *dev);
@@ -350,6 +413,7 @@ extern const unsigned int em28xx_bcount;
#define EM2800_AUDIOSRC_REG 0x08
/* em28xx registers */
+#define I2C_CLK_REG 0x06
#define CHIPID_REG 0x0a
#define USBSUSP_REG 0x0c /* */
@@ -401,6 +465,7 @@ extern const unsigned int em28xx_bcount;
/* em202 registers */
#define MASTER_AC97 0x02
+#define LINE_IN_AC97 0x10
#define VIDEO_AC97 0x14
/* register settings */
@@ -425,28 +490,6 @@ extern const unsigned int em28xx_bcount;
printk(KERN_WARNING "%s: "fmt,\
dev->name , ##arg); } while (0)
-inline static int em28xx_audio_source(struct em28xx *dev, int input)
-{
- if(dev->is_em2800){
- u8 tmp = EM2800_AUDIO_SRC_TUNER;
- if(input == EM28XX_AUDIO_SRC_LINE)
- tmp = EM2800_AUDIO_SRC_LINE;
- em28xx_write_regs(dev, EM2800_AUDIOSRC_REG, &tmp, 1);
- }
- return em28xx_write_reg_bits(dev, AUDIOSRC_REG, input, 0xc0);
-}
-
-inline static int em28xx_audio_usb_mute(struct em28xx *dev, int mute)
-{
- return em28xx_write_reg_bits(dev, XCLK_REG, mute ? 0x00 : 0x80, 0x80);
-}
-
-inline static int em28xx_audio_analog_setup(struct em28xx *dev)
-{
- /* unmute video mixer with default volume level */
- return em28xx_write_ac97(dev, VIDEO_AC97, "\x08\x08");
-}
-
inline static int em28xx_compression_disable(struct em28xx *dev)
{
/* side effect of disabling scaler and mixer */