[PATCHv7,2/9] v4l2: video device: Add V4L2_CTRL_CLASS_FM_TX controls

Message ID 1244827840-886-3-git-send-email-eduardo.valentin@nokia.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Eduardo Valentin June 12, 2009, 5:30 p.m. UTC
  This patch adds a new class of extended controls. This class
is intended to support FM Radio Modulators properties such as:
rds, audio limiters, audio compression, pilot tone generation,
tuning power levels and preemphasis properties.

Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
 linux/include/linux/videodev2.h |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)
  

Comments

Hans Verkuil June 14, 2009, 10:46 a.m. UTC | #1
On Friday 12 June 2009 19:30:33 Eduardo Valentin wrote:
> This patch adds a new class of extended controls. This class
> is intended to support FM Radio Modulators properties such as:
> rds, audio limiters, audio compression, pilot tone generation,
> tuning power levels and preemphasis properties.
> 
> Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
> ---
>  linux/include/linux/videodev2.h |   34 ++++++++++++++++++++++++++++++++++
>  1 files changed, 34 insertions(+), 0 deletions(-)
> 
> diff --git a/linux/include/linux/videodev2.h b/linux/include/linux/videodev2.h
> index b8cffc9..9733435 100644
> --- a/linux/include/linux/videodev2.h
> +++ b/linux/include/linux/videodev2.h
> @@ -806,6 +806,7 @@ struct v4l2_ext_controls {
>  #define V4L2_CTRL_CLASS_USER 0x00980000	/* Old-style 'user' controls */
>  #define V4L2_CTRL_CLASS_MPEG 0x00990000	/* MPEG-compression controls */
>  #define V4L2_CTRL_CLASS_CAMERA 0x009a0000	/* Camera class controls */
> +#define V4L2_CTRL_CLASS_FM_TX 0x009b0000	/* FM Modulator control class */
>  
>  #define V4L2_CTRL_ID_MASK      	  (0x0fffffff)
>  #define V4L2_CTRL_ID2CLASS(id)    ((id) & 0x0fff0000UL)
> @@ -1144,6 +1145,39 @@ enum  v4l2_exposure_auto_type {
>  
>  #define V4L2_CID_PRIVACY			(V4L2_CID_CAMERA_CLASS_BASE+16)
>  
> +/* FM Modulator class control IDs */
> +#define V4L2_CID_FM_TX_CLASS_BASE		(V4L2_CTRL_CLASS_FM_TX | 0x900)
> +#define V4L2_CID_FM_TX_CLASS			(V4L2_CTRL_CLASS_FM_TX | 1)
> +
> +#define V4L2_CID_RDS_ENABLED			(V4L2_CID_FM_TX_CLASS_BASE + 1)
> +#define V4L2_CID_RDS_PI				(V4L2_CID_FM_TX_CLASS_BASE + 2)
> +#define V4L2_CID_RDS_PTY			(V4L2_CID_FM_TX_CLASS_BASE + 3)
> +#define V4L2_CID_RDS_PS_NAME			(V4L2_CID_FM_TX_CLASS_BASE + 4)
> +#define V4L2_CID_RDS_RADIO_TEXT			(V4L2_CID_FM_TX_CLASS_BASE + 5)

I think these RDS controls should be renamed to V4L2_CID_RDS_TX_. This makes
it clear that these controls relate to the RDS transmitter instead of a
receiver. I would not be surprised to see similar controls appear for an RDS
receiver in the future.

> +
> +#define V4L2_CID_AUDIO_LIMITER_ENABLED		(V4L2_CID_FM_TX_CLASS_BASE + 6)
> +#define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME	(V4L2_CID_FM_TX_CLASS_BASE + 7)
> +#define V4L2_CID_AUDIO_LIMITER_DEVIATION	(V4L2_CID_FM_TX_CLASS_BASE + 8)
> +
> +#define V4L2_CID_AUDIO_COMPRESSION_ENABLED	(V4L2_CID_FM_TX_CLASS_BASE + 9)
> +#define V4L2_CID_AUDIO_COMPRESSION_GAIN		(V4L2_CID_FM_TX_CLASS_BASE + 10)
> +#define V4L2_CID_AUDIO_COMPRESSION_THRESHOLD	(V4L2_CID_FM_TX_CLASS_BASE + 11)
> +#define V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME	(V4L2_CID_FM_TX_CLASS_BASE + 12)
> +#define V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME	(V4L2_CID_FM_TX_CLASS_BASE + 13)
> +
> +#define V4L2_CID_PILOT_TONE_ENABLED		(V4L2_CID_FM_TX_CLASS_BASE + 14)
> +#define V4L2_CID_PILOT_TONE_DEVIATION		(V4L2_CID_FM_TX_CLASS_BASE + 15)
> +#define V4L2_CID_PILOT_TONE_FREQUENCY		(V4L2_CID_FM_TX_CLASS_BASE + 16)
> +
> +#define V4L2_CID_PREEMPHASIS			(V4L2_CID_FM_TX_CLASS_BASE + 17)
> +enum v4l2_fm_tx_preemphasis {
> +	V4L2_FM_TX_PREEMPHASIS_DISABLED		= 0,
> +	V4L2_FM_TX_PREEMPHASIS_50_uS		= 1,
> +	V4L2_FM_TX_PREEMPHASIS_75_uS		= 2,
> +};

I suggest renaming this to V4L2_CID_FM_TX_PREEMPHASIS. There is already a
similar V4L2_CID_MPEG_EMPHASIS control and others might well appear in the
future, so I think this name should be more specific to the FM_TX API.

> +#define V4L2_CID_TUNE_POWER_LEVEL		(V4L2_CID_FM_TX_CLASS_BASE + 18)
> +#define V4L2_CID_TUNE_ANTENNA_CAPACITOR		(V4L2_CID_FM_TX_CLASS_BASE + 19)
> +
>  /*
>   *	T U N I N G
>   */

Regards,

	Hans
  
Eduardo Valentin June 14, 2009, 10:50 a.m. UTC | #2
Hi Hans,

On Sun, Jun 14, 2009 at 1:46 PM, Hans Verkuil<hverkuil@xs4all.nl> wrote:
> On Friday 12 June 2009 19:30:33 Eduardo Valentin wrote:
>> This patch adds a new class of extended controls. This class
>> is intended to support FM Radio Modulators properties such as:
>> rds, audio limiters, audio compression, pilot tone generation,
>> tuning power levels and preemphasis properties.
>>
>> Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
>> ---
>>  linux/include/linux/videodev2.h |   34 ++++++++++++++++++++++++++++++++++
>>  1 files changed, 34 insertions(+), 0 deletions(-)
>>
>> diff --git a/linux/include/linux/videodev2.h b/linux/include/linux/videodev2.h
>> index b8cffc9..9733435 100644
>> --- a/linux/include/linux/videodev2.h
>> +++ b/linux/include/linux/videodev2.h
>> @@ -806,6 +806,7 @@ struct v4l2_ext_controls {
>>  #define V4L2_CTRL_CLASS_USER 0x00980000      /* Old-style 'user' controls */
>>  #define V4L2_CTRL_CLASS_MPEG 0x00990000      /* MPEG-compression controls */
>>  #define V4L2_CTRL_CLASS_CAMERA 0x009a0000    /* Camera class controls */
>> +#define V4L2_CTRL_CLASS_FM_TX 0x009b0000     /* FM Modulator control class */
>>
>>  #define V4L2_CTRL_ID_MASK              (0x0fffffff)
>>  #define V4L2_CTRL_ID2CLASS(id)    ((id) & 0x0fff0000UL)
>> @@ -1144,6 +1145,39 @@ enum  v4l2_exposure_auto_type {
>>
>>  #define V4L2_CID_PRIVACY                     (V4L2_CID_CAMERA_CLASS_BASE+16)
>>
>> +/* FM Modulator class control IDs */
>> +#define V4L2_CID_FM_TX_CLASS_BASE            (V4L2_CTRL_CLASS_FM_TX | 0x900)
>> +#define V4L2_CID_FM_TX_CLASS                 (V4L2_CTRL_CLASS_FM_TX | 1)
>> +
>> +#define V4L2_CID_RDS_ENABLED                 (V4L2_CID_FM_TX_CLASS_BASE + 1)
>> +#define V4L2_CID_RDS_PI                              (V4L2_CID_FM_TX_CLASS_BASE + 2)
>> +#define V4L2_CID_RDS_PTY                     (V4L2_CID_FM_TX_CLASS_BASE + 3)
>> +#define V4L2_CID_RDS_PS_NAME                 (V4L2_CID_FM_TX_CLASS_BASE + 4)
>> +#define V4L2_CID_RDS_RADIO_TEXT                      (V4L2_CID_FM_TX_CLASS_BASE + 5)
>
> I think these RDS controls should be renamed to V4L2_CID_RDS_TX_. This makes
> it clear that these controls relate to the RDS transmitter instead of a
> receiver. I would not be surprised to see similar controls appear for an RDS
> receiver in the future.
>
>> +
>> +#define V4L2_CID_AUDIO_LIMITER_ENABLED               (V4L2_CID_FM_TX_CLASS_BASE + 6)
>> +#define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME  (V4L2_CID_FM_TX_CLASS_BASE + 7)
>> +#define V4L2_CID_AUDIO_LIMITER_DEVIATION     (V4L2_CID_FM_TX_CLASS_BASE + 8)
>> +
>> +#define V4L2_CID_AUDIO_COMPRESSION_ENABLED   (V4L2_CID_FM_TX_CLASS_BASE + 9)
>> +#define V4L2_CID_AUDIO_COMPRESSION_GAIN              (V4L2_CID_FM_TX_CLASS_BASE + 10)
>> +#define V4L2_CID_AUDIO_COMPRESSION_THRESHOLD (V4L2_CID_FM_TX_CLASS_BASE + 11)
>> +#define V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME       (V4L2_CID_FM_TX_CLASS_BASE + 12)
>> +#define V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME      (V4L2_CID_FM_TX_CLASS_BASE + 13)
>> +
>> +#define V4L2_CID_PILOT_TONE_ENABLED          (V4L2_CID_FM_TX_CLASS_BASE + 14)
>> +#define V4L2_CID_PILOT_TONE_DEVIATION                (V4L2_CID_FM_TX_CLASS_BASE + 15)
>> +#define V4L2_CID_PILOT_TONE_FREQUENCY                (V4L2_CID_FM_TX_CLASS_BASE + 16)
>> +
>> +#define V4L2_CID_PREEMPHASIS                 (V4L2_CID_FM_TX_CLASS_BASE + 17)
>> +enum v4l2_fm_tx_preemphasis {
>> +     V4L2_FM_TX_PREEMPHASIS_DISABLED         = 0,
>> +     V4L2_FM_TX_PREEMPHASIS_50_uS            = 1,
>> +     V4L2_FM_TX_PREEMPHASIS_75_uS            = 2,
>> +};
>
> I suggest renaming this to V4L2_CID_FM_TX_PREEMPHASIS. There is already a
> similar V4L2_CID_MPEG_EMPHASIS control and others might well appear in the
> future, so I think this name should be more specific to the FM_TX API.

Right. Agreed for both suggestions.

>
>> +#define V4L2_CID_TUNE_POWER_LEVEL            (V4L2_CID_FM_TX_CLASS_BASE + 18)
>> +#define V4L2_CID_TUNE_ANTENNA_CAPACITOR              (V4L2_CID_FM_TX_CLASS_BASE + 19)
>> +
>>  /*
>>   *   T U N I N G
>>   */
>
> Regards,
>
>        Hans
>
> --
> Hans Verkuil - video4linux developer - sponsored by TANDBERG Telecom
> --
> 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
>
  
Trent Piepho June 14, 2009, 4:23 p.m. UTC | #3
On Sun, 14 Jun 2009, Eduardo Valentin wrote:
> >> +/* FM Modulator class control IDs */
> >> +#define V4L2_CID_FM_TX_CLASS_BASE      (V4L2_CTRL_CLASS_FM_TX | 0x900)
> >> +#define V4L2_CID_FM_TX_CLASS                 (V4L2_CTRL_CLASS_FM_TX | 1)
> >> +
> >> +#define V4L2_CID_RDS_ENABLED                 (V4L2_CID_FM_TX_CLASS_BASE + 1)
> >> +#define V4L2_CID_RDS_PI                              (V4L2_CID_FM_TX_CLASS_BASE + 2)
> >> +#define V4L2_CID_RDS_PTY                     (V4L2_CID_FM_TX_CLASS_BASE + 3)
> >> +#define V4L2_CID_RDS_PS_NAME                 (V4L2_CID_FM_TX_CLASS_BASE + 4)
> >> +#define V4L2_CID_RDS_RADIO_TEXT                      (V4L2_CID_FM_TX_CLASS_BASE + 5)
> >
> > I think these RDS controls should be renamed to V4L2_CID_RDS_TX_. This makes
> > it clear that these controls relate to the RDS transmitter instead of a
> > receiver. I would not be surprised to see similar controls appear for an RDS
> > receiver in the future.

So there should there be different controls to set the same thing, one set
for tx and another for rx?

> >> +#define V4L2_CID_PREEMPHASIS                 (V4L2_CID_FM_TX_CLASS_BASE + 17)
> >> +enum v4l2_fm_tx_preemphasis {
> >> +     V4L2_FM_TX_PREEMPHASIS_DISABLED         = 0,
> >> +     V4L2_FM_TX_PREEMPHASIS_50_uS            = 1,
> >> +     V4L2_FM_TX_PREEMPHASIS_75_uS            = 2,
> >> +};
> >
> > I suggest renaming this to V4L2_CID_FM_TX_PREEMPHASIS. There is already a
> > similar V4L2_CID_MPEG_EMPHASIS control and others might well appear in the
> > future, so I think this name should be more specific to the FM_TX API.

The cx88 driver could get support for setting the fm preemphasis via a
control.  I added support via a module option, but a control would be
better.  You're saying it shouldn't use this fm preemphasis control?
--
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
  
Hans Verkuil June 14, 2009, 4:59 p.m. UTC | #4
On Sunday 14 June 2009 18:23:41 Trent Piepho wrote:
> On Sun, 14 Jun 2009, Eduardo Valentin wrote:
> > >> +/* FM Modulator class control IDs */
> > >> +#define V4L2_CID_FM_TX_CLASS_BASE      (V4L2_CTRL_CLASS_FM_TX | 0x900)
> > >> +#define V4L2_CID_FM_TX_CLASS                 (V4L2_CTRL_CLASS_FM_TX | 1)
> > >> +
> > >> +#define V4L2_CID_RDS_ENABLED                 (V4L2_CID_FM_TX_CLASS_BASE + 1)
> > >> +#define V4L2_CID_RDS_PI                              (V4L2_CID_FM_TX_CLASS_BASE + 2)
> > >> +#define V4L2_CID_RDS_PTY                     (V4L2_CID_FM_TX_CLASS_BASE + 3)
> > >> +#define V4L2_CID_RDS_PS_NAME                 (V4L2_CID_FM_TX_CLASS_BASE + 4)
> > >> +#define V4L2_CID_RDS_RADIO_TEXT                      (V4L2_CID_FM_TX_CLASS_BASE + 5)
> > >
> > > I think these RDS controls should be renamed to V4L2_CID_RDS_TX_. This makes
> > > it clear that these controls relate to the RDS transmitter instead of a
> > > receiver. I would not be surprised to see similar controls appear for an RDS
> > > receiver in the future.
> 
> So there should there be different controls to set the same thing, one set
> for tx and another for rx?

Sure. Say some RDS decoder stores the PI in a register. I can imagine that
we add a V4L2_CID_RDS_RX_PI control for that. Whereas a V4L2_CID_RDS_TX_PI
control will return the PI sent out by the encoder.

Currently no such controls exist (or are needed) for an RDS decoder, but I
wouldn't be surprised at all if we need them at some point in the future.

> 
> > >> +#define V4L2_CID_PREEMPHASIS                 (V4L2_CID_FM_TX_CLASS_BASE + 17)
> > >> +enum v4l2_fm_tx_preemphasis {
> > >> +     V4L2_FM_TX_PREEMPHASIS_DISABLED         = 0,
> > >> +     V4L2_FM_TX_PREEMPHASIS_50_uS            = 1,
> > >> +     V4L2_FM_TX_PREEMPHASIS_75_uS            = 2,
> > >> +};
> > >
> > > I suggest renaming this to V4L2_CID_FM_TX_PREEMPHASIS. There is already a
> > > similar V4L2_CID_MPEG_EMPHASIS control and others might well appear in the
> > > future, so I think this name should be more specific to the FM_TX API.
> 
> The cx88 driver could get support for setting the fm preemphasis via a
> control.  I added support via a module option, but a control would be
> better.  You're saying it shouldn't use this fm preemphasis control?

Correct. This set the pre-emphasis when transmitting. For receiving you want
a separate control. Although the enum should be made generic. So FM_TX can be
removed from the enum.

Why should we have one rx and one tx control for this? Because you can have
both receivers and transmitters in one device and you want independent control
of the two.

It is my believe that the other fm_tx controls are unambiguously transmitter
related, so I don't think they need a TX prefix. It doesn't hurt if someone
can double check that, though.

Regards,

	Hans
  
Eduardo Valentin June 16, 2009, 10:52 a.m. UTC | #5
On Sun, Jun 14, 2009 at 06:59:13PM +0200, ext Hans Verkuil wrote:
> On Sunday 14 June 2009 18:23:41 Trent Piepho wrote:
> > On Sun, 14 Jun 2009, Eduardo Valentin wrote:
> > > >> +/* FM Modulator class control IDs */
> > > >> +#define V4L2_CID_FM_TX_CLASS_BASE      (V4L2_CTRL_CLASS_FM_TX | 0x900)
> > > >> +#define V4L2_CID_FM_TX_CLASS                 (V4L2_CTRL_CLASS_FM_TX | 1)
> > > >> +
> > > >> +#define V4L2_CID_RDS_ENABLED                 (V4L2_CID_FM_TX_CLASS_BASE + 1)
> > > >> +#define V4L2_CID_RDS_PI                              (V4L2_CID_FM_TX_CLASS_BASE + 2)
> > > >> +#define V4L2_CID_RDS_PTY                     (V4L2_CID_FM_TX_CLASS_BASE + 3)
> > > >> +#define V4L2_CID_RDS_PS_NAME                 (V4L2_CID_FM_TX_CLASS_BASE + 4)
> > > >> +#define V4L2_CID_RDS_RADIO_TEXT                      (V4L2_CID_FM_TX_CLASS_BASE + 5)
> > > >
> > > > I think these RDS controls should be renamed to V4L2_CID_RDS_TX_. This makes
> > > > it clear that these controls relate to the RDS transmitter instead of a
> > > > receiver. I would not be surprised to see similar controls appear for an RDS
> > > > receiver in the future.
> > 
> > So there should there be different controls to set the same thing, one set
> > for tx and another for rx?
> 
> Sure. Say some RDS decoder stores the PI in a register. I can imagine that
> we add a V4L2_CID_RDS_RX_PI control for that. Whereas a V4L2_CID_RDS_TX_PI
> control will return the PI sent out by the encoder.
> 
> Currently no such controls exist (or are needed) for an RDS decoder, but I
> wouldn't be surprised at all if we need them at some point in the future.
> 
> > 
> > > >> +#define V4L2_CID_PREEMPHASIS                 (V4L2_CID_FM_TX_CLASS_BASE + 17)
> > > >> +enum v4l2_fm_tx_preemphasis {
> > > >> +     V4L2_FM_TX_PREEMPHASIS_DISABLED         = 0,
> > > >> +     V4L2_FM_TX_PREEMPHASIS_50_uS            = 1,
> > > >> +     V4L2_FM_TX_PREEMPHASIS_75_uS            = 2,
> > > >> +};
> > > >
> > > > I suggest renaming this to V4L2_CID_FM_TX_PREEMPHASIS. There is already a
> > > > similar V4L2_CID_MPEG_EMPHASIS control and others might well appear in the
> > > > future, so I think this name should be more specific to the FM_TX API.
> > 
> > The cx88 driver could get support for setting the fm preemphasis via a
> > control.  I added support via a module option, but a control would be
> > better.  You're saying it shouldn't use this fm preemphasis control?
> 
> Correct. This set the pre-emphasis when transmitting. For receiving you want
> a separate control. Although the enum should be made generic. So FM_TX can be
> removed from the enum.
> 
> Why should we have one rx and one tx control for this? Because you can have
> both receivers and transmitters in one device and you want independent control
> of the two.

Yes, agreed here. There is the possibility to have receiver and transmitter
both in the same device. So, I think it is better to have separated controls.

> 
> It is my believe that the other fm_tx controls are unambiguously transmitter
> related, so I don't think they need a TX prefix. It doesn't hurt if someone
> can double check that, though.

hmm.. I see no problem removing the fmtx prefix of the preemphasis
enum. But, if it is becoming a generic enum, better to check if its
meaning is the same of existing emphasis enum for mpeg.

> 
> Regards,
> 
> 	Hans
> 
> -- 
> Hans Verkuil - video4linux developer - sponsored by TANDBERG Telecom
> --
> 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
  
Hans Verkuil June 16, 2009, 11:18 a.m. UTC | #6
On Tuesday 16 June 2009 12:52:34 Eduardo Valentin wrote:
> > It is my believe that the other fm_tx controls are unambiguously
> > transmitter related, so I don't think they need a TX prefix. It doesn't
> > hurt if someone can double check that, though.
>
> hmm.. I see no problem removing the fmtx prefix of the preemphasis
> enum. But, if it is becoming a generic enum, better to check if its
> meaning is the same of existing emphasis enum for mpeg.

It has the same meaning, but unfortunately the mpeg enum is already a public 
API and so cannot be changed. I never realized at the time that that enum 
is more generic than I thought.

But at least this enum can be made generic.

Regards,

	Hans
  
Eduardo Valentin June 16, 2009, 11:51 a.m. UTC | #7
On Tue, Jun 16, 2009 at 01:18:57PM +0200, ext Hans Verkuil wrote:
> On Tuesday 16 June 2009 12:52:34 Eduardo Valentin wrote:
> > > It is my believe that the other fm_tx controls are unambiguously
> > > transmitter related, so I don't think they need a TX prefix. It doesn't
> > > hurt if someone can double check that, though.
> >
> > hmm.. I see no problem removing the fmtx prefix of the preemphasis
> > enum. But, if it is becoming a generic enum, better to check if its
> > meaning is the same of existing emphasis enum for mpeg.
> 
> It has the same meaning, but unfortunately the mpeg enum is already a public 
> API and so cannot be changed. I never realized at the time that that enum 
> is more generic than I thought.
> 
> But at least this enum can be made generic.

Yes, sure.

> 
> Regards,
> 
> 	Hans
> 
> -- 
> Hans Verkuil - video4linux developer - sponsored by TANDBERG Telecom
> --
> 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
  
Trent Piepho June 16, 2009, 6:06 p.m. UTC | #8
On Tue, 16 Jun 2009, Eduardo Valentin wrote:
> On Sun, Jun 14, 2009 at 06:59:13PM +0200, ext Hans Verkuil wrote:
> > On Sunday 14 June 2009 18:23:41 Trent Piepho wrote:
> > > > > similar V4L2_CID_MPEG_EMPHASIS control and others might well appear in the
> > > > > future, so I think this name should be more specific to the FM_TX API.
> > >
> > > The cx88 driver could get support for setting the fm preemphasis via a
> > > control.  I added support via a module option, but a control would be
> > > better.  You're saying it shouldn't use this fm preemphasis control?
> >
> > Correct. This set the pre-emphasis when transmitting. For receiving you want
> > a separate control. Although the enum should be made generic. So FM_TX can be
> > removed from the enum.
> >
> > Why should we have one rx and one tx control for this? Because you can have
> > both receivers and transmitters in one device and you want independent control
> > of the two.
>
> Yes, agreed here. There is the possibility to have receiver and transmitter
> both in the same device. So, I think it is better to have separated controls.

Is both a receiver and transmitter in the same device different than having
two receivers or two transmitters?  In which case, since controls are not
assigned to a specific input, how does one handle that?
--
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
  

Patch

diff --git a/linux/include/linux/videodev2.h b/linux/include/linux/videodev2.h
index b8cffc9..9733435 100644
--- a/linux/include/linux/videodev2.h
+++ b/linux/include/linux/videodev2.h
@@ -806,6 +806,7 @@  struct v4l2_ext_controls {
 #define V4L2_CTRL_CLASS_USER 0x00980000	/* Old-style 'user' controls */
 #define V4L2_CTRL_CLASS_MPEG 0x00990000	/* MPEG-compression controls */
 #define V4L2_CTRL_CLASS_CAMERA 0x009a0000	/* Camera class controls */
+#define V4L2_CTRL_CLASS_FM_TX 0x009b0000	/* FM Modulator control class */
 
 #define V4L2_CTRL_ID_MASK      	  (0x0fffffff)
 #define V4L2_CTRL_ID2CLASS(id)    ((id) & 0x0fff0000UL)
@@ -1144,6 +1145,39 @@  enum  v4l2_exposure_auto_type {
 
 #define V4L2_CID_PRIVACY			(V4L2_CID_CAMERA_CLASS_BASE+16)
 
+/* FM Modulator class control IDs */
+#define V4L2_CID_FM_TX_CLASS_BASE		(V4L2_CTRL_CLASS_FM_TX | 0x900)
+#define V4L2_CID_FM_TX_CLASS			(V4L2_CTRL_CLASS_FM_TX | 1)
+
+#define V4L2_CID_RDS_ENABLED			(V4L2_CID_FM_TX_CLASS_BASE + 1)
+#define V4L2_CID_RDS_PI				(V4L2_CID_FM_TX_CLASS_BASE + 2)
+#define V4L2_CID_RDS_PTY			(V4L2_CID_FM_TX_CLASS_BASE + 3)
+#define V4L2_CID_RDS_PS_NAME			(V4L2_CID_FM_TX_CLASS_BASE + 4)
+#define V4L2_CID_RDS_RADIO_TEXT			(V4L2_CID_FM_TX_CLASS_BASE + 5)
+
+#define V4L2_CID_AUDIO_LIMITER_ENABLED		(V4L2_CID_FM_TX_CLASS_BASE + 6)
+#define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME	(V4L2_CID_FM_TX_CLASS_BASE + 7)
+#define V4L2_CID_AUDIO_LIMITER_DEVIATION	(V4L2_CID_FM_TX_CLASS_BASE + 8)
+
+#define V4L2_CID_AUDIO_COMPRESSION_ENABLED	(V4L2_CID_FM_TX_CLASS_BASE + 9)
+#define V4L2_CID_AUDIO_COMPRESSION_GAIN		(V4L2_CID_FM_TX_CLASS_BASE + 10)
+#define V4L2_CID_AUDIO_COMPRESSION_THRESHOLD	(V4L2_CID_FM_TX_CLASS_BASE + 11)
+#define V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME	(V4L2_CID_FM_TX_CLASS_BASE + 12)
+#define V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME	(V4L2_CID_FM_TX_CLASS_BASE + 13)
+
+#define V4L2_CID_PILOT_TONE_ENABLED		(V4L2_CID_FM_TX_CLASS_BASE + 14)
+#define V4L2_CID_PILOT_TONE_DEVIATION		(V4L2_CID_FM_TX_CLASS_BASE + 15)
+#define V4L2_CID_PILOT_TONE_FREQUENCY		(V4L2_CID_FM_TX_CLASS_BASE + 16)
+
+#define V4L2_CID_PREEMPHASIS			(V4L2_CID_FM_TX_CLASS_BASE + 17)
+enum v4l2_fm_tx_preemphasis {
+	V4L2_FM_TX_PREEMPHASIS_DISABLED		= 0,
+	V4L2_FM_TX_PREEMPHASIS_50_uS		= 1,
+	V4L2_FM_TX_PREEMPHASIS_75_uS		= 2,
+};
+#define V4L2_CID_TUNE_POWER_LEVEL		(V4L2_CID_FM_TX_CLASS_BASE + 18)
+#define V4L2_CID_TUNE_ANTENNA_CAPACITOR		(V4L2_CID_FM_TX_CLASS_BASE + 19)
+
 /*
  *	T U N I N G
  */