Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
fdf77a4f
Commit
fdf77a4f
authored
Jul 20, 2011
by
Mauro Carvalho Chehab
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[media] mt2063: Use Unix standard error handling
Signed-off-by:
Mauro Carvalho Chehab
<
mchehab@redhat.com
>
parent
065719a7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1139 additions
and
1220 deletions
+1139
-1220
drivers/media/common/tuners/mt2063.c
drivers/media/common/tuners/mt2063.c
+1139
-1220
No files found.
drivers/media/common/tuners/mt2063.c
View file @
fdf77a4f
...
...
@@ -16,64 +16,18 @@ module_param(verbose, int, 0644);
#define DVBFE_TUNER_SOFTWARE_SHUTDOWN 100
#define DVBFE_TUNER_CLEAR_POWER_MASKBITS 101
#define MT2063_ERROR (1 << 31)
#define MT2063_USER_ERROR (1 << 30)
/* Macro to be used to check for errors */
#define MT2063_IS_ERROR(s) (((s) >> 30) != 0)
#define MT2063_NO_ERROR(s) (((s) >> 30) == 0)
#define MT2063_OK (0x00000000)
/* Unknown error */
#define MT2063_UNKNOWN (0x80000001)
/* FIXME: Those error codes need conversion*/
/* Error: Upconverter PLL is not locked */
#define MT2063_UPC_UNLOCK (0x80000002)
/* Error: Downconverter PLL is not locked */
#define MT2063_DNC_UNLOCK (0x80000004)
/* Error: Two-wire serial bus communications error */
#define MT2063_COMM_ERR (0x80000008)
/* Error: Tuner handle passed to function was invalid */
#define MT2063_INV_HANDLE (0x80000010)
/* Error: Function argument is invalid (out of range) */
#define MT2063_ARG_RANGE (0x80000020)
/* Error: Function argument (ptr to return value) was NULL */
#define MT2063_ARG_NULL (0x80000040)
/* Error: Attempt to open more than MT_TUNER_CNT tuners */
#define MT2063_TUNER_CNT_ERR (0x80000080)
/* Error: Tuner Part Code / Rev Code mismatches expected value */
#define MT2063_TUNER_ID_ERR (0x80000100)
/* Error: Tuner Initialization failure */
#define MT2063_TUNER_INIT_ERR (0x80000200)
#define MT2063_TUNER_OPEN_ERR (0x80000400)
/* User-definable fields (see mt_userdef.h) */
#define MT2063_USER_DEFINED1 (0x00001000)
#define MT2063_USER_DEFINED2 (0x00002000)
#define MT2063_USER_DEFINED3 (0x00004000)
#define MT2063_USER_DEFINED4 (0x00008000)
#define MT2063_USER_MASK (0x4000f000)
#define MT2063_USER_SHIFT (12)
/* Info: Unavoidable LO-related spur may be present in the output */
#define MT2063_SPUR_PRESENT_ERR (0x00800000)
/* Info: Mask of bits used for # of LO-related spurs that were avoided during tuning */
#define MT2063_SPUR_CNT_MASK (0x001f0000)
#define MT2063_SPUR_SHIFT (16)
/* Info: Tuner timeout waiting for condition */
#define MT2063_TUNER_TIMEOUT (0x00400000)
/* Info: Unavoidable LO-related spur may be present in the output */
#define MT2063_SPUR_PRESENT_ERR (0x00800000)
/* Info: Tuner input frequency is out of range */
#define MT2063_FIN_RANGE (0x01000000)
...
...
@@ -539,12 +493,12 @@ struct mt2063_state {
/* Prototypes */
static
void
MT2063_AddExclZone
(
struct
MT2063_AvoidSpursData_t
*
pAS_Info
,
u32
f_min
,
u32
f_max
);
static
u32
MT2063_ReInit
(
void
*
h
);
static
u32
MT2063_Close
(
void
*
hMT2063
);
static
u32
MT2063_GetReg
(
void
*
h
,
u8
reg
,
u8
*
val
);
static
u32
MT2063_GetParam
(
void
*
h
,
enum
MT2063_Param
param
,
u32
*
pValue
);
static
u32
MT2063_SetReg
(
void
*
h
,
u8
reg
,
u8
val
);
static
u32
MT2063_SetParam
(
void
*
h
,
enum
MT2063_Param
param
,
u32
nValue
);
static
u32
MT2063_ReInit
(
struct
MT2063_Info_t
*
pInfo
);
static
u32
MT2063_Close
(
struct
MT2063_Info_t
*
pInfo
);
static
u32
MT2063_GetReg
(
struct
MT2063_Info_t
*
pInfo
,
u8
reg
,
u8
*
val
);
static
u32
MT2063_GetParam
(
struct
MT2063_Info_t
*
pInfo
,
enum
MT2063_Param
param
,
u32
*
pValue
);
static
u32
MT2063_SetReg
(
struct
MT2063_Info_t
*
pInfo
,
u8
reg
,
u8
val
);
static
u32
MT2063_SetParam
(
struct
MT2063_Info_t
*
pInfo
,
enum
MT2063_Param
param
,
u32
nValue
);
/*****************/
/* From drivers/media/common/tuners/mt2063_cfg.h */
...
...
@@ -769,7 +723,7 @@ static u32 MT2063_WriteSub(void *hUserData,
u32
addr
,
u8
subAddress
,
u8
*
pData
,
u32
cnt
)
{
u32
status
=
MT2063_OK
;
/* Status to be returned */
u32
status
=
0
;
/* Status to be returned */
struct
dvb_frontend
*
fe
=
hUserData
;
struct
mt2063_state
*
state
=
fe
->
tuner_priv
;
/*
...
...
@@ -782,7 +736,7 @@ static u32 MT2063_WriteSub(void *hUserData,
fe
->
ops
.
i2c_gate_ctrl
(
fe
,
1
);
//I2C bypass drxk3926 close i2c bridge
if
(
mt2063_writeregs
(
state
,
subAddress
,
pData
,
cnt
)
<
0
)
{
status
=
MT2063_ERROR
;
status
=
-
EINVAL
;
}
fe
->
ops
.
i2c_gate_ctrl
(
fe
,
0
);
//I2C bypass drxk3926 close i2c bridge
...
...
@@ -838,7 +792,7 @@ static u32 MT2063_ReadSub(void *hUserData,
** return MT_OK.
*/
/* return status; */
u32
status
=
MT2063_OK
;
/* Status to be returned */
u32
status
=
0
;
/* Status to be returned */
struct
dvb_frontend
*
fe
=
hUserData
;
struct
mt2063_state
*
state
=
fe
->
tuner_priv
;
u32
i
=
0
;
...
...
@@ -846,7 +800,7 @@ static u32 MT2063_ReadSub(void *hUserData,
for
(
i
=
0
;
i
<
cnt
;
i
++
)
{
if
(
mt2063_read_regs
(
state
,
subAddress
+
i
,
pData
+
i
,
1
)
<
0
)
{
status
=
MT2063_ERROR
;
status
=
-
EINVAL
;
break
;
}
}
...
...
@@ -962,7 +916,7 @@ static u32 MT2063_RegisterTuner(struct MT2063_AvoidSpursData_t *pAS_Info)
{
#if MT2063_TUNER_CNT == 1
pAS_Info
->
nAS_Algorithm
=
1
;
return
MT2063_OK
;
return
0
;
#else
u32
index
;
...
...
@@ -973,7 +927,7 @@ static u32 MT2063_RegisterTuner(struct MT2063_AvoidSpursData_t *pAS_Info)
*/
for
(
index
=
0
;
index
<
TunerCount
;
index
++
)
{
if
(
TunerList
[
index
]
==
pAS_Info
)
{
return
MT2063_OK
;
/* Already here - no problem */
return
0
;
/* Already here - no problem */
}
}
...
...
@@ -983,9 +937,9 @@ static u32 MT2063_RegisterTuner(struct MT2063_AvoidSpursData_t *pAS_Info)
if
(
TunerCount
<
MT2063_TUNER_CNT
)
{
TunerList
[
TunerCount
]
=
pAS_Info
;
TunerCount
++
;
return
MT2063_OK
;
return
0
;
}
else
return
MT2063_TUNER_CNT_ERR
;
return
-
ENODEV
;
#endif
}
...
...
@@ -1810,13 +1764,13 @@ static u32 IsSpurInBand(struct MT2063_AvoidSpursData_t *pAS_Info,
*****************************************************************************/
static
u32
MT2063_AvoidSpurs
(
void
*
h
,
struct
MT2063_AvoidSpursData_t
*
pAS_Info
)
{
u32
status
=
MT2063_OK
;
u32
status
=
0
;
u32
fm
,
fp
;
/* restricted range on LO's */
pAS_Info
->
bSpurAvoided
=
0
;
pAS_Info
->
nSpursFound
=
0
;
if
(
pAS_Info
->
maxH1
==
0
)
return
MT2063_OK
;
return
0
;
/*
** Avoid LO Generated Spurs
...
...
@@ -2030,14 +1984,14 @@ static u32 MT2063_fLO_FractionalTerm(u32 f_ref, u32 num,
******************************************************************************/
static
u32
MT2063_Open
(
u32
MT2063_Addr
,
struct
MT2063_Info_t
**
hMT2063
,
void
*
hUserData
)
{
u32
status
=
MT2063_OK
;
/* Status to be returned. */
u32
status
=
0
;
/* Status to be returned. */
struct
MT2063_Info_t
*
pInfo
=
NULL
;
struct
dvb_frontend
*
fe
=
(
struct
dvb_frontend
*
)
hUserData
;
struct
mt2063_state
*
state
=
fe
->
tuner_priv
;
/* Check the argument before using */
if
(
hMT2063
==
NULL
)
{
return
MT2063_ARG_NULL
;
return
-
ENODEV
;
}
/* Default tuner handle to NULL. If successful, it will be reassigned */
...
...
@@ -2045,7 +1999,7 @@ static u32 MT2063_Open(u32 MT2063_Addr, struct MT2063_Info_t **hMT2063, void *hU
if
(
state
->
MT2063_init
==
false
)
{
pInfo
=
kzalloc
(
sizeof
(
struct
MT2063_Info_t
),
GFP_KERNEL
);
if
(
pInfo
==
NULL
)
{
return
MT2063_TUNER_OPEN_ERR
;
return
-
ENOMEM
;
}
pInfo
->
handle
=
NULL
;
pInfo
->
address
=
MAX_UDATA
;
...
...
@@ -2055,11 +2009,11 @@ static u32 MT2063_Open(u32 MT2063_Addr, struct MT2063_Info_t **hMT2063, void *hU
pInfo
=
*
hMT2063
;
}
if
(
MT2063_NO_ERROR
(
status
)
)
{
if
(
status
>=
0
)
{
status
|=
MT2063_RegisterTuner
(
&
pInfo
->
AS_Data
);
}
if
(
MT2063_NO_ERROR
(
status
)
)
{
if
(
status
>=
0
)
{
pInfo
->
handle
=
(
void
*
)
pInfo
;
pInfo
->
hUserData
=
hUserData
;
...
...
@@ -2068,7 +2022,7 @@ static u32 MT2063_Open(u32 MT2063_Addr, struct MT2063_Info_t **hMT2063, void *hU
status
|=
MT2063_ReInit
((
void
*
)
pInfo
);
}
if
(
MT2063_IS_ERROR
(
status
)
)
if
(
status
<
0
)
/* MT2063_Close handles the un-registration of the tuner */
MT2063_Close
((
void
*
)
pInfo
);
else
{
...
...
@@ -2106,12 +2060,10 @@ static u32 MT2063_IsValidHandle(struct MT2063_Info_t *handle)
** 138 06-19-2007 DAD Ver 1.00: Initial, derived from mt2067_b.
**
******************************************************************************/
static
u32
MT2063_Close
(
void
*
hMT2063
)
static
u32
MT2063_Close
(
struct
MT2063_Info_t
*
pInfo
)
{
struct
MT2063_Info_t
*
pInfo
=
(
struct
MT2063_Info_t
*
)
hMT2063
;
if
(
!
MT2063_IsValidHandle
(
pInfo
))
return
MT2063_INV_HANDLE
;
return
-
ENODEV
;
/* Unregister tuner with SpurAvoidance routines (if needed) */
MT2063_UnRegisterTuner
(
&
pInfo
->
AS_Data
);
...
...
@@ -2122,7 +2074,7 @@ static u32 MT2063_Close(void *hMT2063)
//kfree(pInfo);
//pInfo = NULL;
return
MT2063_OK
;
return
0
;
}
/****************************************************************************
...
...
@@ -2150,19 +2102,18 @@ static u32 MT2063_Close(void *hMT2063)
** 138 06-19-2007 DAD Ver 1.00: Initial, derived from mt2067_b.
**
****************************************************************************/
static
u32
MT2063_GetLocked
(
void
*
h
)
static
u32
MT2063_GetLocked
(
struct
MT2063_Info_t
*
pInfo
)
{
const
u32
nMaxWait
=
100
;
/* wait a maximum of 100 msec */
const
u32
nPollRate
=
2
;
/* poll status bits every 2 ms */
const
u32
nMaxLoops
=
nMaxWait
/
nPollRate
;
const
u8
LO1LK
=
0x80
;
u8
LO2LK
=
0x08
;
u32
status
=
MT2063_OK
;
/* Status to be returned */
u32
status
=
0
;
/* Status to be returned */
u32
nDelays
=
0
;
struct
MT2063_Info_t
*
pInfo
=
(
struct
MT2063_Info_t
*
)
h
;
if
(
MT2063_IsValidHandle
(
pInfo
)
==
0
)
return
MT2063_INV_HANDLE
;
return
-
ENODEV
;
/* LO2 Lock bit was in a different place for B0 version */
if
(
pInfo
->
tuner_id
==
MT2063_B0
)
...
...
@@ -2174,7 +2125,7 @@ static u32 MT2063_GetLocked(void *h)
MT2063_REG_LO_STATUS
,
&
pInfo
->
reg
[
MT2063_REG_LO_STATUS
],
1
);
if
(
MT2063_IS_ERROR
(
status
)
)
if
(
status
<
0
)
return
(
status
);
if
((
pInfo
->
reg
[
MT2063_REG_LO_STATUS
]
&
(
LO1LK
|
LO2LK
))
==
...
...
@@ -2285,21 +2236,19 @@ static u32 MT2063_GetLocked(void *h)
** 06-24-2008 PINZ Ver 1.18: Add Get/SetParam CTFILT_SW
**
****************************************************************************/
static
u32
MT2063_GetParam
(
void
*
h
,
enum
MT2063_Param
param
,
u32
*
pValue
)
static
u32
MT2063_GetParam
(
struct
MT2063_Info_t
*
pInfo
,
enum
MT2063_Param
param
,
u32
*
pValue
)
{
u32
status
=
MT2063_OK
;
/* Status to be returned */
struct
MT2063_Info_t
*
pInfo
=
(
struct
MT2063_Info_t
*
)
h
;
u32
status
=
0
;
/* Status to be returned */
u32
Div
;
u32
Num
;
if
(
pValue
==
NULL
)
status
|=
MT2063_ARG_NUL
L
;
return
-
EINVA
L
;
/* Verify that the handle passed points to a valid tuner */
if
(
MT2063_IsValidHandle
(
pInfo
)
==
0
)
status
|=
MT2063_INV_HANDLE
;
return
-
ENODEV
;
if
(
MT2063_NO_ERROR
(
status
))
{
switch
(
param
)
{
/* Serial Bus address of this tuner */
case
MT2063_IC_ADDR
:
...
...
@@ -2497,7 +2446,7 @@ static u32 MT2063_GetParam(void *h, enum MT2063_Param param, u32 * pValue)
MT2063_REG_BYP_CTRL
,
&
reg
,
1
);
if
(
MT2063_IS_ERROR
(
status
)
)
if
(
status
<
0
)
return
(
status
);
for
(
i
=
0
;
i
<
8
;
i
++
)
{
...
...
@@ -2510,7 +2459,7 @@ static u32 MT2063_GetParam(void *h, enum MT2063_Param param, u32 * pValue)
[
MT2063_REG_ADC_OUT
],
1
);
if
(
MT2063_NO_ERROR
(
status
)
)
if
(
status
>=
0
)
*
pValue
+=
pInfo
->
reg
[
MT2063_REG_ADC_OUT
];
...
...
@@ -2654,8 +2603,7 @@ static u32 MT2063_GetParam(void *h, enum MT2063_Param param, u32 * pValue)
case
MT2063_EOP
:
default:
status
|=
MT2063_ARG_RANGE
;
}
status
|=
-
ERANGE
;
}
return
(
status
);
}
...
...
@@ -2689,28 +2637,22 @@ static u32 MT2063_GetParam(void *h, enum MT2063_Param param, u32 * pValue)
** 138 06-19-2007 DAD Ver 1.00: Initial, derived from mt2067_b.
**
****************************************************************************/
static
u32
MT2063_GetReg
(
void
*
h
,
u8
reg
,
u8
*
val
)
static
u32
MT2063_GetReg
(
struct
MT2063_Info_t
*
pInfo
,
u8
reg
,
u8
*
val
)
{
u32
status
=
MT2063_OK
;
/* Status to be returned */
struct
MT2063_Info_t
*
pInfo
=
(
struct
MT2063_Info_t
*
)
h
;
u32
status
=
0
;
/* Status to be returned */
/* Verify that the handle passed points to a valid tuner */
if
(
MT2063_IsValidHandle
(
pInfo
)
==
0
)
status
|=
MT2063_INV_HANDLE
;
return
-
ENODEV
;
if
(
val
==
NULL
)
status
|=
MT2063_ARG_NUL
L
;
return
-
EINVA
L
;
if
(
reg
>=
MT2063_REG_END_REGS
)
status
|=
MT2063_ARG_
RANGE
;
return
-
E
RANGE
;
if
(
MT2063_NO_ERROR
(
status
))
{
status
|=
MT2063_ReadSub
(
pInfo
->
hUserData
,
pInfo
->
address
,
reg
,
status
=
MT2063_ReadSub
(
pInfo
->
hUserData
,
pInfo
->
address
,
reg
,
&
pInfo
->
reg
[
reg
],
1
);
if
(
MT2063_NO_ERROR
(
status
))
*
val
=
pInfo
->
reg
[
reg
];
}
return
(
status
);
}
...
...
@@ -2801,15 +2743,15 @@ static u32 MT2063_GetReg(void *h, u8 reg, u8 * val)
static
u32
MT2063_SetReceiverMode
(
struct
MT2063_Info_t
*
pInfo
,
enum
MT2063_RCVR_MODES
Mode
)
{
u32
status
=
MT2063_OK
;
/* Status to be returned */
u32
status
=
0
;
/* Status to be returned */
u8
val
;
u32
longval
;
if
(
Mode
>=
MT2063_NUM_RCVR_MODES
)
status
=
MT2063_ARG_
RANGE
;
status
=
-
E
RANGE
;
/* RFAGCen */
if
(
MT2063_NO_ERROR
(
status
)
)
{
if
(
status
>=
0
)
{
val
=
(
pInfo
->
reg
[
MT2063_REG_PD1_TGT
]
&
(
u8
)
~
0x40
)
|
(
RFAGCEN
[
Mode
]
...
...
@@ -2821,12 +2763,12 @@ static u32 MT2063_SetReceiverMode(struct MT2063_Info_t *pInfo,
}
/* LNARin */
if
(
MT2063_NO_ERROR
(
status
)
)
{
if
(
status
>=
0
)
{
status
|=
MT2063_SetParam
(
pInfo
,
MT2063_LNA_RIN
,
LNARIN
[
Mode
]);
}
/* FIFFQEN and FIFFQ */
if
(
MT2063_NO_ERROR
(
status
)
)
{
if
(
status
>=
0
)
{
val
=
(
pInfo
->
reg
[
MT2063_REG_FIFF_CTRL2
]
&
(
u8
)
~
0xF0
)
|
...
...
@@ -2852,40 +2794,40 @@ static u32 MT2063_SetReceiverMode(struct MT2063_Info_t *pInfo,
status
|=
MT2063_SetParam
(
pInfo
,
MT2063_DNC_OUTPUT_ENABLE
,
longval
);
/* acLNAmax */
if
(
MT2063_NO_ERROR
(
status
)
)
{
if
(
status
>=
0
)
{
status
|=
MT2063_SetParam
(
pInfo
,
MT2063_ACLNA_MAX
,
ACLNAMAX
[
Mode
]);
}
/* LNATGT */
if
(
MT2063_NO_ERROR
(
status
)
)
{
if
(
status
>=
0
)
{
status
|=
MT2063_SetParam
(
pInfo
,
MT2063_LNA_TGT
,
LNATGT
[
Mode
]);
}
/* ACRF */
if
(
MT2063_NO_ERROR
(
status
)
)
{
if
(
status
>=
0
)
{
status
|=
MT2063_SetParam
(
pInfo
,
MT2063_ACRF_MAX
,
ACRFMAX
[
Mode
]);
}
/* PD1TGT */
if
(
MT2063_NO_ERROR
(
status
)
)
{
if
(
status
>=
0
)
{
status
|=
MT2063_SetParam
(
pInfo
,
MT2063_PD1_TGT
,
PD1TGT
[
Mode
]);
}
/* FIFATN */
if
(
MT2063_NO_ERROR
(
status
)
)
{
if
(
status
>=
0
)
{
status
|=
MT2063_SetParam
(
pInfo
,
MT2063_ACFIF_MAX
,
ACFIFMAX
[
Mode
]);
}
/* PD2TGT */
if
(
MT2063_NO_ERROR
(
status
)
)
{
if
(
status
>=
0
)
{
status
|=
MT2063_SetParam
(
pInfo
,
MT2063_PD2_TGT
,
PD2TGT
[
Mode
]);
}
/* Ignore ATN Overload */
if
(
MT2063_NO_ERROR
(
status
)
)
{
if
(
status
>=
0
)
{
val
=
(
pInfo
->
reg
[
MT2063_REG_LNA_TGT
]
&
(
u8
)
~
0x80
)
|
(
RFOVDIS
[
Mode
]
...
...
@@ -2897,7 +2839,7 @@ static u32 MT2063_SetReceiverMode(struct MT2063_Info_t *pInfo,
}
/* Ignore FIF Overload */
if
(
MT2063_NO_ERROR
(
status
)
)
{
if
(
status
>=
0
)
{
val
=
(
pInfo
->
reg
[
MT2063_REG_PD1_TGT
]
&
(
u8
)
~
0x80
)
|
...
...
@@ -2907,7 +2849,7 @@ static u32 MT2063_SetReceiverMode(struct MT2063_Info_t *pInfo,
}
}
if
(
MT2063_NO_ERROR
(
status
)
)
if
(
status
>=
0
)
pInfo
->
rcvr_mode
=
Mode
;
return
(
status
);
...
...
@@ -2947,13 +2889,15 @@ static u32 MT2063_SetReceiverMode(struct MT2063_Info_t *pInfo,
** 06-24-2008 PINZ Ver 1.18: Add Get/SetParam CTFILT_SW
**
******************************************************************************/
static
u32
MT2063_ReInit
(
void
*
h
)
static
u32
MT2063_ReInit
(
struct
MT2063_Info_t
*
pInfo
)
{
u8
all_resets
=
0xF0
;
/* reset/load bits */
u32
status
=
MT2063_OK
;
/* Status to be returned */
struct
MT2063_Info_t
*
pInfo
=
(
struct
MT2063_Info_t
*
)
h
;
u32
status
=
0
;
/* Status to be returned */
u8
*
def
=
NULL
;
u32
FCRUN
;
s32
maxReads
;
u32
fcu_osc
;
u32
i
;
u8
MT2063B0_defaults
[]
=
{
/* Reg, Value */
0x19
,
0x05
,
0x1B
,
0x1D
,
...
...
@@ -2976,7 +2920,6 @@ static u32 MT2063_ReInit(void *h)
0x28
,
0xE0
,
/* Clear the FIFCrst bit here */
0x00
};
/* writing 0x05 0xf0 sw-resets all registers, so we write only needed changes */
u8
MT2063B1_defaults
[]
=
{
/* Reg, Value */
0x05
,
0xF0
,
...
...
@@ -3002,7 +2945,6 @@ static u32 MT2063_ReInit(void *h)
0x28
,
0xE0
,
/* Clear the FIFCrst bit here */
0x00
};
/* writing 0x05 0xf0 sw-resets all registers, so we write only needed changes */
u8
MT2063B3_defaults
[]
=
{
/* Reg, Value */
0x05
,
0xF0
,
...
...
@@ -3016,37 +2958,35 @@ static u32 MT2063_ReInit(void *h)
/* Verify that the handle passed points to a valid tuner */
if
(
MT2063_IsValidHandle
(
pInfo
)
==
0
)
status
|=
MT2063_INV_HANDLE
;
return
-
ENODEV
;
/* Read the Part/Rev code from the tuner */
if
(
MT2063_NO_ERROR
(
status
))
{
status
|=
MT2063_ReadSub
(
pInfo
->
hUserData
,
pInfo
->
address
,
status
=
MT2063_ReadSub
(
pInfo
->
hUserData
,
pInfo
->
address
,
MT2063_REG_PART_REV
,
pInfo
->
reg
,
1
);
}
if
(
status
<
0
)
return
status
;
if
(
MT2063_NO_ERROR
(
status
)
/* Check the part/rev code */
&&
((
pInfo
->
reg
[
MT2063_REG_PART_REV
]
!=
MT2063_B0
)
/* MT2063 B0 */
/* Check the part/rev code */
if
(
((
pInfo
->
reg
[
MT2063_REG_PART_REV
]
!=
MT2063_B0
)
/* MT2063 B0 */
&&
(
pInfo
->
reg
[
MT2063_REG_PART_REV
]
!=
MT2063_B1
)
/* MT2063 B1 */
&&
(
pInfo
->
reg
[
MT2063_REG_PART_REV
]
!=
MT2063_B3
)))
/* MT2063 B3 */
status
|=
MT2063_TUNER_ID_ERR
;
/* Wrong tuner Part/Rev code */
return
-
ENODEV
;
/* Wrong tuner Part/Rev code */
/* Read the Part/Rev code (2nd byte) from the tuner */
if
(
MT2063_NO_ERROR
(
status
))
status
|=
MT2063_ReadSub
(
pInfo
->
hUserData
,
pInfo
->
address
,
/* Check the 2nd byte of the Part/Rev code from the tuner */
status
=
MT2063_ReadSub
(
pInfo
->
hUserData
,
pInfo
->
address
,
MT2063_REG_RSVD_3B
,
&
pInfo
->
reg
[
MT2063_REG_RSVD_3B
],
1
);
if
(
MT2063_NO_ERROR
(
status
)
/* Check the 2nd part/rev code */
if
(
status
>=
0
&&
((
pInfo
->
reg
[
MT2063_REG_RSVD_3B
]
&
0x80
)
!=
0x00
))
/* b7 != 0 ==> NOT MT2063 */
status
|=
MT2063_TUNER_ID_ERR
;
/* Wrong tuner Part/Rev code */
return
-
ENODEV
;
/* Wrong tuner Part/Rev code */
/* Reset the tuner */
if
(
MT2063_NO_ERROR
(
status
))
status
|=
MT2063_WriteSub
(
pInfo
->
hUserData
,
status
=
MT2063_WriteSub
(
pInfo
->
hUserData
,
pInfo
->
address
,
MT2063_REG_LO2CQ_3
,
&
all_resets
,
1
);
if
(
status
<
0
)
return
status
;
/* change all of the default values that vary from the HW reset values */
/* def = (pInfo->reg[PART_REV] == MT2063_B0) ? MT2063B0_defaults : MT2063B1_defaults; */
...
...
@@ -3064,26 +3004,25 @@ static u32 MT2063_ReInit(void *h)
break
;
default:
status
|=
MT2063_TUNER_ID_ERR
;
return
-
ENODEV
;
break
;
}
while
(
MT2063_NO_ERROR
(
status
)
&&
*
def
)
{
while
(
status
>=
0
&&
*
def
)
{
u8
reg
=
*
def
++
;
u8
val
=
*
def
++
;
status
|=
MT2063_WriteSub
(
pInfo
->
hUserData
,
pInfo
->
address
,
reg
,
&
val
,
1
);
status
=
MT2063_WriteSub
(
pInfo
->
hUserData
,
pInfo
->
address
,
reg
,
&
val
,
1
);
}
if
(
status
<
0
)
return
status
;
/* Wait for FIFF location to complete. */
if
(
MT2063_NO_ERROR
(
status
))
{
u32
FCRUN
=
1
;
s32
maxReads
=
10
;
while
(
MT2063_NO_ERROR
(
status
)
&&
(
FCRUN
!=
0
)
&&
(
maxReads
--
>
0
))
{
FCRUN
=
1
;
maxReads
=
10
;
while
(
status
>=
0
&&
(
FCRUN
!=
0
)
&&
(
maxReads
--
>
0
))
{
msleep
(
2
);
status
|
=
MT2063_ReadSub
(
pInfo
->
hUserData
,
status
=
MT2063_ReadSub
(
pInfo
->
hUserData
,
pInfo
->
address
,
MT2063_REG_XO_STATUS
,
&
pInfo
->
...
...
@@ -3092,28 +3031,26 @@ static u32 MT2063_ReInit(void *h)
}
if
(
FCRUN
!=
0
)
status
|=
MT2063_TUNER_INIT_ERR
|
MT2063_TUNER_TIMEOUT
;
return
-
ENODEV
;
if
(
MT2063_NO_ERROR
(
status
))
/* Re-read FIFFC value */
status
|=
MT2063_ReadSub
(
pInfo
->
hUserData
,
pInfo
->
address
,
status
=
MT2063_ReadSub
(
pInfo
->
hUserData
,
pInfo
->
address
,
MT2063_REG_FIFFC
,
&
pInfo
->
reg
[
MT2063_REG_FIFFC
],
1
);
}
if
(
status
<
0
)
return
status
;
/* Read back all the registers from the tuner */
if
(
MT2063_NO_ERROR
(
status
))
status
|=
MT2063_ReadSub
(
pInfo
->
hUserData
,
status
=
MT2063_ReadSub
(
pInfo
->
hUserData
,
pInfo
->
address
,
MT2063_REG_PART_REV
,
pInfo
->
reg
,
MT2063_REG_END_REGS
);
if
(
status
<
0
)
return
status
;
if
(
MT2063_NO_ERROR
(
status
))
{
/* Initialize the tuner state. */
pInfo
->
tuner_id
=
pInfo
->
reg
[
MT2063_REG_PART_REV
];
pInfo
->
AS_Data
.
f_ref
=
MT2063_REF_FREQ
;
pInfo
->
AS_Data
.
f_if1_Center
=
(
pInfo
->
AS_Data
.
f_ref
/
8
)
*
pInfo
->
AS_Data
.
f_if1_Center
=
(
pInfo
->
AS_Data
.
f_ref
/
8
)
*
((
u32
)
pInfo
->
reg
[
MT2063_REG_FIFFC
]
+
640
);
pInfo
->
AS_Data
.
f_if1_bw
=
MT2063_IF1_BW
;
pInfo
->
AS_Data
.
f_out
=
43750000UL
;
...
...
@@ -3128,16 +3065,13 @@ static u32 MT2063_ReInit(void *h)
pInfo
->
AS_Data
.
f_LO1
=
2181000000UL
;
pInfo
->
AS_Data
.
f_LO2
=
1486249786UL
;
pInfo
->
f_IF1_actual
=
pInfo
->
AS_Data
.
f_if1_Center
;
pInfo
->
AS_Data
.
f_in
=
pInfo
->
AS_Data
.
f_LO1
-
pInfo
->
f_IF1_actual
;
pInfo
->
AS_Data
.
f_in
=
pInfo
->
AS_Data
.
f_LO1
-
pInfo
->
f_IF1_actual
;
pInfo
->
AS_Data
.
f_LO1_FracN_Avoid
=
MT2063_LO1_FRACN_AVOID
;
pInfo
->
AS_Data
.
f_LO2_FracN_Avoid
=
MT2063_LO2_FRACN_AVOID
;
pInfo
->
num_regs
=
MT2063_REG_END_REGS
;
pInfo
->
AS_Data
.
avoidDECT
=
MT2063_AVOID_BOTH
;
pInfo
->
ctfilt_sw
=
0
;
}
if
(
MT2063_NO_ERROR
(
status
))
{
pInfo
->
CTFiltMax
[
0
]
=
69230000
;
pInfo
->
CTFiltMax
[
1
]
=
105770000
;
pInfo
->
CTFiltMax
[
2
]
=
140350000
;
...
...
@@ -3169,40 +3103,37 @@ static u32 MT2063_ReInit(void *h)
pInfo
->
CTFiltMax
[
28
]
=
1061870000
;
pInfo
->
CTFiltMax
[
29
]
=
1098330000
;
pInfo
->
CTFiltMax
[
30
]
=
1138990000
;
}
/*
** Fetch the FCU osc value and use it and the fRef value to
** scale all of the Band Max values
*/
if
(
MT2063_NO_ERROR
(
status
))
{
u32
fcu_osc
;
u32
i
;
pInfo
->
reg
[
MT2063_REG_CTUNE_CTRL
]
=
0x0A
;
status
|=
MT2063_WriteSub
(
pInfo
->
hUserData
,
pInfo
->
address
,
status
=
MT2063_WriteSub
(
pInfo
->
hUserData
,
pInfo
->
address
,
MT2063_REG_CTUNE_CTRL
,
&
pInfo
->
reg
[
MT2063_REG_CTUNE_CTRL
],
1
);
if
(
status
<
0
)
return
status
;
/* Read the ClearTune filter calibration value */
status
|=
MT2063_ReadSub
(
pInfo
->
hUserData
,
pInfo
->
address
,
status
=
MT2063_ReadSub
(
pInfo
->
hUserData
,
pInfo
->
address
,
MT2063_REG_FIFFC
,
&
pInfo
->
reg
[
MT2063_REG_FIFFC
],
1
);
if
(
status
<
0
)
return
status
;
fcu_osc
=
pInfo
->
reg
[
MT2063_REG_FIFFC
];
pInfo
->
reg
[
MT2063_REG_CTUNE_CTRL
]
=
0x00
;
status
|=
MT2063_WriteSub
(
pInfo
->
hUserData
,
pInfo
->
address
,
status
=
MT2063_WriteSub
(
pInfo
->
hUserData
,
pInfo
->
address
,
MT2063_REG_CTUNE_CTRL
,
&
pInfo
->
reg
[
MT2063_REG_CTUNE_CTRL
],
1
);
if
(
status
<
0
)
return
status
;
/* Adjust each of the values in the ClearTune filter cross-over table */
for
(
i
=
0
;
i
<
31
;
i
++
)
{
pInfo
->
CTFiltMax
[
i
]
=
(
pInfo
->
CTFiltMax
[
i
]
/
768
)
*
(
fcu_osc
+
640
);
}
}
for
(
i
=
0
;
i
<
31
;
i
++
)
pInfo
->
CTFiltMax
[
i
]
=
(
pInfo
->
CTFiltMax
[
i
]
/
768
)
*
(
fcu_osc
+
640
);
return
(
status
);
}
...
...
@@ -3290,17 +3221,15 @@ static u32 MT2063_ReInit(void *h)
** 06-24-2008 PINZ Ver 1.18: Add Get/SetParam CTFILT_SW
**
****************************************************************************/
static
u32
MT2063_SetParam
(
void
*
h
,
enum
MT2063_Param
param
,
u32
nValue
)
static
u32
MT2063_SetParam
(
struct
MT2063_Info_t
*
pInfo
,
enum
MT2063_Param
param
,
u32
nValue
)
{
u32
status
=
MT2063_OK
;
/* Status to be returned */
u32
status
=
0
;
/* Status to be returned */
u8
val
=
0
;
struct
MT2063_Info_t
*
pInfo
=
(
struct
MT2063_Info_t
*
)
h
;
/* Verify that the handle passed points to a valid tuner */
if
(
MT2063_IsValidHandle
(
pInfo
)
==
0
)
status
|=
MT2063_INV_HANDLE
;
return
-
ENODEV
;
if
(
MT2063_NO_ERROR
(
status
))
{
switch
(
param
)
{
/* crystal frequency */
case
MT2063_SRO_FREQ
:
...
...
@@ -3356,7 +3285,7 @@ static u32 MT2063_SetParam(void *h, enum MT2063_Param param, u32 nValue)
MT2063_REG_LO2CQ_1
,
&
(
tempLO2C
[
0
]),
3
);
if
(
status
==
MT2063_OK
)
{
if
(
status
==
0
)
{
/* cache the bytes just written. */
pInfo
->
reg
[
MT2063_REG_LO2CQ_1
]
=
tempLO2C
[
0
];
...
...
@@ -3677,7 +3606,7 @@ static u32 MT2063_SetParam(void *h, enum MT2063_Param param, u32 nValue)
if
(
pInfo
->
reg
[
MT2063_REG_DNC_GAIN
]
!=
val
)
status
|=
MT2063_SetReg
(
h
,
MT2063_SetReg
(
pInfo
,
MT2063_REG_DNC_GAIN
,
val
);
...
...
@@ -3685,7 +3614,7 @@ static u32 MT2063_SetParam(void *h, enum MT2063_Param param, u32 nValue)
if
(
pInfo
->
reg
[
MT2063_REG_VGA_GAIN
]
!=
val
)
status
|=
MT2063_SetReg
(
h
,
MT2063_SetReg
(
pInfo
,
MT2063_REG_VGA_GAIN
,
val
);
...
...
@@ -3693,7 +3622,7 @@ static u32 MT2063_SetParam(void *h, enum MT2063_Param param, u32 nValue)
if
(
pInfo
->
reg
[
MT2063_REG_RSVD_20
]
!=
val
)
status
|=
MT2063_SetReg
(
h
,
MT2063_SetReg
(
pInfo
,
MT2063_REG_RSVD_20
,
val
);
...
...
@@ -3705,7 +3634,7 @@ static u32 MT2063_SetParam(void *h, enum MT2063_Param param, u32 nValue)
if
(
pInfo
->
reg
[
MT2063_REG_DNC_GAIN
]
!=
val
)
status
|=
MT2063_SetReg
(
h
,
MT2063_SetReg
(
pInfo
,
MT2063_REG_DNC_GAIN
,
val
);
...
...
@@ -3713,7 +3642,7 @@ static u32 MT2063_SetParam(void *h, enum MT2063_Param param, u32 nValue)
if
(
pInfo
->
reg
[
MT2063_REG_VGA_GAIN
]
!=
val
)
status
|=
MT2063_SetReg
(
h
,
MT2063_SetReg
(
pInfo
,
MT2063_REG_VGA_GAIN
,
val
);
...
...
@@ -3721,7 +3650,7 @@ static u32 MT2063_SetParam(void *h, enum MT2063_Param param, u32 nValue)
if
(
pInfo
->
reg
[
MT2063_REG_RSVD_20
]
!=
val
)
status
|=
MT2063_SetReg
(
h
,
MT2063_SetReg
(
pInfo
,
MT2063_REG_RSVD_20
,
val
);
...
...
@@ -3733,7 +3662,7 @@ static u32 MT2063_SetParam(void *h, enum MT2063_Param param, u32 nValue)
if
(
pInfo
->
reg
[
MT2063_REG_DNC_GAIN
]
!=
val
)
status
|=
MT2063_SetReg
(
h
,
MT2063_SetReg
(
pInfo
,
MT2063_REG_DNC_GAIN
,
val
);
...
...
@@ -3741,7 +3670,7 @@ static u32 MT2063_SetParam(void *h, enum MT2063_Param param, u32 nValue)
if
(
pInfo
->
reg
[
MT2063_REG_VGA_GAIN
]
!=
val
)
status
|=
MT2063_SetReg
(
h
,
MT2063_SetReg
(
pInfo
,
MT2063_REG_VGA_GAIN
,
val
);
...
...
@@ -3749,7 +3678,7 @@ static u32 MT2063_SetParam(void *h, enum MT2063_Param param, u32 nValue)
if
(
pInfo
->
reg
[
MT2063_REG_RSVD_20
]
!=
val
)
status
|=
MT2063_SetReg
(
h
,
MT2063_SetReg
(
pInfo
,
MT2063_REG_RSVD_20
,
val
);
...
...
@@ -3761,7 +3690,7 @@ static u32 MT2063_SetParam(void *h, enum MT2063_Param param, u32 nValue)
if
(
pInfo
->
reg
[
MT2063_REG_DNC_GAIN
]
!=
val
)
status
|=
MT2063_SetReg
(
h
,
MT2063_SetReg
(
pInfo
,
MT2063_REG_DNC_GAIN
,
val
);
...
...
@@ -3769,7 +3698,7 @@ static u32 MT2063_SetParam(void *h, enum MT2063_Param param, u32 nValue)
if
(
pInfo
->
reg
[
MT2063_REG_VGA_GAIN
]
!=
val
)
status
|=
MT2063_SetReg
(
h
,
MT2063_SetReg
(
pInfo
,
MT2063_REG_VGA_GAIN
,
val
);
...
...
@@ -3777,7 +3706,7 @@ static u32 MT2063_SetParam(void *h, enum MT2063_Param param, u32 nValue)
if
(
pInfo
->
reg
[
MT2063_REG_RSVD_20
]
!=
val
)
status
|=
MT2063_SetReg
(
h
,
MT2063_SetReg
(
pInfo
,
MT2063_REG_RSVD_20
,
val
);
...
...
@@ -3877,8 +3806,7 @@ static u32 MT2063_SetParam(void *h, enum MT2063_Param param, u32 nValue)
case
MT2063_ACFIF
:
case
MT2063_EOP
:
default:
status
|=
MT2063_ARG_RANGE
;
}
status
|=
-
ERANGE
;
}
return
(
status
);
}
...
...
@@ -3912,12 +3840,11 @@ static u32 MT2063_SetParam(void *h, enum MT2063_Param param, u32 nValue)
****************************************************************************/
static
u32
MT2063_ClearPowerMaskBits
(
struct
MT2063_Info_t
*
pInfo
,
enum
MT2063_Mask_Bits
Bits
)
{
u32
status
=
MT2063_OK
;
/* Status to be returned */
u32
status
=
0
;
/* Status to be returned */
/* Verify that the handle passed points to a valid tuner */
if
(
MT2063_IsValidHandle
(
pInfo
)
==
0
)
status
=
MT2063_INV_HANDLE
;
else
{
return
-
ENODEV
;
Bits
=
(
enum
MT2063_Mask_Bits
)(
Bits
&
MT2063_ALL_SD
);
/* Only valid bits for this tuner */
if
((
Bits
&
0xFF00
)
!=
0
)
{
pInfo
->
reg
[
MT2063_REG_PWR_2
]
&=
~
(
u8
)
(
Bits
>>
8
);
...
...
@@ -3933,7 +3860,6 @@ static u32 MT2063_ClearPowerMaskBits(struct MT2063_Info_t *pInfo, enum MT2063_Ma
MT2063_REG_PWR_1
,
&
pInfo
->
reg
[
MT2063_REG_PWR_1
],
1
);
}
}
return
(
status
);
}
...
...
@@ -3968,12 +3894,11 @@ static u32 MT2063_ClearPowerMaskBits(struct MT2063_Info_t *pInfo, enum MT2063_Ma
****************************************************************************/
static
u32
MT2063_SoftwareShutdown
(
struct
MT2063_Info_t
*
pInfo
,
u8
Shutdown
)
{
u32
status
=
MT2063_OK
;
/* Status to be returned */
u32
status
=
0
;
/* Status to be returned */
/* Verify that the handle passed points to a valid tuner */
if
(
MT2063_IsValidHandle
(
pInfo
)
==
0
)
{
status
=
MT2063_INV_HANDLE
;
}
else
{
if
(
MT2063_IsValidHandle
(
pInfo
)
==
0
)
return
-
ENODEV
;
if
(
Shutdown
==
1
)
pInfo
->
reg
[
MT2063_REG_PWR_1
]
|=
0x04
;
/* Turn the bit on */
else
...
...
@@ -4000,7 +3925,6 @@ static u32 MT2063_SoftwareShutdown(struct MT2063_Info_t *pInfo, u8 Shutdown)
&
pInfo
->
reg
[
MT2063_REG_BYP_CTRL
],
1
);
}
}
return
(
status
);
}
...
...
@@ -4033,25 +3957,21 @@ static u32 MT2063_SoftwareShutdown(struct MT2063_Info_t *pInfo, u8 Shutdown)
** 138 06-19-2007 DAD Ver 1.00: Initial, derived from mt2067_b.
**
****************************************************************************/
static
u32
MT2063_SetReg
(
void
*
h
,
u8
reg
,
u8
val
)
static
u32
MT2063_SetReg
(
struct
MT2063_Info_t
*
pInfo
,
u8
reg
,
u8
val
)
{
u32
status
=
MT2063_OK
;
/* Status to be returned */
struct
MT2063_Info_t
*
pInfo
=
(
struct
MT2063_Info_t
*
)
h
;
u32
status
=
0
;
/* Status to be returned */
/* Verify that the handle passed points to a valid tuner */
if
(
MT2063_IsValidHandle
(
pInfo
)
==
0
)
status
|=
MT2063_INV_HANDLE
;
return
-
ENODEV
;
if
(
reg
>=
MT2063_REG_END_REGS
)
status
|=
MT2063_ARG_
RANGE
;
status
|=
-
E
RANGE
;
if
(
MT2063_NO_ERROR
(
status
))
{
status
|=
MT2063_WriteSub
(
pInfo
->
hUserData
,
pInfo
->
address
,
reg
,
&
val
,
status
=
MT2063_WriteSub
(
pInfo
->
hUserData
,
pInfo
->
address
,
reg
,
&
val
,
1
);
if
(
MT2063_NO_ERROR
(
status
)
)
if
(
status
>=
0
)
pInfo
->
reg
[
reg
]
=
val
;
}
return
(
status
);
}
...
...
@@ -4271,11 +4191,10 @@ static u32 FindClearTuneFilter(struct MT2063_Info_t *pInfo, u32 f_in)
** 06-24-2008 PINZ Ver 1.18: Add Get/SetParam CTFILT_SW
**
****************************************************************************/
static
u32
MT2063_Tune
(
void
*
h
,
u32
f_in
)
static
u32
MT2063_Tune
(
struct
MT2063_Info_t
*
pInfo
,
u32
f_in
)
{
/* RF input center frequency */
struct
MT2063_Info_t
*
pInfo
=
(
struct
MT2063_Info_t
*
)
h
;
u32
status
=
MT2063_OK
;
/* status of operation */
u32
status
=
0
;
/* status of operation */
u32
LO1
;
/* 1st LO register value */
u32
Num1
;
/* Numerator for LO1 reg. value */
u32
f_IF1
;
/* 1st IF requested */
...
...
@@ -4292,15 +4211,15 @@ static u32 MT2063_Tune(void *h, u32 f_in)
/* Verify that the handle passed points to a valid tuner */
if
(
MT2063_IsValidHandle
(
pInfo
)
==
0
)
return
MT2063_INV_HANDLE
;
return
-
ENODEV
;
/* Check the input and output frequency ranges */
if
((
f_in
<
MT2063_MIN_FIN_FREQ
)
||
(
f_in
>
MT2063_MAX_FIN_FREQ
))
status
|=
MT2063_FIN_RANGE
;
return
-
EINVAL
;
if
((
pInfo
->
AS_Data
.
f_out
<
MT2063_MIN_FOUT_FREQ
)
||
(
pInfo
->
AS_Data
.
f_out
>
MT2063_MAX_FOUT_FREQ
))
status
|=
MT2063_FOUT_RANGE
;
return
-
EINVAL
;
/*
** Save original LO1 and LO2 register values
...
...
@@ -4333,7 +4252,7 @@ static u32 MT2063_Tune(void *h, u32 f_in)
/*
** Read the FIFF Center Frequency from the tuner
*/
if
(
MT2063_NO_ERROR
(
status
)
)
{
if
(
status
>=
0
)
{
status
|=
MT2063_ReadSub
(
pInfo
->
hUserData
,
pInfo
->
address
,
MT2063_REG_FIFFC
,
...
...
@@ -4370,7 +4289,7 @@ static u32 MT2063_Tune(void *h, u32 f_in)
** Check for any LO spurs in the output bandwidth and adjust
** the LO settings to avoid them if needed
*/
status
|=
MT2063_AvoidSpurs
(
h
,
&
pInfo
->
AS_Data
);
status
|=
MT2063_AvoidSpurs
(
pInfo
,
&
pInfo
->
AS_Data
);
/*
** MT_AvoidSpurs spurs may have changed the LO1 & LO2 values.
** Recalculate the LO frequencies and the values to be placed
...
...
@@ -4425,7 +4344,7 @@ static u32 MT2063_Tune(void *h, u32 f_in)
** Place all of the calculated values into the local tuner
** register fields.
*/
if
(
MT2063_NO_ERROR
(
status
)
)
{
if
(
status
>=
0
)
{
pInfo
->
reg
[
MT2063_REG_LO1CQ_1
]
=
(
u8
)
(
LO1
&
0xFF
);
/* DIV1q */
pInfo
->
reg
[
MT2063_REG_LO1CQ_2
]
=
(
u8
)
(
Num1
&
0x3F
);
/* NUM1q */
pInfo
->
reg
[
MT2063_REG_LO2CQ_1
]
=
(
u8
)
(((
LO2
&
0x7F
)
<<
1
)
/* DIV2q */
...
...
@@ -4462,13 +4381,13 @@ static u32 MT2063_Tune(void *h, u32 f_in)
** Check for LO's locking
*/
if
(
MT2063_NO_ERROR
(
status
)
)
{
status
|=
MT2063_GetLocked
(
h
);
if
(
status
>=
0
)
{
status
|=
MT2063_GetLocked
(
pInfo
);
}
/*
** If we locked OK, assign calculated data to MT2063_Info_t structure
*/
if
(
MT2063_NO_ERROR
(
status
)
)
{
if
(
status
>=
0
)
{
pInfo
->
f_IF1_actual
=
pInfo
->
AS_Data
.
f_LO1
-
f_in
;
}
}
...
...
@@ -4480,7 +4399,7 @@ static u32 MT_Tune_atv(void *h, u32 f_in, u32 bw_in,
enum
MTTune_atv_standard
tv_type
)
{
u32
status
=
MT2063_OK
;
u32
status
=
0
;
s32
pict_car
=
0
;
s32
pict2chanb_vsb
=
0
;
...
...
@@ -4608,14 +4527,14 @@ static u32 MT_Tune_atv(void *h, u32 f_in, u32 bw_in,
static
int
mt2063_init
(
struct
dvb_frontend
*
fe
)
{
u32
status
=
MT2063_ERROR
;
u32
status
=
-
EINVAL
;
struct
mt2063_state
*
state
=
fe
->
tuner_priv
;
status
=
MT2063_Open
(
0xC0
,
&
(
state
->
MT2063_ht
),
fe
);
status
|=
MT2063_SoftwareShutdown
(
state
->
MT2063_ht
,
1
);
status
|=
MT2063_ClearPowerMaskBits
(
state
->
MT2063_ht
,
MT2063_ALL_SD
);
if
(
MT2063_OK
!=
status
)
{
if
(
0
!=
status
)
{
printk
(
"%s %d error status = 0x%x!!
\n
"
,
__func__
,
__LINE__
,
status
);
return
-
1
;
...
...
@@ -4665,7 +4584,7 @@ static int mt2063_set_state(struct dvb_frontend *fe,
enum
tuner_param
param
,
struct
tuner_state
*
state
)
{
struct
mt2063_state
*
mt2063State
=
fe
->
tuner_priv
;
u32
status
=
MT2063_OK
;
u32
status
=
0
;
switch
(
param
)
{
case
DVBFE_TUNER_FREQUENCY
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment