On Tue, 2005-03-01 at 23:43, Tyler Trafford wrote:
> Tell how this patch works for you, it's a very simple change against
> 0.3.2f.  It sets it to 0 only for NTSC cards, and to 1 for anything
> else.

Yeah, this works. But the problem is the one that I referred to earlier.
The read_setting only returns the right video mode if the tuner is
actually tuned to a signal (at least on my PVR500). Otherwise it returns
0x01 which turns into NTSC, which makes it not work on PAL.  If the card
is tuned to a channel, it does work. 

But it seems the solution might be to find out why state->norm is not
functioning correctly. Why was that?   ivtv calls the driver with
DECODER_SET_NORM, and SET_NORM calls DECODER_SET_AUDIO.

So what I did was move the logic for CH_SEL_ADC2, PATH1_SEL_CTL to
SET_AUDIO and call SET_AUDIO after a SET_INPUT.

I'll post a patch separately, but it also includes my changes for FC3
with 4KSTACKS and adding IOCTL to cx25840 to make it easier to
experiment these settings. But effectively what it looks like now is:

--- 8< ---
  case DECODER_SET_AUDIO: {
    int *iarg = arg;
    u32 pinc;
    int path1;
    int ch_sel_adc2;
    int vidfmt= state->norm;    // = cx25840_get_vid_fmt( client );
    
    DEBUG(1, "set audio: 0x%02x", *iarg);
    
    // not sure if the following is correct, I just took it from the
SET_INPUT methods
    switch( (state->input>=0 && state->input<8)?
cx25840_input_layout[state->input]: -1 )
    {
    case CX25840_COMPOSITE: 
        pinc= 41942880; 
        path1= 2;
        ch_sel_adc2= 0;
        break;
        
    case CX25840_SVIDEO: 
        pinc= state->input==0? 57266012: 41942880;
        path1= 2;
        ch_sel_adc2= 0;
        break;
        
    case CX25840_TUNER:
        pinc= 41942880;         // should this be 41246400 for PAL?
        path1= (vidfmt==VIDEO_MODE_NTSC && cardtype!=2)? 2: 0;
        ch_sel_adc2= (vidfmt==VIDEO_MODE_NTSC)? 0: 1;
        break;
        
    default:
            // no input set: do nothing, we'll come back to this after an input
is set
        DEBUG(1, "invalid input setting 0x%02x", state->input );
        return -EINVAL;
    }    
  
    switch (*iarg) {
    case DECODER_AUDIO_32_KHZ:  pinc/=320; break;
    case DECODER_AUDIO_441_KHZ: pinc/=441; break;
    case DECODER_AUDIO_48_KHZ:  pinc/=480; break;
    default:
      DEBUG(1, "invalid audio setting 0x%02x", *iarg);
      return -EINVAL;
    }
    
    state->audio = *iarg; 
    
    CX25840_TAG('S','a','m','p','l','e',' ','r','a','t','e')
    CX25840_SET_CH_SEL_ADC2( ch_sel_adc2 )
    CX25840_SET_PATH1_SEL_CTL( path1 )
    CX25840_SET_SRC3_PHASE_INC( pinc )    
    CX25840_EXECUTE
    break;
  }

--- 8< ---


And then 
        cx25840_command(client, DECODER_SET_AUDIO, &state->audio);
after the SET_INPUT switch, leaving out these three settings from the
SET_INPUT.

This way, no matter which order SET_AUDIO, SET_NORM and SET_INPUT are
called the audio is always set up correctly. The previous way seemed a
bit inconsistent.

I also don't know which freqout to use, the old code had 41246400, the
new code uses 41942880. If I use the new number I get very 'froggy'
sound, if I use the old number I get a PLL going out of phase every
couple of minutes (high pitched distortion). 

But at the very least this number is now in a single place.

-J



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
ivtv-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ivtv-devel

Reply via email to