[PATCHv10,3/8] v4l2: video device: Add FM_TX controls default configurations

Message ID 1248453448-1668-4-git-send-email-eduardo.valentin@nokia.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Eduardo Valentin July 24, 2009, 4:37 p.m. UTC
  Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
 linux/drivers/media/video/v4l2-common.c |   63 ++++++++++++++++++++++++++++++-
 1 files changed, 62 insertions(+), 1 deletions(-)
  

Comments

Eduardo Valentin July 25, 2009, 1:02 p.m. UTC | #1
On Sat, Jul 25, 2009 at 03:03:33PM +0200, ext Hans Verkuil wrote:
> On Friday 24 July 2009 18:37:23 Eduardo Valentin wrote:
> > Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
> > ---
> >  linux/drivers/media/video/v4l2-common.c |   63 ++++++++++++++++++++++++++++++-
> >  1 files changed, 62 insertions(+), 1 deletions(-)
> > 
> > diff --git a/linux/drivers/media/video/v4l2-common.c b/linux/drivers/media/video/v4l2-common.c
> > index bd13702..6fc0559 100644
> > --- a/linux/drivers/media/video/v4l2-common.c
> > +++ b/linux/drivers/media/video/v4l2-common.c
> > @@ -343,6 +343,12 @@ const char **v4l2_ctrl_get_menu(u32 id)
> >  		"Sepia",
> >  		NULL
> >  	};
> > +	static const char *fm_tx_preemphasis[] = {
> > +		"No preemphasis",
> > +		"50 useconds",
> > +		"75 useconds",
> > +		NULL,
> > +	};
> >  
> >  	switch (id) {
> >  		case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
> > @@ -381,6 +387,8 @@ const char **v4l2_ctrl_get_menu(u32 id)
> >  			return camera_exposure_auto;
> >  		case V4L2_CID_COLORFX:
> >  			return colorfx;
> > +		case V4L2_CID_FM_TX_PREEMPHASIS:
> > +			return fm_tx_preemphasis;
> >  		default:
> >  			return NULL;
> >  	}
> > @@ -479,6 +487,28 @@ const char *v4l2_ctrl_get_name(u32 id)
> >  	case V4L2_CID_ZOOM_CONTINUOUS:		return "Zoom, Continuous";
> >  	case V4L2_CID_PRIVACY:			return "Privacy";
> >  
> > +	/* FM Radio Modulator control */
> > +	case V4L2_CID_FM_TX_CLASS:		return "FM Radio Modulator Controls";
> > +	case V4L2_CID_RDS_TX_PI:		return "RDS Program ID";
> > +	case V4L2_CID_RDS_TX_PTY:		return "RDS Program Type";
> > +	case V4L2_CID_RDS_TX_DEVIATION:		return "RDS Signal Deviation";
> > +	case V4L2_CID_RDS_TX_PS_NAME:		return "RDS PS Name";
> > +	case V4L2_CID_RDS_TX_RADIO_TEXT:	return "RDS Radio Text";
> > +	case V4L2_CID_AUDIO_LIMITER_ENABLED:	return "Audio Limiter Feature Enabled";
> > +	case V4L2_CID_AUDIO_LIMITER_RELEASE_TIME: return "Audio Limiter Release Time";
> > +	case V4L2_CID_AUDIO_LIMITER_DEVIATION:	return "Audio Limiter Deviation";
> > +	case V4L2_CID_AUDIO_COMPRESSION_ENABLED: return "Audio Compression Feature Enabled";
> > +	case V4L2_CID_AUDIO_COMPRESSION_GAIN:	return "Audio Compression Gain";
> > +	case V4L2_CID_AUDIO_COMPRESSION_THRESHOLD: return "Audio Compression Threshold";
> > +	case V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME: return "Audio Compression Attack Time";
> > +	case V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME: return "Audio Compression Release Time";
> > +	case V4L2_CID_PILOT_TONE_ENABLED:	return "Pilot Tone Feature Enabled";
> > +	case V4L2_CID_PILOT_TONE_DEVIATION:	return "Pilot Tone Deviation";
> > +	case V4L2_CID_PILOT_TONE_FREQUENCY:	return "Pilot Tone Frequency";
> > +	case V4L2_CID_FM_TX_PREEMPHASIS:	return "Pre-emphasis settings";
> > +	case V4L2_CID_TUNE_POWER_LEVEL:		return "Tune Power Level";
> > +	case V4L2_CID_TUNE_ANTENNA_CAPACITOR:	return "Tune Antenna Capacitor";
> > +
> >  	default:
> >  		return NULL;
> >  	}
> > @@ -500,7 +530,18 @@ EXPORT_SYMBOL(v4l2_ctrl_is_value64);
> >   * This information is used inside v4l2_compat_ioctl32. */
> >  int v4l2_ctrl_is_pointer(u32 id)
> >  {
> > -	return 0;
> > +	int is_pointer;
> > +
> > +	switch (id) {
> > +	case V4L2_CID_RDS_TX_PS_NAME:
> > +	case V4L2_CID_RDS_TX_RADIO_TEXT:
> > +		is_pointer = 1;
> > +		break;
> > +	default:
> > +		is_pointer = 0;
> > +	}
> > +
> > +	return is_pointer;
> >  }
> 
> There is no need for a temp variable. Just do this:
> 
> int v4l2_ctrl_is_pointer(u32 id)
> {
> 	switch (id) {
> 	case V4L2_CID_RDS_TX_PS_NAME:
> 	case V4L2_CID_RDS_TX_RADIO_TEXT:
> 		return 1;
> 	default:
> 		return 0;
> 	}
> }
> 
> Regards,
> 
> 	Hans


Right, resending v11 with this minor change.

> 
> 
> -- 
> Hans Verkuil - video4linux developer - sponsored by TANDBERG Telecom
  
Hans Verkuil July 25, 2009, 1:03 p.m. UTC | #2
On Friday 24 July 2009 18:37:23 Eduardo Valentin wrote:
> Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
> ---
>  linux/drivers/media/video/v4l2-common.c |   63 ++++++++++++++++++++++++++++++-
>  1 files changed, 62 insertions(+), 1 deletions(-)
> 
> diff --git a/linux/drivers/media/video/v4l2-common.c b/linux/drivers/media/video/v4l2-common.c
> index bd13702..6fc0559 100644
> --- a/linux/drivers/media/video/v4l2-common.c
> +++ b/linux/drivers/media/video/v4l2-common.c
> @@ -343,6 +343,12 @@ const char **v4l2_ctrl_get_menu(u32 id)
>  		"Sepia",
>  		NULL
>  	};
> +	static const char *fm_tx_preemphasis[] = {
> +		"No preemphasis",
> +		"50 useconds",
> +		"75 useconds",
> +		NULL,
> +	};
>  
>  	switch (id) {
>  		case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
> @@ -381,6 +387,8 @@ const char **v4l2_ctrl_get_menu(u32 id)
>  			return camera_exposure_auto;
>  		case V4L2_CID_COLORFX:
>  			return colorfx;
> +		case V4L2_CID_FM_TX_PREEMPHASIS:
> +			return fm_tx_preemphasis;
>  		default:
>  			return NULL;
>  	}
> @@ -479,6 +487,28 @@ const char *v4l2_ctrl_get_name(u32 id)
>  	case V4L2_CID_ZOOM_CONTINUOUS:		return "Zoom, Continuous";
>  	case V4L2_CID_PRIVACY:			return "Privacy";
>  
> +	/* FM Radio Modulator control */
> +	case V4L2_CID_FM_TX_CLASS:		return "FM Radio Modulator Controls";
> +	case V4L2_CID_RDS_TX_PI:		return "RDS Program ID";
> +	case V4L2_CID_RDS_TX_PTY:		return "RDS Program Type";
> +	case V4L2_CID_RDS_TX_DEVIATION:		return "RDS Signal Deviation";
> +	case V4L2_CID_RDS_TX_PS_NAME:		return "RDS PS Name";
> +	case V4L2_CID_RDS_TX_RADIO_TEXT:	return "RDS Radio Text";
> +	case V4L2_CID_AUDIO_LIMITER_ENABLED:	return "Audio Limiter Feature Enabled";
> +	case V4L2_CID_AUDIO_LIMITER_RELEASE_TIME: return "Audio Limiter Release Time";
> +	case V4L2_CID_AUDIO_LIMITER_DEVIATION:	return "Audio Limiter Deviation";
> +	case V4L2_CID_AUDIO_COMPRESSION_ENABLED: return "Audio Compression Feature Enabled";
> +	case V4L2_CID_AUDIO_COMPRESSION_GAIN:	return "Audio Compression Gain";
> +	case V4L2_CID_AUDIO_COMPRESSION_THRESHOLD: return "Audio Compression Threshold";
> +	case V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME: return "Audio Compression Attack Time";
> +	case V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME: return "Audio Compression Release Time";
> +	case V4L2_CID_PILOT_TONE_ENABLED:	return "Pilot Tone Feature Enabled";
> +	case V4L2_CID_PILOT_TONE_DEVIATION:	return "Pilot Tone Deviation";
> +	case V4L2_CID_PILOT_TONE_FREQUENCY:	return "Pilot Tone Frequency";
> +	case V4L2_CID_FM_TX_PREEMPHASIS:	return "Pre-emphasis settings";
> +	case V4L2_CID_TUNE_POWER_LEVEL:		return "Tune Power Level";
> +	case V4L2_CID_TUNE_ANTENNA_CAPACITOR:	return "Tune Antenna Capacitor";
> +
>  	default:
>  		return NULL;
>  	}
> @@ -500,7 +530,18 @@ EXPORT_SYMBOL(v4l2_ctrl_is_value64);
>   * This information is used inside v4l2_compat_ioctl32. */
>  int v4l2_ctrl_is_pointer(u32 id)
>  {
> -	return 0;
> +	int is_pointer;
> +
> +	switch (id) {
> +	case V4L2_CID_RDS_TX_PS_NAME:
> +	case V4L2_CID_RDS_TX_RADIO_TEXT:
> +		is_pointer = 1;
> +		break;
> +	default:
> +		is_pointer = 0;
> +	}
> +
> +	return is_pointer;
>  }

There is no need for a temp variable. Just do this:

int v4l2_ctrl_is_pointer(u32 id)
{
	switch (id) {
	case V4L2_CID_RDS_TX_PS_NAME:
	case V4L2_CID_RDS_TX_RADIO_TEXT:
		return 1;
	default:
		return 0;
	}
}

Regards,

	Hans
  

Patch

diff --git a/linux/drivers/media/video/v4l2-common.c b/linux/drivers/media/video/v4l2-common.c
index bd13702..6fc0559 100644
--- a/linux/drivers/media/video/v4l2-common.c
+++ b/linux/drivers/media/video/v4l2-common.c
@@ -343,6 +343,12 @@  const char **v4l2_ctrl_get_menu(u32 id)
 		"Sepia",
 		NULL
 	};
+	static const char *fm_tx_preemphasis[] = {
+		"No preemphasis",
+		"50 useconds",
+		"75 useconds",
+		NULL,
+	};
 
 	switch (id) {
 		case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
@@ -381,6 +387,8 @@  const char **v4l2_ctrl_get_menu(u32 id)
 			return camera_exposure_auto;
 		case V4L2_CID_COLORFX:
 			return colorfx;
+		case V4L2_CID_FM_TX_PREEMPHASIS:
+			return fm_tx_preemphasis;
 		default:
 			return NULL;
 	}
@@ -479,6 +487,28 @@  const char *v4l2_ctrl_get_name(u32 id)
 	case V4L2_CID_ZOOM_CONTINUOUS:		return "Zoom, Continuous";
 	case V4L2_CID_PRIVACY:			return "Privacy";
 
+	/* FM Radio Modulator control */
+	case V4L2_CID_FM_TX_CLASS:		return "FM Radio Modulator Controls";
+	case V4L2_CID_RDS_TX_PI:		return "RDS Program ID";
+	case V4L2_CID_RDS_TX_PTY:		return "RDS Program Type";
+	case V4L2_CID_RDS_TX_DEVIATION:		return "RDS Signal Deviation";
+	case V4L2_CID_RDS_TX_PS_NAME:		return "RDS PS Name";
+	case V4L2_CID_RDS_TX_RADIO_TEXT:	return "RDS Radio Text";
+	case V4L2_CID_AUDIO_LIMITER_ENABLED:	return "Audio Limiter Feature Enabled";
+	case V4L2_CID_AUDIO_LIMITER_RELEASE_TIME: return "Audio Limiter Release Time";
+	case V4L2_CID_AUDIO_LIMITER_DEVIATION:	return "Audio Limiter Deviation";
+	case V4L2_CID_AUDIO_COMPRESSION_ENABLED: return "Audio Compression Feature Enabled";
+	case V4L2_CID_AUDIO_COMPRESSION_GAIN:	return "Audio Compression Gain";
+	case V4L2_CID_AUDIO_COMPRESSION_THRESHOLD: return "Audio Compression Threshold";
+	case V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME: return "Audio Compression Attack Time";
+	case V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME: return "Audio Compression Release Time";
+	case V4L2_CID_PILOT_TONE_ENABLED:	return "Pilot Tone Feature Enabled";
+	case V4L2_CID_PILOT_TONE_DEVIATION:	return "Pilot Tone Deviation";
+	case V4L2_CID_PILOT_TONE_FREQUENCY:	return "Pilot Tone Frequency";
+	case V4L2_CID_FM_TX_PREEMPHASIS:	return "Pre-emphasis settings";
+	case V4L2_CID_TUNE_POWER_LEVEL:		return "Tune Power Level";
+	case V4L2_CID_TUNE_ANTENNA_CAPACITOR:	return "Tune Antenna Capacitor";
+
 	default:
 		return NULL;
 	}
@@ -500,7 +530,18 @@  EXPORT_SYMBOL(v4l2_ctrl_is_value64);
  * This information is used inside v4l2_compat_ioctl32. */
 int v4l2_ctrl_is_pointer(u32 id)
 {
-	return 0;
+	int is_pointer;
+
+	switch (id) {
+	case V4L2_CID_RDS_TX_PS_NAME:
+	case V4L2_CID_RDS_TX_RADIO_TEXT:
+		is_pointer = 1;
+		break;
+	default:
+		is_pointer = 0;
+	}
+
+	return is_pointer;
 }
 EXPORT_SYMBOL(v4l2_ctrl_is_pointer);
 
@@ -530,6 +571,9 @@  int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 ste
 	case V4L2_CID_EXPOSURE_AUTO_PRIORITY:
 	case V4L2_CID_FOCUS_AUTO:
 	case V4L2_CID_PRIVACY:
+	case V4L2_CID_AUDIO_LIMITER_ENABLED:
+	case V4L2_CID_AUDIO_COMPRESSION_ENABLED:
+	case V4L2_CID_PILOT_TONE_ENABLED:
 		qctrl->type = V4L2_CTRL_TYPE_BOOLEAN;
 		min = 0;
 		max = step = 1;
@@ -558,12 +602,18 @@  int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 ste
 	case V4L2_CID_MPEG_STREAM_VBI_FMT:
 	case V4L2_CID_EXPOSURE_AUTO:
 	case V4L2_CID_COLORFX:
+	case V4L2_CID_FM_TX_PREEMPHASIS:
 		qctrl->type = V4L2_CTRL_TYPE_MENU;
 		step = 1;
 		break;
+	case V4L2_CID_RDS_TX_PS_NAME:
+	case V4L2_CID_RDS_TX_RADIO_TEXT:
+		qctrl->type = V4L2_CTRL_TYPE_STRING;
+		break;
 	case V4L2_CID_USER_CLASS:
 	case V4L2_CID_CAMERA_CLASS:
 	case V4L2_CID_MPEG_CLASS:
+	case V4L2_CID_FM_TX_CLASS:
 		qctrl->type = V4L2_CTRL_TYPE_CTRL_CLASS;
 		qctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY;
 		min = max = step = def = 0;
@@ -592,6 +642,17 @@  int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 ste
 	case V4L2_CID_BLUE_BALANCE:
 	case V4L2_CID_GAMMA:
 	case V4L2_CID_SHARPNESS:
+	case V4L2_CID_RDS_TX_DEVIATION:
+	case V4L2_CID_AUDIO_LIMITER_RELEASE_TIME:
+	case V4L2_CID_AUDIO_LIMITER_DEVIATION:
+	case V4L2_CID_AUDIO_COMPRESSION_GAIN:
+	case V4L2_CID_AUDIO_COMPRESSION_THRESHOLD:
+	case V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME:
+	case V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME:
+	case V4L2_CID_PILOT_TONE_DEVIATION:
+	case V4L2_CID_PILOT_TONE_FREQUENCY:
+	case V4L2_CID_TUNE_POWER_LEVEL:
+	case V4L2_CID_TUNE_ANTENNA_CAPACITOR:
 		qctrl->flags |= V4L2_CTRL_FLAG_SLIDER;
 		break;
 	case V4L2_CID_PAN_RELATIVE: