aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-07-20 20:19:08 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-01-04 19:16:24 -0500
commita0813ea3409dadc294fedb033ec2c4be9ecba0d2 (patch)
tree0185614a84aad457be66b8e9f59249205a48ff52 /drivers/media/common
parentcfde89258a4bf2d9767113d97eed72317b610511 (diff)
[media] mt2063: Remove most of the #if's
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/common')
-rw-r--r--drivers/media/common/tuners/mt2063.c89
-rw-r--r--drivers/media/common/tuners/mt2063.h8
2 files changed, 4 insertions, 93 deletions
diff --git a/drivers/media/common/tuners/mt2063.c b/drivers/media/common/tuners/mt2063.c
index c8f0bfae95af..63d964ac13b6 100644
--- a/drivers/media/common/tuners/mt2063.c
+++ b/drivers/media/common/tuners/mt2063.c
@@ -247,16 +247,12 @@ u32 MT2063_WriteSub(void *hUserData,
247 */ 247 */
248/* return status; */ 248/* return status; */
249 249
250//#if !TUNER_CONTROL_BY_DRXK_DRIVER
251 fe->ops.i2c_gate_ctrl(fe, 1); //I2C bypass drxk3926 close i2c bridge 250 fe->ops.i2c_gate_ctrl(fe, 1); //I2C bypass drxk3926 close i2c bridge
252//#endif
253 251
254 if (mt2063_writeregs(state, subAddress, pData, cnt) < 0) { 252 if (mt2063_writeregs(state, subAddress, pData, cnt) < 0) {
255 status = MT2063_ERROR; 253 status = MT2063_ERROR;
256 } 254 }
257//#if !TUNER_CONTROL_BY_DRXK_DRIVER
258 fe->ops.i2c_gate_ctrl(fe, 0); //I2C bypass drxk3926 close i2c bridge 255 fe->ops.i2c_gate_ctrl(fe, 0); //I2C bypass drxk3926 close i2c bridge
259//#endif
260 256
261 return (status); 257 return (status);
262} 258}
@@ -314,9 +310,7 @@ u32 MT2063_ReadSub(void *hUserData,
314 struct dvb_frontend *fe = hUserData; 310 struct dvb_frontend *fe = hUserData;
315 struct mt2063_state *state = fe->tuner_priv; 311 struct mt2063_state *state = fe->tuner_priv;
316 u32 i = 0; 312 u32 i = 0;
317//#if !TUNER_CONTROL_BY_DRXK_DRIVER
318 fe->ops.i2c_gate_ctrl(fe, 1); //I2C bypass drxk3926 close i2c bridge 313 fe->ops.i2c_gate_ctrl(fe, 1); //I2C bypass drxk3926 close i2c bridge
319//#endif
320 314
321 for (i = 0; i < cnt; i++) { 315 for (i = 0; i < cnt; i++) {
322 if (mt2063_read_regs(state, subAddress + i, pData + i, 1) < 0) { 316 if (mt2063_read_regs(state, subAddress + i, pData + i, 1) < 0) {
@@ -325,9 +319,7 @@ u32 MT2063_ReadSub(void *hUserData,
325 } 319 }
326 } 320 }
327 321
328//#if !TUNER_CONTROL_BY_DRXK_DRIVER
329 fe->ops.i2c_gate_ctrl(fe, 0); //I2C bypass drxk3926 close i2c bridge 322 fe->ops.i2c_gate_ctrl(fe, 0); //I2C bypass drxk3926 close i2c bridge
330//#endif
331 323
332 return (status); 324 return (status);
333} 325}
@@ -364,8 +356,6 @@ void MT2063_Sleep(void *hUserData, u32 nMinDelayTime)
364 msleep(nMinDelayTime); 356 msleep(nMinDelayTime);
365} 357}
366 358
367#if defined(MT2060_CNT)
368#if MT2060_CNT > 0
369/***************************************************************************** 359/*****************************************************************************
370** 360**
371** Name: MT_TunerGain (MT2060 only) 361** Name: MT_TunerGain (MT2060 only)
@@ -407,8 +397,6 @@ u32 MT2060_TunerGain(void *hUserData, s32 * pMeas)
407 397
408 return (status); 398 return (status);
409} 399}
410#endif
411#endif
412//end of mt2063_userdef.c 400//end of mt2063_userdef.c
413//================================================================= 401//=================================================================
414//################################################################# 402//#################################################################
@@ -458,14 +446,6 @@ u32 MT2060_TunerGain(void *hUserData, s32 * pMeas)
458** 446**
459*****************************************************************************/ 447*****************************************************************************/
460 448
461#if !defined(MT2063_TUNER_CNT)
462#error MT2063_TUNER_CNT is not defined (see mt_userdef.h)
463#endif
464
465#if MT2063_TUNER_CNT == 0
466#error MT2063_TUNER_CNT must be updated in mt_userdef.h
467#endif
468
469/* Version of this module */ 449/* Version of this module */
470#define MT2063_SPUR_VERSION 10201 /* Version 01.21 */ 450#define MT2063_SPUR_VERSION 10201 /* Version 01.21 */
471 451
@@ -1437,17 +1417,6 @@ u32 MT2063_AvoidSpursVersion(void)
1437** If the version is different, an updated file is needed from Microtune 1417** If the version is different, an updated file is needed from Microtune
1438*/ 1418*/
1439/* Expecting version 1.21 of the Spur Avoidance API */ 1419/* Expecting version 1.21 of the Spur Avoidance API */
1440#define EXPECTED_MT2063_AVOID_SPURS_INFO_VERSION 010201
1441
1442#if MT2063_AVOID_SPURS_INFO_VERSION < EXPECTED_MT2063_AVOID_SPURS_INFO_VERSION
1443#error Contact Microtune for a newer version of MT_SpurAvoid.c
1444#elif MT2063_AVOID_SPURS_INFO_VERSION > EXPECTED_MT2063_AVOID_SPURS_INFO_VERSION
1445#error Contact Microtune for a newer version of mt2063.c
1446#endif
1447
1448#ifndef MT2063_CNT
1449#error You must define MT2063_CNT in the "mt_userdef.h" file
1450#endif
1451 1420
1452typedef enum { 1421typedef enum {
1453 MT2063_SET_ATTEN, 1422 MT2063_SET_ATTEN,
@@ -1493,9 +1462,9 @@ static const u32 MT2063_Num_Registers = MT2063_REG_END_REGS;
1493 1462
1494#define USE_GLOBAL_TUNER 0 1463#define USE_GLOBAL_TUNER 0
1495 1464
1496static u32 nMT2063MaxTuners = MT2063_CNT; 1465static u32 nMT2063MaxTuners = 1;
1497static struct MT2063_Info_t MT2063_Info[MT2063_CNT]; 1466static struct MT2063_Info_t MT2063_Info[1];
1498static struct MT2063_Info_t *MT2063_Avail[MT2063_CNT]; 1467static struct MT2063_Info_t *MT2063_Avail[1];
1499static u32 nMT2063OpenTuners = 0; 1468static u32 nMT2063OpenTuners = 0;
1500 1469
1501/* 1470/*
@@ -1591,51 +1560,6 @@ u32 MT2063_Open(u32 MT2063_Addr, void ** hMT2063, void *hUserData)
1591 1560
1592 /* Default tuner handle to NULL. If successful, it will be reassigned */ 1561 /* Default tuner handle to NULL. If successful, it will be reassigned */
1593 1562
1594#if USE_GLOBAL_TUNER
1595 *hMT2063 = NULL;
1596
1597 /*
1598 ** If this is our first tuner, initialize the address fields and
1599 ** the list of available control blocks.
1600 */
1601 if (nMT2063OpenTuners == 0) {
1602 for (i = MT2063_CNT - 1; i >= 0; i--) {
1603 MT2063_Info[i].handle = NULL;
1604 MT2063_Info[i].address = MAX_UDATA;
1605 MT2063_Info[i].rcvr_mode = MT2063_CABLE_QAM;
1606 MT2063_Info[i].hUserData = NULL;
1607 MT2063_Avail[i] = &MT2063_Info[i];
1608 }
1609 }
1610
1611 /*
1612 ** Look for an existing MT2063_State_t entry with this address.
1613 */
1614 for (i = MT2063_CNT - 1; i >= 0; i--) {
1615 /*
1616 ** If an open'ed handle provided, we'll re-initialize that structure.
1617 **
1618 ** We recognize an open tuner because the address and hUserData are
1619 ** the same as one that has already been opened
1620 */
1621 if ((MT2063_Info[i].address == MT2063_Addr) &&
1622 (MT2063_Info[i].hUserData == hUserData)) {
1623 pInfo = &MT2063_Info[i];
1624 break;
1625 }
1626 }
1627
1628 /* If not found, choose an empty spot. */
1629 if (pInfo == NULL) {
1630 /* Check to see that we're not over-allocating */
1631 if (nMT2063OpenTuners == MT2063_CNT) {
1632 return MT2063_TUNER_CNT_ERR;
1633 }
1634 /* Use the next available block from the list */
1635 pInfo = MT2063_Avail[nMT2063OpenTuners];
1636 nMT2063OpenTuners++;
1637 }
1638#else
1639 if (state->MT2063_init == false) { 1563 if (state->MT2063_init == false) {
1640 pInfo = kzalloc(sizeof(struct MT2063_Info_t), GFP_KERNEL); 1564 pInfo = kzalloc(sizeof(struct MT2063_Info_t), GFP_KERNEL);
1641 if (pInfo == NULL) { 1565 if (pInfo == NULL) {
@@ -1648,7 +1572,6 @@ u32 MT2063_Open(u32 MT2063_Addr, void ** hMT2063, void *hUserData)
1648 } else { 1572 } else {
1649 pInfo = *hMT2063; 1573 pInfo = *hMT2063;
1650 } 1574 }
1651#endif
1652 1575
1653 if (MT2063_NO_ERROR(status)) { 1576 if (MT2063_NO_ERROR(status)) {
1654 status |= MT2063_RegisterTuner(&pInfo->AS_Data); 1577 status |= MT2063_RegisterTuner(&pInfo->AS_Data);
@@ -1714,13 +1637,9 @@ u32 MT2063_Close(void *hMT2063)
1714 pInfo->handle = NULL; 1637 pInfo->handle = NULL;
1715 pInfo->address = MAX_UDATA; 1638 pInfo->address = MAX_UDATA;
1716 pInfo->hUserData = NULL; 1639 pInfo->hUserData = NULL;
1717#if USE_GLOBAL_TUNER
1718 nMT2063OpenTuners--;
1719 MT2063_Avail[nMT2063OpenTuners] = pInfo; /* Return control block to available list */
1720#else
1721 //kfree(pInfo); 1640 //kfree(pInfo);
1722 //pInfo = NULL; 1641 //pInfo = NULL;
1723#endif 1642
1724 return MT2063_OK; 1643 return MT2063_OK;
1725} 1644}
1726 1645
diff --git a/drivers/media/common/tuners/mt2063.h b/drivers/media/common/tuners/mt2063.h
index 7fb5b743d4d2..e2faff01bd42 100644
--- a/drivers/media/common/tuners/mt2063.h
+++ b/drivers/media/common/tuners/mt2063.h
@@ -81,7 +81,6 @@
81/* 81/*
82 * Data Types 82 * Data Types
83 */ 83 */
84#define MT2060_CNT 10
85 84
86#define MAX_UDATA (4294967295) /* max value storable in u32 */ 85#define MAX_UDATA (4294967295) /* max value storable in u32 */
87 86
@@ -96,11 +95,8 @@
96 * #define MT2121_CNT (3) 95 * #define MT2121_CNT (3)
97 */ 96 */
98 97
99#define MT2063_CNT (1)
100 98
101#if !defined( MT2063_TUNER_CNT )
102#define MT2063_TUNER_CNT (1) /* total num of MicroTuner tuners */ 99#define MT2063_TUNER_CNT (1) /* total num of MicroTuner tuners */
103#endif
104#define MT2063_I2C (0xC0) 100#define MT2063_I2C (0xC0)
105 101
106u32 MT2063_WriteSub(void *hUserData, 102u32 MT2063_WriteSub(void *hUserData,
@@ -113,11 +109,7 @@ u32 MT2063_ReadSub(void *hUserData,
113 109
114void MT2063_Sleep(void *hUserData, u32 nMinDelayTime); 110void MT2063_Sleep(void *hUserData, u32 nMinDelayTime);
115 111
116#if defined(MT2060_CNT)
117#if MT2060_CNT > 0
118u32 MT2060_TunerGain(void *hUserData, s32 * pMeas); 112u32 MT2060_TunerGain(void *hUserData, s32 * pMeas);
119#endif
120#endif
121 113
122/* 114/*
123 * Constant defining the version of the following structure 115 * Constant defining the version of the following structure