[PATCH] Don't call G_TUNER unless actually performing a tuning related call

2013-06-14 Thread Devin Heitmueller
Making G_TUNER calls can take a long time on some tuners, in
particular those that load firmware or do power management.  As a
result, we don't want to call G_TUNER unless the user is actually
doing a tuning related call.  The current code makes a G_TUNER
call regardless of what command the user is attempting to perform.

Problem originally identified on the HVR-950q, where even doing
operations like toggling from the composite to the s-video input
would take over 1000ms.

Signed-off-by: Devin Heitmueller dheitmuel...@kernellabs.com
---
 utils/v4l2-ctl/v4l2-ctl-tuner.cpp | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/utils/v4l2-ctl/v4l2-ctl-tuner.cpp 
b/utils/v4l2-ctl/v4l2-ctl-tuner.cpp
index ebe74d3..9af6b13 100644
--- a/utils/v4l2-ctl/v4l2-ctl-tuner.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-tuner.cpp
@@ -254,6 +254,13 @@ void tuner_set(int fd)
V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
double fac = 16;
 
+   if (!options[OptSetFreq]  ! options[OptSetTuner]  
!options[OptListFreqBands]
+!options[OptSetModulator]  !options[OptFreqSeek]) {
+   /* Don't actually call G_[MODULATOR/TUNER] if we don't intend to
+  actually perform any tuner related function */
+   return;
+   }
+
if (capabilities  V4L2_CAP_MODULATOR) {
type = V4L2_TUNER_RADIO;
modulator.index = tuner_index;
-- 
1.8.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Don't call G_TUNER unless actually performing a tuning related call

2013-06-14 Thread Hans Verkuil
On Fri June 14 2013 15:59:26 Devin Heitmueller wrote:
 Making G_TUNER calls can take a long time on some tuners, in
 particular those that load firmware or do power management.  As a
 result, we don't want to call G_TUNER unless the user is actually
 doing a tuning related call.  The current code makes a G_TUNER
 call regardless of what command the user is attempting to perform.
 
 Problem originally identified on the HVR-950q, where even doing
 operations like toggling from the composite to the s-video input
 would take over 1000ms.
 
 Signed-off-by: Devin Heitmueller dheitmuel...@kernellabs.com

I've committed this. Thanks, this makes a lot of sense!

Regards,

Hans

 ---
  utils/v4l2-ctl/v4l2-ctl-tuner.cpp | 7 +++
  1 file changed, 7 insertions(+)
 
 diff --git a/utils/v4l2-ctl/v4l2-ctl-tuner.cpp 
 b/utils/v4l2-ctl/v4l2-ctl-tuner.cpp
 index ebe74d3..9af6b13 100644
 --- a/utils/v4l2-ctl/v4l2-ctl-tuner.cpp
 +++ b/utils/v4l2-ctl/v4l2-ctl-tuner.cpp
 @@ -254,6 +254,13 @@ void tuner_set(int fd)
   V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
   double fac = 16;
  
 + if (!options[OptSetFreq]  ! options[OptSetTuner]  
 !options[OptListFreqBands]
 +  !options[OptSetModulator]  !options[OptFreqSeek]) {
 + /* Don't actually call G_[MODULATOR/TUNER] if we don't intend to
 +actually perform any tuner related function */
 + return;
 + }
 +
   if (capabilities  V4L2_CAP_MODULATOR) {
   type = V4L2_TUNER_RADIO;
   modulator.index = tuner_index;
 
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html