[linux-dvb] [RFC] Add LNA support to VIDIOC_G/S_TUNER

Manu Abraham abraham.manu at gmail.com
Thu Aug 30 17:28:20 CEST 2007


Steven Toth wrote:
> Hans Verkuil wrote:
>> On Thursday 30 August 2007 02:16, Michael Krufky wrote:
>>  
>>> Hans Verkuil wrote:
>>>    
>>>> Several tuners have support for a Low Noise Amplifier circuit that
>>>> is intended to improve the signal of weak channels.
>>>>
>>>> Usually there is no need for the user to change it, but in some
>>>> cases it is useful or necessary to do so. In particular for the
>>>> TUNER_SAMSUNG_TCPN_2121P30A and TUNER_SAMSUNG_TCPG_6121P30A tuners
>>>> where the LNA circuit must be set manually: i.e. there is no
>>>> automatic detection of whether LNA should be on or off.
>>>>
>>>> These tuners are used in the popular Hauppauge PVR-500 cards and
>>>> the lack of manual control of the LNA bit is a continuing headache.
>>>> This problem is not limited to linux: Hauppauge supplies a Windows
>>>> utility to allow users to toggle the bit.
>>>>
>>>> I propose to add a new tuner capability: V4L2_TUNER_CAP_LNA 0x0080.
>>>>
>>>> Furthermore, the reserved[4] field in struct v4l2_tuner is changed
>>>> to:
>>>>
>>>> __u32 flags;
>>>> __u32 reserved[3];
>>>>
>>>> And the following flags are defined:
>>>>
>>>> V4L2_TUNER_FLAG_LNA_AUTO     0x00
>>>> V4L2_TUNER_FLAG_LNA_MANUAL      0x01
>>>> V4L2_TUNER_FLAG_LNA_OFF      0x00
>>>> V4L2_TUNER_FLAG_LNA_ON      0x02
>>>>       
>>> This seems fine to me.  The only thing that I wonder is:
>>>
>>> #1) Why will the user need to change the LNA setting?
>>>
>>> #2) How will the user know that the setting needs to be changed?
>>>     
>>
>> Let me answer this in reverse order:
>>
>> 2) The picture is bad
>> 1) To solve 2)
>>
>> Basically Hauppauge made a bad decision when they chose the Samsung
>> tuners. I'm still not certain whether Hauppauge made a mistake in the
>> board design or that these tuners are fatally flawed: the datasheet
>> for the PAL Samsung tuner has a flowchart showing how to detect
>> whether the LNA bit should be turned on depending on the signal
>> strength. However, testing showed that this doesn't work, furthermore
>> I received information that the required circuitry to make this work
>> wasn't implemented. The datasheet for the NTSC tuner has no flowchart
>> at all, so I'm still not sure whether the NTSC tuner has that ability
>> or not, but even if it has it won't work due to lack of board support.
>>
>> By default the LNA bit is on, which works fine in 90% of the cases.
>> However, people who have a very strong signal will get herringbone
>> artifacts and need to turn it off. And since signal strength can very
>> between channels it is not enough to make it a module option.
>>
>>   
> 
> I think this is generally a positive change, but I have a couple of
> comments.
> 
> What about the digital equivalent and how will this impact hardware
> designs were a tuner frontend (and LNA) maybe shared between analog and
> digital paths? I remember discussions on the DVB ML where a module
> parameter was added for the nova-t-500, because of a similar requirement.
> 
> Does this feature also belong in dvb_frontend?


I do this dynamically, rather than in a static hardcoded way. It is
called a servo loop. You can do something similarly, if you want. Sounds
quite silly to hard code things.

      static int mc44s80x_adjust_lna_ifgain(struct mc44s80x_state *state)
      {
              struct mc44s80x_reg *reg = &state->reg;
              static int lna_gain = 7;
              int if_pwr, err = 0;
              while (1) {
                      err = mc44s80x_avg_ifdet(state, &if_pwr);

                      if (if_pwr > RF_PWR_MAX) {
                              if (lna_gain < LNAAGC_GAIN_MIN) {
                                      lna_gain++; /* increasing lna gain
reduces tuner gain */

MC44S80x_SETFIELD(LNAAGC_NORMALAGC, *(reg->lna_agc), lna_gain);
                              } else {
                                      break;
                              }
                      } else if (if_pwr < RF_PWR_MIN) {
                              if (lna_gain > 0) {
                                      lna_gain--; /* decreasing lna gain
increases tuner gain */

MC44S80x_SETFIELD(LNAAGC_NORMALAGC, *(reg->lna_agc), lna_gain);
                              } else {
                                      break;
                              }
                      }
              }

              return err;
      }



More information about the linux-dvb mailing list