Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 479 → Rev 480

/shark/trunk/drivers/bttv/bttv-driver.c
614,16 → 614,16
return 1;
 
/* is it free? */
down(&btv->reslock);
//down(&btv->reslock);
if (btv->resources & bit) {
/* no, someone else uses it */
up(&btv->reslock);
//up(&btv->reslock);
return 0;
}
/* it's free, grab it */
fh->resources |= bit;
btv->resources |= bit;
up(&btv->reslock);
//up(&btv->reslock);
return 1;
}
 
648,10 → 648,10
printk("bttv: BUG! (btres)\n");
}
#endif
down(&btv->reslock);
//down(&btv->reslock);
fh->resources &= ~bits;
btv->resources &= ~bits;
up(&btv->reslock);
//up(&btv->reslock);
}
 
/* ----------------------------------------------------------------------- */
1417,12 → 1417,12
case VIDIOCSFREQ:
{
unsigned long *freq = arg;
down(&btv->lock);
//down(&btv->lock);
btv->freq=*freq;
bttv_call_i2c_clients(btv,VIDIOCSFREQ,freq);
if (btv->has_matchbox && btv->radio_user)
tea5757_set_freq(btv,*freq);
up(&btv->lock);
//up(&btv->lock);
return 0;
}
 
1452,10 → 1452,10
if (v->mode >= BTTV_TVNORMS)
return -EINVAL;
 
down(&btv->lock);
//down(&btv->lock);
set_tvnorm(btv,v->mode);
bttv_call_i2c_clients(btv,cmd,v);
up(&btv->lock);
//up(&btv->lock);
return 0;
}
1492,17 → 1492,17
if (v->norm >= BTTV_TVNORMS)
return -EINVAL;
 
down(&btv->lock);
//down(&btv->lock);
if (channel == btv->input &&
v->norm == btv->tvnorm) {
/* nothing to do */
up(&btv->lock);
//up(&btv->lock);
return 0;
}
 
btv->tvnorm = v->norm;
set_input(btv,v->channel);
up(&btv->lock);
//up(&btv->lock);
return 0;
}
 
1515,7 → 1515,7
v->flags |= VIDEO_AUDIO_MUTABLE;
v->mode = VIDEO_SOUND_MONO;
 
down(&btv->lock);
//down(&btv->lock);
bttv_call_i2c_clients(btv,cmd,v);
 
/* card specific hooks */
1522,7 → 1522,7
if (btv->audio_hook)
btv->audio_hook(btv,v,0);
 
up(&btv->lock);
//up(&btv->lock);
return 0;
}
case VIDIOCSAUDIO:
1533,7 → 1533,7
if (audio >= bttv_tvcards[btv->type].audio_inputs)
return -EINVAL;
 
down(&btv->lock);
//down(&btv->lock);
audio_mux(btv, (v->flags&VIDEO_AUDIO_MUTE) ? AUDIO_MUTE : AUDIO_UNMUTE);
bttv_call_i2c_clients(btv,cmd,v);
 
1541,7 → 1541,7
if (btv->audio_hook)
btv->audio_hook(btv,v,1);
up(&btv->lock);
//up(&btv->lock);
return 0;
}
 
1575,10 → 1575,10
if (i == BTTV_TVNORMS)
return -EINVAL;
 
down(&btv->lock);
//down(&btv->lock);
set_tvnorm(btv,i);
i2c_vidiocschan(btv);
up(&btv->lock);
//up(&btv->lock);
return 0;
}
case VIDIOC_QUERYSTD:
1636,10 → 1636,10
if (*i > bttv_tvcards[btv->type].video_inputs)
return -EINVAL;
down(&btv->lock);
//down(&btv->lock);
set_input(btv,*i);
i2c_vidiocschan(btv);
up(&btv->lock);
//up(&btv->lock);
return 0;
}
1651,7 → 1651,7
return -EINVAL;
if (0 != t->index)
return -EINVAL;
down(&btv->lock);
//down(&btv->lock);
memset(t,0,sizeof(*t));
strcpy(t->name, "Television");
t->type = V4L2_TUNER_ANALOG_TV;
1678,7 → 1678,7
}
}
/* FIXME: fill capability+audmode */
up(&btv->lock);
//up(&btv->lock);
return 0;
}
case VIDIOC_S_TUNER:
1689,7 → 1689,7
return -EINVAL;
if (0 != t->index)
return -EINVAL;
down(&btv->lock);
//down(&btv->lock);
{
struct video_audio va;
memset(&va, 0, sizeof(struct video_audio));
1706,7 → 1706,7
if (btv->audio_hook)
btv->audio_hook(btv,&va,1);
}
up(&btv->lock);
//up(&btv->lock);
return 0;
}
 
1727,12 → 1727,12
return -EINVAL;
if (unlikely(f->type != V4L2_TUNER_ANALOG_TV))
return -EINVAL;
down(&btv->lock);
//down(&btv->lock);
btv->freq = f->frequency;
bttv_call_i2c_clients(btv,VIDIOCSFREQ,&btv->freq);
if (btv->has_matchbox && btv->radio_user)
tea5757_set_freq(btv,btv->freq);
up(&btv->lock);
//up(&btv->lock);
return 0;
}
 
1832,7 → 1832,7
BUG();
}
down(&fh->cap.lock);
//down(&fh->cap.lock);
if (fh->ov.clips)
kfree(fh->ov.clips);
fh->ov.clips = clips;
1854,7 → 1854,7
bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new);
retval = bttv_switch_overlay(btv,fh,new);
}
up(&fh->cap.lock);
//up(&fh->cap.lock);
return retval;
}
 
2021,7 → 2021,7
fmt = format_by_fourcc(f->fmt.pix.pixelformat);
/* update our state informations */
down(&fh->cap.lock);
//down(&fh->cap.lock);
fh->fmt = fmt;
fh->cap.field = f->fmt.pix.field;
fh->cap.last = V4L2_FIELD_NONE;
2030,7 → 2030,7
btv->init.fmt = fmt;
btv->init.width = f->fmt.pix.width;
btv->init.height = f->fmt.pix.height;
up(&fh->cap.lock);
//up(&fh->cap.lock);
return 0;
}
2145,7 → 2145,7
fmt = format_by_palette(pic->palette);
if (NULL == fmt)
return -EINVAL;
down(&fh->cap.lock);
//down(&fh->cap.lock);
if (fmt->depth != pic->depth && !sloppy) {
retval = -EINVAL;
goto fh_unlock_and_return;
2167,7 → 2167,7
bt848_contrast(btv,pic->contrast);
bt848_hue(btv,pic->hue);
bt848_sat(btv,pic->colour);
up(&fh->cap.lock);
//up(&fh->cap.lock);
return 0;
}
 
2228,7 → 2228,7
return -EPERM;
end = (unsigned long)fbuf->base +
fbuf->height * fbuf->bytesperline;
down(&fh->cap.lock);
//down(&fh->cap.lock);
retval = -EINVAL;
if (sloppy) {
/* also set the default palette -- for backward
2274,7 → 2274,7
btv->fbuf.fmt.bytesperline = fbuf->bytesperline;
else
btv->fbuf.fmt.bytesperline = btv->fbuf.fmt.width*fbuf->depth/8;
up(&fh->cap.lock);
//up(&fh->cap.lock);
return 0;
}
 
2297,7 → 2297,7
if (!check_alloc_btres(btv,fh,RESOURCE_OVERLAY))
return -EBUSY;
down(&fh->cap.lock);
//down(&fh->cap.lock);
if (*on) {
fh->ov.tvnorm = btv->tvnorm;
new = videobuf_alloc(sizeof(*new));
2308,7 → 2308,7
 
/* switch over */
retval = bttv_switch_overlay(btv,fh,new);
up(&fh->cap.lock);
//up(&fh->cap.lock);
return retval;
}
 
2317,7 → 2317,7
struct video_mbuf *mbuf = arg;
unsigned int i;
 
down(&fh->cap.lock);
//down(&fh->cap.lock);
retval = videobuf_mmap_setup(file,&fh->cap,gbuffers,gbufsize,
V4L2_MEMORY_MMAP);
if (retval < 0)
2327,7 → 2327,7
mbuf->size = gbuffers * gbufsize;
for (i = 0; i < gbuffers; i++)
mbuf->offsets[i] = i * gbufsize;
up(&fh->cap.lock);
//up(&fh->cap.lock);
return 0;
}
case VIDIOCMCAPTURE:
2339,7 → 2339,7
if (vm->frame >= VIDEO_MAX_FRAME)
return -EINVAL;
 
down(&fh->cap.lock);
//down(&fh->cap.lock);
retval = -EINVAL;
buf = (struct bttv_buffer *)fh->cap.bufs[vm->frame];
if (NULL == buf)
2361,7 → 2361,7
spin_lock_irqsave(&btv->s_lock,flags);
buffer_queue(file,&buf->vb);
spin_unlock_irqrestore(&btv->s_lock,flags);
up(&fh->cap.lock);
//up(&fh->cap.lock);
return 0;
}
case VIDIOCSYNC:
2372,7 → 2372,7
if (*frame >= VIDEO_MAX_FRAME)
return -EINVAL;
 
down(&fh->cap.lock);
//down(&fh->cap.lock);
retval = -EINVAL;
buf = (struct bttv_buffer *)fh->cap.bufs[*frame];
if (NULL == buf)
2392,7 → 2392,7
retval = -EINVAL;
break;
}
up(&fh->cap.lock);
//up(&fh->cap.lock);
return retval;
}
 
2570,7 → 2570,7
if (0 == (fmt->flags & FORMAT_FLAGS_PACKED))
return -EINVAL;
 
down(&fh->cap.lock);
//down(&fh->cap.lock);
retval = -EINVAL;
if (fb->flags & V4L2_FBUF_FLAG_OVERLAY) {
if (fb->fmt.width > bttv_tvnorms[btv->tvnorm].swidth)
2611,7 → 2611,7
retval = bttv_switch_overlay(btv,fh,new);
}
}
up(&fh->cap.lock);
//up(&fh->cap.lock);
return retval;
}
 
2743,7 → 2743,7
return 0;
 
fh_unlock_and_return:
up(&fh->cap.lock);
//up(&fh->cap.lock);
return retval;
}
 
2808,28 → 2808,28
buf = list_entry(fh->cap.stream.next,struct bttv_buffer,vb.stream);
} else {
/* read() capture */
down(&fh->cap.lock);
//down(&fh->cap.lock);
if (NULL == fh->cap.read_buf) {
/* need to capture a new frame */
if (locked_btres(fh->btv,RESOURCE_VIDEO)) {
up(&fh->cap.lock);
//up(&fh->cap.lock);
return POLLERR;
}
fh->cap.read_buf = videobuf_alloc(fh->cap.msize);
if (NULL == fh->cap.read_buf) {
up(&fh->cap.lock);
//up(&fh->cap.lock);
return POLLERR;
}
fh->cap.read_buf->memory = V4L2_MEMORY_USERPTR;
field = videobuf_next_field(&fh->cap);
if (0 != fh->cap.ops->buf_prepare(file,fh->cap.read_buf,field)) {
up(&fh->cap.lock);
//up(&fh->cap.lock);
return POLLERR;
}
fh->cap.ops->buf_queue(file,fh->cap.read_buf);
fh->cap.read_off = 0;
}
up(&fh->cap.lock);
//up(&fh->cap.lock);
buf = (struct bttv_buffer*)fh->cap.read_buf;
}
3001,9 → 3001,9
return -ENODEV;
 
dprintk("bttv%d: open called (radio)\n",btv->nr);
down(&btv->lock);
//down(&btv->lock);
if (btv->radio_user) {
up(&btv->lock);
//up(&btv->lock);
return -EBUSY;
}
btv->radio_user++;
3013,7 → 3013,7
bttv_call_i2c_clients(btv,AUDC_SET_RADIO,&btv->tuner_type);
audio_mux(btv,AUDIO_RADIO);
 
up(&btv->lock);
//up(&btv->lock);
return 0;
}