mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-29 13:00:35 +00:00
[media] mt2063: Merge the two state structures into one
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
29a0a4fec5
commit
51f0f7b3ed
@ -372,20 +372,6 @@ enum MT2063_Register_Offsets {
|
|||||||
MT2063_REG_END_REGS
|
MT2063_REG_END_REGS
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MT2063_Info_t {
|
|
||||||
void *handle;
|
|
||||||
void *hUserData;
|
|
||||||
u32 address;
|
|
||||||
u32 tuner_id;
|
|
||||||
struct MT2063_AvoidSpursData_t AS_Data;
|
|
||||||
u32 f_IF1_actual;
|
|
||||||
u32 rcvr_mode;
|
|
||||||
u32 ctfilt_sw;
|
|
||||||
u32 CTFiltMax[31];
|
|
||||||
u32 num_regs;
|
|
||||||
u8 reg[MT2063_REG_END_REGS];
|
|
||||||
};
|
|
||||||
|
|
||||||
enum MTTune_atv_standard {
|
enum MTTune_atv_standard {
|
||||||
MTTUNEA_UNKNOWN = 0,
|
MTTUNEA_UNKNOWN = 0,
|
||||||
MTTUNEA_PAL_B,
|
MTTUNEA_PAL_B,
|
||||||
@ -408,7 +394,6 @@ struct mt2063_state {
|
|||||||
struct dvb_tuner_ops ops;
|
struct dvb_tuner_ops ops;
|
||||||
struct dvb_frontend *frontend;
|
struct dvb_frontend *frontend;
|
||||||
struct tuner_state status;
|
struct tuner_state status;
|
||||||
struct MT2063_Info_t *MT2063_ht;
|
|
||||||
bool MT2063_init;
|
bool MT2063_init;
|
||||||
|
|
||||||
enum MTTune_atv_standard tv_type;
|
enum MTTune_atv_standard tv_type;
|
||||||
@ -416,17 +401,26 @@ struct mt2063_state {
|
|||||||
u32 srate;
|
u32 srate;
|
||||||
u32 bandwidth;
|
u32 bandwidth;
|
||||||
u32 reference;
|
u32 reference;
|
||||||
|
|
||||||
|
u32 tuner_id;
|
||||||
|
struct MT2063_AvoidSpursData_t AS_Data;
|
||||||
|
u32 f_IF1_actual;
|
||||||
|
u32 rcvr_mode;
|
||||||
|
u32 ctfilt_sw;
|
||||||
|
u32 CTFiltMax[31];
|
||||||
|
u32 num_regs;
|
||||||
|
u8 reg[MT2063_REG_END_REGS];
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Prototypes */
|
/* Prototypes */
|
||||||
static void MT2063_AddExclZone(struct MT2063_AvoidSpursData_t *pAS_Info,
|
static void MT2063_AddExclZone(struct MT2063_AvoidSpursData_t *pAS_Info,
|
||||||
u32 f_min, u32 f_max);
|
u32 f_min, u32 f_max);
|
||||||
static u32 MT2063_ReInit(struct MT2063_Info_t *pInfo);
|
static u32 MT2063_ReInit(struct mt2063_state *pInfo);
|
||||||
static u32 MT2063_Close(struct MT2063_Info_t *pInfo);
|
static u32 MT2063_Close(struct mt2063_state *pInfo);
|
||||||
static u32 MT2063_GetReg(struct MT2063_Info_t *pInfo, u8 reg, u8 * val);
|
static u32 MT2063_GetReg(struct mt2063_state *pInfo, u8 reg, u8 * val);
|
||||||
static u32 MT2063_GetParam(struct MT2063_Info_t *pInfo, enum MT2063_Param param, u32 * pValue);
|
static u32 MT2063_GetParam(struct mt2063_state *pInfo, enum MT2063_Param param, u32 * pValue);
|
||||||
static u32 MT2063_SetReg(struct MT2063_Info_t *pInfo, u8 reg, u8 val);
|
static u32 MT2063_SetReg(struct mt2063_state *pInfo, u8 reg, u8 val);
|
||||||
static u32 MT2063_SetParam(struct MT2063_Info_t *pInfo, enum MT2063_Param param,
|
static u32 MT2063_SetParam(struct mt2063_state *pInfo, enum MT2063_Param param,
|
||||||
enum MT2063_DNC_Output_Enable nValue);
|
enum MT2063_DNC_Output_Enable nValue);
|
||||||
|
|
||||||
/*****************/
|
/*****************/
|
||||||
@ -436,17 +430,15 @@ unsigned int mt2063_setTune(struct dvb_frontend *fe, u32 f_in,
|
|||||||
u32 bw_in,
|
u32 bw_in,
|
||||||
enum MTTune_atv_standard tv_type)
|
enum MTTune_atv_standard tv_type)
|
||||||
{
|
{
|
||||||
//return (int)MT_Tune_atv(h, f_in, bw_in, tv_type);
|
|
||||||
|
|
||||||
struct dvb_frontend_ops *frontend_ops = NULL;
|
struct dvb_frontend_ops *frontend_ops = NULL;
|
||||||
struct dvb_tuner_ops *tuner_ops = NULL;
|
struct dvb_tuner_ops *tuner_ops = NULL;
|
||||||
struct tuner_state t_state;
|
struct tuner_state t_state;
|
||||||
struct mt2063_state *mt2063State = fe->tuner_priv;
|
struct mt2063_state *state = fe->tuner_priv;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
t_state.frequency = f_in;
|
t_state.frequency = f_in;
|
||||||
t_state.bandwidth = bw_in;
|
t_state.bandwidth = bw_in;
|
||||||
mt2063State->tv_type = tv_type;
|
state->tv_type = tv_type;
|
||||||
if (&fe->ops)
|
if (&fe->ops)
|
||||||
frontend_ops = &fe->ops;
|
frontend_ops = &fe->ops;
|
||||||
if (&frontend_ops->tuner_ops)
|
if (&frontend_ops->tuner_ops)
|
||||||
@ -558,7 +550,7 @@ unsigned int tuner_MT2063_ClearPowerMaskBits(struct dvb_frontend *fe)
|
|||||||
|
|
||||||
//i2c operation
|
//i2c operation
|
||||||
static int mt2063_writeregs(struct mt2063_state *state, u8 reg1,
|
static int mt2063_writeregs(struct mt2063_state *state, u8 reg1,
|
||||||
u8 * data, int len)
|
u8 *data, int len)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
u8 buf[60]; /* = { reg1, data }; */
|
u8 buf[60]; /* = { reg1, data }; */
|
||||||
@ -648,19 +640,17 @@ static int mt2063_read_regs(struct mt2063_state *state, u8 reg1, u8 * b, u8 len)
|
|||||||
** N/A 03-25-2004 DAD Original
|
** N/A 03-25-2004 DAD Original
|
||||||
**
|
**
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
static u32 MT2063_WriteSub(void *hUserData,
|
static u32 MT2063_WriteSub(struct mt2063_state *state,
|
||||||
u32 addr,
|
u8 subAddress, u8 *pData, u32 cnt)
|
||||||
u8 subAddress, u8 * pData, u32 cnt)
|
|
||||||
{
|
{
|
||||||
u32 status = 0; /* Status to be returned */
|
u32 status = 0; /* Status to be returned */
|
||||||
struct dvb_frontend *fe = hUserData;
|
struct dvb_frontend *fe = state->frontend;
|
||||||
struct mt2063_state *state = fe->tuner_priv;
|
|
||||||
/*
|
/*
|
||||||
** ToDo: Add code here to implement a serial-bus write
|
** ToDo: Add code here to implement a serial-bus write
|
||||||
** operation to the MTxxxx tuner. If successful,
|
** operation to the MTxxxx tuner. If successful,
|
||||||
** return MT_OK.
|
** return MT_OK.
|
||||||
*/
|
*/
|
||||||
/* return status; */
|
|
||||||
|
|
||||||
fe->ops.i2c_gate_ctrl(fe, 1); //I2C bypass drxk3926 close i2c bridge
|
fe->ops.i2c_gate_ctrl(fe, 1); //I2C bypass drxk3926 close i2c bridge
|
||||||
|
|
||||||
@ -711,20 +701,18 @@ static u32 MT2063_WriteSub(void *hUserData,
|
|||||||
** N/A 03-25-2004 DAD Original
|
** N/A 03-25-2004 DAD Original
|
||||||
**
|
**
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
static u32 MT2063_ReadSub(void *hUserData,
|
static u32 MT2063_ReadSub(struct mt2063_state *state,
|
||||||
u32 addr,
|
u8 subAddress, u8 *pData, u32 cnt)
|
||||||
u8 subAddress, u8 * pData, u32 cnt)
|
|
||||||
{
|
{
|
||||||
|
u32 status = 0; /* Status to be returned */
|
||||||
|
struct dvb_frontend *fe = state->frontend;
|
||||||
|
u32 i = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** ToDo: Add code here to implement a serial-bus read
|
** ToDo: Add code here to implement a serial-bus read
|
||||||
** operation to the MTxxxx tuner. If successful,
|
** operation to the MTxxxx tuner. If successful,
|
||||||
** return MT_OK.
|
** return MT_OK.
|
||||||
*/
|
*/
|
||||||
/* return status; */
|
|
||||||
u32 status = 0; /* Status to be returned */
|
|
||||||
struct dvb_frontend *fe = hUserData;
|
|
||||||
struct mt2063_state *state = fe->tuner_priv;
|
|
||||||
u32 i = 0;
|
|
||||||
fe->ops.i2c_gate_ctrl(fe, 1); //I2C bypass drxk3926 close i2c bridge
|
fe->ops.i2c_gate_ctrl(fe, 1); //I2C bypass drxk3926 close i2c bridge
|
||||||
|
|
||||||
for (i = 0; i < cnt; i++) {
|
for (i = 0; i < cnt; i++) {
|
||||||
@ -1911,63 +1899,32 @@ static u32 MT2063_fLO_FractionalTerm(u32 f_ref, u32 num,
|
|||||||
** 138 06-19-2007 DAD Ver 1.00: Initial, derived from mt2067_b.
|
** 138 06-19-2007 DAD Ver 1.00: Initial, derived from mt2067_b.
|
||||||
**
|
**
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
static u32 MT2063_Open(u32 MT2063_Addr, struct MT2063_Info_t **hMT2063, void *hUserData)
|
static u32 MT2063_Open(struct dvb_frontend *fe)
|
||||||
{
|
{
|
||||||
u32 status = 0; /* Status to be returned. */
|
u32 status; /* 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;
|
struct mt2063_state *state = fe->tuner_priv;
|
||||||
|
|
||||||
/* Check the argument before using */
|
|
||||||
if (hMT2063 == NULL) {
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Default tuner handle to NULL. If successful, it will be reassigned */
|
/* Default tuner handle to NULL. If successful, it will be reassigned */
|
||||||
|
|
||||||
if (state->MT2063_init == false) {
|
if (state->MT2063_init == false)
|
||||||
pInfo = kzalloc(sizeof(struct MT2063_Info_t), GFP_KERNEL);
|
state->rcvr_mode = MT2063_CABLE_QAM;
|
||||||
if (pInfo == NULL) {
|
|
||||||
return -ENOMEM;
|
|
||||||
}
|
|
||||||
pInfo->handle = NULL;
|
|
||||||
pInfo->address = MAX_UDATA;
|
|
||||||
pInfo->rcvr_mode = MT2063_CABLE_QAM;
|
|
||||||
pInfo->hUserData = NULL;
|
|
||||||
} else {
|
|
||||||
pInfo = *hMT2063;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
status = MT2063_RegisterTuner(&state->AS_Data);
|
||||||
if (status >= 0) {
|
if (status >= 0) {
|
||||||
status |= MT2063_RegisterTuner(&pInfo->AS_Data);
|
state->rcvr_mode = MT2063_CABLE_QAM;
|
||||||
}
|
status = MT2063_ReInit(state);
|
||||||
|
|
||||||
if (status >= 0) {
|
|
||||||
pInfo->handle = (void *) pInfo;
|
|
||||||
|
|
||||||
pInfo->hUserData = hUserData;
|
|
||||||
pInfo->address = MT2063_Addr;
|
|
||||||
pInfo->rcvr_mode = MT2063_CABLE_QAM;
|
|
||||||
status |= MT2063_ReInit((void *) pInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
/* MT2063_Close handles the un-registration of the tuner */
|
/* MT2063_Close handles the un-registration of the tuner */
|
||||||
MT2063_Close((void *) pInfo);
|
MT2063_Close(state);
|
||||||
else {
|
else {
|
||||||
state->MT2063_init = true;
|
state->MT2063_init = true;
|
||||||
*hMT2063 = pInfo->handle;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 MT2063_IsValidHandle(struct MT2063_Info_t *handle)
|
|
||||||
{
|
|
||||||
return ((handle != NULL) && (handle->handle == handle)) ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
**
|
**
|
||||||
** Name: MT2063_Close
|
** Name: MT2063_Close
|
||||||
@ -1989,19 +1946,11 @@ static u32 MT2063_IsValidHandle(struct MT2063_Info_t *handle)
|
|||||||
** 138 06-19-2007 DAD Ver 1.00: Initial, derived from mt2067_b.
|
** 138 06-19-2007 DAD Ver 1.00: Initial, derived from mt2067_b.
|
||||||
**
|
**
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
static u32 MT2063_Close(struct MT2063_Info_t *pInfo)
|
static u32 MT2063_Close(struct mt2063_state *state)
|
||||||
{
|
{
|
||||||
if (!MT2063_IsValidHandle(pInfo))
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
/* Unregister tuner with SpurAvoidance routines (if needed) */
|
/* Unregister tuner with SpurAvoidance routines (if needed) */
|
||||||
MT2063_UnRegisterTuner(&pInfo->AS_Data);
|
MT2063_UnRegisterTuner(&state->AS_Data);
|
||||||
/* Now remove the tuner from our own list of tuners */
|
/* Now remove the tuner from our own list of tuners */
|
||||||
pInfo->handle = NULL;
|
|
||||||
pInfo->address = MAX_UDATA;
|
|
||||||
pInfo->hUserData = NULL;
|
|
||||||
//kfree(pInfo);
|
|
||||||
//pInfo = NULL;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2031,7 +1980,7 @@ static u32 MT2063_Close(struct MT2063_Info_t *pInfo)
|
|||||||
** 138 06-19-2007 DAD Ver 1.00: Initial, derived from mt2067_b.
|
** 138 06-19-2007 DAD Ver 1.00: Initial, derived from mt2067_b.
|
||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static u32 MT2063_GetLocked(struct MT2063_Info_t *pInfo)
|
static u32 MT2063_GetLocked(struct mt2063_state *pInfo)
|
||||||
{
|
{
|
||||||
const u32 nMaxWait = 100; /* wait a maximum of 100 msec */
|
const u32 nMaxWait = 100; /* wait a maximum of 100 msec */
|
||||||
const u32 nPollRate = 2; /* poll status bits every 2 ms */
|
const u32 nPollRate = 2; /* poll status bits every 2 ms */
|
||||||
@ -2041,16 +1990,13 @@ static u32 MT2063_GetLocked(struct MT2063_Info_t *pInfo)
|
|||||||
u32 status = 0; /* Status to be returned */
|
u32 status = 0; /* Status to be returned */
|
||||||
u32 nDelays = 0;
|
u32 nDelays = 0;
|
||||||
|
|
||||||
if (MT2063_IsValidHandle(pInfo) == 0)
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
/* LO2 Lock bit was in a different place for B0 version */
|
/* LO2 Lock bit was in a different place for B0 version */
|
||||||
if (pInfo->tuner_id == MT2063_B0)
|
if (pInfo->tuner_id == MT2063_B0)
|
||||||
LO2LK = 0x40;
|
LO2LK = 0x40;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
status |=
|
status |=
|
||||||
MT2063_ReadSub(pInfo->hUserData, pInfo->address,
|
MT2063_ReadSub(pInfo,
|
||||||
MT2063_REG_LO_STATUS,
|
MT2063_REG_LO_STATUS,
|
||||||
&pInfo->reg[MT2063_REG_LO_STATUS], 1);
|
&pInfo->reg[MT2063_REG_LO_STATUS], 1);
|
||||||
|
|
||||||
@ -2165,7 +2111,7 @@ static u32 MT2063_GetLocked(struct MT2063_Info_t *pInfo)
|
|||||||
** 06-24-2008 PINZ Ver 1.18: Add Get/SetParam CTFILT_SW
|
** 06-24-2008 PINZ Ver 1.18: Add Get/SetParam CTFILT_SW
|
||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static u32 MT2063_GetParam(struct MT2063_Info_t *pInfo, enum MT2063_Param param, u32 *pValue)
|
static u32 MT2063_GetParam(struct mt2063_state *pInfo, enum MT2063_Param param, u32 *pValue)
|
||||||
{
|
{
|
||||||
u32 status = 0; /* Status to be returned */
|
u32 status = 0; /* Status to be returned */
|
||||||
u32 Div;
|
u32 Div;
|
||||||
@ -2174,14 +2120,10 @@ static u32 MT2063_GetParam(struct MT2063_Info_t *pInfo, enum MT2063_Param param,
|
|||||||
if (pValue == NULL)
|
if (pValue == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* Verify that the handle passed points to a valid tuner */
|
|
||||||
if (MT2063_IsValidHandle(pInfo) == 0)
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
switch (param) {
|
switch (param) {
|
||||||
/* Serial Bus address of this tuner */
|
/* Serial Bus address of this tuner */
|
||||||
case MT2063_IC_ADDR:
|
case MT2063_IC_ADDR:
|
||||||
*pValue = pInfo->address;
|
*pValue = pInfo->config->tuner_address;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Max # of MT2063's allowed to be open */
|
/* Max # of MT2063's allowed to be open */
|
||||||
@ -2214,8 +2156,7 @@ static u32 MT2063_GetParam(struct MT2063_Info_t *pInfo, enum MT2063_Param param,
|
|||||||
{
|
{
|
||||||
/* read the actual tuner register values for LO1C_1 and LO1C_2 */
|
/* read the actual tuner register values for LO1C_1 and LO1C_2 */
|
||||||
status |=
|
status |=
|
||||||
MT2063_ReadSub(pInfo->hUserData,
|
MT2063_ReadSub(pInfo,
|
||||||
pInfo->address,
|
|
||||||
MT2063_REG_LO1C_1,
|
MT2063_REG_LO1C_1,
|
||||||
&pInfo->
|
&pInfo->
|
||||||
reg[MT2063_REG_LO1C_1], 2);
|
reg[MT2063_REG_LO1C_1], 2);
|
||||||
@ -2269,8 +2210,7 @@ static u32 MT2063_GetParam(struct MT2063_Info_t *pInfo, enum MT2063_Param param,
|
|||||||
{
|
{
|
||||||
/* Read the actual tuner register values for LO2C_1, LO2C_2 and LO2C_3 */
|
/* Read the actual tuner register values for LO2C_1, LO2C_2 and LO2C_3 */
|
||||||
status |=
|
status |=
|
||||||
MT2063_ReadSub(pInfo->hUserData,
|
MT2063_ReadSub(pInfo,
|
||||||
pInfo->address,
|
|
||||||
MT2063_REG_LO2C_1,
|
MT2063_REG_LO2C_1,
|
||||||
&pInfo->
|
&pInfo->
|
||||||
reg[MT2063_REG_LO2C_1], 3);
|
reg[MT2063_REG_LO2C_1], 3);
|
||||||
@ -2358,8 +2298,7 @@ static u32 MT2063_GetParam(struct MT2063_Info_t *pInfo, enum MT2063_Param param,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MT2063_PD1:
|
case MT2063_PD1:
|
||||||
case MT2063_PD2:
|
case MT2063_PD2: {
|
||||||
{
|
|
||||||
u8 mask = (param == MT2063_PD1 ? 0x01 : 0x03); /* PD1 vs PD2 */
|
u8 mask = (param == MT2063_PD1 ? 0x01 : 0x03); /* PD1 vs PD2 */
|
||||||
u8 orig = (pInfo->reg[MT2063_REG_BYP_CTRL]);
|
u8 orig = (pInfo->reg[MT2063_REG_BYP_CTRL]);
|
||||||
u8 reg = (orig & 0xF1) | mask; /* Only set 3 bits (not 5) */
|
u8 reg = (orig & 0xF1) | mask; /* Only set 3 bits (not 5) */
|
||||||
@ -2370,8 +2309,7 @@ static u32 MT2063_GetParam(struct MT2063_Info_t *pInfo, enum MT2063_Param param,
|
|||||||
/* Initiate ADC output to reg 0x0A */
|
/* Initiate ADC output to reg 0x0A */
|
||||||
if (reg != orig)
|
if (reg != orig)
|
||||||
status |=
|
status |=
|
||||||
MT2063_WriteSub(pInfo->hUserData,
|
MT2063_WriteSub(pInfo,
|
||||||
pInfo->address,
|
|
||||||
MT2063_REG_BYP_CTRL,
|
MT2063_REG_BYP_CTRL,
|
||||||
®, 1);
|
®, 1);
|
||||||
|
|
||||||
@ -2380,8 +2318,7 @@ static u32 MT2063_GetParam(struct MT2063_Info_t *pInfo, enum MT2063_Param param,
|
|||||||
|
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
status |=
|
status |=
|
||||||
MT2063_ReadSub(pInfo->hUserData,
|
MT2063_ReadSub(pInfo,
|
||||||
pInfo->address,
|
|
||||||
MT2063_REG_ADC_OUT,
|
MT2063_REG_ADC_OUT,
|
||||||
&pInfo->
|
&pInfo->
|
||||||
reg
|
reg
|
||||||
@ -2404,8 +2341,7 @@ static u32 MT2063_GetParam(struct MT2063_Info_t *pInfo, enum MT2063_Param param,
|
|||||||
/* Restore value of Register BYP_CTRL */
|
/* Restore value of Register BYP_CTRL */
|
||||||
if (reg != orig)
|
if (reg != orig)
|
||||||
status |=
|
status |=
|
||||||
MT2063_WriteSub(pInfo->hUserData,
|
MT2063_WriteSub(pInfo,
|
||||||
pInfo->address,
|
|
||||||
MT2063_REG_BYP_CTRL,
|
MT2063_REG_BYP_CTRL,
|
||||||
&orig, 1);
|
&orig, 1);
|
||||||
}
|
}
|
||||||
@ -2501,8 +2437,7 @@ static u32 MT2063_GetParam(struct MT2063_Info_t *pInfo, enum MT2063_Param param,
|
|||||||
|
|
||||||
/* Get VGA Gain Code */
|
/* Get VGA Gain Code */
|
||||||
case MT2063_VGAGC:
|
case MT2063_VGAGC:
|
||||||
*pValue =
|
*pValue = ((pInfo->reg[MT2063_REG_VGA_GAIN] & 0x0C) >> 2);
|
||||||
((pInfo->reg[MT2063_REG_VGA_GAIN] & 0x0C) >> 2);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Get VGA bias current */
|
/* Get VGA bias current */
|
||||||
@ -2566,22 +2501,17 @@ static u32 MT2063_GetParam(struct MT2063_Info_t *pInfo, enum MT2063_Param param,
|
|||||||
** 138 06-19-2007 DAD Ver 1.00: Initial, derived from mt2067_b.
|
** 138 06-19-2007 DAD Ver 1.00: Initial, derived from mt2067_b.
|
||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static u32 MT2063_GetReg(struct MT2063_Info_t *pInfo, u8 reg, u8 * val)
|
static u32 MT2063_GetReg(struct mt2063_state *pInfo, u8 reg, u8 * val)
|
||||||
{
|
{
|
||||||
u32 status = 0; /* 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)
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
if (val == NULL)
|
if (val == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (reg >= MT2063_REG_END_REGS)
|
if (reg >= MT2063_REG_END_REGS)
|
||||||
return -ERANGE;
|
return -ERANGE;
|
||||||
|
|
||||||
status = MT2063_ReadSub(pInfo->hUserData, pInfo->address, reg,
|
status = MT2063_ReadSub(pInfo, reg, &pInfo->reg[reg], 1);
|
||||||
&pInfo->reg[reg], 1);
|
|
||||||
|
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
@ -2623,7 +2553,7 @@ static u32 MT2063_GetReg(struct MT2063_Info_t *pInfo, u8 reg, u8 * val)
|
|||||||
** PD2 Target | 40 | 33 | 42 | 42 | 33 | 42
|
** PD2 Target | 40 | 33 | 42 | 42 | 33 | 42
|
||||||
**
|
**
|
||||||
**
|
**
|
||||||
** Parameters: pInfo - ptr to MT2063_Info_t structure
|
** Parameters: pInfo - ptr to mt2063_state structure
|
||||||
** Mode - desired reciever mode
|
** Mode - desired reciever mode
|
||||||
**
|
**
|
||||||
** Usage: status = MT2063_SetReceiverMode(hMT2063, Mode);
|
** Usage: status = MT2063_SetReceiverMode(hMT2063, Mode);
|
||||||
@ -2669,7 +2599,7 @@ static u32 MT2063_GetReg(struct MT2063_Info_t *pInfo, u8 reg, u8 * val)
|
|||||||
** removed GCUAUTO / BYPATNDN/UP
|
** removed GCUAUTO / BYPATNDN/UP
|
||||||
**
|
**
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
static u32 MT2063_SetReceiverMode(struct MT2063_Info_t *pInfo,
|
static u32 MT2063_SetReceiverMode(struct mt2063_state *pInfo,
|
||||||
enum MT2063_RCVR_MODES Mode)
|
enum MT2063_RCVR_MODES Mode)
|
||||||
{
|
{
|
||||||
u32 status = 0; /* Status to be returned */
|
u32 status = 0; /* Status to be returned */
|
||||||
@ -2818,7 +2748,7 @@ static u32 MT2063_SetReceiverMode(struct MT2063_Info_t *pInfo,
|
|||||||
** 06-24-2008 PINZ Ver 1.18: Add Get/SetParam CTFILT_SW
|
** 06-24-2008 PINZ Ver 1.18: Add Get/SetParam CTFILT_SW
|
||||||
**
|
**
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
static u32 MT2063_ReInit(struct MT2063_Info_t *pInfo)
|
static u32 MT2063_ReInit(struct mt2063_state *pInfo)
|
||||||
{
|
{
|
||||||
u8 all_resets = 0xF0; /* reset/load bits */
|
u8 all_resets = 0xF0; /* reset/load bits */
|
||||||
u32 status = 0; /* Status to be returned */
|
u32 status = 0; /* Status to be returned */
|
||||||
@ -2885,13 +2815,8 @@ static u32 MT2063_ReInit(struct MT2063_Info_t *pInfo)
|
|||||||
0x00
|
0x00
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Verify that the handle passed points to a valid tuner */
|
|
||||||
if (MT2063_IsValidHandle(pInfo) == 0)
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
/* Read the Part/Rev code from the tuner */
|
/* Read the Part/Rev code from the tuner */
|
||||||
status = MT2063_ReadSub(pInfo->hUserData, pInfo->address,
|
status = MT2063_ReadSub(pInfo, MT2063_REG_PART_REV, pInfo->reg, 1);
|
||||||
MT2063_REG_PART_REV, pInfo->reg, 1);
|
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
@ -2902,7 +2827,7 @@ static u32 MT2063_ReInit(struct MT2063_Info_t *pInfo)
|
|||||||
return -ENODEV; /* Wrong tuner Part/Rev code */
|
return -ENODEV; /* Wrong tuner Part/Rev code */
|
||||||
|
|
||||||
/* Check the 2nd byte of the Part/Rev code from the tuner */
|
/* Check the 2nd byte of the Part/Rev code from the tuner */
|
||||||
status = MT2063_ReadSub(pInfo->hUserData, pInfo->address,
|
status = MT2063_ReadSub(pInfo,
|
||||||
MT2063_REG_RSVD_3B,
|
MT2063_REG_RSVD_3B,
|
||||||
&pInfo->reg[MT2063_REG_RSVD_3B], 1);
|
&pInfo->reg[MT2063_REG_RSVD_3B], 1);
|
||||||
|
|
||||||
@ -2911,9 +2836,7 @@ static u32 MT2063_ReInit(struct MT2063_Info_t *pInfo)
|
|||||||
return -ENODEV; /* Wrong tuner Part/Rev code */
|
return -ENODEV; /* Wrong tuner Part/Rev code */
|
||||||
|
|
||||||
/* Reset the tuner */
|
/* Reset the tuner */
|
||||||
status = MT2063_WriteSub(pInfo->hUserData,
|
status = MT2063_WriteSub(pInfo, MT2063_REG_LO2CQ_3, &all_resets, 1);
|
||||||
pInfo->address,
|
|
||||||
MT2063_REG_LO2CQ_3, &all_resets, 1);
|
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
@ -2940,8 +2863,7 @@ static u32 MT2063_ReInit(struct MT2063_Info_t *pInfo)
|
|||||||
while (status >= 0 && *def) {
|
while (status >= 0 && *def) {
|
||||||
u8 reg = *def++;
|
u8 reg = *def++;
|
||||||
u8 val = *def++;
|
u8 val = *def++;
|
||||||
status = MT2063_WriteSub(pInfo->hUserData, pInfo->address, reg,
|
status = MT2063_WriteSub(pInfo, reg, &val, 1);
|
||||||
&val, 1);
|
|
||||||
}
|
}
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
return status;
|
return status;
|
||||||
@ -2951,8 +2873,7 @@ static u32 MT2063_ReInit(struct MT2063_Info_t *pInfo)
|
|||||||
maxReads = 10;
|
maxReads = 10;
|
||||||
while (status >= 0 && (FCRUN != 0) && (maxReads-- > 0)) {
|
while (status >= 0 && (FCRUN != 0) && (maxReads-- > 0)) {
|
||||||
msleep(2);
|
msleep(2);
|
||||||
status = MT2063_ReadSub(pInfo->hUserData,
|
status = MT2063_ReadSub(pInfo,
|
||||||
pInfo->address,
|
|
||||||
MT2063_REG_XO_STATUS,
|
MT2063_REG_XO_STATUS,
|
||||||
&pInfo->
|
&pInfo->
|
||||||
reg[MT2063_REG_XO_STATUS], 1);
|
reg[MT2063_REG_XO_STATUS], 1);
|
||||||
@ -2962,15 +2883,14 @@ static u32 MT2063_ReInit(struct MT2063_Info_t *pInfo)
|
|||||||
if (FCRUN != 0)
|
if (FCRUN != 0)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
status = MT2063_ReadSub(pInfo->hUserData, pInfo->address,
|
status = MT2063_ReadSub(pInfo,
|
||||||
MT2063_REG_FIFFC,
|
MT2063_REG_FIFFC,
|
||||||
&pInfo->reg[MT2063_REG_FIFFC], 1);
|
&pInfo->reg[MT2063_REG_FIFFC], 1);
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
/* Read back all the registers from the tuner */
|
/* Read back all the registers from the tuner */
|
||||||
status = MT2063_ReadSub(pInfo->hUserData,
|
status = MT2063_ReadSub(pInfo,
|
||||||
pInfo->address,
|
|
||||||
MT2063_REG_PART_REV,
|
MT2063_REG_PART_REV,
|
||||||
pInfo->reg, MT2063_REG_END_REGS);
|
pInfo->reg, MT2063_REG_END_REGS);
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
@ -3039,13 +2959,13 @@ static u32 MT2063_ReInit(struct MT2063_Info_t *pInfo)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
pInfo->reg[MT2063_REG_CTUNE_CTRL] = 0x0A;
|
pInfo->reg[MT2063_REG_CTUNE_CTRL] = 0x0A;
|
||||||
status = MT2063_WriteSub(pInfo->hUserData, pInfo->address,
|
status = MT2063_WriteSub(pInfo,
|
||||||
MT2063_REG_CTUNE_CTRL,
|
MT2063_REG_CTUNE_CTRL,
|
||||||
&pInfo->reg[MT2063_REG_CTUNE_CTRL], 1);
|
&pInfo->reg[MT2063_REG_CTUNE_CTRL], 1);
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
return status;
|
return status;
|
||||||
/* Read the ClearTune filter calibration value */
|
/* Read the ClearTune filter calibration value */
|
||||||
status = MT2063_ReadSub(pInfo->hUserData, pInfo->address,
|
status = MT2063_ReadSub(pInfo,
|
||||||
MT2063_REG_FIFFC,
|
MT2063_REG_FIFFC,
|
||||||
&pInfo->reg[MT2063_REG_FIFFC], 1);
|
&pInfo->reg[MT2063_REG_FIFFC], 1);
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
@ -3054,7 +2974,7 @@ static u32 MT2063_ReInit(struct MT2063_Info_t *pInfo)
|
|||||||
fcu_osc = pInfo->reg[MT2063_REG_FIFFC];
|
fcu_osc = pInfo->reg[MT2063_REG_FIFFC];
|
||||||
|
|
||||||
pInfo->reg[MT2063_REG_CTUNE_CTRL] = 0x00;
|
pInfo->reg[MT2063_REG_CTUNE_CTRL] = 0x00;
|
||||||
status = MT2063_WriteSub(pInfo->hUserData, pInfo->address,
|
status = MT2063_WriteSub(pInfo,
|
||||||
MT2063_REG_CTUNE_CTRL,
|
MT2063_REG_CTUNE_CTRL,
|
||||||
&pInfo->reg[MT2063_REG_CTUNE_CTRL], 1);
|
&pInfo->reg[MT2063_REG_CTUNE_CTRL], 1);
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
@ -3150,17 +3070,13 @@ static u32 MT2063_ReInit(struct MT2063_Info_t *pInfo)
|
|||||||
** 06-24-2008 PINZ Ver 1.18: Add Get/SetParam CTFILT_SW
|
** 06-24-2008 PINZ Ver 1.18: Add Get/SetParam CTFILT_SW
|
||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static u32 MT2063_SetParam(struct MT2063_Info_t *pInfo,
|
static u32 MT2063_SetParam(struct mt2063_state *pInfo,
|
||||||
enum MT2063_Param param,
|
enum MT2063_Param param,
|
||||||
enum MT2063_DNC_Output_Enable nValue)
|
enum MT2063_DNC_Output_Enable nValue)
|
||||||
{
|
{
|
||||||
u32 status = 0; /* Status to be returned */
|
u32 status = 0; /* Status to be returned */
|
||||||
u8 val = 0;
|
u8 val = 0;
|
||||||
|
|
||||||
/* Verify that the handle passed points to a valid tuner */
|
|
||||||
if (MT2063_IsValidHandle(pInfo) == 0)
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
switch (param) {
|
switch (param) {
|
||||||
/* crystal frequency */
|
/* crystal frequency */
|
||||||
case MT2063_SRO_FREQ:
|
case MT2063_SRO_FREQ:
|
||||||
@ -3191,13 +3107,11 @@ static u32 MT2063_SetParam(struct MT2063_Info_t *pInfo,
|
|||||||
|
|
||||||
/* Buffer the queue for restoration later and get actual LO2 values. */
|
/* Buffer the queue for restoration later and get actual LO2 values. */
|
||||||
status |=
|
status |=
|
||||||
MT2063_ReadSub(pInfo->hUserData,
|
MT2063_ReadSub(pInfo,
|
||||||
pInfo->address,
|
|
||||||
MT2063_REG_LO2CQ_1,
|
MT2063_REG_LO2CQ_1,
|
||||||
&(tempLO2CQ[0]), 3);
|
&(tempLO2CQ[0]), 3);
|
||||||
status |=
|
status |=
|
||||||
MT2063_ReadSub(pInfo->hUserData,
|
MT2063_ReadSub(pInfo,
|
||||||
pInfo->address,
|
|
||||||
MT2063_REG_LO2C_1,
|
MT2063_REG_LO2C_1,
|
||||||
&(tempLO2C[0]), 3);
|
&(tempLO2C[0]), 3);
|
||||||
|
|
||||||
@ -3211,8 +3125,7 @@ static u32 MT2063_SetParam(struct MT2063_Info_t *pInfo,
|
|||||||
(tempLO2CQ[2] != tempLO2C[2])) {
|
(tempLO2CQ[2] != tempLO2C[2])) {
|
||||||
/* put actual LO2 value into queue (with 0 in one-shot bits) */
|
/* put actual LO2 value into queue (with 0 in one-shot bits) */
|
||||||
status |=
|
status |=
|
||||||
MT2063_WriteSub(pInfo->hUserData,
|
MT2063_WriteSub(pInfo,
|
||||||
pInfo->address,
|
|
||||||
MT2063_REG_LO2CQ_1,
|
MT2063_REG_LO2CQ_1,
|
||||||
&(tempLO2C[0]), 3);
|
&(tempLO2C[0]), 3);
|
||||||
|
|
||||||
@ -3239,8 +3152,7 @@ static u32 MT2063_SetParam(struct MT2063_Info_t *pInfo,
|
|||||||
pInfo->reg[MT2063_REG_LO1CQ_2] =
|
pInfo->reg[MT2063_REG_LO1CQ_2] =
|
||||||
(u8) (FracN);
|
(u8) (FracN);
|
||||||
status |=
|
status |=
|
||||||
MT2063_WriteSub(pInfo->hUserData,
|
MT2063_WriteSub(pInfo,
|
||||||
pInfo->address,
|
|
||||||
MT2063_REG_LO1CQ_1,
|
MT2063_REG_LO1CQ_1,
|
||||||
&pInfo->
|
&pInfo->
|
||||||
reg[MT2063_REG_LO1CQ_1], 2);
|
reg[MT2063_REG_LO1CQ_1], 2);
|
||||||
@ -3248,8 +3160,7 @@ static u32 MT2063_SetParam(struct MT2063_Info_t *pInfo,
|
|||||||
/* set the one-shot bit to load the pair of LO values */
|
/* set the one-shot bit to load the pair of LO values */
|
||||||
tmpOneShot = tempLO2CQ[2] | 0xE0;
|
tmpOneShot = tempLO2CQ[2] | 0xE0;
|
||||||
status |=
|
status |=
|
||||||
MT2063_WriteSub(pInfo->hUserData,
|
MT2063_WriteSub(pInfo,
|
||||||
pInfo->address,
|
|
||||||
MT2063_REG_LO2CQ_3,
|
MT2063_REG_LO2CQ_3,
|
||||||
&tmpOneShot, 1);
|
&tmpOneShot, 1);
|
||||||
|
|
||||||
@ -3257,8 +3168,7 @@ static u32 MT2063_SetParam(struct MT2063_Info_t *pInfo,
|
|||||||
if (restore) {
|
if (restore) {
|
||||||
/* put actual LO2 value into queue (0 in one-shot bits) */
|
/* put actual LO2 value into queue (0 in one-shot bits) */
|
||||||
status |=
|
status |=
|
||||||
MT2063_WriteSub(pInfo->hUserData,
|
MT2063_WriteSub(pInfo,
|
||||||
pInfo->address,
|
|
||||||
MT2063_REG_LO2CQ_1,
|
MT2063_REG_LO2CQ_1,
|
||||||
&(tempLO2CQ[0]), 3);
|
&(tempLO2CQ[0]), 3);
|
||||||
|
|
||||||
@ -3271,7 +3181,7 @@ static u32 MT2063_SetParam(struct MT2063_Info_t *pInfo,
|
|||||||
tempLO2CQ[2];
|
tempLO2CQ[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
MT2063_GetParam(pInfo->hUserData,
|
MT2063_GetParam(pInfo,
|
||||||
MT2063_LO1_FREQ,
|
MT2063_LO1_FREQ,
|
||||||
&pInfo->AS_Data.f_LO1);
|
&pInfo->AS_Data.f_LO1);
|
||||||
}
|
}
|
||||||
@ -3311,13 +3221,11 @@ static u32 MT2063_SetParam(struct MT2063_Info_t *pInfo,
|
|||||||
|
|
||||||
/* Buffer the queue for restoration later and get actual LO2 values. */
|
/* Buffer the queue for restoration later and get actual LO2 values. */
|
||||||
status |=
|
status |=
|
||||||
MT2063_ReadSub(pInfo->hUserData,
|
MT2063_ReadSub(pInfo,
|
||||||
pInfo->address,
|
|
||||||
MT2063_REG_LO1CQ_1,
|
MT2063_REG_LO1CQ_1,
|
||||||
&(tempLO1CQ[0]), 2);
|
&(tempLO1CQ[0]), 2);
|
||||||
status |=
|
status |=
|
||||||
MT2063_ReadSub(pInfo->hUserData,
|
MT2063_ReadSub(pInfo,
|
||||||
pInfo->address,
|
|
||||||
MT2063_REG_LO1C_1,
|
MT2063_REG_LO1C_1,
|
||||||
&(tempLO1C[0]), 2);
|
&(tempLO1C[0]), 2);
|
||||||
|
|
||||||
@ -3326,8 +3234,7 @@ static u32 MT2063_SetParam(struct MT2063_Info_t *pInfo,
|
|||||||
|| (tempLO1CQ[1] != tempLO1C[1])) {
|
|| (tempLO1CQ[1] != tempLO1C[1])) {
|
||||||
/* put actual LO1 value into queue */
|
/* put actual LO1 value into queue */
|
||||||
status |=
|
status |=
|
||||||
MT2063_WriteSub(pInfo->hUserData,
|
MT2063_WriteSub(pInfo,
|
||||||
pInfo->address,
|
|
||||||
MT2063_REG_LO1CQ_1,
|
MT2063_REG_LO1CQ_1,
|
||||||
&(tempLO1C[0]), 2);
|
&(tempLO1C[0]), 2);
|
||||||
|
|
||||||
@ -3353,8 +3260,7 @@ static u32 MT2063_SetParam(struct MT2063_Info_t *pInfo,
|
|||||||
pInfo->reg[MT2063_REG_LO2CQ_3] =
|
pInfo->reg[MT2063_REG_LO2CQ_3] =
|
||||||
(u8) ((FracN2 & 0x0F));
|
(u8) ((FracN2 & 0x0F));
|
||||||
status |=
|
status |=
|
||||||
MT2063_WriteSub(pInfo->hUserData,
|
MT2063_WriteSub(pInfo,
|
||||||
pInfo->address,
|
|
||||||
MT2063_REG_LO1CQ_1,
|
MT2063_REG_LO1CQ_1,
|
||||||
&pInfo->
|
&pInfo->
|
||||||
reg[MT2063_REG_LO1CQ_1], 3);
|
reg[MT2063_REG_LO1CQ_1], 3);
|
||||||
@ -3363,8 +3269,7 @@ static u32 MT2063_SetParam(struct MT2063_Info_t *pInfo,
|
|||||||
tmpOneShot =
|
tmpOneShot =
|
||||||
pInfo->reg[MT2063_REG_LO2CQ_3] | 0xE0;
|
pInfo->reg[MT2063_REG_LO2CQ_3] | 0xE0;
|
||||||
status |=
|
status |=
|
||||||
MT2063_WriteSub(pInfo->hUserData,
|
MT2063_WriteSub(pInfo,
|
||||||
pInfo->address,
|
|
||||||
MT2063_REG_LO2CQ_3,
|
MT2063_REG_LO2CQ_3,
|
||||||
&tmpOneShot, 1);
|
&tmpOneShot, 1);
|
||||||
|
|
||||||
@ -3372,8 +3277,7 @@ static u32 MT2063_SetParam(struct MT2063_Info_t *pInfo,
|
|||||||
if (restore) {
|
if (restore) {
|
||||||
/* put previous LO1 queue value back into queue */
|
/* put previous LO1 queue value back into queue */
|
||||||
status |=
|
status |=
|
||||||
MT2063_WriteSub(pInfo->hUserData,
|
MT2063_WriteSub(pInfo,
|
||||||
pInfo->address,
|
|
||||||
MT2063_REG_LO1CQ_1,
|
MT2063_REG_LO1CQ_1,
|
||||||
&(tempLO1CQ[0]), 2);
|
&(tempLO1CQ[0]), 2);
|
||||||
|
|
||||||
@ -3384,7 +3288,7 @@ static u32 MT2063_SetParam(struct MT2063_Info_t *pInfo,
|
|||||||
tempLO1CQ[1];
|
tempLO1CQ[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
MT2063_GetParam(pInfo->hUserData,
|
MT2063_GetParam(pInfo,
|
||||||
MT2063_LO2_FREQ,
|
MT2063_LO2_FREQ,
|
||||||
&pInfo->AS_Data.f_LO2);
|
&pInfo->AS_Data.f_LO2);
|
||||||
}
|
}
|
||||||
@ -3769,25 +3673,22 @@ static u32 MT2063_SetParam(struct MT2063_Info_t *pInfo,
|
|||||||
** 138 06-19-2007 DAD Ver 1.00: Initial, derived from mt2067_b.
|
** 138 06-19-2007 DAD Ver 1.00: Initial, derived from mt2067_b.
|
||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static u32 MT2063_ClearPowerMaskBits(struct MT2063_Info_t *pInfo, enum MT2063_Mask_Bits Bits)
|
static u32 MT2063_ClearPowerMaskBits(struct mt2063_state *pInfo, enum MT2063_Mask_Bits Bits)
|
||||||
{
|
{
|
||||||
u32 status = 0; /* 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)
|
|
||||||
return -ENODEV;
|
|
||||||
Bits = (enum MT2063_Mask_Bits)(Bits & MT2063_ALL_SD); /* Only valid bits for this tuner */
|
Bits = (enum MT2063_Mask_Bits)(Bits & MT2063_ALL_SD); /* Only valid bits for this tuner */
|
||||||
if ((Bits & 0xFF00) != 0) {
|
if ((Bits & 0xFF00) != 0) {
|
||||||
pInfo->reg[MT2063_REG_PWR_2] &= ~(u8) (Bits >> 8);
|
pInfo->reg[MT2063_REG_PWR_2] &= ~(u8) (Bits >> 8);
|
||||||
status |=
|
status |=
|
||||||
MT2063_WriteSub(pInfo->hUserData, pInfo->address,
|
MT2063_WriteSub(pInfo,
|
||||||
MT2063_REG_PWR_2,
|
MT2063_REG_PWR_2,
|
||||||
&pInfo->reg[MT2063_REG_PWR_2], 1);
|
&pInfo->reg[MT2063_REG_PWR_2], 1);
|
||||||
}
|
}
|
||||||
if ((Bits & 0xFF) != 0) {
|
if ((Bits & 0xFF) != 0) {
|
||||||
pInfo->reg[MT2063_REG_PWR_1] &= ~(u8) (Bits & 0xFF);
|
pInfo->reg[MT2063_REG_PWR_1] &= ~(u8) (Bits & 0xFF);
|
||||||
status |=
|
status |=
|
||||||
MT2063_WriteSub(pInfo->hUserData, pInfo->address,
|
MT2063_WriteSub(pInfo,
|
||||||
MT2063_REG_PWR_1,
|
MT2063_REG_PWR_1,
|
||||||
&pInfo->reg[MT2063_REG_PWR_1], 1);
|
&pInfo->reg[MT2063_REG_PWR_1], 1);
|
||||||
}
|
}
|
||||||
@ -3823,20 +3724,17 @@ static u32 MT2063_ClearPowerMaskBits(struct MT2063_Info_t *pInfo, enum MT2063_Ma
|
|||||||
** correct wakeup of the LNA
|
** correct wakeup of the LNA
|
||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static u32 MT2063_SoftwareShutdown(struct MT2063_Info_t *pInfo, u8 Shutdown)
|
static u32 MT2063_SoftwareShutdown(struct mt2063_state *pInfo, u8 Shutdown)
|
||||||
{
|
{
|
||||||
u32 status = 0; /* 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)
|
|
||||||
return -ENODEV;
|
|
||||||
if (Shutdown == 1)
|
if (Shutdown == 1)
|
||||||
pInfo->reg[MT2063_REG_PWR_1] |= 0x04; /* Turn the bit on */
|
pInfo->reg[MT2063_REG_PWR_1] |= 0x04; /* Turn the bit on */
|
||||||
else
|
else
|
||||||
pInfo->reg[MT2063_REG_PWR_1] &= ~0x04; /* Turn off the bit */
|
pInfo->reg[MT2063_REG_PWR_1] &= ~0x04; /* Turn off the bit */
|
||||||
|
|
||||||
status |=
|
status |=
|
||||||
MT2063_WriteSub(pInfo->hUserData, pInfo->address,
|
MT2063_WriteSub(pInfo,
|
||||||
MT2063_REG_PWR_1,
|
MT2063_REG_PWR_1,
|
||||||
&pInfo->reg[MT2063_REG_PWR_1], 1);
|
&pInfo->reg[MT2063_REG_PWR_1], 1);
|
||||||
|
|
||||||
@ -3844,14 +3742,14 @@ static u32 MT2063_SoftwareShutdown(struct MT2063_Info_t *pInfo, u8 Shutdown)
|
|||||||
pInfo->reg[MT2063_REG_BYP_CTRL] =
|
pInfo->reg[MT2063_REG_BYP_CTRL] =
|
||||||
(pInfo->reg[MT2063_REG_BYP_CTRL] & 0x9F) | 0x40;
|
(pInfo->reg[MT2063_REG_BYP_CTRL] & 0x9F) | 0x40;
|
||||||
status |=
|
status |=
|
||||||
MT2063_WriteSub(pInfo->hUserData, pInfo->address,
|
MT2063_WriteSub(pInfo,
|
||||||
MT2063_REG_BYP_CTRL,
|
MT2063_REG_BYP_CTRL,
|
||||||
&pInfo->reg[MT2063_REG_BYP_CTRL],
|
&pInfo->reg[MT2063_REG_BYP_CTRL],
|
||||||
1);
|
1);
|
||||||
pInfo->reg[MT2063_REG_BYP_CTRL] =
|
pInfo->reg[MT2063_REG_BYP_CTRL] =
|
||||||
(pInfo->reg[MT2063_REG_BYP_CTRL] & 0x9F);
|
(pInfo->reg[MT2063_REG_BYP_CTRL] & 0x9F);
|
||||||
status |=
|
status |=
|
||||||
MT2063_WriteSub(pInfo->hUserData, pInfo->address,
|
MT2063_WriteSub(pInfo,
|
||||||
MT2063_REG_BYP_CTRL,
|
MT2063_REG_BYP_CTRL,
|
||||||
&pInfo->reg[MT2063_REG_BYP_CTRL],
|
&pInfo->reg[MT2063_REG_BYP_CTRL],
|
||||||
1);
|
1);
|
||||||
@ -3888,18 +3786,14 @@ static u32 MT2063_SoftwareShutdown(struct MT2063_Info_t *pInfo, u8 Shutdown)
|
|||||||
** 138 06-19-2007 DAD Ver 1.00: Initial, derived from mt2067_b.
|
** 138 06-19-2007 DAD Ver 1.00: Initial, derived from mt2067_b.
|
||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static u32 MT2063_SetReg(struct MT2063_Info_t *pInfo, u8 reg, u8 val)
|
static u32 MT2063_SetReg(struct mt2063_state *pInfo, u8 reg, u8 val)
|
||||||
{
|
{
|
||||||
u32 status = 0; /* 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)
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
if (reg >= MT2063_REG_END_REGS)
|
if (reg >= MT2063_REG_END_REGS)
|
||||||
status |= -ERANGE;
|
status |= -ERANGE;
|
||||||
|
|
||||||
status = MT2063_WriteSub(pInfo->hUserData, pInfo->address, reg, &val,
|
status = MT2063_WriteSub(pInfo, reg, &val,
|
||||||
1);
|
1);
|
||||||
if (status >= 0)
|
if (status >= 0)
|
||||||
pInfo->reg[reg] = val;
|
pInfo->reg[reg] = val;
|
||||||
@ -4063,7 +3957,7 @@ static u32 MT2063_CalcLO2Mult(u32 * Div,
|
|||||||
** cross-over frequency values.
|
** cross-over frequency values.
|
||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static u32 FindClearTuneFilter(struct MT2063_Info_t *pInfo, u32 f_in)
|
static u32 FindClearTuneFilter(struct mt2063_state *pInfo, u32 f_in)
|
||||||
{
|
{
|
||||||
u32 RFBand;
|
u32 RFBand;
|
||||||
u32 idx; /* index loop */
|
u32 idx; /* index loop */
|
||||||
@ -4122,7 +4016,7 @@ static u32 FindClearTuneFilter(struct MT2063_Info_t *pInfo, u32 f_in)
|
|||||||
** 06-24-2008 PINZ Ver 1.18: Add Get/SetParam CTFILT_SW
|
** 06-24-2008 PINZ Ver 1.18: Add Get/SetParam CTFILT_SW
|
||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static u32 MT2063_Tune(struct MT2063_Info_t *pInfo, u32 f_in)
|
static u32 MT2063_Tune(struct mt2063_state *pInfo, u32 f_in)
|
||||||
{ /* RF input center frequency */
|
{ /* RF input center frequency */
|
||||||
|
|
||||||
u32 status = 0; /* status of operation */
|
u32 status = 0; /* status of operation */
|
||||||
@ -4140,10 +4034,6 @@ static u32 MT2063_Tune(struct MT2063_Info_t *pInfo, u32 f_in)
|
|||||||
u8 val;
|
u8 val;
|
||||||
u32 RFBand;
|
u32 RFBand;
|
||||||
|
|
||||||
/* Verify that the handle passed points to a valid tuner */
|
|
||||||
if (MT2063_IsValidHandle(pInfo) == 0)
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
/* Check the input and output frequency ranges */
|
/* Check the input and output frequency ranges */
|
||||||
if ((f_in < MT2063_MIN_FIN_FREQ) || (f_in > MT2063_MAX_FIN_FREQ))
|
if ((f_in < MT2063_MIN_FIN_FREQ) || (f_in > MT2063_MAX_FIN_FREQ))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -4185,7 +4075,7 @@ static u32 MT2063_Tune(struct MT2063_Info_t *pInfo, u32 f_in)
|
|||||||
*/
|
*/
|
||||||
if (status >= 0) {
|
if (status >= 0) {
|
||||||
status |=
|
status |=
|
||||||
MT2063_ReadSub(pInfo->hUserData, pInfo->address,
|
MT2063_ReadSub(pInfo,
|
||||||
MT2063_REG_FIFFC,
|
MT2063_REG_FIFFC,
|
||||||
&pInfo->reg[MT2063_REG_FIFFC], 1);
|
&pInfo->reg[MT2063_REG_FIFFC], 1);
|
||||||
fiffc = pInfo->reg[MT2063_REG_FIFFC];
|
fiffc = pInfo->reg[MT2063_REG_FIFFC];
|
||||||
@ -4288,10 +4178,10 @@ static u32 MT2063_Tune(struct MT2063_Info_t *pInfo, u32 f_in)
|
|||||||
** IMPORTANT: There is a required order for writing
|
** IMPORTANT: There is a required order for writing
|
||||||
** (0x05 must follow all the others).
|
** (0x05 must follow all the others).
|
||||||
*/
|
*/
|
||||||
status |= MT2063_WriteSub(pInfo->hUserData, pInfo->address, MT2063_REG_LO1CQ_1, &pInfo->reg[MT2063_REG_LO1CQ_1], 5); /* 0x01 - 0x05 */
|
status |= MT2063_WriteSub(pInfo, MT2063_REG_LO1CQ_1, &pInfo->reg[MT2063_REG_LO1CQ_1], 5); /* 0x01 - 0x05 */
|
||||||
if (pInfo->tuner_id == MT2063_B0) {
|
if (pInfo->tuner_id == MT2063_B0) {
|
||||||
/* Re-write the one-shot bits to trigger the tune operation */
|
/* Re-write the one-shot bits to trigger the tune operation */
|
||||||
status |= MT2063_WriteSub(pInfo->hUserData, pInfo->address, MT2063_REG_LO2CQ_3, &pInfo->reg[MT2063_REG_LO2CQ_3], 1); /* 0x05 */
|
status |= MT2063_WriteSub(pInfo, MT2063_REG_LO2CQ_3, &pInfo->reg[MT2063_REG_LO2CQ_3], 1); /* 0x05 */
|
||||||
}
|
}
|
||||||
/* Write out the FIFF offset only if it's changing */
|
/* Write out the FIFF offset only if it's changing */
|
||||||
if (pInfo->reg[MT2063_REG_FIFF_OFFSET] !=
|
if (pInfo->reg[MT2063_REG_FIFF_OFFSET] !=
|
||||||
@ -4299,8 +4189,7 @@ static u32 MT2063_Tune(struct MT2063_Info_t *pInfo, u32 f_in)
|
|||||||
pInfo->reg[MT2063_REG_FIFF_OFFSET] =
|
pInfo->reg[MT2063_REG_FIFF_OFFSET] =
|
||||||
(u8) fiffof;
|
(u8) fiffof;
|
||||||
status |=
|
status |=
|
||||||
MT2063_WriteSub(pInfo->hUserData,
|
MT2063_WriteSub(pInfo,
|
||||||
pInfo->address,
|
|
||||||
MT2063_REG_FIFF_OFFSET,
|
MT2063_REG_FIFF_OFFSET,
|
||||||
&pInfo->
|
&pInfo->
|
||||||
reg[MT2063_REG_FIFF_OFFSET],
|
reg[MT2063_REG_FIFF_OFFSET],
|
||||||
@ -4316,7 +4205,7 @@ static u32 MT2063_Tune(struct MT2063_Info_t *pInfo, u32 f_in)
|
|||||||
status |= MT2063_GetLocked(pInfo);
|
status |= MT2063_GetLocked(pInfo);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
** If we locked OK, assign calculated data to MT2063_Info_t structure
|
** If we locked OK, assign calculated data to mt2063_state structure
|
||||||
*/
|
*/
|
||||||
if (status >= 0) {
|
if (status >= 0) {
|
||||||
pInfo->f_IF1_actual = pInfo->AS_Data.f_LO1 - f_in;
|
pInfo->f_IF1_actual = pInfo->AS_Data.f_LO1 - f_in;
|
||||||
@ -4461,9 +4350,9 @@ static int mt2063_init(struct dvb_frontend *fe)
|
|||||||
u32 status = -EINVAL;
|
u32 status = -EINVAL;
|
||||||
struct mt2063_state *state = fe->tuner_priv;
|
struct mt2063_state *state = fe->tuner_priv;
|
||||||
|
|
||||||
status = MT2063_Open(0xC0, &(state->MT2063_ht), fe);
|
status = MT2063_Open(fe);
|
||||||
status |= MT2063_SoftwareShutdown(state->MT2063_ht, 1);
|
status |= MT2063_SoftwareShutdown(state, 1);
|
||||||
status |= MT2063_ClearPowerMaskBits(state->MT2063_ht, MT2063_ALL_SD);
|
status |= MT2063_ClearPowerMaskBits(state, MT2063_ALL_SD);
|
||||||
|
|
||||||
if (0 != status) {
|
if (0 != status) {
|
||||||
printk("%s %d error status = 0x%x!!\n", __func__, __LINE__,
|
printk("%s %d error status = 0x%x!!\n", __func__, __LINE__,
|
||||||
@ -4484,9 +4373,9 @@ static int mt2063_get_status(struct dvb_frontend *fe, u32 * status)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int mt2063_get_state(struct dvb_frontend *fe,
|
static int mt2063_get_state(struct dvb_frontend *fe,
|
||||||
enum tuner_param param, struct tuner_state *state)
|
enum tuner_param param, struct tuner_state *tunstate)
|
||||||
{
|
{
|
||||||
struct mt2063_state *mt2063State = fe->tuner_priv;
|
struct mt2063_state *state = fe->tuner_priv;
|
||||||
|
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case DVBFE_TUNER_FREQUENCY:
|
case DVBFE_TUNER_FREQUENCY:
|
||||||
@ -4500,21 +4389,19 @@ static int mt2063_get_state(struct dvb_frontend *fe,
|
|||||||
//get bandwidth
|
//get bandwidth
|
||||||
break;
|
break;
|
||||||
case DVBFE_TUNER_REFCLOCK:
|
case DVBFE_TUNER_REFCLOCK:
|
||||||
state->refclock =
|
tunstate->refclock = (u32) MT2063_GetLocked(state);
|
||||||
(u32)
|
|
||||||
MT2063_GetLocked((void *) (mt2063State->MT2063_ht));
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int)state->refclock;
|
return (int)tunstate->refclock;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mt2063_set_state(struct dvb_frontend *fe,
|
static int mt2063_set_state(struct dvb_frontend *fe,
|
||||||
enum tuner_param param, struct tuner_state *state)
|
enum tuner_param param, struct tuner_state *tunstate)
|
||||||
{
|
{
|
||||||
struct mt2063_state *mt2063State = fe->tuner_priv;
|
struct mt2063_state *state = fe->tuner_priv;
|
||||||
u32 status = 0;
|
u32 status = 0;
|
||||||
|
|
||||||
switch (param) {
|
switch (param) {
|
||||||
@ -4522,11 +4409,11 @@ static int mt2063_set_state(struct dvb_frontend *fe,
|
|||||||
//set frequency
|
//set frequency
|
||||||
|
|
||||||
status =
|
status =
|
||||||
MT_Tune_atv((void *) (mt2063State->MT2063_ht),
|
MT_Tune_atv(state,
|
||||||
state->frequency, state->bandwidth,
|
tunstate->frequency, tunstate->bandwidth,
|
||||||
mt2063State->tv_type);
|
state->tv_type);
|
||||||
|
|
||||||
mt2063State->frequency = state->frequency;
|
state->frequency = tunstate->frequency;
|
||||||
break;
|
break;
|
||||||
case DVBFE_TUNER_TUNERSTEP:
|
case DVBFE_TUNER_TUNERSTEP:
|
||||||
break;
|
break;
|
||||||
@ -4534,20 +4421,20 @@ static int mt2063_set_state(struct dvb_frontend *fe,
|
|||||||
break;
|
break;
|
||||||
case DVBFE_TUNER_BANDWIDTH:
|
case DVBFE_TUNER_BANDWIDTH:
|
||||||
//set bandwidth
|
//set bandwidth
|
||||||
mt2063State->bandwidth = state->bandwidth;
|
state->bandwidth = tunstate->bandwidth;
|
||||||
break;
|
break;
|
||||||
case DVBFE_TUNER_REFCLOCK:
|
case DVBFE_TUNER_REFCLOCK:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case DVBFE_TUNER_OPEN:
|
case DVBFE_TUNER_OPEN:
|
||||||
status = MT2063_Open(MT2063_I2C, &(mt2063State->MT2063_ht), fe);
|
status = MT2063_Open(fe);
|
||||||
break;
|
break;
|
||||||
case DVBFE_TUNER_SOFTWARE_SHUTDOWN:
|
case DVBFE_TUNER_SOFTWARE_SHUTDOWN:
|
||||||
status = MT2063_SoftwareShutdown(mt2063State->MT2063_ht, 1);
|
status = MT2063_SoftwareShutdown(state, 1);
|
||||||
break;
|
break;
|
||||||
case DVBFE_TUNER_CLEAR_POWER_MASKBITS:
|
case DVBFE_TUNER_CLEAR_POWER_MASKBITS:
|
||||||
status =
|
status =
|
||||||
MT2063_ClearPowerMaskBits(mt2063State->MT2063_ht,
|
MT2063_ClearPowerMaskBits(state,
|
||||||
MT2063_ALL_SD);
|
MT2063_ALL_SD);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user