Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 285499
b: refs/heads/master
c: a689e36
h: refs/heads/master
i:
  285497: 937f58f
  285495: 54ce632
v: v3
  • Loading branch information
Mauro Carvalho Chehab committed Dec 31, 2011
1 parent 7865389 commit 2f9f798
Show file tree
Hide file tree
Showing 63 changed files with 157 additions and 100 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bc9cd2736b34619b58961d506210fe0e6dfaa27d
refs/heads/master: a689e3657d7e82c2271008553c709fc79fb2e038
8 changes: 4 additions & 4 deletions trunk/drivers/media/dvb/bt8xx/dst.c
Original file line number Diff line number Diff line change
Expand Up @@ -1778,7 +1778,7 @@ static struct dvb_frontend_ops dst_dvbt_ops = {
.init = dst_init,
.tune = dst_tune_frontend,
.set_frontend_legacy = dst_set_frontend,
.get_frontend = dst_get_frontend,
.get_frontend_legacy = dst_get_frontend,
.get_frontend_algo = dst_get_tuning_algo,
.read_status = dst_read_status,
.read_signal_strength = dst_read_signal_strength,
Expand All @@ -1804,7 +1804,7 @@ static struct dvb_frontend_ops dst_dvbs_ops = {
.init = dst_init,
.tune = dst_tune_frontend,
.set_frontend_legacy = dst_set_frontend,
.get_frontend = dst_get_frontend,
.get_frontend_legacy = dst_get_frontend,
.get_frontend_algo = dst_get_tuning_algo,
.read_status = dst_read_status,
.read_signal_strength = dst_read_signal_strength,
Expand Down Expand Up @@ -1838,7 +1838,7 @@ static struct dvb_frontend_ops dst_dvbc_ops = {
.init = dst_init,
.tune = dst_tune_frontend,
.set_frontend_legacy = dst_set_frontend,
.get_frontend = dst_get_frontend,
.get_frontend_legacy = dst_get_frontend,
.get_frontend_algo = dst_get_tuning_algo,
.read_status = dst_read_status,
.read_signal_strength = dst_read_signal_strength,
Expand All @@ -1861,7 +1861,7 @@ static struct dvb_frontend_ops dst_atsc_ops = {
.init = dst_init,
.tune = dst_tune_frontend,
.set_frontend_legacy = dst_set_frontend,
.get_frontend = dst_get_frontend,
.get_frontend_legacy = dst_get_frontend,
.get_frontend_algo = dst_get_tuning_algo,
.read_status = dst_read_status,
.read_signal_strength = dst_read_signal_strength,
Expand Down
102 changes: 78 additions & 24 deletions trunk/drivers/media/dvb/dvb-core/dvb_frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ struct dvb_frontend_private {
};

static void dvb_frontend_wakeup(struct dvb_frontend *fe);
static int dtv_get_frontend(struct dvb_frontend *fe,
struct dtv_frontend_properties *c,
struct dvb_frontend_parameters *p_out);

static bool has_get_frontend(struct dvb_frontend *fe)
{
return fe->ops.get_frontend || fe->ops.get_frontend_legacy;
}

static void dvb_frontend_add_event(struct dvb_frontend *fe, fe_status_t status)
{
Expand All @@ -149,8 +157,8 @@ static void dvb_frontend_add_event(struct dvb_frontend *fe, fe_status_t status)

dprintk ("%s\n", __func__);

if ((status & FE_HAS_LOCK) && fe->ops.get_frontend)
fe->ops.get_frontend(fe, &fepriv->parameters_out);
if ((status & FE_HAS_LOCK) && has_get_frontend(fe))
dtv_get_frontend(fe, NULL, &fepriv->parameters_out);

mutex_lock(&events->mtx);

Expand Down Expand Up @@ -1097,11 +1105,10 @@ static void dtv_property_cache_sync(struct dvb_frontend *fe,
/* Ensure the cached values are set correctly in the frontend
* legacy tuning structures, for the advanced tuning API.
*/
static void dtv_property_legacy_params_sync(struct dvb_frontend *fe)
static void dtv_property_legacy_params_sync(struct dvb_frontend *fe,
struct dvb_frontend_parameters *p)
{
const struct dtv_frontend_properties *c = &fe->dtv_property_cache;
struct dvb_frontend_private *fepriv = fe->frontend_priv;
struct dvb_frontend_parameters *p = &fepriv->parameters_in;

p->frequency = c->frequency;
p->inversion = c->inversion;
Expand Down Expand Up @@ -1223,6 +1230,7 @@ static void dtv_property_adv_params_sync(struct dvb_frontend *fe)
static void dtv_property_cache_submit(struct dvb_frontend *fe)
{
const struct dtv_frontend_properties *c = &fe->dtv_property_cache;
struct dvb_frontend_private *fepriv = fe->frontend_priv;

/* For legacy delivery systems we don't need the delivery_system to
* be specified, but we populate the older structures from the cache
Expand All @@ -1231,7 +1239,7 @@ static void dtv_property_cache_submit(struct dvb_frontend *fe)
if(is_legacy_delivery_system(c->delivery_system)) {

dprintk("%s() legacy, modulation = %d\n", __func__, c->modulation);
dtv_property_legacy_params_sync(fe);
dtv_property_legacy_params_sync(fe, &fepriv->parameters_in);

} else {
dprintk("%s() adv, modulation = %d\n", __func__, c->modulation);
Expand All @@ -1246,6 +1254,58 @@ static void dtv_property_cache_submit(struct dvb_frontend *fe)
}
}

/**
* dtv_get_frontend - calls a callback for retrieving DTV parameters
* @fe: struct dvb_frontend pointer
* @c: struct dtv_frontend_properties pointer (DVBv5 cache)
* @p_out struct dvb_frontend_parameters pointer (DVBv3 FE struct)
*
* This routine calls either the DVBv3 or DVBv5 get_frontend call.
* If c is not null, it will update the DVBv5 cache struct pointed by it.
* If p_out is not null, it will update the DVBv3 params pointed by it.
*/
static int dtv_get_frontend(struct dvb_frontend *fe,
struct dtv_frontend_properties *c,
struct dvb_frontend_parameters *p_out)
{
const struct dtv_frontend_properties *cache = &fe->dtv_property_cache;
struct dtv_frontend_properties tmp_cache;
struct dvb_frontend_parameters tmp_out;
bool fill_cache = (c != NULL);
bool fill_params = (p_out != NULL);
int r;

if (!p_out)
p_out = &tmp_out;

if (!c)
c = &tmp_cache;
else
memcpy(c, cache, sizeof(*c));

/* Then try the DVBv5 one */
if (fe->ops.get_frontend) {
r = fe->ops.get_frontend(fe, c);
if (unlikely(r < 0))
return r;
if (fill_params)
dtv_property_legacy_params_sync(fe, p_out);
return 0;
}

/* As no DVBv5 call exists, use the DVBv3 one */
if (fe->ops.get_frontend_legacy) {
r = fe->ops.get_frontend_legacy(fe, p_out);
if (unlikely(r < 0))
return r;
if (fill_cache)
dtv_property_cache_sync(fe, c, p_out);
return 0;
}

return -EOPNOTSUPP;
}

static int dvb_frontend_ioctl_legacy(struct file *file,
unsigned int cmd, void *parg);
static int dvb_frontend_ioctl_properties(struct file *file,
Expand Down Expand Up @@ -1296,24 +1356,12 @@ static void dtv_set_default_delivery_caps(const struct dvb_frontend *fe, struct
}

static int dtv_property_process_get(struct dvb_frontend *fe,
const struct dtv_frontend_properties *c,
struct dtv_property *tvp,
struct file *file)
{
const struct dtv_frontend_properties *c = &fe->dtv_property_cache;
struct dvb_frontend_private *fepriv = fe->frontend_priv;
struct dtv_frontend_properties cdetected;
int r;

/*
* If the driver implements a get_frontend function, then convert
* detected parameters to S2API properties.
*/
if (fe->ops.get_frontend) {
cdetected = *c;
dtv_property_cache_sync(fe, &cdetected, &fepriv->parameters_out);
c = &cdetected;
}

switch(tvp->cmd) {
case DTV_ENUM_DELSYS:
dtv_set_default_delivery_caps(fe, tvp);
Expand Down Expand Up @@ -1685,6 +1733,7 @@ static int dvb_frontend_ioctl_properties(struct file *file,

} else
if(cmd == FE_GET_PROPERTY) {
struct dtv_frontend_properties cache_out;

tvps = (struct dtv_properties __user *)parg;

Expand All @@ -1707,8 +1756,13 @@ static int dvb_frontend_ioctl_properties(struct file *file,
goto out;
}

/*
* Fills the cache out struct with the cache contents, plus
* the data retrieved from get_frontend/get_frontend_legacy.
*/
dtv_get_frontend(fe, &cache_out, NULL);
for (i = 0; i < tvps->num; i++) {
err = dtv_property_process_get(fe, tvp + i, file);
err = dtv_property_process_get(fe, &cache_out, tvp + i, file);
if (err < 0)
goto out;
(tvp + i)->result = err;
Expand Down Expand Up @@ -2008,10 +2062,10 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
break;

case FE_GET_FRONTEND:
if (fe->ops.get_frontend) {
err = fe->ops.get_frontend(fe, &fepriv->parameters_out);
memcpy(parg, &fepriv->parameters_out, sizeof(struct dvb_frontend_parameters));
}
err = dtv_get_frontend(fe, NULL, &fepriv->parameters_out);
if (err >= 0)
memcpy(parg, &fepriv->parameters_out,
sizeof(struct dvb_frontend_parameters));
break;

case FE_SET_FRONTEND_TUNE_MODE:
Expand Down
5 changes: 4 additions & 1 deletion trunk/drivers/media/dvb/dvb-core/dvb_frontend.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ struct analog_demod_ops {
int (*set_config)(struct dvb_frontend *fe, void *priv_cfg);
};

struct dtv_frontend_properties;

struct dvb_frontend_ops {

struct dvb_frontend_info info;
Expand Down Expand Up @@ -284,7 +286,8 @@ struct dvb_frontend_ops {
int (*set_frontend)(struct dvb_frontend *fe);
int (*get_tune_settings)(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* settings);

int (*get_frontend)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
int (*get_frontend_legacy)(struct dvb_frontend *fe, struct dvb_frontend_parameters *params);
int (*get_frontend)(struct dvb_frontend *fe, struct dtv_frontend_properties *props);

int (*read_status)(struct dvb_frontend* fe, fe_status_t* status);
int (*read_ber)(struct dvb_frontend* fe, u32* ber);
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/media/dvb/dvb-usb/af9005-fe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ static int af9005_fe_get_frontend(struct dvb_frontend *fe,
&temp);
if (ret)
return ret;
deb_info("===== fe_get_frontend ==============\n");
deb_info("===== fe_get_frontend_legacy = =============\n");
deb_info("CONSTELLATION ");
switch (temp) {
case 0:
Expand Down Expand Up @@ -1476,7 +1476,7 @@ static struct dvb_frontend_ops af9005_fe_ops = {
.ts_bus_ctrl = af9005_ts_bus_ctrl,

.set_frontend_legacy = af9005_fe_set_frontend,
.get_frontend = af9005_fe_get_frontend,
.get_frontend_legacy = af9005_fe_get_frontend,

.read_status = af9005_fe_read_status,
.read_ber = af9005_fe_read_ber,
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/dvb/dvb-usb/cinergyT2-fe.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ static struct dvb_frontend_ops cinergyt2_fe_ops = {
.sleep = cinergyt2_fe_sleep,

.set_frontend_legacy = cinergyt2_fe_set_frontend,
.get_frontend = cinergyt2_fe_get_frontend,
.get_frontend_legacy = cinergyt2_fe_get_frontend,
.get_tune_settings = cinergyt2_fe_get_tune_settings,

.read_status = cinergyt2_fe_read_status,
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/dvb/dvb-usb/dtt200u-fe.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ static struct dvb_frontend_ops dtt200u_fe_ops = {
.sleep = dtt200u_fe_sleep,

.set_frontend_legacy = dtt200u_fe_set_frontend,
.get_frontend = dtt200u_fe_get_frontend,
.get_frontend_legacy = dtt200u_fe_get_frontend,
.get_tune_settings = dtt200u_fe_get_tune_settings,

.read_status = dtt200u_fe_read_status,
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/dvb/dvb-usb/friio-fe.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ static struct dvb_frontend_ops jdvbt90502_ops = {
.set_property = jdvbt90502_set_property,

.set_frontend_legacy = jdvbt90502_set_frontend,
.get_frontend = jdvbt90502_get_frontend,
.get_frontend_legacy = jdvbt90502_get_frontend,

.read_status = jdvbt90502_read_status,
.read_signal_strength = jdvbt90502_read_signal_strength,
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/dvb/dvb-usb/mxl111sf-demod.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ static struct dvb_frontend_ops mxl111sf_demod_ops = {
.i2c_gate_ctrl = mxl111sf_i2c_gate_ctrl,
#endif
.set_frontend_legacy = mxl111sf_demod_set_frontend,
.get_frontend = mxl111sf_demod_get_frontend,
.get_frontend_legacy = mxl111sf_demod_get_frontend,
.get_tune_settings = mxl111sf_demod_get_tune_settings,
.read_status = mxl111sf_demod_read_status,
.read_signal_strength = mxl111sf_demod_read_signal_strength,
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/dvb/dvb-usb/vp702x-fe.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ static struct dvb_frontend_ops vp702x_fe_ops = {
.sleep = vp702x_fe_sleep,

.set_frontend_legacy = vp702x_fe_set_frontend,
.get_frontend = vp702x_fe_get_frontend,
.get_frontend_legacy = vp702x_fe_get_frontend,
.get_tune_settings = vp702x_fe_get_tune_settings,

.read_status = vp702x_fe_read_status,
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/dvb/dvb-usb/vp7045-fe.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ static struct dvb_frontend_ops vp7045_fe_ops = {
.sleep = vp7045_fe_sleep,

.set_frontend_legacy = vp7045_fe_set_frontend,
.get_frontend = vp7045_fe_get_frontend,
.get_frontend_legacy = vp7045_fe_get_frontend,
.get_tune_settings = vp7045_fe_get_tune_settings,

.read_status = vp7045_fe_read_status,
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/dvb/firewire/firedtv-fe.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ void fdtv_frontend_init(struct firedtv *fdtv, const char *name)
ops->sleep = fdtv_sleep;

ops->set_frontend_legacy = fdtv_set_frontend;
ops->get_frontend = fdtv_get_frontend;
ops->get_frontend_legacy = fdtv_get_frontend;

ops->get_property = fdtv_get_property;
ops->set_property = fdtv_set_property;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/dvb/frontends/af9013.c
Original file line number Diff line number Diff line change
Expand Up @@ -1513,7 +1513,7 @@ static struct dvb_frontend_ops af9013_ops = {

.get_tune_settings = af9013_get_tune_settings,
.set_frontend_legacy = af9013_set_frontend,
.get_frontend = af9013_get_frontend,
.get_frontend_legacy = af9013_get_frontend,

.read_status = af9013_read_status,
.read_snr = af9013_read_snr,
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/dvb/frontends/atbm8830.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ static struct dvb_frontend_ops atbm8830_ops = {
.i2c_gate_ctrl = atbm8830_i2c_gate_ctrl,

.set_frontend_legacy = atbm8830_set_fe,
.get_frontend = atbm8830_get_fe,
.get_frontend_legacy = atbm8830_get_fe,
.get_tune_settings = atbm8830_get_tune_settings,

.read_status = atbm8830_read_status,
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/dvb/frontends/au8522_dig.c
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ static struct dvb_frontend_ops au8522_ops = {
.sleep = au8522_sleep,
.i2c_gate_ctrl = au8522_i2c_gate_ctrl,
.set_frontend_legacy = au8522_set_frontend,
.get_frontend = au8522_get_frontend,
.get_frontend_legacy = au8522_get_frontend,
.get_tune_settings = au8522_get_tune_settings,
.read_status = au8522_read_status,
.read_ber = au8522_read_ber,
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/dvb/frontends/cx22700.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ static struct dvb_frontend_ops cx22700_ops = {
.i2c_gate_ctrl = cx22700_i2c_gate_ctrl,

.set_frontend_legacy = cx22700_set_frontend,
.get_frontend = cx22700_get_frontend,
.get_frontend_legacy = cx22700_get_frontend,
.get_tune_settings = cx22700_get_tune_settings,

.read_status = cx22700_read_status,
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/dvb/frontends/cx22702.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ static const struct dvb_frontend_ops cx22702_ops = {
.i2c_gate_ctrl = cx22702_i2c_gate_ctrl,

.set_frontend_legacy = cx22702_set_tps,
.get_frontend = cx22702_get_frontend,
.get_frontend_legacy = cx22702_get_frontend,
.get_tune_settings = cx22702_get_tune_settings,

.read_status = cx22702_read_status,
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/dvb/frontends/cx24110.c
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ static struct dvb_frontend_ops cx24110_ops = {
.init = cx24110_initfe,
.write = _cx24110_pll_write,
.set_frontend_legacy = cx24110_set_frontend,
.get_frontend = cx24110_get_frontend,
.get_frontend_legacy = cx24110_get_frontend,
.read_status = cx24110_read_status,
.read_ber = cx24110_read_ber,
.read_signal_strength = cx24110_read_signal_strength,
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/dvb/frontends/cx24123.c
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,7 @@ static struct dvb_frontend_ops cx24123_ops = {

.init = cx24123_initfe,
.set_frontend_legacy = cx24123_set_frontend,
.get_frontend = cx24123_get_frontend,
.get_frontend_legacy = cx24123_get_frontend,
.read_status = cx24123_read_status,
.read_ber = cx24123_read_ber,
.read_signal_strength = cx24123_read_signal_strength,
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/dvb/frontends/cxd2820r_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ static const struct dvb_frontend_ops cxd2820r_ops = {
.get_tune_settings = cxd2820r_get_tune_settings,
.i2c_gate_ctrl = cxd2820r_i2c_gate_ctrl,

.get_frontend = cxd2820r_get_frontend,
.get_frontend_legacy = cxd2820r_get_frontend,

.get_frontend_algo = cxd2820r_get_frontend_algo,
.search = cxd2820r_search,
Expand Down
Loading

0 comments on commit 2f9f798

Please sign in to comment.