• Trent Piepho's avatar
    V4L/DVB (5374): Or51132: refactor i2c code, improve error resilience · d9e54324
    Trent Piepho authored
    The code the i2c transactions was leftover from the old V4L-based ATSC
    driver.  It did too little with too much code.  It is re-written to
    remove unnecessary parameters and be more efficient.  A demod register
    can now be read with one function call, instead of repeating a dozen line
    block of code each time.
    
    There were msleep()'s, which appear to be unnecessary, spread around all
    the I2C transactions.  These have been removed.  Reading SNR used to take
    about 130 ms, now it's down to 1.8 ms.
    
    Reads from the demodulator's registers do not return correct results
    sometimes.  Adding or removing the delays in the I2C transactions did not
    appear to effect the probability of failure.  If anything, the
    transactions without delays were less likely to fail, but since far more
    transactions could be made per second the number of failures per hour was
    greater.
    
    To increase reliability, the SNR and get_params functions will now retry
    once if they get bad data back.  This appears to have reduced the
    probability of failure to effectively zero.
    Some error messages are cleaned up or given KERN_* levels when they were
    missing.  
    
    or51132_setmode() wasn't returning correct error codes, which is fixed as
    well.
    
    CC: Rusty Scott <rustys@ieee.org>
    Signed-off-by: default avatarTrent Piepho <xyzzy@speakeasy.org>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
    d9e54324
or51132.c 17.1 KB