diff options
author | Nickolay V. Shmyrev <devnull@localhost> | 2005-08-17 19:42:11 +0000 |
---|---|---|
committer | Nickolay V. Shmyrev <devnull@localhost> | 2005-08-17 19:42:11 +0000 |
commit | cad4a4110faf2672fc6dec4d5ca6c09ccac2e3e2 (patch) | |
tree | 1603ed1bbfbf74e7dd75c1d8b9a75642dba7d713 | |
parent | 5e49ebffdf77e2a1052b3c84d175e707749f532a (diff) | |
download | mediapointer-dvb-s2-cad4a4110faf2672fc6dec4d5ca6c09ccac2e3e2.tar.gz mediapointer-dvb-s2-cad4a4110faf2672fc6dec4d5ca6c09ccac2e3e2.tar.bz2 |
* cx88-dvb.c: (lgdt330x_pll_set):
* cx88-video.c: (video_release):
* mt20xx.c: (microtune_init):
* saa7134-video.c: (video_release):
* tda8290.c: (standby), (tda8290_init):
* tda9887.c: (tda9887_set_tvnorm), (tda9887_configure),
(tda9887_command):
* tea5767.c: (set_radio_freq), (tea5767_standby),
(tea5767_tuner_init):
* tuner-core.c: (set_addr), (check_mode), (set_mode),
(tuner_command):
* tuner-simple.c: (default_tuner_init):
* tuner.h:
- New tuner standby API.
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-dvb.c | 7 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-video.c | 5 | ||||
-rw-r--r-- | linux/drivers/media/video/mt20xx.c | 3 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134-video.c | 28 | ||||
-rw-r--r-- | linux/drivers/media/video/tda8290.c | 20 | ||||
-rw-r--r-- | linux/drivers/media/video/tda9887.c | 37 | ||||
-rw-r--r-- | linux/drivers/media/video/tea5767.c | 26 | ||||
-rw-r--r-- | linux/drivers/media/video/tuner-core.c | 72 | ||||
-rw-r--r-- | linux/drivers/media/video/tuner-simple.c | 3 | ||||
-rw-r--r-- | linux/include/media/tuner.h | 7 | ||||
-rw-r--r-- | v4l/ChangeLog | 20 |
11 files changed, 137 insertions, 91 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-dvb.c b/linux/drivers/media/video/cx88/cx88-dvb.c index c95b3fb7b..31d1a5310 100644 --- a/linux/drivers/media/video/cx88/cx88-dvb.c +++ b/linux/drivers/media/video/cx88/cx88-dvb.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-dvb.c,v 1.59 2005/08/11 17:18:38 mkrufky Exp $ + * $Id: cx88-dvb.c,v 1.60 2005/08/17 19:42:11 nsh Exp $ * * device driver for Conexant 2388x based TV cards * MPEG Transport Stream (DVB) routines @@ -232,11 +232,8 @@ static int lgdt330x_pll_set(struct dvb_frontend* fe, int err; /* Put the analog decoder in standby to keep it quiet */ - /* FIXME: it is using a side effect to mute tuner instead of T_STANDBY */ if (core->tda9887_conf) { - v4l2_std_id std = V4L2_STD_ATSC; - - cx88_call_i2c_clients(core, VIDIOC_S_STD, &std); + cx88_call_i2c_clients (dev->core, TUNER_SET_STANDBY, NULL); } dvb_pll_configure(core->pll_desc, buf, params->frequency, 0); diff --git a/linux/drivers/media/video/cx88/cx88-video.c b/linux/drivers/media/video/cx88/cx88-video.c index 46f1e95d0..7401b1245 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.87 2005/08/16 17:23:46 catalin Exp $ + * $Id: cx88-video.c,v 1.88 2005/08/17 19:42:11 nsh Exp $ * * device driver for Conexant 2388x based TV cards * video4linux video interface @@ -1113,6 +1113,9 @@ static int video_release(struct inode *inode, struct file *file) videobuf_mmap_free(&fh->vbiq); file->private_data = NULL; kfree(fh); + + cx88_call_i2c_clients (dev->core, TUNER_SET_STANDBY, NULL); + return 0; } diff --git a/linux/drivers/media/video/mt20xx.c b/linux/drivers/media/video/mt20xx.c index 62a1e6f7f..51387cb4f 100644 --- a/linux/drivers/media/video/mt20xx.c +++ b/linux/drivers/media/video/mt20xx.c @@ -1,5 +1,5 @@ /* - * $Id: mt20xx.c,v 1.6 2005/07/15 21:44:14 mchehab Exp $ + * $Id: mt20xx.c,v 1.7 2005/08/17 19:42:11 nsh Exp $ * * i2c tv tuner chip device driver * controls microtune tuners, mt2032 + mt2050 at the moment. @@ -495,6 +495,7 @@ int microtune_init(struct i2c_client *c) memset(buf,0,sizeof(buf)); t->tv_freq = NULL; t->radio_freq = NULL; + t->standby = NULL; name = "unknown"; i2c_master_send(c,buf,1); diff --git a/linux/drivers/media/video/saa7134/saa7134-video.c b/linux/drivers/media/video/saa7134/saa7134-video.c index 7934f3b7e..60cffee2e 100644 --- a/linux/drivers/media/video/saa7134/saa7134-video.c +++ b/linux/drivers/media/video/saa7134/saa7134-video.c @@ -1,5 +1,5 @@ /* - * $Id: saa7134-video.c,v 1.37 2005/07/15 21:44:14 mchehab Exp $ + * $Id: saa7134-video.c,v 1.38 2005/08/17 19:42:11 nsh Exp $ * * device driver for philips saa7134 based TV cards * video4linux video interface @@ -1368,30 +1368,8 @@ static int video_release(struct inode *inode, struct file *file) saa_andorb(SAA7134_OFMT_VIDEO_B, 0x1f, 0); saa_andorb(SAA7134_OFMT_DATA_A, 0x1f, 0); saa_andorb(SAA7134_OFMT_DATA_B, 0x1f, 0); - - if (dev->tuner_type == TUNER_PHILIPS_TDA8290) { - u8 data[2]; - int ret; - struct i2c_msg msg = {.addr=I2C_ADDR_TDA8290, .flags=0, .buf=data, .len = 2}; - data[0] = 0x21; - data[1] = 0xc0; - ret = i2c_transfer(&dev->i2c_adap, &msg, 1); - if (ret != 1) - printk(KERN_ERR "TDA8290 access failure\n"); - msg.addr = I2C_ADDR_TDA8275; - data[0] = 0x30; - data[1] = 0xd0; - ret = i2c_transfer(&dev->i2c_adap, &msg, 1); - if (ret != 1) - printk(KERN_ERR "TDA8275 access failure\n"); - msg.addr = I2C_ADDR_TDA8290; - data[0] = 0x21; - data[1] = 0x80; - i2c_transfer(&dev->i2c_adap, &msg, 1); - data[0] = 0x00; - data[1] = 0x02; - i2c_transfer(&dev->i2c_adap, &msg, 1); - } + + saa7134_i2c_call_clients(dev, TUNER_SET_STANDBY, NULL); /* free stuff */ videobuf_mmap_free(&fh->cap); diff --git a/linux/drivers/media/video/tda8290.c b/linux/drivers/media/video/tda8290.c index c4fb4ecb6..e3340f2d8 100644 --- a/linux/drivers/media/video/tda8290.c +++ b/linux/drivers/media/video/tda8290.c @@ -1,5 +1,5 @@ /* - * $Id: tda8290.c,v 1.16 2005/07/15 21:44:14 mchehab Exp $ + * $Id: tda8290.c,v 1.17 2005/08/17 19:42:11 nsh Exp $ * * i2c tv tuner chip device driver * controls the philips tda8290+75 tuner chip combo. @@ -10,6 +10,9 @@ #include <linux/delay.h> #include <media/tuner.h> +#define I2C_ADDR_TDA8290 0x4b +#define I2C_ADDR_TDA8275 0x61 + /* ---------------------------------------------------------------------- */ struct freq_entry { @@ -76,10 +79,12 @@ static unsigned char i2c_init_tda8275[14] = { 0x00, 0x00, 0x00, 0x00, static unsigned char i2c_set_VS[2] = { 0x30, 0x6F }; static unsigned char i2c_set_GP01_CF[2] = { 0x20, 0x0B }; static unsigned char i2c_tda8290_reset[2] = { 0x00, 0x00 }; +static unsigned char i2c_tda8290_standby[2] = { 0x00, 0x02 }; static unsigned char i2c_gainset_off[2] = { 0x28, 0x14 }; static unsigned char i2c_gainset_on[2] = { 0x28, 0x54 }; static unsigned char i2c_agc3_00[2] = { 0x80, 0x00 }; static unsigned char i2c_agc2_BF[2] = { 0x60, 0xBF }; +static unsigned char i2c_cb1_D0[2] = { 0x30, 0xD0 }; static unsigned char i2c_cb1_D2[2] = { 0x30, 0xD2 }; static unsigned char i2c_cb1_56[2] = { 0x30, 0x56 }; static unsigned char i2c_cb1_52[2] = { 0x30, 0x52 }; @@ -118,6 +123,13 @@ static struct i2c_msg i2c_msg_epilog[] = { { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_gainset_on), i2c_gainset_on }, }; +static struct i2c_msg i2c_msg_standby[] = { + { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_enable_bridge), i2c_enable_bridge }, + { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_cb1_D0), i2c_cb1_D0 }, + { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_disable_bridge), i2c_disable_bridge }, + { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_tda8290_standby), i2c_tda8290_standby }, +}; + static int tda8290_tune(struct i2c_client *c) { struct tuner *t = i2c_get_clientdata(c); @@ -206,6 +218,11 @@ static int has_signal(struct i2c_client *c) return (afc & 0x80)? 65535:0; } +static void standby(struct i2c_client *c) +{ + i2c_transfer(c->adapter, i2c_msg_standby, ARRAY_SIZE(i2c_msg_standby)); +} + int tda8290_init(struct i2c_client *c) { struct tuner *t = i2c_get_clientdata(c); @@ -215,6 +232,7 @@ int tda8290_init(struct i2c_client *c) t->tv_freq = set_tv_freq; t->radio_freq = set_radio_freq; t->has_signal = has_signal; + t->standby = standby; i2c_master_send(c, i2c_enable_bridge, ARRAY_SIZE(i2c_enable_bridge)); i2c_transfer(c->adapter, i2c_msg_init, ARRAY_SIZE(i2c_msg_init)); diff --git a/linux/drivers/media/video/tda9887.c b/linux/drivers/media/video/tda9887.c index 881c82423..dd791ef8a 100644 --- a/linux/drivers/media/video/tda9887.c +++ b/linux/drivers/media/video/tda9887.c @@ -61,7 +61,7 @@ MODULE_LICENSE("GPL"); struct tda9887 { struct i2c_client client; v4l2_std_id std; - unsigned int radio; + enum tuner_mode mode; unsigned int config; unsigned int pinnacle_id; unsigned int using_v4l2; @@ -376,7 +376,7 @@ static int tda9887_set_tvnorm(struct tda9887 *t, char *buf) struct tvnorm *norm = NULL; int i; - if (t->radio) { + if (t->mode == T_RADIO) { if (t->radio_mode == V4L2_TUNER_MODE_MONO) norm = &radio_mono; else @@ -390,9 +390,7 @@ static int tda9887_set_tvnorm(struct tda9887 *t, char *buf) } } if (NULL == norm) { - /* FIXME: it is using a side effect to mute tuner instead of T_STANDBY */ dprintk(PREFIX "Unsupported tvnorm entry - audio muted\n"); - buf[1] |= cForcedMuteAudioON; return -1; } @@ -582,6 +580,10 @@ static int tda9887_configure(struct tda9887 *t) } tda9887_set_config(t,buf); tda9887_set_insmod(t,buf); + + if (t->mode == T_STANDBY) { + buf[1] |= cForcedMuteAudioON; + } #if 0 /* This as-is breaks some cards, must be fixed in a @@ -687,10 +689,17 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) /* --- configuration --- */ case AUDC_SET_RADIO: - t->radio = 1; + { + t->mode = T_RADIO; tda9887_configure(t); break; - + } + case TUNER_SET_STANDBY: + { + t->mode = T_STANDBY; + tda9887_configure(t); + break; + } case AUDC_CONFIG_PINNACLE: { int *i = arg; @@ -723,7 +732,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) struct video_channel *vc = arg; CHECK_V4L2; - t->radio = 0; + t->mode = T_ANALOG_TV; if (vc->norm < ARRAY_SIZE(map)) t->std = map[vc->norm]; tda9887_fixup_std(t); @@ -735,7 +744,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) v4l2_std_id *id = arg; SWITCH_V4L2; - t->radio = 0; + t->mode = T_ANALOG_TV; t->std = *id; tda9887_fixup_std(t); tda9887_configure(t); @@ -747,14 +756,14 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) SWITCH_V4L2; if (V4L2_TUNER_ANALOG_TV == f->type) { - if (t->radio == 0) + if (t->mode == T_ANALOG_TV) return 0; - t->radio = 0; + t->mode = T_ANALOG_TV; } if (V4L2_TUNER_RADIO == f->type) { - if (t->radio == 1) + if (t->mode == T_RADIO) return 0; - t->radio = 1; + t->mode = T_RADIO; } tda9887_configure(t); break; @@ -769,7 +778,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) }; struct v4l2_tuner* tuner = arg; - if (t->radio) { + if (t->mode == T_RADIO) { __u8 reg = 0; tuner->afc=0; if (1 == i2c_master_recv(&t->client,®,1)) @@ -781,7 +790,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) { struct v4l2_tuner* tuner = arg; - if (t->radio) { + if (t->mode == T_RADIO) { t->radio_mode = tuner->audmode; tda9887_configure (t); } diff --git a/linux/drivers/media/video/tea5767.c b/linux/drivers/media/video/tea5767.c index 4327d50be..a8c23b0a8 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.28 2005/08/01 02:58:21 mchehab Exp $ + * $Id: tea5767.c,v 1.29 2005/08/17 19:42:11 nsh Exp $ * * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br) * This code is placed under the terms of the GNU General Public License @@ -206,11 +206,6 @@ static void set_radio_freq(struct i2c_client *c, unsigned int frq) TEA5767_ST_NOISE_CTL | TEA5767_JAPAN_BAND; buffer[4] = 0; - if (t->mode == T_STANDBY) { - tuner_dbg("TEA5767 set to standby mode\n"); - buffer[3] |= TEA5767_STDBY; - } - if (t->audmode == V4L2_TUNER_MODE_MONO) { tuner_dbg("TEA5767 set to mono\n"); buffer[2] |= TEA5767_MONO; @@ -291,6 +286,24 @@ static int tea5767_stereo(struct i2c_client *c) return ((buffer[2] & TEA5767_STEREO_MASK) ? V4L2_TUNER_SUB_STEREO : 0); } +static void tea5767_standby(struct i2c_client *c) +{ + unsigned char buffer[5]; + struct tuner *t = i2c_get_clientdata(c); + unsigned div, rc; + + div = (87500 * 4 + 700 + 225 + 25) / 50; /* Set frequency to 87.5 MHz */ + buffer[0] = (div >> 8) & 0x3f; + buffer[1] = div & 0xff; + buffer[2] = TEA5767_PORT1_HIGH; + buffer[3] = TEA5767_PORT2_HIGH | TEA5767_HIGH_CUT_CTRL | + TEA5767_ST_NOISE_CTL | TEA5767_JAPAN_BAND | TEA5767_STDBY; + buffer[4] = 0; + + if (5 != (rc = i2c_master_send(c, buffer, 5))) + tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc); +} + int tea5767_autodetection(struct i2c_client *c) { unsigned char buffer[7] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; @@ -375,6 +388,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->standby = tea5767_standby; return (0); } diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c index cc24d246c..314229b0f 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.66 2005/08/07 09:24:08 mkrufky Exp $ + * $Id: tuner-core.c,v 1.67 2005/08/17 19:42:11 nsh Exp $ * * i2c tv tuner chip device driver * core core, i.e. kernel interfaces, registering and so on @@ -226,31 +226,31 @@ static void set_addr(struct i2c_client *c, struct tuner_setup *tun_setup) { struct tuner *t = i2c_get_clientdata(c); - if (tun_setup->addr == ADDR_UNSET) { - if (t->mode_mask & tun_setup->mode_mask) + if ((tun_setup->addr == ADDR_UNSET && + (t->mode_mask & tun_setup->mode_mask)) || + tun_setup->addr == c->addr) { set_type(c, tun_setup->type, tun_setup->mode_mask); - } else if (tun_setup->addr == c->addr) { - set_type(c, tun_setup->type, tun_setup->mode_mask); } } static inline int check_mode(struct tuner *t, char *cmd) { - if (1 << t->mode & t->mode_mask) { - switch (t->mode) { - case V4L2_TUNER_RADIO: - tuner_dbg("Cmd %s accepted for radio\n", cmd); - break; - case V4L2_TUNER_ANALOG_TV: - tuner_dbg("Cmd %s accepted for analog TV\n", cmd); - break; - case V4L2_TUNER_DIGITAL_TV: - tuner_dbg("Cmd %s accepted for digital TV\n", cmd); - break; - } - return 0; + if ((1 << t->mode & t->mode_mask) == 0) { + return EINVAL; + } + + switch (t->mode) { + case V4L2_TUNER_RADIO: + tuner_dbg("Cmd %s accepted for radio\n", cmd); + break; + case V4L2_TUNER_ANALOG_TV: + tuner_dbg("Cmd %s accepted for analog TV\n", cmd); + break; + case V4L2_TUNER_DIGITAL_TV: + tuner_dbg("Cmd %s accepted for digital TV\n", cmd); + break; } - return EINVAL; + return 0; } static char pal[] = "-"; @@ -424,20 +424,18 @@ static int tuner_detach(struct i2c_client *client) static inline int set_mode(struct i2c_client *client, struct tuner *t, int mode, char *cmd) { - if (mode != t->mode) { - - t->mode = mode; - if (check_mode(t, cmd) == EINVAL) { - t->mode = T_STANDBY; - if (V4L2_TUNER_RADIO == mode) { - set_tv_freq(client, 400 * 16); - } else { - set_radio_freq(client, 87.5 * 16000); - } - return EINVAL; - } - } - return 0; + if (mode == t->mode) + return 0; + + t->mode = mode; + + if (check_mode(t, cmd) == EINVAL) { + t->mode = T_STANDBY; + if (t->standby) + t->standby (client); + return EINVAL; + } + return 0; } #define switch_v4l2() if (!t->using_v4l2) \ @@ -471,6 +469,14 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) case AUDC_SET_RADIO: set_mode(client,t,V4L2_TUNER_RADIO, "AUDC_SET_RADIO"); break; + case TUNER_SET_STANDBY: + { + if (check_mode(t, "TUNER_SET_STANDBY") == EINVAL) + return 0; + if (t->standby) + t->standby (client); + break; + } case AUDC_CONFIG_PINNACLE: if (check_mode(t, "AUDC_CONFIG_PINNACLE") == EINVAL) return 0; diff --git a/linux/drivers/media/video/tuner-simple.c b/linux/drivers/media/video/tuner-simple.c index 0c4e72dfe..41ba7ad46 100644 --- a/linux/drivers/media/video/tuner-simple.c +++ b/linux/drivers/media/video/tuner-simple.c @@ -1,5 +1,5 @@ /* - * $Id: tuner-simple.c,v 1.44 2005/08/04 04:01:28 nsh Exp $ + * $Id: tuner-simple.c,v 1.45 2005/08/17 19:42:11 nsh Exp $ * * i2c tv tuner chip device driver * controls all those simple 4-control-bytes style tuners. @@ -515,6 +515,7 @@ int default_tuner_init(struct i2c_client *c) t->radio_freq = default_set_radio_freq; t->has_signal = tuner_signal; t->is_stereo = tuner_stereo; + t->standby = NULL; return 0; } diff --git a/linux/include/media/tuner.h b/linux/include/media/tuner.h index 14d46c2ac..268ed8bd5 100644 --- a/linux/include/media/tuner.h +++ b/linux/include/media/tuner.h @@ -1,5 +1,5 @@ -/* $Id: tuner.h,v 1.46 2005/08/04 04:01:28 nsh Exp $ +/* $Id: tuner.h,v 1.47 2005/08/17 19:42:11 nsh Exp $ * tuner.h - definition for different tuners @@ -136,6 +136,7 @@ #define THOMSON 12 #define TUNER_SET_TYPE_ADDR _IOW('T',3,int) +#define TUNER_SET_STANDBY _IOW('T',4,int) #define TDA9887_SET_CONFIG _IOW('t',5,int) /* tv card specific */ @@ -155,9 +156,6 @@ #ifdef __KERNEL__ -#define I2C_ADDR_TDA8290 0x4b -#define I2C_ADDR_TDA8275 0x61 - enum tuner_mode { T_UNINITIALIZED = 0, T_RADIO = 1 << V4L2_TUNER_RADIO, @@ -200,6 +198,7 @@ struct tuner { void (*radio_freq)(struct i2c_client *c, unsigned int freq); int (*has_signal)(struct i2c_client *c); int (*is_stereo)(struct i2c_client *c); + void (*standby)(struct i2c_client *c); }; extern unsigned int tuner_debug; diff --git a/v4l/ChangeLog b/v4l/ChangeLog index bca3c5bc3..fda54eb12 100644 --- a/v4l/ChangeLog +++ b/v4l/ChangeLog @@ -1,3 +1,23 @@ +2005-08-17 19:40 nsh + + * cx88-dvb.c: (lgdt330x_pll_set): + * cx88-video.c: (video_release): + * mt20xx.c: (microtune_init): + * saa7134-video.c: (video_release): + * tda8290.c: (standby), (tda8290_init): + * tda9887.c: (tda9887_set_tvnorm), (tda9887_configure), + (tda9887_command): + * tea5767.c: (set_radio_freq), (tea5767_standby), + (tea5767_tuner_init): + * tuner-core.c: (set_addr), (check_mode), (set_mode), + (tuner_command): + * tuner-simple.c: (default_tuner_init): + * tuner.h: + + - New tuner standby API. + + Signed-off-by: Nickolay V. Shmyrev <nshmyrev@yandex.ru> + 2005-08-17 09:58 mchehab *cx88-reg.h: |