diff mbox

[2/9] v4l2: add RF gain control

Message ID 1433592188-31748-2-git-send-email-crope@iki.fi (mailing list archive)
State New, archived
Headers show

Commit Message

Antti Palosaari June 6, 2015, 12:03 p.m. UTC
Add new RF tuner gain control named RF gain. That is aimed for
external LNA (amplifier) chip just right after antenna connector.

Cc: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
 drivers/media/v4l2-core/v4l2-ctrls.c | 4 ++++
 include/uapi/linux/v4l2-controls.h   | 2 ++
 2 files changed, 6 insertions(+)

Comments

Hans Verkuil June 8, 2015, 9:03 a.m. UTC | #1
On 06/06/2015 02:03 PM, Antti Palosaari wrote:
> Add new RF tuner gain control named RF gain. That is aimed for
> external LNA (amplifier) chip just right after antenna connector.

I don't follow. Do you mean:

This feeds into the external LNA...

But if that's the case, then the LNA chip isn't right after the antenna connector,
since there is a RF amplified in between.

Remember, this is not my area of expertise, so if I don't understand it, then that's
probably true for other non-experts as well :-)

Regards,

	Hans

> 
> Cc: Hans Verkuil <hverkuil@xs4all.nl>
> Signed-off-by: Antti Palosaari <crope@iki.fi>
> ---
>  drivers/media/v4l2-core/v4l2-ctrls.c | 4 ++++
>  include/uapi/linux/v4l2-controls.h   | 2 ++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
> index e3a3468..0fc34b8 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -888,6 +888,8 @@ const char *v4l2_ctrl_get_name(u32 id)
>  	case V4L2_CID_TUNE_DEEMPHASIS:		return "De-Emphasis";
>  	case V4L2_CID_RDS_RECEPTION:		return "RDS Reception";
>  	case V4L2_CID_RF_TUNER_CLASS:		return "RF Tuner Controls";
> +	case V4L2_CID_RF_TUNER_RF_GAIN_AUTO:	return "RF Gain, Auto";
> +	case V4L2_CID_RF_TUNER_RF_GAIN:		return "RF Gain";
>  	case V4L2_CID_RF_TUNER_LNA_GAIN_AUTO:	return "LNA Gain, Auto";
>  	case V4L2_CID_RF_TUNER_LNA_GAIN:	return "LNA Gain";
>  	case V4L2_CID_RF_TUNER_MIXER_GAIN_AUTO:	return "Mixer Gain, Auto";
> @@ -960,6 +962,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
>  	case V4L2_CID_WIDE_DYNAMIC_RANGE:
>  	case V4L2_CID_IMAGE_STABILIZATION:
>  	case V4L2_CID_RDS_RECEPTION:
> +	case V4L2_CID_RF_TUNER_RF_GAIN_AUTO:
>  	case V4L2_CID_RF_TUNER_LNA_GAIN_AUTO:
>  	case V4L2_CID_RF_TUNER_MIXER_GAIN_AUTO:
>  	case V4L2_CID_RF_TUNER_IF_GAIN_AUTO:
> @@ -1161,6 +1164,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
>  	case V4L2_CID_PILOT_TONE_FREQUENCY:
>  	case V4L2_CID_TUNE_POWER_LEVEL:
>  	case V4L2_CID_TUNE_ANTENNA_CAPACITOR:
> +	case V4L2_CID_RF_TUNER_RF_GAIN:
>  	case V4L2_CID_RF_TUNER_LNA_GAIN:
>  	case V4L2_CID_RF_TUNER_MIXER_GAIN:
>  	case V4L2_CID_RF_TUNER_IF_GAIN:
> diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
> index 9f6e108..87539be 100644
> --- a/include/uapi/linux/v4l2-controls.h
> +++ b/include/uapi/linux/v4l2-controls.h
> @@ -932,6 +932,8 @@ enum v4l2_deemphasis {
>  
>  #define V4L2_CID_RF_TUNER_BANDWIDTH_AUTO	(V4L2_CID_RF_TUNER_CLASS_BASE + 11)
>  #define V4L2_CID_RF_TUNER_BANDWIDTH		(V4L2_CID_RF_TUNER_CLASS_BASE + 12)
> +#define V4L2_CID_RF_TUNER_RF_GAIN_AUTO		(V4L2_CID_RF_TUNER_CLASS_BASE + 31)
> +#define V4L2_CID_RF_TUNER_RF_GAIN		(V4L2_CID_RF_TUNER_CLASS_BASE + 32)
>  #define V4L2_CID_RF_TUNER_LNA_GAIN_AUTO		(V4L2_CID_RF_TUNER_CLASS_BASE + 41)
>  #define V4L2_CID_RF_TUNER_LNA_GAIN		(V4L2_CID_RF_TUNER_CLASS_BASE + 42)
>  #define V4L2_CID_RF_TUNER_MIXER_GAIN_AUTO	(V4L2_CID_RF_TUNER_CLASS_BASE + 51)
> 

--
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
Antti Palosaari July 16, 2015, 7:13 a.m. UTC | #2
On 06/08/2015 12:03 PM, Hans Verkuil wrote:
> On 06/06/2015 02:03 PM, Antti Palosaari wrote:
>> Add new RF tuner gain control named RF gain. That is aimed for
>> external LNA (amplifier) chip just right after antenna connector.
>
> I don't follow. Do you mean:
>
> This feeds into the external LNA...
>
> But if that's the case, then the LNA chip isn't right after the antenna connector,
> since there is a RF amplified in between.

On that case, there is amplifier between antenna and tuner chip. And I 
named it as a RF gain. It is quite same thing than LNA gain, but I would 
call LNA gain as a "RF gain" inside the tuner chip - integrated into 
tuner chip. These terms are not 100% established as LNA gain and RF gain 
are considered as a same thing very often.

The fact is that almost every silicon tuner nowadays has integrated 
RF/LNA amplifier, but there is devices having still separate amplifier 
between tuner and antenna. For DVB side there is multiple such devices, 
for example PCTV 290e and PCTV 292. HackRF SDR has separate RF amplifier 
and multiple other amplifiers.

So all in all, I needed second "LNA/RF" gain control and as LNA gain was 
already defined, I defined another as a RF gain.


  RF in   +----+     +-----+     +-------+     +----+  IF out
-------> | RF | --> | LNA | --> | Mixer | --> | IF | -------->
          +----+     +-----+     +-------+     +----+

Those boxes (RF/LNA/Mixer/IF) are gain controls and signal travels in 
order shown from gain to gain. In real life there is usually even more 
gains withing gain stage, eg. Mixer gain stage could contain 3 different 
amplifiers.


RF in = antenna input
IF out = connected to ADC (demod)


Hope the RF gain / LNA gain documentation is now a bit better.


regards
Antti
diff mbox

Patch

diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index e3a3468..0fc34b8 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -888,6 +888,8 @@  const char *v4l2_ctrl_get_name(u32 id)
 	case V4L2_CID_TUNE_DEEMPHASIS:		return "De-Emphasis";
 	case V4L2_CID_RDS_RECEPTION:		return "RDS Reception";
 	case V4L2_CID_RF_TUNER_CLASS:		return "RF Tuner Controls";
+	case V4L2_CID_RF_TUNER_RF_GAIN_AUTO:	return "RF Gain, Auto";
+	case V4L2_CID_RF_TUNER_RF_GAIN:		return "RF Gain";
 	case V4L2_CID_RF_TUNER_LNA_GAIN_AUTO:	return "LNA Gain, Auto";
 	case V4L2_CID_RF_TUNER_LNA_GAIN:	return "LNA Gain";
 	case V4L2_CID_RF_TUNER_MIXER_GAIN_AUTO:	return "Mixer Gain, Auto";
@@ -960,6 +962,7 @@  void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
 	case V4L2_CID_WIDE_DYNAMIC_RANGE:
 	case V4L2_CID_IMAGE_STABILIZATION:
 	case V4L2_CID_RDS_RECEPTION:
+	case V4L2_CID_RF_TUNER_RF_GAIN_AUTO:
 	case V4L2_CID_RF_TUNER_LNA_GAIN_AUTO:
 	case V4L2_CID_RF_TUNER_MIXER_GAIN_AUTO:
 	case V4L2_CID_RF_TUNER_IF_GAIN_AUTO:
@@ -1161,6 +1164,7 @@  void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
 	case V4L2_CID_PILOT_TONE_FREQUENCY:
 	case V4L2_CID_TUNE_POWER_LEVEL:
 	case V4L2_CID_TUNE_ANTENNA_CAPACITOR:
+	case V4L2_CID_RF_TUNER_RF_GAIN:
 	case V4L2_CID_RF_TUNER_LNA_GAIN:
 	case V4L2_CID_RF_TUNER_MIXER_GAIN:
 	case V4L2_CID_RF_TUNER_IF_GAIN:
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index 9f6e108..87539be 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -932,6 +932,8 @@  enum v4l2_deemphasis {
 
 #define V4L2_CID_RF_TUNER_BANDWIDTH_AUTO	(V4L2_CID_RF_TUNER_CLASS_BASE + 11)
 #define V4L2_CID_RF_TUNER_BANDWIDTH		(V4L2_CID_RF_TUNER_CLASS_BASE + 12)
+#define V4L2_CID_RF_TUNER_RF_GAIN_AUTO		(V4L2_CID_RF_TUNER_CLASS_BASE + 31)
+#define V4L2_CID_RF_TUNER_RF_GAIN		(V4L2_CID_RF_TUNER_CLASS_BASE + 32)
 #define V4L2_CID_RF_TUNER_LNA_GAIN_AUTO		(V4L2_CID_RF_TUNER_CLASS_BASE + 41)
 #define V4L2_CID_RF_TUNER_LNA_GAIN		(V4L2_CID_RF_TUNER_CLASS_BASE + 42)
 #define V4L2_CID_RF_TUNER_MIXER_GAIN_AUTO	(V4L2_CID_RF_TUNER_CLASS_BASE + 51)