Commit a5959dbe authored by Andreas Oberritter's avatar Andreas Oberritter Committed by Mauro Carvalho Chehab

[media] DVB: dvb_frontend: add parameters_out

- Holds the parameters detected by the demod.
- Updated on every call to get_frontend, either through ioctl or when
  a frontend event occurs.
- Reset to input parameters after every call to set_frontend, tune or
  search/track.
Signed-off-by: default avatarAndreas Oberritter <obi@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 50727719
...@@ -106,6 +106,7 @@ struct dvb_frontend_private { ...@@ -106,6 +106,7 @@ struct dvb_frontend_private {
/* thread/frontend values */ /* thread/frontend values */
struct dvb_device *dvbdev; struct dvb_device *dvbdev;
struct dvb_frontend_parameters parameters_in; struct dvb_frontend_parameters parameters_in;
struct dvb_frontend_parameters parameters_out;
struct dvb_fe_events events; struct dvb_fe_events events;
struct semaphore sem; struct semaphore sem;
struct list_head list_head; struct list_head list_head;
...@@ -160,12 +161,11 @@ static void dvb_frontend_add_event(struct dvb_frontend *fe, fe_status_t status) ...@@ -160,12 +161,11 @@ static void dvb_frontend_add_event(struct dvb_frontend *fe, fe_status_t status)
e = &events->events[events->eventw]; e = &events->events[events->eventw];
memcpy (&e->parameters, &fepriv->parameters_in,
sizeof (struct dvb_frontend_parameters));
if (status & FE_HAS_LOCK) if (status & FE_HAS_LOCK)
if (fe->ops.get_frontend) if (fe->ops.get_frontend)
fe->ops.get_frontend(fe, &e->parameters); fe->ops.get_frontend(fe, &fepriv->parameters_out);
e->parameters = fepriv->parameters_out;
events->eventw = wp; events->eventw = wp;
...@@ -353,6 +353,7 @@ static int dvb_frontend_swzigzag_autotune(struct dvb_frontend *fe, int check_wra ...@@ -353,6 +353,7 @@ static int dvb_frontend_swzigzag_autotune(struct dvb_frontend *fe, int check_wra
fepriv->parameters_in.inversion = fepriv->inversion; fepriv->parameters_in.inversion = fepriv->inversion;
if (fe->ops.set_frontend) if (fe->ops.set_frontend)
fe_set_err = fe->ops.set_frontend(fe, &fepriv->parameters_in); fe_set_err = fe->ops.set_frontend(fe, &fepriv->parameters_in);
fepriv->parameters_out = fepriv->parameters_in;
if (fe_set_err < 0) { if (fe_set_err < 0) {
fepriv->state = FESTATE_ERROR; fepriv->state = FESTATE_ERROR;
return fe_set_err; return fe_set_err;
...@@ -384,6 +385,7 @@ static void dvb_frontend_swzigzag(struct dvb_frontend *fe) ...@@ -384,6 +385,7 @@ static void dvb_frontend_swzigzag(struct dvb_frontend *fe)
if (fe->ops.set_frontend) if (fe->ops.set_frontend)
retval = fe->ops.set_frontend(fe, retval = fe->ops.set_frontend(fe,
&fepriv->parameters_in); &fepriv->parameters_in);
fepriv->parameters_out = fepriv->parameters_in;
if (retval < 0) if (retval < 0)
fepriv->state = FESTATE_ERROR; fepriv->state = FESTATE_ERROR;
else else
...@@ -600,6 +602,8 @@ static int dvb_frontend_thread(void *data) ...@@ -600,6 +602,8 @@ static int dvb_frontend_thread(void *data)
if (fe->ops.tune) if (fe->ops.tune)
fe->ops.tune(fe, params, fepriv->tune_mode_flags, &fepriv->delay, &s); fe->ops.tune(fe, params, fepriv->tune_mode_flags, &fepriv->delay, &s);
if (params)
fepriv->parameters_out = *params;
if (s != fepriv->status && !(fepriv->tune_mode_flags & FE_TUNE_MODE_ONESHOT)) { if (s != fepriv->status && !(fepriv->tune_mode_flags & FE_TUNE_MODE_ONESHOT)) {
dprintk("%s: state changed, adding current state\n", __func__); dprintk("%s: state changed, adding current state\n", __func__);
...@@ -639,6 +643,7 @@ static int dvb_frontend_thread(void *data) ...@@ -639,6 +643,7 @@ static int dvb_frontend_thread(void *data)
fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN; fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN;
fepriv->delay = HZ / 2; fepriv->delay = HZ / 2;
} }
fepriv->parameters_out = fepriv->parameters_in;
fe->ops.read_status(fe, &s); fe->ops.read_status(fe, &s);
if (s != fepriv->status) { if (s != fepriv->status) {
dvb_frontend_add_event(fe, s); /* update event list */ dvb_frontend_add_event(fe, s); /* update event list */
...@@ -1880,8 +1885,8 @@ static int dvb_frontend_ioctl_legacy(struct file *file, ...@@ -1880,8 +1885,8 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
case FE_GET_FRONTEND: case FE_GET_FRONTEND:
if (fe->ops.get_frontend) { if (fe->ops.get_frontend) {
memcpy (parg, &fepriv->parameters_in, sizeof (struct dvb_frontend_parameters)); err = fe->ops.get_frontend(fe, &fepriv->parameters_out);
err = fe->ops.get_frontend(fe, (struct dvb_frontend_parameters*) parg); memcpy(parg, &fepriv->parameters_out, sizeof(struct dvb_frontend_parameters));
} }
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment