diff options
author | istvan_v@mailbox.hu <istvan_v@mailbox.hu> | 2011-06-06 12:03:44 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-07-27 16:52:40 -0400 |
commit | 8edeb6eb1ae113b8f25a79e5076c1a1ec93538d0 (patch) | |
tree | eb69cbd55c98ec646fce3055f0265517efecef53 /drivers | |
parent | 09f4634293f2d48a9619f51b104bef8e6cc6d559 (diff) |
[media] xc4000: removed card_type
Removed the use of 'card_type' from the tuner configuration structure, and
replaced it with separate parameters to set board-specific configuration.
Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
Cc: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/common/tuners/xc4000.c | 75 | ||||
-rw-r--r-- | drivers/media/common/tuners/xc4000.h | 14 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dib0700_devices.c | 8 | ||||
-rw-r--r-- | drivers/media/video/tuner-core.c | 8 |
4 files changed, 55 insertions, 50 deletions
diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index a053dece60c..479c198e946 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c | |||
@@ -92,14 +92,16 @@ struct xc4000_priv { | |||
92 | struct list_head hybrid_tuner_instance_list; | 92 | struct list_head hybrid_tuner_instance_list; |
93 | struct firmware_description *firm; | 93 | struct firmware_description *firm; |
94 | int firm_size; | 94 | int firm_size; |
95 | __u16 firm_version; | ||
96 | u32 if_khz; | 95 | u32 if_khz; |
97 | u32 freq_hz; | 96 | u32 freq_hz; |
98 | u32 bandwidth; | 97 | u32 bandwidth; |
99 | u8 video_standard; | 98 | u8 video_standard; |
100 | u8 rf_mode; | 99 | u8 rf_mode; |
101 | u8 card_type; | 100 | u8 default_pm; |
101 | u8 dvb_amplitude; | ||
102 | u8 set_smoothedcvbs; | ||
102 | u8 ignore_i2c_write_errors; | 103 | u8 ignore_i2c_write_errors; |
104 | __u16 firm_version; | ||
103 | struct firmware_properties cur_fw; | 105 | struct firmware_properties cur_fw; |
104 | __u16 hwmodel; | 106 | __u16 hwmodel; |
105 | __u16 hwvers; | 107 | __u16 hwvers; |
@@ -1226,19 +1228,22 @@ static int xc4000_set_params(struct dvb_frontend *fe, | |||
1226 | } | 1228 | } |
1227 | } | 1229 | } |
1228 | 1230 | ||
1229 | if (priv->card_type == XC4000_CARD_WINFAST_CX88) { | 1231 | if (xc_write_reg(priv, XREG_D_CODE, 0) == 0) |
1230 | if (xc_write_reg(priv, XREG_D_CODE, 0) == 0) | 1232 | ret = 0; |
1231 | ret = 0; | 1233 | if (priv->dvb_amplitude != 0) { |
1232 | if (xc_write_reg(priv, XREG_AMPLITUDE, | 1234 | if (xc_write_reg(priv, XREG_AMPLITUDE, |
1233 | (priv->firm_version == 0x0102 ? 132 : 134)) | 1235 | (priv->firm_version != 0x0102 || |
1234 | != 0) | 1236 | priv->dvb_amplitude != 134 ? |
1237 | priv->dvb_amplitude : 132)) != 0) | ||
1235 | ret = -EREMOTEIO; | 1238 | ret = -EREMOTEIO; |
1239 | } | ||
1240 | if (priv->set_smoothedcvbs != 0) { | ||
1236 | if (xc_write_reg(priv, XREG_SMOOTHEDCVBS, 1) != 0) | 1241 | if (xc_write_reg(priv, XREG_SMOOTHEDCVBS, 1) != 0) |
1237 | ret = -EREMOTEIO; | 1242 | ret = -EREMOTEIO; |
1238 | if (ret != 0) { | 1243 | } |
1239 | printk(KERN_ERR "xc4000: setting registers failed\n"); | 1244 | if (ret != 0) { |
1240 | /* goto fail; */ | 1245 | printk(KERN_ERR "xc4000: setting registers failed\n"); |
1241 | } | 1246 | /* goto fail; */ |
1242 | } | 1247 | } |
1243 | 1248 | ||
1244 | xc_tune_channel(priv, priv->freq_hz); | 1249 | xc_tune_channel(priv, priv->freq_hz); |
@@ -1412,8 +1417,7 @@ tune_channel: | |||
1412 | if (type & NOGD) | 1417 | if (type & NOGD) |
1413 | video_mode &= 0xFF7F; | 1418 | video_mode &= 0xFF7F; |
1414 | } else if (priv->video_standard < XC4000_I_PAL_NICAM) { | 1419 | } else if (priv->video_standard < XC4000_I_PAL_NICAM) { |
1415 | if (priv->card_type == XC4000_CARD_WINFAST_CX88 && | 1420 | if (priv->firm_version == 0x0102) |
1416 | priv->firm_version == 0x0102) | ||
1417 | video_mode &= 0xFEFF; | 1421 | video_mode &= 0xFEFF; |
1418 | if (audio_std & XC4000_AUDIO_STD_B) | 1422 | if (audio_std & XC4000_AUDIO_STD_B) |
1419 | video_mode |= 0x0080; | 1423 | video_mode |= 0x0080; |
@@ -1425,17 +1429,17 @@ tune_channel: | |||
1425 | } | 1429 | } |
1426 | } | 1430 | } |
1427 | 1431 | ||
1428 | if (priv->card_type == XC4000_CARD_WINFAST_CX88) { | 1432 | if (xc_write_reg(priv, XREG_D_CODE, 0) == 0) |
1429 | if (xc_write_reg(priv, XREG_D_CODE, 0) == 0) | 1433 | ret = 0; |
1430 | ret = 0; | 1434 | if (xc_write_reg(priv, XREG_AMPLITUDE, 1) != 0) |
1431 | if (xc_write_reg(priv, XREG_AMPLITUDE, 1) != 0) | 1435 | ret = -EREMOTEIO; |
1432 | ret = -EREMOTEIO; | 1436 | if (priv->set_smoothedcvbs != 0) { |
1433 | if (xc_write_reg(priv, XREG_SMOOTHEDCVBS, 1) != 0) | 1437 | if (xc_write_reg(priv, XREG_SMOOTHEDCVBS, 1) != 0) |
1434 | ret = -EREMOTEIO; | 1438 | ret = -EREMOTEIO; |
1435 | if (ret != 0) { | 1439 | } |
1436 | printk(KERN_ERR "xc4000: setting registers failed\n"); | 1440 | if (ret != 0) { |
1437 | goto fail; | 1441 | printk(KERN_ERR "xc4000: setting registers failed\n"); |
1438 | } | 1442 | goto fail; |
1439 | } | 1443 | } |
1440 | 1444 | ||
1441 | xc_tune_channel(priv, priv->freq_hz); | 1445 | xc_tune_channel(priv, priv->freq_hz); |
@@ -1516,8 +1520,7 @@ static int xc4000_sleep(struct dvb_frontend *fe) | |||
1516 | 1520 | ||
1517 | /* Avoid firmware reload on slow devices */ | 1521 | /* Avoid firmware reload on slow devices */ |
1518 | if ((no_poweroff == 2 || | 1522 | if ((no_poweroff == 2 || |
1519 | (no_poweroff == 0 && | 1523 | (no_poweroff == 0 && priv->default_pm != 0)) && |
1520 | priv->card_type != XC4000_CARD_WINFAST_CX88)) && | ||
1521 | (priv->cur_fw.type & BASE) != 0) { | 1524 | (priv->cur_fw.type & BASE) != 0) { |
1522 | /* force reset and firmware reload */ | 1525 | /* force reset and firmware reload */ |
1523 | priv->cur_fw.type = XC_POWERED_DOWN; | 1526 | priv->cur_fw.type = XC_POWERED_DOWN; |
@@ -1588,16 +1591,6 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, | |||
1588 | int instance; | 1591 | int instance; |
1589 | u16 id = 0; | 1592 | u16 id = 0; |
1590 | 1593 | ||
1591 | if (cfg->card_type != XC4000_CARD_GENERIC) { | ||
1592 | if (cfg->card_type == XC4000_CARD_WINFAST_CX88) { | ||
1593 | cfg->i2c_address = 0x61; | ||
1594 | cfg->if_khz = 4560; | ||
1595 | } else { /* default to PCTV 340E */ | ||
1596 | cfg->i2c_address = 0x61; | ||
1597 | cfg->if_khz = 5400; | ||
1598 | } | ||
1599 | } | ||
1600 | |||
1601 | dprintk(1, "%s(%d-%04x)\n", __func__, | 1594 | dprintk(1, "%s(%d-%04x)\n", __func__, |
1602 | i2c ? i2c_adapter_id(i2c) : -1, | 1595 | i2c ? i2c_adapter_id(i2c) : -1, |
1603 | cfg ? cfg->i2c_address : -1); | 1596 | cfg ? cfg->i2c_address : -1); |
@@ -1607,8 +1600,6 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, | |||
1607 | instance = hybrid_tuner_request_state(struct xc4000_priv, priv, | 1600 | instance = hybrid_tuner_request_state(struct xc4000_priv, priv, |
1608 | hybrid_tuner_instance_list, | 1601 | hybrid_tuner_instance_list, |
1609 | i2c, cfg->i2c_address, "xc4000"); | 1602 | i2c, cfg->i2c_address, "xc4000"); |
1610 | if (cfg->card_type != XC4000_CARD_GENERIC) | ||
1611 | priv->card_type = cfg->card_type; | ||
1612 | switch (instance) { | 1603 | switch (instance) { |
1613 | case 0: | 1604 | case 0: |
1614 | goto fail; | 1605 | goto fail; |
@@ -1616,6 +1607,11 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, | |||
1616 | case 1: | 1607 | case 1: |
1617 | /* new tuner instance */ | 1608 | /* new tuner instance */ |
1618 | priv->bandwidth = BANDWIDTH_6_MHZ; | 1609 | priv->bandwidth = BANDWIDTH_6_MHZ; |
1610 | /* set default configuration */ | ||
1611 | priv->if_khz = 4560; | ||
1612 | priv->default_pm = 0; | ||
1613 | priv->dvb_amplitude = 134; | ||
1614 | priv->set_smoothedcvbs = 1; | ||
1619 | mutex_init(&priv->lock); | 1615 | mutex_init(&priv->lock); |
1620 | fe->tuner_priv = priv; | 1616 | fe->tuner_priv = priv; |
1621 | break; | 1617 | break; |
@@ -1626,10 +1622,11 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, | |||
1626 | } | 1622 | } |
1627 | 1623 | ||
1628 | if (cfg->if_khz != 0) { | 1624 | if (cfg->if_khz != 0) { |
1629 | /* If the IF hasn't been set yet, use the value provided by | 1625 | /* copy configuration if provided by the caller */ |
1630 | the caller (occurs in hybrid devices where the analog | ||
1631 | call to xc4000_attach occurs before the digital side) */ | ||
1632 | priv->if_khz = cfg->if_khz; | 1626 | priv->if_khz = cfg->if_khz; |
1627 | priv->default_pm = cfg->default_pm; | ||
1628 | priv->dvb_amplitude = cfg->dvb_amplitude; | ||
1629 | priv->set_smoothedcvbs = cfg->set_smoothedcvbs; | ||
1633 | } | 1630 | } |
1634 | 1631 | ||
1635 | /* Check if firmware has been loaded. It is possible that another | 1632 | /* Check if firmware has been loaded. It is possible that another |
diff --git a/drivers/media/common/tuners/xc4000.h b/drivers/media/common/tuners/xc4000.h index d560d01cc82..442cb0fc933 100644 --- a/drivers/media/common/tuners/xc4000.h +++ b/drivers/media/common/tuners/xc4000.h | |||
@@ -27,13 +27,15 @@ | |||
27 | struct dvb_frontend; | 27 | struct dvb_frontend; |
28 | struct i2c_adapter; | 28 | struct i2c_adapter; |
29 | 29 | ||
30 | #define XC4000_CARD_GENERIC 0 | ||
31 | #define XC4000_CARD_PCTV_340E 1 | ||
32 | #define XC4000_CARD_WINFAST_CX88 2 | ||
33 | |||
34 | struct xc4000_config { | 30 | struct xc4000_config { |
35 | u8 card_type; /* if card type is not generic, all other */ | 31 | u8 i2c_address; |
36 | u8 i2c_address; /* parameters are automatically set */ | 32 | /* if non-zero, power management is enabled by default */ |
33 | u8 default_pm; | ||
34 | /* value to be written to XREG_AMPLITUDE in DVB-T mode (0: no write) */ | ||
35 | u8 dvb_amplitude; | ||
36 | /* if non-zero, register 0x0E is set to filter analog TV video output */ | ||
37 | u8 set_smoothedcvbs; | ||
38 | /* IF for DVB-T */ | ||
37 | u32 if_khz; | 39 | u32 if_khz; |
38 | }; | 40 | }; |
39 | 41 | ||
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index d546270d3f5..ae0abc5dcf9 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c | |||
@@ -2778,10 +2778,12 @@ static int pctv340e_frontend_attach(struct dvb_usb_adapter *adap) | |||
2778 | return adap->fe == NULL ? -ENODEV : 0; | 2778 | return adap->fe == NULL ? -ENODEV : 0; |
2779 | } | 2779 | } |
2780 | 2780 | ||
2781 | |||
2782 | static struct xc4000_config dib7000p_xc4000_tunerconfig = { | 2781 | static struct xc4000_config dib7000p_xc4000_tunerconfig = { |
2783 | .i2c_address = 0x61, | 2782 | .i2c_address = 0x61, |
2784 | .if_khz = 5400, | 2783 | .default_pm = 1, |
2784 | .dvb_amplitude = 0, | ||
2785 | .set_smoothedcvbs = 0, | ||
2786 | .if_khz = 5400 | ||
2785 | }; | 2787 | }; |
2786 | 2788 | ||
2787 | static int xc4000_tuner_attach(struct dvb_usb_adapter *adap) | 2789 | static int xc4000_tuner_attach(struct dvb_usb_adapter *adap) |
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 850b45d042f..11cc980b0cd 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -396,8 +396,12 @@ static void set_type(struct i2c_client *c, unsigned int type, | |||
396 | { | 396 | { |
397 | struct xc4000_config xc4000_cfg = { | 397 | struct xc4000_config xc4000_cfg = { |
398 | .i2c_address = t->i2c->addr, | 398 | .i2c_address = t->i2c->addr, |
399 | /* if_khz will be set when the digital dvb_attach() occurs */ | 399 | /* FIXME: the correct parameters will be set */ |
400 | .if_khz = 0, | 400 | /* only when the digital dvb_attach() occurs */ |
401 | .default_pm = 0, | ||
402 | .dvb_amplitude = 0, | ||
403 | .set_smoothedcvbs = 0, | ||
404 | .if_khz = 0 | ||
401 | }; | 405 | }; |
402 | if (!dvb_attach(xc4000_attach, | 406 | if (!dvb_attach(xc4000_attach, |
403 | &t->fe, t->i2c->adapter, &xc4000_cfg)) | 407 | &t->fe, t->i2c->adapter, &xc4000_cfg)) |