summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/cx88
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/cx88')
-rw-r--r--linux/drivers/media/video/cx88/cx88-tvaudio.c67
-rw-r--r--linux/drivers/media/video/cx88/cx88-video.c9
-rw-r--r--linux/drivers/media/video/cx88/cx88.h4
3 files changed, 77 insertions, 3 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-tvaudio.c b/linux/drivers/media/video/cx88/cx88-tvaudio.c
index 5402709aa..d73751a9d 100644
--- a/linux/drivers/media/video/cx88/cx88-tvaudio.c
+++ b/linux/drivers/media/video/cx88/cx88-tvaudio.c
@@ -60,6 +60,33 @@ MODULE_PARM_DESC(audio_debug,"enable debug messages [audio]");
/* ----------------------------------------------------------- */
+static char *aud_ctl_names[64] =
+{
+ [ EN_BTSC_FORCE_MONO ] = "BTSC_FORCE_MONO",
+ [ EN_BTSC_FORCE_STEREO ] = "BTSC_FORCE_STEREO",
+ [ EN_BTSC_FORCE_SAP ] = "BTSC_FORCE_SAP",
+ [ EN_BTSC_AUTO_STEREO ] = "BTSC_AUTO_STEREO",
+ [ EN_BTSC_AUTO_SAP ] = "BTSC_AUTO_SAP",
+ [ EN_A2_FORCE_MONO1 ] = "A2_FORCE_MONO1",
+ [ EN_A2_FORCE_MONO2 ] = "A2_FORCE_MONO2",
+ [ EN_A2_FORCE_STEREO ] = "A2_FORCE_STEREO",
+ [ EN_A2_AUTO_MONO2 ] = "A2_AUTO_MONO2",
+ [ EN_A2_AUTO_STEREO ] = "A2_AUTO_STEREO",
+ [ EN_EIAJ_FORCE_MONO1 ] = "EIAJ_FORCE_MONO1",
+ [ EN_EIAJ_FORCE_MONO2 ] = "EIAJ_FORCE_MONO2",
+ [ EN_EIAJ_FORCE_STEREO ] = "EIAJ_FORCE_STEREO",
+ [ EN_EIAJ_AUTO_MONO2 ] = "EIAJ_AUTO_MONO2",
+ [ EN_EIAJ_AUTO_STEREO ] = "EIAJ_AUTO_STEREO",
+ [ EN_NICAM_FORCE_MONO1 ] = "NICAM_FORCE_MONO1",
+ [ EN_NICAM_FORCE_MONO2 ] = "NICAM_FORCE_MONO2",
+ [ EN_NICAM_FORCE_STEREO ] = "NICAM_FORCE_STEREO",
+ [ EN_NICAM_AUTO_MONO2 ] = "NICAM_AUTO_MONO2",
+ [ EN_NICAM_AUTO_STEREO ] = "NICAM_AUTO_STEREO",
+ [ EN_FMRADIO_FORCE_MONO ] = "FMRADIO_FORCE_MONO",
+ [ EN_FMRADIO_FORCE_STEREO ] = "FMRADIO_FORCE_STEREO",
+ [ EN_FMRADIO_AUTO_STEREO ] = "FMRADIO_AUTO_STEREO",
+};
+
struct rlist {
u32 reg;
u32 val;
@@ -579,9 +606,9 @@ void cx88_get_stereo(struct cx8800_dev *dev, struct v4l2_tuner *t)
reg = cx_read(AUD_STATUS);
mode = reg & 0x03;
pilot = (reg >> 2) & 0x03;
- dprintk("AUD_STATUS: %s / %s [status=0x%x,ctl=0x%x,vol=0x%x]\n",
- m[mode], p[pilot], reg,
- cx_read(AUD_CTL), cx_sread(SHADOW_AUD_VOL_CTL));
+ dprintk("AUD_STATUS: 0x%x [%s/%s] ctl=%s\n",
+ reg, m[mode], p[pilot],
+ aud_ctl_names[cx_read(AUD_CTL) & 63]);
t->capability = V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_SAP |
V4L2_TUNER_CAP_LANG1 | V4L2_TUNER_CAP_LANG2;
@@ -683,6 +710,40 @@ void cx88_set_stereo(struct cx8800_dev *dev, u32 mode)
return;
}
+/* just monitor the audio status for now ... */
+int cx88_audio_thread(void *data)
+{
+ struct cx8800_dev *dev = data;
+ struct v4l2_tuner t;
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,61)
+ lock_kernel();
+ daemonize();
+ sigfillset(&current->blocked);
+ strcpy(current->comm,"msp3400");
+ unlock_kernel();
+#else
+ daemonize("msp3400");
+ allow_signal(SIGTERM);
+#endif
+ dprintk("cx88: tvaudio thread started\n");
+
+ for (;;) {
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(HZ*3);
+ if (signal_pending(current))
+ break;
+ if (dev->shutdown)
+ break;
+
+ memset(&t,0,sizeof(t));
+ cx88_get_stereo(dev,&t);
+ }
+
+ dprintk("cx88: tvaudio thread exiting\n");
+ complete_and_exit(&dev->texit, 0);
+}
+
/*
* Local variables:
* c-basic-offset: 8
diff --git a/linux/drivers/media/video/cx88/cx88-video.c b/linux/drivers/media/video/cx88/cx88-video.c
index 7d416d44a..dd2bb6748 100644
--- a/linux/drivers/media/video/cx88/cx88-video.c
+++ b/linux/drivers/media/video/cx88/cx88-video.c
@@ -2482,6 +2482,10 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
set_tvnorm(dev,tvnorms);
video_mux(dev,0);
up(&dev->lock);
+
+ /* start tvaudio thread */
+ init_completion(&dev->texit);
+ dev->tpid = kernel_thread(cx88_audio_thread, dev, 0);
return 0;
fail3:
@@ -2504,6 +2508,11 @@ static void __devexit cx8800_finidev(struct pci_dev *pci_dev)
{
struct cx8800_dev *dev = pci_get_drvdata(pci_dev);
+ /* stop thread */
+ dev->shutdown = 1;
+ if (dev->tpid >= 0)
+ wait_for_completion(&dev->texit);
+
cx8800_shutdown(dev);
pci_disable_device(pci_dev);
diff --git a/linux/drivers/media/video/cx88/cx88.h b/linux/drivers/media/video/cx88/cx88.h
index e4d459913..f7fd2eefe 100644
--- a/linux/drivers/media/video/cx88/cx88.h
+++ b/linux/drivers/media/video/cx88/cx88.h
@@ -280,6 +280,9 @@ struct cx8800_dev {
/* other global state info */
u32 shadow[SHADOW_MAX];
+ int shutdown;
+ pid_t tpid;
+ struct completion texit;
struct cx8800_suspend_state state;
};
@@ -389,6 +392,7 @@ extern void __devinit cx88_card_setup(struct cx8800_dev *dev);
void cx88_set_tvaudio(struct cx8800_dev *dev);
void cx88_get_stereo(struct cx8800_dev *dev, struct v4l2_tuner *t);
void cx88_set_stereo(struct cx8800_dev *dev, u32 mode);
+int cx88_audio_thread(void *data);
/*
* Local variables: