mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-23 07:01:23 +00:00
V4L/DVB (3344e): Stradis Lindent
Stradis Lindent + some handwork Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This commit is contained in:
parent
91fb8357c3
commit
f823f67936
1 changed files with 391 additions and 416 deletions
|
@ -63,7 +63,6 @@ static int video_nr = -1;
|
|||
module_param(video_nr, int, 0);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
|
||||
#define nDebNormal 0x00480000
|
||||
#define nDebNoInc 0x00480000
|
||||
#define nDebVideo 0xd0480000
|
||||
|
@ -99,7 +98,12 @@ MODULE_LICENSE("GPL");
|
|||
|
||||
#ifdef USE_RESCUE_EEPROM_SDM275
|
||||
static unsigned char rescue_eeprom[64] = {
|
||||
0x00,0x01,0x04,0x13,0x26,0x0f,0x10,0x00,0x00,0x00,0x43,0x63,0x22,0x01,0x29,0x15,0x73,0x00,0x1f, 'd', 'e', 'c', 'x', 'l', 'd', 'v', 'a',0x02,0x00,0x01,0x00,0xcc,0xa4,0x63,0x09,0xe2,0x10,0x00,0x0a,0x00,0x02,0x02, 'd', 'e', 'c', 'x', 'l', 'a',0x00,0x00,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00, 0x01, 0x04, 0x13, 0x26, 0x0f, 0x10, 0x00, 0x00, 0x00, 0x43, 0x63,
|
||||
0x22, 0x01, 0x29, 0x15, 0x73, 0x00, 0x1f, 'd', 'e', 'c', 'x', 'l',
|
||||
'd', 'v', 'a', 0x02, 0x00, 0x01, 0x00, 0xcc, 0xa4, 0x63, 0x09, 0xe2,
|
||||
0x10, 0x00, 0x0a, 0x00, 0x02, 0x02, 'd', 'e', 'c', 'x', 'l', 'a',
|
||||
0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -140,8 +144,9 @@ static int I2CRead(struct saa7146 *saa, unsigned char addr,
|
|||
|
||||
if (saaread(SAA7146_I2C_STATUS) & 0x3c)
|
||||
I2CWipe(saa);
|
||||
for (i = 0; i < 1000 &&
|
||||
(saaread(SAA7146_I2C_STATUS) & SAA7146_I2C_BUSY); i++)
|
||||
for (i = 0;
|
||||
i < 1000 && (saaread(SAA7146_I2C_STATUS) & SAA7146_I2C_BUSY);
|
||||
i++)
|
||||
schedule();
|
||||
if (i == 1000)
|
||||
I2CWipe(saa);
|
||||
|
@ -213,13 +218,15 @@ static void attach_inform(struct saa7146 *saa, int id)
|
|||
{
|
||||
int i;
|
||||
|
||||
DEBUG(printk(KERN_DEBUG "stradis%d: i2c: device found=%02x\n", saa->nr, id));
|
||||
DEBUG(printk(KERN_DEBUG "stradis%d: i2c: device found=%02x\n", saa->nr,
|
||||
id));
|
||||
if (id == 0xa0) { /* we have rev2 or later board, fill in info */
|
||||
for (i = 0; i < 64; i++)
|
||||
saa->boardcfg[i] = I2CRead(saa, 0xa0, i, 1);
|
||||
#ifdef USE_RESCUE_EEPROM_SDM275
|
||||
if (saa->boardcfg[0] != 0) {
|
||||
printk("stradis%d: WARNING: EEPROM STORED VALUES HAVE BEEN IGNORED\n", saa->nr);
|
||||
printk("stradis%d: WARNING: EEPROM STORED VALUES HAVE "
|
||||
"BEEN IGNORED\n", saa->nr);
|
||||
for (i = 0; i < 64; i++)
|
||||
saa->boardcfg[i] = rescue_eeprom[i];
|
||||
}
|
||||
|
@ -254,12 +261,14 @@ static int wait_for_debi_done(struct saa7146 *saa)
|
|||
for (i = 0; i < 500000 &&
|
||||
(saaread(SAA7146_PSR) & SAA7146_PSR_DEBI_S); i++)
|
||||
saaread(SAA7146_MC2);
|
||||
|
||||
if (i > debiwait_maxwait)
|
||||
printk("wait-for-debi-done maxwait: %d\n",
|
||||
debiwait_maxwait = i);
|
||||
|
||||
if (i == 500000)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -330,16 +339,15 @@ static void do_irq_send_data(struct saa7146 *saa)
|
|||
return;
|
||||
}
|
||||
/* if at least 1 block audio waiting and audio fifo isn't full */
|
||||
if (audbytes >= 2048 && (debiread(saa, debNormal,
|
||||
IBM_MP2_AUD_FIFO, 2) & 0xff) < 60) {
|
||||
if (audbytes >= 2048 && (debiread(saa, debNormal, IBM_MP2_AUD_FIFO, 2)
|
||||
& 0xff) < 60) {
|
||||
if (saa->audhead > saa->audtail)
|
||||
split = 65536 - saa->audhead;
|
||||
else
|
||||
split = 0;
|
||||
audbytes = 2048;
|
||||
if (split > 0 && split < 2048) {
|
||||
memcpy(saa->dmadebi, saa->audbuf + saa->audhead,
|
||||
split);
|
||||
memcpy(saa->dmadebi, saa->audbuf + saa->audhead, split);
|
||||
saa->audhead = 0;
|
||||
audbytes -= split;
|
||||
} else
|
||||
|
@ -360,8 +368,7 @@ static void do_irq_send_data(struct saa7146 *saa)
|
|||
split = 0;
|
||||
vidbytes = 30720;
|
||||
if (split > 0 && split < 30720) {
|
||||
memcpy(saa->dmadebi, saa->vidbuf + saa->vidhead,
|
||||
split);
|
||||
memcpy(saa->dmadebi, saa->vidbuf + saa->vidhead, split);
|
||||
saa->vidhead = 0;
|
||||
vidbytes -= split;
|
||||
} else
|
||||
|
@ -400,7 +407,7 @@ static void send_osd_data(struct saa7146 *saa)
|
|||
|
||||
static irqreturn_t saa7146_irq(int irq, void *dev_id, struct pt_regs *regs)
|
||||
{
|
||||
struct saa7146 *saa = (struct saa7146 *) dev_id;
|
||||
struct saa7146 *saa = dev_id;
|
||||
u32 stat, astat;
|
||||
int count;
|
||||
int handled = 0;
|
||||
|
@ -628,11 +635,9 @@ static void initialize_cs8420(struct saa7146 *saa, int pro)
|
|||
else
|
||||
sequence = mode8420con;
|
||||
for (i = 0; i < INIT8420LEN; i++)
|
||||
I2CWrite(saa, 0x20, init8420[i * 2],
|
||||
init8420[i * 2 + 1], 2);
|
||||
I2CWrite(saa, 0x20, init8420[i * 2], init8420[i * 2 + 1], 2);
|
||||
for (i = 0; i < MODE8420LEN; i++)
|
||||
I2CWrite(saa, 0x20, sequence[i * 2],
|
||||
sequence[i * 2 + 1], 2);
|
||||
I2CWrite(saa, 0x20, sequence[i * 2], sequence[i * 2 + 1], 2);
|
||||
printk("stradis%d: CS8420 initialized\n", saa->nr);
|
||||
}
|
||||
|
||||
|
@ -666,7 +671,8 @@ static void initialize_saa7121(struct saa7146 *saa, int dopal)
|
|||
I2CWrite(saa, 0x88, 0x7b,
|
||||
dopal ? PALLastActive :
|
||||
NTSCLastActive, 2);
|
||||
else I2CWrite(saa, 0x88, sequence[i * 2],
|
||||
else
|
||||
I2CWrite(saa, 0x88, sequence[i * 2],
|
||||
sequence[i * 2 + 1], 2);
|
||||
} else {
|
||||
if (sequence[i * 2] == 0x6b && mod)
|
||||
|
@ -700,7 +706,8 @@ static void set_genlock_offset(struct saa7146 *saa, int noffset)
|
|||
nCode = noffset + 0x100;
|
||||
if (nCode == 1)
|
||||
nCode = 0x401;
|
||||
else if (nCode < 1) nCode = 0x400 + PixelsPerLine + nCode;
|
||||
else if (nCode < 1)
|
||||
nCode = 0x400 + PixelsPerLine + nCode;
|
||||
debiwrite(saa, debNormal, XILINX_GLDELAY, nCode, 2);
|
||||
}
|
||||
|
||||
|
@ -715,8 +722,7 @@ static void set_out_format(struct saa7146 *saa, int mode)
|
|||
mdelay(50);
|
||||
saawrite(0x012002c0, SAA7146_NUM_LINE_BYTE1);
|
||||
if (NewCard) {
|
||||
debiwrite(saa, debNormal, IBM_MP2_DISP_MODE,
|
||||
0xe100, 2);
|
||||
debiwrite(saa, debNormal, IBM_MP2_DISP_MODE, 0xe100, 2);
|
||||
mdelay(50);
|
||||
}
|
||||
debiwrite(saa, debNormal, IBM_MP2_DISP_MODE,
|
||||
|
@ -736,7 +742,6 @@ static void set_out_format(struct saa7146 *saa, int mode)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* Intialize bitmangler to map from a byte value to the mangled word that
|
||||
* must be output to program the Xilinx part through the DEBI port.
|
||||
* Xilinx Data Bit->DEBI Bit: 0->15 1->7 2->6 3->12 4->11 5->2 6->1 7->0
|
||||
|
@ -786,20 +791,18 @@ static int initialize_fpga(struct video_code *bitdata)
|
|||
if (NewCard) { /* SDM2xxx */
|
||||
if (!strncmp(bitdata->loadwhat, "decoder2", 8))
|
||||
continue; /* fpga not for this card */
|
||||
if (!strncmp(&saa->boardcfg[42],
|
||||
bitdata->loadwhat, 8)) {
|
||||
if (!strncmp(&saa->boardcfg[42], bitdata->loadwhat, 8))
|
||||
loadfile = 1;
|
||||
} else if (loadtwo && !strncmp(&saa->boardcfg[19],
|
||||
bitdata->loadwhat, 8)) {
|
||||
else if (loadtwo && !strncmp(&saa->boardcfg[19],
|
||||
bitdata->loadwhat, 8))
|
||||
loadfile = 2;
|
||||
} else if (!saa->boardcfg[42] && /* special */
|
||||
!strncmp("decxl", bitdata->loadwhat, 8)) {
|
||||
loadfile = 1;
|
||||
} else
|
||||
else if (!saa->boardcfg[42] && !strncmp("decxl",
|
||||
bitdata->loadwhat, 8))
|
||||
loadfile = 1; /* special */
|
||||
else
|
||||
continue; /* fpga not for this card */
|
||||
if (loadfile != 1 && loadfile != 2) {
|
||||
if (loadfile != 1 && loadfile != 2)
|
||||
continue; /* skip to next card */
|
||||
}
|
||||
if (saa->boardcfg[0] && loadfile == 1)
|
||||
continue; /* skip to next card */
|
||||
if (saa->boardcfg[0] != 1 && loadfile == 2)
|
||||
|
@ -835,8 +838,9 @@ static int initialize_fpga(struct video_code *bitdata)
|
|||
/* Release Xilinx INIT signal (WS2) */
|
||||
saawrite(0x00000000, SAA7146_GPIO_CTRL);
|
||||
/* Wait for the INIT to go High */
|
||||
for (i = 0; i < 10000 &&
|
||||
!(saaread(SAA7146_PSR) & SAA7146_PSR_PIN2); i++)
|
||||
for (i = 0;
|
||||
i < 10000 && !(saaread(SAA7146_PSR) & SAA7146_PSR_PIN2);
|
||||
i++)
|
||||
schedule();
|
||||
if (i == 1000) {
|
||||
printk(KERN_INFO "stradis%d: no fpga INIT\n", saa->nr);
|
||||
|
@ -849,15 +853,11 @@ send_fpga_stuff:
|
|||
bitmangler[bitdata->data[i]];
|
||||
debiwrite(saa, 0x01420000, 0, 0,
|
||||
((bitdata->datasize - startindex) + 5));
|
||||
if (loadtwo) {
|
||||
if (loadfile == 1) {
|
||||
printk("stradis%d: "
|
||||
"awaiting 2nd FPGA bitfile\n",
|
||||
if (loadtwo && loadfile == 1) {
|
||||
printk("stradis%d: awaiting 2nd FPGA bitfile\n",
|
||||
saa->nr);
|
||||
continue; /* skip to next card */
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
for (i = startindex; i < bitdata->datasize; i++)
|
||||
dmabuf[i - startindex] =
|
||||
|
@ -865,8 +865,9 @@ send_fpga_stuff:
|
|||
debiwrite(saa, 0x014a0000, 0, 0,
|
||||
((bitdata->datasize - startindex) + 5) * 2);
|
||||
}
|
||||
for (i = 0; i < 1000 &&
|
||||
!(saaread(SAA7146_PSR) & SAA7146_PSR_PIN2); i++)
|
||||
for (i = 0;
|
||||
i < 1000 && !(saaread(SAA7146_PSR) & SAA7146_PSR_PIN2);
|
||||
i++)
|
||||
schedule();
|
||||
if (i == 1000) {
|
||||
printk(KERN_INFO "stradis%d: FPGA load failed\n",
|
||||
|
@ -923,10 +924,10 @@ send_fpga_stuff:
|
|||
/* we must init CS8420 first since rev b pulls i2s */
|
||||
/* master clock low and CS4341 needs i2s master to */
|
||||
/* run the i2c port. */
|
||||
if (HaveCS8420) {
|
||||
if (HaveCS8420)
|
||||
/* 0=consumer, 1=pro */
|
||||
initialize_cs8420(saa, 0);
|
||||
}
|
||||
|
||||
mdelay(5);
|
||||
if (HaveCS4341)
|
||||
initialize_cs4341(saa);
|
||||
|
@ -946,6 +947,7 @@ send_fpga_stuff:
|
|||
debiwrite(saa, debNormal, XILINX_CTL0, 0x8080, 2);
|
||||
#endif
|
||||
}
|
||||
|
||||
return failure;
|
||||
}
|
||||
|
||||
|
@ -986,10 +988,10 @@ static int do_ibm_reset(struct saa7146 *saa)
|
|||
/* we must init CS8420 first since rev b pulls i2s */
|
||||
/* master clock low and CS4341 needs i2s master to */
|
||||
/* run the i2c port. */
|
||||
if (HaveCS8420) {
|
||||
if (HaveCS8420)
|
||||
/* 0=consumer, 1=pro */
|
||||
initialize_cs8420(saa, 1);
|
||||
}
|
||||
|
||||
mdelay(5);
|
||||
if (HaveCS4341)
|
||||
initialize_cs4341(saa);
|
||||
|
@ -1022,6 +1024,7 @@ static int do_ibm_reset(struct saa7146 *saa)
|
|||
/* clear pending interrupts */
|
||||
debiread(saa, debNormal, IBM_MP2_HOST_INT, 2);
|
||||
debiwrite(saa, debNormal, XILINX_CTL0, 0x1711, 2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1035,8 +1038,8 @@ static int initialize_ibmmpeg2(struct video_code *microcode)
|
|||
saa = &saa7146s[num];
|
||||
/* check that FPGA is loaded */
|
||||
debiwrite(saa, debNormal, IBM_MP2_OSD_SIZE, 0xa55a, 2);
|
||||
if ((i = debiread(saa, debNormal, IBM_MP2_OSD_SIZE, 2)) !=
|
||||
0xa55a) {
|
||||
i = debiread(saa, debNormal, IBM_MP2_OSD_SIZE, 2);
|
||||
if (i != 0xa55a) {
|
||||
printk(KERN_INFO "stradis%d: %04x != 0xa55a\n",
|
||||
saa->nr, i);
|
||||
#if 0
|
||||
|
@ -1075,9 +1078,8 @@ static int initialize_ibmmpeg2(struct video_code *microcode)
|
|||
debiwrite(saa, debNormal, IBM_MP2_AUD_CTL, 0x4552, 2);
|
||||
if (ibm_send_command(saa, IBM_MP2_CONFIG_DECODER,
|
||||
0xe000, 1)) {
|
||||
printk(KERN_ERR
|
||||
"stradis%d: IBM config failed\n",
|
||||
saa->nr);
|
||||
printk(KERN_ERR "stradis%d: IBM config "
|
||||
"failed\n", saa->nr);
|
||||
return -1;
|
||||
}
|
||||
/* set PWM to center value */
|
||||
|
@ -1086,22 +1088,21 @@ static int initialize_ibmmpeg2(struct video_code *microcode)
|
|||
saa->boardcfg[14] +
|
||||
(saa->boardcfg[13] << 8), 2);
|
||||
} else
|
||||
debiwrite(saa, debNormal, XILINX_PWM,
|
||||
0x46, 2);
|
||||
debiwrite(saa, debNormal, XILINX_PWM, 0x46, 2);
|
||||
|
||||
if (HaveCS3310) {
|
||||
i = CS3310MaxLvl;
|
||||
debiwrite(saa, debNormal,
|
||||
XILINX_CS3310_CMPLT, ((i<<8)|i), 2);
|
||||
debiwrite(saa, debNormal, XILINX_CS3310_CMPLT,
|
||||
(i << 8) | i, 2);
|
||||
}
|
||||
printk(KERN_INFO
|
||||
"stradis%d: IBM MPEGCD%d Initialized\n",
|
||||
printk(KERN_INFO "stradis%d: IBM MPEGCD%d Inited\n",
|
||||
saa->nr, 18 + (debiread(saa, debNormal,
|
||||
IBM_MP2_CHIP_CONTROL, 2) >> 12));
|
||||
/* start video decoder */
|
||||
debiwrite(saa, debNormal, IBM_MP2_CHIP_CONTROL,
|
||||
ChipControl, 2);
|
||||
debiwrite(saa, debNormal, IBM_MP2_RB_THRESHOLD,
|
||||
0x4037, 2); /* 256k vid, 3520 bytes aud */
|
||||
debiwrite(saa, debNormal, IBM_MP2_RB_THRESHOLD, 0x4037,
|
||||
2); /* 256k vid, 3520 bytes aud */
|
||||
debiwrite(saa, debNormal, IBM_MP2_AUD_CTL, 0x4573, 2);
|
||||
ibm_send_command(saa, IBM_MP2_PLAY, 0, 0);
|
||||
/* enable buffer threshold irq */
|
||||
|
@ -1114,24 +1115,22 @@ static int initialize_ibmmpeg2(struct video_code *microcode)
|
|||
saa->boardcfg[0] = 37;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 palette2fmt[] =
|
||||
{ /* some of these YUV translations are wrong */
|
||||
static u32 palette2fmt[] = { /* some of these YUV translations are wrong */
|
||||
0xffffffff, 0x86000000, 0x87000000, 0x80000000, 0x8100000, 0x82000000,
|
||||
0x83000000, 0x00000000, 0x03000000, 0x03000000, 0x0a00000, 0x03000000,
|
||||
0x06000000, 0x00000000, 0x03000000, 0x0a000000, 0x0300000
|
||||
};
|
||||
static int bpp2fmt[4] =
|
||||
{
|
||||
static int bpp2fmt[4] = {
|
||||
VIDEO_PALETTE_HI240, VIDEO_PALETTE_RGB565, VIDEO_PALETTE_RGB24,
|
||||
VIDEO_PALETTE_RGB32
|
||||
};
|
||||
|
||||
/* I wish I could find a formula to calculate these... */
|
||||
static u32 h_prescale[64] =
|
||||
{
|
||||
static u32 h_prescale[64] = {
|
||||
0x10000000, 0x18040202, 0x18080000, 0x380c0606, 0x38100204, 0x38140808,
|
||||
0x38180000, 0x381c0000, 0x3820161c, 0x38242a3b, 0x38281230, 0x382c4460,
|
||||
0x38301040, 0x38340080, 0x38380000, 0x383c0000, 0x3840fefe, 0x3844ee9f,
|
||||
|
@ -1144,8 +1143,7 @@ static u32 h_prescale[64] =
|
|||
0x38d80000, 0x38dc0000, 0x38e00000, 0x38e40000, 0x38e80000, 0x38ec0000,
|
||||
0x38f00000, 0x38f40000, 0x38f80000, 0x38fc0000,
|
||||
};
|
||||
static u32 v_gain[64] =
|
||||
{
|
||||
static u32 v_gain[64] = {
|
||||
0x016000ff, 0x016100ff, 0x016100ff, 0x016200ff, 0x016200ff, 0x016200ff,
|
||||
0x016200ff, 0x016300ff, 0x016300ff, 0x016300ff, 0x016300ff, 0x016300ff,
|
||||
0x016300ff, 0x016300ff, 0x016300ff, 0x016400ff, 0x016400ff, 0x016400ff,
|
||||
|
@ -1159,7 +1157,6 @@ static u32 v_gain[64] =
|
|||
0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff,
|
||||
};
|
||||
|
||||
|
||||
static void saa7146_set_winsize(struct saa7146 *saa)
|
||||
{
|
||||
u32 format;
|
||||
|
@ -1190,8 +1187,7 @@ static void saa7146_set_winsize(struct saa7146 *saa)
|
|||
saawrite(v_gain[yacl], SAA7146_HPS_V_GAIN);
|
||||
saawrite(((SAA7146_MC2_UPLD_DMA1 | SAA7146_MC2_UPLD_HPS_V |
|
||||
SAA7146_MC2_UPLD_HPS_H) << 16) | (SAA7146_MC2_UPLD_DMA1 |
|
||||
SAA7146_MC2_UPLD_HPS_V | SAA7146_MC2_UPLD_HPS_H),
|
||||
SAA7146_MC2);
|
||||
SAA7146_MC2_UPLD_HPS_V | SAA7146_MC2_UPLD_HPS_H), SAA7146_MC2);
|
||||
}
|
||||
|
||||
/* clip_draw_rectangle(cm,x,y,w,h) -- handle clipping an area
|
||||
|
@ -1268,12 +1264,13 @@ static void make_clip_tab(struct saa7146 *saa, struct video_clip *cr, int ncr)
|
|||
*/
|
||||
clip_draw_rectangle(clipmap, (saa->win.x + width > saa->win.swidth) ?
|
||||
(saa->win.swidth - saa->win.x) : width, 0, 1024, 768);
|
||||
clip_draw_rectangle(clipmap,0,(saa->win.y+height>saa->win.sheight) ?
|
||||
clip_draw_rectangle(clipmap, 0,
|
||||
(saa->win.y + height > saa->win.sheight) ?
|
||||
(saa->win.sheight - saa->win.y) : height, 1024, 768);
|
||||
if (saa->win.x < 0)
|
||||
clip_draw_rectangle(clipmap, 0, 0, -(saa->win.x), 768);
|
||||
clip_draw_rectangle(clipmap, 0, 0, -saa->win.x, 768);
|
||||
if (saa->win.y < 0)
|
||||
clip_draw_rectangle(clipmap, 0, 0, 1024, -(saa->win.y));
|
||||
clip_draw_rectangle(clipmap, 0, 0, 1024, -saa->win.y);
|
||||
}
|
||||
|
||||
static int saa_ioctl(struct inode *inode, struct file *file,
|
||||
|
@ -1287,10 +1284,8 @@ static int saa_ioctl(struct inode *inode, struct file *file,
|
|||
{
|
||||
struct video_capability b;
|
||||
strcpy(b.name, saa->video_dev.name);
|
||||
b.type = VID_TYPE_CAPTURE |
|
||||
VID_TYPE_OVERLAY |
|
||||
VID_TYPE_CLIPPING |
|
||||
VID_TYPE_FRAMERAM |
|
||||
b.type = VID_TYPE_CAPTURE | VID_TYPE_OVERLAY |
|
||||
VID_TYPE_CLIPPING | VID_TYPE_FRAMERAM |
|
||||
VID_TYPE_SCALES;
|
||||
b.channels = 1;
|
||||
b.audios = 1;
|
||||
|
@ -1328,7 +1323,8 @@ static int saa_ioctl(struct inode *inode, struct file *file,
|
|||
if (p.palette < sizeof(palette2fmt) / sizeof(u32)) {
|
||||
format = palette2fmt[p.palette];
|
||||
saa->win.color_fmt = format;
|
||||
saawrite(format|0x60, SAA7146_CLIP_FORMAT_CTRL);
|
||||
saawrite(format | 0x60,
|
||||
SAA7146_CLIP_FORMAT_CTRL);
|
||||
}
|
||||
saawrite(((p.brightness & 0xff00) << 16) |
|
||||
((p.contrast & 0xfe00) << 7) |
|
||||
|
@ -1337,8 +1333,8 @@ static int saa_ioctl(struct inode *inode, struct file *file,
|
|||
/* upload changed registers */
|
||||
saawrite(((SAA7146_MC2_UPLD_HPS_H |
|
||||
SAA7146_MC2_UPLD_HPS_V) << 16) |
|
||||
SAA7146_MC2_UPLD_HPS_H | SAA7146_MC2_UPLD_HPS_V,
|
||||
SAA7146_MC2);
|
||||
SAA7146_MC2_UPLD_HPS_H |
|
||||
SAA7146_MC2_UPLD_HPS_V, SAA7146_MC2);
|
||||
return 0;
|
||||
}
|
||||
case VIDIOCSWIN:
|
||||
|
@ -1349,11 +1345,14 @@ static int saa_ioctl(struct inode *inode, struct file *file,
|
|||
if (copy_from_user(&vw, arg, sizeof(vw)))
|
||||
return -EFAULT;
|
||||
|
||||
if (vw.flags || vw.width < 16 || vw.height < 16) { /* stop capture */
|
||||
saawrite((SAA7146_MC1_TR_E_1 << 16), SAA7146_MC1);
|
||||
/* stop capture */
|
||||
if (vw.flags || vw.width < 16 || vw.height < 16) {
|
||||
saawrite((SAA7146_MC1_TR_E_1 << 16),
|
||||
SAA7146_MC1);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (saa->win.bpp < 4) { /* 32-bit align start and adjust width */
|
||||
/* 32-bit align start and adjust width */
|
||||
if (saa->win.bpp < 4) {
|
||||
int i = vw.x;
|
||||
vw.x = (vw.x + 3) & ~3;
|
||||
i = vw.x - i;
|
||||
|
@ -1384,12 +1383,12 @@ static int saa_ioctl(struct inode *inode, struct file *file,
|
|||
if (copy_from_user(saa->dmavid2, vw.clips,
|
||||
VIDEO_CLIPMAP_SIZE))
|
||||
return -EFAULT;
|
||||
}
|
||||
else if (vw.clipcount > 16384) {
|
||||
} else if (vw.clipcount > 16384) {
|
||||
return -EINVAL;
|
||||
} else if (vw.clipcount > 0) {
|
||||
if ((vcp = vmalloc(sizeof(struct video_clip) *
|
||||
(vw.clipcount))) == NULL)
|
||||
vcp = vmalloc(sizeof(struct video_clip) *
|
||||
vw.clipcount);
|
||||
if (vcp == NULL)
|
||||
return -ENOMEM;
|
||||
if (copy_from_user(vcp, vw.clips,
|
||||
sizeof(struct video_clip) *
|
||||
|
@ -1399,6 +1398,7 @@ static int saa_ioctl(struct inode *inode, struct file *file,
|
|||
}
|
||||
} else /* nothing clipped */
|
||||
memset(saa->dmavid2, 0, VIDEO_CLIPMAP_SIZE);
|
||||
|
||||
make_clip_tab(saa, vcp, vw.clipcount);
|
||||
if (vw.clipcount > 0)
|
||||
vfree(vcp);
|
||||
|
@ -1474,8 +1474,9 @@ static int saa_ioctl(struct inode *inode, struct file *file,
|
|||
saa->win.depth = v.depth;
|
||||
saa->win.bpl = v.bytesperline;
|
||||
|
||||
DEBUG(printk("Display at %p is %d by %d, bytedepth %d, bpl %d\n",
|
||||
v.base, v.width, v.height, saa->win.bpp, saa->win.bpl));
|
||||
DEBUG(printk("Display at %p is %d by %d, bytedepth %d, "
|
||||
"bpl %d\n", v.base, v.width, v.height,
|
||||
saa->win.bpp, saa->win.bpl));
|
||||
saa7146_set_winsize(saa);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1505,15 +1506,12 @@ static int saa_ioctl(struct inode *inode, struct file *file,
|
|||
return -EFAULT;
|
||||
i = (~(v.volume >> 8)) & 0xff;
|
||||
if (!HaveCS4341) {
|
||||
if (v.flags & VIDEO_AUDIO_MUTE) {
|
||||
if (v.flags & VIDEO_AUDIO_MUTE)
|
||||
debiwrite(saa, debNormal,
|
||||
IBM_MP2_FRNT_ATTEN,
|
||||
0xffff, 2);
|
||||
}
|
||||
IBM_MP2_FRNT_ATTEN, 0xffff, 2);
|
||||
if (!(v.flags & VIDEO_AUDIO_MUTE))
|
||||
debiwrite(saa, debNormal,
|
||||
IBM_MP2_FRNT_ATTEN,
|
||||
0x0000, 2);
|
||||
IBM_MP2_FRNT_ATTEN, 0x0000, 2);
|
||||
if (v.flags & VIDEO_AUDIO_VOLUME)
|
||||
debiwrite(saa, debNormal,
|
||||
IBM_MP2_FRNT_ATTEN,
|
||||
|
@ -1556,29 +1554,22 @@ static int saa_ioctl(struct inode *inode, struct file *file,
|
|||
set_out_format(saa, pmode.p1);
|
||||
return 0;
|
||||
case VID_PLAY_GENLOCK:
|
||||
debiwrite(saa, debNormal,
|
||||
XILINX_CTL0,
|
||||
(pmode.p1 ? 0x8000 : 0x8080),
|
||||
2);
|
||||
debiwrite(saa, debNormal, XILINX_CTL0,
|
||||
pmode.p1 ? 0x8000 : 0x8080, 2);
|
||||
if (NewCard)
|
||||
set_genlock_offset(saa,
|
||||
pmode.p2);
|
||||
set_genlock_offset(saa, pmode.p2);
|
||||
return 0;
|
||||
case VID_PLAY_NORMAL:
|
||||
debiwrite(saa, debNormal,
|
||||
IBM_MP2_CHIP_CONTROL,
|
||||
ChipControl, 2);
|
||||
ibm_send_command(saa,
|
||||
IBM_MP2_PLAY, 0, 0);
|
||||
IBM_MP2_CHIP_CONTROL, ChipControl, 2);
|
||||
ibm_send_command(saa, IBM_MP2_PLAY, 0, 0);
|
||||
saa->playmode = pmode.mode;
|
||||
return 0;
|
||||
case VID_PLAY_PAUSE:
|
||||
/* IBM removed the PAUSE command */
|
||||
/* they say use SINGLE_FRAME now */
|
||||
case VID_PLAY_SINGLE_FRAME:
|
||||
ibm_send_command(saa,
|
||||
IBM_MP2_SINGLE_FRAME,
|
||||
0, 0);
|
||||
ibm_send_command(saa, IBM_MP2_SINGLE_FRAME,0,0);
|
||||
if (saa->playmode == pmode.mode) {
|
||||
debiwrite(saa, debNormal,
|
||||
IBM_MP2_CHIP_CONTROL,
|
||||
|
@ -1587,105 +1578,87 @@ static int saa_ioctl(struct inode *inode, struct file *file,
|
|||
saa->playmode = pmode.mode;
|
||||
return 0;
|
||||
case VID_PLAY_FAST_FORWARD:
|
||||
ibm_send_command(saa,
|
||||
IBM_MP2_FAST_FORWARD, 0, 0);
|
||||
ibm_send_command(saa, IBM_MP2_FAST_FORWARD,0,0);
|
||||
saa->playmode = pmode.mode;
|
||||
return 0;
|
||||
case VID_PLAY_SLOW_MOTION:
|
||||
ibm_send_command(saa,
|
||||
IBM_MP2_SLOW_MOTION,
|
||||
ibm_send_command(saa, IBM_MP2_SLOW_MOTION,
|
||||
pmode.p1, 0);
|
||||
saa->playmode = pmode.mode;
|
||||
return 0;
|
||||
case VID_PLAY_IMMEDIATE_NORMAL:
|
||||
/* ensure transfers resume */
|
||||
debiwrite(saa, debNormal,
|
||||
IBM_MP2_CHIP_CONTROL,
|
||||
ChipControl, 2);
|
||||
ibm_send_command(saa,
|
||||
IBM_MP2_IMED_NORM_PLAY, 0, 0);
|
||||
IBM_MP2_CHIP_CONTROL, ChipControl, 2);
|
||||
ibm_send_command(saa, IBM_MP2_IMED_NORM_PLAY,
|
||||
0, 0);
|
||||
saa->playmode = VID_PLAY_NORMAL;
|
||||
return 0;
|
||||
case VID_PLAY_SWITCH_CHANNELS:
|
||||
saa->audhead = saa->audtail = 0;
|
||||
saa->vidhead = saa->vidtail = 0;
|
||||
ibm_send_command(saa,
|
||||
IBM_MP2_FREEZE_FRAME, 0, 1);
|
||||
ibm_send_command(saa,
|
||||
IBM_MP2_RESET_AUD_RATE, 0, 1);
|
||||
debiwrite(saa, debNormal,
|
||||
IBM_MP2_CHIP_CONTROL, 0, 2);
|
||||
ibm_send_command(saa,
|
||||
IBM_MP2_CHANNEL_SWITCH, 0, 1);
|
||||
debiwrite(saa, debNormal,
|
||||
IBM_MP2_CHIP_CONTROL,
|
||||
ibm_send_command(saa, IBM_MP2_FREEZE_FRAME,0,1);
|
||||
ibm_send_command(saa, IBM_MP2_RESET_AUD_RATE,
|
||||
0, 1);
|
||||
debiwrite(saa, debNormal, IBM_MP2_CHIP_CONTROL,
|
||||
0, 2);
|
||||
ibm_send_command(saa, IBM_MP2_CHANNEL_SWITCH,
|
||||
0, 1);
|
||||
debiwrite(saa, debNormal, IBM_MP2_CHIP_CONTROL,
|
||||
ChipControl, 2);
|
||||
ibm_send_command(saa,
|
||||
IBM_MP2_PLAY, 0, 0);
|
||||
ibm_send_command(saa, IBM_MP2_PLAY, 0, 0);
|
||||
saa->playmode = VID_PLAY_NORMAL;
|
||||
return 0;
|
||||
case VID_PLAY_FREEZE_FRAME:
|
||||
ibm_send_command(saa,
|
||||
IBM_MP2_FREEZE_FRAME, 0, 0);
|
||||
ibm_send_command(saa, IBM_MP2_FREEZE_FRAME,0,0);
|
||||
saa->playmode = pmode.mode;
|
||||
return 0;
|
||||
case VID_PLAY_STILL_MODE:
|
||||
ibm_send_command(saa,
|
||||
IBM_MP2_SET_STILL_MODE, 0, 0);
|
||||
ibm_send_command(saa, IBM_MP2_SET_STILL_MODE,
|
||||
0, 0);
|
||||
saa->playmode = pmode.mode;
|
||||
return 0;
|
||||
case VID_PLAY_MASTER_MODE:
|
||||
if (pmode.p1 == VID_PLAY_MASTER_NONE)
|
||||
saa->boardcfg[1] = 0x13;
|
||||
else if (pmode.p1 ==
|
||||
VID_PLAY_MASTER_VIDEO)
|
||||
else if (pmode.p1 == VID_PLAY_MASTER_VIDEO)
|
||||
saa->boardcfg[1] = 0x23;
|
||||
else if (pmode.p1 ==
|
||||
VID_PLAY_MASTER_AUDIO)
|
||||
else if (pmode.p1 == VID_PLAY_MASTER_AUDIO)
|
||||
saa->boardcfg[1] = 0x43;
|
||||
else
|
||||
return -EINVAL;
|
||||
debiwrite(saa, debNormal,
|
||||
IBM_MP2_CHIP_CONTROL,
|
||||
ChipControl, 2);
|
||||
IBM_MP2_CHIP_CONTROL, ChipControl, 2);
|
||||
return 0;
|
||||
case VID_PLAY_ACTIVE_SCANLINES:
|
||||
if (CurrentMode == VIDEO_MODE_PAL) {
|
||||
if (pmode.p1 < 1 ||
|
||||
pmode.p2 > 625)
|
||||
if (pmode.p1 < 1 || pmode.p2 > 625)
|
||||
return -EINVAL;
|
||||
saa->boardcfg[5] = pmode.p1;
|
||||
saa->boardcfg[55] = (pmode.p1 +
|
||||
(pmode.p2/2) - 1) &
|
||||
0xff;
|
||||
(pmode.p2 / 2) - 1) & 0xff;
|
||||
} else {
|
||||
if (pmode.p1 < 4 ||
|
||||
pmode.p2 > 525)
|
||||
if (pmode.p1 < 4 || pmode.p2 > 525)
|
||||
return -EINVAL;
|
||||
saa->boardcfg[4] = pmode.p1;
|
||||
saa->boardcfg[54] = (pmode.p1 +
|
||||
(pmode.p2/2) - 4) &
|
||||
0xff;
|
||||
(pmode.p2 / 2) - 4) & 0xff;
|
||||
}
|
||||
set_out_format(saa, CurrentMode);
|
||||
case VID_PLAY_RESET:
|
||||
return do_ibm_reset(saa);
|
||||
case VID_PLAY_END_MARK:
|
||||
if (saa->endmarktail <
|
||||
saa->endmarkhead) {
|
||||
if (saa->endmarktail < saa->endmarkhead) {
|
||||
if (saa->endmarkhead -
|
||||
saa->endmarktail < 2)
|
||||
return -ENOSPC;
|
||||
} else if (saa->endmarkhead <=
|
||||
saa->endmarktail) {
|
||||
if (saa->endmarktail -
|
||||
saa->endmarkhead >
|
||||
(MAX_MARKS - 2))
|
||||
} else if (saa->endmarkhead <=saa->endmarktail){
|
||||
if (saa->endmarktail - saa->endmarkhead
|
||||
> (MAX_MARKS - 2))
|
||||
return -ENOSPC;
|
||||
} else
|
||||
return -ENOSPC;
|
||||
saa->endmark[saa->endmarktail] =
|
||||
saa->audtail;
|
||||
saa->endmark[saa->endmarktail] = saa->audtail;
|
||||
saa->endmarktail++;
|
||||
if (saa->endmarktail >= MAX_MARKS)
|
||||
saa->endmarktail = 0;
|
||||
|
@ -1724,8 +1697,8 @@ static int saa_ioctl(struct inode *inode, struct file *file,
|
|||
return -EFAULT;
|
||||
}
|
||||
ucode.data = udata;
|
||||
if (!strncmp(ucode.loadwhat, "decoder.aud", 11)
|
||||
|| !strncmp(ucode.loadwhat, "decoder.vid", 11))
|
||||
if (!strncmp(ucode.loadwhat, "decoder.aud", 11) ||
|
||||
!strncmp(ucode.loadwhat, "decoder.vid", 11))
|
||||
i = initialize_ibmmpeg2(&ucode);
|
||||
else
|
||||
i = initialize_fpga(&ucode);
|
||||
|
@ -1788,7 +1761,8 @@ static ssize_t saa_write(struct file *file, const char __user *buf,
|
|||
if (saa->writemode == VID_WRITE_MPEG_AUD) {
|
||||
spin_lock_irqsave(&saa->lock, flags);
|
||||
if (saa->audhead <= saa->audtail)
|
||||
blocksize = 65536-(saa->audtail - saa->audhead);
|
||||
blocksize = 65536 -
|
||||
(saa->audtail - saa->audhead);
|
||||
else
|
||||
blocksize = saa->audhead - saa->audtail;
|
||||
spin_unlock_irqrestore(&saa->lock, flags);
|
||||
|
@ -1801,7 +1775,8 @@ static ssize_t saa_write(struct file *file, const char __user *buf,
|
|||
}
|
||||
spin_lock_irqsave(&saa->lock, flags);
|
||||
if (saa->audhead <= saa->audtail) {
|
||||
blocksize = 65536-(saa->audtail - saa->audhead);
|
||||
blocksize = 65536 -
|
||||
(saa->audtail - saa->audhead);
|
||||
split = 65536 - saa->audtail;
|
||||
} else {
|
||||
blocksize = saa->audhead - saa->audtail;
|
||||
|
@ -1833,7 +1808,8 @@ static ssize_t saa_write(struct file *file, const char __user *buf,
|
|||
} else if (saa->writemode == VID_WRITE_MPEG_VID) {
|
||||
spin_lock_irqsave(&saa->lock, flags);
|
||||
if (saa->vidhead <= saa->vidtail)
|
||||
blocksize=524288-(saa->vidtail - saa->vidhead);
|
||||
blocksize = 524288 -
|
||||
(saa->vidtail - saa->vidhead);
|
||||
else
|
||||
blocksize = saa->vidhead - saa->vidtail;
|
||||
spin_unlock_irqrestore(&saa->lock, flags);
|
||||
|
@ -1846,7 +1822,8 @@ static ssize_t saa_write(struct file *file, const char __user *buf,
|
|||
}
|
||||
spin_lock_irqsave(&saa->lock, flags);
|
||||
if (saa->vidhead <= saa->vidtail) {
|
||||
blocksize=524288-(saa->vidtail - saa->vidhead);
|
||||
blocksize = 524288 -
|
||||
(saa->vidtail - saa->vidhead);
|
||||
split = 524288 - saa->vidtail;
|
||||
} else {
|
||||
blocksize = saa->vidhead - saa->vidtail;
|
||||
|
@ -1923,8 +1900,7 @@ static int saa_release(struct inode *inode, struct file *file)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct file_operations saa_fops =
|
||||
{
|
||||
static struct file_operations saa_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = saa_open,
|
||||
.release = saa_release,
|
||||
|
@ -1937,8 +1913,7 @@ static struct file_operations saa_fops =
|
|||
};
|
||||
|
||||
/* template for video_device-structure */
|
||||
static struct video_device saa_template =
|
||||
{
|
||||
static struct video_device saa_template = {
|
||||
.name = "SAA7146A",
|
||||
.type = VID_TYPE_CAPTURE | VID_TYPE_OVERLAY,
|
||||
.hardware = VID_HARDWARE_SAA7146,
|
||||
|
@ -2209,6 +2184,7 @@ static struct pci_device_id stradis_pci_tbl[] = {
|
|||
{ PCI_DEVICE(PCI_VENDOR_ID_PHILIPS, PCI_DEVICE_ID_PHILIPS_SAA7146) },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(pci, stradis_pci_tbl);
|
||||
|
||||
static struct pci_driver stradis_driver = {
|
||||
|
@ -2231,7 +2207,6 @@ int __init stradis_init(void)
|
|||
return retval;
|
||||
}
|
||||
|
||||
|
||||
void __exit stradis_exit(void)
|
||||
{
|
||||
pci_unregister_driver(&stradis_driver);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue