81#define MAX_UCODE_REGISTER 110
83#define EM8300_IOCTL_INIT _IOW('C',0,em8300_microcode_t)
84#define EM8300_IOCTL_READREG _IOWR('C',1,em8300_register_t)
85#define EM8300_IOCTL_WRITEREG _IOW('C',2,em8300_register_t)
86#define EM8300_IOCTL_GETSTATUS _IOR('C',3,char[1024])
87#define EM8300_IOCTL_SETBCS _IOW('C',4,em8300_bcs_t)
88#define EM8300_IOCTL_GETBCS _IOR('C',4,em8300_bcs_t)
89#define EM8300_IOCTL_SET_ASPECTRATIO _IOW('C',5,int)
90#define EM8300_IOCTL_GET_ASPECTRATIO _IOR('C',5,int)
91#define EM8300_IOCTL_SET_VIDEOMODE _IOW('C',6,int)
92#define EM8300_IOCTL_GET_VIDEOMODE _IOR('C',6,int)
93#define EM8300_IOCTL_SET_PLAYMODE _IOW('C',7,int)
94#define EM8300_IOCTL_GET_PLAYMODE _IOR('C',7,int)
95#define EM8300_IOCTL_SET_AUDIOMODE _IOW('C',8,int)
96#define EM8300_IOCTL_GET_AUDIOMODE _IOR('C',8,int)
97#define EM8300_IOCTL_SET_SPUMODE _IOW('C',9,int)
98#define EM8300_IOCTL_GET_SPUMODE _IOR('C',9,int)
99#define EM8300_IOCTL_OVERLAY_CALIBRATE _IOWR('C',10,em8300_overlay_calibrate_t)
100#define EM8300_IOCTL_OVERLAY_SETMODE _IOW('C',11,int)
101#define EM8300_IOCTL_OVERLAY_SETWINDOW _IOWR('C',12,em8300_overlay_window_t)
102#define EM8300_IOCTL_OVERLAY_SETSCREEN _IOWR('C',13,em8300_overlay_screen_t)
103#define EM8300_IOCTL_OVERLAY_GET_ATTRIBUTE _IOR('C',14,em8300_attribute_t)
104#define EM8300_IOCTL_OVERLAY_SET_ATTRIBUTE _IOW('C',14,em8300_attribute_t)
105#define EM8300_IOCTL_OVERLAY_SIGNALMODE _IOW('C',15,em8300_attribute_t)
106#define EM8300_IOCTL_SCR_GET _IOR('C',16,unsigned)
107#define EM8300_IOCTL_SCR_SET _IOW('C',16,unsigned)
108#define EM8300_IOCTL_SCR_GETSPEED _IOR('C',17,unsigned)
109#define EM8300_IOCTL_SCR_SETSPEED _IOW('C',17,unsigned)
110#define EM8300_IOCTL_FLUSH _IOW('C',18,int)
111#define EM8300_IOCTL_VBI _IOW('C',19,struct timeval)
113#define EM8300_OVERLAY_SIGNAL_ONLY 1
114#define EM8300_OVERLAY_SIGNAL_WITH_VGA 2
115#define EM8300_OVERLAY_VGA_ONLY 3
117#define EM8300_IOCTL_VIDEO_SETPTS _IOW('C',1,int)
118#define EM8300_IOCTL_VIDEO_GETSCR _IOR('C',2,unsigned)
119#define EM8300_IOCTL_VIDEO_SETSCR _IOW('C',2,unsigned)
121#define EM8300_IOCTL_SPU_SETPTS _IOW('C',1,int)
122#define EM8300_IOCTL_SPU_SETPALETTE _IOW('C',2,unsigned[16])
123#define EM8300_IOCTL_SPU_BUTTON _IOW('C',3,em8300_button_t)
125#define EM8300_ASPECTRATIO_4_3 0
126#define EM8300_ASPECTRATIO_16_9 1
127#define EM8300_ASPECTRATIO_LAST 1
129#define EM8300_VIDEOMODE_PAL 0
130#define EM8300_VIDEOMODE_PAL60 1
131#define EM8300_VIDEOMODE_NTSC 2
132#define EM8300_VIDEOMODE_LAST 2
133#ifndef EM8300_VIDEOMODE_DEFAULT
134#define EM8300_VIDEOMODE_DEFAULT EM8300_VIDEOMODE_PAL
137#define EM8300_AUDIOMODE_ANALOG 0
138#define EM8300_AUDIOMODE_DIGITALPCM 1
139#define EM8300_AUDIOMODE_DIGITALAC3 2
140#ifndef EM8300_AUDIOMODE_DEFAULT
141#define EM8300_AUDIOMODE_DEFAULT EM8300_AUDIOMODE_ANALOG
144#define EM8300_SPUMODE_OFF 0
145#define EM8300_SPUMODE_ON 1
147#define EM8300_PLAYMODE_STOPPED 0
148#define EM8300_PLAYMODE_PAUSED 1
149#define EM8300_PLAYMODE_SLOWFORWARDS 2
150#define EM8300_PLAYMODE_SLOWBACKWARDS 3
151#define EM8300_PLAYMODE_SINGLESTEP 4
152#define EM8300_PLAYMODE_PLAY 5
153#define EM8300_PLAYMODE_REVERSEPLAY 6
154#define EM8300_PLAYMODE_SCAN 7
155#define EM8300_PLAYMODE_FRAMEBUF 8
157#define EM8300_OVERLAY_MODE_OFF 0
158#define EM8300_OVERLAY_MODE_RECTANGLE 1
159#define EM8300_OVERLAY_MODE_OVERLAY 2
161#define EM8300_OVERLAY_CALMODE_XOFFSET 1
162#define EM8300_OVERLAY_CALMODE_YOFFSET 2
163#define EM8300_OVERLAY_CALMODE_XCORRECTION 3
164#define EM8300_OVERLAY_CALMODE_COLOR 4
166#define EM9010_ATTRIBUTE_XCORR 1
167#define EM9010_ATTRIBUTE_XOFFSET 2
168#define EM9010_ATTRIBUTE_YOFFSET 3
169#define EM9010_ATTRIBUTE_JITTER 4
170#define EM9010_ATTRIBUTE_STABILITY 5
171#define EM9010_ATTRIBUTE_KEYCOLOR_UPPER 6
172#define EM9010_ATTRIBUTE_KEYCOLOR_LOWER 7
173#define EM9010_ATTRIBUTE_MAX 7
175#define EM8300_SUBDEVICE_CONTROL 0
176#define EM8300_SUBDEVICE_VIDEO 1
177#define EM8300_SUBDEVICE_AUDIO 2
178#define EM8300_SUBDEVICE_SUBPICTURE 3
180#ifndef PCI_VENDOR_ID_SIGMADESIGNS
181#define PCI_VENDOR_ID_SIGMADESIGNS 0x1105
182#define PCI_DEVICE_ID_SIGMADESIGNS_EM8300 0x8300
185#define CLOCKGEN_SAMPFREQ_MASK 0xc0
186#define CLOCKGEN_SAMPFREQ_66 0xc0
187#define CLOCKGEN_SAMPFREQ_48 0x40
188#define CLOCKGEN_SAMPFREQ_44 0x80
189#define CLOCKGEN_SAMPFREQ_32 0x00
191#define CLOCKGEN_OUTMASK 0x30
192#define CLOCKGEN_DIGITALOUT 0x10
193#define CLOCKGEN_ANALOGOUT 0x20
195#define CLOCKGEN_MODEMASK 0x0f
196#define CLOCKGEN_OVERLAYMODE_1 0x07
197#define CLOCKGEN_TVMODE_1 0x0b
198#define CLOCKGEN_OVERLAYMODE_2 0x04
199#define CLOCKGEN_TVMODE_2 0x02
201#define MVCOMMAND_STOP 0x0
202#define MVCOMMAND_PAUSE 0x1
203#define MVCOMMAND_START 0x3
204#define MVCOMMAND_PLAYINTRA 0x4
205#define MVCOMMAND_SYNC 0x6
206#define MVCOMMAND_FLUSHBUF 0x10
207#define MVCOMMAND_DISPLAYBUFINFO 0x11
209#define MACOMMAND_STOP 0x0
210#define MACOMMAND_PAUSE 0x1
211#define MACOMMAND_PLAY 0x2
213#define IRQSTATUS_VIDEO_VBL 0x10
214#define IRQSTATUS_VIDEO_FIFO 0x2
215#define IRQSTATUS_AUDIO_FIFO 0x8
217#define ENCODER_UNKNOWN 0
218#define ENCODER_ADV7175 1
219#define ENCODER_ADV7170 2
220#define ENCODER_BT865 3
226#define EM8300_MAJOR 121
227#define EM8300_LOGNAME "em8300"
230#include <linux/version.h>
231#include <linux/types.h>
232#include <linux/i2c.h>
233#include <linux/i2c-algo-bit.h>
234#include <linux/time.h>
235#include <linux/wait.h>
236#include <linux/list.h>
238#if defined(CONFIG_SND) || defined(CONFIG_SND_MODULE)
239#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
240#define snd_card_t struct snd_card
242#include <sound/driver.h>
243#include <sound/core.h>
244#include <sound/pcm.h>
262struct displaybuffer_info_s {
275struct em8300_audio_s {
283struct em8300_model_config_s {
288 int bt865_ucode_timeout;
289 int activate_loopback;
292struct adv717x_model_config_s {
294 int pixelport_other_pal;
295 int pixeldata_adjust_ntsc;
296 int pixeldata_adjust_pal;
299struct bt865_model_config_s {
302struct em8300_config_s {
303 struct em8300_model_config_s model;
304 struct adv717x_model_config_s adv717x_model;
305 struct bt865_model_config_s bt865_model;
321 volatile unsigned *mem;
326#if defined(CONFIG_SND) || defined(CONFIG_SND_MODULE)
327 snd_card_t *alsa_card;
331 struct fifo_s *mvfifo;
332 struct fifo_s *mafifo;
333 struct fifo_s *spfifo;
337 int dicom_vertoffset;
338 int dicom_horizoffset;
339 int dicom_brightness;
341 int dicom_saturation;
343 struct displaybuffer_info_s dbuf_info;
353 struct i2c_algo_bit_data i2c_data_1;
354 struct i2c_adapter i2c_ops_1;
357 struct i2c_algo_bit_data i2c_data_2;
358 struct i2c_adapter i2c_ops_2;
362 struct i2c_client *encoder;
363 struct i2c_client *eeprom;
376 int clockgen_overlaymode;
380 struct timeval tv, last_status_time;
387 struct em8300_audio_s audio;
392 unsigned int channel_status_pos;
393 unsigned char channel_status[24];
394 enum { NONE, OSS, ALSA } audio_driver_style;
395 struct semaphore audio_driver_style_lock;
403 uint32_t video_lastpts;
404 int video_ptsvalid,video_offset,video_count;
405 int video_ptsfifo_ptr;
406#if LINUX_VERSION_CODE < 0x020314
407 struct wait_queue *video_ptsfifo_wait;
408 struct wait_queue *vbi_wait;
410 wait_queue_head_t video_ptsfifo_wait;
411 wait_queue_head_t vbi_wait;
413 int video_ptsfifo_waiting;
418 int sp_pts, sp_ptsvalid, sp_count;
420#if LINUX_VERSION_CODE < 0x020314
421 struct wait_queue *sp_ptsfifo_wait;
423 wait_queue_head_t sp_ptsfifo_wait;
425 int sp_ptsfifo_waiting;
433 int overlay_gamma_enable;
436 int overlay_frame_xpos;
437 int overlay_frame_ypos;
438 int overlay_frame_width;
439 int overlay_frame_height;
441 int overlay_double_y;
442 int overlay_xcorr_default;
444 int overlay_dword_24bb8;
446#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,0)
448 struct list_head memory;
456 struct em8300_config_s config;
459 unsigned int card_nr;
462#if defined(CONFIG_SND) || defined(CONFIG_SND_MODULE)
463#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
468#define TIMEDIFF(a,b) a.tv_usec - b.tv_usec + \
469 1000000 * (a.tv_sec - b.tv_sec)
477int em8300_i2c_init1(
struct em8300_s *em);
478int em8300_i2c_init2(
struct em8300_s *em);
479void em8300_i2c_exit(
struct em8300_s *em);
480void em8300_clockgen_write(
struct em8300_s *em,
int abyte);
482void em9010_write(
struct em8300_s *em,
int reg,
int data);
483int em9010_read(
struct em8300_s *em,
int reg);
484int em9010_read16(
struct em8300_s *em,
int reg);
485void em9010_write16(
struct em8300_s *em,
int reg,
int value);
488int em8300_audio_ioctl(
struct em8300_s *em,
unsigned int cmd,
unsigned long arg);
489int em8300_audio_flush(
struct em8300_s *em);
490int em8300_audio_open(
struct em8300_s *em);
491int em8300_audio_release(
struct em8300_s *em);
492int em8300_audio_setup(
struct em8300_s *em);
493ssize_t em8300_audio_write(
struct em8300_s *em,
const char * buf,
494 size_t count, loff_t *ppos);
495int mpegaudio_command(
struct em8300_s *em,
int cmd);
498void em8300_ucode_upload(
struct em8300_s *em,
void *ucode,
int ucode_size);
499void em8300_require_ucode(
struct em8300_s *em);
502int em8300_setregblock(
struct em8300_s *em,
int offset,
int val,
int len);
503int em8300_writeregblock(
struct em8300_s *em,
int offset,
unsigned *buf,
int len);
504int em8300_waitfor(
struct em8300_s *em,
int reg,
int val,
int mask);
505int em8300_waitfor_not(
struct em8300_s *em,
int reg,
int val,
int mask);
508void em8300_dicom_setBCS(
struct em8300_s *em,
int brightness,
int contrast,
int saturation);
509void em8300_dicom_enable(
struct em8300_s *em);
510void em8300_dicom_disable(
struct em8300_s *em);
511int em8300_dicom_update(
struct em8300_s *em);
512void em8300_dicom_init(
struct em8300_s *em);
513int em8300_dicom_get_dbufinfo(
struct em8300_s *em);
514void em8300_dicom_fill_dispbuffers(
struct em8300_s *em,
int xpos,
int ypos,
int xsize,
515 int ysize,
unsigned int pat1,
unsigned int pat2);
518void em8300_video_open(
struct em8300_s *em);
519int em8300_video_setplaymode(
struct em8300_s *em,
int mode);
520int em8300_video_sync(
struct em8300_s *em);
521int em8300_video_flush(
struct em8300_s *em);
522int em8300_video_setup(
struct em8300_s *em);
523int em8300_video_release(
struct em8300_s *em);
524void em8300_video_setspeed(
struct em8300_s *em,
int speed);
525ssize_t em8300_video_write(
struct em8300_s *em,
const char * buf,
526 size_t count, loff_t *ppos);
527int em8300_video_ioctl(
struct em8300_s *em,
unsigned int cmd,
unsigned long arg);
528void em8300_video_check_ptsfifo(
struct em8300_s *em);
531ssize_t em8300_spu_write(
struct em8300_s *em,
const char * buf,
532 size_t count, loff_t *ppos);
533int em8300_spu_open(
struct em8300_s *em);
534int em8300_spu_ioctl(
struct em8300_s *em,
unsigned int cmd,
unsigned long arg);
535int em8300_spu_init(
struct em8300_s *em);
536void em8300_spu_check_ptsfifo(
struct em8300_s *em);
537int em8300_ioctl_setspumode(
struct em8300_s *em,
int mode);
538void em8300_spu_release(
struct em8300_s *em);
541int em8300_control_ioctl(
struct em8300_s *em,
int cmd,
unsigned long arg);
542int em8300_ioctl_setvideomode(
struct em8300_s *em,
int mode);
543int em8300_ioctl_setaspectratio(
struct em8300_s *em,
int ratio);
544int em8300_ioctl_getstatus(
struct em8300_s *em,
char *usermsg);
546void em8300_ioctl_enable_videoout(
struct em8300_s *em,
int mode);
547int em8300_ioctl_setplaymode(
struct em8300_s *em,
int mode);
548int em8300_ioctl_setaudiomode(
struct em8300_s *em,
int mode);
549int em8300_ioctl_getaudiomode(
struct em8300_s *em,
long int mode);
553int em8300_ioctl_overlay_setmode(
struct em8300_s *em,
int val);
556int em9010_cabledetect(
struct em8300_s *em);
557int em9010_calibrate_xoffset(
struct em8300_s *em);
558int em9010_calibrate_yoffset(
struct em8300_s *em);
559int em9010_init(
struct em8300_s *em);
560int em9010_overlay_set_signalmode(
struct em8300_s *em,
int val);
561int em9010_overlay_update(
struct em8300_s *em);
562int em9010_overlay_set_res(
struct em8300_s *em,
int xres,
int yres);
563void sub_4288c(
struct em8300_s *em,
int pa,
int pb,
int pc,
int pd,
int pe,
int pf,
565int em9010_get_attribute(
struct em8300_s *em,
int attribute);
566int em9010_set_attribute(
struct em8300_s *em,
int attribute,
int value);
#define MAX_UCODE_REGISTER
Definition em8300.h:81
#define EM9010_ATTRIBUTE_MAX
Definition em8300.h:173
contrast
Definition eq.c:160
unsigned int width
Definition gfontrle.c:4
const unsigned char u8[sizeof(Motif)]
Definition motif_goom1.h:2
int attribute
Definition em8300.h:68
int value
Definition em8300.h:69
int contrast
Definition em8300.h:46
int brightness
Definition em8300.h:45
int saturation
Definition em8300.h:47
void * ucode
Definition em8300.h:34
int ucode_size
Definition em8300.h:35
int result2
Definition em8300.h:55
int cal_mode
Definition em8300.h:51
int arg
Definition em8300.h:52
int arg2
Definition em8300.h:53
int result
Definition em8300.h:54
int xsize
Definition em8300.h:64
int height
Definition em8300.h:60
int xpos
Definition em8300.h:59
int val
Definition em8300.h:40
int reg
Definition em8300.h:39
int microcode_register
Definition em8300.h:41
aspect_ratio
Definition vdpau_h264.c:102
encoder_type
Definition video_out_dxr3.h:42
const char * name
Definition xine.c:1575
enable disable number of frames of telecine pattern sync required before mode change make frames evenly spaced for film mode(24 fps)" ) PARAM_ITEM( POST_PARAM_TYPE_BOOL