summaryrefslogtreecommitdiff
path: root/linux/drivers/media
diff options
context:
space:
mode:
authorPatrick Boettcher <devnull@localhost>2004-10-11 13:33:38 +0000
committerPatrick Boettcher <devnull@localhost>2004-10-11 13:33:38 +0000
commit2a23d67a809e682a55bf6d5e2a9955956ee53106 (patch)
tree1fa0cc9bcf9ef354cb44be2b607d9e0cc0bb8c50 /linux/drivers/media
parentafef69a0081705ef086e54df10c1c53a71c6c07a (diff)
downloadmediapointer-dvb-s2-2a23d67a809e682a55bf6d5e2a9955956ee53106.tar.gz
mediapointer-dvb-s2-2a23d67a809e682a55bf6d5e2a9955956ee53106.tar.bz2
merged some of the changes Andreas Oberritter did in FE_REFACTORING to HEAD
Diffstat (limited to 'linux/drivers/media')
-rw-r--r--linux/drivers/media/dvb/frontends/dib3000mb.c77
1 files changed, 42 insertions, 35 deletions
diff --git a/linux/drivers/media/dvb/frontends/dib3000mb.c b/linux/drivers/media/dvb/frontends/dib3000mb.c
index 04f3aa609..2b67465fa 100644
--- a/linux/drivers/media/dvb/frontends/dib3000mb.c
+++ b/linux/drivers/media/dvb/frontends/dib3000mb.c
@@ -17,7 +17,7 @@
* Amaury Demol (ademol@dibcom.fr) from DiBcom for providing specs and driver
* sources, on which this driver (and the dvb-dibusb) are based.
*
- * $Id: dib3000mb.c,v 1.9 2004/10/04 13:42:08 pmp Exp $
+ * $Id: dib3000mb.c,v 1.10 2004/10/11 13:33:38 pmp Exp $
*
* see Documentation/dvb/README.dibusb for more information
*
@@ -67,7 +67,7 @@ struct dib3000mb_state {
};
static struct dvb_frontend_info dib3000mb_info = {
- .name = "DiBcom 3000-MB DVB-T frontend",
+ .name = "DiBcom 3000-MB DVB-T",
.type = FE_OFDM,
.frequency_min = 44250000,
.frequency_max = 867250000,
@@ -76,8 +76,8 @@ static struct dvb_frontend_info dib3000mb_info = {
FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO |
FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO |
- FE_CAN_TRANSMISSION_MODE_AUTO |
FE_CAN_GUARD_INTERVAL_AUTO |
+ FE_CAN_TRANSMISSION_MODE_AUTO |
FE_CAN_HIERARCHY_AUTO,
};
@@ -153,7 +153,7 @@ static int dib3000mb_get_frontend(struct dib3000mb_state *state,
u32 dds_val, threshold = 0x800000;
if (!rd(DIB3000MB_REG_TPS_LOCK))
- return -EINVAL;
+ return 0;
dds_val = ((rd(DIB3000MB_REG_DDS_VALUE_MSB) & 0xff) << 16) + rd(DIB3000MB_REG_DDS_VALUE_LSB);
if (dds_val & threshold)
@@ -349,7 +349,6 @@ static int dib3000mb_set_frontend(struct dib3000mb_state *state,
deb_setf("bandwidth: ");
switch (ofdm->bandwidth) {
case BANDWIDTH_8_MHZ:
- case BANDWIDTH_AUTO:
deb_setf("8 MHz\n");
wr_foreach(dib3000mb_reg_timing_freq,dib3000mb_timing_freq[2]);
wr_foreach(dib3000mb_reg_bandwidth,dib3000mb_bandwidth_8mhz);
@@ -364,10 +363,11 @@ static int dib3000mb_set_frontend(struct dib3000mb_state *state,
wr_foreach(dib3000mb_reg_timing_freq,dib3000mb_timing_freq[0]);
wr_foreach(dib3000mb_reg_bandwidth,dib3000mb_bandwidth_6mhz);
break;
+ case BANDWIDTH_AUTO:
+ return -EOPNOTSUPP;
default:
err("unkown bandwidth value.");
return -EINVAL;
- break;
}
}
wr(DIB3000MB_REG_LOCK1_MASK,DIB3000MB_LOCK1_SEARCH_4);
@@ -418,12 +418,13 @@ static int dib3000mb_set_frontend(struct dib3000mb_state *state,
deb_setf("invsersion: ");
switch (fep->inversion) {
+ case INVERSION_AUTO:
+ deb_setf("auto\n");
+ break;
case INVERSION_OFF:
deb_setf("on\n");
wr(DIB3000MB_REG_DDS_INV,DIB3000MB_DDS_INV_OFF);
break;
- case INVERSION_AUTO:
- deb_setf("auto ");
case INVERSION_ON:
deb_setf("on\n");
wr(DIB3000MB_REG_DDS_INV,DIB3000MB_DDS_INV_ON);
@@ -454,7 +455,8 @@ static int dib3000mb_set_frontend(struct dib3000mb_state *state,
deb_setf("hierachy: ");
switch (ofdm->hierarchy_information) {
case HIERARCHY_NONE:
- deb_setf("none ");
+ deb_setf("none ");
+ /* fall through alpha is 1, even when HIERARCHY is NONE */
case HIERARCHY_1:
deb_setf("alpha=1\n");
wr(DIB3000MB_REG_VIT_ALPHA,DIB3000MB_VIT_ALPHA_1);
@@ -663,11 +665,15 @@ static int dib3000mb_fe_init(struct dib3000mb_state *state,int mobile_mode)
static int dib3000mb_read_status(struct dib3000mb_state *state,fe_status_t *stat)
{
*stat = 0;
- *stat |= rd(DIB3000MB_REG_AGC_LOCK) ? FE_HAS_SIGNAL : 0;
- *stat |= rd(DIB3000MB_REG_CARRIER_LOCK) ? FE_HAS_CARRIER : 0;
- *stat |= rd(DIB3000MB_REG_VIT_LCK) ? FE_HAS_VITERBI : 0;
- *stat |= rd(DIB3000MB_REG_TS_SYNC_LOCK) ? FE_HAS_SYNC : 0;
- *stat |= *stat & FE_HAS_SYNC ? FE_HAS_LOCK : 0;
+
+ if (rd(DIB3000MB_REG_AGC_LOCK))
+ *stat |= FE_HAS_SIGNAL;
+ if (rd(DIB3000MB_REG_CARRIER_LOCK))
+ *stat |= FE_HAS_CARRIER;
+ if (rd(DIB3000MB_REG_VIT_LCK))
+ *stat |= FE_HAS_VITERBI;
+ if (rd(DIB3000MB_REG_TS_SYNC_LOCK))
+ *stat |= (FE_HAS_SYNC | FE_HAS_LOCK);
deb_info("actual status is %2x\n",*stat);
@@ -695,8 +701,7 @@ static int dib3000mb_read_status(struct dib3000mb_state *state,fe_status_t *stat
static int dib3000mb_read_ber(struct dib3000mb_state *state,u32 *ber)
{
- *ber =
- ((rd(DIB3000MB_REG_BER_MSB) << 16) | rd(DIB3000MB_REG_BER_LSB) );
+ *ber = ((rd(DIB3000MB_REG_BER_MSB) << 16) | rd(DIB3000MB_REG_BER_LSB) );
return 0;
}
/*
@@ -784,72 +789,71 @@ static int dib3000mb_fe_get_tune_settings(struct dib3000mb_state *state,
return 0;
}
-
static int dib3000mb_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg)
{
struct dib3000mb_state *state = fe->data;
- int ret = 0;
switch (cmd) {
case FE_GET_INFO:
deb_info("FE_GET_INFO\n");
memcpy(arg, &dib3000mb_info, sizeof(struct dvb_frontend_info));
+ return 0;
break;
case FE_READ_STATUS:
deb_info("FE_READ_STATUS\n");
- ret = dib3000mb_read_status(state,(fe_status_t *)arg);
+ return dib3000mb_read_status(state,(fe_status_t *)arg);
break;
case FE_READ_BER:
deb_info("FE_READ_BER\n");
- ret = dib3000mb_read_ber(state,(u32 *)arg);
+ return dib3000mb_read_ber(state,(u32 *)arg);
break;
case FE_READ_SIGNAL_STRENGTH:
deb_info("FE_READ_SIG_STRENGTH\n");
- ret = dib3000mb_read_signal_strength(state,(u16 *) arg);
+ return dib3000mb_read_signal_strength(state,(u16 *) arg);
break;
case FE_READ_SNR:
deb_info("FE_READ_SNR\n");
- ret = dib3000mb_read_snr(state,(u16 *) arg);
+ return dib3000mb_read_snr(state,(u16 *) arg);
break;
case FE_READ_UNCORRECTED_BLOCKS:
deb_info("FE_READ_UNCORRECTED_BLOCKS\n");
- ret = dib3000mb_read_unc_blocks(state,(u32 *) arg);
+ return dib3000mb_read_unc_blocks(state,(u32 *) arg);
break;
case FE_SET_FRONTEND:
deb_info("FE_SET_FRONTEND\n");
- ret = dib3000mb_set_frontend(state,(struct dvb_frontend_parameters *) arg,1);
+ return dib3000mb_set_frontend(state,(struct dvb_frontend_parameters *) arg,1);
break;
case FE_GET_FRONTEND:
deb_info("FE_GET_FRONTEND\n");
- ret = dib3000mb_get_frontend(state,(struct dvb_frontend_parameters *) arg);
+ return dib3000mb_get_frontend(state,(struct dvb_frontend_parameters *) arg);
break;
case FE_SLEEP:
deb_info("FE_SLEEP\n");
- ret = dib3000mb_sleep(state);
+ return dib3000mb_sleep(state);
break;
case FE_INIT:
deb_info("FE_INIT\n");
- ret = dib3000mb_fe_init(state,0);
+ return dib3000mb_fe_init(state,0);
break;
case FE_GET_TUNE_SETTINGS:
deb_info("GET_TUNE_SETTINGS");
- ret = dib3000mb_fe_get_tune_settings(state, (struct
+ return dib3000mb_fe_get_tune_settings(state, (struct
dvb_frontend_tune_settings *) arg);
break;
case FE_SET_TONE:
case FE_SET_VOLTAGE:
default:
- ret = -EOPNOTSUPP;
+ return -EOPNOTSUPP;
break;
}
return 0;
@@ -881,15 +885,19 @@ static int dib3000mb_attach_adapter(struct i2c_adapter *adapter)
i2c_set_clientdata(client,state);
state->manufactor_id = dib3000mb_read_reg(client, DIB3000MB_REG_MANUFACTOR_ID);
+ if (state->manufactor_id != 0x01b3) {
+ ret = -ENODEV;
+ goto probe_err;
+ }
+
state->device_id = dib3000mb_read_reg(client,DIB3000MB_REG_DEVICE_ID);
- if (state->manufactor_id == 0x01b3 && state->device_id == 0x3000)
- info("found a DiBCom (0x%04x) 3000-MB DVB-T frontend (ver: %x).",
- state->manufactor_id, state->device_id);
- else {
- err("did not found a DiBCom 3000-MB.");
+ if (state->device_id == 0x3000) {
ret = -ENODEV;
goto probe_err;
}
+
+ info("found a DiBCom (0x%04x) 3000-MB DVB-T frontend (ver: %x).",
+ state->manufactor_id, state->device_id);
if ((ret = i2c_attach_client(client)))
goto i2c_attach_err;
@@ -901,7 +909,6 @@ static int dib3000mb_attach_adapter(struct i2c_adapter *adapter)
&dib3000mb_info, THIS_MODULE)))
goto dvb_fe_err;
-
goto success;
dvb_fe_err:
i2c_detach_client(client);