diff options
Diffstat (limited to 'linux/drivers/media/video/cx88/cx88-tvaudio.c')
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-tvaudio.c | 83 |
1 files changed, 45 insertions, 38 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-tvaudio.c b/linux/drivers/media/video/cx88/cx88-tvaudio.c index 06faebd3a..0810b9ede 100644 --- a/linux/drivers/media/video/cx88/cx88-tvaudio.c +++ b/linux/drivers/media/video/cx88/cx88-tvaudio.c @@ -57,7 +57,7 @@ MODULE_PARM(audio_debug,"i"); MODULE_PARM_DESC(audio_debug,"enable debug messages [audio]"); #define dprintk(fmt, arg...) if (audio_debug) \ - printk(KERN_DEBUG "%s: " fmt, dev->name , ## arg) + printk(KERN_DEBUG "%s/0: " fmt, core->name , ## arg) /* ----------------------------------------------------------- */ @@ -93,7 +93,7 @@ struct rlist { u32 val; }; -static void set_audio_registers(struct cx8800_dev *dev, +static void set_audio_registers(struct cx88_core *core, const struct rlist *l) { int i; @@ -115,7 +115,7 @@ static void set_audio_registers(struct cx8800_dev *dev, } } -static void set_audio_start(struct cx8800_dev *dev, +static void set_audio_start(struct cx88_core *core, u32 mode, u32 ctl) { // mute @@ -133,7 +133,7 @@ static void set_audio_start(struct cx8800_dev *dev, cx_write(AUD_CTL, ctl); } -static void set_audio_finish(struct cx8800_dev *dev) +static void set_audio_finish(struct cx88_core *core) { u32 volume; @@ -150,7 +150,7 @@ static void set_audio_finish(struct cx8800_dev *dev) /* ----------------------------------------------------------- */ -static void set_audio_standard_BTSC(struct cx8800_dev *dev, unsigned int sap) +static void set_audio_standard_BTSC(struct cx88_core *core, unsigned int sap) { static const struct rlist btsc[] = { /* from dscaler */ @@ -247,20 +247,22 @@ static void set_audio_standard_BTSC(struct cx8800_dev *dev, unsigned int sap) // dscaler: don't know why to set EN_FMRADIO_EN_RDS if (sap) { dprintk("%s SAP (status: unknown)\n",__FUNCTION__); - set_audio_start(dev, 0x0001, + set_audio_start(core, 0x0001, EN_FMRADIO_EN_RDS | EN_BTSC_FORCE_SAP); - set_audio_registers(dev, btsc_sap); + set_audio_registers(core, btsc_sap); } else { dprintk("%s (status: known-good)\n",__FUNCTION__); - set_audio_start(dev, 0x0001, + set_audio_start(core, 0x0001, EN_FMRADIO_EN_RDS | EN_BTSC_AUTO_STEREO); - set_audio_registers(dev, btsc); + set_audio_registers(core, btsc); } - set_audio_finish(dev); + set_audio_finish(core); } static void set_audio_standard_NICAM(struct cx8800_dev *dev) { + struct cx88_core *core = dev->core; + static const struct rlist nicam_common[] = { /* from dscaler */ { AUD_RATE_ADJ1, 0x00000010 }, @@ -316,22 +318,22 @@ static void set_audio_standard_NICAM(struct cx8800_dev *dev) { /* end of list */ }, }; - set_audio_start(dev, 0x0010, + set_audio_start(core, 0x0010, EN_DMTRX_LR | EN_DMTRX_BYPASS | EN_NICAM_AUTO_STEREO); - set_audio_registers(dev, nicam_common); + set_audio_registers(core, nicam_common); switch (dev->tvaudio) { case WW_NICAM_I: dprintk("%s PAL-I NICAM (status: unknown)\n",__FUNCTION__); - set_audio_registers(dev, nicam_pal_i); + set_audio_registers(core, nicam_pal_i); case WW_NICAM_BGDKL: dprintk("%s PAL NICAM (status: unknown)\n",__FUNCTION__); - set_audio_registers(dev, nicam_default); + set_audio_registers(core, nicam_default); break; }; - set_audio_finish(dev); + set_audio_finish(core); } -static void set_audio_standard_NICAM_L(struct cx8800_dev *dev) +static void set_audio_standard_NICAM_L(struct cx88_core *core) { /* This is officially wierd.. register dumps indicate windows * uses audio mode 4.. A2. Let's operate and find out. */ @@ -449,14 +451,16 @@ static void set_audio_standard_NICAM_L(struct cx8800_dev *dev) }; dprintk("%s (status: unknown)\n",__FUNCTION__); - set_audio_start(dev, 0x0004, + set_audio_start(core, 0x0004, 0 /* FIXME */); - set_audio_registers(dev, nicam_l); - set_audio_finish(dev); + set_audio_registers(core, nicam_l); + set_audio_finish(core); } static void set_audio_standard_A2(struct cx8800_dev *dev) { + struct cx88_core *core = dev->core; + /* from dscaler cvs */ static const struct rlist a2_common[] = { { AUD_PDF_DDS_CNST_BYTE2, 0x06 }, @@ -545,26 +549,26 @@ static void set_audio_standard_A2(struct cx8800_dev *dev) { /* end of list */ }, }; - set_audio_start(dev, 0x0004, EN_DMTRX_SUMDIFF | EN_A2_AUTO_STEREO); - set_audio_registers(dev, a2_common); + set_audio_start(core, 0x0004, EN_DMTRX_SUMDIFF | EN_A2_AUTO_STEREO); + set_audio_registers(core, a2_common); switch (dev->tvaudio) { case WW_A2_BG: dprintk("%s PAL-BG A2 (status: known-good)\n",__FUNCTION__); - set_audio_registers(dev, a2_table1); + set_audio_registers(core, a2_table1); break; case WW_A2_DK: dprintk("%s PAL-DK A2 (status: known-good)\n",__FUNCTION__); - set_audio_registers(dev, a2_table2); + set_audio_registers(core, a2_table2); break; case WW_A2_M: dprintk("%s NTSC-M A2 (status: unknown)\n",__FUNCTION__); - set_audio_registers(dev, a2_table3); + set_audio_registers(core, a2_table3); break; }; - set_audio_finish(dev); + set_audio_finish(core); } -static void set_audio_standard_EIAJ(struct cx8800_dev *dev) +static void set_audio_standard_EIAJ(struct cx88_core *core) { static const struct rlist eiaj[] = { /* TODO: eiaj register settings are not there yet ... */ @@ -573,12 +577,12 @@ static void set_audio_standard_EIAJ(struct cx8800_dev *dev) }; dprintk("%s (status: unknown)\n",__FUNCTION__); - set_audio_start(dev, 0x0002, EN_EIAJ_AUTO_STEREO); - set_audio_registers(dev, eiaj); - set_audio_finish(dev); + set_audio_start(core, 0x0002, EN_EIAJ_AUTO_STEREO); + set_audio_registers(core, eiaj); + set_audio_finish(core); } -static void set_audio_standard_FM(struct cx8800_dev *dev) +static void set_audio_standard_FM(struct cx88_core *core) { #if 0 /* FIXME */ switch (dev->audio_properties.FM_deemphasis) @@ -618,12 +622,12 @@ static void set_audio_standard_FM(struct cx8800_dev *dev) #endif dprintk("%s (status: unknown)\n",__FUNCTION__); - set_audio_start(dev, 0x0020, EN_FMRADIO_AUTO_STEREO); + set_audio_start(core, 0x0020, EN_FMRADIO_AUTO_STEREO); // AB: 10/2/01: this register is not being reset appropriately on occasion. cx_write(AUD_POLYPH80SCALEFAC,3); - set_audio_finish(dev); + set_audio_finish(core); } /* ----------------------------------------------------------- */ @@ -632,7 +636,7 @@ void cx88_set_tvaudio(struct cx8800_dev *dev) { switch (dev->tvaudio) { case WW_BTSC: - set_audio_standard_BTSC(dev,0); + set_audio_standard_BTSC(dev->core,0); break; case WW_NICAM_I: case WW_NICAM_BGDKL: @@ -644,18 +648,18 @@ void cx88_set_tvaudio(struct cx8800_dev *dev) set_audio_standard_A2(dev); break; case WW_EIAJ: - set_audio_standard_EIAJ(dev); + set_audio_standard_EIAJ(dev->core); break; case WW_FM: - set_audio_standard_FM(dev); + set_audio_standard_FM(dev->core); break; case WW_SYSTEM_L_AM: - set_audio_standard_NICAM_L(dev); + set_audio_standard_NICAM_L(dev->core); break; case WW_NONE: default: - printk("%s: unknown tv audio mode [%d]\n", - dev->name, dev->tvaudio); + printk("%s/0: unknown tv audio mode [%d]\n", + dev->core->name, dev->tvaudio); break; } return; @@ -665,6 +669,7 @@ void cx88_get_stereo(struct cx8800_dev *dev, struct v4l2_tuner *t) { static char *m[] = {"stereo", "dual mono", "mono", "sap"}; static char *p[] = {"no pilot", "pilot c1", "pilot c2", "?"}; + struct cx88_core *core = dev->core; u32 reg,mode,pilot; reg = cx_read(AUD_STATUS); @@ -712,6 +717,7 @@ void cx88_get_stereo(struct cx8800_dev *dev, struct v4l2_tuner *t) void cx88_set_stereo(struct cx8800_dev *dev, u32 mode) { + struct cx88_core *core = dev->core; u32 ctl = UNSET; u32 mask = UNSET; @@ -781,6 +787,7 @@ void cx88_set_stereo(struct cx8800_dev *dev, u32 mode) int cx88_audio_thread(void *data) { struct cx8800_dev *dev = data; + struct cx88_core *core = dev->core; struct v4l2_tuner t; #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,61) |