Bug 13839

Summary: xc5000 no longer works with Myth-0.21-fixes branch
Product: Drivers Reporter: Rafael J. Wysocki (rjw)
Component: OtherAssignee: drivers_other
Status: CLOSED DOCUMENTED    
Severity: normal CC: devin.heitmueller
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.31-rc Subsystem:
Regression: Yes Bisected commit-id:
Bug Depends on:    
Bug Blocks: 13615    

Description Rafael J. Wysocki 2009-07-26 21:23:33 UTC
Subject    : Regression 2.6.31:  xc5000 no longer works with Myth-0.21-fixes branch
Submitter  : Mark Lord <lkml@rtr.ca>
Date       : 2009-07-19 15:15
References : http://marc.info/?l=linux-kernel&m=124814394016848&w=4
Handled-By : Devin Heitmueller <dheitmueller@kernellabs.com>

This entry is being used for tracking a regression from 2.6.30.  Please don't
close it until the problem is fixed in the mainline.
Comment 1 Devin Heitmueller 2009-07-27 19:09:41 UTC
The following are Mark Lord's comments, which were replied to the email on linux-media but did not make it into the ticket.  I will provide my additional comments in a separate comment.

=== From Mark Lord ===

There is definitely a regression, in that it doesn't work without
config changes to Myth.  This is due to the new way that firmware uploads
are implemented in xc5000:  slower, and more often than before.

But the MythTV workaround required is simple:

    3. In mythtv-setup -> CaptureCards -> DVB:1 -> RecordingOptions
    there is a tickbox for "Open DVB Card on Demand".  It was ticked,
    so I un-ticked that box.  Everything now works!

    When that tickbox was selected, the xc5000 took five (5) seconds to "open",
    as it did the firmware upload every time.  This appeared to exceed some
    timeout inside myth.

    With the tickbox NOT ticked, myth just opens the tuner once at startup,
    and keeps it open, so no more delay when it wants to use it.



Dunno what to say about this one.
Comment 2 Devin Heitmueller 2009-07-27 19:24:15 UTC
Given the brevity of the initial bug report description, here is a description of the actual issue.  Also bear in mind that the linux-media thread discussed a number of different issues, and the one discussed here is the only actual regression from 2.6.30.

The root of the problem is that in 2.6.31 I did a bunch of cleanup work on the xc5000 driver.  This included improvements to the i2c exception handling, fixing some significant tuning performance issues, enabling proper power management, and switching to firmware that Xceive has permitted redistribution for.

All of these changes are working well for most cards (I believe between Michael Krufky and I, we own all of the cards that have the xc5000 which are currently supported under Linux).  However, there is a very specific problem with the 950q which is exposed under MythTV:  The i2c master on the au0828 is *very* slow.  It takes about seven seconds to load the xc5000 firmware across the bus.  This was not a problem before because the firmware was only loaded once when the card was initialized.  However, as a result of the power management work, the firmware needs to be reloaded whenever the card is woken from sleep.  The firmware is automatically reloaded on the first tuning attempt, and the seven second load time seems to have hit some internal timeout on the current MythTV 0.21 branch.

Considerable effort has been expended to improve the performance of the i2c bus.  However, I am not hopeful that we will be able to make it go much faster as we are currently on-par with the Windows driver.

That said, our options are at this point to either disable power management for the xc5000 on the 950q by default, which would be highly undesirable since the vast majority of MythTV users are using PCI based cards rather than USB and thus this would severely impact battery life for all laptop users.  Or, we can have a note in the documentation, the LinuxTV and MythTV wikis that suggests that people using the 950q with MythTV should either use the suggestion Mark provided above about keeping the frontend open, or use the "no_powerdown" modprobe option to disable the power management for their particular environment.

In the end, this all boils down to the default behavior and who has to adapt:  we have to choose between asking MythTV users to uncheck a checkbox in mythtv-setup, or asking that all users have their laptop battery sucked up unless they use a specific modprobe option.

Between those two options, I think we would be better having the MythTV users adapt as they tend to be more advanced users and as the target audience for the HVR-950q goes, they are a smaller population than those using lightweight applications targeted at laptops such as Kaffeine, mplayer, or MeTV.
Comment 3 Rafael J. Wysocki 2009-07-27 22:46:18 UTC
On Monday 27 July 2009, Mark Lord wrote:
> Rafael J. Wysocki wrote:
> > This message has been generated automatically as a part of a report
> > of recent regressions.
> > 
> > The following bug entry is on the current list of known regressions
> > from 2.6.30.  Please verify if it still should be listed and let me know
> > (either way).
> > 
> > 
> > Bug-Entry   : http://bugzilla.kernel.org/show_bug.cgi?id=13839
> > Subject             : xc5000 no longer works with Myth-0.21-fixes branch
> > Submitter   : Mark Lord <lkml@rtr.ca>
> > Date                : 2009-07-19 15:15 (8 days old)
> > References  : http://marc.info/?l=linux-kernel&m=124814394016848&w=4
> > Handled-By  : Devin Heitmueller <dheitmueller@kernellabs.com>
> ..
> 
> There is definitely a regression, in that it doesn't work without
> config changes to Myth.  This is due to the new way that firmware uploads
> are implemented in xc5000:  slower, and more often than before.
> 
> But the MythTV workaround required is simple:
> 
> > 3. In mythtv-setup -> CaptureCards -> DVB:1 -> RecordingOptions
> > there is a tickbox for "Open DVB Card on Demand".  It was ticked,
> > so I un-ticked that box.  Everything now works!
> > 
> > When that tickbox was selected, the xc5000 took five (5) seconds to "open",
> > as it did the firmware upload every time.  This appeared to exceed some
> > timeout inside myth.
> > 
> > With the tickbox NOT ticked, myth just opens the tuner once at startup,
> > and keeps it open, so no more delay when it wants to use it.