summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux/drivers/media/video/cx88/cx88-video.c15
-rw-r--r--linux/drivers/media/video/tea5767.c48
-rw-r--r--linux/drivers/media/video/tuner-core.c3
-rw-r--r--linux/include/media/tuner.h5
-rw-r--r--v4l/ChangeLog5
5 files changed, 50 insertions, 26 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-video.c b/linux/drivers/media/video/cx88/cx88-video.c
index 7edb24afa..f508b1256 100644
--- a/linux/drivers/media/video/cx88/cx88-video.c
+++ b/linux/drivers/media/video/cx88/cx88-video.c
@@ -1,5 +1,5 @@
/*
- * $Id: cx88-video.c,v 1.67 2005/06/17 20:49:30 nsh Exp $
+ * $Id: cx88-video.c,v 1.68 2005/06/19 15:59:25 mchehab Exp $
*
* device driver for Conexant 2388x based TV cards
* video4linux video interface
@@ -1760,8 +1760,19 @@ static int radio_do_ioctl(struct inode *inode, struct file *file,
*id = 0;
return 0;
}
- case VIDIOC_S_AUDIO:
case VIDIOC_S_TUNER:
+ {
+ struct v4l2_tuner *t = arg;
+
+ if (0 != t->index)
+ return -EINVAL;
+
+ cx88_call_i2c_clients(dev->core,VIDIOC_S_TUNER,t);
+
+ return 0;
+ }
+
+ case VIDIOC_S_AUDIO:
case VIDIOC_S_INPUT:
case VIDIOC_S_STD:
return 0;
diff --git a/linux/drivers/media/video/tea5767.c b/linux/drivers/media/video/tea5767.c
index ed7b56944..7eee795c7 100644
--- a/linux/drivers/media/video/tea5767.c
+++ b/linux/drivers/media/video/tea5767.c
@@ -2,7 +2,7 @@
* For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview
* I2C address is allways 0xC0.
*
- * $Id: tea5767.c,v 1.7 2005/06/15 02:43:03 mchehab Exp $
+ * $Id: tea5767.c,v 1.8 2005/06/19 15:59:25 mchehab Exp $
*
* Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br)
* This code is placed under the terms of the GNU General Public License
@@ -129,18 +129,6 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq)
tuner_warn("This tuner doesn't support TV freq.\n");
}
-/* Closest value table */
-/* int radio_frq[16]={ 0, 1, 2, 4, 5, 6, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18 }; */
-/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */
-
-/* radio adjust freq for odd channel frequencies used in US, Brazil, ... */
-/* int radio_frq[16]={ 0, 1, 2, 3, 5, 6, 7, 9, 10, 11, 13, 14, 15, 17, 18, 19 }; */
-/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */
-
-/* radio adjust freq for even channel frequencies */
-/* int radio_frq[16]={ 0, 1, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 19 }; */
-/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */
-
/* Freq should be specifyed at 62.5 Hz */
static void set_radio_freq(struct i2c_client *c, unsigned int frq)
{
@@ -158,6 +146,10 @@ static void set_radio_freq(struct i2c_client *c, unsigned int frq)
buffer[2] = TEA5767_PORT1_HIGH;
buffer[3] = TEA5767_PORT2_HIGH | TEA5767_HIGH_CUT_CTRL | TEA5767_ST_NOISE_CTL | TEA5767_JAPAN_BAND;
buffer[4]=0;
+
+
+ if (!t->audmode == V4L2_TUNER_MODE_MONO)
+ buffer[3] |= TEA5767_MONO;
switch (t->type) {
case TEA5767_HIGH_LO_13MHz:
@@ -194,13 +186,27 @@ static void set_radio_freq(struct i2c_client *c, unsigned int frq)
buffer[0] = (div>>8) & 0x3f;
buffer[1] = div & 0xff;
- tuner_dbg("TEA5767 radio SET 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
- buffer[0],buffer[1],buffer[2],buffer[3],buffer[4]);
+/* tuner_dbg("TEA5767 radio SET 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
+ buffer[0],buffer[1],buffer[2],buffer[3],buffer[4]); */
if (5 != (rc = i2c_master_send(c,buffer,5)))
tuner_warn("i2c i/o error: rc == %d (should be 5)\n",rc);
}
+static int tea5767_set_tuner(struct i2c_client *c, struct v4l2_tuner *vt)
+{
+ struct tuner *t = i2c_get_clientdata(c);
+
+ if (vt->audmode == V4L2_TUNER_MODE_MONO)
+ t->audmode = V4L2_TUNER_MODE_MONO;
+ else
+ t->audmode = V4L2_TUNER_MODE_STEREO;
+
+ set_radio_freq(c, t->freq);
+
+ return 0;
+}
+
static void tea5767_status_dump(unsigned char *buffer)
{
unsigned int div, frq;
@@ -264,10 +270,10 @@ static int tea5767_signal(struct i2c_client *c)
if (5 != (rc = i2c_master_recv(c,buffer,5)))
tuner_warn ( "i2c i/o error: rc == %d (should be 5)\n",rc);
- tuner_dbg("TEA5767 radio SIG GET 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
- buffer[0],buffer[1],buffer[2],buffer[3],buffer[4]);
+/* tuner_dbg("TEA5767 radio SIG GET 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
+ buffer[0],buffer[1],buffer[2],buffer[3],buffer[4]); */
- tea5767_status_dump(buffer);
+ /* tea5767_status_dump(buffer); */
return ((buffer[3] & TEA5767_ADC_LEVEL_MASK) <<(13-4));
}
@@ -281,12 +287,9 @@ static int tea5767_stereo(struct i2c_client *c)
if (5 != (rc = i2c_master_recv(c,buffer,5)))
tuner_warn ( "i2c i/o error: rc == %d (should be 5)\n",rc);
-// tuner_dbg("TEA5767 radio ST GET 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
-// buffer[0],buffer[1],buffer[2],buffer[3],buffer[4]);
-
rc = buffer[2] & TEA5767_STEREO_MASK;
- tuner_dbg("TEA5767 radio ST GET = %02x\n", rc);
+/* tuner_dbg("TEA5767 radio ST GET = %02x\n", rc); */
return ( (buffer[2] & TEA5767_STEREO_MASK) ? V4L2_TUNER_SUB_STEREO: 0);
}
@@ -303,6 +306,7 @@ int tea5767_tuner_init(struct i2c_client *c)
t->radio_freq = set_radio_freq;
t->has_signal = tea5767_signal;
t->is_stereo = tea5767_stereo;
+ t->set_tuner = tea5767_set_tuner;
return (0);
}
diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c
index e92053f27..a0a38be0d 100644
--- a/linux/drivers/media/video/tuner-core.c
+++ b/linux/drivers/media/video/tuner-core.c
@@ -1,5 +1,5 @@
/*
- * $Id: tuner-core.c,v 1.22 2005/06/19 14:41:59 mchehab Exp $
+ * $Id: tuner-core.c,v 1.23 2005/06/19 15:59:25 mchehab Exp $
*
* i2c tv tuner chip device driver
* core core, i.e. kernel interfaces, registering and so on
@@ -285,6 +285,7 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
i2c_set_clientdata(&t->i2c, t);
t->type = UNSET;
t->radio_if2 = 10700*1000; /* 10.7MHz - FM radio */
+ t->audmode = V4L2_TUNER_MODE_STEREO;
i2c_attach_client(&t->i2c);
tuner_info("chip found @ 0x%x (%s)\n",
diff --git a/linux/include/media/tuner.h b/linux/include/media/tuner.h
index dd871449e..36d73f6e7 100644
--- a/linux/include/media/tuner.h
+++ b/linux/include/media/tuner.h
@@ -1,5 +1,5 @@
-/* $Id: tuner.h,v 1.28 2005/06/19 14:41:59 mchehab Exp $
+/* $Id: tuner.h,v 1.29 2005/06/19 15:59:25 mchehab Exp $
*
tuner.h - definition for different tuners
@@ -197,6 +197,9 @@ struct tuner {
unsigned char i2c_easy_mode[2];
unsigned char i2c_set_freq[8];
+ /* used to keep track of audmode */
+ unsigned int audmode;
+
/* function ptrs */
void (*tv_freq)(struct i2c_client *c, unsigned int freq);
void (*radio_freq)(struct i2c_client *c, unsigned int freq);
diff --git a/v4l/ChangeLog b/v4l/ChangeLog
index 2de382fe4..12d1e62db 100644
--- a/v4l/ChangeLog
+++ b/v4l/ChangeLog
@@ -1,4 +1,9 @@
2005-06-19 14:41 mchehab
+ cx88-video.c, tea5767.c, tuner-core.c, tuner.h:
+
+ - Added inicial support for changing radio mode stereo/mono for tea5767
+
+2005-06-19 14:41 mchehab
* tuner.h, tuner-core.c:
- Implemented tuner-core support for VIDIO_S_TUNER