- Restore functional audio on PVR-150 video capture cards (#666456) - Fix another mceusb regression cropping up mostly with rc5 signals (#662071) - Add back some ir-lirc-codec debug spew Signed-off-by: Jarod Wilson <jarod@redhat.com>
1374 lines
40 KiB
Diff
1374 lines
40 KiB
Diff
There are a few patches here... Two are upstream, three are not yet,
|
|
but will be soon...
|
|
|
|
--jarod
|
|
|
|
From upstream:
|
|
commit 692e42df12e8427219958468301f3d03ca5f0f0d
|
|
Author: Brandon Philips <brandon@ifup.org>
|
|
Date: Fri Dec 17 12:58:22 2010 -0300
|
|
|
|
[media] bttv: remove unneeded locking comments
|
|
|
|
After Mauro's "bttv: Fix locking issues due to BKL removal code" there
|
|
are a number of comments that are no longer needed about lock ordering.
|
|
Remove them.
|
|
|
|
Signed-off-by: Brandon Philips <bphilips@suse.de>
|
|
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
|
|
|
|
commit 587f0d5d6d44e3529028bf197d424f866fb2411d
|
|
Author: Mauro Carvalho Chehab <mchehab@infradead.org>
|
|
Date: Wed Dec 15 18:45:42 2010 -0300
|
|
|
|
[media] bttv: fix mutex use before init (BZ#24602)
|
|
|
|
Fix a regression where bttv driver causes oopses when loading, since it
|
|
were using some non-initialized mutexes. While it would be possible to
|
|
fix the issue, there are some other lock troubles, like to the presence of
|
|
lock code at free_btres_lock().
|
|
|
|
It is possible to fix, but the better is to just use the core-assisted
|
|
locking schema. This way, V4L2 core will serialize access to all
|
|
ioctl's/open/close/mmap/read/poll operations, avoiding to have two
|
|
processes accessing the hardware at the same time. Also, as there's just
|
|
one lock, instead of 3, there's no risk of dead locks.
|
|
|
|
The net result is a cleaner code, with just one lock.
|
|
|
|
Reported-by: Dan Carpenter <error27@gmail.com>
|
|
Reported-by: Brandon Philips<brandon@ifup.org>
|
|
Reported-by: Chris Clayton <chris2553@googlemail.com>
|
|
Reported-by: Torsten Kaiser <just.for.lkml@googlemail.com>
|
|
Tested-by: Chris Clayton <chris2553@googlemail.com>
|
|
Tested-by: Torsten Kaiser <just.for.lkml@googlemail.com>
|
|
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
|
|
|
|
commit 46e67acd5d4cacda758e871eebd15cef4e2c2665
|
|
Author: Mauro Carvalho Chehab <mchehab@redhat.com>
|
|
Date: Mon 3 Jan 11:09:56 2011 -0200
|
|
|
|
[media] wm8775: Revert changeset fcb9757333 to avoid a regression
|
|
|
|
It seems that cx88 and ivtv use wm8775 on some different modes. The
|
|
patch that added support for a board with wm8775 broke ivtv boards with
|
|
this device. As we're too close to release 2.6.37, let's just revert
|
|
it.
|
|
|
|
Reported-by: Andy Walls <awalls@md.metrocast.net>
|
|
Reported-by: Eric Sharkey <eric@lisaneric.org>
|
|
Reported-by: Auric <auric@aanet.com.au>
|
|
Reported by: David Gesswein <djg@pdp8online.com>
|
|
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
|
|
|
|
|
|
Not yet upstream:
|
|
commit b8f82c5b7258f0d82102347c52c8f4144ec03990
|
|
Author: Kyle McMartin <kylem@redhat.com>
|
|
Date: Fri Dec 31 00:32:08 2010 -0500
|
|
|
|
rc/ene_ir: fix oops on module load
|
|
|
|
dev->rdev is accessed in ene_setup_hw_settings, so it needs to be wired
|
|
up before then. Also fix a possible improper resource freeing bug.
|
|
|
|
Signed-off-by: Jarod Wilson <jarod@redhat.com>
|
|
|
|
commit e47a4d6dd9429c817a393fafc79259450a423c8b
|
|
Author: Jarod Wilson <jarod@redhat.com>
|
|
Date: Thu Dec 30 23:21:08 2010 -0500
|
|
|
|
rc/imon: need to submit urb before ffdc type check
|
|
|
|
Otherwise, we have a null receive buffer, and the logic all falls down,
|
|
goes boom, all ffdc devs wind up as imon IR w/VFD. Oops.
|
|
|
|
Signed-off-by: Jarod Wilson <jarod@redhat.com>
|
|
|
|
commit 8d52511af719eace80cc75258d9adff4fa9b5bb7
|
|
Author: Jarod Wilson <jarod@redhat.com>
|
|
Date: Mon Dec 27 23:04:02 2010 -0500
|
|
|
|
rc/imon: fix ffdc device detection oops
|
|
|
|
There's a nasty bug that slipped in when the rc device interface was
|
|
altered, only affecting the older 0xffdc imon devices. We were trying
|
|
to access ictx->rdev->allowed_protos before ictx->rdev had been set.
|
|
|
|
There's also an issue with call ordering that meant the correct
|
|
keymap wasn't getting loaded for MCE IR type 0xffdc devices.
|
|
|
|
Signed-off-by: Jarod Wilson <jarod@redhat.com>
|
|
|
|
commit 183cb1bc602b95cb4b65004608ad637a8f07d724
|
|
Author: Jarod Wilson <jarod@redhat.com>
|
|
Date: Wed Jan 5 10:16:13 2011 -0500
|
|
|
|
rc/ir-lirc-codec: add back debug spew
|
|
|
|
Some occasionally useful debug spew disappeared as part of a feature
|
|
update a while back, and I'm finding myself in need of it again to help
|
|
diagnose some issues.
|
|
|
|
Signed-off-by: Jarod Wilson <jarod@redhat.com>
|
|
|
|
|
|
|
|
Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
|
|
===================================================================
|
|
--- linux-2.6.35.x86_64.orig/drivers/media/video/bt8xx/bttv-driver.c
|
|
+++ linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
|
|
@@ -855,7 +855,6 @@ int check_alloc_btres_lock(struct bttv *
|
|
xbits |= RESOURCE_VIDEO_READ | RESOURCE_VIDEO_STREAM;
|
|
|
|
/* is it free? */
|
|
- mutex_lock(&btv->lock);
|
|
if (btv->resources & xbits) {
|
|
/* no, someone else uses it */
|
|
goto fail;
|
|
@@ -885,11 +884,9 @@ int check_alloc_btres_lock(struct bttv *
|
|
/* it's free, grab it */
|
|
fh->resources |= bit;
|
|
btv->resources |= bit;
|
|
- mutex_unlock(&btv->lock);
|
|
return 1;
|
|
|
|
fail:
|
|
- mutex_unlock(&btv->lock);
|
|
return 0;
|
|
}
|
|
|
|
@@ -941,7 +938,6 @@ void free_btres_lock(struct bttv *btv, s
|
|
/* trying to free ressources not allocated by us ... */
|
|
printk("bttv: BUG! (btres)\n");
|
|
}
|
|
- mutex_lock(&btv->lock);
|
|
fh->resources &= ~bits;
|
|
btv->resources &= ~bits;
|
|
|
|
@@ -952,8 +948,6 @@ void free_btres_lock(struct bttv *btv, s
|
|
|
|
if (0 == (bits & VBI_RESOURCES))
|
|
disclaim_vbi_lines(btv);
|
|
-
|
|
- mutex_unlock(&btv->lock);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
@@ -1714,28 +1708,20 @@ static int bttv_prepare_buffer(struct vi
|
|
|
|
/* Make sure tvnorm and vbi_end remain consistent
|
|
until we're done. */
|
|
- mutex_lock(&btv->lock);
|
|
|
|
norm = btv->tvnorm;
|
|
|
|
/* In this mode capturing always starts at defrect.top
|
|
(default VDELAY), ignoring cropping parameters. */
|
|
if (btv->vbi_end > bttv_tvnorms[norm].cropcap.defrect.top) {
|
|
- mutex_unlock(&btv->lock);
|
|
return -EINVAL;
|
|
}
|
|
|
|
- mutex_unlock(&btv->lock);
|
|
-
|
|
c.rect = bttv_tvnorms[norm].cropcap.defrect;
|
|
} else {
|
|
- mutex_lock(&btv->lock);
|
|
-
|
|
norm = btv->tvnorm;
|
|
c = btv->crop[!!fh->do_crop];
|
|
|
|
- mutex_unlock(&btv->lock);
|
|
-
|
|
if (width < c.min_scaled_width ||
|
|
width > c.max_scaled_width ||
|
|
height < c.min_scaled_height)
|
|
@@ -1859,7 +1845,6 @@ static int bttv_s_std(struct file *file,
|
|
unsigned int i;
|
|
int err;
|
|
|
|
- mutex_lock(&btv->lock);
|
|
err = v4l2_prio_check(&btv->prio, fh->prio);
|
|
if (err)
|
|
goto err;
|
|
@@ -1875,7 +1860,6 @@ static int bttv_s_std(struct file *file,
|
|
set_tvnorm(btv, i);
|
|
|
|
err:
|
|
- mutex_unlock(&btv->lock);
|
|
|
|
return err;
|
|
}
|
|
@@ -1899,7 +1883,6 @@ static int bttv_enum_input(struct file *
|
|
struct bttv *btv = fh->btv;
|
|
int rc = 0;
|
|
|
|
- mutex_lock(&btv->lock);
|
|
if (i->index >= bttv_tvcards[btv->c.type].video_inputs) {
|
|
rc = -EINVAL;
|
|
goto err;
|
|
@@ -1929,7 +1912,6 @@ static int bttv_enum_input(struct file *
|
|
i->std = BTTV_NORMS;
|
|
|
|
err:
|
|
- mutex_unlock(&btv->lock);
|
|
|
|
return rc;
|
|
}
|
|
@@ -1939,9 +1921,7 @@ static int bttv_g_input(struct file *fil
|
|
struct bttv_fh *fh = priv;
|
|
struct bttv *btv = fh->btv;
|
|
|
|
- mutex_lock(&btv->lock);
|
|
*i = btv->input;
|
|
- mutex_unlock(&btv->lock);
|
|
|
|
return 0;
|
|
}
|
|
@@ -1953,7 +1933,6 @@ static int bttv_s_input(struct file *fil
|
|
|
|
int err;
|
|
|
|
- mutex_lock(&btv->lock);
|
|
err = v4l2_prio_check(&btv->prio, fh->prio);
|
|
if (unlikely(err))
|
|
goto err;
|
|
@@ -1966,7 +1945,6 @@ static int bttv_s_input(struct file *fil
|
|
set_input(btv, i, btv->tvnorm);
|
|
|
|
err:
|
|
- mutex_unlock(&btv->lock);
|
|
return 0;
|
|
}
|
|
|
|
@@ -1980,7 +1958,6 @@ static int bttv_s_tuner(struct file *fil
|
|
if (unlikely(0 != t->index))
|
|
return -EINVAL;
|
|
|
|
- mutex_lock(&btv->lock);
|
|
if (unlikely(btv->tuner_type == TUNER_ABSENT)) {
|
|
err = -EINVAL;
|
|
goto err;
|
|
@@ -1996,7 +1973,6 @@ static int bttv_s_tuner(struct file *fil
|
|
btv->audio_mode_gpio(btv, t, 1);
|
|
|
|
err:
|
|
- mutex_unlock(&btv->lock);
|
|
|
|
return 0;
|
|
}
|
|
@@ -2007,10 +1983,8 @@ static int bttv_g_frequency(struct file
|
|
struct bttv_fh *fh = priv;
|
|
struct bttv *btv = fh->btv;
|
|
|
|
- mutex_lock(&btv->lock);
|
|
f->type = btv->radio_user ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
|
|
f->frequency = btv->freq;
|
|
- mutex_unlock(&btv->lock);
|
|
|
|
return 0;
|
|
}
|
|
@@ -2025,7 +1999,6 @@ static int bttv_s_frequency(struct file
|
|
if (unlikely(f->tuner != 0))
|
|
return -EINVAL;
|
|
|
|
- mutex_lock(&btv->lock);
|
|
err = v4l2_prio_check(&btv->prio, fh->prio);
|
|
if (unlikely(err))
|
|
goto err;
|
|
@@ -2040,7 +2013,6 @@ static int bttv_s_frequency(struct file
|
|
if (btv->has_matchbox && btv->radio_user)
|
|
tea5757_set_freq(btv, btv->freq);
|
|
err:
|
|
- mutex_unlock(&btv->lock);
|
|
|
|
return 0;
|
|
}
|
|
@@ -2173,7 +2145,6 @@ limit_scaled_size_lock (struct btt
|
|
|
|
/* Make sure tvnorm, vbi_end and the current cropping parameters
|
|
remain consistent until we're done. */
|
|
- mutex_lock(&btv->lock);
|
|
|
|
b = &bttv_tvnorms[btv->tvnorm].cropcap.bounds;
|
|
|
|
@@ -2251,7 +2222,6 @@ limit_scaled_size_lock (struct btt
|
|
rc = 0; /* success */
|
|
|
|
fail:
|
|
- mutex_unlock(&btv->lock);
|
|
|
|
return rc;
|
|
}
|
|
@@ -2283,9 +2253,7 @@ verify_window_lock (struct bttv_fh *
|
|
if (V4L2_FIELD_ANY == field) {
|
|
__s32 height2;
|
|
|
|
- mutex_lock(&fh->btv->lock);
|
|
height2 = fh->btv->crop[!!fh->do_crop].rect.height >> 1;
|
|
- mutex_unlock(&fh->btv->lock);
|
|
field = (win->w.height > height2)
|
|
? V4L2_FIELD_INTERLACED
|
|
: V4L2_FIELD_TOP;
|
|
@@ -2361,7 +2329,6 @@ static int setup_window_lock(struct bttv
|
|
}
|
|
}
|
|
|
|
- mutex_lock(&fh->cap.vb_lock);
|
|
/* clip against screen */
|
|
if (NULL != btv->fbuf.base)
|
|
n = btcx_screen_clips(btv->fbuf.fmt.width, btv->fbuf.fmt.height,
|
|
@@ -2392,13 +2359,6 @@ static int setup_window_lock(struct bttv
|
|
fh->ov.field = win->field;
|
|
fh->ov.setup_ok = 1;
|
|
|
|
- /*
|
|
- * FIXME: btv is protected by btv->lock mutex, while btv->init
|
|
- * is protected by fh->cap.vb_lock. This seems to open the
|
|
- * possibility for some race situations. Maybe the better would
|
|
- * be to unify those locks or to use another way to store the
|
|
- * init values that will be consumed by videobuf callbacks
|
|
- */
|
|
btv->init.ov.w.width = win->w.width;
|
|
btv->init.ov.w.height = win->w.height;
|
|
btv->init.ov.field = win->field;
|
|
@@ -2413,7 +2373,6 @@ static int setup_window_lock(struct bttv
|
|
bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new);
|
|
retval = bttv_switch_overlay(btv,fh,new);
|
|
}
|
|
- mutex_unlock(&fh->cap.vb_lock);
|
|
return retval;
|
|
}
|
|
|
|
@@ -2527,9 +2486,7 @@ static int bttv_try_fmt_vid_cap(struct f
|
|
if (V4L2_FIELD_ANY == field) {
|
|
__s32 height2;
|
|
|
|
- mutex_lock(&btv->lock);
|
|
height2 = btv->crop[!!fh->do_crop].rect.height >> 1;
|
|
- mutex_unlock(&btv->lock);
|
|
field = (f->fmt.pix.height > height2)
|
|
? V4L2_FIELD_INTERLACED
|
|
: V4L2_FIELD_BOTTOM;
|
|
@@ -2615,7 +2572,6 @@ static int bttv_s_fmt_vid_cap(struct fil
|
|
fmt = format_by_fourcc(f->fmt.pix.pixelformat);
|
|
|
|
/* update our state informations */
|
|
- mutex_lock(&fh->cap.vb_lock);
|
|
fh->fmt = fmt;
|
|
fh->cap.field = f->fmt.pix.field;
|
|
fh->cap.last = V4L2_FIELD_NONE;
|
|
@@ -2624,7 +2580,6 @@ static int bttv_s_fmt_vid_cap(struct fil
|
|
btv->init.fmt = fmt;
|
|
btv->init.width = f->fmt.pix.width;
|
|
btv->init.height = f->fmt.pix.height;
|
|
- mutex_unlock(&fh->cap.vb_lock);
|
|
|
|
return 0;
|
|
}
|
|
@@ -2650,11 +2605,9 @@ static int vidiocgmbuf(struct file *file
|
|
unsigned int i;
|
|
struct bttv_fh *fh = priv;
|
|
|
|
- mutex_lock(&fh->cap.vb_lock);
|
|
retval = __videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize,
|
|
V4L2_MEMORY_MMAP);
|
|
if (retval < 0) {
|
|
- mutex_unlock(&fh->cap.vb_lock);
|
|
return retval;
|
|
}
|
|
|
|
@@ -2666,7 +2619,6 @@ static int vidiocgmbuf(struct file *file
|
|
for (i = 0; i < gbuffers; i++)
|
|
mbuf->offsets[i] = i * gbufsize;
|
|
|
|
- mutex_unlock(&fh->cap.vb_lock);
|
|
return 0;
|
|
}
|
|
#endif
|
|
@@ -2776,10 +2728,8 @@ static int bttv_overlay(struct file *fil
|
|
int retval = 0;
|
|
|
|
if (on) {
|
|
- mutex_lock(&fh->cap.vb_lock);
|
|
/* verify args */
|
|
if (unlikely(!btv->fbuf.base)) {
|
|
- mutex_unlock(&fh->cap.vb_lock);
|
|
return -EINVAL;
|
|
}
|
|
if (unlikely(!fh->ov.setup_ok)) {
|
|
@@ -2788,13 +2738,11 @@ static int bttv_overlay(struct file *fil
|
|
}
|
|
if (retval)
|
|
return retval;
|
|
- mutex_unlock(&fh->cap.vb_lock);
|
|
}
|
|
|
|
if (!check_alloc_btres_lock(btv, fh, RESOURCE_OVERLAY))
|
|
return -EBUSY;
|
|
|
|
- mutex_lock(&fh->cap.vb_lock);
|
|
if (on) {
|
|
fh->ov.tvnorm = btv->tvnorm;
|
|
new = videobuf_sg_alloc(sizeof(*new));
|
|
@@ -2806,7 +2754,6 @@ static int bttv_overlay(struct file *fil
|
|
|
|
/* switch over */
|
|
retval = bttv_switch_overlay(btv, fh, new);
|
|
- mutex_unlock(&fh->cap.vb_lock);
|
|
return retval;
|
|
}
|
|
|
|
@@ -2845,7 +2792,6 @@ static int bttv_s_fbuf(struct file *file
|
|
}
|
|
|
|
/* ok, accept it */
|
|
- mutex_lock(&fh->cap.vb_lock);
|
|
btv->fbuf.base = fb->base;
|
|
btv->fbuf.fmt.width = fb->fmt.width;
|
|
btv->fbuf.fmt.height = fb->fmt.height;
|
|
@@ -2877,7 +2823,6 @@ static int bttv_s_fbuf(struct file *file
|
|
retval = bttv_switch_overlay(btv, fh, new);
|
|
}
|
|
}
|
|
- mutex_unlock(&fh->cap.vb_lock);
|
|
return retval;
|
|
}
|
|
|
|
@@ -2956,7 +2901,6 @@ static int bttv_queryctrl(struct file *f
|
|
c->id >= V4L2_CID_PRIVATE_LASTP1))
|
|
return -EINVAL;
|
|
|
|
- mutex_lock(&btv->lock);
|
|
if (!btv->volume_gpio && (c->id == V4L2_CID_AUDIO_VOLUME))
|
|
*c = no_ctl;
|
|
else {
|
|
@@ -2964,7 +2908,6 @@ static int bttv_queryctrl(struct file *f
|
|
|
|
*c = (NULL != ctrl) ? *ctrl : no_ctl;
|
|
}
|
|
- mutex_unlock(&btv->lock);
|
|
|
|
return 0;
|
|
}
|
|
@@ -2975,10 +2918,8 @@ static int bttv_g_parm(struct file *file
|
|
struct bttv_fh *fh = f;
|
|
struct bttv *btv = fh->btv;
|
|
|
|
- mutex_lock(&btv->lock);
|
|
v4l2_video_std_frame_period(bttv_tvnorms[btv->tvnorm].v4l2_id,
|
|
&parm->parm.capture.timeperframe);
|
|
- mutex_unlock(&btv->lock);
|
|
|
|
return 0;
|
|
}
|
|
@@ -2994,7 +2935,6 @@ static int bttv_g_tuner(struct file *fil
|
|
if (0 != t->index)
|
|
return -EINVAL;
|
|
|
|
- mutex_lock(&btv->lock);
|
|
t->rxsubchans = V4L2_TUNER_SUB_MONO;
|
|
bttv_call_all(btv, tuner, g_tuner, t);
|
|
strcpy(t->name, "Television");
|
|
@@ -3006,7 +2946,6 @@ static int bttv_g_tuner(struct file *fil
|
|
if (btv->audio_mode_gpio)
|
|
btv->audio_mode_gpio(btv, t, 0);
|
|
|
|
- mutex_unlock(&btv->lock);
|
|
return 0;
|
|
}
|
|
|
|
@@ -3015,9 +2954,7 @@ static int bttv_g_priority(struct file *
|
|
struct bttv_fh *fh = f;
|
|
struct bttv *btv = fh->btv;
|
|
|
|
- mutex_lock(&btv->lock);
|
|
*p = v4l2_prio_max(&btv->prio);
|
|
- mutex_unlock(&btv->lock);
|
|
|
|
return 0;
|
|
}
|
|
@@ -3029,9 +2966,7 @@ static int bttv_s_priority(struct file *
|
|
struct bttv *btv = fh->btv;
|
|
int rc;
|
|
|
|
- mutex_lock(&btv->lock);
|
|
rc = v4l2_prio_change(&btv->prio, &fh->prio, prio);
|
|
- mutex_unlock(&btv->lock);
|
|
|
|
return rc;
|
|
}
|
|
@@ -3046,9 +2981,7 @@ static int bttv_cropcap(struct file *fil
|
|
cap->type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
|
|
return -EINVAL;
|
|
|
|
- mutex_lock(&btv->lock);
|
|
*cap = bttv_tvnorms[btv->tvnorm].cropcap;
|
|
- mutex_unlock(&btv->lock);
|
|
|
|
return 0;
|
|
}
|
|
@@ -3066,9 +2999,7 @@ static int bttv_g_crop(struct file *file
|
|
inconsistent with fh->width or fh->height and apps
|
|
do not expect a change here. */
|
|
|
|
- mutex_lock(&btv->lock);
|
|
crop->c = btv->crop[!!fh->do_crop].rect;
|
|
- mutex_unlock(&btv->lock);
|
|
|
|
return 0;
|
|
}
|
|
@@ -3092,17 +3023,14 @@ static int bttv_s_crop(struct file *file
|
|
/* Make sure tvnorm, vbi_end and the current cropping
|
|
parameters remain consistent until we're done. Note
|
|
read() may change vbi_end in check_alloc_btres_lock(). */
|
|
- mutex_lock(&btv->lock);
|
|
retval = v4l2_prio_check(&btv->prio, fh->prio);
|
|
if (0 != retval) {
|
|
- mutex_unlock(&btv->lock);
|
|
return retval;
|
|
}
|
|
|
|
retval = -EBUSY;
|
|
|
|
if (locked_btres(fh->btv, VIDEO_RESOURCES)) {
|
|
- mutex_unlock(&btv->lock);
|
|
return retval;
|
|
}
|
|
|
|
@@ -3114,7 +3042,6 @@ static int bttv_s_crop(struct file *file
|
|
|
|
b_top = max(b->top, btv->vbi_end);
|
|
if (b_top + 32 >= b_bottom) {
|
|
- mutex_unlock(&btv->lock);
|
|
return retval;
|
|
}
|
|
|
|
@@ -3137,12 +3064,8 @@ static int bttv_s_crop(struct file *file
|
|
|
|
btv->crop[1] = c;
|
|
|
|
- mutex_unlock(&btv->lock);
|
|
-
|
|
fh->do_crop = 1;
|
|
|
|
- mutex_lock(&fh->cap.vb_lock);
|
|
-
|
|
if (fh->width < c.min_scaled_width) {
|
|
fh->width = c.min_scaled_width;
|
|
btv->init.width = c.min_scaled_width;
|
|
@@ -3159,8 +3082,6 @@ static int bttv_s_crop(struct file *file
|
|
btv->init.height = c.max_scaled_height;
|
|
}
|
|
|
|
- mutex_unlock(&fh->cap.vb_lock);
|
|
-
|
|
return 0;
|
|
}
|
|
|
|
@@ -3228,7 +3149,6 @@ static unsigned int bttv_poll(struct fil
|
|
return videobuf_poll_stream(file, &fh->vbi, wait);
|
|
}
|
|
|
|
- mutex_lock(&fh->cap.vb_lock);
|
|
if (check_btres(fh,RESOURCE_VIDEO_STREAM)) {
|
|
/* streaming capture */
|
|
if (list_empty(&fh->cap.stream))
|
|
@@ -3263,7 +3183,6 @@ static unsigned int bttv_poll(struct fil
|
|
else
|
|
rc = 0;
|
|
err:
|
|
- mutex_unlock(&fh->cap.vb_lock);
|
|
return rc;
|
|
}
|
|
|
|
@@ -3294,23 +3213,11 @@ static int bttv_open(struct file *file)
|
|
return -ENOMEM;
|
|
file->private_data = fh;
|
|
|
|
- /*
|
|
- * btv is protected by btv->lock mutex, while btv->init and other
|
|
- * streaming vars are protected by fh->cap.vb_lock. We need to take
|
|
- * care of both locks to avoid troubles. However, vb_lock is used also
|
|
- * inside videobuf, without calling buf->lock. So, it is a very bad
|
|
- * idea to hold both locks at the same time.
|
|
- * Let's first copy btv->init at fh, holding cap.vb_lock, and then work
|
|
- * with the rest of init, holding btv->lock.
|
|
- */
|
|
- mutex_lock(&fh->cap.vb_lock);
|
|
*fh = btv->init;
|
|
- mutex_unlock(&fh->cap.vb_lock);
|
|
|
|
fh->type = type;
|
|
fh->ov.setup_ok = 0;
|
|
|
|
- mutex_lock(&btv->lock);
|
|
v4l2_prio_open(&btv->prio, &fh->prio);
|
|
|
|
videobuf_queue_sg_init(&fh->cap, &bttv_video_qops,
|
|
@@ -3318,13 +3225,13 @@ static int bttv_open(struct file *file)
|
|
V4L2_BUF_TYPE_VIDEO_CAPTURE,
|
|
V4L2_FIELD_INTERLACED,
|
|
sizeof(struct bttv_buffer),
|
|
- fh, NULL);
|
|
+ fh, &btv->lock);
|
|
videobuf_queue_sg_init(&fh->vbi, &bttv_vbi_qops,
|
|
&btv->c.pci->dev, &btv->s_lock,
|
|
V4L2_BUF_TYPE_VBI_CAPTURE,
|
|
V4L2_FIELD_SEQ_TB,
|
|
sizeof(struct bttv_buffer),
|
|
- fh, NULL);
|
|
+ fh, &btv->lock);
|
|
set_tvnorm(btv,btv->tvnorm);
|
|
set_input(btv, btv->input, btv->tvnorm);
|
|
|
|
@@ -3347,7 +3254,6 @@ static int bttv_open(struct file *file)
|
|
bttv_vbi_fmt_reset(&fh->vbi_fmt, btv->tvnorm);
|
|
|
|
bttv_field_count(btv);
|
|
- mutex_unlock(&btv->lock);
|
|
return 0;
|
|
}
|
|
|
|
@@ -3356,7 +3262,6 @@ static int bttv_release(struct file *fil
|
|
struct bttv_fh *fh = file->private_data;
|
|
struct bttv *btv = fh->btv;
|
|
|
|
- mutex_lock(&btv->lock);
|
|
/* turn off overlay */
|
|
if (check_btres(fh, RESOURCE_OVERLAY))
|
|
bttv_switch_overlay(btv,fh,NULL);
|
|
@@ -3382,14 +3287,8 @@ static int bttv_release(struct file *fil
|
|
|
|
/* free stuff */
|
|
|
|
- /*
|
|
- * videobuf uses cap.vb_lock - we should avoid holding btv->lock,
|
|
- * otherwise we may have dead lock conditions
|
|
- */
|
|
- mutex_unlock(&btv->lock);
|
|
videobuf_mmap_free(&fh->cap);
|
|
videobuf_mmap_free(&fh->vbi);
|
|
- mutex_lock(&btv->lock);
|
|
v4l2_prio_close(&btv->prio, fh->prio);
|
|
file->private_data = NULL;
|
|
kfree(fh);
|
|
@@ -3399,7 +3298,6 @@ static int bttv_release(struct file *fil
|
|
|
|
if (!btv->users)
|
|
audio_mute(btv, 1);
|
|
- mutex_unlock(&btv->lock);
|
|
|
|
return 0;
|
|
}
|
|
@@ -3503,11 +3401,8 @@ static int radio_open(struct file *file)
|
|
if (unlikely(!fh))
|
|
return -ENOMEM;
|
|
file->private_data = fh;
|
|
- mutex_lock(&fh->cap.vb_lock);
|
|
*fh = btv->init;
|
|
- mutex_unlock(&fh->cap.vb_lock);
|
|
|
|
- mutex_lock(&btv->lock);
|
|
v4l2_prio_open(&btv->prio, &fh->prio);
|
|
|
|
btv->radio_user++;
|
|
@@ -3515,7 +3410,6 @@ static int radio_open(struct file *file)
|
|
bttv_call_all(btv, tuner, s_radio);
|
|
audio_input(btv,TVAUDIO_INPUT_RADIO);
|
|
|
|
- mutex_unlock(&btv->lock);
|
|
return 0;
|
|
}
|
|
|
|
@@ -3525,7 +3419,6 @@ static int radio_release(struct file *fi
|
|
struct bttv *btv = fh->btv;
|
|
struct rds_command cmd;
|
|
|
|
- mutex_lock(&btv->lock);
|
|
v4l2_prio_close(&btv->prio, fh->prio);
|
|
file->private_data = NULL;
|
|
kfree(fh);
|
|
@@ -3533,7 +3426,6 @@ static int radio_release(struct file *fi
|
|
btv->radio_user--;
|
|
|
|
bttv_call_all(btv, core, ioctl, RDS_CMD_CLOSE, &cmd);
|
|
- mutex_unlock(&btv->lock);
|
|
|
|
return 0;
|
|
}
|
|
@@ -3562,7 +3454,6 @@ static int radio_g_tuner(struct file *fi
|
|
return -EINVAL;
|
|
if (0 != t->index)
|
|
return -EINVAL;
|
|
- mutex_lock(&btv->lock);
|
|
strcpy(t->name, "Radio");
|
|
t->type = V4L2_TUNER_RADIO;
|
|
|
|
@@ -3571,8 +3462,6 @@ static int radio_g_tuner(struct file *fi
|
|
if (btv->audio_mode_gpio)
|
|
btv->audio_mode_gpio(btv, t, 0);
|
|
|
|
- mutex_unlock(&btv->lock);
|
|
-
|
|
return 0;
|
|
}
|
|
|
|
@@ -3693,7 +3582,7 @@ static const struct v4l2_file_operations
|
|
.open = radio_open,
|
|
.read = radio_read,
|
|
.release = radio_release,
|
|
- .ioctl = video_ioctl2,
|
|
+ .unlocked_ioctl = video_ioctl2,
|
|
.poll = radio_poll,
|
|
};
|
|
|
|
Index: linux-2.6.35.x86_64/drivers/media/rc/ene_ir.c
|
|
===================================================================
|
|
--- linux-2.6.35.x86_64.orig/drivers/media/rc/ene_ir.c
|
|
+++ linux-2.6.35.x86_64/drivers/media/rc/ene_ir.c
|
|
@@ -1004,6 +1004,10 @@ static int ene_probe(struct pnp_dev *pnp
|
|
/* validate resources */
|
|
error = -ENODEV;
|
|
|
|
+ /* init these to -1, as 0 is valid for both */
|
|
+ dev->hw_io = -1;
|
|
+ dev->irq = -1;
|
|
+
|
|
if (!pnp_port_valid(pnp_dev, 0) ||
|
|
pnp_port_len(pnp_dev, 0) < ENE_IO_SIZE)
|
|
goto error;
|
|
@@ -1072,6 +1076,8 @@ static int ene_probe(struct pnp_dev *pnp
|
|
rdev->input_name = "ENE eHome Infrared Remote Transceiver";
|
|
}
|
|
|
|
+ dev->rdev = rdev;
|
|
+
|
|
ene_rx_setup_hw_buffer(dev);
|
|
ene_setup_default_settings(dev);
|
|
ene_setup_hw_settings(dev);
|
|
@@ -1083,7 +1089,6 @@ static int ene_probe(struct pnp_dev *pnp
|
|
if (error < 0)
|
|
goto error;
|
|
|
|
- dev->rdev = rdev;
|
|
ene_notice("driver has been succesfully loaded");
|
|
return 0;
|
|
error:
|
|
Index: linux-2.6.35.x86_64/drivers/media/rc/imon.c
|
|
===================================================================
|
|
--- linux-2.6.35.x86_64.orig/drivers/media/rc/imon.c
|
|
+++ linux-2.6.35.x86_64/drivers/media/rc/imon.c
|
|
@@ -1754,7 +1754,6 @@ static void imon_get_ffdc_type(struct im
|
|
printk(KERN_CONT " (id 0x%02x)\n", ffdc_cfg_byte);
|
|
|
|
ictx->display_type = detected_display_type;
|
|
- ictx->rdev->allowed_protos = allowed_protos;
|
|
ictx->rc_type = allowed_protos;
|
|
}
|
|
|
|
@@ -1837,10 +1836,6 @@ static struct rc_dev *imon_init_rdev(str
|
|
rdev->allowed_protos = RC_TYPE_OTHER | RC_TYPE_RC6; /* iMON PAD or MCE */
|
|
rdev->change_protocol = imon_ir_change_protocol;
|
|
rdev->driver_name = MOD_NAME;
|
|
- if (ictx->rc_type == RC_TYPE_RC6)
|
|
- rdev->map_name = RC_MAP_IMON_MCE;
|
|
- else
|
|
- rdev->map_name = RC_MAP_IMON_PAD;
|
|
|
|
/* Enable front-panel buttons and/or knobs */
|
|
memcpy(ictx->usb_tx_buf, &fp_packet, sizeof(fp_packet));
|
|
@@ -1849,11 +1844,18 @@ static struct rc_dev *imon_init_rdev(str
|
|
if (ret)
|
|
dev_info(ictx->dev, "panel buttons/knobs setup failed\n");
|
|
|
|
- if (ictx->product == 0xffdc)
|
|
+ if (ictx->product == 0xffdc) {
|
|
imon_get_ffdc_type(ictx);
|
|
+ rdev->allowed_protos = ictx->rc_type;
|
|
+ }
|
|
|
|
imon_set_display_type(ictx);
|
|
|
|
+ if (ictx->rc_type == RC_TYPE_RC6)
|
|
+ rdev->map_name = RC_MAP_IMON_MCE;
|
|
+ else
|
|
+ rdev->map_name = RC_MAP_IMON_PAD;
|
|
+
|
|
ret = rc_register_device(rdev);
|
|
if (ret < 0) {
|
|
dev_err(ictx->dev, "remote input dev register failed\n");
|
|
@@ -2106,18 +2108,6 @@ static struct imon_context *imon_init_in
|
|
goto find_endpoint_failed;
|
|
}
|
|
|
|
- ictx->idev = imon_init_idev(ictx);
|
|
- if (!ictx->idev) {
|
|
- dev_err(dev, "%s: input device setup failed\n", __func__);
|
|
- goto idev_setup_failed;
|
|
- }
|
|
-
|
|
- ictx->rdev = imon_init_rdev(ictx);
|
|
- if (!ictx->rdev) {
|
|
- dev_err(dev, "%s: rc device setup failed\n", __func__);
|
|
- goto rdev_setup_failed;
|
|
- }
|
|
-
|
|
usb_fill_int_urb(ictx->rx_urb_intf0, ictx->usbdev_intf0,
|
|
usb_rcvintpipe(ictx->usbdev_intf0,
|
|
ictx->rx_endpoint_intf0->bEndpointAddress),
|
|
@@ -2131,13 +2121,25 @@ static struct imon_context *imon_init_in
|
|
goto urb_submit_failed;
|
|
}
|
|
|
|
+ ictx->idev = imon_init_idev(ictx);
|
|
+ if (!ictx->idev) {
|
|
+ dev_err(dev, "%s: input device setup failed\n", __func__);
|
|
+ goto idev_setup_failed;
|
|
+ }
|
|
+
|
|
+ ictx->rdev = imon_init_rdev(ictx);
|
|
+ if (!ictx->rdev) {
|
|
+ dev_err(dev, "%s: rc device setup failed\n", __func__);
|
|
+ goto rdev_setup_failed;
|
|
+ }
|
|
+
|
|
return ictx;
|
|
|
|
-urb_submit_failed:
|
|
- rc_unregister_device(ictx->rdev);
|
|
rdev_setup_failed:
|
|
input_unregister_device(ictx->idev);
|
|
idev_setup_failed:
|
|
+ usb_kill_urb(ictx->rx_urb_intf0);
|
|
+urb_submit_failed:
|
|
find_endpoint_failed:
|
|
mutex_unlock(&ictx->lock);
|
|
usb_free_urb(tx_urb);
|
|
diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c
|
|
index f011c5d..31a98e2 100644
|
|
--- a/drivers/media/rc/ir-lirc-codec.c
|
|
+++ b/drivers/media/rc/ir-lirc-codec.c
|
|
@@ -1,4 +1,4 @@
|
|
-/* ir-lirc-codec.c - ir-core to classic lirc interface bridge
|
|
+/* ir-lirc-codec.c - rc-core to classic lirc interface bridge
|
|
*
|
|
* Copyright (C) 2010 by Jarod Wilson <jarod@redhat.com>
|
|
*
|
|
@@ -47,6 +47,7 @@ static int ir_lirc_decode(struct rc_dev *dev, struct ir_raw_event ev)
|
|
/* Carrier reports */
|
|
if (ev.carrier_report) {
|
|
sample = LIRC_FREQUENCY(ev.carrier);
|
|
+ IR_dprintk(2, "carrier report (freq: %d)\n", sample);
|
|
|
|
/* Packet end */
|
|
} else if (ev.timeout) {
|
|
@@ -62,6 +63,7 @@ static int ir_lirc_decode(struct rc_dev *dev, struct ir_raw_event ev)
|
|
return 0;
|
|
|
|
sample = LIRC_TIMEOUT(ev.duration / 1000);
|
|
+ IR_dprintk(2, "timeout report (duration: %d)\n", sample);
|
|
|
|
/* Normal sample */
|
|
} else {
|
|
@@ -85,6 +87,8 @@ static int ir_lirc_decode(struct rc_dev *dev, struct ir_raw_event ev)
|
|
|
|
sample = ev.pulse ? LIRC_PULSE(ev.duration / 1000) :
|
|
LIRC_SPACE(ev.duration / 1000);
|
|
+ IR_dprintk(2, "delivering %uus %s to lirc_dev\n",
|
|
+ TO_US(ev.duration), TO_STR(ev.pulse));
|
|
}
|
|
|
|
lirc_buffer_write(dev->raw->lirc.drv->rbuf,
|
|
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c
|
|
index 4aaa47c..54b7fcd 100644
|
|
--- a/drivers/media/video/cx88/cx88-alsa.c
|
|
+++ b/drivers/media/video/cx88/cx88-alsa.c
|
|
@@ -40,7 +40,6 @@
|
|
#include <sound/control.h>
|
|
#include <sound/initval.h>
|
|
#include <sound/tlv.h>
|
|
-#include <media/wm8775.h>
|
|
|
|
#include "cx88.h"
|
|
#include "cx88-reg.h"
|
|
@@ -587,47 +586,26 @@ static int snd_cx88_volume_put(struct snd_kcontrol *kcontrol,
|
|
int left, right, v, b;
|
|
int changed = 0;
|
|
u32 old;
|
|
- struct v4l2_control client_ctl;
|
|
-
|
|
- /* Pass volume & balance onto any WM8775 */
|
|
- if (value->value.integer.value[0] >= value->value.integer.value[1]) {
|
|
- v = value->value.integer.value[0] << 10;
|
|
- b = value->value.integer.value[0] ?
|
|
- (0x8000 * value->value.integer.value[1]) / value->value.integer.value[0] :
|
|
- 0x8000;
|
|
- } else {
|
|
- v = value->value.integer.value[1] << 10;
|
|
- b = value->value.integer.value[1] ?
|
|
- 0xffff - (0x8000 * value->value.integer.value[0]) / value->value.integer.value[1] :
|
|
- 0x8000;
|
|
- }
|
|
- client_ctl.value = v;
|
|
- client_ctl.id = V4L2_CID_AUDIO_VOLUME;
|
|
- call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl);
|
|
-
|
|
- client_ctl.value = b;
|
|
- client_ctl.id = V4L2_CID_AUDIO_BALANCE;
|
|
- call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl);
|
|
|
|
left = value->value.integer.value[0] & 0x3f;
|
|
right = value->value.integer.value[1] & 0x3f;
|
|
b = right - left;
|
|
if (b < 0) {
|
|
- v = 0x3f - left;
|
|
- b = (-b) | 0x40;
|
|
+ v = 0x3f - left;
|
|
+ b = (-b) | 0x40;
|
|
} else {
|
|
- v = 0x3f - right;
|
|
+ v = 0x3f - right;
|
|
}
|
|
/* Do we really know this will always be called with IRQs on? */
|
|
spin_lock_irq(&chip->reg_lock);
|
|
old = cx_read(AUD_VOL_CTL);
|
|
if (v != (old & 0x3f)) {
|
|
- cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, (old & ~0x3f) | v);
|
|
- changed = 1;
|
|
+ cx_write(AUD_VOL_CTL, (old & ~0x3f) | v);
|
|
+ changed = 1;
|
|
}
|
|
- if ((cx_read(AUD_BAL_CTL) & 0x7f) != b) {
|
|
- cx_write(AUD_BAL_CTL, b);
|
|
- changed = 1;
|
|
+ if (cx_read(AUD_BAL_CTL) != b) {
|
|
+ cx_write(AUD_BAL_CTL, b);
|
|
+ changed = 1;
|
|
}
|
|
spin_unlock_irq(&chip->reg_lock);
|
|
|
|
@@ -640,7 +618,7 @@ static const struct snd_kcontrol_new snd_cx88_volume = {
|
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
|
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
|
|
SNDRV_CTL_ELEM_ACCESS_TLV_READ,
|
|
- .name = "Analog-TV Volume",
|
|
+ .name = "Playback Volume",
|
|
.info = snd_cx88_volume_info,
|
|
.get = snd_cx88_volume_get,
|
|
.put = snd_cx88_volume_put,
|
|
@@ -671,14 +649,7 @@ static int snd_cx88_switch_put(struct snd_kcontrol *kcontrol,
|
|
vol = cx_read(AUD_VOL_CTL);
|
|
if (value->value.integer.value[0] != !(vol & bit)) {
|
|
vol ^= bit;
|
|
- cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, vol);
|
|
- /* Pass mute onto any WM8775 */
|
|
- if ((1<<6) == bit) {
|
|
- struct v4l2_control client_ctl;
|
|
- client_ctl.value = 0 != (vol & bit);
|
|
- client_ctl.id = V4L2_CID_AUDIO_MUTE;
|
|
- call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl);
|
|
- }
|
|
+ cx_write(AUD_VOL_CTL, vol);
|
|
ret = 1;
|
|
}
|
|
spin_unlock_irq(&chip->reg_lock);
|
|
@@ -687,7 +658,7 @@ static int snd_cx88_switch_put(struct snd_kcontrol *kcontrol,
|
|
|
|
static const struct snd_kcontrol_new snd_cx88_dac_switch = {
|
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
|
- .name = "Audio-Out Switch",
|
|
+ .name = "Playback Switch",
|
|
.info = snd_ctl_boolean_mono_info,
|
|
.get = snd_cx88_switch_get,
|
|
.put = snd_cx88_switch_put,
|
|
@@ -696,49 +667,13 @@ static const struct snd_kcontrol_new snd_cx88_dac_switch = {
|
|
|
|
static const struct snd_kcontrol_new snd_cx88_source_switch = {
|
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
|
- .name = "Analog-TV Switch",
|
|
+ .name = "Capture Switch",
|
|
.info = snd_ctl_boolean_mono_info,
|
|
.get = snd_cx88_switch_get,
|
|
.put = snd_cx88_switch_put,
|
|
.private_value = (1<<6),
|
|
};
|
|
|
|
-static int snd_cx88_alc_get(struct snd_kcontrol *kcontrol,
|
|
- struct snd_ctl_elem_value *value)
|
|
-{
|
|
- snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol);
|
|
- struct cx88_core *core = chip->core;
|
|
- struct v4l2_control client_ctl;
|
|
-
|
|
- client_ctl.id = V4L2_CID_AUDIO_LOUDNESS;
|
|
- call_hw(core, WM8775_GID, core, g_ctrl, &client_ctl);
|
|
- value->value.integer.value[0] = client_ctl.value ? 1 : 0;
|
|
-
|
|
- return 0;
|
|
-}
|
|
-
|
|
-static int snd_cx88_alc_put(struct snd_kcontrol *kcontrol,
|
|
- struct snd_ctl_elem_value *value)
|
|
-{
|
|
- snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol);
|
|
- struct cx88_core *core = chip->core;
|
|
- struct v4l2_control client_ctl;
|
|
-
|
|
- client_ctl.value = 0 != value->value.integer.value[0];
|
|
- client_ctl.id = V4L2_CID_AUDIO_LOUDNESS;
|
|
- call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl);
|
|
-
|
|
- return 0;
|
|
-}
|
|
-
|
|
-static struct snd_kcontrol_new snd_cx88_alc_switch = {
|
|
- .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
|
- .name = "Line-In ALC Switch",
|
|
- .info = snd_ctl_boolean_mono_info,
|
|
- .get = snd_cx88_alc_get,
|
|
- .put = snd_cx88_alc_put,
|
|
-};
|
|
-
|
|
/****************************************************************************
|
|
Basic Flow for Sound Devices
|
|
****************************************************************************/
|
|
@@ -860,7 +795,6 @@ static int __devinit cx88_audio_initdev(struct pci_dev *pci,
|
|
{
|
|
struct snd_card *card;
|
|
snd_cx88_card_t *chip;
|
|
- struct v4l2_subdev *sd;
|
|
int err;
|
|
|
|
if (devno >= SNDRV_CARDS)
|
|
@@ -896,15 +830,6 @@ static int __devinit cx88_audio_initdev(struct pci_dev *pci,
|
|
if (err < 0)
|
|
goto error;
|
|
|
|
- /* If there's a wm8775 then add a Line-In ALC switch */
|
|
- list_for_each_entry(sd, &chip->core->v4l2_dev.subdevs, list) {
|
|
- if (WM8775_GID == sd->grp_id) {
|
|
- snd_ctl_add(card, snd_ctl_new1(&snd_cx88_alc_switch,
|
|
- chip));
|
|
- break;
|
|
- }
|
|
- }
|
|
-
|
|
strcpy (card->driver, "CX88x");
|
|
sprintf(card->shortname, "Conexant CX%x", pci->device);
|
|
sprintf(card->longname, "%s at %#llx",
|
|
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
|
|
index 9b9e169..0ccc2af 100644
|
|
--- a/drivers/media/video/cx88/cx88-cards.c
|
|
+++ b/drivers/media/video/cx88/cx88-cards.c
|
|
@@ -1007,15 +1007,22 @@ static const struct cx88_board cx88_boards[] = {
|
|
.radio_type = UNSET,
|
|
.tuner_addr = ADDR_UNSET,
|
|
.radio_addr = ADDR_UNSET,
|
|
+ .audio_chip = V4L2_IDENT_WM8775,
|
|
.input = {{
|
|
.type = CX88_VMUX_DVB,
|
|
.vmux = 0,
|
|
+ /* 2: Line-In */
|
|
+ .audioroute = 2,
|
|
},{
|
|
.type = CX88_VMUX_COMPOSITE1,
|
|
.vmux = 1,
|
|
+ /* 2: Line-In */
|
|
+ .audioroute = 2,
|
|
},{
|
|
.type = CX88_VMUX_SVIDEO,
|
|
.vmux = 2,
|
|
+ /* 2: Line-In */
|
|
+ .audioroute = 2,
|
|
}},
|
|
.mpeg = CX88_MPEG_DVB,
|
|
},
|
|
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
|
|
index 62cea95..d9249e5 100644
|
|
--- a/drivers/media/video/cx88/cx88-video.c
|
|
+++ b/drivers/media/video/cx88/cx88-video.c
|
|
@@ -40,7 +40,6 @@
|
|
#include "cx88.h"
|
|
#include <media/v4l2-common.h>
|
|
#include <media/v4l2-ioctl.h>
|
|
-#include <media/wm8775.h>
|
|
|
|
MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards");
|
|
MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
|
|
@@ -977,7 +976,6 @@ int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl)
|
|
const struct cx88_ctrl *c = NULL;
|
|
u32 value,mask;
|
|
int i;
|
|
- struct v4l2_control client_ctl;
|
|
|
|
for (i = 0; i < CX8800_CTLS; i++) {
|
|
if (cx8800_ctls[i].v.id == ctl->id) {
|
|
@@ -991,27 +989,6 @@ int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl)
|
|
ctl->value = c->v.minimum;
|
|
if (ctl->value > c->v.maximum)
|
|
ctl->value = c->v.maximum;
|
|
-
|
|
- /* Pass changes onto any WM8775 */
|
|
- client_ctl.id = ctl->id;
|
|
- switch (ctl->id) {
|
|
- case V4L2_CID_AUDIO_MUTE:
|
|
- client_ctl.value = ctl->value;
|
|
- break;
|
|
- case V4L2_CID_AUDIO_VOLUME:
|
|
- client_ctl.value = (ctl->value) ?
|
|
- (0x90 + ctl->value) << 8 : 0;
|
|
- break;
|
|
- case V4L2_CID_AUDIO_BALANCE:
|
|
- client_ctl.value = ctl->value << 9;
|
|
- break;
|
|
- default:
|
|
- client_ctl.id = 0;
|
|
- break;
|
|
- }
|
|
- if (client_ctl.id)
|
|
- call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl);
|
|
-
|
|
mask=c->mask;
|
|
switch (ctl->id) {
|
|
case V4L2_CID_AUDIO_BALANCE:
|
|
@@ -1558,9 +1535,7 @@ static int radio_queryctrl (struct file *file, void *priv,
|
|
if (c->id < V4L2_CID_BASE ||
|
|
c->id >= V4L2_CID_LASTP1)
|
|
return -EINVAL;
|
|
- if (c->id == V4L2_CID_AUDIO_MUTE ||
|
|
- c->id == V4L2_CID_AUDIO_VOLUME ||
|
|
- c->id == V4L2_CID_AUDIO_BALANCE) {
|
|
+ if (c->id == V4L2_CID_AUDIO_MUTE) {
|
|
for (i = 0; i < CX8800_CTLS; i++) {
|
|
if (cx8800_ctls[i].v.id == c->id)
|
|
break;
|
|
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
|
|
index e8c732e..c9981e7 100644
|
|
--- a/drivers/media/video/cx88/cx88.h
|
|
+++ b/drivers/media/video/cx88/cx88.h
|
|
@@ -398,19 +398,17 @@ static inline struct cx88_core *to_core(struct v4l2_device *v4l2_dev)
|
|
return container_of(v4l2_dev, struct cx88_core, v4l2_dev);
|
|
}
|
|
|
|
-#define call_hw(core, grpid, o, f, args...) \
|
|
+#define call_all(core, o, f, args...) \
|
|
do { \
|
|
if (!core->i2c_rc) { \
|
|
if (core->gate_ctrl) \
|
|
core->gate_ctrl(core, 1); \
|
|
- v4l2_device_call_all(&core->v4l2_dev, grpid, o, f, ##args); \
|
|
+ v4l2_device_call_all(&core->v4l2_dev, 0, o, f, ##args); \
|
|
if (core->gate_ctrl) \
|
|
core->gate_ctrl(core, 0); \
|
|
} \
|
|
} while (0)
|
|
|
|
-#define call_all(core, o, f, args...) call_hw(core, 0, o, f, ##args)
|
|
-
|
|
struct cx8800_dev;
|
|
struct cx8802_dev;
|
|
|
|
diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c
|
|
index 1355256..fe8ef64 100644
|
|
--- a/drivers/media/video/wm8775.c
|
|
+++ b/drivers/media/video/wm8775.c
|
|
@@ -35,7 +35,6 @@
|
|
#include <media/v4l2-device.h>
|
|
#include <media/v4l2-chip-ident.h>
|
|
#include <media/v4l2-ctrls.h>
|
|
-#include <media/wm8775.h>
|
|
|
|
MODULE_DESCRIPTION("wm8775 driver");
|
|
MODULE_AUTHOR("Ulf Eklund, Hans Verkuil");
|
|
@@ -51,16 +50,10 @@ enum {
|
|
TOT_REGS
|
|
};
|
|
|
|
-#define ALC_HOLD 0x85 /* R17: use zero cross detection, ALC hold time 42.6 ms */
|
|
-#define ALC_EN 0x100 /* R17: ALC enable */
|
|
-
|
|
struct wm8775_state {
|
|
struct v4l2_subdev sd;
|
|
struct v4l2_ctrl_handler hdl;
|
|
struct v4l2_ctrl *mute;
|
|
- struct v4l2_ctrl *vol;
|
|
- struct v4l2_ctrl *bal;
|
|
- struct v4l2_ctrl *loud;
|
|
u8 input; /* Last selected input (0-0xf) */
|
|
};
|
|
|
|
@@ -92,30 +85,6 @@ static int wm8775_write(struct v4l2_subdev *sd, int reg, u16 val)
|
|
return -1;
|
|
}
|
|
|
|
-static void wm8775_set_audio(struct v4l2_subdev *sd, int quietly)
|
|
-{
|
|
- struct wm8775_state *state = to_state(sd);
|
|
- u8 vol_l, vol_r;
|
|
- int muted = 0 != state->mute->val;
|
|
- u16 volume = (u16)state->vol->val;
|
|
- u16 balance = (u16)state->bal->val;
|
|
-
|
|
- /* normalize ( 65535 to 0 -> 255 to 0 (+24dB to -103dB) ) */
|
|
- vol_l = (min(65536 - balance, 32768) * volume) >> 23;
|
|
- vol_r = (min(balance, (u16)32768) * volume) >> 23;
|
|
-
|
|
- /* Mute */
|
|
- if (muted || quietly)
|
|
- wm8775_write(sd, R21, 0x0c0 | state->input);
|
|
-
|
|
- wm8775_write(sd, R14, vol_l | 0x100); /* 0x100= Left channel ADC zero cross enable */
|
|
- wm8775_write(sd, R15, vol_r | 0x100); /* 0x100= Right channel ADC zero cross enable */
|
|
-
|
|
- /* Un-mute */
|
|
- if (!muted)
|
|
- wm8775_write(sd, R21, state->input);
|
|
-}
|
|
-
|
|
static int wm8775_s_routing(struct v4l2_subdev *sd,
|
|
u32 input, u32 output, u32 config)
|
|
{
|
|
@@ -133,26 +102,25 @@ static int wm8775_s_routing(struct v4l2_subdev *sd,
|
|
state->input = input;
|
|
if (!v4l2_ctrl_g_ctrl(state->mute))
|
|
return 0;
|
|
- if (!v4l2_ctrl_g_ctrl(state->vol))
|
|
- return 0;
|
|
- if (!v4l2_ctrl_g_ctrl(state->bal))
|
|
- return 0;
|
|
- wm8775_set_audio(sd, 1);
|
|
+ wm8775_write(sd, R21, 0x0c0);
|
|
+ wm8775_write(sd, R14, 0x1d4);
|
|
+ wm8775_write(sd, R15, 0x1d4);
|
|
+ wm8775_write(sd, R21, 0x100 + state->input);
|
|
return 0;
|
|
}
|
|
|
|
static int wm8775_s_ctrl(struct v4l2_ctrl *ctrl)
|
|
{
|
|
struct v4l2_subdev *sd = to_sd(ctrl);
|
|
+ struct wm8775_state *state = to_state(sd);
|
|
|
|
switch (ctrl->id) {
|
|
case V4L2_CID_AUDIO_MUTE:
|
|
- case V4L2_CID_AUDIO_VOLUME:
|
|
- case V4L2_CID_AUDIO_BALANCE:
|
|
- wm8775_set_audio(sd, 0);
|
|
- return 0;
|
|
- case V4L2_CID_AUDIO_LOUDNESS:
|
|
- wm8775_write(sd, R17, (ctrl->val ? ALC_EN : 0) | ALC_HOLD);
|
|
+ wm8775_write(sd, R21, 0x0c0);
|
|
+ wm8775_write(sd, R14, 0x1d4);
|
|
+ wm8775_write(sd, R15, 0x1d4);
|
|
+ if (!ctrl->val)
|
|
+ wm8775_write(sd, R21, 0x100 + state->input);
|
|
return 0;
|
|
}
|
|
return -EINVAL;
|
|
@@ -176,7 +144,16 @@ static int wm8775_log_status(struct v4l2_subdev *sd)
|
|
|
|
static int wm8775_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *freq)
|
|
{
|
|
- wm8775_set_audio(sd, 0);
|
|
+ struct wm8775_state *state = to_state(sd);
|
|
+
|
|
+ /* If I remove this, then it can happen that I have no
|
|
+ sound the first time I tune from static to a valid channel.
|
|
+ It's difficult to reproduce and is almost certainly related
|
|
+ to the zero cross detect circuit. */
|
|
+ wm8775_write(sd, R21, 0x0c0);
|
|
+ wm8775_write(sd, R14, 0x1d4);
|
|
+ wm8775_write(sd, R15, 0x1d4);
|
|
+ wm8775_write(sd, R21, 0x100 + state->input);
|
|
return 0;
|
|
}
|
|
|
|
@@ -226,7 +203,6 @@ static int wm8775_probe(struct i2c_client *client,
|
|
{
|
|
struct wm8775_state *state;
|
|
struct v4l2_subdev *sd;
|
|
- int err;
|
|
|
|
/* Check if the adapter supports the needed features */
|
|
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
|
|
@@ -240,21 +216,15 @@ static int wm8775_probe(struct i2c_client *client,
|
|
return -ENOMEM;
|
|
sd = &state->sd;
|
|
v4l2_i2c_subdev_init(sd, client, &wm8775_ops);
|
|
- sd->grp_id = WM8775_GID; /* subdev group id */
|
|
state->input = 2;
|
|
|
|
- v4l2_ctrl_handler_init(&state->hdl, 4);
|
|
+ v4l2_ctrl_handler_init(&state->hdl, 1);
|
|
state->mute = v4l2_ctrl_new_std(&state->hdl, &wm8775_ctrl_ops,
|
|
V4L2_CID_AUDIO_MUTE, 0, 1, 1, 0);
|
|
- state->vol = v4l2_ctrl_new_std(&state->hdl, &wm8775_ctrl_ops,
|
|
- V4L2_CID_AUDIO_VOLUME, 0, 65535, (65535+99)/100, 0xCF00); /* 0dB*/
|
|
- state->bal = v4l2_ctrl_new_std(&state->hdl, &wm8775_ctrl_ops,
|
|
- V4L2_CID_AUDIO_BALANCE, 0, 65535, (65535+99)/100, 32768);
|
|
- state->loud = v4l2_ctrl_new_std(&state->hdl, &wm8775_ctrl_ops,
|
|
- V4L2_CID_AUDIO_LOUDNESS, 0, 1, 1, 1);
|
|
sd->ctrl_handler = &state->hdl;
|
|
- err = state->hdl.error;
|
|
- if (err) {
|
|
+ if (state->hdl.error) {
|
|
+ int err = state->hdl.error;
|
|
+
|
|
v4l2_ctrl_handler_free(&state->hdl);
|
|
kfree(state);
|
|
return err;
|
|
@@ -266,25 +236,29 @@ static int wm8775_probe(struct i2c_client *client,
|
|
wm8775_write(sd, R23, 0x000);
|
|
/* Disable zero cross detect timeout */
|
|
wm8775_write(sd, R7, 0x000);
|
|
- /* HPF enable, I2S mode, 24-bit */
|
|
- wm8775_write(sd, R11, 0x022);
|
|
+ /* Left justified, 24-bit mode */
|
|
+ wm8775_write(sd, R11, 0x021);
|
|
/* Master mode, clock ratio 256fs */
|
|
wm8775_write(sd, R12, 0x102);
|
|
/* Powered up */
|
|
wm8775_write(sd, R13, 0x000);
|
|
- /* ALC stereo, ALC target level -5dB FS, ALC max gain +8dB */
|
|
- wm8775_write(sd, R16, 0x1bb);
|
|
- /* Set ALC mode and hold time */
|
|
- wm8775_write(sd, R17, (state->loud->val ? ALC_EN : 0) | ALC_HOLD);
|
|
+ /* ADC gain +2.5dB, enable zero cross */
|
|
+ wm8775_write(sd, R14, 0x1d4);
|
|
+ /* ADC gain +2.5dB, enable zero cross */
|
|
+ wm8775_write(sd, R15, 0x1d4);
|
|
+ /* ALC Stereo, ALC target level -1dB FS max gain +8dB */
|
|
+ wm8775_write(sd, R16, 0x1bf);
|
|
+ /* Enable gain control, use zero cross detection,
|
|
+ ALC hold time 42.6 ms */
|
|
+ wm8775_write(sd, R17, 0x185);
|
|
/* ALC gain ramp up delay 34 s, ALC gain ramp down delay 33 ms */
|
|
wm8775_write(sd, R18, 0x0a2);
|
|
/* Enable noise gate, threshold -72dBfs */
|
|
wm8775_write(sd, R19, 0x005);
|
|
- /* Transient window 4ms, ALC min gain -5dB */
|
|
- wm8775_write(sd, R20, 0x0fb);
|
|
-
|
|
- wm8775_set_audio(sd, 1); /* set volume/mute/mux */
|
|
-
|
|
+ /* Transient window 4ms, lower PGA gain limit -1dB */
|
|
+ wm8775_write(sd, R20, 0x07a);
|
|
+ /* LRBOTH = 1, use input 2. */
|
|
+ wm8775_write(sd, R21, 0x102);
|
|
return 0;
|
|
}
|
|
|
|
diff --git a/include/media/wm8775.h b/include/media/wm8775.h
|
|
index a1c4d41..60739c5 100644
|
|
--- a/include/media/wm8775.h
|
|
+++ b/include/media/wm8775.h
|
|
@@ -32,7 +32,4 @@
|
|
#define WM8775_AIN3 4
|
|
#define WM8775_AIN4 8
|
|
|
|
-/* subdev group ID */
|
|
-#define WM8775_GID (1 << 0)
|
|
-
|
|
#endif
|