diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-12-11 11:56:04 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-12-11 11:56:04 -0200 |
commit | 6ddc0844c5e7e40b765d290ac06a93b12eda4e8b (patch) | |
tree | 0b9b10c2e844ce202209a198f45276bd8ebd6bca /linux | |
parent | cdd8a614f8de70d50a815bad283ceab2bfe9a625 (diff) | |
parent | ca436a99a3cc379dbd8d76c612f54971220a7ff5 (diff) | |
download | mediapointer-dvb-s2-6ddc0844c5e7e40b765d290ac06a93b12eda4e8b.tar.gz mediapointer-dvb-s2-6ddc0844c5e7e40b765d290ac06a93b12eda4e8b.tar.bz2 |
merge: http://linuxtv.org/hg/~mkrufky/tuner
From: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux')
-rw-r--r-- | linux/drivers/media/video/tda8290.c | 181 | ||||
-rw-r--r-- | linux/drivers/media/video/tda8290.h | 23 | ||||
-rw-r--r-- | linux/drivers/media/video/tda9887.c | 10 | ||||
-rw-r--r-- | linux/drivers/media/video/tuner-core.c | 93 | ||||
-rw-r--r-- | linux/drivers/media/video/tuner-driver.h | 36 | ||||
-rw-r--r-- | linux/drivers/media/video/tuner-i2c.h | 2 | ||||
-rw-r--r-- | linux/include/media/tuner.h | 2 |
7 files changed, 189 insertions, 158 deletions
diff --git a/linux/drivers/media/video/tda8290.c b/linux/drivers/media/video/tda8290.c index b6fdc01eb..de663918a 100644 --- a/linux/drivers/media/video/tda8290.c +++ b/linux/drivers/media/video/tda8290.c @@ -24,6 +24,8 @@ #include <linux/delay.h> #include "compat.h" #include <linux/videodev.h> +#include "tuner-driver.h" +#include "tuner-i2c.h" #include "tda8290.h" #include "tda827x.h" #include "tda18271.h" @@ -31,13 +33,8 @@ #include "i2c-compat.h" #endif -#if 0 -static int debug = 0; +static int debug; module_param(debug, int, 0644); -#else -static int tuner_debug; -module_param_named(debug, tuner_debug, int, 0644); -#endif MODULE_PARM_DESC(debug, "enable verbose debug messages"); #define PREFIX "tda8290" @@ -59,8 +56,6 @@ struct tda8290_priv { #define TDA18271 16 struct tda827x_config cfg; - - struct tuner *t; }; /*---------------------------------------------------------------------*/ @@ -141,31 +136,31 @@ static int tda8295_i2c_bridge(struct dvb_frontend *fe, int close) /*---------------------------------------------------------------------*/ -static void set_audio(struct dvb_frontend *fe) +static void set_audio(struct dvb_frontend *fe, + struct analog_parameters *params) { struct tda8290_priv *priv = fe->analog_demod_priv; - struct tuner *t = priv->t; char* mode; - if (t->std & V4L2_STD_MN) { + if (params->std & V4L2_STD_MN) { priv->tda8290_easy_mode = 0x01; mode = "MN"; - } else if (t->std & V4L2_STD_B) { + } else if (params->std & V4L2_STD_B) { priv->tda8290_easy_mode = 0x02; mode = "B"; - } else if (t->std & V4L2_STD_GH) { + } else if (params->std & V4L2_STD_GH) { priv->tda8290_easy_mode = 0x04; mode = "GH"; - } else if (t->std & V4L2_STD_PAL_I) { + } else if (params->std & V4L2_STD_PAL_I) { priv->tda8290_easy_mode = 0x08; mode = "I"; - } else if (t->std & V4L2_STD_DK) { + } else if (params->std & V4L2_STD_DK) { priv->tda8290_easy_mode = 0x10; mode = "DK"; - } else if (t->std & V4L2_STD_SECAM_L) { + } else if (params->std & V4L2_STD_SECAM_L) { priv->tda8290_easy_mode = 0x20; mode = "L"; - } else if (t->std & V4L2_STD_SECAM_LC) { + } else if (params->std & V4L2_STD_SECAM_LC) { priv->tda8290_easy_mode = 0x40; mode = "LC"; } else { @@ -176,10 +171,10 @@ static void set_audio(struct dvb_frontend *fe) tuner_dbg("setting tda829x to system %s\n", mode); } -static void tda8290_set_freq(struct dvb_frontend *fe, unsigned int freq) +static void tda8290_set_params(struct dvb_frontend *fe, + struct analog_parameters *params) { struct tda8290_priv *priv = fe->analog_demod_priv; - struct tuner *t = priv->t; unsigned char soft_reset[] = { 0x00, 0x00 }; unsigned char easy_mode[] = { 0x01, priv->tda8290_easy_mode }; @@ -203,16 +198,10 @@ static void tda8290_set_freq(struct dvb_frontend *fe, unsigned int freq) pll_stat; int i; - struct analog_parameters params = { - .frequency = freq, - .mode = t->mode, - .audmode = t->audmode, - .std = t->std - }; - - set_audio(fe); + set_audio(fe, params); - tuner_dbg("tda827xa config is 0x%02x\n", t->config); + if (priv->cfg.config) + tuner_dbg("tda827xa config is 0x%02x\n", *priv->cfg.config); tuner_i2c_xfer_send(&priv->i2c_props, easy_mode, 2); tuner_i2c_xfer_send(&priv->i2c_props, agc_out_on, 2); tuner_i2c_xfer_send(&priv->i2c_props, soft_reset, 2); @@ -231,7 +220,7 @@ static void tda8290_set_freq(struct dvb_frontend *fe, unsigned int freq) tda8290_i2c_bridge(fe, 1); if (fe->ops.tuner_ops.set_analog_params) - fe->ops.tuner_ops.set_analog_params(fe, ¶ms); + fe->ops.tuner_ops.set_analog_params(fe, params); for (i = 0; i < 3; i++) { tuner_i2c_xfer_send(&priv->i2c_props, &addr_pll_stat, 1); @@ -394,23 +383,16 @@ static int tda8295_has_signal(struct dvb_frontend *fe) /*---------------------------------------------------------------------*/ -static void tda8295_set_freq(struct dvb_frontend *fe, unsigned int freq) +static void tda8295_set_params(struct dvb_frontend *fe, + struct analog_parameters *params) { struct tda8290_priv *priv = fe->analog_demod_priv; - struct tuner *t = priv->t; unsigned char blanking_mode[] = { 0x1d, 0x00 }; - struct analog_parameters params = { - .frequency = freq, - .mode = t->mode, - .audmode = t->audmode, - .std = t->std - }; - - set_audio(fe); + set_audio(fe, params); - tuner_dbg("%s: freq = %d\n", __FUNCTION__, freq); + tuner_dbg("%s: freq = %d\n", __FUNCTION__, params->frequency); tda8295_power(fe, 1); tda8295_agc1_out(fe, 1); @@ -427,7 +409,7 @@ static void tda8295_set_freq(struct dvb_frontend *fe, unsigned int freq) tda8295_i2c_bridge(fe, 1); if (fe->ops.tuner_ops.set_analog_params) - fe->ops.tuner_ops.set_analog_params(fe, ¶ms); + fe->ops.tuner_ops.set_analog_params(fe, params); if (priv->cfg.agcf) priv->cfg.agcf(fe); @@ -484,13 +466,13 @@ static void tda8295_standby(struct dvb_frontend *fe) static void tda8290_init_if(struct dvb_frontend *fe) { struct tda8290_priv *priv = fe->analog_demod_priv; - struct tuner *t = priv->t; unsigned char set_VS[] = { 0x30, 0x6F }; unsigned char set_GP00_CF[] = { 0x20, 0x01 }; unsigned char set_GP01_CF[] = { 0x20, 0x0B }; - if ((t->config == 1) || (t->config == 2)) + if ((priv->cfg.config) && + ((*priv->cfg.config == 1) || (*priv->cfg.config == 2))) tuner_i2c_xfer_send(&priv->i2c_props, set_GP00_CF, 2); else tuner_i2c_xfer_send(&priv->i2c_props, set_GP01_CF, 2); @@ -558,7 +540,6 @@ static int tda829x_find_tuner(struct dvb_frontend *fe) { struct tda8290_priv *priv = fe->analog_demod_priv; struct analog_tuner_ops *ops = fe->ops.analog_demod_ops; - struct tuner *t = priv->t; int i, ret, tuners_found; u32 tuner_addrs; u8 data; @@ -618,7 +599,7 @@ static int tda829x_find_tuner(struct dvb_frontend *fe) if (data == 0x83) { priv->ver |= TDA18271; - tda18271_attach(&t->fe, priv->tda827x_addr, + tda18271_attach(fe, priv->tda827x_addr, priv->i2c_props.adap); } else { if ((data & 0x3c) == 0) @@ -626,40 +607,17 @@ static int tda829x_find_tuner(struct dvb_frontend *fe) else priv->ver |= TDA8275A; - tda827x_attach(&t->fe, priv->tda827x_addr, + tda827x_attach(fe, priv->tda827x_addr, priv->i2c_props.adap, &priv->cfg); } - if (t->fe.ops.tuner_ops.init) - t->fe.ops.tuner_ops.init(&t->fe); + if (fe->ops.tuner_ops.init) + fe->ops.tuner_ops.init(fe); - if (t->fe.ops.tuner_ops.sleep) - t->fe.ops.tuner_ops.sleep(&t->fe); + if (fe->ops.tuner_ops.sleep) + fe->ops.tuner_ops.sleep(fe); ops->i2c_gate_ctrl(fe, 0); - switch (priv->ver) { - case TDA8290 | TDA8275: - strlcpy(t->i2c->name, "tda8290+75", sizeof(t->i2c->name)); - break; - case TDA8295 | TDA8275: - strlcpy(t->i2c->name, "tda8295+75", sizeof(t->i2c->name)); - break; - case TDA8290 | TDA8275A: - strlcpy(t->i2c->name, "tda8290+75a", sizeof(t->i2c->name)); - break; - case TDA8295 | TDA8275A: - strlcpy(t->i2c->name, "tda8295+75a", sizeof(t->i2c->name)); - break; - case TDA8290 | TDA18271: - strlcpy(t->i2c->name, "tda8290+18271", sizeof(t->i2c->name)); - break; - case TDA8295 | TDA18271: - strlcpy(t->i2c->name, "tda8295+18271", sizeof(t->i2c->name)); - break; - default: - return -EINVAL; - } - return 0; } @@ -673,7 +631,7 @@ static int tda8290_probe(struct tuner_i2c_props *i2c_props) tuner_i2c_xfer_recv(i2c_props, &tda8290_id[1], 1); if (tda8290_id[1] == TDA8290_ID) { - if (tuner_debug) + if (debug) printk(KERN_DEBUG "%s: tda8290 detected @ %d-%04x\n", __FUNCTION__, i2c_adapter_id(i2c_props->adap), i2c_props->addr); @@ -693,7 +651,7 @@ static int tda8295_probe(struct tuner_i2c_props *i2c_props) tuner_i2c_xfer_recv(i2c_props, &tda8295_id[1], 1); if (tda8295_id[1] == TDA8295_ID) { - if (tuner_debug) + if (debug) printk(KERN_DEBUG "%s: tda8295 detected @ %d-%04x\n", __FUNCTION__, i2c_adapter_id(i2c_props->adap), i2c_props->addr); @@ -704,8 +662,10 @@ static int tda8295_probe(struct tuner_i2c_props *i2c_props) } static struct analog_tuner_ops tda8290_tuner_ops = { - .set_tv_freq = tda8290_set_freq, - .set_radio_freq = tda8290_set_freq, + .info = { + .name = "TDA8290", + }, + .set_params = tda8290_set_params, .has_signal = tda8290_has_signal, .standby = tda8290_standby, .release = tda829x_release, @@ -713,29 +673,34 @@ static struct analog_tuner_ops tda8290_tuner_ops = { }; static struct analog_tuner_ops tda8295_tuner_ops = { - .set_tv_freq = tda8295_set_freq, - .set_radio_freq = tda8295_set_freq, + .info = { + .name = "TDA8295", + }, + .set_params = tda8295_set_params, .has_signal = tda8295_has_signal, .standby = tda8295_standby, .release = tda829x_release, .i2c_gate_ctrl = tda8295_i2c_bridge, }; -int tda829x_attach(struct tuner *t) +struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe, + struct i2c_adapter *i2c_adap, u8 i2c_addr, + struct tda829x_config *cfg) { - struct dvb_frontend *fe = &t->fe; struct tda8290_priv *priv = NULL; + char *name; priv = kzalloc(sizeof(struct tda8290_priv), GFP_KERNEL); if (priv == NULL) - return -ENOMEM; + return NULL; fe->analog_demod_priv = priv; - priv->i2c_props.addr = t->i2c->addr; - priv->i2c_props.adap = t->i2c->adapter; - priv->cfg.config = &t->config; - priv->cfg.tuner_callback = t->tuner_callback; - priv->t = t; + priv->i2c_props.addr = i2c_addr; + priv->i2c_props.adap = i2c_adap; + if (cfg) { + priv->cfg.config = cfg->lna_cfg; + priv->cfg.tuner_callback = cfg->tuner_callback; + } if (tda8290_probe(&priv->i2c_props) == 0) { priv->ver = TDA8290; @@ -748,7 +713,31 @@ int tda829x_attach(struct tuner *t) } if (tda829x_find_tuner(fe) < 0) - return -EINVAL; + goto fail; + + switch (priv->ver) { + case TDA8290 | TDA8275: + name = "tda8290+75"; + break; + case TDA8295 | TDA8275: + name = "tda8295+75"; + break; + case TDA8290 | TDA8275A: + name = "tda8290+75a"; + break; + case TDA8295 | TDA8275A: + name = "tda8295+75a"; + break; + case TDA8290 | TDA18271: + name = "tda8290+18271"; + break; + case TDA8295 | TDA18271: + name = "tda8295+18271"; + break; + default: + goto fail; + } + tuner_info("type set to %s\n", name); if (priv->ver & TDA8290) { tda8290_init_tuner(fe); @@ -756,19 +745,23 @@ int tda829x_attach(struct tuner *t) } else if (priv->ver & TDA8295) tda8295_init_if(fe); - tuner_info("type set to %s\n", t->i2c->name); - +#if 0 t->mode = V4L2_TUNER_ANALOG_TV; +#endif + return fe; - return 0; +fail: + tda829x_release(fe); + fe->ops.analog_demod_ops = NULL; + return NULL; } EXPORT_SYMBOL_GPL(tda829x_attach); -int tda829x_probe(struct tuner *t) +int tda829x_probe(struct i2c_adapter *i2c_adap, u8 i2c_addr) { struct tuner_i2c_props i2c_props = { - .adap = t->i2c->adapter, - .addr = t->i2c->addr + .adap = i2c_adap, + .addr = i2c_addr, }; unsigned char soft_reset[] = { 0x00, 0x00 }; diff --git a/linux/drivers/media/video/tda8290.h b/linux/drivers/media/video/tda8290.h index 3a1f04520..7bce03183 100644 --- a/linux/drivers/media/video/tda8290.h +++ b/linux/drivers/media/video/tda8290.h @@ -18,24 +18,35 @@ #define __TDA8290_H__ #include <linux/i2c.h> -#include "tuner-driver.h" +#include "dvb_frontend.h" + +struct tda829x_config { + unsigned int *lna_cfg; + int (*tuner_callback) (void *dev, int command, int arg); +}; #if defined(CONFIG_TUNER_TDA8290) || (defined(CONFIG_TUNER_TDA8290_MODULE) && defined(MODULE)) -extern int tda829x_probe(struct tuner *t); +extern int tda829x_probe(struct i2c_adapter *i2c_adap, u8 i2c_addr); -extern int tda829x_attach(struct tuner *t); +extern struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe, + struct i2c_adapter *i2c_adap, + u8 i2c_addr, + struct tda829x_config *cfg); #else -static inline int tda829x_probe(struct tuner *t) +static inline int tda829x_probe(struct i2c_adapter *i2c_adap, u8 i2c_addr) { printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); return -EINVAL; } -static inline int tda829x_attach(struct tuner *t) +static inline struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe, + struct i2c_adapter *i2c_adap, + u8 i2c_addr, + struct tda829x_config *cfg) { printk(KERN_INFO "%s: not probed - driver disabled by Kconfig\n", __FUNCTION__); - return -EINVAL; + return NULL; } #endif diff --git a/linux/drivers/media/video/tda9887.c b/linux/drivers/media/video/tda9887.c index cefba2a14..bd4173e41 100644 --- a/linux/drivers/media/video/tda9887.c +++ b/linux/drivers/media/video/tda9887.c @@ -13,6 +13,7 @@ #endif #include <media/v4l2-common.h> #include <media/tuner.h> +#include "tuner-i2c.h" #include "tda9887.h" @@ -633,7 +634,8 @@ static void tda9887_standby(struct dvb_frontend *fe) tda9887_configure(fe); } -static void tda9887_set_freq(struct dvb_frontend *fe, unsigned int freq) +static void tda9887_set_params(struct dvb_frontend *fe, + struct analog_parameters *params) { tda9887_configure(fe); } @@ -645,8 +647,10 @@ static void tda9887_release(struct dvb_frontend *fe) } static struct analog_tuner_ops tda9887_tuner_ops = { - .set_tv_freq = tda9887_set_freq, - .set_radio_freq = tda9887_set_freq, + .info = { + .name = "TDA9887", + }, + .set_params = tda9887_set_params, .standby = tda9887_standby, .tuner_status = tda9887_tuner_status, .get_afc = tda9887_get_afc, diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c index 0b3bc1c91..479afb1f6 100644 --- a/linux/drivers/media/video/tuner-core.c +++ b/linux/drivers/media/video/tuner-core.c @@ -63,7 +63,34 @@ static unsigned int no_autodetect = 0; static unsigned int show_i2c = 0; /* insmod options used at runtime => read/write */ -int tuner_debug = 0; +static int tuner_debug; + +#define tuner_warn(fmt, arg...) do { \ + printk(KERN_WARNING "%s %d-%04x: " fmt, PREFIX, \ + i2c_adapter_id(t->i2c->adapter), \ + t->i2c->addr, ##arg); \ + } while (0) + +#define tuner_info(fmt, arg...) do { \ + printk(KERN_INFO "%s %d-%04x: " fmt, PREFIX, \ + i2c_adapter_id(t->i2c->adapter), \ + t->i2c->addr, ##arg); \ + } while (0) + +#define tuner_err(fmt, arg...) do { \ + printk(KERN_ERR "%s %d-%04x: " fmt, PREFIX, \ + i2c_adapter_id(t->i2c->adapter), \ + t->i2c->addr, ##arg); \ + } while (0) + +#define tuner_dbg(fmt, arg...) do { \ + if (tuner_debug) \ + printk(KERN_DEBUG "%s %d-%04x: " fmt, PREFIX, \ + i2c_adapter_id(t->i2c->adapter), \ + t->i2c->addr, ##arg); \ + } while (0) + +/* ------------------------------------------------------------------------ */ static unsigned int tv_range[2] = { 44, 958 }; static unsigned int radio_range[2] = { 65, 108 }; @@ -107,23 +134,17 @@ MODULE_LICENSE("GPL"); /* ---------------------------------------------------------------------- */ -static void fe_set_freq(struct dvb_frontend *fe, unsigned int freq) +static void fe_set_params(struct dvb_frontend *fe, + struct analog_parameters *params) { struct dvb_tuner_ops *fe_tuner_ops = &fe->ops.tuner_ops; struct tuner *t = fe->analog_demod_priv; - struct analog_parameters params = { - .frequency = freq, - .mode = t->mode, - .audmode = t->audmode, - .std = t->std - }; - if (NULL == fe_tuner_ops->set_analog_params) { tuner_warn("Tuner frontend module has no way to set freq\n"); return; } - fe_tuner_ops->set_analog_params(fe, ¶ms); + fe_tuner_ops->set_analog_params(fe, params); } static void fe_release(struct dvb_frontend *fe) @@ -165,8 +186,7 @@ static int fe_has_signal(struct dvb_frontend *fe) static void tuner_status(struct dvb_frontend *fe); static struct analog_tuner_ops tuner_core_ops = { - .set_tv_freq = fe_set_freq, - .set_radio_freq = fe_set_freq, + .set_params = fe_set_params, .standby = fe_standby, .release = fe_release, .has_signal = fe_has_signal, @@ -179,11 +199,17 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq) struct tuner *t = i2c_get_clientdata(c); struct analog_tuner_ops *ops = t->fe.ops.analog_demod_ops; + struct analog_parameters params = { + .mode = t->mode, + .audmode = t->audmode, + .std = t->std + }; + if (t->type == UNSET) { tuner_warn ("tuner type not set\n"); return; } - if ((NULL == ops) || (NULL == ops->set_tv_freq)) { + if ((NULL == ops) || (NULL == ops->set_params)) { tuner_warn ("Tuner has no way to set tv freq\n"); return; } @@ -198,7 +224,9 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq) else freq = tv_range[1] * 16; } - ops->set_tv_freq(&t->fe, freq); + params.frequency = freq; + + ops->set_params(&t->fe, ¶ms); } static void set_radio_freq(struct i2c_client *c, unsigned int freq) @@ -206,11 +234,17 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq) struct tuner *t = i2c_get_clientdata(c); struct analog_tuner_ops *ops = t->fe.ops.analog_demod_ops; + struct analog_parameters params = { + .mode = t->mode, + .audmode = t->audmode, + .std = t->std + }; + if (t->type == UNSET) { tuner_warn ("tuner type not set\n"); return; } - if ((NULL == ops) || (NULL == ops->set_radio_freq)) { + if ((NULL == ops) || (NULL == ops->set_params)) { tuner_warn ("tuner has no way to set radio frequency\n"); return; } @@ -225,8 +259,9 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq) else freq = radio_range[1] * 16000; } + params.frequency = freq; - ops->set_radio_freq(&t->fe, freq); + ops->set_params(&t->fe, ¶ms); } static void set_freq(struct i2c_client *c, unsigned long freq) @@ -282,6 +317,15 @@ static void attach_simple_tuner(struct tuner *t) simple_tuner_attach(&t->fe, t->i2c->adapter, t->i2c->addr, &cfg); } +static void attach_tda829x(struct tuner *t) +{ + struct tda829x_config cfg = { + .lna_cfg = &t->config, + .tuner_callback = t->tuner_callback, + }; + tda829x_attach(&t->fe, t->i2c->adapter, t->i2c->addr, &cfg); +} + static void set_type(struct i2c_client *c, unsigned int type, unsigned int new_mode_mask, unsigned int new_config, int (*tuner_callback) (void *dev, int command,int arg)) @@ -324,7 +368,7 @@ static void set_type(struct i2c_client *c, unsigned int type, break; case TUNER_PHILIPS_TDA8290: { - tda829x_attach(t); + attach_tda829x(t); break; } case TUNER_TEA5767: @@ -388,14 +432,16 @@ static void set_type(struct i2c_client *c, unsigned int type, ops = t->fe.ops.analog_demod_ops; - if (((NULL == ops) || - ((NULL == ops->set_tv_freq) && (NULL == ops->set_radio_freq))) && + if (((NULL == ops) || (NULL == ops->set_params)) && (fe_tuner_ops->set_analog_params)) { strlcpy(t->i2c->name, fe_tuner_ops->info.name, sizeof(t->i2c->name)); t->fe.ops.analog_demod_ops = &tuner_core_ops; t->fe.analog_demod_priv = t; + } else { + strlcpy(t->i2c->name, ops->info.name, + sizeof(t->i2c->name)); } tuner_dbg("type set to %s\n", t->i2c->name); @@ -1082,7 +1128,8 @@ static int tuner_probe(struct i2c_client *client) case 0x4b: /* If chip is not tda8290, don't register. since it can be tda9887*/ - if (tda829x_probe(t) == 0) { + if (tda829x_probe(t->i2c->adapter, + t->i2c->addr) == 0) { tuner_dbg("tda829x detected\n"); } else { /* Default is being tda9887 */ @@ -1135,11 +1182,11 @@ register_client: /* Sets a default mode */ if (t->mode_mask & T_ANALOG_TV) { - t->mode = T_ANALOG_TV; + t->mode = V4L2_TUNER_ANALOG_TV; } else if (t->mode_mask & T_RADIO) { - t->mode = T_RADIO; + t->mode = V4L2_TUNER_RADIO; } else { - t->mode = T_DIGITAL_TV; + t->mode = V4L2_TUNER_DIGITAL_TV; } set_type(client, t->type, t->mode_mask, t->config, t->tuner_callback); list_add_tail(&t->list, &tuner_list); diff --git a/linux/drivers/media/video/tuner-driver.h b/linux/drivers/media/video/tuner-driver.h index a4db32d97..65ced4350 100644 --- a/linux/drivers/media/video/tuner-driver.h +++ b/linux/drivers/media/video/tuner-driver.h @@ -24,16 +24,20 @@ #include <linux/videodev2.h> #include <linux/i2c.h> -#include "tuner-i2c.h" #include "dvb_frontend.h" extern unsigned const int tuner_count; -struct tuner; +struct analog_demod_info { + char *name; +}; struct analog_tuner_ops { - void (*set_tv_freq)(struct dvb_frontend *fe, unsigned int freq); - void (*set_radio_freq)(struct dvb_frontend *fe, unsigned int freq); + + struct analog_demod_info info; + + void (*set_params)(struct dvb_frontend *fe, + struct analog_parameters *params); int (*has_signal)(struct dvb_frontend *fe); int (*is_stereo)(struct dvb_frontend *fe); int (*get_afc)(struct dvb_frontend *fe); @@ -69,28 +73,4 @@ struct tuner { int (*tuner_callback) (void *dev, int command,int arg); }; -/* ------------------------------------------------------------------------ */ - -#define tuner_warn(fmt, arg...) do { \ - printk(KERN_WARNING "%s %d-%04x: " fmt, PREFIX, \ - i2c_adapter_id(t->i2c->adapter), t->i2c->addr, ##arg); \ - } while (0) - -#define tuner_info(fmt, arg...) do { \ - printk(KERN_INFO "%s %d-%04x: " fmt, PREFIX, \ - i2c_adapter_id(t->i2c->adapter), t->i2c->addr , ##arg); \ - } while (0) - -#define tuner_err(fmt, arg...) do { \ - printk(KERN_ERR "%s %d-%04x: " fmt, PREFIX, \ - i2c_adapter_id(t->i2c->adapter), t->i2c->addr , ##arg); \ - } while (0) - -#define tuner_dbg(fmt, arg...) do { \ - extern int tuner_debug; \ - if (tuner_debug) \ - printk(KERN_DEBUG "%s %d-%04x: " fmt, PREFIX, \ - i2c_adapter_id(t->i2c->adapter), t->i2c->addr , ##arg); \ - } while (0) - #endif /* __TUNER_DRIVER_H__ */ diff --git a/linux/drivers/media/video/tuner-i2c.h b/linux/drivers/media/video/tuner-i2c.h index d7cf72c3f..de52e8ffd 100644 --- a/linux/drivers/media/video/tuner-i2c.h +++ b/linux/drivers/media/video/tuner-i2c.h @@ -59,7 +59,6 @@ static inline int tuner_i2c_xfer_send_recv(struct tuner_i2c_props *props, return (ret == 2) ? ilen : ret; } -#ifndef __TUNER_DRIVER_H__ #define tuner_warn(fmt, arg...) do { \ printk(KERN_WARNING "%s %d-%04x: " fmt, PREFIX, \ i2c_adapter_id(priv->i2c_props.adap), \ @@ -84,6 +83,5 @@ static inline int tuner_i2c_xfer_send_recv(struct tuner_i2c_props *props, i2c_adapter_id(priv->i2c_props.adap), \ priv->i2c_props.addr , ##arg); \ } while (0) -#endif /* __TUNER_DRIVER_H__ */ #endif /* __TUNER_I2C_H__ */ diff --git a/linux/include/media/tuner.h b/linux/include/media/tuner.h index d49392d90..97be269af 100644 --- a/linux/include/media/tuner.h +++ b/linux/include/media/tuner.h @@ -24,8 +24,6 @@ #include <linux/videodev2.h> -extern int tuner_debug; - #define ADDR_UNSET (255) #define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */ |