On Sun, 2009-02-08 at 18:24 -0600, Ben Nemec wrote:
> On Sunday 08 February 2009 03:17:47 pm Andy Walls wrote:
> [snip]
> > You really do need to try the AUDIO_ENABLE register related fix I have
> > at my cx18 repo.
> I tried this, but I seem to be hitting the I2C_DRIVERID_TVMIXER error that I
> believe you are already aware of. Since it appears your audio changes went
> in after the change that caused it I can't get them built. Is there a
> workaround?
Apply the attached patch to a snapshot or pull of the latest v4l-dvb
repo. It is the sum of changes in my ~awalls/cx18 repo.
Regards,
Andy
diff -r 3541eb5b56f7 linux/drivers/media/video/cx18/cx18-audio.c
--- a/linux/drivers/media/video/cx18/cx18-audio.c Thu Jan 29 10:57:25 2009 -0200
+++ b/linux/drivers/media/video/cx18/cx18-audio.c Sun Feb 08 20:43:38 2009 -0500
@@ -64,8 +64,7 @@
val = cx18_read_reg(cx, CX18_AUDIO_ENABLE) & ~0x30;
val |= (audio_input > CX18_AV_AUDIO_SERIAL2) ? 0x20 :
(audio_input << 4);
- cx18_write_reg(cx, val | 0xb00, CX18_AUDIO_ENABLE);
- cx18_vapi(cx, CX18_APU_RESETAI, 1, 0);
+ cx18_write_reg_expect(cx, val | 0xb00, CX18_AUDIO_ENABLE, val, 0x30);
return 0;
}
diff -r 3541eb5b56f7 linux/drivers/media/video/cx18/cx18-av-core.c
--- a/linux/drivers/media/video/cx18/cx18-av-core.c Thu Jan 29 10:57:25 2009 -0200
+++ b/linux/drivers/media/video/cx18/cx18-av-core.c Sun Feb 08 20:43:38 2009 -0500
@@ -680,19 +680,45 @@
/* ----------------------------------------------------------------------- */
+static int valid_av_cmd(unsigned int cmd)
+{
+ switch (cmd) {
+ /* All commands supported by cx18_av_cmd() */
+ case VIDIOC_INT_DECODE_VBI_LINE:
+ case VIDIOC_INT_AUDIO_CLOCK_FREQ:
+ case VIDIOC_STREAMON:
+ case VIDIOC_STREAMOFF:
+ case VIDIOC_LOG_STATUS:
+ case VIDIOC_G_CTRL:
+ case VIDIOC_S_CTRL:
+ case VIDIOC_QUERYCTRL:
+ case VIDIOC_G_STD:
+ case VIDIOC_S_STD:
+ case AUDC_SET_RADIO:
+ case VIDIOC_INT_G_VIDEO_ROUTING:
+ case VIDIOC_INT_S_VIDEO_ROUTING:
+ case VIDIOC_INT_G_AUDIO_ROUTING:
+ case VIDIOC_INT_S_AUDIO_ROUTING:
+ case VIDIOC_S_FREQUENCY:
+ case VIDIOC_G_TUNER:
+ case VIDIOC_S_TUNER:
+ case VIDIOC_G_FMT:
+ case VIDIOC_S_FMT:
+ case VIDIOC_INT_RESET:
+ return 1;
+ default:
+ return 0;
+ }
+ return 0;
+}
+
int cx18_av_cmd(struct cx18 *cx, unsigned int cmd, void *arg)
{
struct cx18_av_state *state = &cx->av_state;
struct v4l2_tuner *vt = arg;
struct v4l2_routing *route = arg;
- /* ignore these commands */
- switch (cmd) {
- case TUNER_SET_TYPE_ADDR:
- return 0;
- }
-
- if (!state->is_initialized) {
+ if (!state->is_initialized && valid_av_cmd(cmd)) {
CX18_DEBUG_INFO("cmd %08x triggered fw load\n", cmd);
/* initialize on first use */
state->is_initialized = 1;
diff -r 3541eb5b56f7 linux/drivers/media/video/cx18/cx18-av-firmware.c
--- a/linux/drivers/media/video/cx18/cx18-av-firmware.c Thu Jan 29 10:57:25 2009 -0200
+++ b/linux/drivers/media/video/cx18/cx18-av-firmware.c Sun Feb 08 20:43:38 2009 -0500
@@ -131,7 +131,8 @@
v = cx18_read_reg(cx, CX18_AUDIO_ENABLE);
/* If bit 11 is 1, clear bit 10 */
if (v & 0x800)
- cx18_write_reg(cx, v & 0xFFFFFBFF, CX18_AUDIO_ENABLE);
+ cx18_write_reg_expect(cx, v & 0xFFFFFBFF, CX18_AUDIO_ENABLE,
+ 0, 0x400);
/* Enable WW auto audio standard detection */
v = cx18_av_read4(cx, CXADEC_STD_DET_CTL);
diff -r 3541eb5b56f7 linux/drivers/media/video/cx18/cx18-driver.c
--- a/linux/drivers/media/video/cx18/cx18-driver.c Thu Jan 29 10:57:25 2009 -0200
+++ b/linux/drivers/media/video/cx18/cx18-driver.c Sun Feb 08 20:43:38 2009 -0500
@@ -563,8 +563,6 @@
mutex_init(&cx->epu2apu_mb_lock);
mutex_init(&cx->epu2cpu_mb_lock);
- spin_lock_init(&cx->lock);
-
cx->work_queue = create_singlethread_workqueue(cx->name);
if (cx->work_queue == NULL) {
CX18_ERR("Unable to create work hander thread\n");
@@ -1085,6 +1083,19 @@
return -ENXIO;
}
+ /*
+ * The second firmware load requires us to normalize the APU state,
+ * or the audio for the first analog capture will be badly incorrect.
+ *
+ * I can't seem to call APU_RESETAI and have it succeed without the
+ * APU capturing audio, so we start and stop it here to do the reset
+ */
+
+ /* MPEG Encoding, 224 kbps, MPEG Layer II, 48 ksps */
+ cx18_vapi(cx, CX18_APU_START, 2, CX18_APU_ENCODING_METHOD_MPEG|0xb9, 0);
+ cx18_vapi(cx, CX18_APU_RESETAI, 0);
+ cx18_vapi(cx, CX18_APU_STOP, 1, CX18_APU_ENCODING_METHOD_MPEG);
+
vf.tuner = 0;
vf.type = V4L2_TUNER_ANALOG_TV;
vf.frequency = 6400; /* the tuner 'baseline' frequency */
diff -r 3541eb5b56f7 linux/drivers/media/video/cx18/cx18-driver.h
--- a/linux/drivers/media/video/cx18/cx18-driver.h Thu Jan 29 10:57:25 2009 -0200
+++ b/linux/drivers/media/video/cx18/cx18-driver.h Sun Feb 08 20:43:38 2009 -0500
@@ -429,7 +429,6 @@
unsigned long i_flags; /* global cx18 flags */
atomic_t ana_capturing; /* count number of active analog capture streams */
atomic_t tot_capturing; /* total count number of active capture streams */
- spinlock_t lock; /* lock access to this struct */
int search_pack_header;
int open_id; /* incremented each time an open occurs, used as
_______________________________________________
ivtv-users mailing list
[email protected]
http://ivtvdriver.org/mailman/listinfo/ivtv-users