summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorAndrew de Quincy <devnull@localhost>2004-02-26 14:17:07 +0000
committerAndrew de Quincy <devnull@localhost>2004-02-26 14:17:07 +0000
commitc6a1ef178f8e95f64d3422076a9561750aa467f3 (patch)
tree5cb30bd2fb5129543df9a1445c186b7082bbbf7c /linux
parentc08db094ca2fbfecad2261574f5c08d3aad6dbab (diff)
downloadmediapointer-dvb-s2-c6a1ef178f8e95f64d3422076a9561750aa467f3.tar.gz
mediapointer-dvb-s2-c6a1ef178f8e95f64d3422076a9561750aa467f3.tar.bz2
Added FE_GETMINDELAY. The frontend can implement this, and return a
minimum tuning delay to use for the specified frontend parameters. If not, it will default to 50ms
Diffstat (limited to 'linux')
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_frontend.c18
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_frontend.h1
2 files changed, 12 insertions, 7 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
index 3b8225f9e..cffbed5a5 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -100,6 +100,7 @@ struct dvb_frontend_data {
int inversion;
int auto_count;
int started_auto_count;
+ int min_delay;
int exit;
fe_status_t status;
};
@@ -329,7 +330,7 @@ static void dvb_frontend_init (struct dvb_frontend_data *fe)
dvb_frontend_internal_ioctl (frontend, FE_INIT, NULL);
}
-static void update_delay (int *quality, int *delay, int locked)
+static void update_delay (int *quality, int *delay, int min_delay, int locked)
{
int q2;
@@ -343,7 +344,7 @@ static void update_delay (int *quality, int *delay, int locked)
q2 = *quality - 128;
q2 *= q2;
- *delay = HZ/20 + q2 * HZ / (128*128);
+ *delay = min_delay + q2 * HZ / (128*128);
}
/**
@@ -514,7 +515,7 @@ static int dvb_frontend_thread (void *data)
// if we're not tuned, and we have a lock, move to the TUNED state
if ((fe->state & FESTATE_SEARCHING) && (s & FE_HAS_LOCK)) {
- update_delay(&quality, &delay, s & FE_HAS_LOCK);
+ update_delay(&quality, &delay, fe->min_delay, s & FE_HAS_LOCK);
fe->state = FESTATE_TUNED;
// if we're tuned, then we have determined the correct inversion
@@ -526,7 +527,7 @@ static int dvb_frontend_thread (void *data)
// if we are tuned already, check we're still locked
if (fe->state & FESTATE_TUNED) {
- update_delay(&quality, &delay, s & FE_HAS_LOCK);
+ update_delay(&quality, &delay, fe->min_delay, s & FE_HAS_LOCK);
// we're tuned, and the lock is still good...
if (s & FE_HAS_LOCK) {
@@ -542,7 +543,7 @@ static int dvb_frontend_thread (void *data)
// don't actually do anything if we're in the LOSTLOCK state
// and the frontend can recover automatically
if ((fe->state & FESTATE_LOSTLOCK) && (fe->info->caps & FE_CAN_RECOVER)) {
- update_delay(&quality, &delay, s & FE_HAS_LOCK);
+ update_delay(&quality, &delay, fe->min_delay, s & FE_HAS_LOCK);
continue;
}
@@ -559,7 +560,7 @@ static int dvb_frontend_thread (void *data)
// fast zigzag
if (fe->state & FESTATE_SEARCHING_FAST) {
- delay = (HZ * 50) / 1000; // hardcoded fast zigzag scan delay of 50ms
+ delay = fe->min_delay;
// OK, if we've run out of trials at the fast speed. Drop back to
// slow for the _next_ attempt
@@ -577,7 +578,7 @@ static int dvb_frontend_thread (void *data)
// slow zigzag
if (fe->state & FESTATE_SEARCHING_SLOW) {
- update_delay(&quality, &delay, s & FE_HAS_LOCK);
+ update_delay(&quality, &delay, fe->min_delay, s & FE_HAS_LOCK);
dvb_frontend_autotune(fe);
}
@@ -725,6 +726,9 @@ static int dvb_frontend_ioctl (struct inode *inode, struct file *file,
memcpy (&fe->parameters, parg,
sizeof (struct dvb_frontend_parameters));
+ fe->min_delay = dvb_frontend_internal_ioctl(&fe->frontend, FE_GETMINDELAY, &fe->parameters);
+ if (fe->min_delay <= 0) fe->min_delay = HZ/20; // default mindelay of 50ms
+
dvb_frontend_add_event (fe, 0);
wake_up_interruptible(&fe->wait_queue);
break;
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.h b/linux/drivers/media/dvb/dvb-core/dvb_frontend.h
index 565358a54..350b1ea2c 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.h
+++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.h
@@ -64,6 +64,7 @@ struct dvb_frontend {
#define FE_SLEEP _IO('v', 80)
#define FE_INIT _IO('v', 81)
#define FE_RESET _IO('v', 82)
+#define FE_GETMINDELAY _IO('v', 83)
extern int