aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx88')
-rw-r--r--drivers/media/video/cx88/cx88-alsa.c117
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c16
-rw-r--r--drivers/media/video/cx88/cx88-cards.c44
-rw-r--r--drivers/media/video/cx88/cx88-core.c30
-rw-r--r--drivers/media/video/cx88/cx88-dsp.c11
-rw-r--r--drivers/media/video/cx88/cx88-dvb.c181
-rw-r--r--drivers/media/video/cx88/cx88-i2c.c31
-rw-r--r--drivers/media/video/cx88/cx88-input.c57
-rw-r--r--drivers/media/video/cx88/cx88-mpeg.c6
-rw-r--r--drivers/media/video/cx88/cx88-tvaudio.c43
-rw-r--r--drivers/media/video/cx88/cx88-vbi.c2
-rw-r--r--drivers/media/video/cx88/cx88-video.c86
-rw-r--r--drivers/media/video/cx88/cx88-vp3054-i2c.c2
-rw-r--r--drivers/media/video/cx88/cx88.h74
14 files changed, 464 insertions, 236 deletions
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c
index 4f383cdf5296..4aaa47c0eabf 100644
--- a/drivers/media/video/cx88/cx88-alsa.c
+++ b/drivers/media/video/cx88/cx88-alsa.c
@@ -40,6 +40,7 @@
40#include <sound/control.h> 40#include <sound/control.h>
41#include <sound/initval.h> 41#include <sound/initval.h>
42#include <sound/tlv.h> 42#include <sound/tlv.h>
43#include <media/wm8775.h>
43 44
44#include "cx88.h" 45#include "cx88.h"
45#include "cx88-reg.h" 46#include "cx88-reg.h"
@@ -94,7 +95,7 @@ typedef struct cx88_audio_dev snd_cx88_card_t;
94 ****************************************************************************/ 95 ****************************************************************************/
95 96
96static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 97static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
97static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 98static const char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
98static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 1}; 99static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 1};
99 100
100module_param_array(enable, bool, NULL, 0444); 101module_param_array(enable, bool, NULL, 0444);
@@ -131,7 +132,7 @@ static int _cx88_start_audio_dma(snd_cx88_card_t *chip)
131{ 132{
132 struct cx88_audio_buffer *buf = chip->buf; 133 struct cx88_audio_buffer *buf = chip->buf;
133 struct cx88_core *core=chip->core; 134 struct cx88_core *core=chip->core;
134 struct sram_channel *audio_ch = &cx88_sram_channels[SRAM_CH25]; 135 const struct sram_channel *audio_ch = &cx88_sram_channels[SRAM_CH25];
135 136
136 /* Make sure RISC/FIFO are off before changing FIFO/RISC settings */ 137 /* Make sure RISC/FIFO are off before changing FIFO/RISC settings */
137 cx_clear(MO_AUD_DMACNTRL, 0x11); 138 cx_clear(MO_AUD_DMACNTRL, 0x11);
@@ -197,7 +198,7 @@ static int _cx88_stop_audio_dma(snd_cx88_card_t *chip)
197/* 198/*
198 * BOARD Specific: IRQ dma bits 199 * BOARD Specific: IRQ dma bits
199 */ 200 */
200static char *cx88_aud_irqs[32] = { 201static const char *cx88_aud_irqs[32] = {
201 "dn_risci1", "up_risci1", "rds_dn_risc1", /* 0-2 */ 202 "dn_risci1", "up_risci1", "rds_dn_risc1", /* 0-2 */
202 NULL, /* reserved */ 203 NULL, /* reserved */
203 "dn_risci2", "up_risci2", "rds_dn_risc2", /* 4-6 */ 204 "dn_risci2", "up_risci2", "rds_dn_risc2", /* 4-6 */
@@ -308,7 +309,7 @@ static int dsp_buffer_free(snd_cx88_card_t *chip)
308 * Digital hardware definition 309 * Digital hardware definition
309 */ 310 */
310#define DEFAULT_FIFO_SIZE 4096 311#define DEFAULT_FIFO_SIZE 4096
311static struct snd_pcm_hardware snd_cx88_digital_hw = { 312static const struct snd_pcm_hardware snd_cx88_digital_hw = {
312 .info = SNDRV_PCM_INFO_MMAP | 313 .info = SNDRV_PCM_INFO_MMAP |
313 SNDRV_PCM_INFO_INTERLEAVED | 314 SNDRV_PCM_INFO_INTERLEAVED |
314 SNDRV_PCM_INFO_BLOCK_TRANSFER | 315 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -533,7 +534,7 @@ static struct snd_pcm_ops snd_cx88_pcm_ops = {
533/* 534/*
534 * create a PCM device 535 * create a PCM device
535 */ 536 */
536static int __devinit snd_cx88_pcm(snd_cx88_card_t *chip, int device, char *name) 537static int __devinit snd_cx88_pcm(snd_cx88_card_t *chip, int device, const char *name)
537{ 538{
538 int err; 539 int err;
539 struct snd_pcm *pcm; 540 struct snd_pcm *pcm;
@@ -586,26 +587,47 @@ static int snd_cx88_volume_put(struct snd_kcontrol *kcontrol,
586 int left, right, v, b; 587 int left, right, v, b;
587 int changed = 0; 588 int changed = 0;
588 u32 old; 589 u32 old;
590 struct v4l2_control client_ctl;
591
592 /* Pass volume & balance onto any WM8775 */
593 if (value->value.integer.value[0] >= value->value.integer.value[1]) {
594 v = value->value.integer.value[0] << 10;
595 b = value->value.integer.value[0] ?
596 (0x8000 * value->value.integer.value[1]) / value->value.integer.value[0] :
597 0x8000;
598 } else {
599 v = value->value.integer.value[1] << 10;
600 b = value->value.integer.value[1] ?
601 0xffff - (0x8000 * value->value.integer.value[0]) / value->value.integer.value[1] :
602 0x8000;
603 }
604 client_ctl.value = v;
605 client_ctl.id = V4L2_CID_AUDIO_VOLUME;
606 call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl);
607
608 client_ctl.value = b;
609 client_ctl.id = V4L2_CID_AUDIO_BALANCE;
610 call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl);
589 611
590 left = value->value.integer.value[0] & 0x3f; 612 left = value->value.integer.value[0] & 0x3f;
591 right = value->value.integer.value[1] & 0x3f; 613 right = value->value.integer.value[1] & 0x3f;
592 b = right - left; 614 b = right - left;
593 if (b < 0) { 615 if (b < 0) {
594 v = 0x3f - left; 616 v = 0x3f - left;
595 b = (-b) | 0x40; 617 b = (-b) | 0x40;
596 } else { 618 } else {
597 v = 0x3f - right; 619 v = 0x3f - right;
598 } 620 }
599 /* Do we really know this will always be called with IRQs on? */ 621 /* Do we really know this will always be called with IRQs on? */
600 spin_lock_irq(&chip->reg_lock); 622 spin_lock_irq(&chip->reg_lock);
601 old = cx_read(AUD_VOL_CTL); 623 old = cx_read(AUD_VOL_CTL);
602 if (v != (old & 0x3f)) { 624 if (v != (old & 0x3f)) {
603 cx_write(AUD_VOL_CTL, (old & ~0x3f) | v); 625 cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, (old & ~0x3f) | v);
604 changed = 1; 626 changed = 1;
605 } 627 }
606 if (cx_read(AUD_BAL_CTL) != b) { 628 if ((cx_read(AUD_BAL_CTL) & 0x7f) != b) {
607 cx_write(AUD_BAL_CTL, b); 629 cx_write(AUD_BAL_CTL, b);
608 changed = 1; 630 changed = 1;
609 } 631 }
610 spin_unlock_irq(&chip->reg_lock); 632 spin_unlock_irq(&chip->reg_lock);
611 633
@@ -614,11 +636,11 @@ static int snd_cx88_volume_put(struct snd_kcontrol *kcontrol,
614 636
615static const DECLARE_TLV_DB_SCALE(snd_cx88_db_scale, -6300, 100, 0); 637static const DECLARE_TLV_DB_SCALE(snd_cx88_db_scale, -6300, 100, 0);
616 638
617static struct snd_kcontrol_new snd_cx88_volume = { 639static const struct snd_kcontrol_new snd_cx88_volume = {
618 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 640 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
619 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | 641 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
620 SNDRV_CTL_ELEM_ACCESS_TLV_READ, 642 SNDRV_CTL_ELEM_ACCESS_TLV_READ,
621 .name = "Playback Volume", 643 .name = "Analog-TV Volume",
622 .info = snd_cx88_volume_info, 644 .info = snd_cx88_volume_info,
623 .get = snd_cx88_volume_get, 645 .get = snd_cx88_volume_get,
624 .put = snd_cx88_volume_put, 646 .put = snd_cx88_volume_put,
@@ -649,31 +671,74 @@ static int snd_cx88_switch_put(struct snd_kcontrol *kcontrol,
649 vol = cx_read(AUD_VOL_CTL); 671 vol = cx_read(AUD_VOL_CTL);
650 if (value->value.integer.value[0] != !(vol & bit)) { 672 if (value->value.integer.value[0] != !(vol & bit)) {
651 vol ^= bit; 673 vol ^= bit;
652 cx_write(AUD_VOL_CTL, vol); 674 cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, vol);
675 /* Pass mute onto any WM8775 */
676 if ((1<<6) == bit) {
677 struct v4l2_control client_ctl;
678 client_ctl.value = 0 != (vol & bit);
679 client_ctl.id = V4L2_CID_AUDIO_MUTE;
680 call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl);
681 }
653 ret = 1; 682 ret = 1;
654 } 683 }
655 spin_unlock_irq(&chip->reg_lock); 684 spin_unlock_irq(&chip->reg_lock);
656 return ret; 685 return ret;
657} 686}
658 687
659static struct snd_kcontrol_new snd_cx88_dac_switch = { 688static const struct snd_kcontrol_new snd_cx88_dac_switch = {
660 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 689 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
661 .name = "Playback Switch", 690 .name = "Audio-Out Switch",
662 .info = snd_ctl_boolean_mono_info, 691 .info = snd_ctl_boolean_mono_info,
663 .get = snd_cx88_switch_get, 692 .get = snd_cx88_switch_get,
664 .put = snd_cx88_switch_put, 693 .put = snd_cx88_switch_put,
665 .private_value = (1<<8), 694 .private_value = (1<<8),
666}; 695};
667 696
668static struct snd_kcontrol_new snd_cx88_source_switch = { 697static const struct snd_kcontrol_new snd_cx88_source_switch = {
669 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 698 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
670 .name = "Capture Switch", 699 .name = "Analog-TV Switch",
671 .info = snd_ctl_boolean_mono_info, 700 .info = snd_ctl_boolean_mono_info,
672 .get = snd_cx88_switch_get, 701 .get = snd_cx88_switch_get,
673 .put = snd_cx88_switch_put, 702 .put = snd_cx88_switch_put,
674 .private_value = (1<<6), 703 .private_value = (1<<6),
675}; 704};
676 705
706static int snd_cx88_alc_get(struct snd_kcontrol *kcontrol,
707 struct snd_ctl_elem_value *value)
708{
709 snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol);
710 struct cx88_core *core = chip->core;
711 struct v4l2_control client_ctl;
712
713 client_ctl.id = V4L2_CID_AUDIO_LOUDNESS;
714 call_hw(core, WM8775_GID, core, g_ctrl, &client_ctl);
715 value->value.integer.value[0] = client_ctl.value ? 1 : 0;
716
717 return 0;
718}
719
720static int snd_cx88_alc_put(struct snd_kcontrol *kcontrol,
721 struct snd_ctl_elem_value *value)
722{
723 snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol);
724 struct cx88_core *core = chip->core;
725 struct v4l2_control client_ctl;
726
727 client_ctl.value = 0 != value->value.integer.value[0];
728 client_ctl.id = V4L2_CID_AUDIO_LOUDNESS;
729 call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl);
730
731 return 0;
732}
733
734static struct snd_kcontrol_new snd_cx88_alc_switch = {
735 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
736 .name = "Line-In ALC Switch",
737 .info = snd_ctl_boolean_mono_info,
738 .get = snd_cx88_alc_get,
739 .put = snd_cx88_alc_put,
740};
741
677/**************************************************************************** 742/****************************************************************************
678 Basic Flow for Sound Devices 743 Basic Flow for Sound Devices
679 ****************************************************************************/ 744 ****************************************************************************/
@@ -683,7 +748,7 @@ static struct snd_kcontrol_new snd_cx88_source_switch = {
683 * Only boards with eeprom and byte 1 at eeprom=1 have it 748 * Only boards with eeprom and byte 1 at eeprom=1 have it
684 */ 749 */
685 750
686static struct pci_device_id cx88_audio_pci_tbl[] __devinitdata = { 751static const struct pci_device_id const cx88_audio_pci_tbl[] __devinitdata = {
687 {0x14f1,0x8801,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, 752 {0x14f1,0x8801,PCI_ANY_ID,PCI_ANY_ID,0,0,0},
688 {0x14f1,0x8811,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, 753 {0x14f1,0x8811,PCI_ANY_ID,PCI_ANY_ID,0,0,0},
689 {0, } 754 {0, }
@@ -795,6 +860,7 @@ static int __devinit cx88_audio_initdev(struct pci_dev *pci,
795{ 860{
796 struct snd_card *card; 861 struct snd_card *card;
797 snd_cx88_card_t *chip; 862 snd_cx88_card_t *chip;
863 struct v4l2_subdev *sd;
798 int err; 864 int err;
799 865
800 if (devno >= SNDRV_CARDS) 866 if (devno >= SNDRV_CARDS)
@@ -830,6 +896,15 @@ static int __devinit cx88_audio_initdev(struct pci_dev *pci,
830 if (err < 0) 896 if (err < 0)
831 goto error; 897 goto error;
832 898
899 /* If there's a wm8775 then add a Line-In ALC switch */
900 list_for_each_entry(sd, &chip->core->v4l2_dev.subdevs, list) {
901 if (WM8775_GID == sd->grp_id) {
902 snd_ctl_add(card, snd_ctl_new1(&snd_cx88_alc_switch,
903 chip));
904 break;
905 }
906 }
907
833 strcpy (card->driver, "CX88x"); 908 strcpy (card->driver, "CX88x");
834 sprintf(card->shortname, "Conexant CX%x", pci->device); 909 sprintf(card->shortname, "Conexant CX%x", pci->device);
835 sprintf(card->longname, "%s at %#llx", 910 sprintf(card->longname, "%s at %#llx",
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index 660b2a927feb..417d1d5c73c4 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -1057,7 +1057,7 @@ static int mpeg_open(struct file *file)
1057 1057
1058 dprintk( 1, "%s\n", __func__); 1058 dprintk( 1, "%s\n", __func__);
1059 1059
1060 lock_kernel(); 1060 mutex_lock(&dev->core->lock);
1061 1061
1062 /* Make sure we can acquire the hardware */ 1062 /* Make sure we can acquire the hardware */
1063 drv = cx8802_get_driver(dev, CX88_MPEG_BLACKBIRD); 1063 drv = cx8802_get_driver(dev, CX88_MPEG_BLACKBIRD);
@@ -1065,7 +1065,7 @@ static int mpeg_open(struct file *file)
1065 err = drv->request_acquire(drv); 1065 err = drv->request_acquire(drv);
1066 if(err != 0) { 1066 if(err != 0) {
1067 dprintk(1,"%s: Unable to acquire hardware, %d\n", __func__, err); 1067 dprintk(1,"%s: Unable to acquire hardware, %d\n", __func__, err);
1068 unlock_kernel(); 1068 mutex_unlock(&dev->core->lock);;
1069 return err; 1069 return err;
1070 } 1070 }
1071 } 1071 }
@@ -1073,7 +1073,7 @@ static int mpeg_open(struct file *file)
1073 if (!atomic_read(&dev->core->mpeg_users) && blackbird_initialize_codec(dev) < 0) { 1073 if (!atomic_read(&dev->core->mpeg_users) && blackbird_initialize_codec(dev) < 0) {
1074 if (drv) 1074 if (drv)
1075 drv->request_release(drv); 1075 drv->request_release(drv);
1076 unlock_kernel(); 1076 mutex_unlock(&dev->core->lock);
1077 return -EINVAL; 1077 return -EINVAL;
1078 } 1078 }
1079 dprintk(1, "open dev=%s\n", video_device_node_name(vdev)); 1079 dprintk(1, "open dev=%s\n", video_device_node_name(vdev));
@@ -1083,7 +1083,7 @@ static int mpeg_open(struct file *file)
1083 if (NULL == fh) { 1083 if (NULL == fh) {
1084 if (drv) 1084 if (drv)
1085 drv->request_release(drv); 1085 drv->request_release(drv);
1086 unlock_kernel(); 1086 mutex_unlock(&dev->core->lock);
1087 return -ENOMEM; 1087 return -ENOMEM;
1088 } 1088 }
1089 file->private_data = fh; 1089 file->private_data = fh;
@@ -1094,15 +1094,14 @@ static int mpeg_open(struct file *file)
1094 V4L2_BUF_TYPE_VIDEO_CAPTURE, 1094 V4L2_BUF_TYPE_VIDEO_CAPTURE,
1095 V4L2_FIELD_INTERLACED, 1095 V4L2_FIELD_INTERLACED,
1096 sizeof(struct cx88_buffer), 1096 sizeof(struct cx88_buffer),
1097 fh); 1097 fh, NULL);
1098 1098
1099 /* FIXME: locking against other video device */ 1099 /* FIXME: locking against other video device */
1100 cx88_set_scale(dev->core, dev->width, dev->height, 1100 cx88_set_scale(dev->core, dev->width, dev->height,
1101 fh->mpegq.field); 1101 fh->mpegq.field);
1102 unlock_kernel();
1103 1102
1104 atomic_inc(&dev->core->mpeg_users); 1103 atomic_inc(&dev->core->mpeg_users);
1105 1104 mutex_unlock(&dev->core->lock);
1106 return 0; 1105 return 0;
1107} 1106}
1108 1107
@@ -1120,8 +1119,11 @@ static int mpeg_release(struct file *file)
1120 videobuf_stop(&fh->mpegq); 1119 videobuf_stop(&fh->mpegq);
1121 1120
1122 videobuf_mmap_free(&fh->mpegq); 1121 videobuf_mmap_free(&fh->mpegq);
1122
1123 mutex_lock(&dev->core->lock);
1123 file->private_data = NULL; 1124 file->private_data = NULL;
1124 kfree(fh); 1125 kfree(fh);
1126 mutex_unlock(&dev->core->lock);
1125 1127
1126 /* Make sure we release the hardware */ 1128 /* Make sure we release the hardware */
1127 drv = cx8802_get_driver(dev, CX88_MPEG_BLACKBIRD); 1129 drv = cx8802_get_driver(dev, CX88_MPEG_BLACKBIRD);
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index e8416b76da67..b26fcba8600c 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -970,15 +970,22 @@ static const struct cx88_board cx88_boards[] = {
970 .radio_type = UNSET, 970 .radio_type = UNSET,
971 .tuner_addr = ADDR_UNSET, 971 .tuner_addr = ADDR_UNSET,
972 .radio_addr = ADDR_UNSET, 972 .radio_addr = ADDR_UNSET,
973 .audio_chip = V4L2_IDENT_WM8775,
973 .input = {{ 974 .input = {{
974 .type = CX88_VMUX_DVB, 975 .type = CX88_VMUX_DVB,
975 .vmux = 0, 976 .vmux = 0,
977 /* 2: Line-In */
978 .audioroute = 2,
976 },{ 979 },{
977 .type = CX88_VMUX_COMPOSITE1, 980 .type = CX88_VMUX_COMPOSITE1,
978 .vmux = 1, 981 .vmux = 1,
982 /* 2: Line-In */
983 .audioroute = 2,
979 },{ 984 },{
980 .type = CX88_VMUX_SVIDEO, 985 .type = CX88_VMUX_SVIDEO,
981 .vmux = 2, 986 .vmux = 2,
987 /* 2: Line-In */
988 .audioroute = 2,
982 }}, 989 }},
983 .mpeg = CX88_MPEG_DVB, 990 .mpeg = CX88_MPEG_DVB,
984 }, 991 },
@@ -2104,6 +2111,18 @@ static const struct cx88_board cx88_boards[] = {
2104 } }, 2111 } },
2105 .mpeg = CX88_MPEG_DVB, 2112 .mpeg = CX88_MPEG_DVB,
2106 }, 2113 },
2114 [CX88_BOARD_TWINHAN_VP1027_DVBS] = {
2115 .name = "Twinhan VP-1027 DVB-S",
2116 .tuner_type = TUNER_ABSENT,
2117 .radio_type = UNSET,
2118 .tuner_addr = ADDR_UNSET,
2119 .radio_addr = ADDR_UNSET,
2120 .input = {{
2121 .type = CX88_VMUX_DVB,
2122 .vmux = 0,
2123 } },
2124 .mpeg = CX88_MPEG_DVB,
2125 },
2107}; 2126};
2108 2127
2109/* ------------------------------------------------------------------ */ 2128/* ------------------------------------------------------------------ */
@@ -2576,6 +2595,10 @@ static const struct cx88_subid cx88_subids[] = {
2576 .subvendor = 0xb034, 2595 .subvendor = 0xb034,
2577 .subdevice = 0x3034, 2596 .subdevice = 0x3034,
2578 .card = CX88_BOARD_PROF_7301, 2597 .card = CX88_BOARD_PROF_7301,
2598 }, {
2599 .subvendor = 0x1822,
2600 .subdevice = 0x0023,
2601 .card = CX88_BOARD_TWINHAN_VP1027_DVBS,
2579 }, 2602 },
2580}; 2603};
2581 2604
@@ -2673,10 +2696,10 @@ static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data)
2673/* ----------------------------------------------------------------------- */ 2696/* ----------------------------------------------------------------------- */
2674/* some GDI (was: Modular Technology) specific stuff */ 2697/* some GDI (was: Modular Technology) specific stuff */
2675 2698
2676static struct { 2699static const struct {
2677 int id; 2700 int id;
2678 int fm; 2701 int fm;
2679 char *name; 2702 const char *name;
2680} gdi_tuner[] = { 2703} gdi_tuner[] = {
2681 [ 0x01 ] = { .id = TUNER_ABSENT, 2704 [ 0x01 ] = { .id = TUNER_ABSENT,
2682 .name = "NTSC_M" }, 2705 .name = "NTSC_M" },
@@ -2710,7 +2733,7 @@ static struct {
2710 2733
2711static void gdi_eeprom(struct cx88_core *core, u8 *eeprom_data) 2734static void gdi_eeprom(struct cx88_core *core, u8 *eeprom_data)
2712{ 2735{
2713 char *name = (eeprom_data[0x0d] < ARRAY_SIZE(gdi_tuner)) 2736 const char *name = (eeprom_data[0x0d] < ARRAY_SIZE(gdi_tuner))
2714 ? gdi_tuner[eeprom_data[0x0d]].name : NULL; 2737 ? gdi_tuner[eeprom_data[0x0d]].name : NULL;
2715 2738
2716 info_printk(core, "GDI: tuner=%s\n", name ? name : "unknown"); 2739 info_printk(core, "GDI: tuner=%s\n", name ? name : "unknown");
@@ -3070,6 +3093,13 @@ static void cx88_card_setup_pre_i2c(struct cx88_core *core)
3070 cx_set(MO_GP1_IO, 0x10); 3093 cx_set(MO_GP1_IO, 0x10);
3071 mdelay(50); 3094 mdelay(50);
3072 break; 3095 break;
3096
3097 case CX88_BOARD_TWINHAN_VP1027_DVBS:
3098 cx_write(MO_GP0_IO, 0x00003230);
3099 cx_write(MO_GP0_IO, 0x00003210);
3100 msleep(1);
3101 cx_write(MO_GP0_IO, 0x00001230);
3102 break;
3073 } 3103 }
3074} 3104}
3075 3105
@@ -3485,19 +3515,19 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
3485 later code configures a tea5767. 3515 later code configures a tea5767.
3486 */ 3516 */
3487 v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap, 3517 v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap,
3488 "tuner", "tuner", 3518 NULL, "tuner",
3489 0, v4l2_i2c_tuner_addrs(ADDRS_RADIO)); 3519 0, v4l2_i2c_tuner_addrs(ADDRS_RADIO));
3490 if (has_demod) 3520 if (has_demod)
3491 v4l2_i2c_new_subdev(&core->v4l2_dev, 3521 v4l2_i2c_new_subdev(&core->v4l2_dev,
3492 &core->i2c_adap, "tuner", "tuner", 3522 &core->i2c_adap, NULL, "tuner",
3493 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); 3523 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD));
3494 if (core->board.tuner_addr == ADDR_UNSET) { 3524 if (core->board.tuner_addr == ADDR_UNSET) {
3495 v4l2_i2c_new_subdev(&core->v4l2_dev, 3525 v4l2_i2c_new_subdev(&core->v4l2_dev,
3496 &core->i2c_adap, "tuner", "tuner", 3526 &core->i2c_adap, NULL, "tuner",
3497 0, has_demod ? tv_addrs + 4 : tv_addrs); 3527 0, has_demod ? tv_addrs + 4 : tv_addrs);
3498 } else { 3528 } else {
3499 v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap, 3529 v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap,
3500 "tuner", "tuner", core->board.tuner_addr, NULL); 3530 NULL, "tuner", core->board.tuner_addr, NULL);
3501 } 3531 }
3502 } 3532 }
3503 3533
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
index 85eb266fb351..2e145f0a5fd9 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -217,7 +217,7 @@ cx88_free_buffer(struct videobuf_queue *q, struct cx88_buffer *buf)
217 struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb); 217 struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
218 218
219 BUG_ON(in_interrupt()); 219 BUG_ON(in_interrupt());
220 videobuf_waiton(&buf->vb,0,0); 220 videobuf_waiton(q, &buf->vb, 0, 0);
221 videobuf_dma_unmap(q->dev, dma); 221 videobuf_dma_unmap(q->dev, dma);
222 videobuf_dma_free(dma); 222 videobuf_dma_free(dma);
223 btcx_riscmem_free(to_pci_dev(q->dev), &buf->risc); 223 btcx_riscmem_free(to_pci_dev(q->dev), &buf->risc);
@@ -253,7 +253,7 @@ cx88_free_buffer(struct videobuf_queue *q, struct cx88_buffer *buf)
253 * 0x0c00 - FIFOs 253 * 0x0c00 - FIFOs
254 */ 254 */
255 255
256struct sram_channel cx88_sram_channels[] = { 256const struct sram_channel const cx88_sram_channels[] = {
257 [SRAM_CH21] = { 257 [SRAM_CH21] = {
258 .name = "video y / packed", 258 .name = "video y / packed",
259 .cmds_start = 0x180040, 259 .cmds_start = 0x180040,
@@ -353,7 +353,7 @@ struct sram_channel cx88_sram_channels[] = {
353}; 353};
354 354
355int cx88_sram_channel_setup(struct cx88_core *core, 355int cx88_sram_channel_setup(struct cx88_core *core,
356 struct sram_channel *ch, 356 const struct sram_channel *ch,
357 unsigned int bpl, u32 risc) 357 unsigned int bpl, u32 risc)
358{ 358{
359 unsigned int i,lines; 359 unsigned int i,lines;
@@ -394,7 +394,7 @@ int cx88_sram_channel_setup(struct cx88_core *core,
394 394
395static int cx88_risc_decode(u32 risc) 395static int cx88_risc_decode(u32 risc)
396{ 396{
397 static char *instr[16] = { 397 static const char * const instr[16] = {
398 [ RISC_SYNC >> 28 ] = "sync", 398 [ RISC_SYNC >> 28 ] = "sync",
399 [ RISC_WRITE >> 28 ] = "write", 399 [ RISC_WRITE >> 28 ] = "write",
400 [ RISC_WRITEC >> 28 ] = "writec", 400 [ RISC_WRITEC >> 28 ] = "writec",
@@ -406,14 +406,14 @@ static int cx88_risc_decode(u32 risc)
406 [ RISC_WRITECM >> 28 ] = "writecm", 406 [ RISC_WRITECM >> 28 ] = "writecm",
407 [ RISC_WRITECR >> 28 ] = "writecr", 407 [ RISC_WRITECR >> 28 ] = "writecr",
408 }; 408 };
409 static int incr[16] = { 409 static int const incr[16] = {
410 [ RISC_WRITE >> 28 ] = 2, 410 [ RISC_WRITE >> 28 ] = 2,
411 [ RISC_JUMP >> 28 ] = 2, 411 [ RISC_JUMP >> 28 ] = 2,
412 [ RISC_WRITERM >> 28 ] = 3, 412 [ RISC_WRITERM >> 28 ] = 3,
413 [ RISC_WRITECM >> 28 ] = 3, 413 [ RISC_WRITECM >> 28 ] = 3,
414 [ RISC_WRITECR >> 28 ] = 4, 414 [ RISC_WRITECR >> 28 ] = 4,
415 }; 415 };
416 static char *bits[] = { 416 static const char * const bits[] = {
417 "12", "13", "14", "resync", 417 "12", "13", "14", "resync",
418 "cnt0", "cnt1", "18", "19", 418 "cnt0", "cnt1", "18", "19",
419 "20", "21", "22", "23", 419 "20", "21", "22", "23",
@@ -432,9 +432,9 @@ static int cx88_risc_decode(u32 risc)
432 432
433 433
434void cx88_sram_channel_dump(struct cx88_core *core, 434void cx88_sram_channel_dump(struct cx88_core *core,
435 struct sram_channel *ch) 435 const struct sram_channel *ch)
436{ 436{
437 static char *name[] = { 437 static const char * const name[] = {
438 "initial risc", 438 "initial risc",
439 "cdt base", 439 "cdt base",
440 "cdt size", 440 "cdt size",
@@ -489,14 +489,14 @@ void cx88_sram_channel_dump(struct cx88_core *core,
489 core->name,cx_read(ch->cnt2_reg)); 489 core->name,cx_read(ch->cnt2_reg));
490} 490}
491 491
492static char *cx88_pci_irqs[32] = { 492static const char *cx88_pci_irqs[32] = {
493 "vid", "aud", "ts", "vip", "hst", "5", "6", "tm1", 493 "vid", "aud", "ts", "vip", "hst", "5", "6", "tm1",
494 "src_dma", "dst_dma", "risc_rd_err", "risc_wr_err", 494 "src_dma", "dst_dma", "risc_rd_err", "risc_wr_err",
495 "brdg_err", "src_dma_err", "dst_dma_err", "ipb_dma_err", 495 "brdg_err", "src_dma_err", "dst_dma_err", "ipb_dma_err",
496 "i2c", "i2c_rack", "ir_smp", "gpio0", "gpio1" 496 "i2c", "i2c_rack", "ir_smp", "gpio0", "gpio1"
497}; 497};
498 498
499void cx88_print_irqbits(char *name, char *tag, char **strings, 499void cx88_print_irqbits(const char *name, const char *tag, const char *strings[],
500 int len, u32 bits, u32 mask) 500 int len, u32 bits, u32 mask)
501{ 501{
502 unsigned int i; 502 unsigned int i;
@@ -770,7 +770,7 @@ static const u32 xtal = 28636363;
770 770
771static int set_pll(struct cx88_core *core, int prescale, u32 ofreq) 771static int set_pll(struct cx88_core *core, int prescale, u32 ofreq)
772{ 772{
773 static u32 pre[] = { 0, 0, 0, 3, 2, 1 }; 773 static const u32 pre[] = { 0, 0, 0, 3, 2, 1 };
774 u64 pll; 774 u64 pll;
775 u32 reg; 775 u32 reg;
776 int i; 776 int i;
@@ -879,7 +879,7 @@ static int set_tvaudio(struct cx88_core *core)
879 } else { 879 } else {
880 printk("%s/0: tvaudio support needs work for this tv norm [%s], sorry\n", 880 printk("%s/0: tvaudio support needs work for this tv norm [%s], sorry\n",
881 core->name, v4l2_norm_to_name(core->tvnorm)); 881 core->name, v4l2_norm_to_name(core->tvnorm));
882 core->tvaudio = 0; 882 core->tvaudio = WW_NONE;
883 return 0; 883 return 0;
884 } 884 }
885 885
@@ -1020,15 +1020,15 @@ int cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm)
1020 1020
1021struct video_device *cx88_vdev_init(struct cx88_core *core, 1021struct video_device *cx88_vdev_init(struct cx88_core *core,
1022 struct pci_dev *pci, 1022 struct pci_dev *pci,
1023 struct video_device *template, 1023 const struct video_device *template_,
1024 char *type) 1024 const char *type)
1025{ 1025{
1026 struct video_device *vfd; 1026 struct video_device *vfd;
1027 1027
1028 vfd = video_device_alloc(); 1028 vfd = video_device_alloc();
1029 if (NULL == vfd) 1029 if (NULL == vfd)
1030 return NULL; 1030 return NULL;
1031 *vfd = *template; 1031 *vfd = *template_;
1032 vfd->v4l2_dev = &core->v4l2_dev; 1032 vfd->v4l2_dev = &core->v4l2_dev;
1033 vfd->parent = &pci->dev; 1033 vfd->parent = &pci->dev;
1034 vfd->release = video_device_release; 1034 vfd->release = video_device_release;
diff --git a/drivers/media/video/cx88/cx88-dsp.c b/drivers/media/video/cx88/cx88-dsp.c
index a94e00a4ac5d..a9907265ff66 100644
--- a/drivers/media/video/cx88/cx88-dsp.c
+++ b/drivers/media/video/cx88/cx88-dsp.c
@@ -230,7 +230,7 @@ static s32 detect_btsc(struct cx88_core *core, s16 x[], u32 N)
230 230
231static s16 *read_rds_samples(struct cx88_core *core, u32 *N) 231static s16 *read_rds_samples(struct cx88_core *core, u32 *N)
232{ 232{
233 struct sram_channel *srch = &cx88_sram_channels[SRAM_CH27]; 233 const struct sram_channel *srch = &cx88_sram_channels[SRAM_CH27];
234 s16 *samples; 234 s16 *samples;
235 235
236 unsigned int i; 236 unsigned int i;
@@ -292,11 +292,20 @@ s32 cx88_dsp_detect_stereo_sap(struct cx88_core *core)
292 switch (core->tvaudio) { 292 switch (core->tvaudio) {
293 case WW_BG: 293 case WW_BG:
294 case WW_DK: 294 case WW_DK:
295 case WW_EIAJ:
296 case WW_M:
295 ret = detect_a2_a2m_eiaj(core, samples, N); 297 ret = detect_a2_a2m_eiaj(core, samples, N);
296 break; 298 break;
297 case WW_BTSC: 299 case WW_BTSC:
298 ret = detect_btsc(core, samples, N); 300 ret = detect_btsc(core, samples, N);
299 break; 301 break;
302 case WW_NONE:
303 case WW_I:
304 case WW_L:
305 case WW_I2SPT:
306 case WW_FM:
307 case WW_I2SADC:
308 break;
300 } 309 }
301 310
302 kfree(samples); 311 kfree(samples);
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index faa8e8163a4a..367a653f4c95 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -56,6 +56,7 @@
56#include "stv0900.h" 56#include "stv0900.h"
57#include "stb6100.h" 57#include "stb6100.h"
58#include "stb6100_proc.h" 58#include "stb6100_proc.h"
59#include "mb86a16.h"
59 60
60MODULE_DESCRIPTION("driver for cx2388x based DVB cards"); 61MODULE_DESCRIPTION("driver for cx2388x based DVB cards");
61MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>"); 62MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
@@ -105,7 +106,7 @@ static void dvb_buf_release(struct videobuf_queue *q,
105 cx88_free_buffer(q, (struct cx88_buffer*)vb); 106 cx88_free_buffer(q, (struct cx88_buffer*)vb);
106} 107}
107 108
108static struct videobuf_queue_ops dvb_qops = { 109static const struct videobuf_queue_ops dvb_qops = {
109 .buf_setup = dvb_buf_setup, 110 .buf_setup = dvb_buf_setup,
110 .buf_prepare = dvb_buf_prepare, 111 .buf_prepare = dvb_buf_prepare,
111 .buf_queue = dvb_buf_queue, 112 .buf_queue = dvb_buf_queue,
@@ -167,12 +168,12 @@ static void cx88_dvb_gate_ctrl(struct cx88_core *core, int open)
167 168
168static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe) 169static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe)
169{ 170{
170 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 }; 171 static const u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 };
171 static u8 reset [] = { RESET, 0x80 }; 172 static const u8 reset [] = { RESET, 0x80 };
172 static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; 173 static const u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
173 static u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 }; 174 static const u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 };
174 static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 }; 175 static const u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
175 static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 }; 176 static const u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
176 177
177 mt352_write(fe, clock_config, sizeof(clock_config)); 178 mt352_write(fe, clock_config, sizeof(clock_config));
178 udelay(200); 179 udelay(200);
@@ -187,12 +188,12 @@ static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe)
187 188
188static int dvico_dual_demod_init(struct dvb_frontend *fe) 189static int dvico_dual_demod_init(struct dvb_frontend *fe)
189{ 190{
190 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x38 }; 191 static const u8 clock_config [] = { CLOCK_CTL, 0x38, 0x38 };
191 static u8 reset [] = { RESET, 0x80 }; 192 static const u8 reset [] = { RESET, 0x80 };
192 static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; 193 static const u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
193 static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 }; 194 static const u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 };
194 static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 }; 195 static const u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
195 static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 }; 196 static const u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
196 197
197 mt352_write(fe, clock_config, sizeof(clock_config)); 198 mt352_write(fe, clock_config, sizeof(clock_config));
198 udelay(200); 199 udelay(200);
@@ -208,13 +209,13 @@ static int dvico_dual_demod_init(struct dvb_frontend *fe)
208 209
209static int dntv_live_dvbt_demod_init(struct dvb_frontend* fe) 210static int dntv_live_dvbt_demod_init(struct dvb_frontend* fe)
210{ 211{
211 static u8 clock_config [] = { 0x89, 0x38, 0x39 }; 212 static const u8 clock_config [] = { 0x89, 0x38, 0x39 };
212 static u8 reset [] = { 0x50, 0x80 }; 213 static const u8 reset [] = { 0x50, 0x80 };
213 static u8 adc_ctl_1_cfg [] = { 0x8E, 0x40 }; 214 static const u8 adc_ctl_1_cfg [] = { 0x8E, 0x40 };
214 static u8 agc_cfg [] = { 0x67, 0x10, 0x23, 0x00, 0xFF, 0xFF, 215 static const u8 agc_cfg [] = { 0x67, 0x10, 0x23, 0x00, 0xFF, 0xFF,
215 0x00, 0xFF, 0x00, 0x40, 0x40 }; 216 0x00, 0xFF, 0x00, 0x40, 0x40 };
216 static u8 dntv_extra[] = { 0xB5, 0x7A }; 217 static const u8 dntv_extra[] = { 0xB5, 0x7A };
217 static u8 capt_range_cfg[] = { 0x75, 0x32 }; 218 static const u8 capt_range_cfg[] = { 0x75, 0x32 };
218 219
219 mt352_write(fe, clock_config, sizeof(clock_config)); 220 mt352_write(fe, clock_config, sizeof(clock_config));
220 udelay(2000); 221 udelay(2000);
@@ -229,37 +230,41 @@ static int dntv_live_dvbt_demod_init(struct dvb_frontend* fe)
229 return 0; 230 return 0;
230} 231}
231 232
232static struct mt352_config dvico_fusionhdtv = { 233static const struct mt352_config dvico_fusionhdtv = {
233 .demod_address = 0x0f, 234 .demod_address = 0x0f,
234 .demod_init = dvico_fusionhdtv_demod_init, 235 .demod_init = dvico_fusionhdtv_demod_init,
235}; 236};
236 237
237static struct mt352_config dntv_live_dvbt_config = { 238static const struct mt352_config dntv_live_dvbt_config = {
238 .demod_address = 0x0f, 239 .demod_address = 0x0f,
239 .demod_init = dntv_live_dvbt_demod_init, 240 .demod_init = dntv_live_dvbt_demod_init,
240}; 241};
241 242
242static struct mt352_config dvico_fusionhdtv_dual = { 243static const struct mt352_config dvico_fusionhdtv_dual = {
243 .demod_address = 0x0f, 244 .demod_address = 0x0f,
244 .demod_init = dvico_dual_demod_init, 245 .demod_init = dvico_dual_demod_init,
245}; 246};
246 247
247static struct zl10353_config cx88_terratec_cinergy_ht_pci_mkii_config = { 248static const struct zl10353_config cx88_terratec_cinergy_ht_pci_mkii_config = {
248 .demod_address = (0x1e >> 1), 249 .demod_address = (0x1e >> 1),
249 .no_tuner = 1, 250 .no_tuner = 1,
250 .if2 = 45600, 251 .if2 = 45600,
251}; 252};
252 253
254static struct mb86a16_config twinhan_vp1027 = {
255 .demod_address = 0x08,
256};
257
253#if defined(CONFIG_VIDEO_CX88_VP3054) || (defined(CONFIG_VIDEO_CX88_VP3054_MODULE) && defined(MODULE)) 258#if defined(CONFIG_VIDEO_CX88_VP3054) || (defined(CONFIG_VIDEO_CX88_VP3054_MODULE) && defined(MODULE))
254static int dntv_live_dvbt_pro_demod_init(struct dvb_frontend* fe) 259static int dntv_live_dvbt_pro_demod_init(struct dvb_frontend* fe)
255{ 260{
256 static u8 clock_config [] = { 0x89, 0x38, 0x38 }; 261 static const u8 clock_config [] = { 0x89, 0x38, 0x38 };
257 static u8 reset [] = { 0x50, 0x80 }; 262 static const u8 reset [] = { 0x50, 0x80 };
258 static u8 adc_ctl_1_cfg [] = { 0x8E, 0x40 }; 263 static const u8 adc_ctl_1_cfg [] = { 0x8E, 0x40 };
259 static u8 agc_cfg [] = { 0x67, 0x10, 0x20, 0x00, 0xFF, 0xFF, 264 static const u8 agc_cfg [] = { 0x67, 0x10, 0x20, 0x00, 0xFF, 0xFF,
260 0x00, 0xFF, 0x00, 0x40, 0x40 }; 265 0x00, 0xFF, 0x00, 0x40, 0x40 };
261 static u8 dntv_extra[] = { 0xB5, 0x7A }; 266 static const u8 dntv_extra[] = { 0xB5, 0x7A };
262 static u8 capt_range_cfg[] = { 0x75, 0x32 }; 267 static const u8 capt_range_cfg[] = { 0x75, 0x32 };
263 268
264 mt352_write(fe, clock_config, sizeof(clock_config)); 269 mt352_write(fe, clock_config, sizeof(clock_config));
265 udelay(2000); 270 udelay(2000);
@@ -274,41 +279,41 @@ static int dntv_live_dvbt_pro_demod_init(struct dvb_frontend* fe)
274 return 0; 279 return 0;
275} 280}
276 281
277static struct mt352_config dntv_live_dvbt_pro_config = { 282static const struct mt352_config dntv_live_dvbt_pro_config = {
278 .demod_address = 0x0f, 283 .demod_address = 0x0f,
279 .no_tuner = 1, 284 .no_tuner = 1,
280 .demod_init = dntv_live_dvbt_pro_demod_init, 285 .demod_init = dntv_live_dvbt_pro_demod_init,
281}; 286};
282#endif 287#endif
283 288
284static struct zl10353_config dvico_fusionhdtv_hybrid = { 289static const struct zl10353_config dvico_fusionhdtv_hybrid = {
285 .demod_address = 0x0f, 290 .demod_address = 0x0f,
286 .no_tuner = 1, 291 .no_tuner = 1,
287}; 292};
288 293
289static struct zl10353_config dvico_fusionhdtv_xc3028 = { 294static const struct zl10353_config dvico_fusionhdtv_xc3028 = {
290 .demod_address = 0x0f, 295 .demod_address = 0x0f,
291 .if2 = 45600, 296 .if2 = 45600,
292 .no_tuner = 1, 297 .no_tuner = 1,
293}; 298};
294 299
295static struct mt352_config dvico_fusionhdtv_mt352_xc3028 = { 300static const struct mt352_config dvico_fusionhdtv_mt352_xc3028 = {
296 .demod_address = 0x0f, 301 .demod_address = 0x0f,
297 .if2 = 4560, 302 .if2 = 4560,
298 .no_tuner = 1, 303 .no_tuner = 1,
299 .demod_init = dvico_fusionhdtv_demod_init, 304 .demod_init = dvico_fusionhdtv_demod_init,
300}; 305};
301 306
302static struct zl10353_config dvico_fusionhdtv_plus_v1_1 = { 307static const struct zl10353_config dvico_fusionhdtv_plus_v1_1 = {
303 .demod_address = 0x0f, 308 .demod_address = 0x0f,
304}; 309};
305 310
306static struct cx22702_config connexant_refboard_config = { 311static const struct cx22702_config connexant_refboard_config = {
307 .demod_address = 0x43, 312 .demod_address = 0x43,
308 .output_mode = CX22702_SERIAL_OUTPUT, 313 .output_mode = CX22702_SERIAL_OUTPUT,
309}; 314};
310 315
311static struct cx22702_config hauppauge_hvr_config = { 316static const struct cx22702_config hauppauge_hvr_config = {
312 .demod_address = 0x63, 317 .demod_address = 0x63,
313 .output_mode = CX22702_SERIAL_OUTPUT, 318 .output_mode = CX22702_SERIAL_OUTPUT,
314}; 319};
@@ -320,7 +325,7 @@ static int or51132_set_ts_param(struct dvb_frontend* fe, int is_punctured)
320 return 0; 325 return 0;
321} 326}
322 327
323static struct or51132_config pchdtv_hd3000 = { 328static const struct or51132_config pchdtv_hd3000 = {
324 .demod_address = 0x15, 329 .demod_address = 0x15,
325 .set_ts_params = or51132_set_ts_param, 330 .set_ts_params = or51132_set_ts_param,
326}; 331};
@@ -355,14 +360,14 @@ static struct lgdt330x_config fusionhdtv_3_gold = {
355 .set_ts_params = lgdt330x_set_ts_param, 360 .set_ts_params = lgdt330x_set_ts_param,
356}; 361};
357 362
358static struct lgdt330x_config fusionhdtv_5_gold = { 363static const struct lgdt330x_config fusionhdtv_5_gold = {
359 .demod_address = 0x0e, 364 .demod_address = 0x0e,
360 .demod_chip = LGDT3303, 365 .demod_chip = LGDT3303,
361 .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */ 366 .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */
362 .set_ts_params = lgdt330x_set_ts_param, 367 .set_ts_params = lgdt330x_set_ts_param,
363}; 368};
364 369
365static struct lgdt330x_config pchdtv_hd5500 = { 370static const struct lgdt330x_config pchdtv_hd5500 = {
366 .demod_address = 0x59, 371 .demod_address = 0x59,
367 .demod_chip = LGDT3303, 372 .demod_chip = LGDT3303,
368 .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */ 373 .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */
@@ -376,7 +381,7 @@ static int nxt200x_set_ts_param(struct dvb_frontend* fe, int is_punctured)
376 return 0; 381 return 0;
377} 382}
378 383
379static struct nxt200x_config ati_hdtvwonder = { 384static const struct nxt200x_config ati_hdtvwonder = {
380 .demod_address = 0x0a, 385 .demod_address = 0x0a,
381 .set_ts_params = nxt200x_set_ts_param, 386 .set_ts_params = nxt200x_set_ts_param,
382}; 387};
@@ -429,15 +434,15 @@ static int tevii_dvbs_set_voltage(struct dvb_frontend *fe,
429 434
430 cx_set(MO_GP0_IO, 0x6040); 435 cx_set(MO_GP0_IO, 0x6040);
431 switch (voltage) { 436 switch (voltage) {
432 case SEC_VOLTAGE_13: 437 case SEC_VOLTAGE_13:
433 cx_clear(MO_GP0_IO, 0x20); 438 cx_clear(MO_GP0_IO, 0x20);
434 break; 439 break;
435 case SEC_VOLTAGE_18: 440 case SEC_VOLTAGE_18:
436 cx_set(MO_GP0_IO, 0x20); 441 cx_set(MO_GP0_IO, 0x20);
437 break; 442 break;
438 case SEC_VOLTAGE_OFF: 443 case SEC_VOLTAGE_OFF:
439 cx_clear(MO_GP0_IO, 0x20); 444 cx_clear(MO_GP0_IO, 0x20);
440 break; 445 break;
441 } 446 }
442 447
443 if (core->prev_set_voltage) 448 if (core->prev_set_voltage)
@@ -445,23 +450,49 @@ static int tevii_dvbs_set_voltage(struct dvb_frontend *fe,
445 return 0; 450 return 0;
446} 451}
447 452
448static struct cx24123_config geniatech_dvbs_config = { 453static int vp1027_set_voltage(struct dvb_frontend *fe,
454 fe_sec_voltage_t voltage)
455{
456 struct cx8802_dev *dev = fe->dvb->priv;
457 struct cx88_core *core = dev->core;
458
459 switch (voltage) {
460 case SEC_VOLTAGE_13:
461 dprintk(1, "LNB SEC Voltage=13\n");
462 cx_write(MO_GP0_IO, 0x00001220);
463 break;
464 case SEC_VOLTAGE_18:
465 dprintk(1, "LNB SEC Voltage=18\n");
466 cx_write(MO_GP0_IO, 0x00001222);
467 break;
468 case SEC_VOLTAGE_OFF:
469 dprintk(1, "LNB Voltage OFF\n");
470 cx_write(MO_GP0_IO, 0x00001230);
471 break;
472 }
473
474 if (core->prev_set_voltage)
475 return core->prev_set_voltage(fe, voltage);
476 return 0;
477}
478
479static const struct cx24123_config geniatech_dvbs_config = {
449 .demod_address = 0x55, 480 .demod_address = 0x55,
450 .set_ts_params = cx24123_set_ts_param, 481 .set_ts_params = cx24123_set_ts_param,
451}; 482};
452 483
453static struct cx24123_config hauppauge_novas_config = { 484static const struct cx24123_config hauppauge_novas_config = {
454 .demod_address = 0x55, 485 .demod_address = 0x55,
455 .set_ts_params = cx24123_set_ts_param, 486 .set_ts_params = cx24123_set_ts_param,
456}; 487};
457 488
458static struct cx24123_config kworld_dvbs_100_config = { 489static const struct cx24123_config kworld_dvbs_100_config = {
459 .demod_address = 0x15, 490 .demod_address = 0x15,
460 .set_ts_params = cx24123_set_ts_param, 491 .set_ts_params = cx24123_set_ts_param,
461 .lnb_polarity = 1, 492 .lnb_polarity = 1,
462}; 493};
463 494
464static struct s5h1409_config pinnacle_pctv_hd_800i_config = { 495static const struct s5h1409_config pinnacle_pctv_hd_800i_config = {
465 .demod_address = 0x32 >> 1, 496 .demod_address = 0x32 >> 1,
466 .output_mode = S5H1409_PARALLEL_OUTPUT, 497 .output_mode = S5H1409_PARALLEL_OUTPUT,
467 .gpio = S5H1409_GPIO_ON, 498 .gpio = S5H1409_GPIO_ON,
@@ -471,7 +502,7 @@ static struct s5h1409_config pinnacle_pctv_hd_800i_config = {
471 .mpeg_timing = S5H1409_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK, 502 .mpeg_timing = S5H1409_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,
472}; 503};
473 504
474static struct s5h1409_config dvico_hdtv5_pci_nano_config = { 505static const struct s5h1409_config dvico_hdtv5_pci_nano_config = {
475 .demod_address = 0x32 >> 1, 506 .demod_address = 0x32 >> 1,
476 .output_mode = S5H1409_SERIAL_OUTPUT, 507 .output_mode = S5H1409_SERIAL_OUTPUT,
477 .gpio = S5H1409_GPIO_OFF, 508 .gpio = S5H1409_GPIO_OFF,
@@ -480,7 +511,7 @@ static struct s5h1409_config dvico_hdtv5_pci_nano_config = {
480 .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, 511 .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK,
481}; 512};
482 513
483static struct s5h1409_config kworld_atsc_120_config = { 514static const struct s5h1409_config kworld_atsc_120_config = {
484 .demod_address = 0x32 >> 1, 515 .demod_address = 0x32 >> 1,
485 .output_mode = S5H1409_SERIAL_OUTPUT, 516 .output_mode = S5H1409_SERIAL_OUTPUT,
486 .gpio = S5H1409_GPIO_OFF, 517 .gpio = S5H1409_GPIO_OFF,
@@ -489,24 +520,24 @@ static struct s5h1409_config kworld_atsc_120_config = {
489 .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, 520 .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK,
490}; 521};
491 522
492static struct xc5000_config pinnacle_pctv_hd_800i_tuner_config = { 523static const struct xc5000_config pinnacle_pctv_hd_800i_tuner_config = {
493 .i2c_address = 0x64, 524 .i2c_address = 0x64,
494 .if_khz = 5380, 525 .if_khz = 5380,
495}; 526};
496 527
497static struct zl10353_config cx88_pinnacle_hybrid_pctv = { 528static const struct zl10353_config cx88_pinnacle_hybrid_pctv = {
498 .demod_address = (0x1e >> 1), 529 .demod_address = (0x1e >> 1),
499 .no_tuner = 1, 530 .no_tuner = 1,
500 .if2 = 45600, 531 .if2 = 45600,
501}; 532};
502 533
503static struct zl10353_config cx88_geniatech_x8000_mt = { 534static const struct zl10353_config cx88_geniatech_x8000_mt = {
504 .demod_address = (0x1e >> 1), 535 .demod_address = (0x1e >> 1),
505 .no_tuner = 1, 536 .no_tuner = 1,
506 .disable_i2c_gate_ctrl = 1, 537 .disable_i2c_gate_ctrl = 1,
507}; 538};
508 539
509static struct s5h1411_config dvico_fusionhdtv7_config = { 540static const struct s5h1411_config dvico_fusionhdtv7_config = {
510 .output_mode = S5H1411_SERIAL_OUTPUT, 541 .output_mode = S5H1411_SERIAL_OUTPUT,
511 .gpio = S5H1411_GPIO_ON, 542 .gpio = S5H1411_GPIO_ON,
512 .mpeg_timing = S5H1411_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, 543 .mpeg_timing = S5H1411_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK,
@@ -516,7 +547,7 @@ static struct s5h1411_config dvico_fusionhdtv7_config = {
516 .status_mode = S5H1411_DEMODLOCKING 547 .status_mode = S5H1411_DEMODLOCKING
517}; 548};
518 549
519static struct xc5000_config dvico_fusionhdtv7_tuner_config = { 550static const struct xc5000_config dvico_fusionhdtv7_tuner_config = {
520 .i2c_address = 0xc2 >> 1, 551 .i2c_address = 0xc2 >> 1,
521 .if_khz = 5380, 552 .if_khz = 5380,
522}; 553};
@@ -601,19 +632,19 @@ static int cx24116_reset_device(struct dvb_frontend *fe)
601 return 0; 632 return 0;
602} 633}
603 634
604static struct cx24116_config hauppauge_hvr4000_config = { 635static const struct cx24116_config hauppauge_hvr4000_config = {
605 .demod_address = 0x05, 636 .demod_address = 0x05,
606 .set_ts_params = cx24116_set_ts_param, 637 .set_ts_params = cx24116_set_ts_param,
607 .reset_device = cx24116_reset_device, 638 .reset_device = cx24116_reset_device,
608}; 639};
609 640
610static struct cx24116_config tevii_s460_config = { 641static const struct cx24116_config tevii_s460_config = {
611 .demod_address = 0x55, 642 .demod_address = 0x55,
612 .set_ts_params = cx24116_set_ts_param, 643 .set_ts_params = cx24116_set_ts_param,
613 .reset_device = cx24116_reset_device, 644 .reset_device = cx24116_reset_device,
614}; 645};
615 646
616static struct stv0900_config prof_7301_stv0900_config = { 647static const struct stv0900_config prof_7301_stv0900_config = {
617 .demod_address = 0x6a, 648 .demod_address = 0x6a,
618/* demod_mode = 0,*/ 649/* demod_mode = 0,*/
619 .xtal = 27000000, 650 .xtal = 27000000,
@@ -625,12 +656,12 @@ static struct stv0900_config prof_7301_stv0900_config = {
625 .set_ts_params = stv0900_set_ts_param, 656 .set_ts_params = stv0900_set_ts_param,
626}; 657};
627 658
628static struct stb6100_config prof_7301_stb6100_config = { 659static const struct stb6100_config prof_7301_stb6100_config = {
629 .tuner_address = 0x60, 660 .tuner_address = 0x60,
630 .refclock = 27000000, 661 .refclock = 27000000,
631}; 662};
632 663
633static struct stv0299_config tevii_tuner_sharp_config = { 664static const struct stv0299_config tevii_tuner_sharp_config = {
634 .demod_address = 0x68, 665 .demod_address = 0x68,
635 .inittab = sharp_z0194a_inittab, 666 .inittab = sharp_z0194a_inittab,
636 .mclk = 88000000UL, 667 .mclk = 88000000UL,
@@ -643,7 +674,7 @@ static struct stv0299_config tevii_tuner_sharp_config = {
643 .set_ts_params = cx24116_set_ts_param, 674 .set_ts_params = cx24116_set_ts_param,
644}; 675};
645 676
646static struct stv0288_config tevii_tuner_earda_config = { 677static const struct stv0288_config tevii_tuner_earda_config = {
647 .demod_address = 0x68, 678 .demod_address = 0x68,
648 .min_delay_ms = 100, 679 .min_delay_ms = 100,
649 .set_ts_params = cx24116_set_ts_param, 680 .set_ts_params = cx24116_set_ts_param,
@@ -676,7 +707,7 @@ static int cx8802_alloc_frontends(struct cx8802_dev *dev)
676 707
677 708
678 709
679static u8 samsung_smt_7020_inittab[] = { 710static const u8 samsung_smt_7020_inittab[] = {
680 0x01, 0x15, 711 0x01, 0x15,
681 0x02, 0x00, 712 0x02, 0x00,
682 0x03, 0x00, 713 0x03, 0x00,
@@ -850,7 +881,7 @@ static int samsung_smt_7020_stv0299_set_symbol_rate(struct dvb_frontend *fe,
850} 881}
851 882
852 883
853static struct stv0299_config samsung_stv0299_config = { 884static const struct stv0299_config samsung_stv0299_config = {
854 .demod_address = 0x68, 885 .demod_address = 0x68,
855 .inittab = samsung_smt_7020_inittab, 886 .inittab = samsung_smt_7020_inittab,
856 .mclk = 88000000UL, 887 .mclk = 88000000UL,
@@ -1416,6 +1447,18 @@ static int dvb_register(struct cx8802_dev *dev)
1416 } 1447 }
1417 1448
1418 break; 1449 break;
1450 case CX88_BOARD_TWINHAN_VP1027_DVBS:
1451 dev->ts_gen_cntrl = 0x00;
1452 fe0->dvb.frontend = dvb_attach(mb86a16_attach,
1453 &twinhan_vp1027,
1454 &core->i2c_adap);
1455 if (fe0->dvb.frontend) {
1456 core->prev_set_voltage =
1457 fe0->dvb.frontend->ops.set_voltage;
1458 fe0->dvb.frontend->ops.set_voltage =
1459 vp1027_set_voltage;
1460 }
1461 break;
1419 1462
1420 default: 1463 default:
1421 printk(KERN_ERR "%s/2: The frontend of your DVB/ATSC card isn't supported yet\n", 1464 printk(KERN_ERR "%s/2: The frontend of your DVB/ATSC card isn't supported yet\n",
@@ -1576,7 +1619,7 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv)
1576 V4L2_BUF_TYPE_VIDEO_CAPTURE, 1619 V4L2_BUF_TYPE_VIDEO_CAPTURE,
1577 V4L2_FIELD_TOP, 1620 V4L2_FIELD_TOP,
1578 sizeof(struct cx88_buffer), 1621 sizeof(struct cx88_buffer),
1579 dev); 1622 dev, NULL);
1580 /* init struct videobuf_dvb */ 1623 /* init struct videobuf_dvb */
1581 fe->dvb.name = dev->core->name; 1624 fe->dvb.name = dev->core->name;
1582 } 1625 }
diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c
index 82db555b22dd..f53836bb6a5a 100644
--- a/drivers/media/video/cx88/cx88-i2c.c
+++ b/drivers/media/video/cx88/cx88-i2c.c
@@ -108,7 +108,7 @@ static const struct i2c_algo_bit_data cx8800_i2c_algo_template = {
108 108
109/* ----------------------------------------------------------------------- */ 109/* ----------------------------------------------------------------------- */
110 110
111static char *i2c_devs[128] = { 111static const char * const i2c_devs[128] = {
112 [ 0x1c >> 1 ] = "lgdt330x", 112 [ 0x1c >> 1 ] = "lgdt330x",
113 [ 0x86 >> 1 ] = "tda9887/cx22702", 113 [ 0x86 >> 1 ] = "tda9887/cx22702",
114 [ 0xa0 >> 1 ] = "eeprom", 114 [ 0xa0 >> 1 ] = "eeprom",
@@ -117,7 +117,7 @@ static char *i2c_devs[128] = {
117 [ 0xc8 >> 1 ] = "xc5000", 117 [ 0xc8 >> 1 ] = "xc5000",
118}; 118};
119 119
120static void do_i2c_scan(char *name, struct i2c_client *c) 120static void do_i2c_scan(const char *name, struct i2c_client *c)
121{ 121{
122 unsigned char buf; 122 unsigned char buf;
123 int i,rc; 123 int i,rc;
@@ -183,30 +183,3 @@ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci)
183 183
184 return core->i2c_rc; 184 return core->i2c_rc;
185} 185}
186
187void cx88_i2c_init_ir(struct cx88_core *core)
188{
189 /* Instantiate the IR receiver device, if present */
190 if (0 == core->i2c_rc) {
191 struct i2c_board_info info;
192 const unsigned short addr_list[] = {
193 0x18, 0x6b, 0x71,
194 I2C_CLIENT_END
195 };
196
197 memset(&info, 0, sizeof(struct i2c_board_info));
198 strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
199 /* Use quick read command for probe, some IR chips don't
200 * support writes */
201 i2c_new_probed_device(&core->i2c_adap, &info, addr_list,
202 i2c_probe_func_quick_read);
203 }
204}
205
206/* ----------------------------------------------------------------------- */
207
208/*
209 * Local variables:
210 * c-basic-offset: 8
211 * End:
212 */
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c
index eccc5e49a350..fc777bc6e716 100644
--- a/drivers/media/video/cx88/cx88-input.c
+++ b/drivers/media/video/cx88/cx88-input.c
@@ -405,6 +405,11 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
405 ir->mask_keycode = 0x7e; 405 ir->mask_keycode = 0x7e;
406 ir->polling = 100; /* ms */ 406 ir->polling = 100; /* ms */
407 break; 407 break;
408 case CX88_BOARD_TWINHAN_VP1027_DVBS:
409 ir_codes = RC_MAP_TWINHAN_VP1027_DVBS;
410 ir_type = IR_TYPE_NEC;
411 ir->sampling = 0xff00; /* address */
412 break;
408 } 413 }
409 414
410 if (NULL == ir_codes) { 415 if (NULL == ir_codes) {
@@ -530,6 +535,7 @@ void cx88_ir_irq(struct cx88_core *core)
530 case CX88_BOARD_PROF_7300: 535 case CX88_BOARD_PROF_7300:
531 case CX88_BOARD_PROF_7301: 536 case CX88_BOARD_PROF_7301:
532 case CX88_BOARD_PROF_6200: 537 case CX88_BOARD_PROF_6200:
538 case CX88_BOARD_TWINHAN_VP1027_DVBS:
533 ircode = ir_decode_pulsedistance(ir->samples, ir->scount, 1, 4); 539 ircode = ir_decode_pulsedistance(ir->samples, ir->scount, 1, 4);
534 540
535 if (ircode == 0xffffffff) { /* decoding error */ 541 if (ircode == 0xffffffff) { /* decoding error */
@@ -609,13 +615,54 @@ void cx88_ir_irq(struct cx88_core *core)
609 return; 615 return;
610} 616}
611 617
618
619void cx88_i2c_init_ir(struct cx88_core *core)
620{
621 struct i2c_board_info info;
622 const unsigned short addr_list[] = {
623 0x18, 0x6b, 0x71,
624 I2C_CLIENT_END
625 };
626 const unsigned short *addrp;
627 /* Instantiate the IR receiver device, if present */
628 if (0 != core->i2c_rc)
629 return;
630
631 memset(&info, 0, sizeof(struct i2c_board_info));
632 strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
633
634 /*
635 * We can't call i2c_new_probed_device() because it uses
636 * quick writes for probing and at least some RC receiver
637 * devices only reply to reads.
638 * Also, Hauppauge XVR needs to be specified, as address 0x71
639 * conflicts with another remote type used with saa7134
640 */
641 for (addrp = addr_list; *addrp != I2C_CLIENT_END; addrp++) {
642 info.platform_data = NULL;
643 memset(&core->init_data, 0, sizeof(core->init_data));
644
645 if (*addrp == 0x71) {
646 /* Hauppauge XVR */
647 core->init_data.name = "cx88 Hauppauge XVR remote";
648 core->init_data.ir_codes = RC_MAP_HAUPPAUGE_NEW;
649 core->init_data.type = IR_TYPE_RC5;
650 core->init_data.internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR;
651
652 info.platform_data = &core->init_data;
653 }
654 if (i2c_smbus_xfer(&core->i2c_adap, *addrp, 0,
655 I2C_SMBUS_READ, 0,
656 I2C_SMBUS_QUICK, NULL) >= 0) {
657 info.addr = *addrp;
658 i2c_new_device(&core->i2c_adap, &info);
659 break;
660 }
661 }
662}
663
612/* ---------------------------------------------------------------------- */ 664/* ---------------------------------------------------------------------- */
613 665
614MODULE_AUTHOR("Gerd Knorr, Pavel Machek, Chris Pascoe"); 666MODULE_AUTHOR("Gerd Knorr, Pavel Machek, Chris Pascoe");
615MODULE_DESCRIPTION("input driver for cx88 GPIO-based IR remote controls"); 667MODULE_DESCRIPTION("input driver for cx88 GPIO-based IR remote controls");
616MODULE_LICENSE("GPL"); 668MODULE_LICENSE("GPL");
617/*
618 * Local variables:
619 * c-basic-offset: 8
620 * End:
621 */
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c
index 499f8d512ad6..f7d71acbb078 100644
--- a/drivers/media/video/cx88/cx88-mpeg.c
+++ b/drivers/media/video/cx88/cx88-mpeg.c
@@ -313,7 +313,7 @@ void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf)
313 313
314/* ----------------------------------------------------------- */ 314/* ----------------------------------------------------------- */
315 315
316static void do_cancel_buffers(struct cx8802_dev *dev, char *reason, int restart) 316static void do_cancel_buffers(struct cx8802_dev *dev, const char *reason, int restart)
317{ 317{
318 struct cx88_dmaqueue *q = &dev->mpegq; 318 struct cx88_dmaqueue *q = &dev->mpegq;
319 struct cx88_buffer *buf; 319 struct cx88_buffer *buf;
@@ -358,7 +358,7 @@ static void cx8802_timeout(unsigned long data)
358 do_cancel_buffers(dev,"timeout",1); 358 do_cancel_buffers(dev,"timeout",1);
359} 359}
360 360
361static char *cx88_mpeg_irqs[32] = { 361static const char * cx88_mpeg_irqs[32] = {
362 "ts_risci1", NULL, NULL, NULL, 362 "ts_risci1", NULL, NULL, NULL,
363 "ts_risci2", NULL, NULL, NULL, 363 "ts_risci2", NULL, NULL, NULL,
364 "ts_oflow", NULL, NULL, NULL, 364 "ts_oflow", NULL, NULL, NULL,
@@ -849,7 +849,7 @@ static void __devexit cx8802_remove(struct pci_dev *pci_dev)
849 kfree(dev); 849 kfree(dev);
850} 850}
851 851
852static struct pci_device_id cx8802_pci_tbl[] = { 852static const struct pci_device_id cx8802_pci_tbl[] = {
853 { 853 {
854 .vendor = 0x14f1, 854 .vendor = 0x14f1,
855 .device = 0x8802, 855 .device = 0x8802,
diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c
index 239631568f3b..08220de3d74d 100644
--- a/drivers/media/video/cx88/cx88-tvaudio.c
+++ b/drivers/media/video/cx88/cx88-tvaudio.c
@@ -70,7 +70,7 @@ MODULE_PARM_DESC(radio_deemphasis, "Radio deemphasis time constant, "
70 70
71/* ----------------------------------------------------------- */ 71/* ----------------------------------------------------------- */
72 72
73static char *aud_ctl_names[64] = { 73static const char * const aud_ctl_names[64] = {
74 [EN_BTSC_FORCE_MONO] = "BTSC_FORCE_MONO", 74 [EN_BTSC_FORCE_MONO] = "BTSC_FORCE_MONO",
75 [EN_BTSC_FORCE_STEREO] = "BTSC_FORCE_STEREO", 75 [EN_BTSC_FORCE_STEREO] = "BTSC_FORCE_STEREO",
76 [EN_BTSC_FORCE_SAP] = "BTSC_FORCE_SAP", 76 [EN_BTSC_FORCE_SAP] = "BTSC_FORCE_SAP",
@@ -360,7 +360,15 @@ static void set_audio_standard_NICAM(struct cx88_core *core, u32 mode)
360 set_audio_registers(core, nicam_bgdki_common); 360 set_audio_registers(core, nicam_bgdki_common);
361 set_audio_registers(core, nicam_i); 361 set_audio_registers(core, nicam_i);
362 break; 362 break;
363 default: 363 case WW_NONE:
364 case WW_BTSC:
365 case WW_BG:
366 case WW_DK:
367 case WW_EIAJ:
368 case WW_I2SPT:
369 case WW_FM:
370 case WW_I2SADC:
371 case WW_M:
364 dprintk("%s PAL-BGDK NICAM (status: known-good)\n", __func__); 372 dprintk("%s PAL-BGDK NICAM (status: known-good)\n", __func__);
365 set_audio_registers(core, nicam_bgdki_common); 373 set_audio_registers(core, nicam_bgdki_common);
366 set_audio_registers(core, nicam_default); 374 set_audio_registers(core, nicam_default);
@@ -621,7 +629,13 @@ static void set_audio_standard_A2(struct cx88_core *core, u32 mode)
621 dprintk("%s AM-L (status: devel)\n", __func__); 629 dprintk("%s AM-L (status: devel)\n", __func__);
622 set_audio_registers(core, am_l); 630 set_audio_registers(core, am_l);
623 break; 631 break;
624 default: 632 case WW_NONE:
633 case WW_BTSC:
634 case WW_EIAJ:
635 case WW_I2SPT:
636 case WW_FM:
637 case WW_I2SADC:
638 case WW_M:
625 dprintk("%s Warning: wrong value\n", __func__); 639 dprintk("%s Warning: wrong value\n", __func__);
626 return; 640 return;
627 break; 641 break;
@@ -779,7 +793,7 @@ void cx88_set_tvaudio(struct cx88_core *core)
779 set_audio_finish(core, EN_I2SIN_ENABLE); 793 set_audio_finish(core, EN_I2SIN_ENABLE);
780 break; 794 break;
781 case WW_NONE: 795 case WW_NONE:
782 default: 796 case WW_I2SPT:
783 printk("%s/0: unknown tv audio mode [%d]\n", 797 printk("%s/0: unknown tv audio mode [%d]\n",
784 core->name, core->tvaudio); 798 core->name, core->tvaudio);
785 break; 799 break;
@@ -795,8 +809,8 @@ void cx88_newstation(struct cx88_core *core)
795 809
796void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t) 810void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t)
797{ 811{
798 static char *m[] = { "stereo", "dual mono", "mono", "sap" }; 812 static const char * const m[] = { "stereo", "dual mono", "mono", "sap" };
799 static char *p[] = { "no pilot", "pilot c1", "pilot c2", "?" }; 813 static const char * const p[] = { "no pilot", "pilot c1", "pilot c2", "?" };
800 u32 reg, mode, pilot; 814 u32 reg, mode, pilot;
801 815
802 reg = cx_read(AUD_STATUS); 816 reg = cx_read(AUD_STATUS);
@@ -840,7 +854,12 @@ void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t)
840 break; 854 break;
841 } 855 }
842 break; 856 break;
843 default: 857 case WW_NONE:
858 case WW_I:
859 case WW_L:
860 case WW_I2SPT:
861 case WW_FM:
862 case WW_I2SADC:
844 /* nothing */ 863 /* nothing */
845 break; 864 break;
846 } 865 }
@@ -945,6 +964,9 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual)
945 } 964 }
946 break; 965 break;
947 case WW_I2SADC: 966 case WW_I2SADC:
967 case WW_NONE:
968 case WW_EIAJ:
969 case WW_I2SPT:
948 /* DO NOTHING */ 970 /* DO NOTHING */
949 break; 971 break;
950 } 972 }
@@ -1000,7 +1022,12 @@ int cx88_audio_thread(void *data)
1000 /* automatically switch to best available mode */ 1022 /* automatically switch to best available mode */
1001 cx88_set_stereo(core, mode, 0); 1023 cx88_set_stereo(core, mode, 0);
1002 break; 1024 break;
1003 default: 1025 case WW_NONE:
1026 case WW_BTSC:
1027 case WW_EIAJ:
1028 case WW_I2SPT:
1029 case WW_FM:
1030 case WW_I2SADC:
1004hw_autodetect: 1031hw_autodetect:
1005 /* stereo autodetection is supported by hardware so 1032 /* stereo autodetection is supported by hardware so
1006 we don't need to do it manually. Do nothing. */ 1033 we don't need to do it manually. Do nothing. */
diff --git a/drivers/media/video/cx88/cx88-vbi.c b/drivers/media/video/cx88/cx88-vbi.c
index d9445b0e7ab2..f8f8389c0362 100644
--- a/drivers/media/video/cx88/cx88-vbi.c
+++ b/drivers/media/video/cx88/cx88-vbi.c
@@ -230,7 +230,7 @@ static void vbi_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
230 cx88_free_buffer(q,buf); 230 cx88_free_buffer(q,buf);
231} 231}
232 232
233struct videobuf_queue_ops cx8800_vbi_qops = { 233const struct videobuf_queue_ops cx8800_vbi_qops = {
234 .buf_setup = vbi_setup, 234 .buf_setup = vbi_setup,
235 .buf_prepare = vbi_prepare, 235 .buf_prepare = vbi_prepare,
236 .buf_queue = vbi_queue, 236 .buf_queue = vbi_queue,
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 0fab65c3ab39..d2f159daa8b5 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -41,6 +41,7 @@
41#include "cx88.h" 41#include "cx88.h"
42#include <media/v4l2-common.h> 42#include <media/v4l2-common.h>
43#include <media/v4l2-ioctl.h> 43#include <media/v4l2-ioctl.h>
44#include <media/wm8775.h>
44 45
45MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards"); 46MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards");
46MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); 47MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
@@ -78,7 +79,7 @@ MODULE_PARM_DESC(vid_limit,"capture memory limit in megabytes");
78/* ------------------------------------------------------------------- */ 79/* ------------------------------------------------------------------- */
79/* static data */ 80/* static data */
80 81
81static struct cx8800_fmt formats[] = { 82static const struct cx8800_fmt formats[] = {
82 { 83 {
83 .name = "8 bpp, gray", 84 .name = "8 bpp, gray",
84 .fourcc = V4L2_PIX_FMT_GREY, 85 .fourcc = V4L2_PIX_FMT_GREY,
@@ -142,7 +143,7 @@ static struct cx8800_fmt formats[] = {
142 }, 143 },
143}; 144};
144 145
145static struct cx8800_fmt* format_by_fourcc(unsigned int fourcc) 146static const struct cx8800_fmt* format_by_fourcc(unsigned int fourcc)
146{ 147{
147 unsigned int i; 148 unsigned int i;
148 149
@@ -159,7 +160,7 @@ static const struct v4l2_queryctrl no_ctl = {
159 .flags = V4L2_CTRL_FLAG_DISABLED, 160 .flags = V4L2_CTRL_FLAG_DISABLED,
160}; 161};
161 162
162static struct cx88_ctrl cx8800_ctls[] = { 163static const struct cx88_ctrl cx8800_ctls[] = {
163 /* --- video --- */ 164 /* --- video --- */
164 { 165 {
165 .v = { 166 .v = {
@@ -288,7 +289,7 @@ static struct cx88_ctrl cx8800_ctls[] = {
288 .shift = 0, 289 .shift = 0,
289 } 290 }
290}; 291};
291static const int CX8800_CTLS = ARRAY_SIZE(cx8800_ctls); 292enum { CX8800_CTLS = ARRAY_SIZE(cx8800_ctls) };
292 293
293/* Must be sorted from low to high control ID! */ 294/* Must be sorted from low to high control ID! */
294const u32 cx88_user_ctrls[] = { 295const u32 cx88_user_ctrls[] = {
@@ -306,7 +307,7 @@ const u32 cx88_user_ctrls[] = {
306}; 307};
307EXPORT_SYMBOL(cx88_user_ctrls); 308EXPORT_SYMBOL(cx88_user_ctrls);
308 309
309static const u32 *ctrl_classes[] = { 310static const u32 * const ctrl_classes[] = {
310 cx88_user_ctrls, 311 cx88_user_ctrls,
311 NULL 312 NULL
312}; 313};
@@ -710,7 +711,7 @@ static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
710 cx88_free_buffer(q,buf); 711 cx88_free_buffer(q,buf);
711} 712}
712 713
713static struct videobuf_queue_ops cx8800_video_qops = { 714static const struct videobuf_queue_ops cx8800_video_qops = {
714 .buf_setup = buffer_setup, 715 .buf_setup = buffer_setup,
715 .buf_prepare = buffer_prepare, 716 .buf_prepare = buffer_prepare,
716 .buf_queue = buffer_queue, 717 .buf_queue = buffer_queue,
@@ -752,7 +753,7 @@ static int video_open(struct file *file)
752{ 753{
753 struct video_device *vdev = video_devdata(file); 754 struct video_device *vdev = video_devdata(file);
754 struct cx8800_dev *dev = video_drvdata(file); 755 struct cx8800_dev *dev = video_drvdata(file);
755 struct cx88_core *core; 756 struct cx88_core *core = dev->core;
756 struct cx8800_fh *fh; 757 struct cx8800_fh *fh;
757 enum v4l2_buf_type type = 0; 758 enum v4l2_buf_type type = 0;
758 int radio = 0; 759 int radio = 0;
@@ -769,19 +770,14 @@ static int video_open(struct file *file)
769 break; 770 break;
770 } 771 }
771 772
772 lock_kernel();
773
774 core = dev->core;
775
776 dprintk(1, "open dev=%s radio=%d type=%s\n", 773 dprintk(1, "open dev=%s radio=%d type=%s\n",
777 video_device_node_name(vdev), radio, v4l2_type_names[type]); 774 video_device_node_name(vdev), radio, v4l2_type_names[type]);
778 775
779 /* allocate + initialize per filehandle data */ 776 /* allocate + initialize per filehandle data */
780 fh = kzalloc(sizeof(*fh),GFP_KERNEL); 777 fh = kzalloc(sizeof(*fh),GFP_KERNEL);
781 if (NULL == fh) { 778 if (unlikely(!fh))
782 unlock_kernel();
783 return -ENOMEM; 779 return -ENOMEM;
784 } 780
785 file->private_data = fh; 781 file->private_data = fh;
786 fh->dev = dev; 782 fh->dev = dev;
787 fh->radio = radio; 783 fh->radio = radio;
@@ -790,18 +786,20 @@ static int video_open(struct file *file)
790 fh->height = 240; 786 fh->height = 240;
791 fh->fmt = format_by_fourcc(V4L2_PIX_FMT_BGR24); 787 fh->fmt = format_by_fourcc(V4L2_PIX_FMT_BGR24);
792 788
789 mutex_lock(&core->lock);
790
793 videobuf_queue_sg_init(&fh->vidq, &cx8800_video_qops, 791 videobuf_queue_sg_init(&fh->vidq, &cx8800_video_qops,
794 &dev->pci->dev, &dev->slock, 792 &dev->pci->dev, &dev->slock,
795 V4L2_BUF_TYPE_VIDEO_CAPTURE, 793 V4L2_BUF_TYPE_VIDEO_CAPTURE,
796 V4L2_FIELD_INTERLACED, 794 V4L2_FIELD_INTERLACED,
797 sizeof(struct cx88_buffer), 795 sizeof(struct cx88_buffer),
798 fh); 796 fh, NULL);
799 videobuf_queue_sg_init(&fh->vbiq, &cx8800_vbi_qops, 797 videobuf_queue_sg_init(&fh->vbiq, &cx8800_vbi_qops,
800 &dev->pci->dev, &dev->slock, 798 &dev->pci->dev, &dev->slock,
801 V4L2_BUF_TYPE_VBI_CAPTURE, 799 V4L2_BUF_TYPE_VBI_CAPTURE,
802 V4L2_FIELD_SEQ_TB, 800 V4L2_FIELD_SEQ_TB,
803 sizeof(struct cx88_buffer), 801 sizeof(struct cx88_buffer),
804 fh); 802 fh, NULL);
805 803
806 if (fh->radio) { 804 if (fh->radio) {
807 dprintk(1,"video_open: setting radio device\n"); 805 dprintk(1,"video_open: setting radio device\n");
@@ -826,9 +824,9 @@ static int video_open(struct file *file)
826 } 824 }
827 call_all(core, tuner, s_radio); 825 call_all(core, tuner, s_radio);
828 } 826 }
829 unlock_kernel();
830 827
831 atomic_inc(&core->users); 828 atomic_inc(&core->users);
829 mutex_unlock(&core->lock);
832 830
833 return 0; 831 return 0;
834} 832}
@@ -920,10 +918,11 @@ static int video_release(struct file *file)
920 918
921 videobuf_mmap_free(&fh->vidq); 919 videobuf_mmap_free(&fh->vidq);
922 videobuf_mmap_free(&fh->vbiq); 920 videobuf_mmap_free(&fh->vbiq);
921
922 mutex_lock(&dev->core->lock);
923 file->private_data = NULL; 923 file->private_data = NULL;
924 kfree(fh); 924 kfree(fh);
925 925
926 mutex_lock(&dev->core->lock);
927 if(atomic_dec_and_test(&dev->core->users)) 926 if(atomic_dec_and_test(&dev->core->users))
928 call_all(dev->core, core, s_power, 0); 927 call_all(dev->core, core, s_power, 0);
929 mutex_unlock(&dev->core->lock); 928 mutex_unlock(&dev->core->lock);
@@ -944,7 +943,7 @@ video_mmap(struct file *file, struct vm_area_struct * vma)
944 943
945int cx88_get_control (struct cx88_core *core, struct v4l2_control *ctl) 944int cx88_get_control (struct cx88_core *core, struct v4l2_control *ctl)
946{ 945{
947 struct cx88_ctrl *c = NULL; 946 const struct cx88_ctrl *c = NULL;
948 u32 value; 947 u32 value;
949 int i; 948 int i;
950 949
@@ -976,9 +975,10 @@ EXPORT_SYMBOL(cx88_get_control);
976 975
977int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl) 976int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl)
978{ 977{
979 struct cx88_ctrl *c = NULL; 978 const struct cx88_ctrl *c = NULL;
980 u32 value,mask; 979 u32 value,mask;
981 int i; 980 int i;
981 struct v4l2_control client_ctl;
982 982
983 for (i = 0; i < CX8800_CTLS; i++) { 983 for (i = 0; i < CX8800_CTLS; i++) {
984 if (cx8800_ctls[i].v.id == ctl->id) { 984 if (cx8800_ctls[i].v.id == ctl->id) {
@@ -992,6 +992,27 @@ int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl)
992 ctl->value = c->v.minimum; 992 ctl->value = c->v.minimum;
993 if (ctl->value > c->v.maximum) 993 if (ctl->value > c->v.maximum)
994 ctl->value = c->v.maximum; 994 ctl->value = c->v.maximum;
995
996 /* Pass changes onto any WM8775 */
997 client_ctl.id = ctl->id;
998 switch (ctl->id) {
999 case V4L2_CID_AUDIO_MUTE:
1000 client_ctl.value = ctl->value;
1001 break;
1002 case V4L2_CID_AUDIO_VOLUME:
1003 client_ctl.value = (ctl->value) ?
1004 (0x90 + ctl->value) << 8 : 0;
1005 break;
1006 case V4L2_CID_AUDIO_BALANCE:
1007 client_ctl.value = ctl->value << 9;
1008 break;
1009 default:
1010 client_ctl.id = 0;
1011 break;
1012 }
1013 if (client_ctl.id)
1014 call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl);
1015
995 mask=c->mask; 1016 mask=c->mask;
996 switch (ctl->id) { 1017 switch (ctl->id) {
997 case V4L2_CID_AUDIO_BALANCE: 1018 case V4L2_CID_AUDIO_BALANCE:
@@ -1072,7 +1093,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
1072 struct v4l2_format *f) 1093 struct v4l2_format *f)
1073{ 1094{
1074 struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core; 1095 struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core;
1075 struct cx8800_fmt *fmt; 1096 const struct cx8800_fmt *fmt;
1076 enum v4l2_field field; 1097 enum v4l2_field field;
1077 unsigned int maxw, maxh; 1098 unsigned int maxw, maxh;
1078 1099
@@ -1247,7 +1268,7 @@ static int vidioc_s_std (struct file *file, void *priv, v4l2_std_id *tvnorms)
1247/* only one input in this sample driver */ 1268/* only one input in this sample driver */
1248int cx88_enum_input (struct cx88_core *core,struct v4l2_input *i) 1269int cx88_enum_input (struct cx88_core *core,struct v4l2_input *i)
1249{ 1270{
1250 static const char *iname[] = { 1271 static const char * const iname[] = {
1251 [ CX88_VMUX_COMPOSITE1 ] = "Composite1", 1272 [ CX88_VMUX_COMPOSITE1 ] = "Composite1",
1252 [ CX88_VMUX_COMPOSITE2 ] = "Composite2", 1273 [ CX88_VMUX_COMPOSITE2 ] = "Composite2",
1253 [ CX88_VMUX_COMPOSITE3 ] = "Composite3", 1274 [ CX88_VMUX_COMPOSITE3 ] = "Composite3",
@@ -1267,9 +1288,10 @@ int cx88_enum_input (struct cx88_core *core,struct v4l2_input *i)
1267 i->type = V4L2_INPUT_TYPE_CAMERA; 1288 i->type = V4L2_INPUT_TYPE_CAMERA;
1268 strcpy(i->name,iname[INPUT(n).type]); 1289 strcpy(i->name,iname[INPUT(n).type]);
1269 if ((CX88_VMUX_TELEVISION == INPUT(n).type) || 1290 if ((CX88_VMUX_TELEVISION == INPUT(n).type) ||
1270 (CX88_VMUX_CABLE == INPUT(n).type)) 1291 (CX88_VMUX_CABLE == INPUT(n).type)) {
1271 i->type = V4L2_INPUT_TYPE_TUNER; 1292 i->type = V4L2_INPUT_TYPE_TUNER;
1272 i->std = CX88_NORMS; 1293 i->std = CX88_NORMS;
1294 }
1273 return 0; 1295 return 0;
1274} 1296}
1275EXPORT_SYMBOL(cx88_enum_input); 1297EXPORT_SYMBOL(cx88_enum_input);
@@ -1537,7 +1559,9 @@ static int radio_queryctrl (struct file *file, void *priv,
1537 if (c->id < V4L2_CID_BASE || 1559 if (c->id < V4L2_CID_BASE ||
1538 c->id >= V4L2_CID_LASTP1) 1560 c->id >= V4L2_CID_LASTP1)
1539 return -EINVAL; 1561 return -EINVAL;
1540 if (c->id == V4L2_CID_AUDIO_MUTE) { 1562 if (c->id == V4L2_CID_AUDIO_MUTE ||
1563 c->id == V4L2_CID_AUDIO_VOLUME ||
1564 c->id == V4L2_CID_AUDIO_BALANCE) {
1541 for (i = 0; i < CX8800_CTLS; i++) { 1565 for (i = 0; i < CX8800_CTLS; i++) {
1542 if (cx8800_ctls[i].v.id == c->id) 1566 if (cx8800_ctls[i].v.id == c->id)
1543 break; 1567 break;
@@ -1578,7 +1602,7 @@ static void cx8800_vid_timeout(unsigned long data)
1578 spin_unlock_irqrestore(&dev->slock,flags); 1602 spin_unlock_irqrestore(&dev->slock,flags);
1579} 1603}
1580 1604
1581static char *cx88_vid_irqs[32] = { 1605static const char *cx88_vid_irqs[32] = {
1582 "y_risci1", "u_risci1", "v_risci1", "vbi_risc1", 1606 "y_risci1", "u_risci1", "v_risci1", "vbi_risc1",
1583 "y_risci2", "u_risci2", "v_risci2", "vbi_risc2", 1607 "y_risci2", "u_risci2", "v_risci2", "vbi_risc2",
1584 "y_oflow", "u_oflow", "v_oflow", "vbi_oflow", 1608 "y_oflow", "u_oflow", "v_oflow", "vbi_oflow",
@@ -1723,7 +1747,7 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
1723 1747
1724static struct video_device cx8800_vbi_template; 1748static struct video_device cx8800_vbi_template;
1725 1749
1726static struct video_device cx8800_video_template = { 1750static const struct video_device cx8800_video_template = {
1727 .name = "cx8800-video", 1751 .name = "cx8800-video",
1728 .fops = &video_fops, 1752 .fops = &video_fops,
1729 .ioctl_ops = &video_ioctl_ops, 1753 .ioctl_ops = &video_ioctl_ops,
@@ -1758,7 +1782,7 @@ static const struct v4l2_ioctl_ops radio_ioctl_ops = {
1758#endif 1782#endif
1759}; 1783};
1760 1784
1761static struct video_device cx8800_radio_template = { 1785static const struct video_device cx8800_radio_template = {
1762 .name = "cx8800-radio", 1786 .name = "cx8800-radio",
1763 .fops = &radio_fops, 1787 .fops = &radio_fops,
1764 .ioctl_ops = &radio_ioctl_ops, 1788 .ioctl_ops = &radio_ioctl_ops,
@@ -1872,20 +1896,20 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
1872 1896
1873 if (core->board.audio_chip == V4L2_IDENT_WM8775) 1897 if (core->board.audio_chip == V4L2_IDENT_WM8775)
1874 v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap, 1898 v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap,
1875 "wm8775", "wm8775", 0x36 >> 1, NULL); 1899 NULL, "wm8775", 0x36 >> 1, NULL);
1876 1900
1877 if (core->board.audio_chip == V4L2_IDENT_TVAUDIO) { 1901 if (core->board.audio_chip == V4L2_IDENT_TVAUDIO) {
1878 /* This probes for a tda9874 as is used on some 1902 /* This probes for a tda9874 as is used on some
1879 Pixelview Ultra boards. */ 1903 Pixelview Ultra boards. */
1880 v4l2_i2c_new_subdev(&core->v4l2_dev, 1904 v4l2_i2c_new_subdev(&core->v4l2_dev,
1881 &core->i2c_adap, 1905 &core->i2c_adap,
1882 "tvaudio", "tvaudio", 0, I2C_ADDRS(0xb0 >> 1)); 1906 NULL, "tvaudio", 0, I2C_ADDRS(0xb0 >> 1));
1883 } 1907 }
1884 1908
1885 switch (core->boardnr) { 1909 switch (core->boardnr) {
1886 case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD: 1910 case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD:
1887 case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD: { 1911 case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD: {
1888 static struct i2c_board_info rtc_info = { 1912 static const struct i2c_board_info rtc_info = {
1889 I2C_BOARD_INFO("isl1208", 0x6f) 1913 I2C_BOARD_INFO("isl1208", 0x6f)
1890 }; 1914 };
1891 1915
@@ -2082,7 +2106,7 @@ static int cx8800_resume(struct pci_dev *pci_dev)
2082 2106
2083/* ----------------------------------------------------------- */ 2107/* ----------------------------------------------------------- */
2084 2108
2085static struct pci_device_id cx8800_pci_tbl[] = { 2109static const struct pci_device_id cx8800_pci_tbl[] = {
2086 { 2110 {
2087 .vendor = 0x14f1, 2111 .vendor = 0x14f1,
2088 .device = 0x8800, 2112 .device = 0x8800,
diff --git a/drivers/media/video/cx88/cx88-vp3054-i2c.c b/drivers/media/video/cx88/cx88-vp3054-i2c.c
index 794f2932b755..ec5476d8b10b 100644
--- a/drivers/media/video/cx88/cx88-vp3054-i2c.c
+++ b/drivers/media/video/cx88/cx88-vp3054-i2c.c
@@ -121,8 +121,6 @@ int vp3054_i2c_probe(struct cx8802_dev *dev)
121 memcpy(&vp3054_i2c->algo, &vp3054_i2c_algo_template, 121 memcpy(&vp3054_i2c->algo, &vp3054_i2c_algo_template,
122 sizeof(vp3054_i2c->algo)); 122 sizeof(vp3054_i2c->algo));
123 123
124 vp3054_i2c->adap.class |= I2C_CLASS_TV_DIGITAL;
125
126 vp3054_i2c->adap.dev.parent = &dev->pci->dev; 124 vp3054_i2c->adap.dev.parent = &dev->pci->dev;
127 strlcpy(vp3054_i2c->adap.name, core->name, 125 strlcpy(vp3054_i2c->adap.name, core->name,
128 sizeof(vp3054_i2c->adap.name)); 126 sizeof(vp3054_i2c->adap.name));
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index 33d161a11725..e8c732e7ae4f 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -31,9 +31,8 @@
31#include <media/videobuf-dma-sg.h> 31#include <media/videobuf-dma-sg.h>
32#include <media/v4l2-chip-ident.h> 32#include <media/v4l2-chip-ident.h>
33#include <media/cx2341x.h> 33#include <media/cx2341x.h>
34#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE)
35#include <media/videobuf-dvb.h> 34#include <media/videobuf-dvb.h>
36#endif 35#include <media/ir-kbd-i2c.h>
37 36
38#include "btcx-risc.h" 37#include "btcx-risc.h"
39#include "cx88-reg.h" 38#include "cx88-reg.h"
@@ -108,7 +107,7 @@ static unsigned int inline norm_maxh(v4l2_std_id norm)
108/* static data */ 107/* static data */
109 108
110struct cx8800_fmt { 109struct cx8800_fmt {
111 char *name; 110 const char *name;
112 u32 fourcc; /* v4l2 format id */ 111 u32 fourcc; /* v4l2 format id */
113 int depth; 112 int depth;
114 int flags; 113 int flags;
@@ -138,7 +137,7 @@ struct cx88_ctrl {
138/* more */ 137/* more */
139 138
140struct sram_channel { 139struct sram_channel {
141 char *name; 140 const char *name;
142 u32 cmds_start; 141 u32 cmds_start;
143 u32 ctrl_start; 142 u32 ctrl_start;
144 u32 cdt; 143 u32 cdt;
@@ -149,7 +148,7 @@ struct sram_channel {
149 u32 cnt1_reg; 148 u32 cnt1_reg;
150 u32 cnt2_reg; 149 u32 cnt2_reg;
151}; 150};
152extern struct sram_channel cx88_sram_channels[]; 151extern const struct sram_channel const cx88_sram_channels[];
153 152
154/* ----------------------------------------------------------- */ 153/* ----------------------------------------------------------- */
155/* card configuration */ 154/* card configuration */
@@ -240,6 +239,7 @@ extern struct sram_channel cx88_sram_channels[];
240#define CX88_BOARD_WINFAST_DTV2000H_J 82 239#define CX88_BOARD_WINFAST_DTV2000H_J 82
241#define CX88_BOARD_PROF_7301 83 240#define CX88_BOARD_PROF_7301 83
242#define CX88_BOARD_SAMSUNG_SMT_7020 84 241#define CX88_BOARD_SAMSUNG_SMT_7020 84
242#define CX88_BOARD_TWINHAN_VP1027_DVBS 85
243 243
244enum cx88_itype { 244enum cx88_itype {
245 CX88_VMUX_COMPOSITE1 = 1, 245 CX88_VMUX_COMPOSITE1 = 1,
@@ -262,7 +262,7 @@ struct cx88_input {
262}; 262};
263 263
264struct cx88_board { 264struct cx88_board {
265 char *name; 265 const char *name;
266 unsigned int tuner_type; 266 unsigned int tuner_type;
267 unsigned int radio_type; 267 unsigned int radio_type;
268 unsigned char tuner_addr; 268 unsigned char tuner_addr;
@@ -281,6 +281,20 @@ struct cx88_subid {
281 u32 card; 281 u32 card;
282}; 282};
283 283
284enum cx88_tvaudio {
285 WW_NONE = 1,
286 WW_BTSC,
287 WW_BG,
288 WW_DK,
289 WW_I,
290 WW_L,
291 WW_EIAJ,
292 WW_I2SPT,
293 WW_FM,
294 WW_I2SADC,
295 WW_M
296};
297
284#define INPUT(nr) (core->board.input[nr]) 298#define INPUT(nr) (core->board.input[nr])
285 299
286/* ----------------------------------------------------------- */ 300/* ----------------------------------------------------------- */
@@ -300,7 +314,7 @@ struct cx88_buffer {
300 /* cx88 specific */ 314 /* cx88 specific */
301 unsigned int bpl; 315 unsigned int bpl;
302 struct btcx_riscmem risc; 316 struct btcx_riscmem risc;
303 struct cx8800_fmt *fmt; 317 const struct cx8800_fmt *fmt;
304 u32 count; 318 u32 count;
305}; 319};
306 320
@@ -352,7 +366,7 @@ struct cx88_core {
352 /* state info */ 366 /* state info */
353 struct task_struct *kthread; 367 struct task_struct *kthread;
354 v4l2_std_id tvnorm; 368 v4l2_std_id tvnorm;
355 u32 tvaudio; 369 enum cx88_tvaudio tvaudio;
356 u32 audiomode_manual; 370 u32 audiomode_manual;
357 u32 audiomode_current; 371 u32 audiomode_current;
358 u32 input; 372 u32 input;
@@ -363,6 +377,9 @@ struct cx88_core {
363 /* IR remote control state */ 377 /* IR remote control state */
364 struct cx88_IR *ir; 378 struct cx88_IR *ir;
365 379
380 /* I2C remote data */
381 struct IR_i2c_init_data init_data;
382
366 struct mutex lock; 383 struct mutex lock;
367 /* various v4l controls */ 384 /* various v4l controls */
368 u32 freq; 385 u32 freq;
@@ -381,17 +398,19 @@ static inline struct cx88_core *to_core(struct v4l2_device *v4l2_dev)
381 return container_of(v4l2_dev, struct cx88_core, v4l2_dev); 398 return container_of(v4l2_dev, struct cx88_core, v4l2_dev);
382} 399}
383 400
384#define call_all(core, o, f, args...) \ 401#define call_hw(core, grpid, o, f, args...) \
385 do { \ 402 do { \
386 if (!core->i2c_rc) { \ 403 if (!core->i2c_rc) { \
387 if (core->gate_ctrl) \ 404 if (core->gate_ctrl) \
388 core->gate_ctrl(core, 1); \ 405 core->gate_ctrl(core, 1); \
389 v4l2_device_call_all(&core->v4l2_dev, 0, o, f, ##args); \ 406 v4l2_device_call_all(&core->v4l2_dev, grpid, o, f, ##args); \
390 if (core->gate_ctrl) \ 407 if (core->gate_ctrl) \
391 core->gate_ctrl(core, 0); \ 408 core->gate_ctrl(core, 0); \
392 } \ 409 } \
393 } while (0) 410 } while (0)
394 411
412#define call_all(core, o, f, args...) call_hw(core, 0, o, f, ##args)
413
395struct cx8800_dev; 414struct cx8800_dev;
396struct cx8802_dev; 415struct cx8802_dev;
397 416
@@ -410,7 +429,7 @@ struct cx8800_fh {
410 unsigned int nclips; 429 unsigned int nclips;
411 430
412 /* video capture */ 431 /* video capture */
413 struct cx8800_fmt *fmt; 432 const struct cx8800_fmt *fmt;
414 unsigned int width,height; 433 unsigned int width,height;
415 struct videobuf_queue vidq; 434 struct videobuf_queue vidq;
416 435
@@ -565,7 +584,7 @@ struct cx8802_dev {
565/* ----------------------------------------------------------- */ 584/* ----------------------------------------------------------- */
566/* cx88-core.c */ 585/* cx88-core.c */
567 586
568extern void cx88_print_irqbits(char *name, char *tag, char **strings, 587extern void cx88_print_irqbits(const char *name, const char *tag, const char *strings[],
569 int len, u32 bits, u32 mask); 588 int len, u32 bits, u32 mask);
570 589
571extern int cx88_core_irq(struct cx88_core *core, u32 status); 590extern int cx88_core_irq(struct cx88_core *core, u32 status);
@@ -592,10 +611,10 @@ cx88_free_buffer(struct videobuf_queue *q, struct cx88_buffer *buf);
592extern void cx88_risc_disasm(struct cx88_core *core, 611extern void cx88_risc_disasm(struct cx88_core *core,
593 struct btcx_riscmem *risc); 612 struct btcx_riscmem *risc);
594extern int cx88_sram_channel_setup(struct cx88_core *core, 613extern int cx88_sram_channel_setup(struct cx88_core *core,
595 struct sram_channel *ch, 614 const struct sram_channel *ch,
596 unsigned int bpl, u32 risc); 615 unsigned int bpl, u32 risc);
597extern void cx88_sram_channel_dump(struct cx88_core *core, 616extern void cx88_sram_channel_dump(struct cx88_core *core,
598 struct sram_channel *ch); 617 const struct sram_channel *ch);
599 618
600extern int cx88_set_scale(struct cx88_core *core, unsigned int width, 619extern int cx88_set_scale(struct cx88_core *core, unsigned int width,
601 unsigned int height, enum v4l2_field field); 620 unsigned int height, enum v4l2_field field);
@@ -603,8 +622,8 @@ extern int cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm);
603 622
604extern struct video_device *cx88_vdev_init(struct cx88_core *core, 623extern struct video_device *cx88_vdev_init(struct cx88_core *core,
605 struct pci_dev *pci, 624 struct pci_dev *pci,
606 struct video_device *template, 625 const struct video_device *template_,
607 char *type); 626 const char *type);
608extern struct cx88_core* cx88_core_get(struct pci_dev *pci); 627extern struct cx88_core* cx88_core_get(struct pci_dev *pci);
609extern void cx88_core_put(struct cx88_core *core, 628extern void cx88_core_put(struct cx88_core *core,
610 struct pci_dev *pci); 629 struct pci_dev *pci);
@@ -630,13 +649,12 @@ int cx8800_restart_vbi_queue(struct cx8800_dev *dev,
630 struct cx88_dmaqueue *q); 649 struct cx88_dmaqueue *q);
631void cx8800_vbi_timeout(unsigned long data); 650void cx8800_vbi_timeout(unsigned long data);
632 651
633extern struct videobuf_queue_ops cx8800_vbi_qops; 652extern const struct videobuf_queue_ops cx8800_vbi_qops;
634 653
635/* ----------------------------------------------------------- */ 654/* ----------------------------------------------------------- */
636/* cx88-i2c.c */ 655/* cx88-i2c.c */
637 656
638extern int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci); 657extern int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci);
639extern void cx88_i2c_init_ir(struct cx88_core *core);
640 658
641 659
642/* ----------------------------------------------------------- */ 660/* ----------------------------------------------------------- */
@@ -651,18 +669,6 @@ extern void cx88_setup_xc3028(struct cx88_core *core, struct xc2028_ctrl *ctl);
651/* ----------------------------------------------------------- */ 669/* ----------------------------------------------------------- */
652/* cx88-tvaudio.c */ 670/* cx88-tvaudio.c */
653 671
654#define WW_NONE 1
655#define WW_BTSC 2
656#define WW_BG 3
657#define WW_DK 4
658#define WW_I 5
659#define WW_L 6
660#define WW_EIAJ 7
661#define WW_I2SPT 8
662#define WW_FM 9
663#define WW_I2SADC 10
664#define WW_M 11
665
666void cx88_set_tvaudio(struct cx88_core *core); 672void cx88_set_tvaudio(struct cx88_core *core);
667void cx88_newstation(struct cx88_core *core); 673void cx88_newstation(struct cx88_core *core);
668void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t); 674void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t);
@@ -686,6 +692,7 @@ int cx88_ir_fini(struct cx88_core *core);
686void cx88_ir_irq(struct cx88_core *core); 692void cx88_ir_irq(struct cx88_core *core);
687int cx88_ir_start(struct cx88_core *core); 693int cx88_ir_start(struct cx88_core *core);
688void cx88_ir_stop(struct cx88_core *core); 694void cx88_ir_stop(struct cx88_core *core);
695extern void cx88_i2c_init_ir(struct cx88_core *core);
689 696
690/* ----------------------------------------------------------- */ 697/* ----------------------------------------------------------- */
691/* cx88-mpeg.c */ 698/* cx88-mpeg.c */
@@ -705,10 +712,3 @@ int cx88_set_freq (struct cx88_core *core,struct v4l2_frequency *f);
705int cx88_get_control(struct cx88_core *core, struct v4l2_control *ctl); 712int cx88_get_control(struct cx88_core *core, struct v4l2_control *ctl);
706int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl); 713int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl);
707int cx88_video_mux(struct cx88_core *core, unsigned int input); 714int cx88_video_mux(struct cx88_core *core, unsigned int input);
708
709/*
710 * Local variables:
711 * c-basic-offset: 8
712 * End:
713 * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off
714 */