From: Istvan Varga Date: Fri, 3 Jun 2011 12:38:04 +0000 (-0300) Subject: [media] xc4000: added card_type X-Git-Tag: MMI-PSA29.97-13-9~18729^2~360 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0b4021321c0536a3368746497686ce56e5bcf3e5;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git [media] xc4000: added card_type This patch adds support for selecting a card type in struct xc4000_config, to allow for implementing some card specific code in the driver. Signed-off-by: Istvan Varga Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 71739dc33438..0afb61f8eae5 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c @@ -90,6 +90,7 @@ struct xc4000_priv { u32 bandwidth; u8 video_standard; u8 rf_mode; + u8 card_type; u8 ignore_i2c_write_errors; /* struct xc2028_ctrl ctrl; */ struct firmware_properties cur_fw; @@ -1433,6 +1434,16 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, int instance; u16 id = 0; + if (cfg->card_type != XC4000_CARD_GENERIC) { + if (cfg->card_type == XC4000_CARD_WINFAST_CX88) { + cfg->i2c_address = 0x61; + cfg->if_khz = 4560; + } else { /* default to PCTV 340E */ + cfg->i2c_address = 0x61; + cfg->if_khz = 5400; + } + } + dprintk(1, "%s(%d-%04x)\n", __func__, i2c ? i2c_adapter_id(i2c) : -1, cfg ? cfg->i2c_address : -1); @@ -1442,6 +1453,8 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, instance = hybrid_tuner_request_state(struct xc4000_priv, priv, hybrid_tuner_instance_list, i2c, cfg->i2c_address, "xc4000"); + if (cfg->card_type != XC4000_CARD_GENERIC) + priv->card_type = cfg->card_type; switch (instance) { case 0: goto fail; @@ -1458,7 +1471,7 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, break; } - if (priv->if_khz == 0) { + if (cfg->if_khz != 0) { /* If the IF hasn't been set yet, use the value provided by the caller (occurs in hybrid devices where the analog call to xc4000_attach occurs before the digital side) */ diff --git a/drivers/media/common/tuners/xc4000.h b/drivers/media/common/tuners/xc4000.h index 3881ba26b794..d560d01cc82b 100644 --- a/drivers/media/common/tuners/xc4000.h +++ b/drivers/media/common/tuners/xc4000.h @@ -27,8 +27,13 @@ struct dvb_frontend; struct i2c_adapter; +#define XC4000_CARD_GENERIC 0 +#define XC4000_CARD_PCTV_340E 1 +#define XC4000_CARD_WINFAST_CX88 2 + struct xc4000_config { - u8 i2c_address; + u8 card_type; /* if card type is not generic, all other */ + u8 i2c_address; /* parameters are automatically set */ u32 if_khz; };