diff options
author | Gerd Knorr <devnull@localhost> | 2005-02-09 19:27:21 +0000 |
---|---|---|
committer | Gerd Knorr <devnull@localhost> | 2005-02-09 19:27:21 +0000 |
commit | a57f1dd6d13a9b061984fe1621703da7ae99090d (patch) | |
tree | 2599ac5eb9411b6573213c22407fcf583ac4f769 /linux/drivers | |
parent | d88c7c9e5a9181439bd0facde6802a881acd5442 (diff) | |
download | mediapointer-dvb-s2-a57f1dd6d13a9b061984fe1621703da7ae99090d.tar.gz mediapointer-dvb-s2-a57f1dd6d13a9b061984fe1621703da7ae99090d.tar.bz2 |
- make the new splitted tuner module build.
Diffstat (limited to 'linux/drivers')
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-input.c | 4 | ||||
-rw-r--r-- | linux/drivers/media/video/mt20xx.c | 29 | ||||
-rw-r--r-- | linux/drivers/media/video/tda8290.c | 164 | ||||
-rw-r--r-- | linux/drivers/media/video/tuner-core.c | 30 | ||||
-rw-r--r-- | linux/drivers/media/video/tuner-simple.c | 7 |
5 files changed, 100 insertions, 134 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-input.c b/linux/drivers/media/video/cx88/cx88-input.c index 0570cebe8..d6266e51a 100644 --- a/linux/drivers/media/video/cx88/cx88-input.c +++ b/linux/drivers/media/video/cx88/cx88-input.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-input.c,v 1.5 2005/01/31 11:35:05 kraxel Exp $ + * $Id: cx88-input.c,v 1.6 2005/02/09 19:27:21 kraxel Exp $ * * Device driver for GPIO attached remote control interfaces * on Conexant 2388x based TV/DVB cards. @@ -95,8 +95,10 @@ static IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE] = { [ 0x1f ] = KEY_EXIT, // back/exit [ 0x20 ] = KEY_CHANNELUP, // channel / program + [ 0x21 ] = KEY_CHANNELDOWN, // channel / program - + [ 0x22 ] = KEY_CHANNEL, // source (old black remote) [ 0x24 ] = KEY_PREVIOUS, // replay |< [ 0x25 ] = KEY_ENTER, // OK + [ 0x26 ] = KEY_SLEEP, // minimize (old black remote) [ 0x29 ] = KEY_BLUE, // blue key [ 0x2e ] = KEY_GREEN, // green button [ 0x30 ] = KEY_PAUSE, // pause diff --git a/linux/drivers/media/video/mt20xx.c b/linux/drivers/media/video/mt20xx.c index c505b33af..4e66135d1 100644 --- a/linux/drivers/media/video/mt20xx.c +++ b/linux/drivers/media/video/mt20xx.c @@ -1,5 +1,8 @@ /* - * $Id: mt20xx.c,v 1.1 2005/02/09 15:42:46 kraxel Exp $ + * $Id: mt20xx.c,v 1.2 2005/02/09 19:27:21 kraxel Exp $ + * + * i2c tv tuner chip device driver + * controls microtune tuners, mt2032 + mt2050 at the moment. */ #include <linux/delay.h> #include <linux/i2c.h> @@ -149,13 +152,13 @@ static int mt2032_check_lo_lock(struct i2c_client *c) buf[0]=0x0e; i2c_master_send(c,buf,1); i2c_master_recv(c,buf,1); - dprintk("mt2032 Reg.E=0x%02x\n",buf[0]); + printk("mt2032 Reg.E=0x%02x\n",buf[0]); lock=buf[0] &0x06; if (lock==6) break; - dprintk("mt2032: pll wait 1ms for lock (0x%2x)\n",buf[0]); + printk("mt2032: pll wait 1ms for lock (0x%2x)\n",buf[0]); udelay(1000); } return lock; @@ -169,7 +172,7 @@ static int mt2032_optimize_vco(struct i2c_client *c,int sel,int lock) buf[0]=0x0f; i2c_master_send(c,buf,1); i2c_master_recv(c,buf,1); - dprintk("mt2032 Reg.F=0x%02x\n",buf[0]); + printk("mt2032 Reg.F=0x%02x\n",buf[0]); tad1=buf[0]&0x07; if(tad1 ==0) return lock; @@ -187,7 +190,7 @@ static int mt2032_optimize_vco(struct i2c_client *c,int sel,int lock) return lock; } - dprintk("mt2032 optimize_vco: sel=%d\n",sel); + printk("mt2032 optimize_vco: sel=%d\n",sel); buf[0]=0x0f; buf[1]=sel; @@ -205,7 +208,7 @@ static void mt2032_set_if_freq(struct i2c_client *c, unsigned int rfin, int lint_try,ret,sel,lock=0; struct tuner *t = i2c_get_clientdata(c); - dprintk("mt2032_set_if_freq rfin=%d if1=%d if2=%d from=%d to=%d\n",rfin,if1,if2,from,to); + printk("mt2032_set_if_freq rfin=%d if1=%d if2=%d from=%d to=%d\n",rfin,if1,if2,from,to); buf[0]=0; ret=i2c_master_send(c,buf,1); @@ -315,17 +318,17 @@ static int mt2032_init(struct i2c_client *c) // Adjust XOGC (register 7), wait for XOK xogc=7; do { - dprintk("mt2032: xogc = 0x%02x\n",xogc&0x07); + printk("mt2032: xogc = 0x%02x\n",xogc&0x07); mdelay(10); buf[0]=0x0e; i2c_master_send(c,buf,1); i2c_master_recv(c,buf,1); xok=buf[0]&0x01; - dprintk("mt2032: xok = 0x%02x\n",xok); + printk("mt2032: xok = 0x%02x\n",xok); if (xok == 1) break; xogc--; - dprintk("mt2032: xogc = 0x%02x\n",xogc&0x07); + printk("mt2032: xogc = 0x%02x\n",xogc&0x07); if (xogc == 3) { xogc=4; // min. 4 per spec break; @@ -351,7 +354,7 @@ static void mt2050_set_antenna(struct i2c_client *c, unsigned char antenna) buf[0] = 6; buf[1] = antenna ? 0x11 : 0x10; ret=i2c_master_send(c,buf,2); - dprintk("mt2050: enabled antenna connector %d\n", antenna); + printk("mt2050: enabled antenna connector %d\n", antenna); } static void mt2050_set_if_freq(struct i2c_client *c,unsigned int freq, unsigned int if2) @@ -361,8 +364,8 @@ static void mt2050_set_if_freq(struct i2c_client *c,unsigned int freq, unsigned int ret; unsigned char buf[6]; - dprintk("mt2050_set_if_freq freq=%d if1=%d if2=%d\n", - freq,if1,if2); + printk("mt2050_set_if_freq freq=%d if1=%d if2=%d\n", + freq,if1,if2); f_lo1=freq+if1; f_lo1=(f_lo1/1000000)*1000000; @@ -462,7 +465,7 @@ static int mt2050_init(struct i2c_client *c) ret=i2c_master_send(c,buf,1); i2c_master_recv(c,buf,1); - dprintk("mt2050: sro is %x\n",buf[0]); + printk("mt2050: sro is %x\n",buf[0]); t->tv_freq = mt2050_set_tv_freq; t->radio_freq = mt2050_set_radio_freq; return 0; diff --git a/linux/drivers/media/video/tda8290.c b/linux/drivers/media/video/tda8290.c index 898ac62e5..6c54d9e82 100644 --- a/linux/drivers/media/video/tda8290.c +++ b/linux/drivers/media/video/tda8290.c @@ -1,5 +1,8 @@ /* - * $Id: tda8290.c,v 1.1 2005/02/09 15:42:46 kraxel Exp $ + * $Id: tda8290.c,v 1.2 2005/02/09 19:27:21 kraxel Exp $ + * + * i2c tv tuner chip device driver + * controls the philips tda8290+75 tuner chip combo. */ #include <linux/i2c.h> #include <linux/videodev.h> @@ -8,9 +11,12 @@ /* ---------------------------------------------------------------------- */ +#define I2C_ADDR_TDA8290 0x4b +#define I2C_ADDR_TDA8275 0x61 + struct freq_entry { - __u16 freq; - __u8 value; + u16 freq; + u8 value; }; static struct freq_entry band_table[] = { @@ -71,12 +77,9 @@ static unsigned char i2c_init_tda8275[14] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x40 }; static unsigned char i2c_set_VS[2] = { 0x30, 0x6F }; static unsigned char i2c_set_GP01_CF[2] = { 0x20, 0x0B }; -static unsigned char i2c_easy_mode[2] = { 0x01, 0x02 }; static unsigned char i2c_tda8290_reset[2] = { 0x00, 0x00 }; static unsigned char i2c_gainset_off[2] = { 0x28, 0x14 }; static unsigned char i2c_gainset_on[2] = { 0x28, 0x54 }; -static unsigned char i2c_set_freq[8] = { 0x00, 0x00, 0x00, 0x40, - 0x52, 0x00, 0x00, 0x8F }; static unsigned char i2c_agc3_00[2] = { 0x80, 0x00 }; static unsigned char i2c_agc2_BF[2] = { 0x60, 0xBF }; static unsigned char i2c_cb1_D2[2] = { 0x30, 0xD2 }; @@ -94,14 +97,14 @@ static struct i2c_msg i2c_msg_init[] = { }; static struct i2c_msg i2c_msg_prolog[] = { - { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_easy_mode), i2c_easy_mode }, +// { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_easy_mode), i2c_easy_mode }, { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_gainset_off), i2c_gainset_off }, { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_tda8290_reset), i2c_tda8290_reset }, { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_enable_bridge), i2c_enable_bridge }, }; static struct i2c_msg i2c_msg_config[] = { - { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_set_freq), i2c_set_freq }, +// { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_set_freq), i2c_set_freq }, { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_agc3_00), i2c_agc3_00 }, { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_agc2_BF), i2c_agc2_BF }, { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_cb1_D2), i2c_cb1_D2 }, @@ -117,26 +120,38 @@ static struct i2c_msg i2c_msg_epilog[] = { { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_gainset_on), i2c_gainset_on }, }; -static int tda8290_tune(void) +static int tda8290_tune(struct i2c_client *c) { - i2c_transfer(tda8290_client_template.adapter, i2c_msg_prolog, ARRAY_SIZE(i2c_msg_prolog)); - i2c_transfer(tda8290_client_template.adapter, i2c_msg_config, ARRAY_SIZE(i2c_msg_config)); - msleep(550); - i2c_transfer(tda8290_client_template.adapter, i2c_msg_epilog, ARRAY_SIZE(i2c_msg_epilog)); + struct tuner *t = i2c_get_clientdata(c); + struct i2c_msg easy_mode = + { I2C_ADDR_TDA8290, 0, 2, t->i2c_easy_mode }; + struct i2c_msg set_freq = + { I2C_ADDR_TDA8290, 0, 8, t->i2c_set_freq }; + + i2c_transfer(c->adapter, &easy_mode, 1); + i2c_transfer(c->adapter, i2c_msg_prolog, ARRAY_SIZE(i2c_msg_prolog)); + + i2c_transfer(c->adapter, &set_freq, 1); + i2c_transfer(c->adapter, i2c_msg_config, ARRAY_SIZE(i2c_msg_config)); + msleep(550); + i2c_transfer(c->adapter, i2c_msg_epilog, ARRAY_SIZE(i2c_msg_epilog)); return 0; } -static void set_frequency(struct tuner *t, u32 frequency, u16 ifc) +static void set_frequency(struct tuner *t, u16 ifc) { - u32 N = (((frequency<<3)+ifc)&0x3fffc); - - N = N >> get_freq_entry(div_table, frequency); - - i2c_set_freq[1] = (unsigned char)(N>>8); - i2c_set_freq[2] = (unsigned char) N; - i2c_set_freq[5] = get_freq_entry(band_table, frequency); - i2c_set_freq[6] = get_freq_entry(agc_table, frequency); + u32 N = (((t->freq<<3)+ifc)&0x3fffc); + + N = N >> get_freq_entry(div_table, t->freq); + t->i2c_set_freq[0] = 0; + t->i2c_set_freq[1] = (unsigned char)(N>>8); + t->i2c_set_freq[2] = (unsigned char) N; + t->i2c_set_freq[0] = 0x40; + t->i2c_set_freq[0] = 0x52; + t->i2c_set_freq[5] = get_freq_entry(band_table, t->freq); + t->i2c_set_freq[6] = get_freq_entry(agc_table, t->freq); + t->i2c_set_freq[0] = 0x8f; } #define V4L2_STD_MN (V4L2_STD_PAL_M|V4L2_STD_PAL_N|V4L2_STD_PAL_Nc|V4L2_STD_NTSC) @@ -146,18 +161,20 @@ static void set_frequency(struct tuner *t, u32 frequency, u16 ifc) static void set_audio(struct tuner *t) { + t->i2c_easy_mode[0] = 0x01; + if (t->std & V4L2_STD_MN) - i2c_easy_mode[1] = 0x01; + t->i2c_easy_mode[1] = 0x01; else if (t->std & V4L2_STD_B) - i2c_easy_mode[1] = 0x02; + t->i2c_easy_mode[1] = 0x02; else if (t->std & V4L2_STD_GH) - i2c_easy_mode[1] = 0x04; + t->i2c_easy_mode[1] = 0x04; else if (t->std & V4L2_STD_PAL_I) - i2c_easy_mode[1] = 0x08; + t->i2c_easy_mode[1] = 0x08; else if (t->std & V4L2_STD_DK) - i2c_easy_mode[1] = 0x10; + t->i2c_easy_mode[1] = 0x10; else if (t->std & V4L2_STD_SECAM_L) - i2c_easy_mode[1] = 0x20; + t->i2c_easy_mode[1] = 0x20; } static void set_tv_freq(struct i2c_client *c, unsigned int freq) @@ -165,18 +182,28 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq) struct tuner *t = i2c_get_clientdata(c); set_audio(t); - set_frequency(t, f->frequency, 864); - tda8290_tune(); + set_frequency(t, 864); + tda8290_tune(c); } static void set_radio_freq(struct i2c_client *c, unsigned int freq) { struct tuner *t = i2c_get_clientdata(c); - set_frequency(t, f->frequency, 704); - tda8290_tune(); + set_frequency(t, 704); + tda8290_tune(c); } -int default_tuner_init(struct i2c_client *c) +static int has_signal(struct i2c_client *c) +{ + unsigned char i2c_get_afc[1] = { 0x1B }; + unsigned char afc = 0; + + i2c_master_send(c, i2c_get_afc, ARRAY_SIZE(i2c_get_afc)); + i2c_master_recv(c, &afc, 1); + return (afc & 0x80)? 65535:0; +} + +int tda8290_init(struct i2c_client *c) { struct tuner *t = i2c_get_clientdata(c); @@ -184,77 +211,13 @@ int default_tuner_init(struct i2c_client *c) printk("tuner: type set to %s\n", c->name); t->tv_freq = set_tv_freq; t->radio_freq = set_radio_freq; - return 0; -} - -/* ----------------------------------------------------------------------- */ - -#if 0 - -static int tda8290_command(struct i2c_client *client, unsigned int cmd, void *arg) -{ - if( client->addr == I2C_ADDR_TDA8275) - return 0; - - switch (cmd) { - /* --- v4l ioctls --- */ - case VIDIOC_G_TUNER: - { - struct v4l2_tuner* t = arg; - - if (t->type == V4L2_TUNER_ANALOG_TV) - { - unsigned char afc = 0; - unsigned char i2c_get_afc[1] = { 0x1B }; - - i2c_master_send(&tda8290_client_template, i2c_get_afc, ARRAY_SIZE(i2c_get_afc)); - i2c_master_recv(&tda8290_client_template, &afc, 1); - - t->signal = (afc & 0x80)? 65535:0; - t->afc = -((((char)(afc<<1))*3375)>>9); - } - return 0; - } - } - - return -EINVAL; -} - -static int tda8290_attach(struct i2c_adapter *adap, int addr, int kind) -{ - printk("%s: chip found @ 0x%x\n", __FUNCTION__, addr); - - switch(addr) - { - case I2C_ADDR_TDA8290: - { - tda8290_client_template.adapter = adap; - tda8290_client_template.addr = addr; - - i2c_attach_client(&tda8290_client_template); - - i2c_master_send(&tda8290_client_template, i2c_enable_bridge, ARRAY_SIZE(i2c_enable_bridge)); - } break; - - case I2C_ADDR_TDA8275: - { - tda8275_client_template.adapter = adap; - tda8275_client_template.addr = addr; - - i2c_attach_client(&tda8275_client_template); - - i2c_transfer(tda8290_client_template.adapter, i2c_msg_init, ARRAY_SIZE(i2c_msg_init)); - } break; - - default: - return -EINVAL; - } + t->has_signal = has_signal; + i2c_master_send(c, i2c_enable_bridge, ARRAY_SIZE(i2c_enable_bridge)); + i2c_transfer(c->adapter, i2c_msg_init, ARRAY_SIZE(i2c_msg_init)); return 0; } -#endif - /* * Overrides for Emacs so that we follow Linus's tabbing style. * --------------------------------------------------------------------------- @@ -262,4 +225,3 @@ static int tda8290_attach(struct i2c_adapter *adap, int addr, int kind) * c-basic-offset: 8 * End: */ - diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c index f20e7b912..0fdc2fcf6 100644 --- a/linux/drivers/media/video/tuner-core.c +++ b/linux/drivers/media/video/tuner-core.c @@ -1,5 +1,8 @@ /* - * $Id: tuner-core.c,v 1.1 2005/02/09 15:42:46 kraxel Exp $ + * $Id: tuner-core.c,v 1.2 2005/02/09 19:27:21 kraxel Exp $ + * + * i2c tv tuner chip device driver + * core core, i.e. kernel interfaces, registering and so on */ #include <linux/module.h> @@ -242,9 +245,6 @@ static int tuner_detach(struct i2c_client *client) i2c_detach_client(client); kfree(t); kfree(client); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) - MOD_DEC_USE_COUNT; -#endif return 0; } @@ -323,10 +323,8 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) struct video_tuner *vt = arg; CHECK_V4L2; -#if 0 - if (V4L2_TUNER_RADIO == t->mode) - vt->signal = tuner_signal(client); -#endif + if (V4L2_TUNER_RADIO == t->mode && t->has_signal) + vt->signal = t->has_signal(client); return 0; } case VIDIOCGAUDIO: @@ -334,10 +332,10 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) struct video_audio *va = arg; CHECK_V4L2; -#if 0 - if (V4L2_TUNER_RADIO == t->mode) - va->mode = (tuner_stereo(client) ? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO); -#endif + if (V4L2_TUNER_RADIO == t->mode && t->is_stereo) + va->mode = t->is_stereo(client) + ? VIDEO_SOUND_STEREO + : VIDEO_SOUND_MONO; return 0; } @@ -371,10 +369,8 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) struct v4l2_tuner *tuner = arg; SWITCH_V4L2; -#if 0 - if (V4L2_TUNER_RADIO == t->mode) - tuner->signal = tuner_signal(client); -#endif + if (V4L2_TUNER_RADIO == t->mode && t->has_signal) + tuner->signal = t->has_signal(client); break; } default: @@ -406,9 +402,7 @@ static int tuner_resume(struct device * dev, u32 level) /* ----------------------------------------------------------------------- */ static struct i2c_driver driver = { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,54) .owner = THIS_MODULE, -#endif .name = "i2c TV tuner driver", .id = I2C_DRIVERID_TUNER, .flags = I2C_DF_NOTIFY, diff --git a/linux/drivers/media/video/tuner-simple.c b/linux/drivers/media/video/tuner-simple.c index afa89e8d1..231f709d7 100644 --- a/linux/drivers/media/video/tuner-simple.c +++ b/linux/drivers/media/video/tuner-simple.c @@ -1,5 +1,8 @@ /* - * $Id: tuner-simple.c,v 1.1 2005/02/09 15:42:46 kraxel Exp $ + * $Id: tuner-simple.c,v 1.2 2005/02/09 19:27:21 kraxel Exp $ + * + * i2c tv tuner chip device driver + * controls all those simple 4-control-bytes style tuners. */ #include <linux/delay.h> #include <linux/i2c.h> @@ -455,6 +458,8 @@ int default_tuner_init(struct i2c_client *c) t->tv_freq = default_set_tv_freq; t->radio_freq = default_set_radio_freq; + t->has_signal = tuner_signal; + t->is_stereo = tuner_stereo; return 0; } |