gatos-cvs Mailing List for GATOS (Page 2)
Status: Beta
Brought to you by:
volodya
You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(10) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(35) |
Feb
(67) |
Mar
(41) |
Apr
(4) |
May
(7) |
Jun
(9) |
Jul
(7) |
Aug
(2) |
Sep
(9) |
Oct
(3) |
Nov
(5) |
Dec
(30) |
| 2004 |
Jan
(11) |
Feb
|
Mar
|
Apr
|
May
(9) |
Jun
(6) |
Jul
(8) |
Aug
(3) |
Sep
(5) |
Oct
(15) |
Nov
(25) |
Dec
(14) |
| 2005 |
Jan
(11) |
Feb
(5) |
Mar
(8) |
Apr
(5) |
May
(1) |
Jun
(2) |
Jul
(1) |
Aug
|
Sep
|
Oct
(1) |
Nov
(3) |
Dec
|
| 2006 |
Jan
(2) |
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(2) |
Sep
|
Oct
(3) |
Nov
(1) |
Dec
(2) |
| 2007 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
|
From: <gat...@li...> - 2005-07-04 00:22:38
|
Update of /cvsroot/gatos/v4l2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1975 Modified Files: board.c generic.c Log Message: changes pci_dev dev->slot_name to pci_name(dev) Index: generic.c =================================================================== RCS file: /cvsroot/gatos/v4l2/generic.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- generic.c 7 Apr 2005 02:09:43 -0000 1.10 +++ generic.c 4 Jul 2005 00:22:22 -0000 1.11 @@ -1851,10 +1851,11 @@ strncpy(cap->driver,"genericv4l",sizeof(cap->driver)); #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) strncpy(cap->card,card->video_dev.name,sizeof(cap->card)); + snprintf(cap->bus_info,sizeof(cap->bus_info),"PCI:%s",card->dev->slot_name); #else strncpy(cap->card,card->video_dev->name,sizeof(cap->card)); + snprintf(cap->bus_info,sizeof(cap->bus_info),"PCI:%s",pci_name(card->dev)); #endif - snprintf(cap->bus_info,sizeof(cap->bus_info),"PCI:%s",card->dev->slot_name); cap->version = GENERIC_VERSION_CODE; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | @@ -2488,7 +2489,11 @@ /* display info about the card we found */ pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) printk(KERN_INFO "genericv4l(%d): rev %d at %s, irq: %d, latency: %d, atifb: 0x%lx\n", num_cards_detected, card->revision, dev->slot_name, dev->irq, lat, pci_resource_start(dev,0)); +#else + printk(KERN_INFO "genericv4l(%d): rev %d at %s, irq: %d, latency: %d, atifb: 0x%lx\n", num_cards_detected, card->revision, pci_name(dev), dev->irq, lat, pci_resource_start(dev,0)); +#endif printk(KERN_INFO "IO at 0x%08lx 0x%08lx\n", pci_resource_start(dev, 1), pci_resource_end(dev, 1)); printk(KERN_INFO "mmr at 0x%08lx 0x%08lx\n", pci_resource_start(dev, 2), pci_resource_end(dev, 2)); @@ -2537,6 +2542,7 @@ if (card->driver_data & MACH64CHIP){ ptr = biosptr + 0x48; romtable = biosptr + *((u16*)ptr); +dprintk(2,"romtable at %p\n", romtable); ptr = romtable + 0x46; ptr = biosptr + *((u16*)ptr); memcpy(card->m64mminfo,ptr,5); Index: board.c =================================================================== RCS file: /cvsroot/gatos/v4l2/board.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- board.c 12 Mar 2005 17:44:00 -0000 1.2 +++ board.c 4 Jul 2005 00:22:20 -0000 1.3 @@ -189,10 +189,13 @@ dprintk(2,"card(%d) fi12xx_register called ptr is %d\n",card->cardnum, *ptr); if (card->board.addr == 0xFF){ - if (*ptr&0x0F) + if (*ptr&0x0F){ + dprintk(2,"card(%d) board.addr 0xFF\n", card->cardnum); card->tuner = (*ptr<=MAXTUNERTYPE) ? *ptr : 0; + } } else { card->tuner = card->boardinfo & 0x0F; + dprintk(2,"card(%d) tuner is 0x%02x\n", card->cardnum, card->tuner); if (card->tuner == 0x0F){ card->tuner = (*ptr<=MAXTUNERTYPE) ? *ptr : 0; } |
|
From: <gat...@li...> - 2005-06-21 18:06:31
|
Update of /cvsroot/gatos/km In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31626 Modified Files: km_v4l_24.c Log Message: Backport PAL VBI code to 2.4.x kernels Index: km_v4l_24.c =================================================================== RCS file: /cvsroot/gatos/km/km_v4l_24.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- km_v4l_24.c 11 Jan 2005 09:02:35 -0000 1.4 +++ km_v4l_24.c 21 Jun 2005 14:14:03 -0000 1.5 @@ -384,16 +384,35 @@ case VIDIOCGVBIFMT: { struct vbi_format vbi_f; - vbi_f.sampling_rate=28636363; + struct video_window vwin; + + spin_lock(&(kms->kms_lock)); + if(kms->get_window_parameters==NULL) { + spin_unlock(&(kms->kms_lock)); + return -EINVAL; + } + kms->get_window_parameters(kms, &(vwin)); + spin_unlock(&(kms->kms_lock)); + vbi_f.samples_per_line=kms->vbi_width; vbi_f.sample_format=VIDEO_PALETTE_RAW; - vbi_f.start[0]=kms->vbi_start; - vbi_f.start[1]=kms->vbi_start; - vbi_f.start[0]=10; - vbi_f.start[1]=272; vbi_f.count[0]=kms->vbi_height; vbi_f.count[1]=kms->vbi_height; vbi_f.flags=0; + switch(vwin.width) { + case 640: /* NTSC */ + vbi_f.sampling_rate=28636363; + vbi_f.start[0]=10; + vbi_f.start[1]=272; + break; + case 720: /* PAL, SECAM */ + default: + vbi_f.sampling_rate=35468950; + vbi_f.start[0]=7; + vbi_f.start[1]=319; + break; + } + if(copy_to_user(arg,&vbi_f,sizeof(vbi_f))) return -EFAULT; return 0; |
|
From: <gat...@li...> - 2005-06-19 07:20:29
|
Update of /cvsroot/gatos/km In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17423 Modified Files: km.c Log Message: pci_dev.slot_name is now obsolete, use pci_name macro instead Index: km.c =================================================================== RCS file: /cvsroot/gatos/km/km.c,v retrieving revision 1.106 retrieving revision 1.107 diff -u -d -r1.106 -r1.107 --- km.c 19 Mar 2005 10:40:12 -0000 1.106 +++ km.c 19 Jun 2005 07:20:16 -0000 1.107 @@ -588,7 +588,7 @@ #ifdef CONFIG_PCI_NAMES printk(KERN_INFO "km: probing %s\n",dev->pretty_name); #else - printk(KERN_INFO "km: probing %s\n",dev->slot_name); + printk(KERN_INFO "km: probing %s\n",pci_name(dev)); #endif #else printk(KERN_INFO "km: probing %s\n",dev->name); @@ -724,16 +724,16 @@ FIELD("DEVICE_ID").data.c.string=kmalloc(strlen(dev->pretty_name)+1, GFP_KERNEL); memcpy(FIELD("DEVICE_ID").data.c.string, dev->pretty_name, strlen(dev->pretty_name)+1); #else - FIELD("DEVICE_ID").data.c.string=kmalloc(strlen(dev->slot_name)+1, GFP_KERNEL); - memcpy(FIELD("DEVICE_ID").data.c.string, dev->slot_name, strlen(dev->slot_name)+1); + FIELD("DEVICE_ID").data.c.string=kmalloc(strlen(pci_name(dev))+1, GFP_KERNEL); + memcpy(FIELD("DEVICE_ID").data.c.string, pci_name(dev), strlen(pci_name(dev))+1); #endif #else FIELD("DEVICE_ID").data.c.string=kmalloc(strlen(dev->name)+1, GFP_KERNEL); memcpy(FIELD("DEVICE_ID").data.c.string, dev->name, strlen(dev->name)+1); #endif - FIELD("LOCATION_ID").data.c.string=kmalloc(strlen(dev->slot_name)+10, GFP_KERNEL); - sprintf(FIELD("LOCATION_ID").data.c.string, "PCI:%s", dev->slot_name); + FIELD("LOCATION_ID").data.c.string=kmalloc(strlen(pci_name(dev))+10, GFP_KERNEL); + sprintf(FIELD("LOCATION_ID").data.c.string, "PCI:%s", pci_name(dev)); FIELD("INSTANCE_ID").data.c.string=kmalloc(20, GFP_KERNEL); sprintf(FIELD("INSTANCE_ID").data.c.string, "KM_DEVICE:%d", num_devices); @@ -772,14 +772,14 @@ #ifdef LINUX_2_6 #ifdef CONFIG_PCI_NAMES printk("Device %s %s (0x%04x:0x%04x) corresponds to /dev/video%d\n", - dev->pretty_name, dev->slot_name, dev->vendor, dev->device, kms->vd->minor); + dev->pretty_name, pci_name(dev), dev->vendor, dev->device, kms->vd->minor); #else printk("Device %s (0x%04x:0x%04x) corresponds to /dev/video%d\n", - dev->slot_name, dev->vendor, dev->device, kms->vd->minor); + pci_name(dev), dev->vendor, dev->device, kms->vd->minor); #endif #else printk("Device %s %s (0x%04x:0x%04x) corresponds to /dev/video%d\n", - dev->name, dev->slot_name, dev->vendor, dev->device, kms->vd->minor); + dev->name, pci_name(dev), dev->vendor, dev->device, kms->vd->minor); #endif pci_set_master(dev); printk("kms variables: reg_aperture=%p\n",kms->reg_aperture); |
|
From: <gat...@li...> - 2005-05-28 09:00:19
|
Update of /cvsroot/gatos/avview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27550 Modified Files: alsa.scp Log Message: Fix scrollbar of alsa control panel so that last few items can be accessed even when some controls are unlocked. Index: alsa.scp =================================================================== RCS file: /cvsroot/gatos/avview/alsa.scp,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- alsa.scp 20 Dec 2003 17:59:15 -0000 1.21 +++ alsa.scp 28 May 2005 09:00:10 -0000 1.22 @@ -206,6 +206,7 @@ if { "$current_alsa_device" == "none" } { canvas $mw.label -width 0 -height 0 -background red grid $mw.label + $canvas configure -scrollregion "0 0 1 1" return } eval label $mw.title -text "\"Mixer (ALSA)\"" \ @@ -221,12 +222,9 @@ incr i } -after idle [ subst -nocommands { - catch { - set bbox [grid bbox $mw] - $canvas configure -scrollregion "[grid bbox $mw]" -width [expr [lindex \$bbox 2]+8] - } - } ] +update idletasks +set bbox [grid bbox $mw] +$canvas configure -scrollregion $bbox -width [expr [lindex $bbox 2]+8] } proc generate_alsa_window { cw } { @@ -317,6 +315,7 @@ eval frame $cw.f1.c.f [get_settings $cw.f1.c.f ALSA] $cw.f1.c create window 5 0 -window $cw.f1.c.f -anchor nw +bind $cw.f1.c.f <Configure> "readjust_alsa_scrollbar $cw.f1.c %W %h" if { "$current_alsa_device" != "none" } { generate_mixer_window $cw.f1.c $cw.f1.c.f @@ -356,6 +355,13 @@ } } +proc readjust_alsa_scrollbar {canvas frame height} { + if {[$frame cget -height] != $height} { + $canvas configure -scrollregion [grid bbox $frame] + eval $frame configure -height $height + } +} + global alsa_window set alsa_window 0 global current_alsa_device |
|
From: <gat...@li...> - 2005-04-26 08:07:24
|
Update of /cvsroot/gatos/km In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22433 Modified Files: km_v4l.c Log Message: Create device and drivers links in sysfs. Index: km_v4l.c =================================================================== RCS file: /cvsroot/gatos/km/km_v4l.c,v retrieving revision 1.55 retrieving revision 1.56 diff -u -d -r1.55 -r1.56 --- km_v4l.c 31 Mar 2005 19:40:11 -0000 1.55 +++ km_v4l.c 26 Apr 2005 08:06:58 -0000 1.56 @@ -428,6 +428,7 @@ kms->vd = video_device_alloc(); if (NULL == kms->vd) return -ENOMEM; memcpy(kms->vd, &km_v4l_template, sizeof(km_v4l_template)); + kms->vd->dev = &(kms->dev->dev); video_set_drvdata(kms->vd, kms); kms->vbi_vd = video_device_alloc(); @@ -436,6 +437,7 @@ return -ENOMEM; } memcpy(kms->vbi_vd, &km_v4l_vbi_template, sizeof(km_v4l_vbi_template)); + kms->vbi_vd->dev = &(kms->dev->dev); video_set_drvdata(kms->vbi_vd, kms); if(kms->is_capture_active!=NULL) |
|
From: <gat...@li...> - 2005-04-10 15:47:26
|
Update of /cvsroot/gatos/avview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19949 Modified Files: avview.scp Log Message: Restore dpms and screensaver settings if exiting while in fullscreen mode. Index: avview.scp =================================================================== RCS file: /cvsroot/gatos/avview/avview.scp,v retrieving revision 1.155 retrieving revision 1.156 diff -u -d -r1.155 -r1.156 --- avview.scp 5 Nov 2004 09:05:01 -0000 1.155 +++ avview.scp 10 Apr 2005 15:47:14 -0000 1.156 @@ -545,10 +545,23 @@ proc exit_avview {} { global save_settings_on_exit +global VIDEO_WINDOW saved_screensaver_mode if { [ffmpeg_present] == "yes" } { ffmpeg_stop_encoding } if { $save_settings_on_exit == "true" } { save_settings } +if {[info exists saved_screensaver_mode]} { + xmisc_setscreensaver $VIDEO_WINDOW [lindex $saved_screensaver_mode 0]\ + [lindex $saved_screensaver_mode 1]\ + [lindex $saved_screensaver_mode 2]\ + [lindex $saved_screensaver_mode 3]\ + [lindex $saved_screensaver_mode 4]\ + [lindex $saved_screensaver_mode 5]\ + [lindex $saved_screensaver_mode 6]\ + [lindex $saved_screensaver_mode 7]\ + [lindex $saved_screensaver_mode 8]\ + [lindex $saved_screensaver_mode 9] +} exit } |
|
From: <gat...@li...> - 2005-04-07 02:09:53
|
Update of /cvsroot/gatos/v4l2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31656 Modified Files: generic.c Log Message: Fixes a warning with the proc code Index: generic.c =================================================================== RCS file: /cvsroot/gatos/v4l2/generic.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- generic.c 1 Apr 2005 02:59:01 -0000 1.9 +++ generic.c 7 Apr 2005 02:09:43 -0000 1.10 @@ -983,7 +983,7 @@ len += sprintf (buffer+len,"%-20s = 0x%02X\n",#REG,REG) /* should do one for each card? is it possible to do generic func? */ -ssize_t proc_read(char *buffer, char **start, off_t offset, int size, +int proc_read(char *buffer, char **start, off_t offset, int size, int *eof, void *data) { // char buffer[8000]; @@ -1052,7 +1052,7 @@ return len; } -ssize_t proc_write(struct file *file, const char *buffer, +int proc_write(struct file *file, const char *buffer, unsigned long count, void *data) { GENERIC_CARD *card = data; |
|
From: <gat...@li...> - 2005-04-04 12:30:08
|
Update of /cvsroot/gatos/km In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23038 Modified Files: mach64.c rage128.c Log Message: Add missing return value for mach64 IRQ handler. Cleanups. Index: mach64.c =================================================================== RCS file: /cvsroot/gatos/km/mach64.c,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- mach64.c 14 Jan 2004 06:30:51 -0000 1.52 +++ mach64.c 4 Apr 2005 12:29:59 -0000 1.53 @@ -132,7 +132,6 @@ static void mach64_start_request_transfer(KM_TRANSFER_REQUEST *kmtr) { -long status; KM_STRUCT *kms=kmtr->user_data; mach64_wait_for_idle(kms); wmb(); @@ -172,7 +171,7 @@ irqreturn_t mach64_km_irq(int irq, void *dev_id, struct pt_regs *regs) { KM_STRUCT *kms; -long status, status_cap, mask; +long status; int count; kms=dev_id; @@ -193,7 +192,7 @@ } status=readl(kms->reg_aperture+MACH64_CRTC_INT_CNTL); - KM_DEBUG("CRTC_INT_CNTL=0x%08x\n", status); + KM_DEBUG("CRTC_INT_CNTL=0x%08lx\n", status); writel(ACK_INTERRUPT(status, status & (MACH64_CAPBUF0_INT_ACK| MACH64_CAPBUF1_INT_ACK| MACH64_BUSMASTER_INT_ACK)), kms->reg_aperture+MACH64_CRTC_INT_CNTL); @@ -211,7 +210,8 @@ mach64_wait_for_idle(kms); acknowledge_dma(kms); } - if(!(status & (MACH64_CAPBUF0_INT_ACK|MACH64_CAPBUF1_INT_ACK|MACH64_BUSMASTER_INT_ACK)))return; + if(!(status & (MACH64_CAPBUF0_INT_ACK|MACH64_CAPBUF1_INT_ACK|MACH64_BUSMASTER_INT_ACK))) + return IRQ_NONE; } return IRQ_HANDLED; } Index: rage128.c =================================================================== RCS file: /cvsroot/gatos/km/rage128.c,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- rage128.c 14 Jan 2004 06:30:51 -0000 1.43 +++ rage128.c 4 Apr 2005 12:29:59 -0000 1.44 @@ -142,7 +142,6 @@ static void rage128_start_request_transfer(KM_TRANSFER_REQUEST *kmtr) { -long status; KM_STRUCT *kms=kmtr->user_data; rage128_wait_for_idle(kms); wmb(); |
|
From: <gat...@li...> - 2005-04-01 02:59:11
|
Update of /cvsroot/gatos/v4l2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17478 Modified Files: generic.c Log Message: adds some space between the buffers so they dont overlap on rage 128 cards Index: generic.c =================================================================== RCS file: /cvsroot/gatos/v4l2/generic.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- generic.c 15 Mar 2005 21:27:39 -0000 1.8 +++ generic.c 1 Apr 2005 02:59:01 -0000 1.9 @@ -2693,7 +2693,7 @@ /* make room for odd frame + vbi frame + even frame */ card->buffer0 = 1024*card->videoram - bufsize - 8000; - card->buffer1 = card->buffer0 - bufsize; + card->buffer1 = card->buffer0 - bufsize - 8000; card->vbibuffer = card->buffer1 - 32768; /* allocate space for two frames of max size eg 640*480*2) */ |
|
From: <gat...@li...> - 2005-03-31 19:40:20
|
Update of /cvsroot/gatos/km In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24375 Modified Files: km_v4l.c Log Message: Add ability to handle VBI capture on PAL and SECAM standards. The capture has to be supported by the X driver also. Currently only the X.Org CVS does offer such support for PAL. Index: km_v4l.c =================================================================== RCS file: /cvsroot/gatos/km/km_v4l.c,v retrieving revision 1.54 retrieving revision 1.55 diff -u -d -r1.54 -r1.55 --- km_v4l.c 17 Dec 2004 10:01:14 -0000 1.54 +++ km_v4l.c 31 Mar 2005 19:40:11 -0000 1.55 @@ -324,16 +324,35 @@ case VIDIOCGVBIFMT: { struct vbi_format vbi_f; - vbi_f.sampling_rate=28636363; + struct video_window vwin; + + spin_lock(&(kms->kms_lock)); + if(kms->get_window_parameters==NULL) { + spin_unlock(&(kms->kms_lock)); + return -EINVAL; + } + kms->get_window_parameters(kms, &(vwin)); + spin_unlock(&(kms->kms_lock)); + vbi_f.samples_per_line=kms->vbi_width; vbi_f.sample_format=VIDEO_PALETTE_RAW; - vbi_f.start[0]=kms->vbi_start; - vbi_f.start[1]=kms->vbi_start; - vbi_f.start[0]=10; - vbi_f.start[1]=272; vbi_f.count[0]=kms->vbi_height; vbi_f.count[1]=kms->vbi_height; vbi_f.flags=0; + switch(vwin.width) { + case 640: /* NTSC */ + vbi_f.sampling_rate=28636363; + vbi_f.start[0]=10; + vbi_f.start[1]=272; + break; + case 720: /* PAL, SECAM */ + default: + vbi_f.sampling_rate=35468950; + vbi_f.start[0]=7; + vbi_f.start[1]=319; + break; + } + if(copy_to_user(arg,&vbi_f,sizeof(vbi_f))) return -EFAULT; return 0; |
|
From: <gat...@li...> - 2005-03-19 10:40:22
|
Update of /cvsroot/gatos/km In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21324 Modified Files: km.c Log Message: an extraneous spin_unlock() was causing random lock-ups Index: km.c =================================================================== RCS file: /cvsroot/gatos/km/km.c,v retrieving revision 1.105 retrieving revision 1.106 diff -u -d -r1.105 -r1.106 --- km.c 16 Mar 2005 07:27:35 -0000 1.105 +++ km.c 19 Mar 2005 10:40:12 -0000 1.106 @@ -253,7 +253,6 @@ wmb(); if(km_fire_transfer_request(kmtq)){ request=&(kmtq->request[kmtq->first]); - spin_unlock(&(kmtq->lock)); request->start_transfer(request); return; } |
|
From: <gat...@li...> - 2005-03-16 07:27:47
|
Update of /cvsroot/gatos/km In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30285 Modified Files: km.c Log Message: Initialize DEVICE_ID correctly when kernel is compiled without CONFIG_PCI_NAMES. Failure to initialize it caused for example avview to crash at launch. Index: km.c =================================================================== RCS file: /cvsroot/gatos/km/km.c,v retrieving revision 1.104 retrieving revision 1.105 diff -u -d -r1.104 -r1.105 --- km.c 12 Mar 2005 13:55:00 -0000 1.104 +++ km.c 16 Mar 2005 07:27:35 -0000 1.105 @@ -725,7 +725,8 @@ FIELD("DEVICE_ID").data.c.string=kmalloc(strlen(dev->pretty_name)+1, GFP_KERNEL); memcpy(FIELD("DEVICE_ID").data.c.string, dev->pretty_name, strlen(dev->pretty_name)+1); #else - FIELD("DEVICE_ID").data.c.string=0; + FIELD("DEVICE_ID").data.c.string=kmalloc(strlen(dev->slot_name)+1, GFP_KERNEL); + memcpy(FIELD("DEVICE_ID").data.c.string, dev->slot_name, strlen(dev->slot_name)+1); #endif #else FIELD("DEVICE_ID").data.c.string=kmalloc(strlen(dev->name)+1, GFP_KERNEL); |
|
From: <gat...@li...> - 2005-03-15 21:27:50
|
Update of /cvsroot/gatos/v4l2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29656 Modified Files: generic.c rage128.c Log Message: Fixes a problem with capturing images after changing the resolution or channel Index: generic.c =================================================================== RCS file: /cvsroot/gatos/v4l2/generic.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- generic.c 12 Mar 2005 17:44:00 -0000 1.7 +++ generic.c 15 Mar 2005 21:27:39 -0000 1.8 @@ -681,6 +681,11 @@ /* lock the card */ down_interruptible(&card->lock); + /* clear any existing buffers */ + card->status &= ~(STATUS_DMABUF_READY | STATUS_BUF0_READY | STATUS_BUF1_READY); + /* reset field count */ + card->field_count = 0; + if (card->driver_data & RAGE128CHIP) { rage128_enable_capture(card); } else { @@ -941,7 +946,7 @@ GENERIC_FH *fh = file->private_data; GENERIC_CARD *card = fh->card; - dprintk(2,"card(%d) Poll called\n",card->cardnum); + dprintk(3,"card(%d) Poll called\n",card->cardnum); poll_wait(file,&generic_wait,wait); if (card->status & STATUS_POLL_READY){ @@ -2050,7 +2055,7 @@ case VIDIOC_QBUF: { struct v4l2_buffer *b = arg; -dprintk(2,"card(%d) VIDIOC_QBUF called\n",card->cardnum); +dprintk(3,"card(%d) VIDIOC_QBUF called\n",card->cardnum); if (b->type != V4L2_BUF_TYPE_VIDEO_CAPTURE){ return -EINVAL; } @@ -2065,7 +2070,7 @@ { struct v4l2_buffer *b = arg; -dprintk(2,"card(%d) VIDIOC_DQBUF called\n",card->cardnum); +dprintk(3,"card(%d) VIDIOC_DQBUF called\n",card->cardnum); if (b->type != V4L2_BUF_TYPE_VIDEO_CAPTURE){ return -EINVAL; } @@ -2904,12 +2909,21 @@ if (status & 1){ handled = 1; card->field_count++; - card->status |= STATUS_BUF0_READY | STATUS_POLL_READY; + + /* since we are telling it to transfer the last frame captured + * (even if this one is odd and odd if this one is even) + * Then wait till we have another frame, or anytime + * we change channels or capture size it will look funny */ + if (card->field_count > 2) { + card->status |= STATUS_BUF1_READY | STATUS_POLL_READY; + } } if (status & 2){ handled = 1; card->field_count++; - card->status |= STATUS_BUF1_READY | STATUS_POLL_READY; + if (card->field_count > 2) { + card->status |= STATUS_BUF0_READY | STATUS_POLL_READY; + } } //Acknowledge that we saw the interrupt R128_CAP_INT_STATUS = status & mask; Index: rage128.c =================================================================== RCS file: /cvsroot/gatos/v4l2/rage128.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- rage128.c 12 Mar 2005 17:44:00 -0000 1.3 +++ rage128.c 15 Mar 2005 21:27:40 -0000 1.4 @@ -176,18 +176,20 @@ /* if interlaced then pitch is cardwidth * 4 to skip every other line cap buf0 even offset is the offset of even frames so the offset should be 0 if not interlaced? */ -R128_CAP0_BUF0_OFFSET = card->buffer0; -R128_CAP0_BUF1_OFFSET = card->buffer1; if (disableinterlace || card->height <= generic_tvnorms[card->tvnorm].sheight / 2){ - R128_CAP0_BUF_PITCH = 2*card->width; + R128_CAP0_BUF0_OFFSET = card->buffer0; + R128_CAP0_BUF1_OFFSET = card->buffer0; R128_CAP0_BUF0_EVEN_OFFSET = card->buffer1; - R128_CAP0_BUF1_EVEN_OFFSET = card->buffer0; + R128_CAP0_BUF1_EVEN_OFFSET = card->buffer1; + R128_CAP0_BUF_PITCH = 2*card->width; } else { + R128_CAP0_BUF0_OFFSET = card->buffer0; + R128_CAP0_BUF1_OFFSET = card->buffer1; + R128_CAP0_BUF0_EVEN_OFFSET = card->buffer1 + 2*card->width; + R128_CAP0_BUF1_EVEN_OFFSET = card->buffer0 + 2*card->width; R128_CAP0_BUF_PITCH = 2*2*card->width; - R128_CAP0_BUF0_EVEN_OFFSET = card->buffer0 + 2*card->width; - R128_CAP0_BUF1_EVEN_OFFSET = card->buffer1 + 2*card->width; } //R128_CAP0_ONESHOT_BUF_OFFSET = card->buffer0; @@ -271,9 +273,11 @@ | R128_CAP0_CONFIG_START_FIELD_EVEN | R128_CAP0_CONFIG_START_BUF_GET | R128_CAP0_CONFIG_BUF_TYPE_ALT // alternates between buf0 and buf1 -//| R128_CAP0_CONFIG_BUF_TYPE_FRAME +| R128_CAP0_CONFIG_BUF_TYPE_FRAME | R128_CAP0_CONFIG_BUF_MODE_DOUBLE | R128_CAP0_CONFIG_VBI_EN //vertical blank interrupt +| R128_CAP0_CONFIG_ODD_ONE_MORE_LINE +| R128_CAP0_CONFIG_HORZ_DECIMATOR | R128_CAP0_CONFIG_VIDEO_IN_VYUY422); } else { // 0x60 is interlace 0x40 is not @@ -289,6 +293,9 @@ | R128_CAP0_CONFIG_BUF_TYPE_FRAME | R128_CAP0_CONFIG_BUF_MODE_DOUBLE | R128_CAP0_CONFIG_VBI_EN //vertical blank interrupt +//| R128_CAP0_CONFIG_EVEN_ONE_MORE_LINE +//| R128_CAP0_CONFIG_ODD_ONE_MORE_LINE +| R128_CAP0_CONFIG_HORZ_DECIMATOR | R128_CAP0_CONFIG_VIDEO_IN_VYUY422); } |
|
From: <gat...@li...> - 2005-03-12 17:44:10
|
Update of /cvsroot/gatos/v4l2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20442 Modified Files: board.c generic.c rage128.c rage128.h Log Message: fixes a bug with rage128 cards (kept switching the audio mux back to input from tuner) removes some debugging messages Index: board.c =================================================================== RCS file: /cvsroot/gatos/v4l2/board.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- board.c 9 Mar 2005 20:34:42 -0000 1.1 +++ board.c 12 Mar 2005 17:44:00 -0000 1.2 @@ -220,9 +220,9 @@ if (card->driver_data & RAGE128CHIP){ if (card->mux == 2) { - BTWRITE(card,0x3f,1); //set to tv for audio + BTWRITE(card,BT829_P_IO,1); //set to tv for audio } else { - BTWRITE(card,0x3f,0); //set to input for audio + BTWRITE(card,BT829_P_IO,0); //set to input for audio } } else if (card->driver_data & MACH64CHIP){ u32 tmp; Index: generic.c =================================================================== RCS file: /cvsroot/gatos/v4l2/generic.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- generic.c 9 Mar 2005 20:34:42 -0000 1.6 +++ generic.c 12 Mar 2005 17:44:00 -0000 1.7 @@ -689,6 +689,7 @@ /* set CAGC and CKILL (chroma agc and low color detector) */ temp = BTREAD(card,BT829_SCLOOP); + //temp |= BT829_CKILL | BT829_CAGC | BT829_PEAK; temp |= BT829_CKILL | BT829_CAGC; /* When decoding SECAM video this filter must be enabled */ @@ -701,7 +702,10 @@ /* break this into flags or remove since it is default? */ BTWRITE(card,BT829_WC_UP,0xCF); BTWRITE(card,BT829_WC_DN,0x7F); - BTWRITE(card,BT829_P_IO,0x0); + +// if (card->driver_data & MACH64CHIP){ +// BTWRITE(card,BT829_P_IO,0x0); +// } /* free the card */ up(&card->lock); @@ -2054,7 +2058,6 @@ return -EINVAL; } add_frame_to_queue(&card->frame_queue,b->index); - return 0; } /* Exchange a buffer with the driver (dequeue)*/ @@ -2516,12 +2519,14 @@ if (card->driver_data & RAGE128CHIP) { /* force the rage128 to let us read the bios... not sure why this works but it does (found by trial and error) */ - if (*(biosptr) == 0x0) { + if (*(biosptr) == 0x0 || *(biosptr) == 0xFF) { printk (KERN_INFO "ERROR reading from bios, attempting to fix!\n"); R128_I2C_CNTL_1 = 0x0; iounmap(card->atifb); card->atifb=ioremap(pci_resource_start(dev, 0),pci_resource_len(dev, 0)); - } + } else { +printk (KERN_INFO "reading from bios, worked! %d \n", *(biosptr)); + } } /* now read in some values from the rom */ if (card->driver_data & MACH64CHIP){ @@ -2545,6 +2550,7 @@ ptr = biosptr + *((u16*)ptr) + 0x0E; /* before using divide by 100!!!! */ card->refclock = *((u16*)ptr); +printk (KERN_INFO "refclock is %d\n", refclock); } /* now unmap the rom so we dont waste ram */ @@ -2893,7 +2899,7 @@ /* check if we have any frame captures ready */ status = R128_CAP_INT_STATUS; mask = R128_CAP_INT_CNTL; -printk (KERN_INFO "Cap Status is 0x%08x mask is 0x%08x\n", status, mask); +//printk (KERN_INFO "Cap Status is 0x%08x mask is 0x%08x\n", status, mask); if (status & 1){ handled = 1; @@ -2912,7 +2918,7 @@ status = R128_GEN_INT_STATUS; mask = R128_GEN_INT_CNTL; -printk (KERN_INFO "Gen Status is 0x%08x mask is 0x%08x\n", status, mask); +//printk (KERN_INFO "Gen Status is 0x%08x mask is 0x%08x\n", status, mask); /* check if dma transfer finished */ if (status & (1<<16)) { Index: rage128.h =================================================================== RCS file: /cvsroot/gatos/v4l2/rage128.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- rage128.h 9 Mar 2005 20:34:42 -0000 1.2 +++ rage128.h 12 Mar 2005 17:44:00 -0000 1.3 @@ -21,7 +21,9 @@ #define R128_CLOCK_FREQ 80000 /* 7.5kHz .. 100kHz */ +#define R128_CLOCK_CNTL_INDEX (*((u32*)(card->MMR+0x0008))) #define R128_CLOCK_CNTL_INDEX0 (*(( u8*)(card->MMR+0x0008))) +#define R128_CLOCK_CNTL_INDEX1 (*(( u8*)(card->MMR+0x0009))) #define R128_CLOCK_CNTL_DATA (*((u32*)(card->MMR+0x000C))) #define FCP_CNTL 0x012 #define R128_PLL_WR_EN (1 << 7) Index: rage128.c =================================================================== RCS file: /cvsroot/gatos/v4l2/rage128.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- rage128.c 9 Mar 2005 20:34:42 -0000 1.2 +++ rage128.c 12 Mar 2005 17:44:00 -0000 1.3 @@ -41,7 +41,7 @@ printk (KERN_INFO "Error initializing r128 card\n"); return -ENODEV; } - printk (KERN_INFO "device id 0x%08x revision %d\n",id, rev); + printk (KERN_INFO "Rage128 device id 0x%08x revision %d\n",id, rev); /* figure out what i2c mode to use */ if (i2c_init(card) != 0){ @@ -206,7 +206,7 @@ /* enable streaming (turn on interrupts) */ R128_CLOCK_CNTL_INDEX0 = (FCP_CNTL & 0x1F) | R128_PLL_WR_EN; - R128_CLOCK_CNTL_DATA = 0x001; // was 101 + R128_CLOCK_CNTL_DATA = 0x101; // was 101 R128_CLOCK_CNTL_INDEX0 = (FCP_CNTL & 0x1F) & ~R128_PLL_WR_EN; BTWRITE(card,BT829_VACTIVE_LO,LO(generic_tvnorms[card->tvnorm].sheight)); @@ -322,9 +322,7 @@ R128_CLOCK_CNTL_DATA = 0x404; R128_CLOCK_CNTL_INDEX0 = (FCP_CNTL & 0x1F) & ~R128_PLL_WR_EN; -printk (KERN_INFO "dis R128_CAP0_TRIG_CNTL is 0x%08x\n", R128_CAP0_TRIG_CNTL); R128_CAP0_TRIG_CNTL = 0x00000000; -printk (KERN_INFO "dis R128_CAP0_TRIG_CNTL is now 0x%08x\n", R128_CAP0_TRIG_CNTL); //make sure DMA transfers have stopped R128_BUS_CNTL |= R128_BUS_MASTER_RESET; } |
|
From: <gat...@li...> - 2005-03-12 13:55:10
|
Update of /cvsroot/gatos/km In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25219 Modified Files: km.c Log Message: pci_enable_device must be called before getting irq, otherwise km may end up using wrong irq! Index: km.c =================================================================== RCS file: /cvsroot/gatos/km/km.c,v retrieving revision 1.103 retrieving revision 1.104 diff -u -d -r1.103 -r1.104 --- km.c 9 Mar 2005 08:40:32 -0000 1.103 +++ km.c 12 Mar 2005 13:55:00 -0000 1.104 @@ -611,6 +611,8 @@ kms=&(km_devices[num_devices]); memset(kms, 0, sizeof(KM_STRUCT)); + if (pci_enable_device(dev)) + return -EIO; kms->dev=dev; kms->irq=dev->irq; kms->gui_dma_queue.request=kms->gui_dma_request; @@ -631,8 +633,6 @@ kms->vbi.info_du=-1; spin_lock_init(&(kms->kms_lock)); printk(KERN_DEBUG "km: using irq %ld\n", kms->irq); - if (pci_enable_device(dev)) - return -EIO; printk(KERN_DEBUG "Register aperture is 0x%08lx 0x%08lx\n", pci_resource_start(dev, 2), pci_resource_len(dev, 2)); /* if (!request_mem_region(pci_resource_start(dev,2), |
|
From: <gat...@li...> - 2005-03-09 20:34:53
|
Update of /cvsroot/gatos/v4l2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32089 Modified Files: Makefile_2.4 Makefile_2.6 bt829.c generic.c i2c.c mach64.c mach64.h memory.c rage128.c rage128.h Added Files: board.c board.h Removed Files: tda9850.h Log Message: Adds support for rage128 cards. Major problem: capturing corrupts overlay (restarting X fixes it) No idea why its getting corrupted Eric Index: generic.c =================================================================== RCS file: /cvsroot/gatos/v4l2/generic.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- generic.c 17 Feb 2005 17:33:39 -0000 1.5 +++ generic.c 9 Mar 2005 20:34:42 -0000 1.6 @@ -37,6 +37,7 @@ #include "generic.h" #include "i2c.h" #include "bt829.h" +#include "board.h" #include "mach64.h" #include "rage128.h" #include "memory.h" @@ -681,7 +682,7 @@ down_interruptible(&card->lock); if (card->driver_data & RAGE128CHIP) { -printk (KERN_INFO "Rage128 enable capture\n"); + rage128_enable_capture(card); } else { mach64_enable_capture(card); } @@ -722,14 +723,14 @@ if (fh->resources & STATUS_CAPTURING){ generic_disable_capture(card); } -printk (KERN_INFO "Release video called\n"); +dprintk (1, "Release video called\n"); break; case V4L2_BUF_TYPE_VBI_CAPTURE: /* stop vbi capture here */ if (fh->resources & STATUS_VBI_CAPTURE){ generic_disable_vbi(card); } -printk (KERN_INFO "Release vbi called\n"); +dprintk (1, "Release vbi called\n"); break; default: BUG(); @@ -969,7 +970,7 @@ #define DUMP_BT_REG(REG) \ len += sprintf (buffer+len,"%-20s (0x%02X) = 0x%02X\n",#REG,REG, BTREAD(card,REG)) -#define DUMP_M64_REG(REG) \ +#define DUMP_BOARD_REG(REG) \ len += sprintf (buffer+len,"%-20s = 0x%02X\n",#REG,REG) /* should do one for each card? is it possible to do generic func? */ @@ -1016,9 +1017,16 @@ DUMP_BT_REG(BT829_CC_DATA); DUMP_BT_REG(BT829_WC_DN); DUMP_BT_REG(BT829_P_IO); - DUMP_M64_REG(MACH64_CAPTURE_BUF0_OFFSET); - DUMP_M64_REG(MACH64_CAPTURE_BUF1_OFFSET); - DUMP_M64_REG(MACH64_ONESHOT_BUF_OFFSET); + if (card->driver_data & MACH64CHIP){ + DUMP_BOARD_REG(MACH64_CAPTURE_BUF0_OFFSET); + DUMP_BOARD_REG(MACH64_CAPTURE_BUF1_OFFSET); + DUMP_BOARD_REG(MACH64_ONESHOT_BUF_OFFSET); + } else { + DUMP_BOARD_REG(R128_CAP0_BUF0_OFFSET); + DUMP_BOARD_REG(R128_CAP0_BUF1_OFFSET); + DUMP_BOARD_REG(R128_CAP0_ONESHOT_BUF_OFFSET); + DUMP_BOARD_REG(R128_CAP0_CONFIG); + } // up(&card->lock); // up(&card->lockcap); @@ -1050,11 +1058,12 @@ inbuf[count] = '\0'; printk(KERN_INFO "card(%d) Write called you sent [%s]\n",card->cardnum, inbuf); - if (debug) { +/* if (debug) { debug = 0; } else { debug = 3; - } + } */ + return count; } @@ -1345,7 +1354,7 @@ printk (KERN_INFO "STALLED!!!!! aborting framegrab\n"); up(&card->lockcap); return; - } + } // there are two dma tables, one for buf0 one for buf1 // they are rebuilt when the capture size changes @@ -1370,7 +1379,11 @@ if (!disabledma) { down_interruptible(&card->lock); // pass the dma_table to the card - MACH64_BM_SYSTEM_TABLE = virt_to_bus(ptr) | FRAME_BUFFER_TO_SYSTEM; + if (card->driver_data & RAGE128CHIP) { + R128_BM_VIDCAP_BUF0 = virt_to_bus(ptr) | R128_SYSTEM_TRIGGER_VIDEO_TO_SYSTEM; + } else if (card->driver_data & MACH64CHIP){ + MACH64_BM_SYSTEM_TABLE = virt_to_bus(ptr) | FRAME_BUFFER_TO_SYSTEM; + } //wait for dma to finish /* this should transfer the vbi information as well */ @@ -1408,8 +1421,14 @@ // odd vbi is 0 even is 1; whichfield = BTREAD(card,BT829_DSTATUS) & BT829_DSTATUS_FIELD; if (!disabledma) { - MACH64_BM_SYSTEM_TABLE = virt_to_bus(card->dma_table_vbi) | + if (card->driver_data & RAGE128CHIP) { + R128_BM_VIDCAP_BUF0 = virt_to_bus(card->dma_table_vbi) | + R128_SYSTEM_TRIGGER_SYSTEM_TO_VIDEO; + } else if (card->driver_data & MACH64CHIP){ + MACH64_BM_SYSTEM_TABLE = virt_to_bus(card->dma_table_vbi) | FRAME_BUFFER_TO_SYSTEM; + } + wait_event_interruptible(generic_wait, (card->status & STATUS_DMABUF_READY)); card->status &= ~STATUS_DMABUF_READY; } @@ -2441,14 +2460,14 @@ /* keep going it still might work! */ } - /* request end memory region 720x480x2 and 2 frames (so x2) */ + /* request end memory region 720x480x2 and 2 frames (so x2) if (!request_mem_region(pci_resource_start(dev,0) + pci_resource_len(dev,0) - 1382400, 1382400, tag)) { printk(KERN_WARNING "genericv4l(%d): can't lock video memory.\n", num_cards_detected); - /* keep going it still might work! */ - } + keep going it still might work! + } */ /* enable bus mastering for this card */ pci_set_master(dev); @@ -2494,7 +2513,16 @@ pci_write_config_dword(dev, PCI_ROM_ADDRESS, val); biosptr=ioremap(romaddr,pci_resource_len(dev, PCI_ROM_RESOURCE)); - + if (card->driver_data & RAGE128CHIP) { + /* force the rage128 to let us read the bios... + not sure why this works but it does (found by trial and error) */ + if (*(biosptr) == 0x0) { + printk (KERN_INFO "ERROR reading from bios, attempting to fix!\n"); + R128_I2C_CNTL_1 = 0x0; + iounmap(card->atifb); + card->atifb=ioremap(pci_resource_start(dev, 0),pci_resource_len(dev, 0)); + } + } /* now read in some values from the rom */ if (card->driver_data & MACH64CHIP){ ptr = biosptr + 0x48; @@ -2510,8 +2538,9 @@ romtable = biosptr + *((u16*)ptr); ptr = romtable + 0x38; ptr = biosptr + *((u16*)ptr); - if (ptr != biosptr) + if (ptr != biosptr) { memcpy(card->r128mminfo,ptr,12) ; + } ptr = romtable + 0x30; ptr = biosptr + *((u16*)ptr) + 0x0E; /* before using divide by 100!!!! */ @@ -2567,14 +2596,19 @@ /*setup a video4linux device for this card */ register_video4linux(card); - card->saved_crtc_cntl = MACH64_CRTC_INT_CNTL; - card->saved_bus_cntl = MACH64_BUS_CNTL; + if (card->driver_data & MACH64CHIP){ + card->saved_crtc_cntl = MACH64_CRTC_INT_CNTL; + card->saved_bus_cntl = MACH64_BUS_CNTL; - // enable bus mastering. - MACH64_BUS_CNTL = (card->saved_bus_cntl | MACH64_BUS_APER_REG_DIS | + // enable bus mastering. + MACH64_BUS_CNTL = (card->saved_bus_cntl | MACH64_BUS_APER_REG_DIS | MACH64_BUS_MSTR_RESET | MACH64_BUS_FLUSH_BUF | MACH64_BUS_PCI_DAC_DLY | MACH64_BUS_RD_DISCARD_EN | MACH64_BUS_RD_ABORT_EN) & ~MACH64_BUS_MASTER_DIS; + } else if (card->driver_data & RAGE128CHIP){ + //enable bus mastering for r128? + + } //allocate space for dma_tables (*150 holds enough for 640*480*2) //should check cards max capture and set max size to that? @@ -2694,14 +2728,17 @@ } //set location of capture buffers - MACH64_CAPTURE_BUF0_OFFSET = card->buffer0; - MACH64_CAPTURE_BUF1_OFFSET = card->buffer1; - MACH64_ONESHOT_BUF_OFFSET = card->vbibuffer; /* set it to store to vbibuffer*/ - - //make sure video format is yuyv - flags = MACH64_VIDEO_FORMAT; - flags &= ~MACH64_VIDEO_IN; //clear video_in - MACH64_VIDEO_FORMAT = flags | MACH64_VIDEO_VYUY422; + if (card->driver_data & MACH64CHIP){ + MACH64_CAPTURE_BUF0_OFFSET = card->buffer0; + MACH64_CAPTURE_BUF1_OFFSET = card->buffer1; + MACH64_ONESHOT_BUF_OFFSET = card->vbibuffer; /* set it to store to vbibuffer*/ + //make sure video format is yuyv + flags = MACH64_VIDEO_FORMAT; + flags &= ~MACH64_VIDEO_IN; //clear video_in + MACH64_VIDEO_FORMAT = flags | MACH64_VIDEO_VYUY422; + } else { + // set locations for r128 card here? + } if (!disabledma) { // build dma tables (dma table, from_addr, to_addr, bufsize) @@ -2815,46 +2852,83 @@ #endif { GENERIC_CARD *card = (GENERIC_CARD *)dev_id; - unsigned int flags; + int handled = 0; + + if (card->driver_data & MACH64CHIP){ + unsigned int flags; + flags = MACH64_CRTC_INT_CNTL; + if (flags & MACH64_BUSMASTER_INT_ACK){ + dprintk(3,"card(%d) busmaster interrupt\n",card->cardnum); + //Acknowledge that we saw the interrupt + MACH64_CRTC_INT_CNTL = flags | MACH64_BUSMASTER_INT_ACK; + card->status |= STATUS_DMABUF_READY; + handled = 1; + } + if (flags & MACH64_CAPBUF0_INT_ACK){ + dprintk(3,"card(%d) buf0 interrupt\n",card->cardnum); + //Acknowledge that we saw the interrupt + MACH64_CRTC_INT_CNTL = flags | MACH64_CAPBUF0_INT_ACK; + card->field_count++; + card->status |= STATUS_BUF0_READY | STATUS_POLL_READY; + handled = 1; + } + if (flags & MACH64_CAPBUF1_INT_ACK){ + dprintk(3,"card(%d) buf1 interrupt\n",card->cardnum); + //Acknowledge that we saw the interrupt + MACH64_CRTC_INT_CNTL = flags | MACH64_CAPBUF1_INT_ACK; + card->field_count++; + card->status |= STATUS_BUF1_READY | STATUS_POLL_READY; + handled = 1; + } + if (flags & MACH64_CAPONESHOT_INT_ACK){ + dprintk(3,"card(%d) oneshot interrupt\n",card->cardnum); + //Acknowledge that we saw the interrupt + MACH64_CRTC_INT_CNTL = flags | MACH64_CAPONESHOT_INT_ACK; + card->status |= STATUS_VBI_READY | STATUS_POLL_READY; + handled = 1; + } + } else if (card->driver_data & RAGE128CHIP){ + unsigned int status, mask; - flags = MACH64_CRTC_INT_CNTL; - if (flags & MACH64_BUSMASTER_INT_ACK){ - dprintk(3,"card(%d) busmaster interrupt\n",card->cardnum); - //Acknowledge that we saw the interrupt - MACH64_CRTC_INT_CNTL = flags | MACH64_BUSMASTER_INT_ACK; - card->status |= STATUS_DMABUF_READY; - } - if (flags & MACH64_CAPBUF0_INT_ACK){ - dprintk(3,"card(%d) buf0 interrupt\n",card->cardnum); - //Acknowledge that we saw the interrupt - MACH64_CRTC_INT_CNTL = flags | MACH64_CAPBUF0_INT_ACK; - card->field_count++; -// if (!(card->status & STATUS_BUF0_READY)){ + /* check if we have any frame captures ready */ + status = R128_CAP_INT_STATUS; + mask = R128_CAP_INT_CNTL; +printk (KERN_INFO "Cap Status is 0x%08x mask is 0x%08x\n", status, mask); + + if (status & 1){ + handled = 1; + card->field_count++; card->status |= STATUS_BUF0_READY | STATUS_POLL_READY; -// } - } - if (flags & MACH64_CAPBUF1_INT_ACK){ - dprintk(3,"card(%d) buf1 interrupt\n",card->cardnum); - //Acknowledge that we saw the interrupt - MACH64_CRTC_INT_CNTL = flags | MACH64_CAPBUF1_INT_ACK; - card->field_count++; -// if (!(card->status & STATUS_BUF1_READY)){ + } + if (status & 2){ + handled = 1; + card->field_count++; card->status |= STATUS_BUF1_READY | STATUS_POLL_READY; -// } - } - if (flags & MACH64_CAPONESHOT_INT_ACK){ - dprintk(3,"card(%d) oneshot interrupt\n",card->cardnum); + } //Acknowledge that we saw the interrupt - MACH64_CRTC_INT_CNTL = flags | MACH64_CAPONESHOT_INT_ACK; -// if (!(card->status & STATUS_VBI_READY)){ - card->status |= STATUS_VBI_READY | STATUS_POLL_READY; -// } + R128_CAP_INT_STATUS = status & mask; + + /* check for dma interrupt now */ + status = R128_GEN_INT_STATUS; + mask = R128_GEN_INT_CNTL; + +printk (KERN_INFO "Gen Status is 0x%08x mask is 0x%08x\n", status, mask); + + /* check if dma transfer finished */ + if (status & (1<<16)) { + card->status |= STATUS_DMABUF_READY; + handled=1; + } + //Acknowledge that we saw the interrupt + R128_GEN_INT_STATUS = status & mask; } - tasklet_schedule(&generic_tasklet); + if (handled) { + tasklet_schedule(&generic_tasklet); + } #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) - return IRQ_HANDLED; + return IRQ_RETVAL(handled); #endif } @@ -2916,8 +2990,13 @@ printk("genericv4l(%d): unloading\n",card->cardnum); - //disable interrupts - MACH64_CRTC_INT_CNTL &= ~(MACH64_CAPBUF0_INT_EN|MACH64_CAPBUF1_INT_EN|MACH64_CAPONESHOT_INT_EN|MACH64_BUSMASTER_INT_EN); + if (card->driver_data & RAGE128CHIP) { + /* must set R128_I2C_CNTL_1 to 0 or we will not beable to read from rom next time we load the module */ + R128_I2C_CNTL_1 = 0x0; + } else if (card->driver_data & MACH64CHIP){ + //disable interrupts + MACH64_CRTC_INT_CNTL &= ~(MACH64_CAPBUF0_INT_EN|MACH64_CAPBUF1_INT_EN|MACH64_CAPONESHOT_INT_EN|MACH64_BUSMASTER_INT_EN); + } /* remove v4l devices */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) Index: rage128.h =================================================================== RCS file: /cvsroot/gatos/v4l2/rage128.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- rage128.h 11 Jan 2005 21:11:06 -0000 1.1.1.1 +++ rage128.h 9 Mar 2005 20:34:42 -0000 1.2 @@ -21,6 +21,38 @@ #define R128_CLOCK_FREQ 80000 /* 7.5kHz .. 100kHz */ +#define R128_CLOCK_CNTL_INDEX0 (*(( u8*)(card->MMR+0x0008))) +#define R128_CLOCK_CNTL_DATA (*((u32*)(card->MMR+0x000C))) +#define FCP_CNTL 0x012 +#define R128_PLL_WR_EN (1 << 7) + +#define R128_CAP0_BUF_PITCH (*((u32*)(card->MMR+0x0930))) +#define R128_CAP1_BUF_PITCH (*((u32*)(card->MMR+0x09A0))) +#define R128_CAP0_V_WINDOW (*((u32*)(card->MMR+0x0934))) +#define R128_CAP0_H_WINDOW (*((u32*)(card->MMR+0x0938))) +#define R128_CAP1_V_WINDOW (*((u32*)(card->MMR+0x09A4))) +#define R128_CAP1_H_WINDOW (*((u32*)(card->MMR+0x09A8))) +#define R128_CAP0_VBI_V_WINDOW (*((u32*)(card->MMR+0x0944))) +#define R128_CAP0_VBI_H_WINDOW (*((u32*)(card->MMR+0x0948))) +#define R128_CAP1_VBI_V_WINDOW (*((u32*)(card->MMR+0x09B4))) +#define R128_CAP1_VBI_H_WINDOW (*((u32*)(card->MMR+0x09B8))) +#define R128_CAP0_BUF0_OFFSET (*((u32*)(card->MMR+0x0920))) +#define R128_CAP0_BUF1_OFFSET (*((u32*)(card->MMR+0x0924))) +#define R128_CAP0_BUF0_EVEN_OFFSET (*((u32*)(card->MMR+0x0928))) +#define R128_CAP0_BUF1_EVEN_OFFSET (*((u32*)(card->MMR+0x092C))) +#define R128_CAP0_VBI_ODD_OFFSET (*((u32*)(card->MMR+0x093C))) +#define R128_CAP0_VBI_EVEN_OFFSET (*((u32*)(card->MMR+0x0940))) +#define R128_CAP1_VBI_ODD_OFFSET (*((u32*)(card->MMR+0x09AC))) +#define R128_CAP1_VBI_EVEN_OFFSET (*((u32*)(card->MMR+0x09B0))) +#define R128_CAP0_ONESHOT_BUF_OFFSET (*((u32*)(card->MMR+0x096C))) +#define R128_CAP1_ONESHOT_BUF_OFFSET (*((u32*)(card->MMR+0x09DC))) +#define R128_CAPTURE_PORT_MODE_CNTL (*((u32*)(card->MMR+0x094C))) +#define R128_CAP0_ANC_ODD_OFFSET (*((u32*)(card->MMR+0x095C))) +#define R128_CAP0_ANC_EVEN_OFFSET (*((u32*)(card->MMR+0x0960))) +#define R128_CAP1_ANC_ODD_OFFSET (*((u32*)(card->MMR+0x09CC))) +#define R128_CAP1_ANC_EVEN_OFFSET (*((u32*)(card->MMR+0x09D0))) + + #define R128_I2C_CNTL_0 (*((u32*)(card->MMR+0x0090))) #define R128_I2C_CNTL_0_0 (*(( u8*)(card->MMR+0x0090))) #define R128_I2C_CNTL_0_1 (*(( u8*)(card->MMR+0x0091))) @@ -33,9 +65,6 @@ #define R128_DEVICE_ID (*((u16*)(card->MMR+0x0F02))) #define R128_REVISION_ID (*(( u8*)(card->MMR+0x0F08))) -/* this matches up to CARD_ALL_IN_WONDER in mach64.h */ -#define CARD_RAGE128_AIW 2 - /* R128_I2C_CNTL_0 bits */ #define I2C_DONE 0x00000001 #define I2C_NACK 0x00000002 @@ -55,16 +84,81 @@ #define I2C_EN 0x00020000 #define R128_CAP0_TRIG_CNTL (*((u32*)(card->MMR+0x0950))) +#define R128_CAP1_TRIG_CNTL (*((u32*)(card->MMR+0x09C0))) #define R128_CAP0_TRIG_CNTL_TRIGGER_GET 0x00000003 #define R128_CAP0_TRIG_CNTL_TRIGGER_SET 0x00000001 #define R128_CAP0_TRIG_CNTL_CAPTURE_EN 0x00000010 #define R128_CAP0_TRIG_CNTL_VSYNC_GET 0x0000FF00 #define R128_CAP0_TRIG_CNTL_VSYNC_SET 0x00010000 +#define R128_BUS_CNTL (*((u32*)(card->MMR+0x0030))) +#define R128_BUS_MASTER_RESET (1 << 1) +#define R128_BUS_MASTER_DIS (1 << 6) +#define R128_BUS_RD_DISCARD_EN (1 << 24) +#define R128_BUS_RD_ABORT_EN (1 << 25) +#define R128_BUS_MSTR_DISCONNECT_EN (1 << 28) +#define R128_BUS_WRT_BURST (1 << 29) +#define R128_BUS_READ_BURST (1 << 30) + +#define R128_BM_VIDCAP_BUF0 (*((u32*)(card->MMR+0xA60))) +#define R128_BM_VIDCAP_BUF1 (*((u32*)(card->MMR+0xA64))) +#define R128_BM_VIDCAP_BUF2 (*((u32*)(card->MMR+0xA68))) + +#define R128_BM_CHUNK_0_VAL (*((u32*)(card->MMR+0xA18))) +#define R128_BM_PTR_FORCE_TO_PCI (1 << 21) +#define R128_BM_PM4_RD_FORCE_TO_PCI (1 << 22) +#define R128_BM_GLOBAL_FORCE_TO_PCI (1 << 23) + +#define RAGE128_BM_FORCE_TO_PCI 0x20000000 +#define R128_BM_CHUNK_1_VAL (*((u32*)(card->MMR+0xA1C))) + +#define R128_GEN_INT_STATUS (*((u32*)(card->MMR+0x44))) +#define R128_GEN_INT_CNTL (*((u32*)(card->MMR+0x40))) +#define R128_CAP_INT_CNTL (*((u32*)(card->MMR+0x908))) +#define R128_CAP_INT_STATUS (*((u32*)(card->MMR+0x90C))) +#define R128_CAP0_DEBUG (*((u32*)(card->MMR+0x0954))) + + +#define R128_CAP0_CONFIG (*((u32*)(card->MMR+0x0958))) +#define R128_CAP1_CONFIG (*((u32*)(card->MMR+0x09C8))) +#define R128_CAP0_CONFIG_CONTINUOS 0x00000001 +#define R128_CAP0_CONFIG_START_FIELD_EVEN 0x00000002 +#define R128_CAP0_CONFIG_START_BUF_GET 0x00000004 +#define R128_CAP0_CONFIG_START_BUF_SET 0x00000008 +#define R128_CAP0_CONFIG_BUF_TYPE_ALT 0x00000010 +#define R128_CAP0_CONFIG_BUF_TYPE_FRAME 0x00000020 +#define R128_CAP0_CONFIG_ONESHOT_MODE_FRAME 0x00000040 +#define R128_CAP0_CONFIG_BUF_MODE_DOUBLE 0x00000080 +#define R128_CAP0_CONFIG_BUF_MODE_TRIPLE 0x00000100 +#define R128_CAP0_CONFIG_MIRROR_EN 0x00000200 +#define R128_CAP0_CONFIG_ONESHOT_MIRROR_EN 0x00000400 +#define R128_CAP0_CONFIG_VIDEO_SIGNED_UV 0x00000800 +#define R128_CAP0_CONFIG_ANC_DECODE_EN 0x00001000 +#define R128_CAP0_CONFIG_VBI_EN 0x00002000 +#define R128_CAP0_CONFIG_SOFT_PULL_DOWN_EN 0x00004000 +#define R128_CAP0_CONFIG_VIP_EXTEND_FLAG_EN 0x00008000 +#define R128_CAP0_CONFIG_FAKE_FIELD_EN 0x00010000 +#define R128_CAP0_CONFIG_ODD_ONE_MORE_LINE 0x00020000 +#define R128_CAP0_CONFIG_EVEN_ONE_MORE_LINE 0x00040000 +#define R128_CAP0_CONFIG_HORZ_DIVIDE_2 0x00080000 +#define R128_CAP0_CONFIG_HORZ_DIVIDE_4 0x00100000 +#define R128_CAP0_CONFIG_VERT_DIVIDE_2 0x00200000 +#define R128_CAP0_CONFIG_VERT_DIVIDE_4 0x00400000 +#define R128_CAP0_CONFIG_FORMAT_BROOKTREE 0x00000000 +#define R128_CAP0_CONFIG_FORMAT_CCIR656 0x00800000 +#define R128_CAP0_CONFIG_FORMAT_ZV 0x01000000 +#define R128_CAP0_CONFIG_FORMAT_VIP 0x01800000 +#define R128_CAP0_CONFIG_FORMAT_TRANSPORT 0x02000000 +#define R128_CAP0_CONFIG_HORZ_DECIMATOR 0x04000000 +#define R128_CAP0_CONFIG_VIDEO_IN_YVYU422 0x00000000 +#define R128_CAP0_CONFIG_VIDEO_IN_VYUY422 0x20000000 + +#define R128_SYSTEM_TRIGGER_SYSTEM_TO_VIDEO 0x0 +#define R128_SYSTEM_TRIGGER_VIDEO_TO_SYSTEM 0x1 -#define R128_BUS_MSTR_RESET 0x00000002ul int r128_inita(GENERIC_CARD *card); +void rage128_enable_capture(GENERIC_CARD *card); void rage128_disable_capture(GENERIC_CARD *card); #endif Index: mach64.h =================================================================== RCS file: /cvsroot/gatos/v4l2/mach64.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- mach64.h 11 Jan 2005 21:11:06 -0000 1.1.1.1 +++ mach64.h 9 Mar 2005 20:34:42 -0000 1.2 @@ -19,12 +19,6 @@ #ifndef GENERIC_MACH64_HEADER #define GENERIC_MACH64_HEADER 1 -#define CAPTURE_MODE_SINGLE_ODD 0 -#define CAPTURE_MODE_SINGLE_EVEN 1 -#define CAPTURE_MODE_DOUBLE 2 -#define CAPTURE_MODE_INTERLACED 3 -#define CAPTURE_MODE_INTERLACED_INV 4 - #define MACH64_DMA_GUI_COMMAND__EOL 0x80000000 #define MACH64_CONFIG_CHIP_ID (*(card->MEM_0+0x38)) @@ -104,24 +98,7 @@ #define MACH64_BUSMASTER_INT_EN (1<<24) #define MACH64_BUSMASTER_INT_ACK (1<<25) -#define TDA8425 8425 -#define TDA9850 9850 -#define TDA9851 9851 -#define MSP3410 3410 - -#define CARD_STAND_ALONE 1 -#define CARD_ALL_IN_WONDER 2 -#define CARD_ALL_IN_WONDER_PRO 3 -#define CARD_ALL_IN_WONDER_128 4 -#define CARD_NEC 5 - -int board_setbyte(GENERIC_CARD *card); int m64_inita(GENERIC_CARD *card); -int fi12xx_tune(GENERIC_CARD *card); -int fi12xx_register(GENERIC_CARD *card,u8 addr, int use); -void set_mute(GENERIC_CARD *card, int value); -int board_setaudio(GENERIC_CARD *card); -u8 fi12xx_band(GENERIC_CARD *card, unsigned long freq); void mach64_enable_capture(GENERIC_CARD *card); void mach64_disable_capture(GENERIC_CARD *card); --- tda9850.h DELETED --- Index: mach64.c =================================================================== RCS file: /cvsroot/gatos/v4l2/mach64.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- mach64.c 17 Feb 2005 17:22:59 -0000 1.4 +++ mach64.c 9 Mar 2005 20:34:42 -0000 1.5 @@ -22,72 +22,14 @@ #define __NO_VERSION__ #include "generic.h" -#include "i2c.h" #include "bt829.h" #include "mach64.h" -#include "memory.h" -#include "tda9850.h" +#include "i2c.h" +#include "board.h" static const int videoRamSizes[] = {0, 256, 512, 1024, 2*1024, 4*1024, 6*1024, 8*1024, 12*1024, 16*1024, 0}; -struct tuner_types generic_tuners[] = { - { 0,1, NULL, NULL, NULL }, - { 1,1, "Philips", "FI1236", "NTSC M/N" }, - { 2,6, "Philips", "FI1236J", "NTSC Japan" }, - { 3,0, "Philips", "FI1216MK2", "PAL B/G" }, - { 4,0, "Philips", "FI1246", "PAL I" }, - { 5,0, "Philips", "FI1216MF", "PAL B/G, SECAM L/L'" }, - { 6,1, "Philips", "FI1236MK2", "NTSC M/N" }, - { 7,2, "Philips", "FI1256", "SECAM D/K" }, - { 8,1, "Samsung", "TCPN7082PC27A", "NTSC M/N" }, - { 9,0, "Philips", "FI1216MK2(EXT)", "PAL B/G" }, - { 10,0, "Philips", "FI1246MK2(EXT)", "PAL I" }, - { 11,0, "Philips", "FI1216MF(EXT)", "PAL B/G, SECAM L/L'" }, - { 12,1, "Philips", "FI1236MK2(EXT)", "NTSC M/N" }, - { 13,0, "Temic", "FN5AL", "PAL I/B/G/DK, SECAM DK" }, - { 14,1, NULL, NULL, NULL }, - { 15,1, NULL, NULL, NULL }, - { 16,1, "Alps", "TSBH5", "NTSC M/N" }, - { 17,1, "Alps", "TSC??", "NTSC M/N" }, - { 18,1, "Alps", "TSCH5", "NTSC M/N with FM" } -}; -const unsigned int MAXTUNERTYPE = ARRAY_SIZE(generic_tuners); - - -/* Board info/control byte: - * 0x80: bt829: 0:enable 1:disable - * 0x40: sound: 0:tuner 1:video - * 0x20: 0:stereo 1:mono (R/O?) - * 0x10: 0:mute 1:unmute - * 0x0F: Tuner type (R/O) - */ - -int board_setbyte(GENERIC_CARD *card) -{ - u8 info; - u32 tmp; - - tmp = MACH64_EXT_DAC_REGS & 0xFFFFFFFC; - if (card->mute) tmp |= 0x2; /* something to do with audio */ - if (card->mux == 2) tmp |= 0x1; /* something to do with tuner */ - MACH64_EXT_DAC_REGS = tmp; - - /* All-In-Wonder */ - info = 0x2F; /* TV-Tuner */ - -/* could check if we are capturing here as well and mute if not */ - if (card->mux != 2){ - info |= 0x40; /* sound 0:tuner 1:comp/svideo */ - } - if (!(card->mute)) { - info |= 0x10; /* 0:mute 1:unmute */ - } - i2c_write(card,card->board.addr,&info,1); - - return 0; -} - int m64_inita(GENERIC_CARD *card) { u32 id; @@ -121,10 +63,6 @@ printk(KERN_INFO "videoram is %d\n",card->videoram); - /* 8192 space for registers in framebuffer happens on pro version */ - card->vbibuffer = 1024*card->videoram - 32768 - 8192; - - /* find board address */ card->board.addr = 0x70; //standalone card card->boardinfo = 0xFF; @@ -260,221 +198,6 @@ return 0; } -/* Tune to frequency */ -int fi12xx_tune(GENERIC_CARD *card) -{ - u8 data[4]; - u8 band; - u32 K,Fpc,freq; - int i=0; - - /* if ntsc or pal M use this */ - if (card->tvnorm == 1 || card->tvnorm == 4 || card->tvnorm == 6){ - Fpc = 4575; /* 45.75 * 100 */ - } else { - Fpc = 3890; /* 38.90 * 100 */ - } - /* reset oform, for some reason this can be changed during use, causing white pixels to appear black, so if we reset it when we change channels... :) */ - BTWRITE(card,BT829_OFORM,0x0A); - freq = card->freq * 100 / 16; - - K = (freq + Fpc) * 16 + 50; - band = fi12xx_band(card,freq); - card->freq = (K/16 - Fpc) / 100; - i = (K > card->lastfreq) ? 0 : 2; - card->lastfreq = K; - K = K / 100 - 4; /* Since I removed the float operations, the conversion is off by 4... so lets just remove 4 :) */ - data[i+0] = (K>>8) & 0x7F; - data[i+1] = K & 0xFF; - data[2-i] = 0x8E; - data[3-i] = band ; - i2c_write(card,card->fi12xx.addr,data,sizeof(data)); - return 0; -} - -u8 fi12xx_band(GENERIC_CARD *card, unsigned long freq) -{ - int system=0; - - switch (card->tuner) { - case 1: case 2: case 12: /* NTSC M/N and NTSC Japan */ - if (freq <= 16000) - return 0xA2; - if (freq <= 45125) - return 0x94; - if (freq <= 46325) - return 0x34; - return 0x31; - case 3: case 4: case 9: case 10: /* PAL B/G and PAL I */ - if (freq <= 14025) - return 0xA2; - if (freq <= 16825) - return 0xA4; - if (freq <= 44725) - return 0x94; - return 0x31; - case 6: /* NTSC M/N Mk2 */ - if (freq <= 16000) - return 0xA0; - if (freq <= 45400) - return 0x90; - return 0x30; - case 7: /* SECAM D/K */ - if (freq <= 16825) - return 0xA0; - if (freq <= 45525) - return 0x90; - return 0x30; - case 5: case 11: /* PAL B/G, SECAM L/L' */ - if (card->tvnorm != 2) { - system = 1; /* pal */ - } else { - system = 3 ; /* secam */ - } - if (freq <= 16825) - return 0xA0+system; - if (freq <= 44725) - return 0x90+system; - return 0x30+system; - case 8: /* NTSC M/N (Samsung) */ - if (card->type == CARD_NEC) { - if (freq <= 16000) - return 0xA0; - if (freq <= 45400) - return 0x90; - return 0x30; - } else if (card->type == CARD_STAND_ALONE && card->board.revision == 0){ - if (freq <= 15725) - return 0xA2; - if (freq <= 45125) - return 0x94; - if (freq <= 46325) - return 0x34; - return 0x31; - } else { - if (freq <= 12725) - return 0x01; - if (freq <= 36125) - return 0x02; - return 0x08; } - case 13: /* PAL I/B/G/DK, SECAM D/K */ - if (freq <= 14025) - return 0xA2; - if (freq <= 16825) - return 0xA4; - if (freq <= 44725) - return 0x94; - return 0x31; - case 16: case 17: /* NTSC M/N */ - if (freq <= 13000) - return 0x14; - if (freq <= 36400) - return 0x12; - return 0x11; - case 18: /* NTSC M/N with FM */ - if (freq <= 13000) - return 0x14; - if (freq <= 36400) - return 0x12; - return 0x11; - default: return 0x00; - } -} - - -int fi12xx_register(GENERIC_CARD *card,u8 addr, int use) -{ - char *ident, name[64]; - u8 *ptr; - -/* need to check for r128mminfo here as well */ - ptr = card->m64mminfo; - - dprintk(2,"card(%d) fi12xx_register called ptr is %d\n",card->cardnum, *ptr); - if (card->board.addr == 0xFF){ - if (*ptr&0x0F) - card->tuner = (*ptr<=MAXTUNERTYPE) ? *ptr : 0; - } else { - card->tuner = card->boardinfo & 0x0F; - if (card->tuner == 0x0F){ - card->tuner = (*ptr<=MAXTUNERTYPE) ? *ptr : 0; - } - } -// if (card->tuner) -// { - ident = generic_tuners[card->tuner].ident; - if (ident==NULL) ident="Unknown"; - snprintf(name,sizeof(name),"%s Tuner Module (%s %s)%s", - generic_tuners[card->tuner].system, - generic_tuners[card->tuner].vendor, - ident, (use)?"":" UNUSED") ; - printk(KERN_INFO "Tuner is %s\n",name); - card->tvnorm = generic_tuners[card->tuner].tunertype; - -// } - /* set address of tuner */ - card->fi12xx.addr = addr; - return 0; -} - -void set_mute(GENERIC_CARD *card, int value) -{ - u8 info; - info = 0x2F; /* TV-Tuner */ - card->mute = value; - if (value == 0) info |= 0x10; - i2c_write(card,card->board.addr,&info,1); - board_setaudio(card); - board_setbyte(card); -} - - -int board_setaudio(GENERIC_CARD *card) -{ - u8 tmp, data; - - if (card->audio.deviceid == TDA8425){ - i2c_writereg8(card,card->audio.addr,0x00,0xFF); //left vol - i2c_writereg8(card,card->audio.addr,0x01,0xFF); //right vol - i2c_writereg8(card,card->audio.addr,0x02,0xF6); //bass - i2c_writereg8(card,card->audio.addr,0x03,0xF6); //treble - tmp = 0xC0; - tmp |= card->mute ? 0x20 : 0x0; - /* stereo 3 , Linear 2 , Pseudo 1 , Forced mono 0 */ - tmp |= card->stereo ? (3 << 3) : 0x0; - tmp |= 3 << 1; //src sel - tmp |= (card->mux != 2) ? 0 : 1; - i2c_writereg8(card,card->audio.addr,0x08,tmp); - } - - if (card->audio.deviceid == TDA9850) { - i2c_writereg8(card,card->audio.addr,CON1ADDR,0x08); /* noise threshold stereo */ - i2c_writereg8(card,card->audio.addr,CON2ADDR,0x08); /* noise threshold sap */ - i2c_writereg8(card,card->audio.addr,CON3ADDR,0x40); /* stereo mode */ - i2c_writereg8(card,card->audio.addr,CON4ADDR,0x07); /* 0 dB input gain? */ - i2c_writereg8(card,card->audio.addr,ALI1ADDR,0x10); /* wideband alignment? */ - i2c_writereg8(card,card->audio.addr,ALI2ADDR,0x10); /* spectral alignment? */ - i2c_writereg8(card,card->audio.addr,ALI3ADDR,0x03); - - tmp = 0x0; - tmp |= card->stereo<<6; - tmp |= card->sap<<7; - tmp |= card->mute ? 0x8 : 0x0; //normal mute - tmp |= card->mute ? 0x10 : 0x0; //sap mute? - - i2c_writereg8(card,card->audio.addr,CON3ADDR,tmp); - } - - if (card->audio.deviceid == TDA9851) { - data = (BTREAD(card,BT829_P_IO)&0xFC) | (card->mux==2); - BTWRITE(card,BT829_P_IO,data); - data = (i2c_read(card,card->audio.addr) & 0x01) | 0x04 ; - i2c_write(card,card->audio.addr,&data,1); - } - - return 0; -} - void mach64_enable_capture(GENERIC_CARD *card) { int temp,vfilt,vtotal; Index: rage128.c =================================================================== RCS file: /cvsroot/gatos/v4l2/rage128.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- rage128.c 11 Jan 2005 21:11:06 -0000 1.1.1.1 +++ rage128.c 9 Mar 2005 20:34:42 -0000 1.2 @@ -23,6 +23,9 @@ #include "generic.h" #include "rage128.h" +#include "i2c.h" +#include "bt829.h" +#include "board.h" int r128_inita(GENERIC_CARD *card) { @@ -40,38 +43,288 @@ } printk (KERN_INFO "device id 0x%08x revision %d\n",id, rev); + /* figure out what i2c mode to use */ + if (i2c_init(card) != 0){ + printk (KERN_ERR "Could not find i2c bus driver\n"); + return -ENODEV; + } + // printk ("R128_CONFIG_APER_0_BASE 0x%08x\n", R128_CONFIG_APER_0_BASE); card->videoram = R128_CONFIG_MEMSIZE >> 10; printk(KERN_INFO "videoram is %d\n",card->videoram); /* not sure what this does */ - R128_VIDEOMUX_CNTL=0x50781; + R128_VIDEOMUX_CNTL=0x50783; + + R128_CAPTURE_PORT_MODE_CNTL = 0; + + /* find board address (make this into a function) */ + card->board.addr = 0x70; //standalone card + card->boardinfo = 0xFF; + i2c_write(card,0x70,&card->boardinfo,1); + if ((card->boardinfo = i2c_read(card,0x70)) != 0xFF){ + card->board.addr = 0x70; //standalone card + card->type=CARD_STAND_ALONE; + } else { + card->boardinfo = 0xFF; + i2c_write(card,0x40,&card->boardinfo,1); + if ((card->boardinfo = i2c_read(card,0x40)) != 0xFF){ + card->board.addr = 0x40; //standalone card + card->type=CARD_STAND_ALONE; + } else { + card->boardinfo = 0xFF; + i2c_write(card,0x78,&card->boardinfo,1); + if ((card->boardinfo = i2c_read(card,0x78)) != 0xFF){ + card->board.addr = 0x78; //nec card? + card->type=CARD_NEC; + } else { + card->boardinfo = 0x7F; + i2c_write(card,0x76,&card->boardinfo,1); + if ((card->boardinfo = i2c_read(card,0x76)) != 0xFF){ + card->board.addr = 0x76; /*all in wonder */ + } else { + card->board.addr = 0xFF; /*all in wonder pro */ + //card->board.addr = 0x76; /*all in wonder pro */ + } + switch (card->board.deviceid) { + case 0x5245: case 0x5246: case 0x524B: case 0x524C: + card->type=CARD_ALL_IN_WONDER_128; + break; + case 0x4742: case 0x4744: case 0x4749: case 0x4750: case 0x4751: + card->type=CARD_ALL_IN_WONDER_PRO; + break; + default: + card->type=CARD_ALL_IN_WONDER; + } + } + } + } + + +/* should pull this out from mach64 and put it in board.c then call that */ + /* could do tv out later */ + board_setbyte(card) ; /* Enable Capture Board */ + + /* find the tuner */ + if (i2c_device(card,0xC0)) + fi12xx_register(card,0xC0,0); + if (i2c_device(card,0xC6)) + fi12xx_register(card,0xC6,1); + + /* find the audio chip */ + if (i2c_device(card,0x82)){ + printk(KERN_INFO "TDA8425 Stereo Audio Processor\n"); + card->audio.deviceid = TDA8425; + card->audio.addr = 0x82; + } else if(i2c_device(card,0xB4)){ + printk(KERN_INFO "TDA9850 BTSC Stereo+SAP Audio Processor\n"); + card->audio.deviceid = TDA9850; + card->audio.addr = 0xB4; + } else if(i2c_device(card,0xB6)){ + printk(KERN_INFO "TDA9851 BTSC Economic Stereo Audio Processor\n"); + card->audio.deviceid = TDA9851; + card->audio.addr = 0xB6; + } else if(i2c_device(card,0x80)){ + card->audio.deviceid = MSP3410; + printk(KERN_INFO "MSP3410 Multi-Sound Audio Processor\n"); + card->audio.addr = 0x80; + } + else { + printk(KERN_INFO "NO SOUND PROCESSOR found\n"); + } + + /* find the bt829 device now */ + if (i2c_device(card,0x88)){ + bt829_register(card,0x88,1,1); + } + if (i2c_device(card,0x8A)){ + bt829_register(card,0x8A,1,1); + } + + /* TDEC controls frames per sec 0 is all frames (read bt829.pdf for info) */ + BTWRITE(card,BT829_TDEC,0x00); /*Temporal decimation register */ + BTWRITE(card,BT829_OFORM,0x0A); /* output format register */ + + /* check if we are muted or not? maybe always mute? */ + if (i2c_read(card,card->board.addr) & 0x10){ + card->mute = 0; //lets just always mute + } else { + card->mute = 1; + } + + /* check what mux we are on */ + if (BTREAD(card,BT829_ADC) == 0x80){ + card->mux = 3; //svideo + } else { + card->mux = 2; //tuner + } + + /* make sure capture is off to start with */ + R128_CAP0_TRIG_CNTL = 0x00000000; - /* set card type to all in wonder for now, I should change this to - make it for different capture abilities */ - card->type=CARD_RAGE128_AIW; - return 0; } -/* + void rage128_enable_capture(GENERIC_CARD *card) { - int width,height,bpp,bufsize,temp,vfilt,vtotal; - unsigned int flags; + int temp,vtotal; - MACH64_CRTC_INT_CNTL &= ~(MACH64_CAPBUF0_INT_EN|MACH64_CAPBUF1_INT_EN|MACH64_CAPONESHOT_INT_EN|MACH64_BUSMASTER_INT_EN); + /* set location of capture buffers */ + +/* if interlaced then pitch is cardwidth * 4 to skip every other line + cap buf0 even offset is the offset of even frames + so the offset should be 0 if not interlaced? */ +R128_CAP0_BUF0_OFFSET = card->buffer0; +R128_CAP0_BUF1_OFFSET = card->buffer1; + +if (disableinterlace || + card->height <= generic_tvnorms[card->tvnorm].sheight / 2){ + R128_CAP0_BUF_PITCH = 2*card->width; + R128_CAP0_BUF0_EVEN_OFFSET = card->buffer1; + R128_CAP0_BUF1_EVEN_OFFSET = card->buffer0; +} else { + R128_CAP0_BUF_PITCH = 2*2*card->width; + R128_CAP0_BUF0_EVEN_OFFSET = card->buffer0 + 2*card->width; + R128_CAP0_BUF1_EVEN_OFFSET = card->buffer1 + 2*card->width; +} + + //R128_CAP0_ONESHOT_BUF_OFFSET = card->buffer0; + R128_CAP0_ONESHOT_BUF_OFFSET = 0; + R128_CAP0_H_WINDOW = XY(2*card->width,0); + // should change the 21 based on capture size and pal/ntsc/secam + R128_CAP0_V_WINDOW = XY(21-1+(card->height),21); + +R128_CAP0_VBI_V_WINDOW = 0; +R128_CAP0_VBI_H_WINDOW = 0; +#warning make vbibuffer 2*32768 size in generic.c +R128_CAP0_VBI_EVEN_OFFSET = card->vbibuffer; +R128_CAP0_VBI_ODD_OFFSET = card->vbibuffer + 32768; + +R128_CAP0_DEBUG = 0; + +/* enable streaming (turn on interrupts) */ + R128_CLOCK_CNTL_INDEX0 = (FCP_CNTL & 0x1F) | R128_PLL_WR_EN; + R128_CLOCK_CNTL_DATA = 0x001; // was 101 + R128_CLOCK_CNTL_INDEX0 = (FCP_CNTL & 0x1F) & ~R128_PLL_WR_EN; + +BTWRITE(card,BT829_VACTIVE_LO,LO(generic_tvnorms[card->tvnorm].sheight)); +/* IF HDELAY IS NOT EVEN THEN CBSENSE MUST BE SET TO 1 + * if you dont do this then cb,cr order is wrong + * (you get yvyu instead of yuyv) */ +temp = card->width*generic_tvnorms[card->tvnorm].hdelayx1/generic_tvnorms[card->tvnorm].hactivex1; +if (temp & 0x1){ + card->cbsense=1; +} else { + card->cbsense=0; +} +BTWRITE(card,BT829_HDELAY_LO,LO(temp)); + +BTWRITE(card,BT829_HACTIVE_LO,LO(card->width)); + +BTWRITE(card,BT829_HSCALE_HI,HI(4096*generic_tvnorms[card->tvnorm].hactivex1/card->width-4096)); +BTWRITE(card,BT829_HSCALE_LO,LO(4096*generic_tvnorms[card->tvnorm].hactivex1/card->width-4096)); + +bt829_ctrl(card); + +vtotal = generic_tvnorms[card->tvnorm].sheight; +if (disableinterlace){ + vtotal *= 2; +} + +/* set crop register based on tuner type and size of image capture */ + switch (card->tuner) { + case 3: case 4: case 9: case 10: /* PAL B/G and PAL I */ + case 7: /* SECAM D/K */ + case 5: case 11: /* PAL B/G, SECAM L/L' */ + case 13: /* PAL I/B/G/DK, SECAM D/K */ + if (card->width <= generic_tvnorms[card->tvnorm].swidth / 2){ + BTWRITE(card,BT829_CROP,0x21); + } else { + BTWRITE(card,BT829_CROP,0x23); + } + break; + /* NTSC M/N and NTSC Japan */ + /* NTSC M/N Mk2 */ + /* NTSC M/N (Samsung) */ + /* NTSC M/N */ + /* NTSC M/N with FM */ + default: + if (card->width <= generic_tvnorms[card->tvnorm].swidth / 2){ + BTWRITE(card,BT829_CROP,0x11); + } else { + BTWRITE(card,BT829_CROP,0x12); + } + break; + } + +//if less than half height then do not interlace +if (disableinterlace || card->height <= generic_tvnorms[card->tvnorm].sheight / 2){ +BTWRITE(card,BT829_VSCALE_HI,HI(0x10000 - + ((512*vtotal/(card->height*2)-512) & 0x1fff))|0x40); + //((512*vtotal/(card->height*2)-512) & 0x1fff))|0xe0); +BTWRITE(card,BT829_VSCALE_LO,LO(0x10000 - + ((512*vtotal/(card->height*2)-512) & 0x1fff))); + + R128_CAP0_CONFIG = (R128_CAP0_CONFIG_CONTINUOS +| R128_CAP0_CONFIG_START_FIELD_EVEN +| R128_CAP0_CONFIG_START_BUF_GET +| R128_CAP0_CONFIG_BUF_TYPE_ALT // alternates between buf0 and buf1 +//| R128_CAP0_CONFIG_BUF_TYPE_FRAME +| R128_CAP0_CONFIG_BUF_MODE_DOUBLE +| R128_CAP0_CONFIG_VBI_EN //vertical blank interrupt +| R128_CAP0_CONFIG_VIDEO_IN_VYUY422); +} else { +// 0x60 is interlace 0x40 is not +BTWRITE(card,BT829_VSCALE_HI,HI(0x10000 - + ((512*vtotal/card->height-512) & 0x1fff))|0x60); +BTWRITE(card,BT829_VSCALE_LO,LO(0x10000 - + ((512*vtotal/card->height-512) & 0x1fff))); + + R128_CAP0_CONFIG = (R128_CAP0_CONFIG_CONTINUOS +| R128_CAP0_CONFIG_START_FIELD_EVEN +| R128_CAP0_CONFIG_START_BUF_GET +| R128_CAP0_CONFIG_BUF_TYPE_ALT +| R128_CAP0_CONFIG_BUF_TYPE_FRAME +| R128_CAP0_CONFIG_BUF_MODE_DOUBLE +| R128_CAP0_CONFIG_VBI_EN //vertical blank interrupt +| R128_CAP0_CONFIG_VIDEO_IN_VYUY422); +} + + R128_CAP1_CONFIG = 0; + + R128_BUS_CNTL &= ~R128_BUS_MASTER_DIS; + + R128_BM_CHUNK_0_VAL |= (R128_BM_PTR_FORCE_TO_PCI | + R128_BM_PM4_RD_FORCE_TO_PCI | + R128_BM_GLOBAL_FORCE_TO_PCI); // |0xFF + + R128_BM_CHUNK_1_VAL = 0xF0F0F0F; + + R128_CAP_INT_STATUS = 3; + R128_GEN_INT_STATUS = (1<<8)|(1<<16); + R128_CAP_INT_CNTL = 3; + R128_GEN_INT_CNTL |= (1<<16); + + R128_CAP0_TRIG_CNTL = R128_CAP0_TRIG_CNTL_CAPTURE_EN|R128_CAP0_TRIG_CNTL_TRIGGER_SET; + + card->status |= STATUS_CAPTURING; } -*/ void rage128_disable_capture(GENERIC_CARD *card) { - u32 bus_cntl; + R128_CAP0_CONFIG = 0x00000000L; + R128_CAP_INT_CNTL &= ~3; + R128_GEN_INT_CNTL &= ~((1<<16)|(1<<24)); +/* disable streaming (turn off interrupts) */ + R128_CLOCK_CNTL_INDEX0 = (FCP_CNTL & 0x1F) | R128_PLL_WR_EN; + R128_CLOCK_CNTL_DATA = 0x404; + R128_CLOCK_CNTL_INDEX0 = (FCP_CNTL & 0x1F) & ~R128_PLL_WR_EN; -// R128_CAP0_CONFIG = 0x00000000L; +printk (KERN_INFO "dis R128_CAP0_TRIG_CNTL is 0x%08x\n", R128_CAP0_TRIG_CNTL); + R128_CAP0_TRIG_CNTL = 0x00000000; +printk (KERN_INFO "dis R128_CAP0_TRIG_CNTL is now 0x%08x\n", R128_CAP0_TRIG_CNTL); //make sure DMA transfers have stopped -// bus_cntl = R128_BUS_CNTL; -// R128_BUS_CNTL = bus_cntl | R128_BUS_MSTR_RESET; - card->status = 0; + R128_BUS_CNTL |= R128_BUS_MASTER_RESET; } Index: bt829.c =================================================================== RCS file: /cvsroot/gatos/v4l2/bt829.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- bt829.c 11 Jan 2005 21:11:07 -0000 1.1.1.1 +++ bt829.c 9 Mar 2005 20:34:42 -0000 1.2 @@ -66,10 +66,8 @@ { /* 1=Composite, 2=tuner, 3=S-Video */ if(card->mux==3) - //BTWRITE(card, BT829_ADC,0xA1); BTWRITE(card, BT829_ADC,0x80); else -// BTWRITE(card, BT829_ADC,0xA3); BTWRITE(card, BT829_ADC,0x82); bt829_ctrl(card); @@ -79,15 +77,7 @@ void bt829_iform(GENERIC_CARD *card) { -/* int flag; - - flag = BTREAD(card,BT829_IFORM); - if (tunertype == -1) { - flag &= 0xf8; // set FORMAT to AUTOFORMAT (000) - BTWRITE(card,BT829_IFORM,card->mux<<5|GENERIC_IFORM_XT0|GENERIC_IFORM_XT1); - } else { */ - BTWRITE(card,BT829_IFORM,card->mux<<5|generic_tvnorms[card->tvnorm].iform); -// } + BTWRITE(card,BT829_IFORM,card->mux<<5|generic_tvnorms[card->tvnorm].iform); } int bt829_ctrl(GENERIC_CARD *card) Index: i2c.c =================================================================== RCS file: /cvsroot/gatos/v4l2/i2c.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- i2c.c 11 Jan 2005 21:11:05 -0000 1.1.1.1 +++ i2c.c 9 Mar 2005 20:34:42 -0000 1.2 @@ -24,7 +24,6 @@ #include "generic.h" #include "i2c.h" -#include "bt829.h" #include "mach64.h" #include "rage128.h" @@ -48,7 +47,10 @@ unsigned long nm; if (card->driver_data & RAGE128CHIP){ - nm = card->refclock * 1000000 / (4*R128_CLOCK_FREQ); + /* set it to the rage128 i2c driver (all nulls) */ + card->i2c = &generic_i2c_driver[3]; + + nm = card->refclock * 10000 / (4*R128_CLOCK_FREQ); for (card->R128_N=1 ; card->R128_N<255 ; card->R128_N++) if (card->R128_N*(card->R128_N-1) > nm) break; @@ -62,119 +64,126 @@ i2c_device(card,0xC4) + i2c_device(card,0xC6); if (ok != 0 && ok != 4){ -dprintk(2,"card(%d) Rage128 i2c driver\n",card->cardnum); +printk(KERN_INFO "card(%d) Rage128 i2c driver\n",card->cardnum); return 0; } - } + /* check for bt829 chip */ + ok = i2c_device(card,0x88) + i2c_device(card,0x8a); - // try (DAC+GEN_TEST) - card->i2c = &generic_i2c_driver[0]; - card->sclreg = MACH64_DAC_CNTL_PTR; - card->sdareg = MACH64_GEN_TEST_CNTL_PTR; - card->sclset = 0x01000000; - card->sdaset = 0x00000001; - card->sdaget = 0x00000008; - card->scldir = 0x08000000; - card->sdadir = 0x00000020; - save1 = MACH64_DAC_CNTL; - save2 = MACH64_GEN_TEST_CNTL; - save3 = MACH64_GP_IO; - *card->sdareg |= 0x00000010; - save4 = MACH64_CRTC_H_TOTAL_DISP; //hmm why do this? - MACH64_GP_IO &= 0x7FFFFFFF; - MACH64_CRTC_H_TOTAL_DISP = save4; //hmm why do this? + if ((ok != 0) && (ok != 4)) { + return 0; + } + /* failed to find it */ + R128_I2C_CNTL_1 = 0x0; + } else if (card->driver_data & MACH64CHIP){ + // try (DAC+GEN_TEST) + card->i2c = &generic_i2c_driver[0]; + card->sclreg = MACH64_DAC_CNTL_PTR; + card->sdareg = MACH64_GEN_TEST_CNTL_PTR; + card->sclset = 0x01000000; + card->sdaset = 0x00000001; + card->sdaget = 0x00000008; + card->scldir = 0x08000000; + card->sdadir = 0x00000020; + save1 = MACH64_DAC_CNTL; + save2 = MACH64_GEN_TEST_CNTL; + save3 = MACH64_GP_IO; + *card->sdareg |= 0x00000010; + save4 = MACH64_CRTC_H_TOTAL_DISP; //hmm why do this? + MACH64_GP_IO &= 0x7FFFFFFF; + MACH64_CRTC_H_TOTAL_DISP = save4; //hmm why do this? - ok = i2c_device(card,0xC0) + i2c_device(card,0xC2) + - i2c_device(card,0xC4) + i2c_device(card,0xC6); + ok = i2c_device(card,0xC0) + i2c_device(card,0xC2) + + i2c_device(card,0xC4) + i2c_device(card,0xC6); - if (ok != 0 && ok != 4){ + if (ok != 0 && ok != 4){ dprintk(2,"card(%d) DAC+GEN_TEST i2c driver\n",card->cardnum); - return 0; - } - //else this is not the right i2c driver set everything back to what it was - MACH64_DAC_CNTL = save1; - MACH64_GEN_TEST_CNTL = save2; - MACH64_GP_IO = save3; + return 0; + } + //else this is not the right i2c driver set everything back to what it was + MACH64_DAC_CNTL = save1; + MACH64_GEN_TEST_CNTL = save2; + MACH64_GP_IO = save3; - //try next i2c driver (GP_IO Register) - card->sclreg = MACH64_GP_IO_PTR; - card->sdareg = MACH64_GP_IO_PTR; - save1 = MACH64_GP_IO; - card->sclset = 0x00000800; - card->sdaset = 0x00000010; - card->sdaget = 0x00000010; - card->scldir = 0x08000000; - card->sdadir = 0x00100000; - ok = i2c_device(card,0xC0) + i2c_device(card,0xC2) + - i2c_device(card,0xC4) + i2c_device(card,0xC6); + //try next i2c driver (GP_IO Register) + card->sclreg = MACH64_GP_IO_PTR; + card->sdareg = MACH64_GP_IO_PTR; + save1 = MACH64_GP_IO; + card->sclset = 0x00000800; + card->sdaset = 0x00000010; + card->sdaget = 0x00000010; + card->scldir = 0x08000000; + card->sdadir = 0x00100000; + ok = i2c_device(card,0xC0) + i2c_device(card,0xC2) + + i2c_device(card,0xC4) + i2c_device(card,0xC6); - if (ok != 0 && ok != 4){ + if (ok != 0 && ok != 4){ dprintk(2,"card(%d) GP_IO i2c driver\n",card->cardnum); - return 0; - } - /* now try bt829 units in case there is no tuner */ - if (ok == 0){ - ok = i2c_device(card,0x88)+i2c_device(card,0x8a); - if (ok != 0){ return 0; } - } + /* now try bt829 units in case there is no tuner */ + if (ok == 0){ + ok = i2c_device(card,0x88)+i2c_device(card,0x8a); + if (ok != 0){ + return 0; + } + } - //else nope reset and test next - MACH64_GP_IO = save1; + //else nope reset and test next + MACH64_GP_IO = save1; - //try next i2c driver LG (GP_IO Register) - card->sclreg = MACH64_GP_IO_PTR; - card->sdareg = MACH64_GP_IO_PTR; - save1 = MACH64_GP_IO; - card->sclset = 0x00000400; - card->sdaset = 0x00001000; - card->sdaget = 0x00001000; - card->scldir = 0x04000000; - card->sdadir = 0x10000000; - ok = i2c_device(card,0xC0) + i2c_device(card,0xC2) + + //try next i2c driver LG (GP_IO Register) + card->sclreg = MACH64_GP_IO_PTR; + card->sdareg = MACH64_GP_IO_PTR; + save1 = MACH64_GP_IO; + card->sclset = 0x00000400; + card->sdaset = 0x00001000; + card->sdaget = 0x00001000; + card->scldir = 0x04000000; + card->sdadir = 0x10000000; + ok = i2c_device(card,0xC0) + i2c_device(card,0xC2) + i2c_device(card,0xC4) + i2c_device(card,0xC6); - if (ok != 0 && ok != 4){ + if (ok != 0 && ok != 4){ dprintk(2,"card(%d) LG GP_IO i2c driver\n",card->cardnum); - return 0; - } - //else nope reset and try next - MACH64_GP_IO = save1; + return 0; + } + //else nope reset and try next + MACH64_GP_IO = save1; - //TB (ImpacTV) - card->i2c = &generic_i2c_driver[1]; - tvout_write32(card,MACH64_TV_I2C_CNTL,0x00005500|card->tv_i2c_cntl); - ok = i2c_device(card,0xC0) + i2c_device(card,0xC2) + - i2c_device(card,0xC4) + i2c_device(card,0xC6); + //TB (ImpacTV) + card->i2c = &generic_i2c_driver[1]; + tvout_write32(card,MACH64_TV_I2C_CNTL,0x00005500|card->tv_i2c_cntl); + ok = i2c_device(card,0xC0) + i2c_device(card,0xC2) + + i2c_device(card,0xC4) + i2c_device(card,0xC6); - if (ok != 0 && ok != 4){ + if (ok != 0 && ok != 4){ dprintk(2,"card(%d) Impact tv i2c driver\n",card->cardnum); - return 0; - } - //else nope try last one + return 0; + } + //else nope try last one - //(Rage PRO) - card->i2c = &generic_i2c_driver[2]; - save1 = MACH64_I2C_CNTL_0; - save2 = MACH64_I2C_CNTL_1; - MACH64_I2C_CNTL_1 = 0x00400000; - if (MACH64_I2C_CNTL_1!=0x00400000) - return (-ENODEV); + //(Rage PRO) + card->i2c = &generic_i2c_driver[2]; + save1 = MACH64_I2C_CNTL_0; + save2 = MACH64_I2C_CNTL_1; + MACH64_I2C_CNTL_1 = 0x00400000; + if (MACH64_I2C_CNTL_1!=0x00400000) + return (-ENODEV); - card->i2c_cntl_0 = 0x0000C000; - MACH64_I2C_CNTL_0 = card->i2c_cntl_0|0x00040000; + card->i2c_cntl_0 = 0x0000C000; + MACH64_I2C_CNTL_0 = card->i2c_cntl_0|0x00040000; - ok = i2c_device(card,0xC0) + i2c_device(card,0xC2) + - i2c_device(card,0xC4) + i2c_device(card,0xC6); + ok = i2c_device(card,0xC0) + i2c_device(card,0xC2) + + i2c_device(card,0xC4) + i2c_device(card,0xC6); - if (ok != 0 && ok != 4){ + if (ok != 0 && ok != 4){ dprintk(2,"card(%d) RagePro i2c driver\n",card->cardnum); - return 0; - } - MACH64_I2C_CNTL_0 = save1; - MACH64_I2C_CNTL_1 = save2; - + return 0; + } + MACH64_I2C_CNTL_0 = save1; + MACH64_I2C_CNTL_1 = save2; + } return (-ENODEV); } @@ -432,11 +441,11 @@ int r128_wait_ack(GENERIC_CARD *card) { int nack=0, n1=0, n2=0 ; - while (n1++ < 10 && (R128_I2C_CNTL_0_1 & (I2C_GO>>8))) udelay(1); + while (n1++ < 10 && (R128_I2C_CNTL_0_1 & (I2C_GO>>8))) udelay(15); while (n2++ < 10 && !nack) { nack = R128_I2C_CNTL_0_0 & (I2C_DONE|I2C_NACK|I2C_HALT); if (!nack) - udelay(1); + udelay(15); } return (nack != I2C_DONE); } --- NEW FILE: board.h --- /* This file is part of genericv4l. genericv4l 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. genericv4l 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef GENERIC_BOARD_HEADER #define GENERIC_BOARD_HEADER 1 #define TDA8425 8425 #define TDA9850 9850 #define TDA9851 9851 #define MSP3410 3410 #define CARD_STAND_ALONE 1 #define CARD_ALL_IN_WONDER 2 #define CARD_ALL_IN_WONDER_PRO 3 #define CARD_ALL_IN_WONDER_128 4 #define CARD_NEC 5 #define CAPTURE_MODE_SINGLE_ODD 0 #define CAPTURE_MODE_SINGLE_EVEN 1 #define CAPTURE_MODE_DOUBLE 2 #define CAPTURE_MODE_INTERLACED 3 #define CAPTURE_MODE_INTERLACED_INV 4 /* registers in the TDA9850 BTSC/dbx chip */ #define CON1ADDR 0x04 #define CON2ADDR 0x05 #define CON3ADDR 0x06 #define CON4ADDR 0x07 #define ALI1ADDR 0x08 #define ALI2ADDR 0x09 #define ALI3ADDR 0x0a void set_mute(GENERIC_CARD *card, int value); int board_setaudio(GENERIC_CARD *card); int fi12xx_tune(GENERIC_CARD *card); u8 fi12xx_band(GENERIC_CARD *card, unsigned long freq); int fi12xx_register(GENERIC_CARD *card,u8 addr, int use); int board_setbyte(GENERIC_CARD *card); #endif Index: Makefile_2.6 =================================================================== RCS file: /cvsroot/gatos/v4l2/Makefile_2.6,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Makefile_2.6 11 Jan 2005 21:11:07 -0000 1.1.1.1 +++ Makefile_2.6 9 Mar 2005 20:34:42 -0000 1.2 @@ -1,13 +1,14 @@ +SRCS := bt829.c generic.c i2c.c mach64.c memory.c queue.c rage128.c board.c + ifneq ($(KERNELRELEASE),) obj-m := genericv4l.o -genericv4l-objs := bt829.o generic.o i2c.o mach64.o memory.o queue.o rage128.o +genericv4l-objs := $(SRCS:%.c=%.o) else KDIR := /lib/modules/$(shell uname -r)/build PWD := $(shell pwd) MODULE := genericv4l.ko -SRCS := genericv4l.c bt829.c generic.c i2c.c mach64.c memory.c queue.c rage128.c OBJS := $(patsubst %.c,%.o,$(SRCS)) default: Index: memory.c =================================================================== RCS file: /cvsroot/gatos/v4l2/memory.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- memory.c 11 Jan 2005 21:11:07 -0000 1.1.1.1 +++ memory.c 9 Mar 2005 20:34:42 -0000 1.2 @@ -27,9 +27,8 @@ #endif #include "generic.h" -#include "i2c.h" -#include "bt829.h" #include "mach64.h" +#include "rage128.h" #include "memory.h" /* Here we want the physical address of the memory. @@ -98,6 +97,8 @@ ptr[i].from_addr = from_addr + i*PAGE_SIZE; ptr[i].to_addr = kvirt_to_pa(to_addr + i*PAGE_SIZE); ptr[i].size = PAGE_SIZE; // amount to transfer? +/* ERROR NOT REQUIRED FOR MACH64 */ + ptr[i].size = PAGE_SIZE | RAGE128_BM_FORCE_TO_PCI; ptr[i].reserved = 0; bufsize -= PAGE_SIZE; } @@ -112,5 +113,7 @@ ptr[i].from_addr = from_addr + i*PAGE_SIZE; ptr[i].to_addr = kvirt_to_pa(to_addr + i*PAGE_SIZE); ptr[i].size = bufsize | MACH64_DMA_GUI_COMMAND__EOL; //make it stop +/* ERROR NOT REQUIRED FOR MACH64 */ + ptr[i].size = bufsize | RAGE128_BM_FORCE_TO_PCI | MACH64_DMA_GUI_COMMAND__EOL; //make it stop ptr[i].reserved = 0; } --- NEW FILE: board.c --- /* This file is part of genericv4l. genericv4l 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. genericv4l 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "generic.h" #include "board.h" #include "bt829.h" #include "mach64.h" #include "rage128.h" #include "i2c.h" /* Board info/control byte: * 0x80: bt829: 0:enable 1:disable * 0x40: sound: 0:tuner 1:video * 0x20: 0:stereo 1:mono (R/O?) * 0x10: 0:mute 1:unmute * 0x0F: Tuner type (R/O) */ struct tuner_types generic_tuners[] = { { 0,1, NULL, NULL, NULL }, { 1,1, "Philips", "FI1236", "NTSC M/N" }, { 2,6, "Philips", "FI1236J", "NTSC Japan" }, { 3,0, "Philips", "FI1216MK2", "PAL B/G" }, { 4,0, "Philips", "FI1246", "PAL I" }, { 5,0, "Philips", "FI1216MF", "PAL B/G, SECAM L/L'" }, { 6,1, "Philips", "FI1236MK2", "NTSC M/N" }, { 7,2, "Philips", "FI1256", "SECAM D/K" }, { 8,1, "Samsung", "TCPN7082PC27A", "NTSC M/N" }, { 9,0, "Philips", "FI1216MK2(EXT)", "PAL B/G" }, { 10,0, "Philips", "FI1246MK2(EXT)", "PAL I" }, { 11,0, "Philips", "FI1216MF(EXT)", "PAL B/G, SECAM L/L'" }, { 12,1, "Philips", "FI1236MK2(EXT)", "NTSC M/N" }, { 13,0, "Temic", "FN5AL", "PAL I/B/G/DK, SECAM DK" }, { 14,1, NULL, NULL, NULL }, { 15,1, NULL, NULL, NULL }, { 16,1, "Alps", "TSBH5", "NTSC M/N" }, { 17,1, "Alps", "TSC??", "NTSC M/N" }, { 18,1, "Alps", "TSCH5", "NTSC M/N with FM" } }; const unsigned int MAXTUNERTYPE = ARRAY_SIZE(generic_tuners); /* Tune to frequency */ int fi12xx_tune(GENERIC_CARD *card) { u8 data[4]; u8 band; u32 K,Fpc,freq; int i=0; /* if ntsc or pal M use this */ if (card->tvnorm == 1 || card->tvnorm == 4 || card->tvnorm == 6){ Fpc = 4575; /* 45.75 * 100 */ } else { Fpc = 3890; /* 38.90 * 100 */ } /* reset oform, for some reason this can be changed during use, causing white pixels to appear black, so if we reset it when we change channels... :) */ BTWRITE(card,BT829_OFORM,0x0A); freq = card->freq * 100 / 16; K = (freq + Fpc) * 16 + 50; band = fi12xx_band(card,freq); card->freq = (K/16 - Fpc) / 100; i = (K > card->lastfreq) ? 0 : 2; card->lastfreq = K; K = K / 100; /* - 4; Since I removed the float operations, the conversion is off by 4... so lets just remove 4 :) */ data[i+0] = (K>>8) & 0x7F; data[i+1] = K & 0xFF; data[2-i] = 0x8E; //data[2-i] = 0xCE; // MSB -> 1 CP T2 T1 T0 RSA RSB OS <- LSB (see fi1236.pdf) data[3-i] = band ; i2c_write(card,card->fi12xx.addr,data,sizeof(data)); return 0; } u8 fi12xx_band(GENERIC_CARD *card, unsigned long freq) { int system=0; switch (card->tuner) { case 1: case 2: case 12: /* NTSC M/N and NTSC Japan */ if (freq <= 16000) return 0xA2; if (freq <= 45125) return 0x94; if (freq <= 46325) return 0x34; return 0x31; case 3: case 4: case 9: case 10: /* PAL B/G and PAL I */ if (freq <= 14025) return 0xA2; if (freq <= 16825) return 0xA4; if (freq <= 44725) return 0x94; return 0x31; case 6: /* NTSC M/N Mk2 */ if (freq <= 16000) return 0xA0; if (freq <= 45400) return 0x90; return 0x30; case 7: /* SECAM D/K */ if (freq <= 16825) return 0xA0; if (freq <= 45525) return 0x90; return 0x30; case 5: case 11: /* PAL B/G, SECAM L/L' */ if (card->tvnorm != 2) { system = 1; /* pal */ } else { system = 3 ; /* secam */ } if (freq <= 16825) return 0xA0+system; if (freq <= 44725) return 0x90+system; return 0x30+system; case 8: /* NTSC M/N (Samsung) */ if (card->type == CARD_NEC) { if (freq <= 16000) return 0xA0; if (freq <= 45400) return 0x90; return 0x30; } else if (card->type == CARD_STAND_ALONE && card->board.revision == 0){ if (freq <= 15725) return 0xA2; if (freq <= 45125) return 0x94; if (freq <= 46325) return 0x34; return 0x31; } else { if (freq <= 12725) return 0x01; if (freq <= 36125) return 0x02; return 0x08; } case 13: /* PAL I/B/G/DK, SECAM D/K */ if (freq <= 14025) return 0xA2; if (freq <= 16825) return 0xA4; if (freq <= 44725) return 0x94; return 0x31; case 16: case 17: /* NTSC M/N */ if (freq <= 13000) return 0x14; if (freq <= 36400) return 0x12; return 0x11; case 18: /* NTSC M/N with FM */ if (freq <= 13000) return 0x14; if (freq <= 36400) return 0x12; return 0x11; default: return 0x00; } } int fi12xx_register(GENERIC_CARD *card,u8 addr, int use) { char *ident, name[64]; u8 *ptr; if (card->driver_data & RAGE128CHIP) { ptr = card->r128mminfo; } else { ptr = card->m64mminfo; } dprintk(2,"card(%d) fi12xx_register called ptr is %d\n",card->cardnum, *ptr); if (card->board.addr == 0xFF){ if (*ptr&0x0F) card->tuner = (*ptr<=MAXTUNERTYPE) ? *ptr : 0; } else { card->tuner = card->boardinfo & 0x0F; if (card->tuner == 0x0F){ card->tuner = (*ptr<=MAXTUNERTYPE) ? *ptr : 0; ... [truncated message content] |
|
From: <gat...@li...> - 2005-03-09 08:40:43
|
Update of /cvsroot/gatos/km In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3610 Modified Files: km.c km_api_data.c Log Message: remap_page_range is obsolete on current 2.6 kernels. Fix size_t related compiler warnings on AMD64. Index: km_api_data.c =================================================================== RCS file: /cvsroot/gatos/km/km_api_data.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- km_api_data.c 16 Dec 2004 14:30:56 -0000 1.23 +++ km_api_data.c 9 Mar 2005 08:40:32 -0000 1.24 @@ -247,7 +247,7 @@ return kdu->mmap(file, vma); } -static int km_fo_data_read(struct file *file, char *buf, size_t count, loff_t *ppos) +static ssize_t km_fo_data_read(struct file *file, char *buf, size_t count, loff_t *ppos) { KDU_FILE_PRIVATE_DATA *kdufpd=file->private_data; KM_DATA_UNIT *kdu=kdufpd->kdu; @@ -265,6 +265,7 @@ unsigned long size = vma->vm_end-vma->vm_start; unsigned long chunk_size; unsigned long page, start; +unsigned long pos; int i,j; if(kdu->type!=KDU_TYPE_VIRTUAL_BLOCK){ @@ -277,14 +278,23 @@ for(j=0;j<dvb->size;j+=PAGE_SIZE){ if(chunk_size*i+PAGE_SIZE*j<offset)continue; if(chunk_size*i+PAGE_SIZE*j>offset+size)return 0; - page=kvirt_to_pa((unsigned long)dvb->ptr[i]+j*PAGE_SIZE); + pos=(unsigned long)dvb->ptr[i]+j*PAGE_SIZE; start=vma->vm_start+chunk_size*i+PAGE_SIZE*j-offset; #ifdef LINUX_2_6 - if(remap_page_range(vma,start, page, PAGE_SIZE, PAGE_SHARED)) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) + page=kvirt_to_pa(pos); + if(remap_page_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) + return -EAGAIN; #else - if(remap_page_range(start, page, PAGE_SIZE, PAGE_SHARED)) + page=page_to_pfn(vmalloc_to_page((void *)pos)); + if(remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) + return -EAGAIN; #endif +#else + page=kvirt_to_pa(pos); + if(remap_page_range(start, page, PAGE_SIZE, PAGE_SHARED)) return -EAGAIN; +#endif } return 0; } Index: km.c =================================================================== RCS file: /cvsroot/gatos/km/km.c,v retrieving revision 1.102 retrieving revision 1.103 diff -u -d -r1.102 -r1.103 --- km.c 11 Jan 2005 09:12:42 -0000 1.102 +++ km.c 9 Mar 2005 08:40:32 -0000 1.103 @@ -713,7 +713,7 @@ pci_set_drvdata(dev, NULL); return -EIO; } - printk("sizeof(kmfl_template)=%d sizeof(KM_FIELD)=%d\n", sizeof(kmfl_template), sizeof(KM_FIELD)); + printk("sizeof(kmfl_template)=%ld sizeof(KM_FIELD)=%ld\n", (unsigned long)sizeof(kmfl_template), (unsigned long)sizeof(KM_FIELD)); kms->kmfl=kmalloc(sizeof(kmfl_template), GFP_KERNEL); memcpy(kms->kmfl, kmfl_template, sizeof(kmfl_template)); @@ -1081,7 +1081,7 @@ request_module("videodev"); printk(KERN_INFO "Kmultimedia module version %s loaded\n", KM_VERSION); - printk(KERN_DEBUG "Page size is %ld sizeof(bm_list_descriptor)=%d sizeof(KM_STRUCT)=%d\n", PAGE_SIZE, sizeof(bm_list_descriptor), sizeof(KM_STRUCT)); + printk(KERN_DEBUG "Page size is %ld sizeof(bm_list_descriptor)=%ld sizeof(KM_STRUCT)=%ld\n", PAGE_SIZE, (unsigned long)sizeof(bm_list_descriptor), (unsigned long)sizeof(KM_STRUCT)); num_devices=0; pci_module_init( &km_pci_driver ); |
|
From: <gat...@li...> - 2005-02-17 17:33:48
|
Update of /cvsroot/gatos/v4l2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6503 Modified Files: generic.c Log Message: removes some debugging and returns the correct audio mode when VIDIOC_G_TUNER is called Eric Index: generic.c =================================================================== RCS file: /cvsroot/gatos/v4l2/generic.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- generic.c 17 Feb 2005 17:22:58 -0000 1.4 +++ generic.c 17 Feb 2005 17:33:39 -0000 1.5 @@ -2288,18 +2288,26 @@ strncpy(t->name, "tuner", sizeof(t->name)); t->type = V4L2_TUNER_ANALOG_TV; t->rangehigh = 0xffffffffUL; -// t->capability = V4L2_TUNER_CAP_NORM|V4L2_TUNER_CAP_STEREO|V4L2_TUNER_CAP_SAP; - t->capability = V4L2_TUNER_CAP_NORM|V4L2_TUNER_CAP_STEREO; -/* my all in wonder does not do sap */ -// t->rxsubchans = V4L2_TUNER_SUB_STEREO|V4L2_TUNER_SUB_SAP; - t->rxsubchans = V4L2_TUNER_SUB_STEREO; + if (card->audio.deviceid == TDA9850) { + t->capability = V4L2_TUNER_CAP_NORM|V4L2_TUNER_CAP_STEREO|V4L2_TUNER_CAP_SAP; + t->rxsubchans = V4L2_TUNER_SUB_STEREO|V4L2_TUNER_SUB_SAP; + } else { + t->capability = V4L2_TUNER_CAP_NORM|V4L2_TUNER_CAP_STEREO; + t->rxsubchans = V4L2_TUNER_SUB_STEREO; + } /* check if the tuner has a horizontal lock */ if (BTREAD(card,BT829_DSTATUS)&BT829_DSTATUS_HLOC) t->signal = 0xffff; - /* should probably check to see if sap is on? */ - t->audmode = V4L2_TUNER_MODE_STEREO; + if (card->stereo) { + t->audmode = V4L2_TUNER_MODE_STEREO; + t->rxsubchans |= V4L2_TUNER_SUB_STEREO; + } + if (card->sap) { + t->audmode = V4L2_TUNER_MODE_LANG1; + t->rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; + } up(&card->lock); return 0; @@ -2327,7 +2335,6 @@ } else if (t->audmode == V4L2_TUNER_MODE_SAP){ card->stereo = 1; card->sap = 1; -printk (KERN_INFO "Setting sap mode \n"); } else { dprintk(1,"card(%d) unknown %d\n",card->cardnum,t->audmode); } |
|
From: <gat...@li...> - 2005-02-17 17:23:09
|
Update of /cvsroot/gatos/v4l2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3889 Modified Files: generic.c generic.h mach64.c Added Files: tda9850.h Log Message: Switching Stereo/SAP/mono should now work with tda9850 audio chips Eric Index: generic.h =================================================================== RCS file: /cvsroot/gatos/v4l2/generic.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- generic.h 3 Feb 2005 15:01:55 -0000 1.3 +++ generic.h 17 Feb 2005 17:22:58 -0000 1.4 @@ -322,7 +322,7 @@ /* ATI chip refclock crystal frequency */ unsigned long refclock; - int stereo, sap; + int stereo, sap, mute; /* video4linux 1 */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) @@ -353,7 +353,7 @@ int width,height; unsigned long freq; unsigned long lastfreq; /* direction matters when telling the tuner to change channel */ - int tvnorm,hue,contrast,bright,saturation,mute; + int tvnorm,hue,contrast,bright,saturation; unsigned int mux; /* Video source (Bt829 MUX) 1=Composite,2=tuner,3=S-Video */ int cbsense; u16 luma, sat_u, sat_v; --- NEW FILE: tda9850.h --- /* registers in the TDA9850 BTSC/dbx chip */ #define CON1ADDR 0x04 #define CON2ADDR 0x05 #define CON3ADDR 0x06 #define CON4ADDR 0x07 #define ALI1ADDR 0x08 #define ALI2ADDR 0x09 #define ALI3ADDR 0x0a Index: generic.c =================================================================== RCS file: /cvsroot/gatos/v4l2/generic.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- generic.c 3 Feb 2005 15:01:55 -0000 1.3 +++ generic.c 17 Feb 2005 17:22:58 -0000 1.4 @@ -2316,17 +2316,23 @@ return -EINVAL; down_interruptible(&card->lock); if (t->audmode == V4L2_TUNER_MODE_MONO){ - dprintk(1,"card(%d) set to mono (not done)\n",card->cardnum); + card->stereo = 0; + card->sap = 0; } else if (t->audmode == V4L2_TUNER_MODE_STEREO){ - dprintk(1,"card(%d) set to stereo (not done)\n",card->cardnum); + card->stereo = 1; + card->sap = 0; } else if (t->audmode == V4L2_TUNER_MODE_LANG1){ - dprintk(1,"card(%d) set to lang1 (not done)\n",card->cardnum); + card->stereo = 1; + card->sap = 1; } else if (t->audmode == V4L2_TUNER_MODE_SAP){ - dprintk(1,"card(%d) set to sap (not done)\n",card->cardnum); + card->stereo = 1; + card->sap = 1; +printk (KERN_INFO "Setting sap mode \n"); } else { dprintk(1,"card(%d) unknown %d\n",card->cardnum,t->audmode); } up(&card->lock); + board_setaudio(card); return 0; } /* get tuner freq */ Index: mach64.c =================================================================== RCS file: /cvsroot/gatos/v4l2/mach64.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- mach64.c 3 Feb 2005 15:01:55 -0000 1.3 +++ mach64.c 17 Feb 2005 17:22:59 -0000 1.4 @@ -26,6 +26,7 @@ #include "bt829.h" #include "mach64.h" #include "memory.h" +#include "tda9850.h" static const int videoRamSizes[] = {0, 256, 512, 1024, 2*1024, 4*1024, 6*1024, 8*1024, 12*1024, 16*1024, 0}; @@ -433,13 +434,13 @@ u8 tmp, data; if (card->audio.deviceid == TDA8425){ - i2c_writereg8(card,card->audio.addr,0x00,0xFF); //left - i2c_writereg8(card,card->audio.addr,0x01,0xFF); //right + i2c_writereg8(card,card->audio.addr,0x00,0xFF); //left vol + i2c_writereg8(card,card->audio.addr,0x01,0xFF); //right vol i2c_writereg8(card,card->audio.addr,0x02,0xF6); //bass i2c_writereg8(card,card->audio.addr,0x03,0xF6); //treble tmp = 0xC0; tmp |= card->mute ? 0x20 : 0x0; - /* stereo 3 = Spacial 2 = Linear 1 = Pseudo 0 = Forced mono */ + /* stereo 3 , Linear 2 , Pseudo 1 , Forced mono 0 */ tmp |= card->stereo ? (3 << 3) : 0x0; tmp |= 3 << 1; //src sel tmp |= (card->mux != 2) ? 0 : 1; @@ -447,29 +448,21 @@ } if (card->audio.deviceid == TDA9850) { - if (card->mux == 2) { - i2c_writereg8(card,card->audio.addr,0x04,0x0F); - i2c_writereg8(card,card->audio.addr,0x05,0x0F); - i2c_writereg8(card,card->audio.addr,0x06,0x58); - i2c_writereg8(card,card->audio.addr,0x07,0x07); - i2c_writereg8(card,card->audio.addr,0x08,0x00); - i2c_writereg8(card,card->audio.addr,0x09,0x00); - i2c_writereg8(card,card->audio.addr,0x0A,0x03); - } else { - i2c_writereg8(card,card->audio.addr,0x04,0x07); - i2c_writereg8(card,card->audio.addr,0x05,0x07); - i2c_writereg8(card,card->audio.addr,0x06,0x58); - i2c_writereg8(card,card->audio.addr,0x07,0x07); - i2c_writereg8(card,card->audio.addr,0x08,0x10); - i2c_writereg8(card,card->audio.addr,0x09,0x10); - i2c_writereg8(card,card->audio.addr,0x0A,0x03); - } + i2c_writereg8(card,card->audio.addr,CON1ADDR,0x08); /* noise threshold stereo */ + i2c_writereg8(card,card->audio.addr,CON2ADDR,0x08); /* noise threshold sap */ + i2c_writereg8(card,card->audio.addr,CON3ADDR,0x40); /* stereo mode */ + i2c_writereg8(card,card->audio.addr,CON4ADDR,0x07); /* 0 dB input gain? */ + i2c_writereg8(card,card->audio.addr,ALI1ADDR,0x10); /* wideband alignment? */ + i2c_writereg8(card,card->audio.addr,ALI2ADDR,0x10); /* spectral alignment? */ + i2c_writereg8(card,card->audio.addr,ALI3ADDR,0x03); + tmp = 0x0; tmp |= card->stereo<<6; - tmp |= card->sap<<6; + tmp |= card->sap<<7; tmp |= card->mute ? 0x8 : 0x0; //normal mute tmp |= card->mute ? 0x10 : 0x0; //sap mute? - i2c_writereg8(card,card->audio.addr,0x06,tmp); + + i2c_writereg8(card,card->audio.addr,CON3ADDR,tmp); } if (card->audio.deviceid == TDA9851) { |
|
From: <gat...@li...> - 2005-02-09 17:27:27
|
Update of /cvsroot/gatos/avview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14652 Modified Files: Makefile.am alsa.c start_avview.desktop.in vbi.c Log Message: Switch to new KDE menu format. Cleanups Index: start_avview.desktop.in =================================================================== RCS file: /cvsroot/gatos/avview/start_avview.desktop.in,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- start_avview.desktop.in 30 Aug 2002 07:19:33 -0000 1.1 +++ start_avview.desktop.in 9 Feb 2005 17:27:03 -0000 1.2 @@ -3,6 +3,7 @@ Encoding=UTF-8 MimeType= Name[en_US]=AVview +GenericName=TV Viewer Path= ServiceTypes= SwallowExec= @@ -12,3 +13,4 @@ Type=Application X-KDE-SubstituteUID=false X-KDE-Username= +Categories=TV;AudioVideo;Video; Index: Makefile.am =================================================================== RCS file: /cvsroot/gatos/avview/Makefile.am,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- Makefile.am 26 Aug 2004 00:24:33 -0000 1.21 +++ Makefile.am 9 Feb 2005 17:27:02 -0000 1.22 @@ -48,8 +48,7 @@ echo 'Icon=$(datadir)/AVview/avview-48x48.png' >> start_avview.desktop install-data-hook: reminders - $(INSTALL_DATA) start_avview.desktop $(KDEDIR)/share/applnk/Multimedia/ || \ - $(INSTALL_DATA) start_avview.desktop $(KDEDIR)/share/apps/kappfinder/apps/Multimedia/ || \ + $(INSTALL_DATA) start_avview.desktop /usr/share/applications/ || \ true @echo "" @echo " ************************************************" Index: alsa.c =================================================================== RCS file: /cvsroot/gatos/avview/alsa.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- alsa.c 6 Oct 2004 12:10:23 -0000 1.39 +++ alsa.c 9 Feb 2005 17:27:03 -0000 1.40 @@ -518,7 +518,7 @@ snd_pcm_sw_params_t *swparams; const char *arg_audio_device; const char *arg_audio_rate; -long rate; +unsigned int rate; unsigned int buffer_time; int dir; snd_pcm_uframes_t uframes; @@ -532,7 +532,7 @@ arg_audio_rate=get_value(argc, argv, "-audio_rate"); rate=24000; /* should be ok.. */ -if(arg_audio_rate!=NULL)rate=atol(arg_audio_rate); +if(arg_audio_rate!=NULL)rate=(unsigned int)atol(arg_audio_rate); i=lookup_string(alsa_sc, arg_audio_device); if((i<0)||((ad=(ALSA_DATA *)alsa_sc->data[i])==NULL)){ @@ -583,10 +583,10 @@ dir=0; a=snd_pcm_hw_params_set_rate_near(ad->recording_handle, hwparams, &rate, &dir); if(a<0){ - fprintf(stderr,"Rate %ldHz not available for recording: %s\n", rate, snd_strerror(a)); + fprintf(stderr,"Rate %dHz not available for recording: %s\n", rate, snd_strerror(a)); return -1; } -param->sample_rate=rate; +param->sample_rate=(long)rate; param->channels=2; ad->param=param; fprintf(stderr,"Using sample rate %ld Hz frame_size=%ld\n", param->sample_rate, ad->frame_size); Index: vbi.c =================================================================== RCS file: /cvsroot/gatos/avview/vbi.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- vbi.c 10 Jul 2004 13:27:31 -0000 1.11 +++ vbi.c 9 Feb 2005 17:27:03 -0000 1.12 @@ -103,16 +103,16 @@ } } -void vbi_loop(VBI_DATA *data) +void *vbi_loop(void *vbidata) { +VBI_DATA *data=vbidata; int h,w; unsigned char *buf; vbi_sliced *buf_sliced; double timestamp; struct timeval tv; int r; -int lines,i; -DATAGRAM d; +int lines; pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL); @@ -126,12 +126,12 @@ r=vbi_capture_read(data->cap, buf, buf_sliced, &lines, ×tamp, &tv); if(r<0){ fprintf(stderr, "Exiting VBI loop\n"); - return; + return NULL; } pthread_mutex_lock(&(data->mutex)); if(data->dec==NULL){ pthread_mutex_unlock(&(data->mutex)); - return; /* close thread */ + return NULL; /* close thread */ } vbi_decode(data->dec, buf_sliced, lines, timestamp); pthread_mutex_unlock(&(data->mutex)); |
|
From: <gat...@li...> - 2005-02-09 16:53:45
|
Update of /cvsroot/gatos/avview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2397 Modified Files: xmisc.c Log Message: sizeof(long) == 8 bytes on 64-bit archs. This was causing a segfault right at the start on AMD64. Index: xmisc.c =================================================================== RCS file: /cvsroot/gatos/avview/xmisc.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- xmisc.c 3 Jan 2004 18:21:19 -0000 1.14 +++ xmisc.c 9 Feb 2005 16:53:34 -0000 1.15 @@ -327,7 +327,7 @@ return TCL_ERROR; } Tk_PhotoGetImage(image, &pib); -data=alloca(pib.width*pib.height*4+8); +data=alloca((pib.width*pib.height+2)*sizeof(long)); data[0]=pib.width; data[1]=pib.height; for(j=0;j<pib.height;j++){ |
|
From: <gat...@li...> - 2005-02-03 15:02:07
|
Update of /cvsroot/gatos/v4l2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14717 Modified Files: generic.c generic.h mach64.c Log Message: adds in the option to disabledma fixes probe for memory for older card Eric Index: generic.h =================================================================== RCS file: /cvsroot/gatos/v4l2/generic.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- generic.h 22 Jan 2005 13:59:03 -0000 1.2 +++ generic.h 3 Feb 2005 15:01:55 -0000 1.3 @@ -368,7 +368,8 @@ /* dma tables and frame buffers */ DMA_BM_TABLE *dma_table_buf0,*dma_table_buf1,*dma_table_buf2,*dma_table_buf3; DMA_BM_TABLE *dma_table_vbi; - u32 *framebuffer1,*framebuffer2, *vbidatabuffer; + //u32 *framebuffer1,*framebuffer2, *vbidatabuffer; + u8 *framebuffer1,*framebuffer2, *vbidatabuffer; int frame; /* which frame they want to capture to */ int whichfield; /* which field we just captured */ unsigned int field_count; Index: generic.c =================================================================== RCS file: /cvsroot/gatos/v4l2/generic.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- generic.c 22 Jan 2005 13:59:03 -0000 1.2 +++ generic.c 3 Feb 2005 15:01:55 -0000 1.3 @@ -54,6 +54,9 @@ int disablev4l2=0; MODULE_PARM(disablev4l2, "i"); MODULE_PARM_DESC(disablev4l2, "disable v4l2 support"); +int disabledma=0; +MODULE_PARM(disabledma, "i"); +MODULE_PARM_DESC(disabledma, "disable dma support"); int disableinterlace=0; MODULE_PARM(disableinterlace, "i"); MODULE_PARM_DESC(disableinterlace, "disable interlace modes"); @@ -941,7 +944,7 @@ /* if this is a poll for vbi make sure a vbi frame is ready */ if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { - if (card->status & STATUS_VBI_DMABUF_READY){ + if (disabledma || card->status & STATUS_VBI_DMABUF_READY){ return POLLIN|POLLRDNORM; } return 0; @@ -1364,19 +1367,21 @@ } } - down_interruptible(&card->lock); - // pass the dma_table to the card - MACH64_BM_SYSTEM_TABLE = virt_to_bus(ptr) | FRAME_BUFFER_TO_SYSTEM; + if (!disabledma) { + down_interruptible(&card->lock); + // pass the dma_table to the card + MACH64_BM_SYSTEM_TABLE = virt_to_bus(ptr) | FRAME_BUFFER_TO_SYSTEM; - //wait for dma to finish - /* this should transfer the vbi information as well */ - stall=0; - wait_event_interruptible(generic_wait, (card->status & STATUS_DMABUF_READY) - || (stall++ > 10)); - card->status &= ~STATUS_DMABUF_READY; + //wait for dma to finish + /* this should transfer the vbi information as well */ + stall=0; + wait_event_interruptible(generic_wait, (card->status & STATUS_DMABUF_READY) + || (stall++ > 10)); + card->status &= ~STATUS_DMABUF_READY; - // release the lock so we can transfer data again - up(&card->lock); + // release the lock so we can transfer data again + up(&card->lock); + } up(&card->lockcap); } @@ -1402,12 +1407,12 @@ down_interruptible(&card->lock); // odd vbi is 0 even is 1; whichfield = BTREAD(card,BT829_DSTATUS) & BT829_DSTATUS_FIELD; - - MACH64_BM_SYSTEM_TABLE = virt_to_bus(card->dma_table_vbi) | + if (!disabledma) { + MACH64_BM_SYSTEM_TABLE = virt_to_bus(card->dma_table_vbi) | FRAME_BUFFER_TO_SYSTEM; - wait_event_interruptible(generic_wait, (card->status & STATUS_DMABUF_READY)); - card->status &= ~STATUS_DMABUF_READY; - + wait_event_interruptible(generic_wait, (card->status & STATUS_DMABUF_READY)); + card->status &= ~STATUS_DMABUF_READY; + } up(&card->lock); up(&card->lockvbi); return whichfield; @@ -2408,9 +2413,11 @@ } /* tell the card we can do DMA transfers with any memory */ - if (pci_set_dma_mask(dev, 0xffffffff) != 0) { - printk(KERN_WARNING "genericv4l(%d): No suitable DMA available.\n", num_cards_detected); - return -EIO; + if (!disabledma) { + if (pci_set_dma_mask(dev, 0xffffffff) != 0) { + printk(KERN_WARNING "genericv4l(%d): No suitable DMA available.\n", num_cards_detected); + return -EIO; + } } /* reserve the cards i/o resources, tag is just a name to associate with this lock */ @@ -2421,6 +2428,7 @@ /* keep going it still might work! */ } + /* request end memory region 720x480x2 and 2 frames (so x2) */ if (!request_mem_region(pci_resource_start(dev,0) + pci_resource_len(dev,0) - 1382400, 1382400, @@ -2455,7 +2463,14 @@ one of the cards resources (change the number to get to others) */ /* since we are doing dma its we dont really need to map atifb... */ card->atifb=ioremap(pci_resource_start(dev, 0),pci_resource_len(dev, 0)); - card->MMR=ioremap(pci_resource_start(dev, 2),pci_resource_len(dev, 2)); + + if (pci_resource_start(dev, 2) == 0 || pci_resource_len(dev, 2) == 0) { + card->MMR = (u8*)(card->atifb + 0x007FF800); + printk(KERN_INFO "Using default value for mmr at atifb+0x007FF800\n"); + } else { + card->MMR=ioremap(pci_resource_start(dev, 2),pci_resource_len(dev, 2)); + } + card->MEM_0 = ((u32*)card->MMR)+256; card->MEM_1 = ((u32*)card->MMR); @@ -2552,44 +2567,46 @@ //should check cards max capture and set max size to that? //dma table can transfer 4096 per entry, so we need 150 entries to transfer //640*480*2 (614400/4096 = 150) each one has 256 so we have more than enough - card->dma_table_buf0 = kmalloc(sizeof(DMA_BM_TABLE) * 256,GFP_KERNEL); - card->dma_table_buf1 = kmalloc(sizeof(DMA_BM_TABLE) * 256,GFP_KERNEL); - card->dma_table_buf2 = kmalloc(sizeof(DMA_BM_TABLE) * 256,GFP_KERNEL); - card->dma_table_buf3 = kmalloc(sizeof(DMA_BM_TABLE) * 256,GFP_KERNEL); + if (!disabledma) { + card->dma_table_buf0 = kmalloc(sizeof(DMA_BM_TABLE) * 256,GFP_KERNEL); + card->dma_table_buf1 = kmalloc(sizeof(DMA_BM_TABLE) * 256,GFP_KERNEL); + card->dma_table_buf2 = kmalloc(sizeof(DMA_BM_TABLE) * 256,GFP_KERNEL); + card->dma_table_buf3 = kmalloc(sizeof(DMA_BM_TABLE) * 256,GFP_KERNEL); - /* 8 should hold enough for 32k and we need two one for each field */ - card->dma_table_vbi = kmalloc(sizeof(DMA_BM_TABLE) * 15,GFP_KERNEL); + /* 8 should hold enough for 32k and we need two one for each field */ + card->dma_table_vbi = kmalloc(sizeof(DMA_BM_TABLE) * 15,GFP_KERNEL); - if (card->dma_table_buf0 == NULL || card->dma_table_buf1 == NULL || - card->dma_table_buf2 == NULL || card->dma_table_buf3 == NULL || - card->dma_table_vbi == NULL){ - if (card->dma_table_buf0 != NULL) - kfree(card->dma_table_buf0); - else - printk("Could not allocate dma table 1\n"); - if (card->dma_table_buf1 != NULL) - kfree(card->dma_table_buf1); - else - printk("Could not allocate dma table 2\n"); - if (card->dma_table_buf2 != NULL) - kfree(card->dma_table_buf2); - else - printk("Could not allocate dma table 3\n"); - if (card->dma_table_buf3 != NULL) - kfree(card->dma_table_buf3); - else - printk("Could not allocate dma table 4\n"); + if (card->dma_table_buf0 == NULL || card->dma_table_buf1 == NULL || + card->dma_table_buf2 == NULL || card->dma_table_buf3 == NULL || + card->dma_table_vbi == NULL){ + if (card->dma_table_buf0 != NULL) + kfree(card->dma_table_buf0); + else + printk("Could not allocate dma table 1\n"); + if (card->dma_table_buf1 != NULL) + kfree(card->dma_table_buf1); + else + printk("Could not allocate dma table 2\n"); + if (card->dma_table_buf2 != NULL) + kfree(card->dma_table_buf2); + else + printk("Could not allocate dma table 3\n"); + if (card->dma_table_buf3 != NULL) + kfree(card->dma_table_buf3); + else + printk("Could not allocate dma table 4\n"); - if (card->dma_table_vbi != NULL) - kfree(card->dma_table_vbi); - else - printk("Could not allocate dma table for vbi\n"); + if (card->dma_table_vbi != NULL) + kfree(card->dma_table_vbi); + else + printk("Could not allocate dma table for vbi\n"); - iounmap(card->atifb); - iounmap(card->MMR); - release_mem_region(pci_resource_start(dev,2),pci_resource_len(dev,2)); - pci_set_drvdata(dev, NULL); - return -ENOMEM; + iounmap(card->atifb); + iounmap(card->MMR); + release_mem_region(pci_resource_start(dev,2),pci_resource_len(dev,2)); + pci_set_drvdata(dev, NULL); + return -ENOMEM; + } } /* override tunertype that we found with module param */ @@ -2598,29 +2615,6 @@ } set_tvnorm(card, card->tvnorm); - /* allocate space for two frames of max size eg 640*480*2) */ - card->fbmallocsize = generic_tvnorms[card->tvnorm].swidth * generic_tvnorms[card->tvnorm].sheight * 2; - /* make sure its a page size multiple, because i am grabing a buffer for each frame (v4l2) instead of one large buffer (v4l1) so v4l1 programs expect an offset ... blah blah blah i will fix it :) */ - card->fbmallocsize = (card->fbmallocsize + PAGE_SIZE -1) & ~(PAGE_SIZE -1); - - card->framebuffer1 = rvmalloc(card->fbmallocsize); - card->framebuffer2 = rvmalloc(card->fbmallocsize); - card->vbidatabuffer = rvmalloc(32768); - if (card->framebuffer1 == NULL || card->framebuffer2 == NULL || - card->vbidatabuffer == NULL){ - printk("Could not allocate dma buffer\n"); - kfree(card->dma_table_buf0); - kfree(card->dma_table_buf1); - kfree(card->dma_table_buf2); - kfree(card->dma_table_buf3); - kfree(card->dma_table_vbi); - iounmap(card->atifb); - iounmap(card->MMR); - release_mem_region(pci_resource_start(dev,2),pci_resource_len(dev,2)); - pci_set_drvdata(dev, NULL); - return -ENOMEM; - } - //set default values card->width=generic_tvnorms[card->tvnorm].swidth; card->height=generic_tvnorms[card->tvnorm].sheight; @@ -2644,6 +2638,48 @@ card->buffer1 = card->buffer0 - bufsize; card->vbibuffer = card->buffer1 - 32768; + /* allocate space for two frames of max size eg 640*480*2) */ + card->fbmallocsize = generic_tvnorms[card->tvnorm].swidth * generic_tvnorms[card->tvnorm].sheight * 2; + /* make sure its a page size multiple, because i am grabing a buffer for each frame (v4l2) instead of one large buffer (v4l1) so v4l1 programs expect an offset ... blah blah blah i will fix it :) */ + card->fbmallocsize = (card->fbmallocsize + PAGE_SIZE -1) & ~(PAGE_SIZE -1); + + if (!disabledma) { + card->framebuffer1 = rvmalloc(card->fbmallocsize); + card->framebuffer2 = rvmalloc(card->fbmallocsize); + card->vbidatabuffer = rvmalloc(32768); + if (card->framebuffer1 == NULL || card->framebuffer2 == NULL || + card->vbidatabuffer == NULL){ + printk("Could not allocate dma buffer\n"); + kfree(card->dma_table_buf0); + kfree(card->dma_table_buf1); + kfree(card->dma_table_buf2); + kfree(card->dma_table_buf3); + kfree(card->dma_table_vbi); + iounmap(card->atifb); + iounmap(card->MMR); + release_mem_region(pci_resource_start(dev,2),pci_resource_len(dev,2)); + pci_set_drvdata(dev, NULL); + return -ENOMEM; + } + } else { + /* no dma so just point to the cards memory and the copy + * routines will read it from there + * oh and make sure we capture on page boundaries :) */ + card->buffer0 = 1024*card->videoram - bufsize - 8000; + card->buffer0 = (card->buffer0 + PAGE_SIZE -1) & ~(PAGE_SIZE -1); + card->buffer1 = card->buffer0 - bufsize; + card->buffer1 = (card->buffer1 + PAGE_SIZE -1) & ~(PAGE_SIZE -1); + card->vbibuffer = card->buffer1 - 32768; + card->vbibuffer = (card->vbibuffer + PAGE_SIZE -1) & ~(PAGE_SIZE -1); + + card->framebuffer1 = (u8*) card->atifb+card->buffer0; + card->framebuffer2 = (u8*) card->atifb+card->buffer1; + card->vbidatabuffer = (u8*) card->atifb+card->vbibuffer; +printk (KERN_INFO "atifb is 0x%p\n", card->atifb); +printk (KERN_INFO "framebuffer1 is 0x%p\n", card->framebuffer1); +printk (KERN_INFO "framebuffer2 is 0x%p\n", card->framebuffer2); + } + //set location of capture buffers MACH64_CAPTURE_BUF0_OFFSET = card->buffer0; MACH64_CAPTURE_BUF1_OFFSET = card->buffer1; @@ -2654,13 +2690,15 @@ flags &= ~MACH64_VIDEO_IN; //clear video_in MACH64_VIDEO_FORMAT = flags | MACH64_VIDEO_VYUY422; - // build dma tables (dma table, from_addr, to_addr, bufsize) - build_dma_table(card->dma_table_buf0, card->buffer0,(unsigned long)card->framebuffer1, bufsize); - build_dma_table(card->dma_table_buf1, card->buffer1,(unsigned long)card->framebuffer1, bufsize); - build_dma_table(card->dma_table_buf2, card->buffer0,(unsigned long)card->framebuffer2, bufsize); - build_dma_table(card->dma_table_buf3, card->buffer1,(unsigned long)card->framebuffer2, bufsize); - // build the vbi buffers while we are at it - build_dma_table(card->dma_table_vbi, card->vbibuffer,(unsigned long)card->vbidatabuffer, 32768); + if (!disabledma) { + // build dma tables (dma table, from_addr, to_addr, bufsize) + build_dma_table(card->dma_table_buf0, card->buffer0,(unsigned long)card->framebuffer1, bufsize); + build_dma_table(card->dma_table_buf1, card->buffer1,(unsigned long)card->framebuffer1, bufsize); + build_dma_table(card->dma_table_buf2, card->buffer0,(unsigned long)card->framebuffer2, bufsize); + build_dma_table(card->dma_table_buf3, card->buffer1,(unsigned long)card->framebuffer2, bufsize); + // build the vbi buffers while we are at it + build_dma_table(card->dma_table_vbi, card->vbibuffer,(unsigned long)card->vbidatabuffer, 32768); + } /* add proc interface for this card */ sprintf (buf,"%d",card->cardnum); @@ -2895,14 +2933,16 @@ pci_set_drvdata(pci_dev, NULL); /* remove the dma table and frame memory */ - rvfree(card->framebuffer1,card->fbmallocsize); - rvfree(card->framebuffer2,card->fbmallocsize); - rvfree(card->vbidatabuffer,32768); - kfree(card->dma_table_buf0); - kfree(card->dma_table_buf1); - kfree(card->dma_table_buf2); - kfree(card->dma_table_buf3); - kfree(card->dma_table_vbi); + if (!disabledma) { + rvfree(card->framebuffer1,card->fbmallocsize); + rvfree(card->framebuffer2,card->fbmallocsize); + rvfree(card->vbidatabuffer,32768); + kfree(card->dma_table_buf0); + kfree(card->dma_table_buf1); + kfree(card->dma_table_buf2); + kfree(card->dma_table_buf3); + kfree(card->dma_table_vbi); + } /* free proc interface for this card */ sprintf (buf, "%d", card->cardnum); Index: mach64.c =================================================================== RCS file: /cvsroot/gatos/v4l2/mach64.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- mach64.c 22 Jan 2005 13:59:03 -0000 1.2 +++ mach64.c 3 Feb 2005 15:01:55 -0000 1.3 @@ -27,6 +27,9 @@ #include "mach64.h" #include "memory.h" +static const int videoRamSizes[] = + {0, 256, 512, 1024, 2*1024, 4*1024, 6*1024, 8*1024, 12*1024, 16*1024, 0}; + struct tuner_types generic_tuners[] = { { 0,1, NULL, NULL, NULL }, { 1,1, "Philips", "FI1236", "NTSC M/N" }, @@ -88,19 +91,6 @@ { u32 id; - card->videoram = MACH64_MEM_CNTL & 15; - if (card->videoram < 8) - card->videoram = 512*(card->videoram+1); - else if (card->videoram < 12) - card->videoram = 1024*(card->videoram-3); - else - card->videoram = 2048*(card->videoram-7); - - printk(KERN_INFO "videoram is %d\n",card->videoram); - - /* 8192 space for registers in framebuffer happens on pro version */ - card->vbibuffer = 1024*card->videoram - 32768 - 8192; - /* figure out what i2c mode to use */ if (i2c_init(card) != 0){ printk (KERN_ERR "Could not find i2c bus driver\n"); @@ -113,6 +103,27 @@ printk (KERN_INFO "genericv4l(%d): ati deviceid 0x%04X revision %d\n",card->cardnum,card->board.deviceid, card->board.revision); + /* for 264 CT ET VT GT we probe for memory differently + * I only know the id for 264VT though :) */ + if (card->board.deviceid == 0x5654) { + card->videoram = (MACH64_MEM_CNTL & 7) + 2; + card->videoram = videoRamSizes[card->videoram]; + } else { + card->videoram = MACH64_MEM_CNTL & 15; + if (card->videoram < 8) + card->videoram = 512*(card->videoram+1); + else if (card->videoram < 12) + card->videoram = 1024*(card->videoram-3); + else + card->videoram = 2048*(card->videoram-7); + } + + printk(KERN_INFO "videoram is %d\n",card->videoram); + + /* 8192 space for registers in framebuffer happens on pro version */ + card->vbibuffer = 1024*card->videoram - 32768 - 8192; + + /* find board address */ card->board.addr = 0x70; //standalone card card->boardinfo = 0xFF; @@ -564,33 +575,28 @@ /* set crop register based on tuner type and size of image capture */ switch (card->tuner) { - case 1: case 2: case 12: /* NTSC M/N and NTSC Japan */ - case 6: /* NTSC M/N Mk2 */ - case 8: /* NTSC M/N (Samsung) */ - case 16: case 17: /* NTSC M/N */ - case 18: /* NTSC M/N with FM */ - if (card->width <= 320){ - BTWRITE(card,BT829_CROP,0x11); - } else { - BTWRITE(card,BT829_CROP,0x12); - } - break; case 3: case 4: case 9: case 10: /* PAL B/G and PAL I */ case 7: /* SECAM D/K */ case 5: case 11: /* PAL B/G, SECAM L/L' */ case 13: /* PAL I/B/G/DK, SECAM D/K */ - if (card->width <= 320){ + if (card->width <= generic_tvnorms[card->tvnorm].swidth / 2){ BTWRITE(card,BT829_CROP,0x21); } else { BTWRITE(card,BT829_CROP,0x23); } break; + /* NTSC M/N and NTSC Japan */ + /* NTSC M/N Mk2 */ + /* NTSC M/N (Samsung) */ + /* NTSC M/N */ + /* NTSC M/N with FM */ default: - if (card->width <= 320){ + if (card->width <= generic_tvnorms[card->tvnorm].swidth / 2){ BTWRITE(card,BT829_CROP,0x11); } else { BTWRITE(card,BT829_CROP,0x12); } + break; } //if less than half height then do not interlace |
|
From: <gat...@li...> - 2005-01-22 13:59:26
|
Update of /cvsroot/gatos/v4l2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28771 Modified Files: generic.c generic.h mach64.c Log Message: Changes remap_page_range to remap_pfn_range for 2.6.10 and above kernels Attempt to get vbi capture working for more than just NTSC tuners. (removes some of the hard coded values) Eric Index: generic.h =================================================================== RCS file: /cvsroot/gatos/v4l2/generic.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- generic.h 11 Jan 2005 21:11:07 -0000 1.1.1.1 +++ generic.h 22 Jan 2005 13:59:03 -0000 1.2 @@ -406,7 +406,7 @@ unsigned int cmd, void *arg); void i2c_vidiocschan(GENERIC_CARD *card); int set_tvnorm(GENERIC_CARD *card, unsigned int norm); -void generic_vbi_try_fmt(GENERIC_FH *fh, struct v4l2_format *f); +void generic_vbi_try_fmt(GENERIC_FH *fh, GENERIC_CARD *card, struct v4l2_format *f); void generic_enable_vbi(GENERIC_CARD *card); void generic_disable_vbi(GENERIC_CARD *card); void generic_enable_capture(GENERIC_CARD *card); Index: generic.c =================================================================== RCS file: /cvsroot/gatos/v4l2/generic.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- generic.c 11 Jan 2005 21:11:07 -0000 1.1.1.1 +++ generic.c 22 Jan 2005 13:59:03 -0000 1.2 @@ -894,13 +894,17 @@ } } while (size > 0){ - page = kvirt_to_pa(pos); #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) + page = kvirt_to_pa(pos); if (remap_page_range(start,page,PAGE_SIZE, PAGE_SHARED)) { #else +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) + page = kvirt_to_pa(pos); if (remap_page_range(vma,start,page,PAGE_SIZE, PAGE_SHARED)) { -// page = page_to_pfn(vmalloc_to_page((void *)pos)); -// if (remap_pfn_range(vma,start,page,PAGE_SIZE, PAGE_SHARED)) { +#else + page = page_to_pfn(vmalloc_to_page((void *)pos)); + if (remap_pfn_range(vma,start,page,PAGE_SIZE, PAGE_SHARED)) { +#endif #endif printk(KERN_INFO "remap page range failed"); up(&card->lock); @@ -1162,28 +1166,26 @@ void generic_vbi_setlines(GENERIC_FH *fh, GENERIC_CARD *card, int lines) { - int vdelay; + int vdelay; - if (lines < 1) - lines = 1; - if (lines > VBI_MAXLINES) - lines = VBI_MAXLINES; - fh->lines = lines; + if (lines < 1) + lines = 1; + if (lines > VBI_MAXLINES) + lines = VBI_MAXLINES; + fh->lines = lines; - vdelay = BTREAD(card,BT829_VDELAY_LO); - if (vdelay < lines*2) { - vdelay = lines*2; - BTWRITE(card,BT829_VDELAY_LO,vdelay); - } + vdelay = BTREAD(card,BT829_VDELAY_LO); + if (vdelay < lines*2) { + vdelay = lines*2; + BTWRITE(card,BT829_VDELAY_LO,vdelay); + } } - - -void generic_vbi_get_fmt(GENERIC_FH *fh, struct v4l2_format *f) +void generic_vbi_get_fmt(GENERIC_FH *fh, GENERIC_CARD *card, struct v4l2_format *f) { memset(f,0,sizeof(*f)); f->type = V4L2_BUF_TYPE_VBI_CAPTURE; - f->fmt.vbi.sampling_rate = 35468950; + f->fmt.vbi.sampling_rate = generic_tvnorms[card->tvnorm].Fsc; f->fmt.vbi.samples_per_line = 2048; f->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY; f->fmt.vbi.offset = 244; @@ -1203,12 +1205,12 @@ } } -void generic_vbi_try_fmt(GENERIC_FH *fh, struct v4l2_format *f) +void generic_vbi_try_fmt(GENERIC_FH *fh, GENERIC_CARD *card, struct v4l2_format *f) { u32 start0,start1,count; f->type = V4L2_BUF_TYPE_VBI_CAPTURE; - f->fmt.vbi.sampling_rate = 35468950; + f->fmt.vbi.sampling_rate = generic_tvnorms[card->tvnorm].Fsc; f->fmt.vbi.samples_per_line = 2048; f->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY; f->fmt.vbi.offset = 244; @@ -1254,6 +1256,7 @@ f->fmt.pix.height * f->fmt.pix.bytesperline; return 0; case V4L2_BUF_TYPE_VBI_CAPTURE: + generic_vbi_get_fmt(fh,card,f); return 0; default: return -EINVAL; @@ -1632,20 +1635,28 @@ case VIDIOCGVBIFMT: { struct vbi_format *fmt = (void *) arg; + struct v4l2_format fmt2; + +/* check if we are in capture mode and switch to vbi mode?? */ + + generic_vbi_get_fmt(fh,card, &fmt2); /* no idea what these numbers are :) i will just try to make it work with ntsc for now */ - fmt->sampling_rate = 35468950; - fmt->samples_per_line = 2048; + memset(fmt,0,sizeof(*fmt)); + fmt->sampling_rate = fmt2.fmt.vbi.sampling_rate; + fmt->samples_per_line = fmt2.fmt.vbi.samples_per_line; fmt->sample_format = VIDEO_PALETTE_RAW; - fmt->start[0] = 10; - fmt->count[0] = 16; - fmt->start[1] = 273; - fmt->count[1] = 16; - fmt->flags = 0; - /* use card->tvnorm to set different starts for pal/secam */ + fmt->start[0] = fmt2.fmt.vbi.start[0]; + fmt->count[0] = fmt2.fmt.vbi.count[0]; + fmt->start[1] = fmt2.fmt.vbi.start[1]; + fmt->count[1] = fmt2.fmt.vbi.count[1]; +// if (fmt2.fmt.vbi.flags & VBI_UNSYNC) +// fmt->flags |= V4L2_VBI_UNSYNC; +// if (fmt2.fmt.vbi.flags & VBI_INTERLACED) +// fmt->flags |= V4L2_VBI_INTERLACED; -dprintk(1,"card(%d) VIDIOCGVBIFMT called (not done yet)\n",card->cardnum); +dprintk(1,"card(%d) VIDIOCGVBIFMT called \n",card->cardnum); return 0; } @@ -1921,10 +1932,13 @@ } break; case V4L2_BUF_TYPE_VBI_CAPTURE: -dprintk(1,"card(%d) V4L2_BUF_TYPE_VBI_CAPTURE inside VIDIOC_S_FMT (not done)\n",card->cardnum); +dprintk(1,"card(%d) V4L2_BUF_TYPE_VBI_CAPTURE inside VIDIOC_S_FMT\n",card->cardnum); + generic_vbi_try_fmt(fh,card,f); + generic_vbi_setlines(fh,card,f->fmt.vbi.count[0]); + generic_vbi_get_fmt(fh,card,f); break; default: - return -EINVAL; + return -EINVAL; } return 0; Index: mach64.c =================================================================== RCS file: /cvsroot/gatos/v4l2/mach64.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- mach64.c 11 Jan 2005 21:11:06 -0000 1.1.1.1 +++ mach64.c 22 Jan 2005 13:59:03 -0000 1.2 @@ -531,15 +531,7 @@ /* vbi stuff here we use oneshot to record vbi info */ MACH64_VBI_START_END = XY(20,6); -/* okay ccdecoder thinks lines are 2048 long and it expects cc data on -line 11, 11 * 2048 = 22528 -But we are capturing from line 10 to line 20 and cc data is on line 17 -So we have to make the width for 7 lines = 22528 -22528 / 7 = 3218 which is 0xC92 so we use that for the width -or we can just start capturing from line 6... */ -//MACH64_VBI_WIDTH = 0x00000C92; /* 3218 */ -MACH64_VBI_WIDTH = 2048; /* 3218 */ -//MACH64_ONESHOT_BUF_OFFSET = card->vbibuffer; /* set it to store to vbibuffer*/ +MACH64_VBI_WIDTH = 2048; /* set capture size, should be using card->width card->height */ MACH64_CAPTURE_X_WIDTH = XY(2*card->width,0); |
|
From: <gat...@li...> - 2005-01-17 09:57:30
|
Update of /cvsroot/gatos/ati.4.4.0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12638 Modified Files: Tag: r200_branch theatre200.c Log Message: Modified the place for the printouts for GPIO registers. Index: theatre200.c =================================================================== RCS file: /cvsroot/gatos/ati.4.4.0/Attic/theatre200.c,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -u -d -r1.1.2.6 -r1.1.2.7 --- theatre200.c 14 Jan 2005 18:26:06 -0000 1.1.2.6 +++ theatre200.c 17 Jan 2005 09:57:11 -0000 1.1.2.7 @@ -5,6 +5,9 @@ * License: GPL * * $Log$ + * Revision 1.1.2.7 2005/01/17 09:57:11 bogdand + * Modified the place for the printouts for GPIO registers. + * * Revision 1.1.2.6 2005/01/14 18:26:06 bogdand * Added commands to drive the analog mux used for sound (4052) * @@ -1589,13 +1592,6 @@ t->wStandard = wStandard; - theatre_read(t, 0x30, &data); - xf86DrvMsg(t->VIP->scrnIndex,X_INFO,"REGISTER 0x30: %x\n", data); - - theatre_read(t, 0x34, &data); - xf86DrvMsg(t->VIP->scrnIndex,X_INFO,"REGISTER 0x34: %x\n", data); - - /* Program the new standards: */ switch (wStandard & 0x00FF) { @@ -1734,6 +1730,12 @@ t->wConnector = wConnector; + theatre_read(t, VIP_GPIO_CNTL, &data); + xf86DrvMsg(t->VIP->scrnIndex,X_INFO,"VIP_GPIO_CNTL: %x\n", data); + + theatre_read(t, VIP_GPIO_INOUT, &data); + xf86DrvMsg(t->VIP->scrnIndex,X_INFO,"VIP_GPIO_INOUT: %x\n", data); + switch (wConnector) { case (DEC_TUNER): /* Tuner*/ @@ -1780,6 +1782,13 @@ dsp_set_video_input_connector(t, t->wComp0Connector); } + theatre_read(t, VIP_GPIO_CNTL, &data); + xf86DrvMsg(t->VIP->scrnIndex,X_INFO,"VIP_GPIO_CNTL: %x\n", data); + + theatre_read(t, VIP_GPIO_INOUT, &data); + xf86DrvMsg(t->VIP->scrnIndex,X_INFO,"VIP_GPIO_INOUT: %x\n", data); + + dsp_configure_i2s_port(t, 0, 0, 0); dsp_configure_spdif_port(t, 0); |
|
From: <gat...@li...> - 2005-01-17 09:55:28
|
Update of /cvsroot/gatos/ati.4.4.0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12341 Modified Files: Tag: r200_branch radeon_video.c Log Message: When changing the frequency do a mute of UDA1380 before and unmute after. This is to avoid plops Index: radeon_video.c =================================================================== RCS file: /cvsroot/gatos/ati.4.4.0/radeon_video.c,v retrieving revision 1.6.2.12 retrieving revision 1.6.2.13 diff -u -d -r1.6.2.12 -r1.6.2.13 --- radeon_video.c 13 Jan 2005 13:56:57 -0000 1.6.2.12 +++ radeon_video.c 17 Jan 2005 09:55:15 -0000 1.6.2.13 @@ -2565,6 +2565,7 @@ CARD32 data; pPriv->frequency = value; /* mute volume if it was not muted before */ + if((pPriv->uda1380!=NULL)&& !pPriv->mute)xf86_uda1380_mute(pPriv->uda1380, TRUE); if((pPriv->msp3430!=NULL)&& !pPriv->mute)xf86_MSP3430SetVolume(pPriv->msp3430, MSP3430_FAST_MUTE); if(pPriv->fi1236 != NULL) xf86_TUNER_set_frequency(pPriv->fi1236, value); /* if(pPriv->theatre != NULL) RADEON_RT_SetEncoding(pScrn, pPriv); */ @@ -2572,6 +2573,7 @@ if((pPriv->msp3430 != NULL) && (pPriv->msp3430->recheck)) xf86_InitMSP3430(pPriv->msp3430); if((pPriv->msp3430 != NULL)&& !pPriv->mute) xf86_MSP3430SetVolume(pPriv->msp3430, MSP3430_VOLUME(pPriv->volume)); + if((pPriv->uda1380 != NULL)&& !pPriv->mute) xf86_uda1380_setvolume(pPriv->uda1380, pPriv->volume); } else if(attribute == xvMute) { pPriv->mute = value; @@ -3719,8 +3721,7 @@ case 3: t->standard_video_if=2; t->standard_sound_carrier=1; - /* t->modulation=0; */ /* positive AM */ - t->modulation=2; /* negative FM */ + t->modulation=2; /* negative FM */ break; /* NTSC */ case 4: @@ -3728,7 +3729,7 @@ case 6: t->standard_video_if=1; t->standard_sound_carrier=0; - t->modulation=2; /* negative FM */ + t->modulation=2; /* negative FM */ break; /* SECAM */ case 7: |