diff mbox

Don't call G_TUNER unless actually performing a tuning related call

Message ID 1371218366-16081-1-git-send-email-dheitmueller@kernellabs.com (mailing list archive)
State New, archived
Headers show

Commit Message

Devin Heitmueller June 14, 2013, 1:59 p.m. UTC
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 <dheitmueller@kernellabs.com>
---
 utils/v4l2-ctl/v4l2-ctl-tuner.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Hans Verkuil June 14, 2013, 2:44 p.m. UTC | #1
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 <dheitmueller@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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;