aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bt8xx
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/bt8xx')
-rw-r--r--drivers/media/video/bt8xx/Makefile2
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c170
-rw-r--r--drivers/media/video/bt8xx/bttv-vbi.c2
3 files changed, 90 insertions, 84 deletions
diff --git a/drivers/media/video/bt8xx/Makefile b/drivers/media/video/bt8xx/Makefile
index 94350f21cdc0..db641a36b197 100644
--- a/drivers/media/video/bt8xx/Makefile
+++ b/drivers/media/video/bt8xx/Makefile
@@ -9,4 +9,4 @@ bttv-objs := bttv-driver.o bttv-cards.o bttv-if.o \
9obj-$(CONFIG_VIDEO_BT848) += bttv.o 9obj-$(CONFIG_VIDEO_BT848) += bttv.o
10 10
11EXTRA_CFLAGS += -I$(src)/.. 11EXTRA_CFLAGS += -I$(src)/..
12EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core 12EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 74def9c23952..423e954948be 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -973,12 +973,12 @@ audio_mux(struct bttv *btv, int input, int mute)
973 For now this is sufficient. */ 973 For now this is sufficient. */
974 switch (input) { 974 switch (input) {
975 case TVAUDIO_INPUT_RADIO: 975 case TVAUDIO_INPUT_RADIO:
976 route.input = MSP_INPUT(MSP_IN_SCART_2, MSP_IN_TUNER_1, 976 route.input = MSP_INPUT(MSP_IN_SCART2, MSP_IN_TUNER1,
977 MSP_DSP_OUT_SCART, MSP_DSP_OUT_SCART); 977 MSP_DSP_IN_SCART, MSP_DSP_IN_SCART);
978 break; 978 break;
979 case TVAUDIO_INPUT_EXTERN: 979 case TVAUDIO_INPUT_EXTERN:
980 route.input = MSP_INPUT(MSP_IN_SCART_1, MSP_IN_TUNER_1, 980 route.input = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER1,
981 MSP_DSP_OUT_SCART, MSP_DSP_OUT_SCART); 981 MSP_DSP_IN_SCART, MSP_DSP_IN_SCART);
982 break; 982 break;
983 case TVAUDIO_INPUT_INTERN: 983 case TVAUDIO_INPUT_INTERN:
984 /* Yes, this is the same input as for RADIO. I doubt 984 /* Yes, this is the same input as for RADIO. I doubt
@@ -986,8 +986,8 @@ audio_mux(struct bttv *btv, int input, int mute)
986 input is the BTTV_BOARD_AVERMEDIA98. I wonder how 986 input is the BTTV_BOARD_AVERMEDIA98. I wonder how
987 that was tested. My guess is that the whole INTERN 987 that was tested. My guess is that the whole INTERN
988 input does not work. */ 988 input does not work. */
989 route.input = MSP_INPUT(MSP_IN_SCART_2, MSP_IN_TUNER_1, 989 route.input = MSP_INPUT(MSP_IN_SCART2, MSP_IN_TUNER1,
990 MSP_DSP_OUT_SCART, MSP_DSP_OUT_SCART); 990 MSP_DSP_IN_SCART, MSP_DSP_IN_SCART);
991 break; 991 break;
992 case TVAUDIO_INPUT_TUNER: 992 case TVAUDIO_INPUT_TUNER:
993 default: 993 default:
@@ -1023,14 +1023,11 @@ audio_input(struct bttv *btv, int input)
1023static void 1023static void
1024i2c_vidiocschan(struct bttv *btv) 1024i2c_vidiocschan(struct bttv *btv)
1025{ 1025{
1026 struct video_channel c; 1026 v4l2_std_id std = bttv_tvnorms[btv->tvnorm].v4l2_id;
1027 1027
1028 memset(&c,0,sizeof(c)); 1028 bttv_call_i2c_clients(btv, VIDIOC_S_STD, &std);
1029 c.norm = btv->tvnorm;
1030 c.channel = btv->input;
1031 bttv_call_i2c_clients(btv,VIDIOCSCHAN,&c);
1032 if (btv->c.type == BTTV_BOARD_VOODOOTV_FM) 1029 if (btv->c.type == BTTV_BOARD_VOODOOTV_FM)
1033 bttv_tda9880_setnorm(btv,c.norm); 1030 bttv_tda9880_setnorm(btv,btv->tvnorm);
1034} 1031}
1035 1032
1036static int 1033static int
@@ -1184,11 +1181,27 @@ static int get_control(struct bttv *btv, struct v4l2_control *c)
1184 break; 1181 break;
1185 if (i == BTTV_CTLS) 1182 if (i == BTTV_CTLS)
1186 return -EINVAL; 1183 return -EINVAL;
1187 if (i >= 4 && i <= 8) { 1184 if (btv->audio_hook && i >= 4 && i <= 8) {
1188 memset(&va,0,sizeof(va)); 1185 memset(&va,0,sizeof(va));
1189 bttv_call_i2c_clients(btv, VIDIOCGAUDIO, &va); 1186 btv->audio_hook(btv,&va,0);
1190 if (btv->audio_hook) 1187 switch (c->id) {
1191 btv->audio_hook(btv,&va,0); 1188 case V4L2_CID_AUDIO_MUTE:
1189 c->value = (VIDEO_AUDIO_MUTE & va.flags) ? 1 : 0;
1190 break;
1191 case V4L2_CID_AUDIO_VOLUME:
1192 c->value = va.volume;
1193 break;
1194 case V4L2_CID_AUDIO_BALANCE:
1195 c->value = va.balance;
1196 break;
1197 case V4L2_CID_AUDIO_BASS:
1198 c->value = va.bass;
1199 break;
1200 case V4L2_CID_AUDIO_TREBLE:
1201 c->value = va.treble;
1202 break;
1203 }
1204 return 0;
1192 } 1205 }
1193 switch (c->id) { 1206 switch (c->id) {
1194 case V4L2_CID_BRIGHTNESS: 1207 case V4L2_CID_BRIGHTNESS:
@@ -1205,19 +1218,11 @@ static int get_control(struct bttv *btv, struct v4l2_control *c)
1205 break; 1218 break;
1206 1219
1207 case V4L2_CID_AUDIO_MUTE: 1220 case V4L2_CID_AUDIO_MUTE:
1208 c->value = (VIDEO_AUDIO_MUTE & va.flags) ? 1 : 0;
1209 break;
1210 case V4L2_CID_AUDIO_VOLUME: 1221 case V4L2_CID_AUDIO_VOLUME:
1211 c->value = va.volume;
1212 break;
1213 case V4L2_CID_AUDIO_BALANCE: 1222 case V4L2_CID_AUDIO_BALANCE:
1214 c->value = va.balance;
1215 break;
1216 case V4L2_CID_AUDIO_BASS: 1223 case V4L2_CID_AUDIO_BASS:
1217 c->value = va.bass;
1218 break;
1219 case V4L2_CID_AUDIO_TREBLE: 1224 case V4L2_CID_AUDIO_TREBLE:
1220 c->value = va.treble; 1225 bttv_call_i2c_clients(btv,VIDIOC_G_CTRL,c);
1221 break; 1226 break;
1222 1227
1223 case V4L2_CID_PRIVATE_CHROMA_AGC: 1228 case V4L2_CID_PRIVATE_CHROMA_AGC:
@@ -1269,11 +1274,35 @@ static int set_control(struct bttv *btv, struct v4l2_control *c)
1269 break; 1274 break;
1270 if (i == BTTV_CTLS) 1275 if (i == BTTV_CTLS)
1271 return -EINVAL; 1276 return -EINVAL;
1272 if (i >= 4 && i <= 8) { 1277 if (btv->audio_hook && i >= 4 && i <= 8) {
1273 memset(&va,0,sizeof(va)); 1278 memset(&va,0,sizeof(va));
1274 bttv_call_i2c_clients(btv, VIDIOCGAUDIO, &va); 1279 btv->audio_hook(btv,&va,0);
1275 if (btv->audio_hook) 1280 switch (c->id) {
1276 btv->audio_hook(btv,&va,0); 1281 case V4L2_CID_AUDIO_MUTE:
1282 if (c->value) {
1283 va.flags |= VIDEO_AUDIO_MUTE;
1284 audio_mute(btv, 1);
1285 } else {
1286 va.flags &= ~VIDEO_AUDIO_MUTE;
1287 audio_mute(btv, 0);
1288 }
1289 break;
1290
1291 case V4L2_CID_AUDIO_VOLUME:
1292 va.volume = c->value;
1293 break;
1294 case V4L2_CID_AUDIO_BALANCE:
1295 va.balance = c->value;
1296 break;
1297 case V4L2_CID_AUDIO_BASS:
1298 va.bass = c->value;
1299 break;
1300 case V4L2_CID_AUDIO_TREBLE:
1301 va.treble = c->value;
1302 break;
1303 }
1304 btv->audio_hook(btv,&va,1);
1305 return 0;
1277 } 1306 }
1278 switch (c->id) { 1307 switch (c->id) {
1279 case V4L2_CID_BRIGHTNESS: 1308 case V4L2_CID_BRIGHTNESS:
@@ -1289,26 +1318,13 @@ static int set_control(struct bttv *btv, struct v4l2_control *c)
1289 bt848_sat(btv,c->value); 1318 bt848_sat(btv,c->value);
1290 break; 1319 break;
1291 case V4L2_CID_AUDIO_MUTE: 1320 case V4L2_CID_AUDIO_MUTE:
1292 if (c->value) { 1321 audio_mute(btv, c->value);
1293 va.flags |= VIDEO_AUDIO_MUTE; 1322 /* fall through */
1294 audio_mute(btv, 1);
1295 } else {
1296 va.flags &= ~VIDEO_AUDIO_MUTE;
1297 audio_mute(btv, 0);
1298 }
1299 break;
1300
1301 case V4L2_CID_AUDIO_VOLUME: 1323 case V4L2_CID_AUDIO_VOLUME:
1302 va.volume = c->value;
1303 break;
1304 case V4L2_CID_AUDIO_BALANCE: 1324 case V4L2_CID_AUDIO_BALANCE:
1305 va.balance = c->value;
1306 break;
1307 case V4L2_CID_AUDIO_BASS: 1325 case V4L2_CID_AUDIO_BASS:
1308 va.bass = c->value;
1309 break;
1310 case V4L2_CID_AUDIO_TREBLE: 1326 case V4L2_CID_AUDIO_TREBLE:
1311 va.treble = c->value; 1327 bttv_call_i2c_clients(btv,VIDIOC_S_CTRL,c);
1312 break; 1328 break;
1313 1329
1314 case V4L2_CID_PRIVATE_CHROMA_AGC: 1330 case V4L2_CID_PRIVATE_CHROMA_AGC:
@@ -1364,11 +1380,6 @@ static int set_control(struct bttv *btv, struct v4l2_control *c)
1364 default: 1380 default:
1365 return -EINVAL; 1381 return -EINVAL;
1366 } 1382 }
1367 if (i >= 4 && i <= 8) {
1368 bttv_call_i2c_clients(btv, VIDIOCSAUDIO, &va);
1369 if (btv->audio_hook)
1370 btv->audio_hook(btv,&va,1);
1371 }
1372 return 0; 1383 return 0;
1373} 1384}
1374 1385
@@ -1591,12 +1602,16 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1591 } 1602 }
1592 case VIDIOCSFREQ: 1603 case VIDIOCSFREQ:
1593 { 1604 {
1594 unsigned long *freq = arg; 1605 struct v4l2_frequency freq;
1606
1607 memset(&freq, 0, sizeof(freq));
1608 freq.frequency = *(unsigned long *)arg;
1595 mutex_lock(&btv->lock); 1609 mutex_lock(&btv->lock);
1596 btv->freq=*freq; 1610 freq.type = btv->radio_user ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
1597 bttv_call_i2c_clients(btv,VIDIOCSFREQ,freq); 1611 btv->freq = *(unsigned long *)arg;
1612 bttv_call_i2c_clients(btv,VIDIOC_S_FREQUENCY,&freq);
1598 if (btv->has_matchbox && btv->radio_user) 1613 if (btv->has_matchbox && btv->radio_user)
1599 tea5757_set_freq(btv,*freq); 1614 tea5757_set_freq(btv,*(unsigned long *)arg);
1600 mutex_unlock(&btv->lock); 1615 mutex_unlock(&btv->lock);
1601 return 0; 1616 return 0;
1602 } 1617 }
@@ -1827,33 +1842,26 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1827 return -EINVAL; 1842 return -EINVAL;
1828 mutex_lock(&btv->lock); 1843 mutex_lock(&btv->lock);
1829 memset(t,0,sizeof(*t)); 1844 memset(t,0,sizeof(*t));
1845 t->rxsubchans = V4L2_TUNER_SUB_MONO;
1846 bttv_call_i2c_clients(btv, VIDIOC_G_TUNER, t);
1830 strcpy(t->name, "Television"); 1847 strcpy(t->name, "Television");
1831 t->type = V4L2_TUNER_ANALOG_TV;
1832 t->capability = V4L2_TUNER_CAP_NORM; 1848 t->capability = V4L2_TUNER_CAP_NORM;
1833 t->rxsubchans = V4L2_TUNER_SUB_MONO; 1849 t->type = V4L2_TUNER_ANALOG_TV;
1834 if (btread(BT848_DSTATUS)&BT848_DSTATUS_HLOC) 1850 if (btread(BT848_DSTATUS)&BT848_DSTATUS_HLOC)
1835 t->signal = 0xffff; 1851 t->signal = 0xffff;
1836 { 1852
1837 struct video_tuner tuner; 1853 if (btv->audio_hook) {
1838
1839 memset(&tuner, 0, sizeof (tuner));
1840 tuner.rangehigh = 0xffffffffUL;
1841 bttv_call_i2c_clients(btv, VIDIOCGTUNER, &tuner);
1842 t->rangelow = tuner.rangelow;
1843 t->rangehigh = tuner.rangehigh;
1844 }
1845 {
1846 /* Hmmm ... */ 1854 /* Hmmm ... */
1847 struct video_audio va; 1855 struct video_audio va;
1848 memset(&va, 0, sizeof(struct video_audio)); 1856 memset(&va, 0, sizeof(struct video_audio));
1849 bttv_call_i2c_clients(btv, VIDIOCGAUDIO, &va); 1857 btv->audio_hook(btv,&va,0);
1850 if (btv->audio_hook) 1858 t->audmode = V4L2_TUNER_MODE_MONO;
1851 btv->audio_hook(btv,&va,0); 1859 t->rxsubchans = V4L2_TUNER_SUB_MONO;
1852 if(va.mode & VIDEO_SOUND_STEREO) { 1860 if(va.mode & VIDEO_SOUND_STEREO) {
1853 t->audmode = V4L2_TUNER_MODE_STEREO; 1861 t->audmode = V4L2_TUNER_MODE_STEREO;
1854 t->rxsubchans |= V4L2_TUNER_SUB_STEREO; 1862 t->rxsubchans = V4L2_TUNER_SUB_STEREO;
1855 } 1863 }
1856 if(va.mode & VIDEO_SOUND_LANG1) { 1864 if(va.mode & VIDEO_SOUND_LANG2) {
1857 t->audmode = V4L2_TUNER_MODE_LANG1; 1865 t->audmode = V4L2_TUNER_MODE_LANG1;
1858 t->rxsubchans = V4L2_TUNER_SUB_LANG1 1866 t->rxsubchans = V4L2_TUNER_SUB_LANG1
1859 | V4L2_TUNER_SUB_LANG2; 1867 | V4L2_TUNER_SUB_LANG2;
@@ -1872,10 +1880,10 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1872 if (0 != t->index) 1880 if (0 != t->index)
1873 return -EINVAL; 1881 return -EINVAL;
1874 mutex_lock(&btv->lock); 1882 mutex_lock(&btv->lock);
1875 { 1883 bttv_call_i2c_clients(btv, VIDIOC_S_TUNER, t);
1884 if (btv->audio_hook) {
1876 struct video_audio va; 1885 struct video_audio va;
1877 memset(&va, 0, sizeof(struct video_audio)); 1886 memset(&va, 0, sizeof(struct video_audio));
1878 bttv_call_i2c_clients(btv, VIDIOCGAUDIO, &va);
1879 if (t->audmode == V4L2_TUNER_MODE_MONO) 1887 if (t->audmode == V4L2_TUNER_MODE_MONO)
1880 va.mode = VIDEO_SOUND_MONO; 1888 va.mode = VIDEO_SOUND_MONO;
1881 else if (t->audmode == V4L2_TUNER_MODE_STEREO || 1889 else if (t->audmode == V4L2_TUNER_MODE_STEREO ||
@@ -1885,9 +1893,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1885 va.mode = VIDEO_SOUND_LANG1; 1893 va.mode = VIDEO_SOUND_LANG1;
1886 else if (t->audmode == V4L2_TUNER_MODE_LANG2) 1894 else if (t->audmode == V4L2_TUNER_MODE_LANG2)
1887 va.mode = VIDEO_SOUND_LANG2; 1895 va.mode = VIDEO_SOUND_LANG2;
1888 bttv_call_i2c_clients(btv, VIDIOCSAUDIO, &va); 1896 btv->audio_hook(btv,&va,1);
1889 if (btv->audio_hook)
1890 btv->audio_hook(btv,&va,1);
1891 } 1897 }
1892 mutex_unlock(&btv->lock); 1898 mutex_unlock(&btv->lock);
1893 return 0; 1899 return 0;
@@ -1912,7 +1918,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1912 return -EINVAL; 1918 return -EINVAL;
1913 mutex_lock(&btv->lock); 1919 mutex_lock(&btv->lock);
1914 btv->freq = f->frequency; 1920 btv->freq = f->frequency;
1915 bttv_call_i2c_clients(btv,VIDIOCSFREQ,&btv->freq); 1921 bttv_call_i2c_clients(btv,VIDIOC_S_FREQUENCY,f);
1916 if (btv->has_matchbox && btv->radio_user) 1922 if (btv->has_matchbox && btv->radio_user)
1917 tea5757_set_freq(btv,btv->freq); 1923 tea5757_set_freq(btv,btv->freq);
1918 mutex_unlock(&btv->lock); 1924 mutex_unlock(&btv->lock);
@@ -1920,7 +1926,9 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1920 } 1926 }
1921 case VIDIOC_LOG_STATUS: 1927 case VIDIOC_LOG_STATUS:
1922 { 1928 {
1929 printk(KERN_INFO "bttv%d: ================= START STATUS CARD #%d =================\n", btv->c.nr, btv->c.nr);
1923 bttv_call_i2c_clients(btv, VIDIOC_LOG_STATUS, NULL); 1930 bttv_call_i2c_clients(btv, VIDIOC_LOG_STATUS, NULL);
1931 printk(KERN_INFO "bttv%d: ================== END STATUS CARD #%d ==================\n", btv->c.nr, btv->c.nr);
1924 return 0; 1932 return 0;
1925 } 1933 }
1926 1934
@@ -2870,12 +2878,10 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
2870 return 0; 2878 return 0;
2871 } 2879 }
2872 *c = bttv_ctls[i]; 2880 *c = bttv_ctls[i];
2873 if (i >= 4 && i <= 8) { 2881 if (btv->audio_hook && i >= 4 && i <= 8) {
2874 struct video_audio va; 2882 struct video_audio va;
2875 memset(&va,0,sizeof(va)); 2883 memset(&va,0,sizeof(va));
2876 bttv_call_i2c_clients(btv, VIDIOCGAUDIO, &va); 2884 btv->audio_hook(btv,&va,0);
2877 if (btv->audio_hook)
2878 btv->audio_hook(btv,&va,0);
2879 switch (bttv_ctls[i].id) { 2885 switch (bttv_ctls[i].id) {
2880 case V4L2_CID_AUDIO_VOLUME: 2886 case V4L2_CID_AUDIO_VOLUME:
2881 if (!(va.flags & VIDEO_AUDIO_VOLUME)) 2887 if (!(va.flags & VIDEO_AUDIO_VOLUME))
diff --git a/drivers/media/video/bt8xx/bttv-vbi.c b/drivers/media/video/bt8xx/bttv-vbi.c
index e20ff238e409..8c9f0f7cf467 100644
--- a/drivers/media/video/bt8xx/bttv-vbi.c
+++ b/drivers/media/video/bt8xx/bttv-vbi.c
@@ -184,7 +184,7 @@ void bttv_vbi_try_fmt(struct bttv_fh *fh, struct v4l2_format *f)
184 - tvnorm->vbistart[0]; 184 - tvnorm->vbistart[0];
185 count1 = (s64) f->fmt.vbi.start[1] + f->fmt.vbi.count[1] 185 count1 = (s64) f->fmt.vbi.start[1] + f->fmt.vbi.count[1]
186 - tvnorm->vbistart[1]; 186 - tvnorm->vbistart[1];
187 count = clamp (max (count0, count1), 1LL, (s64) VBI_MAXLINES); 187 count = clamp (max (count0, count1), (s64) 1, (s64) VBI_MAXLINES);
188 188
189 f->fmt.vbi.start[0] = tvnorm->vbistart[0]; 189 f->fmt.vbi.start[0] = tvnorm->vbistart[0];
190 f->fmt.vbi.start[1] = tvnorm->vbistart[1]; 190 f->fmt.vbi.start[1] = tvnorm->vbistart[1];