Release 4.11 drivers/media/usb/dvb-usb/dtt200u-fe.c
/* Frontend part of the Linux driver for the WideView/ Yakumo/ Hama/
* Typhoon/ Yuan DVB-T USB2.0 receiver.
*
* Copyright (C) 2005 Patrick Boettcher <patrick.boettcher@posteo.de>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 2.
*
* see Documentation/dvb/README.dvb-usb for more information
*/
#include "dtt200u.h"
struct dtt200u_fe_state {
struct dvb_usb_device *d;
enum fe_status stat;
struct dtv_frontend_properties fep;
struct dvb_frontend frontend;
unsigned char data[80];
struct mutex data_mutex;
};
static int dtt200u_fe_read_status(struct dvb_frontend *fe,
enum fe_status *stat)
{
struct dtt200u_fe_state *state = fe->demodulator_priv;
int ret;
mutex_lock(&state->data_mutex);
state->data[0] = GET_TUNE_STATUS;
ret = dvb_usb_generic_rw(state->d, state->data, 1, state->data, 3, 0);
if (ret < 0) {
*stat = 0;
mutex_unlock(&state->data_mutex);
return ret;
}
switch (state->data[0]) {
case 0x01:
*stat = FE_HAS_SIGNAL | FE_HAS_CARRIER |
FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK;
break;
case 0x00: /* pending */
*stat = FE_TIMEDOUT; /* during set_frontend */
break;
default:
case 0x02: /* failed */
*stat = 0;
break;
}
mutex_unlock(&state->data_mutex);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Stezenbach | 79 | 51.63% | 1 | 20.00% |
Mauro Carvalho Chehab | 63 | 41.18% | 3 | 60.00% |
Patrick Boettcher | 11 | 7.19% | 1 | 20.00% |
Total | 153 | 100.00% | 5 | 100.00% |
static int dtt200u_fe_read_ber(struct dvb_frontend* fe, u32 *ber)
{
struct dtt200u_fe_state *state = fe->demodulator_priv;
int ret;
mutex_lock(&state->data_mutex);
state->data[0] = GET_VIT_ERR_CNT;
ret = dvb_usb_generic_rw(state->d, state->data, 1, state->data, 3, 0);
if (ret >= 0)
*ber = (state->data[0] << 16) | (state->data[1] << 8) | state->data[2];
mutex_unlock(&state->data_mutex);
return ret;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Mauro Carvalho Chehab | 50 | 43.10% | 2 | 50.00% |
Johannes Stezenbach | 41 | 35.34% | 1 | 25.00% |
Patrick Boettcher | 25 | 21.55% | 1 | 25.00% |
Total | 116 | 100.00% | 4 | 100.00% |
static int dtt200u_fe_read_unc_blocks(struct dvb_frontend* fe, u32 *unc)
{
struct dtt200u_fe_state *state = fe->demodulator_priv;
int ret;
mutex_lock(&state->data_mutex);
state->data[0] = GET_RS_UNCOR_BLK_CNT;
ret = dvb_usb_generic_rw(state->d, state->data, 1, state->data, 2, 0);
if (ret >= 0)
*unc = (state->data[0] << 8) | state->data[1];
mutex_unlock(&state->data_mutex);
return ret;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Mauro Carvalho Chehab | 61 | 58.10% | 2 | 50.00% |
Johannes Stezenbach | 40 | 38.10% | 1 | 25.00% |
Patrick Boettcher | 4 | 3.81% | 1 | 25.00% |
Total | 105 | 100.00% | 4 | 100.00% |
static int dtt200u_fe_read_signal_strength(struct dvb_frontend* fe, u16 *strength)
{
struct dtt200u_fe_state *state = fe->demodulator_priv;
int ret;
mutex_lock(&state->data_mutex);
state->data[0] = GET_AGC;
ret = dvb_usb_generic_rw(state->d, state->data, 1, state->data, 1, 0);
if (ret >= 0)
*strength = (state->data[0] << 8) | state->data[0];
mutex_unlock(&state->data_mutex);
return ret;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Mauro Carvalho Chehab | 62 | 59.05% | 2 | 50.00% |
Johannes Stezenbach | 42 | 40.00% | 1 | 25.00% |
Patrick Boettcher | 1 | 0.95% | 1 | 25.00% |
Total | 105 | 100.00% | 4 | 100.00% |
static int dtt200u_fe_read_snr(struct dvb_frontend* fe, u16 *snr)
{
struct dtt200u_fe_state *state = fe->demodulator_priv;
int ret;
mutex_lock(&state->data_mutex);
state->data[0] = GET_SNR;
ret = dvb_usb_generic_rw(state->d, state->data, 1, state->data, 1, 0);
if (ret >= 0)
*snr = ~((state->data[0] << 8) | state->data[0]);
mutex_unlock(&state->data_mutex);
return ret;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Mauro Carvalho Chehab | 65 | 60.19% | 2 | 66.67% |
Johannes Stezenbach | 43 | 39.81% | 1 | 33.33% |
Total | 108 | 100.00% | 3 | 100.00% |
static int dtt200u_fe_init(struct dvb_frontend* fe)
{
struct dtt200u_fe_state *state = fe->demodulator_priv;
int ret;
mutex_lock(&state->data_mutex);
state->data[0] = SET_INIT;
ret = dvb_usb_generic_write(state->d, state->data, 1);
mutex_unlock(&state->data_mutex);
return ret;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Mauro Carvalho Chehab | 35 | 53.03% | 1 | 50.00% |
Johannes Stezenbach | 31 | 46.97% | 1 | 50.00% |
Total | 66 | 100.00% | 2 | 100.00% |
static int dtt200u_fe_sleep(struct dvb_frontend* fe)
{
return dtt200u_fe_init(fe);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Stezenbach | 17 | 100.00% | 1 | 100.00% |
Total | 17 | 100.00% | 1 | 100.00% |
static int dtt200u_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune)
{
tune->min_delay_ms = 1500;
tune->step_size = 0;
tune->max_drift = 0;
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Stezenbach | 35 | 94.59% | 1 | 50.00% |
Patrick Boettcher | 2 | 5.41% | 1 | 50.00% |
Total | 37 | 100.00% | 2 | 100.00% |
static int dtt200u_fe_set_frontend(struct dvb_frontend *fe)
{
struct dtv_frontend_properties *fep = &fe->dtv_property_cache;
struct dtt200u_fe_state *state = fe->demodulator_priv;
int ret;
u16 freq = fep->frequency / 250000;
mutex_lock(&state->data_mutex);
state->data[0] = SET_BANDWIDTH;
switch (fep->bandwidth_hz) {
case 8000000:
state->data[1] = 8;
break;
case 7000000:
state->data[1] = 7;
break;
case 6000000:
state->data[1] = 6;
break;
default:
ret = -EINVAL;
goto ret;
}
ret = dvb_usb_generic_write(state->d, state->data, 2);
if (ret < 0)
goto ret;
state->data[0] = SET_RF_FREQ;
state->data[1] = freq & 0xff;
state->data[2] = (freq >> 8) & 0xff;
ret = dvb_usb_generic_write(state->d, state->data, 3);
if (ret < 0)
goto ret;
ret:
mutex_unlock(&state->data_mutex);
return ret;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Stezenbach | 103 | 48.82% | 1 | 20.00% |
Mauro Carvalho Chehab | 99 | 46.92% | 3 | 60.00% |
Patrick Boettcher | 9 | 4.27% | 1 | 20.00% |
Total | 211 | 100.00% | 5 | 100.00% |
static int dtt200u_fe_get_frontend(struct dvb_frontend* fe,
struct dtv_frontend_properties *fep)
{
struct dtt200u_fe_state *state = fe->demodulator_priv;
memcpy(fep, &state->fep, sizeof(struct dtv_frontend_properties));
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Stezenbach | 39 | 88.64% | 1 | 33.33% |
Mauro Carvalho Chehab | 5 | 11.36% | 2 | 66.67% |
Total | 44 | 100.00% | 3 | 100.00% |
static void dtt200u_fe_release(struct dvb_frontend* fe)
{
struct dtt200u_fe_state *state = (struct dtt200u_fe_state*) fe->demodulator_priv;
kfree(state);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Stezenbach | 30 | 100.00% | 1 | 100.00% |
Total | 30 | 100.00% | 1 | 100.00% |
static const struct dvb_frontend_ops dtt200u_fe_ops;
struct dvb_frontend* dtt200u_fe_attach(struct dvb_usb_device *d)
{
struct dtt200u_fe_state* state = NULL;
/* allocate memory for the internal state */
state = kzalloc(sizeof(struct dtt200u_fe_state), GFP_KERNEL);
if (state == NULL)
goto error;
deb_info("attaching frontend dtt200u\n");
state->d = d;
mutex_init(&state->data_mutex);
memcpy(&state->frontend.ops,&dtt200u_fe_ops,sizeof(struct dvb_frontend_ops));
state->frontend.demodulator_priv = state;
return &state->frontend;
error:
return NULL;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Stezenbach | 66 | 66.67% | 1 | 16.67% |
Ye Jianjun (Joey | 17 | 17.17% | 1 | 16.67% |
Mauro Carvalho Chehab | 8 | 8.08% | 1 | 16.67% |
Trent Piepho | 5 | 5.05% | 1 | 16.67% |
Patrick Boettcher | 2 | 2.02% | 1 | 16.67% |
Panagiotis Issaris | 1 | 1.01% | 1 | 16.67% |
Total | 99 | 100.00% | 6 | 100.00% |
static const struct dvb_frontend_ops dtt200u_fe_ops = {
.delsys = { SYS_DVBT },
.info = {
.name = "WideView USB DVB-T",
.frequency_min = 44250000,
.frequency_max = 867250000,
.frequency_stepsize = 250000,
.caps = FE_CAN_INVERSION_AUTO |
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_RECOVER |
FE_CAN_HIERARCHY_AUTO,
},
.release = dtt200u_fe_release,
.init = dtt200u_fe_init,
.sleep = dtt200u_fe_sleep,
.set_frontend = dtt200u_fe_set_frontend,
.get_frontend = dtt200u_fe_get_frontend,
.get_tune_settings = dtt200u_fe_get_tune_settings,
.read_status = dtt200u_fe_read_status,
.read_ber = dtt200u_fe_read_ber,
.read_signal_strength = dtt200u_fe_read_signal_strength,
.read_snr = dtt200u_fe_read_snr,
.read_ucblocks = dtt200u_fe_read_unc_blocks,
};
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Stezenbach | 708 | 56.10% | 1 | 7.69% |
Mauro Carvalho Chehab | 471 | 37.32% | 5 | 38.46% |
Patrick Boettcher | 58 | 4.60% | 3 | 23.08% |
Ye Jianjun (Joey | 17 | 1.35% | 1 | 7.69% |
Trent Piepho | 5 | 0.40% | 1 | 7.69% |
Max Kellermann | 2 | 0.16% | 1 | 7.69% |
Panagiotis Issaris | 1 | 0.08% | 1 | 7.69% |
Total | 1262 | 100.00% | 13 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.