IVTV changes:

#0.3.7k - moved YUV code into ivtv-yuv.c
	- moved version info into ivtv-version.h
	- added detection for PVR500
	- added --version option for ivtvctl

#0.3.7j - fix for older kernels compile.
	- Hans tuner fix
	- John/Ian fixes for YUV decoding.

#0.3.7i - [Philip Rowlands] Add MODULE_PARM_DESC for most parameters
	- [Philip Rowlands] Use 2.6-style module_param (merge from v4l tree)
	- [Philip Rowlands] tuner/tda9887: print warning if unsupported
	  parameter given.
	- Fixed sliced CC handling.

#0.3.7h - don't allow VBI framing code errors: leads to VPS or WSS being seen
	  as teletext.
	- add a function to decode a VBI line to the decoders
	- fix raw VBI for NTSC (the end of the CC lines contained garbage).
	- enable stricter sliced VBI matching to prevent WSS or VPS from being
	  seen as teletext.
	- fix division by zero when choosing a width > 720.
	- improve tveeprom: now reports the audio processor correctly, and it
	  also shows the decoder processor.
	- fix ivtvctl: register addresses were mangled by a 'char' cast.
	- add sliced VBI support for the cx24850.
	- remove cardtype from cx24850. Now the ivtv driver sets the cardtype
	  automatically.

#0.3.7g - added ivtv-radio patch from Adam Forsyth:
		-It speeds up the station searching by skipping the range
		 below where stations are if you don't want to see all strong
		 frequencies.
		-It closes the file handle for the radio device
	- added small patch from Kevin Ruland to export the module device table.
	- cleanup QuickSetup
	- prepare for sliced VBI for cx25840.
	- make VBI specification more detailed to allow sliced VBI autodetection.
	- split itv struct initialization to allow for changing the card type
	  pending on the tveeprom data.
	- fixed a NULL deferenced in ivtv_reset_digitizer.
	- add new (internal) ioctls: IVTV_IOC_G_VBI_FMT, IVTV_IOC_S_VBI_FMT,
	  IVTV_IOC_TRY_VBI_FMT and IVTV_IOC_G_VBI_CAP. This will be used as the
	  proof-of-concept for a V4L2 sliced VBI standard.
	  This API is for now internal and may change.
	- allow changing the sliced VBI settings while capturing. This used to
	  return EBUSY.
	- fixed inadvertently removed tuners from tveeprom.c
	- added vbi-detect test utility. This scans the VBI lines and tries to
	  detect which VBI types are transmitted.
	- fix compile error for ivtv-detect.c.
	- removed hack in radio.c. Doesn't seem to be needed anymore, at least,
	  I can no longer reproduce the problem.

#0.3.7f - clean up actions in sources
	- regularize driver kernel messages
	- make the driver less verbose
	- all ioctl calls can now be seen at debug level 16 (DEBUG_IOCTL flag)
	- tda9887 is now per card (so like radio and tuner it's an array)
	  This fixes attempts by cards without an tda9887 to access the chip.
	- Increase MAX_CARDS to 12
	- Allocate driver structures dynamically
	- Allocate sliced VBI buffers required for MPEG insertion dynamically.
	- Added top-level Makefile to build driver and tools at once.
	- Moved the wss, fw_api, vvi_passthrough and vbi.c to the test directory.
	  These are compiled but not installed.
	- Removed from the utils directory: test.au, capture.c/cc_decode.h,
	  chann.c. As far as I can tell these are obsolete.

#0.3.7e - added back the dropped fixes from 0.3.7c
	- added doc fixes from Philip Rowlands
	- fix in cx25480 chip probe.
	- add PVR500 radio support.
	- proper indent of ivtv-cards.c
	- fix eeprom radio detection bug
	- add line in kernel log to clearly separate each card 
	- fix bug where calling VIDIOC_G_FMT for the VBI format
	  would clear the sliced VBI settings. Don't do this if
	  a capture is running.
	- removed dead VBI code.
	- improve WSS, VPS and CC passthrough handling. No more WSS
	  signals should be dropped.
	- fix 64-bit bug in embedded VBI causing missing VBI lines.
	- fix the sliced VBI internal format: it was entirely possible
	  to loose data.
	- /dev/vbi4 and /dev/vbi0 (for sliced VBI) returned the data in
	  swapped byte order. Fixed. (Embedded VBI was not affected by
	  this bug.)
	- improve autodetect saa7127, should make the i2c_enable argument
	  obsolete. 
	- the vbi tool now selects the appropriate VBI types according to
	  the tuner standard (NTSC/PAL).

#0.3.7d - Hans patches all added for multiple fixes through the driver.

#0.3.7c - Hans patches added for VBI timestamps and tuner fixes.
	- Hans patch to fix VBI passthrough mode.
	- patch to fix volume levels between pvr cards.
	- fixes to compile clean added.
	- fixes temp for tuner.h compile on older kernels.

#0.3.7b - patch to fix wm8775 load for i2c conflicts
        - fix for tda
        - tuner patch.
	- YUV Decoder patches
        - Misc patches from D. Hugh Redelmeier

#0.3.7a - YUV decoder patch.
        - X server update for YUV.

#0.3.7 - YUV decoder patches.
       - powerdown soundchip on cx25840 when not in use. 	
       - i2c index improvements for cx25840 module.

#0.3.6z - busmaster enable patch.
        - YUV Decoding fixes patch.
        - fix interruptible sleep statement.
        - declaration fix of a variable.
        - new x server
        - streams declaration fix.

#0.3.6y - patch from Hans for module autoload fixes..
        - patch for color key for FB from John Harvey.

#0.3.6x - Robert Hardy patch to fix i2c range and also fix interruptible_sleep
	  usage.

#0.3.6w - added patch to fix ivtvfbctl information on options.
        - added patch to fix module options
        - added patch to make tda9887 code more sane.
        - changed encoder buffers to 32k, hopefully works as well, because 128k
          is way too big (this is only when statically allocating them).

#0.3.6v - added stream safety patch.
        - added fixes for YUV
 
#0.3.6u - patches for PAL tda module, and card id patch added.

#0.3.6t - don't use semaphores around DMA calls for reading from the encoder.

#0.3.6s - John Harveys patch for YUV decoding fixes.
        - cx25840 patches for audio volume control
        - fixed radio.c to have more functionality.

#0.3.6r - made buffer allocation amounts changable through module options.
        - steal buffers when allocation fails for encoding.

#0.3.6q - patch to unify digitizer function (produces compile warnings???).

#0.3.6p - fixes to PAL teletext, doesn't make a ton of sense, but works,
          something is odd there.
        - John Harveys YUV decoding fixes.
        - patches to fix the stream DMA logging so it's clear what is going on.
        - digitizer reset improved, so digitizer should also be setup again
          for capture properly.

#0.3.6o - increased encoder buffer total to 4 meg by default at startup.
        - added patch for improvements to cx25840 i2c detection
        - added cleanup patches for cx25840
        - added patch for wm8775

#0.3.6n - changed encoder buffers to use 128k if static and older firmware,
          else 32k if newer firmware or dynamic allocation setup.

#0.3.6m -  patches to detect cx25840 better.
        - patches to clean up audio in cx25840
        - changed encoder buffers to 32k.

#0.3.6l - Tylers fixes for indenting in cx25840 module.
        - John Harveys fixes for YUV Decoding.

#0.3.6k - found bug in VBI buffer size setup for NTSC.

#0.3.6j - fixes for cx25840 initialization
        - included the source to the newest X server.

#0.3.6i - fix for pci oops segfault.
        - fix for i2c xfer code, retrys and turns off fast fw load in cx25840
          if it fails.

#0.3.6h - John Harveys patches for YUV scaling and also new X driver.
        - Makefile patches for debian.

#0.3.6g - changed buffer sizes back, seems they were best as is, now looking
          at ways to allocate buffers with smaller pages and still address
          them as large chunks, not sure how, but the chip makes us have to use
          larger buffers than we'd like to.
        - dynamic flags added for streams, so we can have each stream have a
          separate setting for buffers in the future.
        - code added for future buffers which are groups of pages, setup in
          a writable chunk but able to be DMA'd to chip, and not allocate
          large buffers, this is a 'work in progress'.

#0.3.6f - changed decoder buffers to 32k
        - default to static memory allocation now, suspect more stable.
        - firmware patches added, quicker firmware load and fixes.

#0.3.6e - reduced all buffers to around 4k, to allow for allocations to be
          more likely no matter what.
  
#0.3.6d - reduce decoder DMA buffers to 16k for reduced memory usage.
        - found bug where we freed the registered v4l device if buffers
          couldn't be allocated, that's very bad :-).
        - new module parameter ivtv_dynbuf which chooses either to use 
          dynamic buffer allocation or disable, default is to enable it (1).

#0.3.6c - patch to fix typo in vblank code for PAL.
        - patch to fix scaling.

#0.3.6b - patches to fix pal vbi setup, and vblank.
        - patches to fix ioctl return in ivtvctl.

#0.3.6a - msleep interruptible patch for fixing dep on tda driver.
        - added firmware rewrite fix for pvr150/500.

#0.3.6  - added patch for composite/s-vid/tuner switching without pops.
        - added patch for 550.

#0.3.5z - reworked VBI buffer sizes, more exact, no strange calculations
          anymore.
 
#0.3.5y - reduce YUV buffers again safely.
        - change buffer default/max values to tune better to whats needed.
        - VBI changes to setup and size, mainly cleanup.

#0.3.5x - really fixed autodetection now, should be right, was in a funny
          order before, now more logical and able to force or auto detect std.

#0.3.5w - removed buffer split for YUV and VBI, seems to be breaking things.
        - trying vsync interrupt differently, may get the timing better.

#0.3.5v - input gain for cx25840 patch.
        - added values for registers in pal mode.
        - check FMT register for standard to set VBI to.
        - reverse some vsync changes for now, keep safe parts. 

#0.3.5u - vsync interrupt now really only gives an interrupt per frame.

#0.3.5t - added setup for VBI from i2c dumps so NTSC is setup like Windows
          driver, haven't done PAL ones yet, no way to test it easily.
        - changes to pvr150/500 vbi sliced code to get closer, yet still
          not able to get proper cc data or vbi.

#0.3.5s - remove check for VBI boundry, don't use vsync event notification.

#0.3.5r - change encoder startup once again to hopefully be more
          stable and decided bad to redo settings per startup, seems that
          is not as stable.

#0.3.5q - don't print out every vbi offset change as err level.
        - digitizer setup for itvc16 vsync no longer uses event.

#0.3.5p - setup encoding even when interface is open for other encodings.
        - fix autodetection, and setup variables still for standard, not
          totally best way yet, but will work again for autodetection right.

#0.3.5o - changed encoder startup, re-init digitizer and setup vsync better.

#0.3.5n - decoder buffer gather was checking results wrong if buffers were
          enough.
        - only change vbi line size to +12 for NTSC, breaks PAL.
        - restart VBI capture when our buffers are invalid.

#0.3.5m - vbi buffer offset read from vbi buffer ptr register now.

#0.3.5l - removed cruft from patch.
        - patch from Tyler simplifying cx25840 module, and split it up into 
          separate parts.
        - force re-init of input even after first capture is running.
 
#0.3.5k - patch to reorder ivtvctl code and improve it.
        - patch to cleanup cx25840-driver.c and improve things there.
        - when capture starts re-init cx25840 norm/audio/video/vbi input.

#0.3.5j - re-init cx25840 input each capture start, and stop/start 
	      microcontroller around the input on/off.
        - color s-video patch added.

#0.3.5i - decoder buffer sizes reduced, was a test to increase them that
          got left in the driver.
        - remove DMAP lock on encoder when stopping.
        - cleanup of thread code, also added right DMA clear for VBI function.


#0.3.5h - fixes so pvr150/500 and pvr350 cards work together better.

#0.3.5g - patch for cleanup of cx25840-driver.c.

#0.3.5f - changes to raw vbi buffer size, exact size of xfers.

#0.3.5e - pci id  for new pvr500 card.
        - patch for YUV close.
        - smaller YUV buffers.
        - swap data for VBI in read, not in work queues, for raw data. 
        - reinit VBI variables every encoder start for VBI.

#0.3.5d - right fixes for audio from Tyler Trafford.
        - John Harvey patch for YUV in NTSC.
        - Hotplug firmware patch from Tyler Trafford.

#0.3.5c - fixes to YUV decoding for /dev/video48 buffer usage, use vsync and
          fix the YUV vsync stuff.
        - fixes for Myth ff/rw hopefully, so not just showing prev image.

#0.3.5b - changes to capture startup and VBI raw mode.
        - added patch for audio setting registers in cx25840-driver.c.
        - buffer size calculations for raw VBI.
        - tv standard now default is correct, 0 wasn't valid, made it
          not behave as expected and be setup in NTSC by default, even
          though was supposed to be.
        - black magic now off by default in cx25840-driver.c.

#0.3.5a - don't setup vsync notification in encoder for re-init.
        - set NTSC audio statically instead of autodetection
        - set digitizer standard on driver load
        
#0.3.5 - changed VBI to not timestamp, switched cx25840-driver.c file
              from 4s.
       - remote control gpio reset patch included.

#0.3.4y - changed size of raw VBI so as to be 1444 for PAL, and add 12 for NTSC.
        - misc suggested audio fixes for cx25840 from mailing lists.

#0.3.4x - no longer need to have one big buffer for raw VBI, decreases the
          memory allocation considerably.
        - back to 1444 for vbi size on raw VBI, seems like it works now
          with my other changes, possibly the way to go, no lost characters.
        - move vbi stream swap and parse to unify pio and DMA mode.
 
#0.3.4w - fixes to allow non-embed mode not to try and embed anyways.
        - internal input enable patch added for pvr150.

#0.3.4v - redo of VBI size calculations, seemed to have fixed the raw missing
          bytes, which looks like we didn't grab the whole frame, and also
          skip the start codes in the process (was 4 bytes offset), also
          do the garbage removal for the pvr150/500 cards.
        - work around Myth bug where embed mode is give the passthrough value
          hence triggering the other embedding modes, so now check and keep
          it 1 or 0 for now, need to remove that check for experimentation with
          the firmware embedding mode.

#0.3.4u - change vbi re-insertion and embed, now use firmware method, wth
          User Data packets.  This needs work, the embed ioctl now takes
          different values like 2=firmware user data packets, 1=ivtv method
          doing it ourselves, 3=firmware private data packets (buggy).
        - currently still same vbi insertion as before, but improved, have
          a new interrupt used to get vsync's exact.

#0.3.4t - fix to X server source to compile.
        - change Vsync interrupt to actually be correct one, so we get
          real vsync timing per frame, not the old all off time one, seems
          like this interrupt is the real one.
        - when not in reinsertion mode, we use firmware re-insertion which
          is very minimal and un-noticable, but have to use User data insert,
          still seems to not be able to extract it from decoder???.

#0.3.4s - John Harveys patch for YUV ioctl and Xserver.
        - updated xserver binary.

#0.3.4r - closed captioning fixes, raw data mode.

#0.3.4q - fixed raw vbi, buffers were way too small.
        - AMD 64bit changes from Hans.
        - new x driver binary and source included in utils directory for YUV 
          decoder support.  (still need to add John Harveys patch, I couldn't,
          something wrong either with me or the patch, probably me :-).
 
#0.3.4p - split up all VBI to separate work queues, for dec/enc ones, and
          mpg separate now.
        - patch from David DeHaven to keep from having to set inputs during
          audio switches.
        - changes to how CC is done for dec output, queue for data and
          should be much better yet, still some bugs, hard to time it right.
        - fix for switching TV/FM in tda9887 from Axel Thimm (otherwise 
		you sometimes get static)

#0.3.4o - fixed problems with saa7127 feeding, redid again, bugs last time,
          now seems like perfect output.
        - fixes to allow multiple buffers to work for firmware VBI queue.

#0.3.4n - better locking and queue of decoder VBI input to pvr350 saa7127 out.

#0.3.4m - patches from Hauppauge, thanks to Axel Thimm, listed below...

 	a) ivtv-0.3.3p-new-tuner.patch
   		Place TUNER_LG_NTSC_TAPE's FM support in the proper slot and add
   		a new entry

 	b) ivtv-0.3.3z-radio.patch
   		FM radio support on PVR-150/500

 	c) ivtv-0.3.4j-audio-switch.patch
   		Composite audio switching

 	d) ivtv-0.3.4j-videostatus.patch
   		needed for auto-scanning channels (returns whether selected
   		frequency has video signal)

        - added pre-filter parameter of temporal of 8 like Windows driver.

#0.3.4l - fix to raw capture line size

#0.3.4k - detect new pvr150 id.
        - patch for audio input to cx25840
        - patch for printf statements
        - fixes from Hans, and modified by me, for VBI re-insertion.
        - some more vbi fixes.

#0.3.4j - change way vbi decoding works for output through pvr350,
          now lock and send vbi data on vsync interrupt.
        - some debug messages removed.
        - use pio mode for vbi re-insertion and vbi decoding.
        - fix to osd stream so uses it for user pointer buffers, use
          those again as default instead of static ones.

#0.3.4i - fixes for when not using dynamic buffer allocation.

#0.3.4h - fixes from Hans for vbi re-insertion.
        - changes to allow proper dynamic allocation of dec-vbi buffer and
          pvr350 vbi output to work right, don't have to read the vbi
          device for it all to work right now.
        - stream fixes.

#0.3.4g - work on cc output for pvr350, not clean output, missed characters
          on vbi re-insertion it seems.
        - have some work for vbi where it in theory could capture more than
          one frame of vbi per interrupt, but still set to 1.
        - fixes to pvr350 da output so CC is setup one then send just data
          after that till done.
        - fixes so re-insertion isn't tried on pvr150 cards, because can't
          slice data, also only setup certain protocols if not setup for
          sliced when enabled for re-insertion.

#0.3.4f - patch to clean up digitizer defines, unify some code.
        - new pvr150 id included.
        - fixes to vbi decoding, device /dev/vbi4 works again.
        - fixes to vbi, found bugs with byte swapping.

#0.3.4e - more fixes to VBI, found a couple problems from moving to DMA,
          one major one was data wasn't processed, done before buffer was
          filled by DMA.

#0.3.4d - fix to VBI re-insertion and setup of dec vbi stream so it only
          happens on the 350 card, otherwise it crashes the system.

#0.3.4c - increase VBI re-insertion buffers, way too low.
        - changed buffering to use dynamic buffers, upon stream startup,
          should only use how much it needs for memory, turn this
          off by setting DYNAMIC_MEMORY_ALLOC to 0 in ivtv-driver.h.
        - changes to improve vbi insertion, still seems like something is
          wrong and overflows buffers, seems like not reading fast enough
          out of read function.
        - fixes to bugs in stream allocation, fixes to encoder work queue
          so stops before stream is deallocated. 

#0.3.4b - vbi raw count for pvr150/500 changed to 1444.
        - vbi raw count for saa7115 changed to 1444.
        - patch to fix cx25480 utils program again.

#0.3.4a - changed vbi line sizes to be dynamic and change depending on 
          digitizer.
        - added utils/capture.c, compile separately with 'make capture',
          and change the defines in the utils/Makefile to point to the
          librarys and include files for zvbi (all in the source dir of
          libzvbi, download from zapping.sf.net).  This allows you to use
          raw capture (needed for pvr150 cards) and still get CC output
          which is clean, also shows how to use the raw output and slice it 
          using zvbi.

#0.3.4 - fixes to John Harveys patch for ivtv-ioctl.c which were missing.
       - fixes to vbi changes from last version which causes lots of log
         messages.
       - changes to  vbi size which seems to be better for both digitizers,
         at least same as the settings in the Windows driver, for the most
         part.

#0.3.3z - John Harveys patch to decoder state.
        - add ioctl for fast_stop and splicing, in ivtv.h.

#0.3.3y - some changes to vsync setup when using VBI.

#0.3.3x - fixed vbi reinsertion bug, was doing the dma all wrong.
        - fixed set size of digitizer during a capture, breaks it bad.
        - fixed register vbi function in cx25840.

#0.3.3w - fixed vbi bug.

#0.3.3v - fixes to encoder capture, reset for cx25840 when timed out,
          and help keeping encoding going quickly and clearing the buffers.

#0.3.3u - fixes to pause in myth, shouldn't be slow now.
	- added patches for printf statements on amd64.
        - added patch for makefile fixes and 2.4 fix for debian.
        - added trans.pl program to utils directory.

#0.3.3t - fixed bug with fast_stop, changed wrong count. 
        - less verbose on pausing when not decoding and stop info.

#0.3.3s - added dec_options of no_stop and fast_stop, which allow us to
          either stop without decoding the rest of the buffers (default),
          and to stop only enough so that splicing is smooth.

#0.3.3r - fixes to stop decoding.

#0.3.3q - stop after buffers clear, leave decoder as is.
        - got black frame stop working right again.
        - fixes to pause and speed control ioctl, may help Myth freezes.

#0.3.3p - changes to YUV decoding, make more stable with MPEG.
        - uncommented some code for decoder, seems needed.
        - stop decoder and flush buffers completely.
        - adjust YUV buffers for PAL.  

#0.3.3o - fixed bug in ivtvctl where vbi insertion flag was never checked
          properly, so said it was always on.
        - stream allocation for stolen buffers and allocated buffers
          fixed.
        - increased max allocated buffers for VBI and PCM streams.
        - removed extra junk in mailbox api cmd for DMA xfers, no longer
          used for more than simple telling firmware data xfer counts.

#0.3.3n - use static buffers for OSD.
        - use semaphore for DMA lock around API call after decoder xfer.
        - changed DMA error in interrupt to not print verbose msgs or fw reload.
        - cleanup and changed decoder work queue, fixed little inefficiencies
          and possibly some bugs which may influence decoder/osd freezing.
        - fix to vbi insert flag, now initialize it to 0 upon module startup.

#0.3.3m - changed to speed ioctl to help ff/rw hangs.
        - fixes to YUV and MPEG decoding working together better.
        - less register changing for YUV decoding.

#0.3.3l - fix to saa7127 for newer kernels and still works with pvr150/350.
        - change to speed ioctl to try and fix Myth ff/rw pauses.

#0.3.3k - VBI fixes from Hans.
        - fixes to YUV/MPG switching.
        - fixes for VBI on pvr250 sliced.
        - fixes for scaling on pvr150/500 cards.

#0.3.3j - redid stop decoding/and decoder handling in hopes of fixing Myth
          TV problems, seems to have made my MythTV keep from freezing.

#0.3.3i - YUV Decoding works, pretty much, you must have done decoding before
          it will, at least once since the module has loaded, seems to init
          the decoder for YUV output and haven't figured out how to avoid 
          that requirement yet.

#0.3.3h - improvement for VBI and capture.

#0.3.3g - decrease VBI buffers.

#0.3.3f - changes to cx25840 so no autoconfigure is done.
        - found bug in resolution size setup fro cx25840 for codec ioctl.
        - fixes to keep settings from being changed while encoding. 
        - patch to use new read/write functions in cx25840
        - misc vbi and capture fixes when done together, and config setup.

#0.3.3e - more fixes to the register setup for the cx25840.
        - change input after input reset to regain proper input settings.

#0.3.3d - fixed problem with settings for the cx25840 registers settings,
          old code always reset these upon a capture, new one never reset,
          and the settings set at initialization were not right (never were
          setup before in actuality after a capture start).

#0.3.3c - found problem with change from not breaking out of OSD
          waitq after an interrupt, seems this speeds up osd and stops
          freezes if we do break out.

#0.3.3b - fix to saa7127 i2c and cx25840 getting along.
        - fix to jiffies member of api structure by D. Hugh Redelmeier.
        - D. Hugh Redelmeier patch to fix install.txt docs.

#0.3.3a - fixes to VBI decoder reinsertion.
        - added patch for cx25840 audio firmware load.
        - fixes to decoding, more places to keep dec/osd from locking.

#0.3.3 - VBI uses DMA safely now, decoder and encoder VBI should do this.

#0.3.2z - fix for svideo to comp or tuner switch in cx25840.
        - fixes for PAL and sound in cx25840, and also tuner patch.
        - have decoder YUV improvements for when we figure out how to make it work,
          now array of buffers, value for buffer used.
        - fixes to make decoder always go to black if requested.

#0.3.2y - bug in osd DMA where semaphore wasn't grabbed.
        - fixed yuv_fixup module option to be enabled if set, not done with
          a define in the source like it was, and fixed some bugs in the
          function induced sometime in the past, so now should work again.
        - some fixes to VBI startup capture, don't setup VBI unless needed.
	- remove VSCALE() setup in cx25840 for vertical scaling to not break,
          this fixes the bar across the bottom of screen problem.

#0.3.2x - various changes to cx25840 VBI settings, should be more likely to
          allow slicing in the future.
        - changes and patch added I made which should help decoder/osd 
          lockups, fixed alot of things from the patch.

#0.3.2w - added new pvr150/500 revision with different device ID c801.
	- took John Harveys ideas and made dec/osd waitq stuff have a
          global unlock function to help keep osd/dec freezes (please test).
        - patch to fix cx25840 reset.
        - patch to warn of tveeprom and tuner modules not being ivtv's versions.

#0.3.2v - VBI in raw mode works for the cx25840, thanks to captures produced
          from Allan Stirling I was able to figure this out.

#0.3.2u - remove extra strings from cx25840.
        - misc VBI work for cx25840.
        - fixed order of manual card type input.

#0.3.2t - added cx25840 patch for read/write functions to registers.

#0.3.2s - fixes to 2.6 from 2.4 patch with spinlocks.
        - Tyler Trafford  patch to not reset the cx25840 registers constantly.
        - fixes to cx25840 on/off function.
        - misc additions to cx25840 module.

#0.3.2r - added ability to view and change cx25840 registers directly,
          basically just like the saa7115 module, same as it was originally
          where ivtvctl -G and -g reg=0x00,val=0x00 will work again.
        - fixes to tveeprom
        - fixes for compiling in newer kernels.
        - fixes for compiling in 2.4

#0.3.2q - fixed logic wrong in switch statement for encoding lines api cmd.
        - Added docs/QuickSetup file for helping quickly just get the card
          working on a modern FC3 2.6 installation using pvr500/150 cards
          in NTSC Land.

#0.3.2p - fixed semaphore lock in interrupt for mailbox function when doing
          a refresh for VIM input.
        - patch to fix sound on pvr150/500 cards.

#0.3.2o - added OSD vsync back in, it is needed to keep things safe from
          jittery decoding.
        - just default all OSD PREP_FRAME calls to use buffers, not userspace
          ones, they are too small and also more dangerous at crashing the chip.
        - fixes to VBI to work with digitzer event notifications, and work for
          VBI on bot pvr250 and pvr350 cards.

#0.3.2n - added api calls from ivtv.sf.net api-log.txt, not known, but
          done suspiciously close to cc stuff, and event notification, so
          maybe related.
        - removed some bad code for encoder and decoder interrupt signals,
          seems to have slipped in from somewhere, not sure where though.
        - turn on event notifications for the itvc16 again, maybe above API
          calls added will help.
        - fixes to firmware load for cx25840
        - fixes for modparams in 2.6
        - fixes for tveemod for pvr500, no radio on second tuner

#0.3.2m - removed OSD vsync timing code, not needed anymore.
        - removed YUV OSD input code, unused and not needed.
        - encoding V4L Get Format parameters are now correct
          for type and size of frames when doing YUV capture.
        - have Encoder PIO mode able to be set from ivtv-driver.h
          using IVTV_ENC_PIO variable.

#0.3.2l - minor code cleanups, removed some unused code.

#0.3.2k - some cleanup and fixes to last DMA changes.
        - hotplug firmware no longer uses kmalloc
        - remove semi colons from cx25840 driver
        - run Lindent on cx25840 driver.
        - run Lindent on entire source of ivtv.

#0.3.2j - streams setup/teardown fully redone.
        - DMA functions all standardized.
        - DMA done interrupts are used again.
        - dynamic stream allocation of buffers possible, but
          not optimal from memory allocation failures.
        - lots of reworking of DMA, stream allocation, please test.
        - Encoder PIO mode possible, static variable for now in ivtv-irq.c
          in ivtv_sched_DMA() function (WARNING: uses alot of CPU)...
        	int encode_*_pio_mode = 0;
        - tveeprom-tuner-updates patch #3
        - cx25840-tuner_pinc patch
        - wm8775-debug patch
        - cx25840-modparam patch (breaks in 2.6.8 so not enabled)
        - wm8775-modparam patch
        - cx25840-hotplugfw patch
        - ivtv-0.3.2i-Makefile_support_non_current_kernel patch.

#0.3.2i - fixed sliced vbi on cx23416 chips.
        - card type patch.
        - DMA fixes to streamline code, improve some
          errors.
        - YUV Decoding fixes, more likely to work now I suspect,
          things like no byteswapping, which isn't done for YUV.
        - generic DMA functions added for from/to the chip.

#0.3.2h - audiofmt patch, with fixes.

#0.3.2g - 4k stack patch with sound.
        - fixes to speed up encoding DMA
        - misc pvr500/150 patches
        - added in pvr500 device id/s.

#0.3.2f - fixes to vbi.c to skip msnbc garbage data on CC output.
        - ivtvfbctl window patch.
        - vsync patches.
        - pvr 150 and 500 fixes.
        - msp fixes for audio and raise max mpg buffers patch.
        - pal fixes
        - tveeprom patch.

#0.3.2e - fixes to vbi.c util and CC, output clean formatted text.
        - AMD 64 patches (check, some in ivtv-streams my not have applied)
        - encoder stdout patch.
        - patch for incr of file pos in decoder write.
        - patch for decoder pts stop.
        - vbi patch.
        - fix for 2.4 kernel and compiling with cx25840.
        - patch for vsync interrupt
        - patch for init sighand spinlock.

#0.3.2d - patch for pvr150 audio in NTSC
	- fixes to vbi.c util and CC, output clean formatted text, 
          kindof :-).
        - patch for pvr150 stereo in PAL
        - patch for pg600
 
#0.3.2c - John Harveys fix for the OSD in FC3.
 
#0.3.2b - John Harveys updated X server
        - Ulfs PVR150 patch
        - Makefile patch
        - John Harveys stoping OSD messages from occuring that are benign
        - Mpeg1 patch from Ben Willers

#0.3.2a - New type of YUV decoding in OSD, more like PREP_FRAME.
	- Fix for saa7129 register setting.

#0.3.2 - DMA sync fixed for above 2.6.8 kernels in ivtv-osd.c
       - cc in vbi.c now outputs a bit better in line progresson, no repeating.
       - patch from John Harvey adding some fb support	

#0.3.1z - 64bit patch.
        - YUV buffers changed to fit YUV data better for decoding
        - wm8775 patch to fix register settings.
        - fix PAL black level for saa7127

#0.3.1y - use vsync to time interrupts for decoding/encoding, just like 
	  OSD is.

#0.3.1x - adjusted PCM buffer sizes and general buffer config to be better about allocation.

#0.3.1w - fixed PCM so it works again :-).  was a need for decoder offset adding for
          the DMA, yet didn't need this for the pts, so had to change the logic slightly.
 
#0.3.1v - fix YUV output for my VIA system, and can capture YUV/MPG now at the
          same time too, may fix PCM too I hope.
        - fix allocation errors?  try this, may do that.

#0.3.1u - fix YUV output for NTSC, and should be better all around.  Bug in way
          we calculated and also where we changed over to UV buffers from the Y
          buffers.

#0.3.1t  - Anduin Withers patch to allow a compile option 'make HP_FWLOAD=1'
           to use the firmware hotplug code.
         - Rob Shortt patch for encoder.c to allow 25fps.

#0.3.1s - patch from Robert Hardy to fix DMA above 2.6.8, sync was changed.

#0.3.1r - now a wm8775 module is included, may have to be manually loaded?
        - firmware size is same as one available on sshpvr site, at:
           ftp://ftp.shspvr.com/download/wintv-pvr_150-500/inf/pvr_2.0.18.22316.zip
#0.3.1q - Upload FW to cx25840, have to have  /lib/modules/HcwMakoA.ROM
	  it comes on the Hauppauge pvr150 CD, audio firmware.

	 cx25840.h:
	   #define AUDIO_FW_SIZE 13837
	   #define AUDIO_FW_FILE "/lib/modules/HcwMakoA.ROM"

	 Audio still will not work yet, need more, but this is the basic
         start of doing the right things for audio, Ulf knows more details
         of this, hopefully this will help him merge his code.
       - fix for MODULE_VERSION only used in 2.6.

#0.3.1p - Robert Hardy patch for module parameters to work right in 2.6.

#0.3.1o - VBI fix for vbi utility, patch seemed to have broken this from the
          ivtv.h header and changes to the vbi structure.
        - patch from Anduin Withers for version info ioctl.
        - fix from Peter Martin which allows the saa7115 to act better when
          no video is present.
        - patch to fix video freq setup in encoder util.

#0.3.1n - seems there's another device id for the pvr150 out there, hopefully
          same besides that, so it should now load too, also new info in
          doc/README.cx25840 about how some i2c loading isn't consistent with
          how I thought it was, so the i2c_enable options have to be different.

#0.3.1m - have IVTV_FW_LOADER check for defined to use firmware hotplug, 
          otherwise it will use the old method.  This needs some way to
          know if hotplug works on the system else we break alot of setups,
          so patches welcome to have that automatically verify things somehow.

#0.3.1l - YUV decoder stream patch from John Harvey.
        - spinlock used around entire interrupt handler, same as DMA one.
        - Anduin Withers patch for using 2.6 hotplug firmware if available.

#0.3.1k - remove llseek define from compat.h to fix 2.4
        - use frame based DMA for all firmware.

#0.3.1j - Using semaphores instead of spinlocks for all DMA buffer queue
          locking, testing this.

#0.3.1i - John Harveys patch for threads properly handling interrupts.

	- init chip just like windows driver, except for some register write
          that is really large, still need to look into that.

	- audio i2c dumps from Ulf, looks promising, this uses those to hopefully
          setup audio in the pvr150, doesn't work.

#0.3.1h - revert thread changes for sleeping for now, not as stable.

#0.3.1g - don't change decoder buffers to 128k for older firmware, 64k is  best.

#0.3.1f - dynamically at runtime change buffering for DMA depending on firmware
          revision, warn about bad ones.

#0.3.1e - John Harveys patch to Myth updated, now PIP works :-).
        - don't exit waitq if interrupted for enc/dec.

#0.3.1d - updated X driver to John Harveys newest, big fixes, heavily recommened

#0.3.1c - Fix OSD waitq logic.
	- Fix OSD Offset and size outofbounds checking.

	- fixes for coring/proc amp setting, since different than saa7115
          values.
        - Seems it's tuner type 47, need a newer kernel or patches.

	- Scaling for the cx25840 now works, only audio left and VBI/Radio.

	- more settings configurable, better reset.
        - Now things TODO are:
          1. Audio register, Enable, need i2c dumps, no datasheet for this.
          2. Scaling, it's hard to understand from the datasheet, need someone
             or i2c dumps to see how to set this up.
          3. VBI, Hans probably will eventually some day do this? seems easier
             than the saa7115 but still complicated calculations and video
             knowledge of VBI, so leave this up to him I hope :-).

	- brightness, contrast, hue, saturation are configured now for the cx25840.

	- fixed bug which seems like we never set the active input on startup,
          were assuming the default, but on the pvr150 this isn't so, it's S-video
          by default, not the tuner.

	- cx25840 Status: input map setup for pvr150.

	- cx25840 Status: I have figured out the svideo input is 0, composite is 2,
          tuner still just static, probably tuning, maybe a new tuner?
        - initialize cx25840 now like docs tell, and also fixed register setup for input
          to be correct.  Picture looks real nice now, just need tuner and sound support.
	  also of course all the proc amp settings and scaling are needed to get more
          advanced functionality.

	- cx25840 Status: It works as of Sat Oct 30 13:01:06 CDT 2004,
          composite setup by default, should work, input 2, tuner isn't, svideo should.

	- working on support for cx25840 chip, just starting.
 	- change saa7115 luminance control to have resolution enhancement.
        - cx25840 Status:
          2004 Oct 29 00:30:00 - can load pvr150 and pvr350 cards together now,
                 you must give the i2c_enable=x,x,x module option to 
                 the saa7127 and cx25840 modules, by default the
                 saa7127 is enabled for all cards and cx25840 isn't.
                 you have to do i2c_enable=-1,1 for the saa7127 to enable the
                 second pvr150/350 to work, and disable the first, opposite
                 for the cx25840.  So if having 3 cards, first 350, second 250
                 and third 150, you would give the saa7127 i2c_enable=1,-1 and cx25840
                 i2c_enable=-1,1 (since both 150/350 use i2c addr 0x88, but not the 250,
                 so your setting 2 cards up, first with saa7127, second with cx25840,
                 the i2c_enable= option is only counting 150/350 cards essentially).

		   options saa7127 i2c_enable=1,-1
		   options cx25840 i2c_enable=-1,1

#0.3.1b - ivtvfbctl tests new osd stream instead of get_user_pages.
        - threads sleeping are interruptible now, but hopefully right.

#0.3.1a - new OSD ioctl now can decode video frame accurately to timing, using
          vsync ioctl to show one field at a time, at least pretty dang close now,
          also seems stable too :-).

#0.3.1 - Added OSD ioctl, new one, that uses static buffers.

#0.2.0-rc2d - patch from Thor Kooda for compiling with gcc 2.95.
            - some fixes for non-informative messages from the OSD waitq.
            - possibly fix looping break of encoder buffering when overflow occurs,
              think I figured out what this was, possibly dynamic allocation, will
              see I guess.
            - some better info on tracking overflows with encoder.

#0.2.0-rc2c - fix some bugs with doing the osd waitq, actually quite easy to spot, but
              didn't have time to fix till now.  Sill some osd interrupted waitq messages,
              but actually benign somewhat from it probably being more informational, just
              happens when we stop decoding and are in the middle of a DMA.  Also seems there
              may be something with the OSD involved there too, but seems to not show any
              problems visibly, so maybe just need to change verboseness of those messages.

#0.2.0-rc2b - give OSD its own waitq and just use the busy flag for it, not the decoders.
            - changes to encoding default buffers to 3meg instead of 2, and wake up waitq
              when we can't find enough, so reading will kick in faster.

#0.2.0-rc2a - fix spinlock problem in osd, wasn't used actually, but was wrong lock.

#0.2.0-rc2 - cleanup old unused code and commented out stuff that isn't needed again.

#0.2.0-rc1o - nice level is set in 2.4. now.
 
#0.2.0-rc1n - decoder seems to be having a jitter problem with smaller buffers,
              odd, encoder seems happy and fine.  So having full 64k buffers for
              decoding, only have a meg of them so not as bad as encoding ones are
              when that big.

#0.2.0-rc1m - raise decoder buffers to 16k, encoder buffers are 16k, and decoder
              xfers are now 64k, while encoders are frame based.

#0.2.0-rc1l - use all mailboxes now, may help ff/rw hangs.

#0.2.0-rc1k - buffers are 4k now for enc/dec, and frame based enc, this is so
              memory issues are fixed, but may be less stable, although this
              will at least point that out and make it an understood problem
              I hope, I haven't got solutions for this at the moment, and have
              worked quite a bit to try.
            - stop encoding fix.

#0.2.0-rc1j - James A. Pattie updates for Perl utilities.

#0.2.0-rc1i - John Harveys fix for hanging threads in 2.4, and  
	      better threading too.

#0.2.0-rc1h - hans vbi patch and doc cleanup
	    - capture interrupt mask fix

#0.2.0-rc1g - added in install docs troubleshooting section talking about memory 
              allocation problems and rebooting to test.
            - don't wake up vsync from vsync function.
            - kill off threads if lingering, hopefully fix problems in 2.4

#0.2.0-rc1f - don't check vsync registers unless using framesync ioctl, check from
              there, just use vsync interrupt to wakeup, don't like reading those
              registers constantly, seems like it isn't needed.
            - change buffers back to 32k, I don't trust them that small still, 
              seems always to show problems.
            - revert to OSD dmap flag being used, isn't safe like currently done,
              only works well it seems with the changes to an osd stream, otherwise
              not safe it seems so only for 0.3.0+.

#0.2.0-rc1e - use 32k buffers, seems like we have to, hopefully as stable, this
              should make sure though by using it now, is that way in 100zz.
            - videodev unregister upon memory load failure should be safe now.

#0.2.0-rc1d - last part of function not being included fixed in ivtv-irq.c,
              forgot to also include the right include file for that.

#0.2.0-rc1c - fixes for ivtvfbctl to not mess up the state and also will
              do less fiddling with settings that the user never wanted change.
            - changed osd flag used from decoder to independent one, this should
              help interference with decoding and wasn't needed since we lock
              with semaphores now.
            - timestamp vsync function wasn't right for running in interrupt so
              probably wasn't working correctly.
            - missed update to version, and also spinlock in interrupt was one line
              above where it should be, replaced at Fri Oct 15 16:30:55 CDT 2004.

#0.2.0-rc1b - timestamp fixes, accurate now, help ff/rw in Myth.
            - scaling fixes 480x480 res, fixes default Myth setting.
	    - fix patch level rev number to be 0.2.0.	

#0.2.0-rc1a - Robert Hardy fix for pci dma sync.

#0.2.0-rc1 - Release Candidate 1, same as 115e basically.

#115e - seems like only 128k buffers work well, anything else will cause 
        problems long term, hardware seems to not do so well.
     
#115d - X11 driver fixed so it won't conflict with the fbdev driver, so both can
        be loaded together, may allow double screens and other fixes for people I think.

#115c - still wasn't right, had to use the api return, makes more sense
        this way now.
 
#115b - made gettiming ioctl sync itself up right for scr and pts.

#115a - more accurate framesync ioctl, wait more times and it's better.

#115 - Hans patch to fix VBI embedding.

#114z - Hans patches for fixing VBI and MPEG interference, also smaller VBI buffers.

#114y - do 128k DMA for encoding, frame based still bad, but smaller buffers seem
        ok I think, will see.

#114x - trying frame based DMA, again, seeing to if it is still not possible.

#114w - changed buffer sizes smaller, testing...

#114v - Hans fix for VBI.

#114u - fixed some problems with timestamps, surprisingly influence quite a bit of
        Myth playback and somehow the OSD too, make up for hardware inaccuracys.

#114s - more accurate timestamps now.

#114r - removed vsync tasklet, have different method now of gathering the
        timestamp info, do so in ioctl calls, where we would be wanting it,
        else seems like it may do odd things, plus should be able to calculate
        somewhat without decoding the timing a little.

#114q - fix NOFREEZE right.
      - Hans patch to fix pip and scaling.

#114p - move NOFREEZE in threads to only be used in 2.6.

#114o - patch added to name ioremap and irq allocations from David George.

#114n - increased priority of decoder and encoder threads like work queues do.

#114m - making sure everything is working right with the threads.
      - removed work queues.
      - fix for init of waitq in threads.

#114l - use thread instead of work queues, may port to 2.4 now :-).

#114k - fix for dma sync for 2.6.9+.

#114j - vsync now runs all the time.
      - try to keep timestamp sane, seems like the hardware may not.

#114i - fix for passthrough mode and framesync, allow timestamp interrupt.
      - fix for encoding, seems some firmware/cards have different offsets.

#114h - std detection sets frames per GOP.

#114g - fix for passthrough mode.

#114f - redid semaphores for stream locking, got rid of streams_lock, just
        use each streams semaphore.

#114e - check for enc register interrupt bit added again.
      - interrupt masks reworked, so DMA errors always are enabled, and
        don't enable all the interupts we don't use.

#114d - changed back to 128k buffers, page sized ones don't work well with
        the hardware.

#114c - Arpi's patch to allow fw api calls to be made to the encoder.
      - Kevins patch for timestamp accuracy.
      - page size buffers, maybe better now we are all
        in process space, encoding should handle many interrupts better.

#114b - changed speed ioctl method from what I tried before, seems to have fixed
        prerecorded playbacks.
      - don't use down_interruptible on semaphores.
      - various changes for stop decode where bugs seem to have been, probably not
        things hit by anyone or harmful.

#114a - fix from John Harvey for stop decode, seems it needed code I removed.
      - fix from Arpi for 2.4 kernel include missing.
 
#114 - changed semaphore and spin locks for register DMA access, have a
       separate one for that, seems to make sense, and hopefully fixes this
       odd semaphore oops I'm getting in the encoder work queue.
     - removed OSD decoder DMA check, maybe a problem?.
 
#113z - have semaphores be interruptible for the DMA registers locking,
        this seems to really help things alot.

#113y - cleanup of code not used anymore, still plenty, big changes from
        removing tasklets, actually things have simplified quite a bit.
      - fix for decoder DMA buffer flushing, seems it wasn't subtracting the
        right buffer value, needed readpos,  not bytesused, since that is
        zeroed out already when in the dma_q.

#113x - OSD/DEC waitq fixed so shouldn't spend forever looping.

#113w - cleanup to some old commented out code.
      - fixes for Myth channel changing, redo start/stop ioctls again, seem
        better, also speed control improved.
      - locking changed again for reg dma so no longer using irqsave
        spinlocks, not needed anymore.

#113u - more locking fixes, seems encoding and the OSD can interfere with
        each other actually, probably just from the OSD doing so many sg links,
        need to change that, but until then it may work better with the extra
        locking (and of course would be nice to use more sg links, seems the
        hardware is just buggy the more you use.

#113t - better locking of reg DMA, seems enc/dec xfer register really isn't
        able to handle not being locked, figures, but shows the central point
        where dec/enc DMA can affect each other.

#113s - studied the register DMA, balanced encoding/decoding/osd from what
        seems to be the way to do them right.  
      - OSD splits up DMA xfers, from watching the registers and seeing that
        the problem is always getting stuck on one of the many sg array links.
      - OSD split seems to no longer cause the wait to be longer for OSD DMA. 

#113r - now enc/dec completely use work queues, no tasklets, VBI is done in
        the encoder work queue, no data is touched in the interrupt context,
        only vsync tasklet now, still deciding what to do there.
 
#113q - changed semaphore locking for stop enc/dec, and DMA xfers.

#113p - changes to saa7115 digitizer settings, seem more correct, looks like
        the lum flashing is gone I've seen.
      - wait for encoder buffers when not enough available yet, should help
        alot if a system has high usage bursts, and now can do this from the
        encoding schedule DMA being out of interrupt time.

#113o - encoder work queue now fully implemented to redo the DMA if errors
        occur and no longer use the encoder DMA api cmd, seems to be
        pretty good with high load now, will see how works.

#113n - reverted back to encoder in irq context, fails to work fast enough,
        this is essentially 113k, or really 113f, nothing much changed since
        then, and very stable it seems here.

#113m - encoder now checks DMA status, and waits till ready, and waits till
        finished, and fixes DMA errors that occur, hopefully curtail the
        need for an encoder  timeout function, and fix the errors right :-).

#113l - some changes to itvc register reading function.
      - Encoder now uses a work queue for scheduling the DMA, this allows it
        to be in process context and should help us fix DMA errors easier.

#113k - and smaller buffers seem to cause less but similar problems as frame
        based DMA, seems we just have to stick with 32k buffers.

#113j - don't use frame based DMA for encoding, seems so useless and inefficient,
        plus buggy, probably why encoding would stop randomly in 0.1.9 actually,
        seems that stopped happening as frequent using the 128k xfers, possibility
        It seems to work better with bigger buffers, but then you waste too many
        megabytes of memory in total, have to use 4 times as much, 16 meg instead
        of 4, it's just worthless and unworkable (plus I dont' see the point
        of frame based xfers in mpeg2 capture, wouldn't we want GOPs, else what
        is a frame worth when missing almost all the pixels mostly since 
        compression and GOP structure makes each frame actually just partial of
        the entire picture.

#113i - patches and X server organized better.
      - Trying page size buffers for encoding/decoding once again, and
        frame sized DMA for encoding.  This is an ideal setup if it works,
        because then less data per DMA xfers and alot less memory needed
        in large chunks.

#113h - Passthrough mode now can be enabled/disabled while encoding, before,
        after, anytime you feel like it :-).

#113g - timeout has spinlocks to stop enc tasklets, also increased timeout.

#113f - smaller buffers, 32k, seems better if works as well as 128k.

#113e - now encoder will steal more buffers in overflow conditions, should make
        us never stop encoding from running dry of buffers, seems if you miss one
        interrupt for encoding it gives up.
      - frame based DMA should be pretty solid compared to before, seems much better.

      - changed to encoding timeout to hopefully help be a bit safer during timeouts.
     
#113d - switched back to byte DMA for encoding, not wanting to enable that by
        default just yet.  Also fix for OSD unused variable.

#113c - fix for passthrough mode so it sets up the stream if not done yet.
      - hopefully fixed it so frame based DMA encoding works, not setup by
        default, but was timing out frequently and seems it isn't as often
        now, if ever, does fix itself but dangerous still, so something I'm
        testing till permanently active (if ever, not sure we really want this
        by default, seems the chip really hates this mode).

#113b - fix passthrough mode, now should allow capture during/after/before,
        some caveats which may be permanent limitations or things to fix
        later to improve all the optional possibilities there.

#113 - exploring new decoder registers which show us more status on decoder
       activity and where pointer is in buffer, and buffer xfer sizes.

#112z - decoder startup for polling improved, seems to still eat CPU?  is it
        a polling bug actually, we are checking and there is space available,
        something is odd there.

#112y - fixed decoder close, flush queue again, not in ioctl or in stop though.
      - fix for flushing decoder, kind of, still odd how it won't flush from
        the ioctl manually for user apps.

#112x - fixed decoder poll I think, it was not checking right for free space.

#112w - fixed cahnnel changes and OSD this time for real hopefully :-)

#112v - fixed channel changes hopefully, semaphore locking needed
        some changes to work right there.

#112u - semaphores separated between encoding/decoding.
      - stop/start decode reworked in how they are executed.

#112t - reverted start/stop ioctl change and fixed messages right.

#112s - fixes hopefully for stop/start in Myth including channel changes and ff/rw.

#112r - OSD fixes, cleanup of how it works continuing previous work on that.
      - Encoder timeout tried different for resending DMA.

#112q - fix for lock breakout of osd waitq.

#112p - fix for oops with 2.4 and scatter list building.
      - fixing osd/dec jitter, seems  to be some checks I
        put in it seems. 

#112o - fixed bugs in OSD.
 
#112n - removed semaphore locking on OSD/DEC.  Not needed and does bad things.

#112m - worked on redoing OSD/DEC DMA with new method, figured out how to fix the
        DMA errors quicker.

#112l - check decoder sg list.
      - kmalloc again instead of using get_free_page. 
 
#112k - adjustments, seem to make my VIA more happy, and seem safest settings
        I suspect something is dangerous with the card dma'ing to/from wrong
        locations if not done carefully, probably the root cause when things
        get really messed up and crash.  Seems like this happens often when
        sending data in odd chunks.

#112j - trying framebased encoding with 32k buffers, seems like there's a
        chance this will work better than before manually sending DMA, will
        see.
 
#112i - encoding seems to work using the DMA registers, very easy actually,
        seems too simple, has to be some caveat, will see :-).  Issuing  the
        API cmd isn't needed, in fact that corrupts things, so the timeouts
        may be better now too :-).

#112h - trying all buffers dynamically allocated, no static ones, haven't
        tested that in awhile, seeing if it really works still.

#112g - buffer sizes for encoding changed back to 128k xfer and buffers, seems
        this is the only real stable setup for encoding long term, need to
        possibly figure out how to manually send encoding DMA, since it seems
        to have fixed the decoding/osd problems, possibly same for encoding.
 
#112f - maybe not so great on VIA, hmm, frame based encoding timing out 
        different there, figures, but haven't fully figured out sending
        encoding DMA through the registers totally yet, possibly more we
        can do there.

#112e - frame based encoding can work now, seems encoder DMA timeouts may be fixed,
        it went through one here smoothly on frame based DMA mode, seems to just
        need a manual push of the last DMA, didn't see any glitches either.

#112d - embedded VBI fixed, still not working on NTSC, but same as was before it 
        broke really bad, so should fix the PAL stuff I'd expect.

#112c - more work on YUV decoding, now can move the requested data, and if we knew
        the offset it may work, interrupts do keep going now, but seems to not
        display, and wrecks decoder output till module reload, seems closer.
      - cleanups, fixes for YUV encoding.

#112b - John Harveys patches for Myth added.

#112a - using better decoder values hopefully for buffers, reduce DMA errors
        since still should be less than current even though they recover now.
 
#112 - OSD DMA now should be safer than ever.
 
#111z - hopefully fixed encoder DMA errors, resending DMA?  seems to have run
        quite awhile here, but hard to tell yet.

#111x - decoder DMA w/registers setup to retry the DMA when having an error, seems
        to work.  
      - encoder check for status removed for now, wasn't checking details enough.
      - buffers changed to what hopefully is optimal for the hardware from what I
        can tell, 128k enc xfers using 8 16k buffers which fits into the encoder
        DMA registers perfectly.  And 64k decoder xfers which should work with the
        one decoder/osd DMA register I hope.

#111w - working on register DMA.

#111v - working on decoder/osd DMA through the registers, still a work in
        progress, exploring how to do this all manually and keep track of
        it ourselves instead of relying on the firmware.

#111u - sending decoder DMA via registers, sort of like using PIO mode it
        seems, you have to load the sg array register and send the decoder
        bit to the xfer register, then execute the api cmd with the sg array
        handle as 0.

#111t - removed spinlock for register access, seems somewhere something is
        bad there, covers too much code and really shouldn't have to do it,
        but good to group all registers access together into a function though.

#111s - removed OSD DMA check on Done interrupt.

#111r - trying DMA mode again, PIO mode and encoder 128k sizes don't work
        as well together, and PIO mode can randomly stop encoding.

#111q - decoder PIO mode seems to work well now.

#111o - changed decoder DMA parameters to match version John mentioned worked
        good for him on decoding, 106w.
      - encoder udelay removed, think I hit that and things went boom ;-).
 
#111n - worked on framebased encoder DMA, seems when we give less than 32k
        for a buffer, it stops.
      - check encoder buffer, seems the encoder also at times asks us for too
        much space from the offset, only happens with 256k and 512k xfers, odd.
      - sizes of encoder buffers are 32k again, seems that is what the encoder
        probably works best with, wondering if the decoder likes 64k, since that
        is the max xfer we are using and there's only one hardware sg buffer.
      - setup program index for encoding, can see the index information in
        there, it updates in a rolling from beginning to end and loops, right
        after the encoder buffer, and the first register shows which address it
        is currently writing to for the index.  This looks tricky to grab and
        figure out the format???

#111m - loop when dma error occurs fixed.

#111l - zero out decoder status registers when stopping and starting capture.
        
#111k - register reading improved so it should allow easier searching.

#111j - changed so that all register access use new reg access functions right.

#111i - trying to stop interrupts and lock each memory access to the card,
        maybe that is something which provokes it, should at least slow down
        hammering the card somewhat I hope, and serialize access during high
        load situations hopefully.

#111g - tuned decoder for my VIA, so should be more stable in general now,
        Intel was just fine before, but VIA was just horrible.

#111f - decoder DMA register check added back, seems to be necessary.

#111e - patch from John Harvey fixing decoder problems with returning
        -EAGAIN correctly.

#111d - decoding works again, getting things back together, hopefully more
        stable, at least have more ideas and possibilities now with the DMA
        a bit different than before.

#111c - snapshot of devel towards more stable buffers for the itvc chip.

#111a - checking encoder/decoder DMA registers to make sure last DMA
        is really done, this seems to work, and it seems that the last
        DMA isn't really finished many times even though we get the
        interrupt, kinda scary.
 
#111 - lock interrupt register access, and other registers.

#110z - check dec DMA mailbox for completion.

#110y - tuning for my VIA.

#110x - trying the 128k buffer again, see if it really is just when we
        do scatter gather or not.

#110w - changes to hopefully make DMA errors less likely, only give the
        firmware chunks which fit into the buffers, seems like there are only
        8 encoder and 1 decoder buffers actually, somehow the firmware is
        splitting up the DMA xfers for us.
 
#110v - more work on dma errors.

#110u - bigger DMA buffers.

#110t - more fixes to dma errors.

#110r - reverted to 110m.
      - redo DMA pci mapping, now use sync, don't unmap sg array.
      - lots of bug fixes for dma mapping, OSD was bad, better now.

#110m - bug where I didn't reduce the encoder api cmd sg size.

#110l - fix for encoder DMA size.
      - change way DMA reset works, other way seems to not be right still.

#110k - Able to monitor DMA errors under debug level info.
      - Encoder timeout runs dma err reset too, so can catch 
        it through the encoder too.
      - still don't know if dma reset works, because I can't trigger DMA
        errors here on this Intel system, have to wait till tonight.

#110j - DMA errors kinda understood now, found logic of the DMA registers,
        there are address ones and stat ones, and one to send the addr,
        see code and mailing list for details.

#110i - OSD PREP_DMA fixed so no longer breaking up DMA for user, this seems
        alot less stable in the driver to do that way.  return errors so taht
        apps like Myth and X can try an OSD again when interrupted because busy.

#110h - waitq fixes for decoding and osd, should improve dma errors there
        I hope.
 
#110g - changed DMA to be as small as possible, and fix for the itvc reg
        ioctl, so it won't read off the end of the ioremapped memory ;-).

#110f - decoder now gathers buffers in one lock for write function.

#110e - fixed decoder poll.

#110d - encoder timeout re-added, but now should be better at doing the
        right thing.

#110c - endif fix.

#110b - write function refined even more, now have io_q gathered with
       the rest of the buffers, kinda an obvious thing there to do, and
       seems like it's all even better, lots of work to do in there but
       most is done finally :-).  Now to figure out if VBI and YUV are really
       broken. 
 
#110a - removed encoder timeout, not needed from what I can tell, maybe
        actually causes problems.
      - fixed bugs in encoder read, found more, seems CPU usage was being
        a bit bad, should be fixed.  Seems ok here so far, lots of checking
        and testing still to be done, eventually can overhaul the write 
        function and use the information learned from the read :-).

#110 - frame based DMA seems to still be problematic in just not giving
       us data quick enough.

#109z - need to allocate base of buffers it seems, else enc/dec are not
        as stable on certain systems it seems, and seems to be right to
        have a default allocation.
      - fixed encoder buffer read bugs, works now in DMA frame based mode,
        so uneven sizes are working again, also optimized it alot more.

#109y - fixes for counting buffers, when flushing don't flush dec/enc
        ones which don't count as full yet, like io_q in dec or dma_q 
        in enc, one of those small details which are interesting to
        figure out from accounting for data more than before.

#109x - fixes for STREAMOFF.
      - John Harveys patch for ivtv.h being installed for 2.4.
      - some read fixes.

#109w - fixes to write function, still something wrong when input is not
        aligned right, can't do frame based DMA which causes that to be
        triggered.

#109v - encoding read now gathers all buffers at one grab, and then reads
        them all, it looks like this boosts performance greatly for our
        encoding read, and page size buffers hopefully work well now on all
        systems, seems like it's very efficient here so far at reading.

#109u - got pts/scr restart working, and now should not trigger at startup.

#109t - commented out pts/scr check for now, triggered by slow startups
      - buffers increased for now
 
#109s - trying frame based DMA again and page size buffers, all dynamically
        allocated, will see if it can work with that now, and working on
        making that work better anyways.

#109r - found 1 off buffer bug, was reallocating at least 1 constantly.

#109q - some tuning.

#109p - fix for io_q spinlock
      - buffers increased for dec/and dma xfer size set to 128k for now.
      - decoder buffers now count properly.

#109o - encoder and decoder buffers increased till new write/read buffer
        stuff is done, also statically allocated for now too w/bigger ones.

#109n - captures should restart properly now, also fixes to encoder write, still
	something odd, but should restart.

#109m - more fixes, was a bad bug in the decoding DMA done.
      - using page size buffers again, I think I know what they need to
        work better on all systems, need to read more than one page
        or buffer at a time from the queue, should help efficiency.
      - VBI and possibly radio (probably just VBI) are broke, so watch
        out :-).

#109l - fixes for decoding, it still has a bug, may have always been there,
        but now exposed, may be a stat keeping error more than functional
        error, seems our bytes full for decoding floats above the base line
        somehow.

#109k - Don't use this for decoding, it will crash, I'm working on a small
        bug there, changed the way it check for buffers being available,
        and lots of locking/stat changes to keep track of buffers.

#109j - lots of changes to how non-blocking works for the decoder, so we
        actually bail properly and try to always really have enough room
        for the data, seems this has never been really correct, and -EAGAIN
        returned seems to not work for Myth like it should.

#109i - buffer sizes adjusted, seems dec really needs 4k and encoder 128k?

#109h - vsync framesync and timestamp made to work, run vsync at dec DMA done
        now which should be enough, after each decode basically.

#109g - changes to dec buffers size, don't wait in mailbox api for DMA status.
      - vsync changes, seems polling it probably is not great at the speed it
        does so.

#109f - more tuning buffers.

#109e - fixes to timeouts for decoding and encoding, lots of little tunings to hopefully
        help that.

#109d - decoder fixed now, things seem really good again, I hope they are but ff/rw
        and channel changes still probably need work, and OSD issues may exist, please
        test.

#109c - fixed encoding problems I think, please test :-).

#109b -  Restart encoding when it fails.

#109 - fix for OSD DMA, was missing last 64k chunk :-).
     - trying to restart decoding when frozen from system io activity being
       high.

#108z - buffer size increased for encoding.
      - do 128k encoder xfers, seems frame based isn't so stable.
      - osd dma increment and alignment changed, should be more stable.

#108y - fixed channel change, also a bit better about keeping decoding going, 
        seems checking and starting decoding if not started in the decoder waitq
        is the key.

#108x - improved way speed control works, shouldn't require heavy locking now,
        seems if we pause right before it everything is safe as when locking.
      - encoder buffers 32k, decoder buffers page size.
      - channel changing still has something odd with the start/stop ioctl
        seems the start ioctl is not really starting decoding, actually just
        writing should start it, so odd.

#108v - fixed bug pausing and speed control of the decoder.
      -  still seems to be a channel changing bug.
      - changed decoder waitq on blocking input, trying to regulate
        it more so not error prone, seems a bit too fast at times.

#108u - reworked decoder DMA.
      - still bugs, but working now, redid entire way decoder is fed, seems
        like it is now more correct as to what the decoder wants us to do.

#108t - changed decoder method of DMAing because the changes I did before seem
        partly bad, so removed some of them.
      - buffers now page size, need testing of that.
  
#108s - it's better, but still encoding will stop? but now it will never
        kill the system from what I can tell, but now need to figure out
        what touchy part has made encoding capable of stoping at random,
        although seems it stops frequently when little encoding activity or
        lower bitrates.

#108r - Encoder problem may be fixed? seems like I've found something
        really odd and looks like the wait for encoding and checking for
        full buffers were problematic.  

#108q - made buf_fill atomic, locks safely now, still more work there.

#108p - encoder changes to reading function.

#108n - starting closer look at encoder and general open/close and file
        functions, something odd happens there with reading at least and
        possibly interraction between enc/dec at the same time.

#108m - encoder sleep seems like it may need to be smaller, now 1/8 second 
        instead of 1 second, would *think* wake_up would have gotten that,
        but possibly not, and system load may make  it crucial to read faster.

#108l - trying to restart encoding when failed, and avoid problems when
        overflows occur.
      - Tuner patch from Michael T. Dean which adds support for the new LG one.

#108k - more fixes to decoder DMA changes, make sure buffers are full
        before starting decoding, keeps jitter from occuring it seems
      - larger buffers again, seeing if work for decoding safely with the
        dma changes, may help stability hopefully.

#108j - decoder dma changes, try to regulate alot more.

#108i - changes to OSD DMA flag so hopefully more clean with decoding.
      - New Myth patch, using 64k buffers.

#108h - firmware mailbox search was using bad values since changes to ioremap.
      - decoder buffers seem to do badly still above 4k.
 
#108g - changes to speed ioctl and pause, should keep from hanging pauses.
      - fixes for OSD DMA so should be a bit better at locking.
 
#108f - Decoder buffer amount needs to be at least 256k, seemed to work
        just about everywhere else but playing a file prerecorded and not
        using polling (odd how no one noticed?).

#108e - Including John Harveys X Server, incremental updates.
      - firmware load/unload fixes.

#108d - patch from John Harvey fixing OSD problems.

#108c - check and align buffer differently.
      - smaller decoder max buffers amount.

#108b - decoder sleep buffer check.
      - osd autofinds pvr350s

#108a - firmware loading changes added
      - osd documentation for PAL changes added.

#108 - backporting 'good' chagnes from 107w and before.
      - added OSD increment
      - added Encoding timing wait changes
      - added begining buffer allocations
      - added fixes for PAL OSD

#107e - encoder buffers now 128k again by default.

#107d - changed decoder buffers back to 32k, seems to be bad :-).
      - tweaking of buffer sizes for optimal amounts on each stream.
      - encoder buffers lowered back to 32k, seems like that's a good
        place to start, 128k may be worse on system even if better for hardware.

#107c - less verbose poll output on debug messages.

#107b - encoder now checks bytes instead of buffers for all DMA.
      - increases in buffers now that dynamically.

#107a - decoder now checks bytes instead of buffers for all DMA.
        still need to do encoder, and find any stray bugs.
 
#107 - osd fix, seems when moving the buffer with osdcoords it wasn't
       adding the cards offset to that value.
     - fix so framebuffer once again loads the dec buffers setting before
       checking the fbbase.
     - trying 32k encoder buffers, for now, maybe help on the memory allocation.

#106z - fixed bug in count of decoder buffer bytes so that the right number
        is left in the free queue all the time.

#106y - narrowed 'work todo' down so only part left is recalculating the
        buffers needed when sending the DMA, everything else  will adjust
        when buffers are shrunk, but the amount and loop through buffers
        to send to the card.
 
#106x - have the buffer fill amount stored with each stream so that all
        checks can be on how much data is in the stream instead of from
        using the buffer count and buffer sizes which may not all be the
        same.

#106w - allocation of buffers are now calculated on size instead of number.
        still need to change way calculations are done though 

#106v - fixed the major glaring bugs for encoder memory allocation, still
        need to change the whole logic to check the size and not number
        of buffers, and to use size for all counts of them since may be 
        different sizes.

#106u - lowered decoder buffer size for now.

#106t - patch to remove the msp check from 2.4.
      - half dynamic for decoder buffers for now, seems better.
      - removed extra swap file left in dir.
  
#106s - fixes for dynamic buffers.
      - cleanup of debugging and other code.

#106r - Decoder needed more work to allow max buffers to be static, logic was
        wrong in read, had to do some extra checks than I had thought necessary.

#106q - lots of fixes for dynamic buffer allocation, going through and finding
        all the places to fix things like using the new stream buffer max/min
        counts instead of the defines etc.  This leads to us being able to
        change settings while  running on the fly.
      - When encoding overflows, we clear out all the buffers and start
        over, crude way of framedropping to protect the system for the moment
        , although should probably check and just remove enough for the
        next DMA but may not be easy to know how much is really enough.
      - Decoder buffers are now really setup so none dynamic, fixes above allowed
        that to work properly.

#106p - decoder default DMA buffers size and amounts changed, 4k and
        really all statically allocated now.
 
#106o - Decoder  DMA buffers are now able to use a default amount, right
        now it isn't dynamically allocating  any by default, seems like a
        small amount to have to do so with.

#106n - encoder DMA buffers are now set to have a default amount, only
        allocate new ones when more than that number are needed.
      - keep track of a streams min/max buffers allowed, actually enforce max
        for encoding now ;-).
      - start of doing the same buffer default allocations for decoding too.

#106m - encoder timing changed for timeouts, should help encoding with
        delivering data faster.

#106l - when encoding waits, no longer waits forever, will give up now.

#106k - Decoder flush needed to be in irqlock instead of normal spin_locks.
      - fixes to OSD so it won't lock up decoding during playing back prerecorded
        shows in Myth.
      - ff/rw should be a bit better.
      - attempt at YUV decoding buffer, first of a set which look like YUV buffers 
        right before the decoder MPG buffer and OSD buffer.
 
#106j - well can't have null module options, so tuner broke, now you must remove
        the old module options.

#106i - removed checks for buffer amounts, all dynamic, just there now to keep
        old setups compatible for the moment, till I replace those with new
        options for max megs to allocate per stream.

#106g - seems the stop logic in the decoder work queue was not clearing the 
        streamoff flag, which was basically giving two stop decode api commands
        at times possibly, so now should not do that.

#106f - changes to stop decode, now should really stop all DMA before stoping.
      - changes to pause, have to coordinate between the speed/stop/pause
        api commands, making sure none are issued at the same time and
        keeping the DMA from being in progress when any are issued.

#106e - found bug in buffer init, when trying smaller ones, seems I forgot
	to actually catch the memory pointer to the new smaller chunk, so
        that must show it being quite rare to hit needing to fragment more
        normally, but ff/rw seems to bring it about quicker.
        
#106d - experimental change in the way speed changes work for the decoder,
        I have now done it different, where a flag is set if we are busy
        when the speed ioctl is issued, and it is stored and sent right
        after we get the lock in the decoder work queue, this seems like
        the right way to do it.

#106c - fixed VBI :-).

#106b - remove digitizer interrupt check.
      - decoder has bugs still at greater than 4k from not being able to
        squeeze the data into tiny increments so harder to get buffers
        to send and fit right into the firmwares requests.
      - SG List size expanded so that the encoder will have enough of an
        SG array when allocating less than 32k buffers.

#106a - trying decoder buffers as 32k sizes again to see if more efficient,
        seems like they should be, alot less dequeue of buffers is done.

#106 - Encoder uses large buffers now, but can reduce down to a page if
       necessary.
     - global decoder pio mode now a variable in a dma settings structure,
       so should be easier to change all the settings on the fly, so could
       go in/out of decoder pio mode and also have different size buffers
       in the same DMA someday soon hopefully.

#105z - changed so that the buffers could be larger than a page still.

#105x - changes way dma mailbox api calls work.

#105w - changes so as soon as IVTV_YUV_BUFFER_OFFSET has then right YUV
        memory location for the buffer, it should work?

#105v - don't wait for EOS unless the mpeg stream.
      - start capture trys to wait till digitizer really starts, may not
        work on all cards?
      - try to start capture again if failed.
 
#105u - reworking mailbox api command stuff, studied it more and think
        I found some possible problems that could occur, so hopefully that
        may help the decoder indirectly (api cmd sending has everything to
        do with how well the firmware acts).

#105t - order of flag checking in DMA done for decoder is more logical.

#105s - changed decoder DMA done so it frees buffers in irq time,
        now spinlock irqsave for the decoder since may work better now.
      - Decoder processor io bug fixed, but still freezes, need to lock.
      - lots of little changes.

#105r - changes to decoder timing.

#105q - more tuning of buffer sizes.

#105p - lots of changes for decoding, removed buffer allocation
        which is no longer needed.
 
#105o - reworked algorythm for Decoder Buffer calculation.

#105n - changes to make polling work right again.

#105m - added flow control again with dynamic buffers :-).
      - changes to decoder DMA sizes sent, trying to send less.

#105l - please see patches/pci_latency.sh

#105k - decoding works again, was broken in 105j.

#105j - don't start decoder till have some data in the buffers, basically 
        after the first write.
      - all buffers are dynamically allocated now.

#105i - decoder buffers are all dynamically allocated now, will see how that 
	goes.

#105h - wait till min buffers are filled before exiting dec waitq
      - properly lock buffers before init, do so atomic, this all
        should be more dynamic, yet really needed to lock all along,
        odd that it didn't, can see the spinlock restriction, but the
        atomic flag fixes that and pages should be easy to get.

#105g - check buffer to see if really exists before freeing.
      - wakeup decoder waitq after freeing buffers, or if a OSD DMA has
        finished.
      - check for buffers available in decoder waitq before breaking to 
        do DMA.

#105f - changes to help keep decoding going, seems a change last patch caused
        a problem with that.

#105e - trying to fix way unload wrks so things don't oops when freeing 
        the buffers.

#105d - using scatter list for OSD DMA.
      - fixes for stream init and cleanup.

#105c - well it ran all night, survived a firmware reload, only had one 
        in 8 hours running, so seems good.

#105b -fixed problems freeing/allocating sg lists/array memory.

#105a - dynamically allocate streams sgarray and lists each DMA call, and
        free on DMA done.

#105 - dynamically allocate/deallocated OSD memory for SG arrays, redo
       entire stream memory and device setup on firmware reloads.

#104z - Changes to check and never give the decoder more data than wants, 
        double check in the api call, still need to redo the DMA if so.

#104y - patch added for M179 cards using Svideo from Brad Fritz.

#104x - ioremap memory separate for encoder/decoder, also only ioremap half
        since we never access the last half so it will safe space, also if
        you read the memory it repeats again half way through, weird.
      - don't ioremap osd again, just use a pointer to the decoder ioremap
        area.
      - pci setup moved to separate function from init.

#104w - Removed mailbox command storing and check all for results, testing.
      - read the mailbox back after each write to try and avoid pci posts not
        updating on all motherboards, one theory.

#104v - Trying to alter decoding values to work better.
      - firmware reload should be fixed somewhat from error happening 
        because encoder DMA wasn't handled properly.

#104u - decoder xfer back to 128k, still not perfect on detecting startup
        right, maybe something to limit till into decoding or something.

#104t - Don't even align Encoder DMA xfers, seems already done for us, and
        works fine with values given.

#104s - OSD DMA is unmapped in the DMA Done interrupt
      - Decoder DMA error unmaps encoding DMA immediately, no tasklet.
      - Use frame based DMA.
      - Calculate when firmware isn't giving us proper values for decoding
        DMA, we now get the value ourselves.
      - Allow 512k DMA decoder input for mpeg, last change allows this

#104r - firmware reload checks removed, changed so hopefully keeps encoding
        after reload.

#104q - decoder work queue didn't clear DMAP when failing.

#104p - DMAP could have been left set in decoder work queue, although not
        horrible could have slowed down the OSD.
      - calculate and keep bitrate/peakbitrate at sane values.

#104o - check in all functions inputing data for a firmware reload and wait
        till complete before continuing.
      - decoder semaphore removed.
      - wait for decoder api to finish, don't limit decoder mailbox to 1
      - tweaks and raises to buffer sizes.
      - back to 128k encoding dma xfers, seems frame based may still be a
        problem, hard to get aligned right and not have too much buffer.

#104n - Changes to start making OSD DMA use scatterlists and be more uniform
        to the rest of the DMA methods for streams.

#104m - Encoder should be able to do frame based DMA safely now.
      - Using safest values for decoding buffer sizes, 32k align, 64k min.

#104l - Decoder DMA uses sg lists now, may have broken decoder PIO mode for now.
      - bug in encoder checking for free buffers behavior fixed.
      - Decoder DMA schedule reworked to be just like encoder gathering
        the free buffers ahead of time, should be alot better at accuracy
        than the old methods used there.

#104j - hopefully fixed mplayer polling problems.
      - use 128k DMA xfers for now, seems alignment may be a problem otherwise.
      - don't wait for decoder DMA

#104i - DMA for encoding uses SGlist of scatter struct type now, total rework of
        encoding DMA.

#104f - min dma xfer set to 32k, align to page size, use frame based encoding 
        DMA.  Seems this keeps things running in Myth and avoids decoder buffers
        running out during poll and osd usage.

#104e - speed change doesn't send play cmd after done, undoes speedchange
        actually.
 
#104d - encoder frame based DMA
      - align and min xfer now 32k again, seems to need that.

#104b - bug in stop decoding on module unload, can't use a waitq.
      - pos wasn't updated in write functions, seems like a problem,
        but still was working.
      - left out VBI dma part to get free buffers, from changes to 
        check first if enough are free. 

#104a - debug for encoding buffers removed.

#104 - some more encoder buffers fixes.

#103n - fixed spinlock efficiency when encoding, although something still
        seems very fishy there.
      - alot of little fixes
      - fw reload now uses it's own work queue.

#103m - Debugging encoder write.

#103l - Encoder DMA mapping checks and syncs only if already mapped.
      - some cleanup of commented out code.
      - Trying to fix encoder poll for mplayer and still keep VLC/VLS happy.

#103k - wait for decoder DMA api now, don't trust this yet.
      - ff/rw redone, should be more smooth and stable now I hope.

#103j - Don't wait for decoder DMA, see how that works.
      - Don't wait on firmware reload for registers to be ready.

#103i - firmware reloads seem to still be needed sometimes on DMA errors,
        seems something worked there, seems like we may need to wait more
        instead of reloading the firmware, something odd is happening there.

#103h - page align OSD Buffer again, was missing this step so was up to
        the user.

#103g - logging made a bit less verbose hopefully for debugging to be
        possible.
      
#103f - use pci_map_page() for buffers, now should allow High Mem usage
        and be much more efficient using this method of DMA.

#103e - cleanup some code from recent changes to decoder/osd DMA.

#103d - allow minimum decoder DMA xfer to be 4k, or PAGE_SIZE actually.

#103c - align to 4k now instead of 32k, seems more efficient.

#103b - changed minimum DMA xfer size to 64k
      - changed decoder poll, seems to work nicer now.
     
#103a - changes to dma error check to still check fw and restart streams,
        seems this is needed when in more complex situations than just a 
        dd and osd session.

#103 - DMA errors no longer need firmware reload.
     - Major debugging of DMA when errors occur, will be verbose
     - some more verbose logging for other errors to find the cause of things
     - redid OSD DMA completely, more like v4l buffer stuff.

#102 - Decoder Xfer max needs to be 128k for Myth to work, must be something
       to do with write size and polling, works again in Myth now.

#101z - Decoder PIO writes lock interrupts on each write now.
      - check to make sure all DMA is finished and ready before executing
        the decoder/osd API xfer commands.
      - When stoping decoding wait for the DMAP to be finished.
      - Patch from Hans to fix LG Tuner

#101y - Max Decoder Xfer is 64k now, have decoder buffer at 2meg (seems to need
        it for using smaller xfer sizes).
      - Have PIO mode working safely with encoding, better than before, seems
        it is really hard to write to the memory, have to make sure nothing
        else is going on first.

#101x - Decoder PIO mode fixed with new DMA Mapping, now will avoid using
        any DMA Mapping when in that mode to save PCI DMA address space.
      - Changes to decoder work queue, now in 2.6 is a separate queue to itself
        which should reduce decoder latency somewhat.
      - Changes to timing for OSD wait, and DEC wait too.
 
#101w - fixed firmware reloads hopefully.

#101v - back to 128k encoder dma xfers, frame based seems unstable.

#101u - decoder buffers crash it at 32k, back to 4k
      - have frame based encoding DMA
      
#101t - use 32k buffers again for decoding.
      - YUV decoder and encoder worked on, decoder won't work of course, but
        now have it starting to try, switches between mpg/yuv mode, seems we
        need to either do something to initialize YUV or know the memory
        location ahead of time.

#101s - Robert Hardy patch to allow 2.6.7+ Linux kernels to work

#101r - fix from Rob Shortt fixing the vcap memory allocation.

#101q - ivtv-driver.h file settings for DMA easy to find and should be simple
        for anyone to alter now.

#101p - Changes to try and xfer different size chunks besides max and still
        do so safely, have to keep them at 32k or 64k aligned it seems.
      - Made buffer element counters atomic, seems like a good thing.
      - Trying to get poll and general write to decoder working the same.

#101o - Decoder DMA xfer now should allow minimum size to work if not 
        able to get maximum, should have always done this.

#101n - changed way OSD works, so DMA should never get overlapped and
        not mapped, or unmapped improperly.

#101m - found a possible source of decoding problems with checking for
        free buffers to use before running the work queue from the irq handler.
      - improved logic for figuring out if work queue should fail, print more
        info when odd things occur there.

#101l - Decoder DMA unmap hopefully works right now in all cases.

#101k - 32k encoder buffers seem to work best, times out random otherwise.

#101j - Now map SG Array properly, per DMA call, and clear to all 0's.
      - Fixes that should help DMA work cleaner.
      - Encoder DMA size was being given with the API cmd all wrong?

#101i - Change encoding DMA xfer to 128k per interrupt again
      - changed so that our GOP size is determined by standard yet we can
        alter that still to another value later.
      
#101h - changes in decoder buffers.

#101g - OSD needed to wait still, so changed that back.

#101f - letting OSD wait logic make it much nicer balancing with decoding DMA.

#101e - using pci_sync for DMA mappings, seems the sgarray may need this for
        each stream.  
      - map/unmap osd sgarray per DMA xfer, wasn't done, may need this on
        all streams possibly, or the pci_sync stuff at least I think.

#101d - Calculate buffers arch portable so PAGE_SIZE is always used.
      - buffers make more sense showing how many megs they are each.

#101c - unmap OSD DMA fixed somewhat.

#101b - changes for firmware reload, interrupts different.
 
#101a - Changed encoding buffers back to 32k, while decoder buffers are 4k

#101 - go with z_pages, seems stable, but trying to keep DMA going when polling,
       still seems like there's something wrong with certain systems though.
 
#100z_pages - have 4k buffers, for testing against 100z.

#100z - Don't unmap OSD DMA for now, somethings odd there, but may have always
        caused a subtle problem in Myth.
 
#100y - Using get_free_pages for encoder/decoder buffers, trying to get 32k
       	together in chunks.

#100x - OSD Framebuffer DMA changed to try and conserve memory and also not
        ever send too much and overflow the buffer.
      - way OSD checks and sends DMA hopefully improved, seems to have been
        lots of little problems there which could cause oddities.

#100v - using 2meg for encoding buffers, seems to need a bit extra.
      - use get_free_page, zeroing them out seems slow.
 
#100u - using pages per buffer for encoding/decoding now, basically just using
        __get_free_page() instead of kmalloc, not sure if this is enough, but
        seems more stable so far.

#100t - changes to decoder and encoder buffer amounts, hopefully more stable.

#100s - changed dma buffers to use 4k size chunks, hardwired for now because
        I think any other sizes than my defaults would be wrong.

#100r - New Myth patch, changes the decoder chunk to 64k.
      - allow really small dma xfers, seems to work, may be better.

#100q - lowered decoder DMA max xfer to 64k, and don't set DMA size, let the
        decoder use the default, whatever that is.
      - some cleanup of commented code

#100p - don't check the buffers read anymore, just exit if count at end
        which seems better there, and possibly the problem was byteswapping
        twice sometimes, check the code to see.
      - don't strip the header off mpeg streams, seems odd.

#100o - Encoder write function fixed so that buffers being read are 
        only gathered up to a max amount, and seems like there were some
        possible bugs in the buffer handling which should now be fixed
        hopefully.
      - MythTV patches changed so the encoder read size isn't changed anymore
        the 05 is altered, 06 works in CVS.
      - Patch from Paolo to check the SAA 7115 stats, very cool, ivtvctl -I

#100l - poll for encoding seems better yet, this seems like something
        that has to be tuned just right, vlc works better now, was locking
        up things.
      - use encoder DMA using frames, capture 15 at a time, or 1 GOP in NTSC,
        this figure may need tuning too, I think this form of encoding is better
 
#100k - clear out decoder pts counters again, still seems wrong.
      - attempt to start playback multiple times if fails.

#100j - fix for encoder poll, makes VLC and VLS work with ivtv well, old
        kludge to make it work now breaks it actually, opposite :-).

#100i - small change to decoder buffers, halved them, keeps glitches from
        occuring possibly from too much buffering and overrunning the decoder.

#100h - Hans patch for 64bit.
      - New Myth Patch, 05
      - trying some different values for the decoding/osd timing.

#100g - use very small 2k buffers for encoding, seems to work so far.

#100f - Changes to help Myth work better.

#100e - Fixed EOS/STREAMOFF/EOG support, now works like it should.

#100d - changed poll function for decoding, seems better in Myth.

#100c - buffers now 32k again
      - reduced OSD timeout to 1 HZ

#100e - revert all 100d changes back to 100b.
      - Fixed EOS/STREAMOFF/EOG support, now works like it should.

#100b - reduced DMA buffers for decoder again, seems really stable that way,
        although for some reason breaks Myth over long term I think.

#100a - decoder timeout reloads firmware now.
      - fixed some compile warnings.

#100 - checks jiffies since last DMA for dec, so are spaced a bit.
     - count vsync intervals
     - changed around buffer sizes so Myth will now work.

#99z - made decoding dma buffers 2k, and reduced DMA xfers, trying to fix DMA
      decoding mode.

#99y - cleanup
     - stop decode no longer waits.

#99x - maybe found the problem with DMA in decoding, too many wake_up's for
       the decoder waitq may have been the problem.

#99w - write with Processor IO now for decoder by default.

#99v - New Myth patch, this one seems to really make things fast
       for the OSD, promise :-).
     - X patch updated, small fix for DMA, probably not needed but
       just in case.

#99u - change block sizes to 128k for decoder, 64k makes the OSD jitter.

#99t - bug where api call for osd dma wasn't returning an error and clearing
       the DMAP bit.

#99s - make osd/dec able to work faster and be stable.

#99r - Got ff/rw working again in Myth, had to adjust that function.

#99p - redoing OSD locking somewhat, or way it waits, trying to rid us of
       the lockup and firmware crash potential there while decoding.
     - dma xfer increased again, don't see it helped, no reports.

#99o - OSD is much faster, checks if decoder is running, won't wait if not.
     - free OSD DMA, or UNMAP it right.
     - check to make sure OSD DMA has actually finished, and free it properly.

#99n - REBOOT before trying this one, settings are changed which may be held
       by the chip.
     - decoder input changed to max of 64k for now, to see if that helps some.
     - don't allow changing extra decoder buffers and don't use them, this may
       give more stability to things?

#99m - Include X server in source and binary, Matthias + my DMA chunk code to
       send in 256k chunks.

#99l - added Hans latest patches.

#99k - just remove fb_write for 2.4 at the moment, don't know how to mask
       that function in 2.4.

#99j - ah, figured out the channel changing culprit, decoder atomic variables
       needed to be incremented instead of set, since the decoder interface
       can be opened by multiple clients many times, works but confusing :-).

#99i - fb really keeps you from writing to it now, and space allowed is only
       what is needed.

#99h - stop decode just waits for DMA done now, too hard to wait for all buffers
     - OSD made safe, by removing ability to mmap and write to the fb
       directly, basically fix it so it's safe else this is not enabled.
     
#99f - speed control allows setting outside of decoding again.
     - had commented out the stop/flush decode buffer clearing, back now.

#99e - fixed OSD in Myth, now responds realtime.

#99d - fix ff/rw problems in Myth.
     - fix channel changing.
     - fix DMA problems.
     - improve OSD and decoding interactions.
     - most Myth problems hopefully solved.

#99c - reduce dma xfers, seems it is needed on my VIA afterall, maybe something
       still needs to be done there and it will work better that way.
     - Hans patch for v4l compat on 2.4
     
#99b - decoder uses streamoff flag, should allow stops to decode till end.
     - numerous fixes to decoder buffers in DMA sending functions.

#99a - some fixes to poll, using DMA by default again, needs some tweaks.

#99 - Decoder runs in Processor IO mode by default, uncomment define in
      ivtv-driver.h for /* DMA or PIO */ #define DEC_DMA_PIO to use DMA.

#98v - Don't run work queue in ivtv_write every block processed, this seems
       like a bad thing to do.

#98u - OSD should be a bit more solid with decoding now, somewhat slow at
       points when decoding is heavy, but doesn't interfere and seems to
       continue on.

#98t - have mem_size return fixed, should report right buffers now.
     - reduced max xfer to 64k for decoder, to be safe for now, still not sure.
     - seems to be missing audio glitches and stable still, I think the
       mem_size rounding to nearest buffer size fix did this.

#98s - seems way I am changing the mem_size and the return of the function
       for that are wrong, from not being able to be negative, need to rethink
       it more, this should fix it though but will print out funny still.

#98r - patch from John Harvey fixing v4l compat in 2.4.

#98q - counted buffers wrong to calculate max sent for decoder.

#98p - had induced a buffer overrun bug in hopefully fixing one which seems to
       have still existed, so hopefully this really fixes it this time.

#98o - have a ivtv_dec_buffer function which calculates the right size to send
       for decoder DMA, does all checks.

#98n - have a ivtv_dma_status function to check status easier.

#98m - do decoding work queue different, may fix some errors.

#98l - Hans patch to fix 2.4 support, and print msp version.

#98k - free decoder buffers upon next decoding schedule.

#98j - buffers for decoding now are 2048 bytes.

#98i - Added Hans patches, lots of fixes, adds GPL, fixes card detection,
       debugging.

#98h - added Hans patch with fixes and improvements. 

#98g - decoder writing reduced by one buffer.
     - osd writing should now be safe for both DMA and normal writing.

#98f - offset works right now for the memory register reading :-).

#98e - now can search whole itvc memory space, just use 0x0-0x0200ffff.

#98d - added Hans patch with documentation from David.

#98c - more careful when reading registers to keep from crashing the firmware.

#98b - can choose min/max registers now to show.

#98a - itvc register get/set work now.

#98 - register dumps and setting of the itvc, ivtvctl -O and -o.

#97z - added ioctl to set/get registers of the itvc15/16.
     - fixed bug where decoding wasn't clearing the bytes used for buffers.

#97x - change back to DMA mode for decoding, seems the other changes now
       may help, which changing it allowed me to see problems which were
       not DMA related but limitations of the card, when encoding/decoding
       happen they must be separated in time enough else the card seems to
       have problems.

#97w - fixed decoder xfer size to hopefully work better in Myth.
     - disabled VIM Restart check for encoding.

#97v - reduce DMA xfers to 64k, put in check for repeating dma xfers.
     - added Hans patch for decoder stop/start.

#97u - OSD is much faster than ever, even while decoding :-).

#97t - decoding is now processor driven without DMA.
 
#97p - AMD 64 patch from Rutger.

#97o - Hans patches added, streams dynamically allocated now.
     - fixed the messages from stream startup for the digitizer restart.

#97m - have digitizer restart set a flag which we can use to know if it 
       actually worked, very important for channel changes.
     - start capture waits to write till actually encoding, from above changes.
     - other odds n ends.

#97l - firmware reloads now restart every stream properly
     - trying to improve channel changing and digitizer resets, reworking the
       ordering and things.
     - fixed bug in decoder streams restart.
     - removed unused OSD stream.

#97k - Hans patch for VBI and other fixes.

#97j - fixed ff/rw so are a bit nicer.
     - fixed channel changes.
     - fixed general decoder/osd responiveness through some timing changes.
     - added patch from David George which skips minors which are in use.

#97i - fix for Myth ff/rw somewhat, Hans patches for VBI and WSS fixes.

#97h - removed semaphore from OSD, it was causing it not to handle multiple
       instances like X and Myth :-).

#97g - trying VIA  fix for KT400 chipsets, probably still need more chipsets
       device id's there.

#97f - trying to get decoder startup not to interfere with the OSD, but
       may be tricky, need to put the osd on hold at these times, the 
       decoder really needs the DMA to flow at startup, might be something
       bigger xfers help.

#97e - strange, found the decoder would mask encoder interrupts upon startup.

#97d - OSD/DEC stop can interfere, have OSD able to get DMAP when the 
       decoder isn't running and the OSD has set it and lost it.
     - stop decode fixes so stops the work queue and also properly stops
       and allows the OSD to continue on.

#97c - trying to wait longer for the OSD to finish.

#97b - fixed bug with OSD return, EAGAIN instead of IO.

#97a - trying decoding using 128k block sizes, seems reasonable, also what
       I am setting the firmware DMA for anyways, and matches the encoder too.

#97 - trying to fix problems dynamically allocating memory, something is
       possibly funny, or just prepdma on my mboard is bad, which may very
       well be, get io errors, used to dma error.
    - removed OSD stream, use the MPG one since basically with the other DMA
       that would be the onlything the OSD stream would contain (and can't
       do both at once, and lock each other, so not necessary.

#96j - OSD memory is dynamically allocated and just for the size needed now.

#96i - osd bug crept into last patch.

#96h - cleanup of osd stream stuff.

#96g - OSD uses old DMA with get_user_pages now.
     - have decoder and osd DMA signal the waitq's to go when done.

#96f - added DMA functions for OSD using get_user_pages.

#96e - starting to work in Myth again, still buggy using poll.

#96d - lots of cleanup, since decoder seems figured out, now need to work
       with it when I'm not working against something impossible like before.
     - return a value to Myth when interrupted, else seems to not work great,
       probably from X and Myth fighting each other.

#96c - change encoder back to using 32k buffers, but allocate 256 by default,
       seems to need more in tight situations like heavy DMA activity, will see.
     - don't allow users to change decoder buffer amounts, tuned to exactly
       what is needed, not to be changed ;-).

#96b - can set the firmware dma xfer sizes and type in ivtv-driver.h now with
       the rest of the DMA settings.
     - found the big decoder bug, turns out we were writing one buffer too
       many from the logic of the decoder DMA mapping loop, this has been
       there since 0.1.9 and before I believe, no wonder we couldn't send
       too much data and possibly why the encoder and osd are affected so
       badly at times, that memory space is right next to them.

#96a - Hans patch for a core dump from ivtvctl

#96 - don't use api cmd for last DMA status, it slows down the OSD too much.
    - I changed the decoding buffers to 64k, seems like 32k isn't very good
      with our current methods of encoder xfers.
    - I changed the decoder dma xfers to always be 128k too just like the
      decoder, hopefully this works well everywhere, right now trying to get
      it working as optimized as possible, since these changes are allowing
      the osd to work better and encoding but may be too much for some systems. 

#95z - new debug level for DEC, shows all the debugging for the decoder 
       DMA xfers which I added.
     - new way to keep track of the decoder DMA state, should improve our
       ability to fix the problems currently present.

#95x - testing still, trying to wait for decoder information about DMA xfer.

#95w - debug patch, prints out all decoder details of state, only for testing.

#95v - don't zap dec dma api commands at mailbox, this was bad when waiting.
     - decrease decoder wait time in api again.

#95u - no longer run work queue in fill_dec_buffers, only if full of
       buffers which seems to be a better place for it, now need to
       try reducing those, but this is running quite nice here with
       128k decoder input on VIA.
     - use semaphores to lock work queue, which should make ff/rw nicer.

#95t - don't print out annoying busy messages, seem like an INFO option
       or maybe even VERBOSE, part of the way I timeout dec/osd now.
 
#95s - VIA works with bigger dma xfers now, so enabled same as Intel.
     - lowered DMA xfers to 128k for decoder, seems like enough, matches 
       encoder, will see how it works. 
     - for now encoder dma blocks are 128k again, seems the encoder can
       timeout when doing smaller ones probably from our inefficiency.
     - found flushing the work queue keeps things from crashing the system
       in ivtv_fill_dec_buffers before running the work queue.  This seems
       to slow down things a bit though at startup possibly, yet seems to
       keep my VIA from crashing and possibly still handle alot more data
       input.

#95r - Hans patch which fixes vbi buffer sizes and other fixes.

#95q - default bitrates changed to more standard ones, 9800/15000 which
       are the normal top legal and max DVD rate.
     - changed dnr to be off, not automatic, think this was screwing with
       peoples encodings when on bad signals.
     - found if I have 32768 less than the decoders max buffer given as
       the max, things don't glitch with bigger DMA sizes, at least on
       Intel, so it's up to 512k for now, starts decodings faster.
     - some timing tuning, and removed debug messages.
 
#95p - testing, do not touch, will spit debug messages out constantly :-).

#95o - able to manually run dec/osd using cat/ivtvfbctl and not see problems,
       still trying to find what causes glitches and stoped decoding.

#95n - working in Myth again with OSD/DEC seems ok, needs timing changes still.

#95m - cleaning up some stuff, also trying to figure out some problems keeping
       decoding going longterm, seems to be the same old issue when being 
       extra careful, then decoding can stop for some reason, need more 
       debugging to figure it out.

#95l - found way to keep both the OSD and decoder evenly flowing :-).

#95k - took out my debugging messages :-)

#95j - better OSD and DEC balancing.

#95h - decoder seems better in Myth, trying to fix osd freezing decoding.

#95g - fixes for Myth ff/pause and other problems seen.

#95f - fixing bugs from new setup.

#95d - getting things working ok on VIA, still dma errors though.
     - this has glitches, but much better design I think in the waitqueue.

#95b - buffer size changes, api timeout changes for DMA, work queue fix.
     - Hans patch fixing streams.

#95a - Hans patch for fixing autoload support and other fixes.

#95 - Hans patch for updating tuner.h and latest tuners, plus Microtune 4049 FM5

#94z - Hans patch for cleanup and audio selection ioctls
     - Don't wait for OSD, may need to change DMA buffers too, will see.

#94y - decoder queue empty for dma hopefully made safer.
     - decoder mailbox api no longer waits, just locks the semaphore.
     - clear out old decoder mailbox api commands which seems to be needed.
       when not waiting for the return.

#94x - stop wait queues on module unload
     - mixed up the DMAP wait on firmware reloads, was opposite of what it
       should have been, oops.

#94w - firmware reloads for DMA errors should work again.

#94v - firmware reloads almost seamless now :-).

#94u - separated firmware reload from decoder thread.
 
#94t - decoder changed from using a thread to a work queue in 2.6, or a
       task queue in 2.4.

#94s - test release

#94r - reduced buffer amounts to free lots of memory, still wasteful, but
       should help those in dire problems right now.

#94q - hopefully fix cat on VIA, can't test this, cat works great here though
       either way on Intel, strange.
     - Byteswap buffer after it is filled completely, before enqueue happens,
       was a temporary swap in userspace but now fully done after copy_from_
       _user but not till an entire 32k buffer is gathered.
 
#94p - fix for cat and dd with different block sizes while uses 32k buffers.

#94n - more fixes for decoding api calls, way dma is sent and cleared, thread
       is called.
     - lowered block size so cat works again.
     - added Hans patch to fix oops.

#94m - Hans patch added with more fixes.
     - new IO buf to allow buffers for decoder to be 32k and fully packed.
     - this may break cat and any input below 32k, but stable otherwise,
       once that support is fixed should work very well for them.

#94k - Hans patch to fix more osd/dec issues.

#94i - Hans patch to decoder/osd.

#94e - tasklets in reset should not go crazy now after firmware reloads.

#94d - EOS fix from Hans.

#94c - increase buffer sizes on Intel, can do up to 128k DMA xfers now.

#94b - Hans patch for filling decoding/osd buffers.

#94a - Hans fix for not vbi reinserting for every encoding unless 
       setup that way.

#94 - fixed bug I induced for VIA motherboards, decoding would be glitchy.

#93n - don't run thread on VIA motherboards, set tuner again to freq, have all
       standards there, but not setting the others for now, need to look them up.

#93m - firmware reloads greatly improved.

#93l - remove SA_INTERRUPT from IRQ handler so that other irqs can run during
       a cards interupts.
     - some VIA tweaks to make my system at home run nicer during decoding.
     - firmware reloads now use UNINTERUPTIBLE sleeping
     - have ivtv_sleep_timeout use option to not be interruptible.

#93k - digitizer reset done like before, but check pause and digitizer
       separate now.
     - mailbox api timeout fixed up a bit different.
    
#93j - mailbox API timeout changed to allow certain commands to not be
       interruptible, while others are.

#93i - fix EOS and STREAMOFF commands.

#93h - fixes cat on ordinary Intel motherboards, and print out PCI vendor
       information to collect types which have problems.

#93g - fix firmware reloads hopefully, and VIA fix may activate properly now.

#93f - firmware reloads locking improved so all streams are stopped and then
       restarted, sortof, not fully sent API commands yet, but at least
       main ones and locking should work better.

#93e - hans newest patch, minus stoping encoding from continuing into passthru
       mode.
     - fixes for VIA motherboards and Intel, so they all work right together
       hopefully, now change the logic of the decoding for one or the other.

#93a - working on OSD locking.

#93 - reverted to using the dec DMA functions in the ivtv write function.
      this seems to work great so far, still testing, see what it does there.

#92c - Trying this another way in the thread, to fix 92 shortcommings.

#92 - Hans patch for cleanup, added tuner options.

#90l - Hans patch for more cleanup to streams.

#90k - Hans patch for stream fixes.

#90h - removing restrictions of osd and decoder, dangerous somewhat, watchout.

#90f - found way to detect decoder stoping very easily, now can restart it.

#90e - alot of changes to try and do decoding/osd stuff right, busy bit is
       gone, semaphores lock the OSD/DEC, and ff/rw.

#90d - Added Hans patch fixing multiple problems.

#90c - fix for missing VIDIOC_S_CTRL_OLD define, odd.

#90b - thread should exit properly now on module unload.

#90a - trying to adjust sizes of buffers gathered before sending through
       DMA.

#90 - waiting for OSD dma again, seems like firmware reloads work but 
       DMA errors happen too often, something is odd.
    - don't reload firmware if osd times out, plus wait for free mailboxes
      a bit longer to give some slack there.

#89l - smaller OSD buffers, trying to speed that up without instability.

#89j - better spinlocks for OSD.

#89i - don't wait for OSD DMA,this seems to make Myth not so great, and I
      suspect is just bad to do.

#89h - trying small decoder buffers again, seems to be what works the best?

#89g - Hans fix for ioctl in Myth.

#89f - audio fix.

#89e - some more changes to api for osd dma.

#89d - use semaphore in ivtv_api for the OSD DMA.

#89c - made myth work again with OSD and decoding, and CPU changes.
 
#89b - thread for decoding now is really efficient, sleeps till data builds
       up.

#89a - enabled ability to have different buffer sizes for VBI buffers, not 
      different though for now, Hans may know better.
    - spinlocks were used dangerously for encoding, fixed.
    - put more checks for decoding thread, should keep from having cpu hogging.

#89 - turn on framebuffer when sending DMA, it gets turned off sometimes
      and if sending DMA should be on.

#88i - use semaphore to allow ff/rw tobe safe.
 
#88h - more tweaks to try and get decoding w/osd and ff/rw to work nice.

#88g - mailbox api for dec/osd DMA changed to not use semaphore, but wait
       for OSD DMA to complete.

#88f - ff/rw wait for busy bit different, wake all streams after ff/rw.

#88e - wait for osd DMA done and then unmap DMA, right after xfer.
     - schedule() in osd waitq now.
     - seems really good here so far :-).
 
#88d - have wait for busy bit in dec thread, keeps from consuming cpu time.

#88c - changed buffer sizes back to 64k, and 4k.  This just seems to work
       the best.
     - call thread wakeup different, hopefully no longer have glitches.

#88b - hans patch merged,and also tuner patch merged for SECAM.
     - buffer changes, sizes different, all 32k now.  also have improved
       the decoding, but still eats CPU once in awhile.

#88a - removed unused qlen options for dec mpg and yuv.
     - reduced buffer sizes, double what they should have been.
     - changed default buffer sizes to more DMA nice sizes, multiples of 8.

#88 - buffer sizes were all wrong, changed them so now right, also use
      defines for all settings now, so should be easier to try different
      settings.

#87k - Myth should display again properly, one line thing in dec thread was
       stoping it.

#87j - found bug in how decoder and osd worked, probably will show up now ;-).

#87i - framebuffer clear didn't work, but now check if encoding/decoding first
       so reloading the ivtv-fb module isn't dangerous.

#87h - fixes to OSD
     - clear OSD safely now
     - cleanup of when decoder was  not a thread
     - wait for OSD DMA again, have sched function doing this right now.

#87g - tuner type patch.
     - thread may exit now
     - thread may take less CPU

#87f - revert ivtv busy bit changes to osd and also increased osd buffer sizes

#87c - decoder thread doesn't eat all the CPU now.

#87b - reduced buffer sizes again.  
     - firmware reloads changed around some to hopefully fix some things.

#87 - decoder thread is back, very experimental in this patch.
    - but seems to work at least.

#86c - fix for decoding problem in Myth, strange though, we need to be
       careful in ivtv_fill_dec_buffers() about amount of data collected
       at a time it seems, have to look at this closer.

#86a - fix for saa7127 register dumps in ivtvctl 
     - removed extra master_w waitq, no longer used by FB.
     - buffer sizes fixed, was giving too many to decoder.
     - YUV enabled by default, only 64 2k buffers for now.

#86 - Hans patch added, more cleanup, ivtv_api worked upon, and ivtv-fb.

#85h - fix osd so it is using the same logic to fill the buffers as the
       decoder, hopefully fixed Myth problem with polling decoding too.

#85g - fix for making sure buffers are never overfilled for the decoder.

#85f - fixing stop that could end up in a deadlock from the spinlocks not
       being unlocked from an abrupt stop of decoding, also command API
       settings improved to help stop decode and firmware checks to work
       smoother.

#85e - Way decoder fills buffers wasn't locking right, could overfill buffers.
     - buffer sizes for decoding reduced to 2048, which seems to make many
       more data input sizes work.

#85c - made so osd dma happens without sending false errors, and also now
       send in between decoder DMAs.

#85b - crude form of sending OSD DMA through normal decoder sched function,
       use decoder mailbox 3 to store information and check that mailbox
       first instead of mailbox 9.  Should be able to enhance the timing
       alot, this is just a start at doing it this way.

#85a - some improvements in ff/rw and OSD speed, still gets stuck, firmware
       reloads still don't always save it either.

#85 - Hans patches added for streams and table changes.
    - OSD is now just like the decoder DMA, uses DMAP, no OSD_DMA anymore.
      this is still a work in progress for ff/rw to work right, and still
      a bit problematic on the OSD.

#84p - trying to fix a state that the module gets in during ff/rw which it
       is stuck somewhat, only get busy bit before ff/rw now, also don't wait
       for the OSD dma in ivtv_api too.
 
#84o - reduce dec buffer size to 4k too, stop waiting  for dec in ivtv_api,
       fix to finding reset for firmware in decoder dma sched.
     - removed change with VIDIOC_S_CTRL.

#84n - using 4k size OSD DMA buffers, hopefully fixes jitter sending OSD DMA.

#84m - fix from Hans for CC data, 
     - fix for VIDIOC_S_CTRL missing.
     - fixes to decoding and OSD DMA.
     - hopefully get firmware reloads fixed.

#84l - buffer size changes, seems to work better, slow, but works right. 

#84k - fix for fill_dec_buffers which should make it work all the time,
       with any input method.
     - changed all buffers to 64k, OSD/DEC.
 
#84j - Hans changes to VBI, other stuff too, just his merges and changes
       since my last 84h patch.

#84h - Trying to get OSD buffers to behave.
     - revert ivtv_fill_dec_buffers change for now.

#84g - Hans fixed OSD stream minor number bug.
     - Trying to make both cat and ivtvplay/splicer to both work.
 
#84f - strangely sending 1 4k buffer at atime worked with the decoder,
       fixing this though, seems really wrong, back to the way it was
       plus other fixes Hans found made cat work, hopefully all correct now.

#84e - possibly fix odd data sizes input to the driver for good, found
       something that should do this right, fixes from Hans which should
       fix data timeouts too and help fix the odd input sizes problem.

#84d - added part back in, possibly safe, still trying to figure that out.

#84c - seems that part of the code filling extra buffers is corrupting them,
       should be fixed with this I think, only does it when sending odd sizes,
       like in splicer I send GOPs at a time.
 
#84b - fixes to OSD size of buffers, otherwise screen moves around horizontally
       and vertically, have to be set to PAL size or smaller it seems, odd.

#84 - cleanup of old fb dma structures and DMA setup, now completely removed.

#83e - OSD now uses Streams DMA buffer, has own type, similar now to how
       the decoder does DMA somewhat, so quite a bit of a change.
     - Added Hans cleanup patch.

#83d - check DMA sent to card by size rather than buffers.

#83c - firmware reload locks decoder busy bit now.

#83b - Hans patch for compatibility
     - Brians patch for the radio device

#83a - ok, now trying the buffer size change again, this time should be
       enough data to know this will work.  They are now set to 64 4k
       buffers, sending 16 at a time, and the DMA size is set to 65536. 
     - you must use between 32 and 256 decoder mpeg buffers, and I'd 
       recommend 64 which is the default, they are 4k now so no longer so
       big and the old values won't do you very nicely ;-). 

#83 - stop decode once again more work on getting it to stop nicely, making
      sure the lock doesn't get stuck mainly.
    - minor fixes for buffer flushing and some cleanup of commented out stuff

#82h - fixed bug with feeding the decoder only GOPs, which are not always 
       aligned perfectly into chunks, this works once again.

#82g - Hans patch for enum input bug from Myth
     - fix for start capture, data Timeouts, was not waiting for start capture
       API which is why it was having problems.

#82f - Hans patches to fix the ioctl calls and v4l compat.

#82e - decoder EOS, now properly ends decoding, finishes all the buffers.
 
#82d - changed EOS to hopefully work right again, for some reason isn't working
       everytime now.

#82c - removed schedule() again, EOS tasklet ran different, decoder buffers
       changed back to 32k w/8 allocated and 2 used for DMA at a time.
       seems safer at these settings for the time being till I figure out how
       to rework the whole gathering buffers and filling them.

#82b - brians patch for radio and modinfo gives driver version now.

#82a - changes encoding, using spinlocks better for it, and schedule() again.
     - found bug in EOS capture ending, wasn't setting then right for jiffies.
     - bug in EOS for decoding, same as above.

#82 - changed decoder buffers to 4k, 32 of them, and send up to 8 at a time,
      basically the buffers are able to handle different data sizes this way,
      and at the same time results in smaller DMA sizes to the card in most
      cases which should generally improve VIA performance I think, does here.
    - stop decode should work better now.

#81e - addes Hans patches.

#81d - fix for compiling on 2.4 kernel, lock_kernel include.
     - fix for define of rc in ivtv-fb to 0, shouldn't have affected it though.

#81c - fixes for OSD, should be really stable, not messing with the BUSY 
       bit, instead use the OSD_DMA bit and the stream semaphore exclusively.
     - fixes for ff/rw.

#81-a-b _Hans reorganized the driver files, much nicer now :-).

#80f - OSD is split up into multiple calls for DMA chunks, 512k for now.

#80e - added Hans VBI patch for inserting VBI to the decoder, and much more.

#80c - ported more fixes for decoding from the patches I backed out of, stuff
       to start support for different data sizes.
     - Hans patch for VBI documentation.

#80b - saa7115 parts commented out for testing added back.
     - enabled code to keep fb state again, was disabled in this version
     - added compatibility for I2C_ADAP_CLASS_TV_ANALOG define
     - improved mailbox return
     - fix to encoder for DMA timeouts on certain motherboards and multiple
       cards working at the same time (think this is the reason it's needed).

#80a - added Hans VBI patch, Jens patch.

#71d - found more that could be wrong with osd commands, hopefully fixed.

#71c - don't cache framebuffer commands for on/off state and alpha, seem
       to not be working for those, must need to be issued at times even
       if same value, kinda piled together so understand this is needed.

#71b - better use of the semaphore to lock the decoder and osd.

#71a - encoder timeout doesn't run anything anymore, seems like this would
       cause problems and may not be needed anymore.

#71 - moved scatter gather arrays into stream structure, now really separate.
    - fixed DMA direction, made way dma was allocated and size checked work
      properly, dma was not setup for the proper direction for encoding, and
      also didn't really check if the buffers were below the amount allowed.
    - reworked decoder completely, all outside irq time and tasklets, no longer
      using decoder timeout since this isn't needed driving the decoder this
      way.
    - hopefully fixed firmware reloads not triggered when in the osd alone.
 
#70n - don't run timeout for decoder, seems to be bad when decoding outside
       interrupts.

#70m - fixed decoder stutter after long term playback in myth for live tv,
       hopefully, at least improves decoding and should fix it long term too.

#70l - check for NULL buffers on decoder copy to user, still this won't fix
       the DMA errors it seems, but good to do so still.

#70k - stop capture and stop decode worked over so timing on waiting for
       last DMA to finish should work better, also EOS should not be lost 
       in most cases.
     - redid the decoder copy to user, needed to check if successful, maybe
       the source of DMA errors?

#70j - divided tasklets amongst decoder/encoder again, this seems to be
       the best way to do it, otherwise things seem buggy.
     - fixed decoder timeout to not cause decoding be corrupted.

#70h - moving decoder data req back into irqtime, is this safe??? well I'm
       trying to keep the decoding going which always stops if this isn't
       done in irqtime, I suspect I need to to something more to make it
       fully safe, this is just figuring out if it fixes the decoder stoping.
 
#70e - cleanup, removed all defines for odd changes, no longer needed, was
       for testing.
     - found some bugs where I had a tasklet scheduled which shouldn't have
       been.
     - removed tasklet kill and disable at module unload, maybe caused a
       oops upon unload, think we need to be more careful there now tat
       the streams are a bit more separate even from tasklets, possibly only
       when unloading the module unproperly too, without stoping all activity.

#70d - taking a dangerous leap, although it looks safe to me ;-).  Moving to
       using spin_lock_bh() for all the streams locking, this seems to fix 
       the whole problem with OSD/Dec/Enc DMA breaking the playback/recording
       and delaying it so it becomes jittery, this no longer occurs.  There
       are tiny interruptions upon decoding startup if there is a very
       high amount of OSD DMA going on, otherwise seems amazingly stable.
     - speed up to module load, maybe safer? removed sleep from saa7115 load. 
       I think this sleep would conflict with the msp3400 because it's a bit
       racey and uses task queues or something, and seems like the sleep didn't
       help it anyways, still locked up on occasion. 
 
#70c - got this working right, decoder frees buffers outside of irqtime.

#70b - moved decoder deq out of irq time.

#70a - trying different check which doesn't seem as good but better than before
       the last patch, still can cause decoding to pause till done slamming OSD
       DMA to the device while encoding/decoding.
       
#70 - big bug fixed I think, seems that way, the OSD would wakeup the
      waitq for itself right after DMA was finished, this made it capable
      of taking over all DMA, now only do that when not decoding, strangly
      this makes encoding avoid the jitter too.
    - Also merged all tasklets into one global tasklet to try and make DMA
      never interfere with itself, this may be the actual fix for encoding, 
      while decoding still needed the one above.

#69l - framebuffer osd now gets and sets the state properly, including the
       on/off bit too.
     - Added Hans VBI patch to fix adding frame numbers.

#69k - didn't fix scaling problems for pvr250 cards yet, bummer.
     - fixed ivtv bug where the framebuffer state was not given
       with the correct current settings, basically left out flicker
       reduction and on/off state.

#69j - hopefully fixed scaling problems for pvr250 cards?
     - removed some byteswap in irq defines, just a test which isn't needed.
     - removed checking deq multiple times, if really needed it's not the
       right way to do it.
     - removed DMA done restriction on device open.

#69i - discovered needed command to get passthrough mode not to have to
       clear out stored commands, was the decoder source one, which seems
       to switch it on/off so that even if same value is there it is needed.

#69h - amd 64 support added mostly, from Sven Boeckelmann
     - found source of Myth Bug, heh, well some other things that
       can cause it, basically seems that the framebuffer checking
       reduced fixes it, but you may get jerky playback now when
       heavily using the OSD, price for fast OSD which Myth requires.

#69g - found source of Myth Bug, waiting for write/read DMA to be done
       before running the OSD DMA seems to have been the problem, the
       whole timing stuff takes the place of that better anyways.

#69f - Hans patch for encoder/decoder poll.

#69e - trying to fix MythTV bug, well combination of the two actually.
     - changed status check in saa7115 to use a safer sleep and also
       it waits till attaching the client before doing the check.

#69c - changed spinlocks and semaphores to no longer use cacheline stuff.
       think I needed to remove it from the global ivtv_lock too, and also
       initialize them all to unlocked, although odd that this was implied
       by the cacheline thing, weird.

#69b - changed decoder timeout and timing between it and the OSD so hopefully
       it will act like the encoder does there and not even flinch when under
       high OSD usage.

#69a - added back encoder timeout DMA tasklet launch and waitq wakeup,
       streams can stop again and that seems to be what had fixed it I guess.

#69 - changed OSD jiffie check to 1 jiffie, this seems to allow the
      OSD to work while encoding, which broke before and I hadn't taken
      the time to tune it, should be interesting now.

#68g - re-enabled OSD and encoder timing, seems more needed now, maybe
       the new DMA from the VBI differences or something, but always 
       wanted to enable that, now should be able to browse Myth really
       fast while watching live TV and not cause the encoding to get jerky,
       seems this happens if the encoder DMA is ever held back too long.

#68f - added the cache_smp stuff on every single lock, weird, but if even
       one is removed they all break.

#68e - added back spinlock cache_in_smp stuff, ate buffers fast.

#68c - clear framebuffer upon module load, should keep us from ever seeing
       that default crap on there again that looks really freaky :-).

#68b - changed passthrough mode to work right on preemptive mode, and also
       altered so should allow captures to work too, was a missing subtype
       to for sending the data to the decoder properly.

#68 - added Hans v4l compat patch.

#67c - added Hans patch, added sleep again to channel changin.

#67a - sleep longer for firmware reset, sleep less on firmware sleep for
       normal boot too.

#67 - enabled timers for encoder/decoder, adjusted to no longer cause extra
      problems hopefully.
    - reduced osd wait on api commands.
    
#66l - disabled timers for encoder/decoder, may have caused more problems
       than fix now, dma seems not to need them anymore.

#66k - trying to find a way to detect the need to reload the firmware,
       even when firmware still responds, seems to get in a weird state.

#66j - fixed more bugs in reloading firmware and locking it properly.

#65i - put sap patch in to make part work.
     - better timing in encoder timeout and decoder timeout no longer runs
       dma tasklets.

#65h - removed unused saa7114.c file, got in there from doing tests awhile back.
     - changed buffers back to 32k, got this to work better I think.

#66g - still working on data timeouts, I think they can't happen anymore :-).

#66f - trying firmware reset in dec_fill_buffer different than before.

#66e - reworking timeout for encoder again, this time should try reseting,
       then firmware reloading, if those don't work it should stop/restart
       the stream then.  I think the stop/restart is good, seems like what
       will make it always work if done right.
     - check dma status on open of device, hopefully will make live tv
       in myth work right, and makes sense to not start doing anything til
       we know dma is calm.
     - don't wait for firmware reset in places.
     - wait for dma to be done in reset by checking register, needed with
       bigger encoding dma sizes it seems.
     - wait for api cmd stop/start capture/decode again, that may have been
       a part of the problem.

#66d - have decoder set at 65536 as DMA size, seems without this it
       gets a bit hungry for large chunks of DMA data.

#66c - scart volume at 0db, or should be I think at least.
     - patch from Stephane for standard detection to work on the msp again.

#66b - changed DMA size for encoder, now does it in bytes and gets a fixed
       size, the default actually, and it seems to be so different than
       frame based in size, seems interesting, so far working ok here.

#66a - spliting up firmware dec/enc reload somewhat, also optimizing it
       or at least trying :-).

#66 - took decoder enable/disable and allow firmware reloads to do so
      during them, gets rid of the green screen, but still a wait there,
      so I'm looking at minimizing the disable time.

#65g - changed firmware reload to record whether capturing or not and
       decoding/osd is active, if so then record state and restore after
       reload.

#65f - opening firmware file, if failed, would still try to close it.
     - changed locking seemed to work well, now can run firmware reloads
       multiple times and it does it right still, only one succeeds and
       the rest wait for it to finish.
 
#65e - hopefully firmware lock works right now, last night I did some dumb
       stuff there :-)).

#65d - firmware reload should be triggered correctly now.

#65c - fixed Timeout for data loop, was broken, made it so firmware reloads
       and digitizer resets should be done correctly in all cases now.

#65b - tuner support for SECAM fixed, patch had not been correct or something.

#65a - increased decoder buffers back to 8, seems like that is just enough.
    - msp volume changed slightly from original for now, seems that this
      needs to be different still from looking at the data sheet.

#65 - reworked data Timeout check and the way the digitizer reset/firmware
      reload works from there.

#64m - changing stop capture to hopefully not affect decoding when occuring
       in the end gop mode.
     - changed firmware reload, don't find the mailboxes again if they work
       after the reload, may fix the green screen problem.
     - stop timer for encoder earlier in stop capture
     - don't run stop capture when start capture fails
     - digitizer reset wasn't tested more than once
     - reload firmware for encoder in a different area of the read function
     - kill off encoder dma tasklet if lingering DMA, may have been bad
       since the tasklet would be deferred and not really prioitized to go.
     - make decoder really turn off output on module unload, for some reason
       this doesn't happen
     - lock firmware relaod, clear bits better after done.
     - reload firmware when encoder start capture fails, test at least.
     - firmware reload improved to be faster for OSD wait and DEC wait.

#64l - using api stuff from osd-stream, added the commands that don't need
       a result, so now shouldn't spend as much time per command sent, with
       command storage this should work really quick and efficient.
     - added sleep if not in an interrupt for api mailbox searching. 
     - don't store a command when it fails
     - wait for start capture, this is important and works with my previous
       changes, I was testing to see if needed, it does need to wait, which
       keeps captures from stoping before starting, since I check and if
       start capture fails I close the stream and exit instead of stop capture.
     - choose whether or not to wait for the api commands that can avoid it.

#64k - put stuff to print out audio changes to msp3400 for debugging better.
  
#64j - fixed bug in api cmd storage, should work better now :-).
     - msp videodev2.h include changed.
 
#64i - STORE_API_CMD define at the top of ivtv.h now is there, if uncommented
       enables new api command storage. This may have some problems still,
       so this should debug that.

#64h - made a storage system for api commands, now saves the send/return 
       values, won't bombard firmware with redundant control settings.
     - firmware reloads now for each card from api cmd, take the itv
       structure into there now so can do the api storage too.

#64g - made firmware reload go a little smoother, still the green screen 

#64f - patch from Stephane Zermatten to fix the SAP/Bilingual support right.

#64e - changing digitizer sleep back for now, till Myth is fixed.

#64d - put osd memory free back in, trying it before the allocation of 
       new osd memory if it is already been allocated before.

#64c - fix the m179 the right way, actually just needed to not call the
       vbi ioctl and then everything works great :-).

#64b - need more buffers for VBI to sit happy, changed to 32.
     - fixed msp setup for the m179 from changes in the sap/bilingual patch,
       was working fine but now save some i2c traffic trying to send to 0x00.

#64a - made saa7115 work for either m179 or 350/250 cards without modification
       commented out misc changes, may be needed for something??? don't know,
       works fine on either cards without them
 
#64 - added audio patch, SAP support, bilingual :-).  all from 
      Stephane Zermatten at http://www.geocities.com/szermatt/bilingual.html.

#63u - have buffers try 3 times again to find free ones,
     - don't check for busy bit when dec polling

#63t - made decoder_poll only check if data needed.

#63s - actually got the gcc patch in by manually adding it, weird, it just
       didn't apply even though said it did and also wouldn't apply again,
       maybe there were two there.

#63r - default pcm and vbi buffers raised, saw buffer overflows on those
       and now have found that the buffers in general can run out and need
       more tuning like this.
     - startout with osd alpha at 255, seems Myth counts on that value.
     - removed all restrictions from decoder poll besides making sure theres
       a value greater than 0 in dec reg 9 showing it wanting data.

#63q - removed buffer free aggressive looping in encoder deq, caused myth to
       act funny.

#63p - check for busy bit in poll

#63o - applied patch for older gcc versions
 
#63n - removed spinlock I added, it only is ran on module unload and seems
       to cause oops's with it included.
     - fixed decoder startup where capture bit wasn't set atomically.
     - removed some old commented out code
     - reworked ivtv_dec_poll to check the dec status and only return
       if needed or not, not running dma calls, fixes bug in myth.

#63m - for some reason the changes for the new card type stuff being used
       in the firmware reset code got lost somewhere, readded that.
       This also should make the osd work with 350 rev2 cards, shouldn't have
       worked before since it didn't allow usage if not a rev1 350.

#63l - changed byteswap so can be done in irq or outside depending on 
       define in ivtv.h
     - testing byteswap back in irq time.

#63k - put a spinlock in that I missed.

#63j - removed loop for waiting for encoder buffers to free.

#63i - secam patch added for secam tuner support from bruno which Mean dug
       out of the mail archive.

#63h - found that decoding needs to use irq interrupts, at least some times,
       reoccuring decoder freezing happens it seems on a system using
       multiple cards.  I have switched back to tasklets for all decoder
       DMA but also have the OSD still waiting for it's api calls, this
       hopefully works stable, also have an idea about trying to do the 
       decoder DMA different in irqtime, waiting if not in it but do if so.

#63g - big bug, encoder would get requests for 0 buffers, possibly would
       happen when decoding, so thought didn't have enough, now just return.

#63f - looking at buffer overflows for encoding closer w/debug messages.
     - clear encoding bits per stream stop instead of after last stream stops.

#63e - waiting for result from osd/dec dma calls, since can now outside irq, 
       seems like this makes ff/rw smoother, seems like the right way to do it.
     - clear the OSD bit when reloading the firmware, this is obviously a bug
       which was causing some of the problems there.

#63d - trying to wait for osd api calls.
     - moved decoding schedule outside of irq time or tasklets
     - able to save alpha settings right when reloading firmware
     - cleanup of some stuff left around from last couple changes.

#63c - fix for osd where firmware needed to be reloaded to clear a stuck busy
       bit, may be better way but this should test and find out.

#63b - tuning api calls more, when decoding, there's now better checking and
       only clearing the decoder api call when safe to do so.
     - use decoder api semlock for osd call outside osd api call instead of
       inside api, I think this should keep osd/dec commands from piling up
       and causing collisions.

#63a - worked on mailbox api, seems decoding works better if the start/stop
       and speed commands are setup right, also trying different tests with
       settings that I've found to work well with certain commands from testing
     - worked on decoding stop, like encoding now, try to finish last DMA right,
       this makes splicing work much nicer now, the stop command is important. 

#63 - fixes for ff/rw and firmware reloads for api failure.

#62e - changed over to new mailbox api stuff used for the dma calls,
       helps start/stop captures to work smoother.
     - don't wait for return to stop capture, it makes things work better
       when starting a capture.
     - use video pause in channel changing again, found that if you disable
       the digitizer, it is better, but only if you run the refresh intput,
       just like starting a capture but in mid encode needs to refresh, makes
       sense and seems to be the only way it won't crash.

#62d - found way to properly bail out when user stops capturing before it
       even started, return error from startcap and then run stop capture
       to cleanup, seems to work.

#62c - fixed string thing in encoder.c

#62b - another fix to osd in Myth, although may cause encoding and osd
       interaction problems.

#62a - change to fix osd in Myth and X
     - changed channel changing problem, removing video pause again

#62 - pip and m179 cards work now if you uncomment the #define M179 out of
      saa7115.c

#61d - fixes in osd, reverted some unneeded changes from getting fw reloads 
       to work.

#61c - bug in osd waitq clearing flags where it shouldn't.

#61b - channel change, trying to make that nicer.

#61a - found a place that was causing the wait to still happen on the
       firmware reloads, now should only take 3sec to trigger, was 33

#61 - fixes to firmware reloads on dec dma errors, got one and was able to
      find plenty of things to fix the long wait it took, but it still worked.
    - changed dma tasklet for decoding to run the tasklet statements for 
      each dec irq, instead of all in the same one, may help keep them separate.

#60 - added encoder command in utils, encoder.c which can capture the program
      stream ending, also can do lots of things, check out with -h arg for help.

#59r - Made radio device variable atomic for the radio user, used i_flags.
     - removed the spinlock_irq on the open when choosing a device, seems
       like this isn't needed and dangerous.
     - improved way digitizer is reset so it no longer can lockup the machine
       during a start capture, hopefully :-).
     - changed stop capture and start capture to always enable device event
       notification, seems needed for properly switching between both.
     - fixed end gop ioctl command.

#59q - trying to deq buffers more aggressively, try looping 3 times,
       sleep when freeing them, may help hopefully, at least an interesting
       test.

#59p - put Brians byteswap outside of IRQ time back in, think this is
       one thing holding up the buffers being free.

#59o - split spinlocks, now one for each stream, no global one, should
       allow decoding/encoding to not cause each other to starve for buffers.
 
#59n - fixed firmware reloads, should be faster, and have them
       setup the decoder safer now.

#59m - added streamoff and end_gop ioctl commands to test_ioctl
	-E 0|1 forthe end GOP setting, and -S for streamoff,
        doesn't really seem to work here yet, weird.

#59l - fixed some bugs from how I did the enc_timeout stop.

#59k - got streamoff working again, so can capture the end GOP or the
       last P frame for splicing :-).

#59j - removed spinlocks from decoder/osd api dma calls.
     - added sleep to keep ivtvfbctl sane at it's speed upon the fb,
       can be turned off with -nosleep.
     - increased encoder timeout, affected by osd usage when high.
     - added osd dma jiffies count, like decoder, check and slow down
       osd dma in encoder timeout if needed.
     - added extra check for osd busy flag, now can't slow down the 
       decoder or encoder DMA with the osd.

#59i - fixing missed spinlocks, put in tasklets for DMA done stuff
     - better way to finish EOS DMA.
     - removed commented out spinlocks and things.

#59h - missed a spinlock on buffer overflow dma rerunning for the encoder.
     - print out more information on buffer overflow.
     - try even if didn't free buffers to rerun DMA, think the free buffer
       thing doesn't really mean none are available, just locked by the
       decoder.

#59g - removing global spinlocking, probably dangerous, but I want to
       see it happen, so far is working fine on preemptible, they just
       need to be removed carefully.

#59f - trying to remove schedule() from ivtv_read, changing back.

#59e - put test decoder/osd timeout checks in, may be able to keep freezes
       from stoping things.

#59d - put back spinlock on open.

#59c - another place tasklets were not commented right for USE_TASKLET to
       disable them right.
     - checking dma status on encoder timeout, if sense an error, go on
       and run the timeout even if no DMA pending.

#59b - added patch for svideo/composite at the same time for 350 output.
     - trying encoder timeout later on stop_capture call.

#59a - now tasklets actually can be disabled, I forgot the stuff in ivtv-api.c
     - change to the waiting for osd/dec to be unbusy when reloading the
       firmware.

#59 - removed all changes before 55b
    - don't do video pause when changing channels
    - don't mute video when starting a capture, or unmute, leave as is.
    - using tasklets for firmware reloads
    - made USE_TASKLET define work again, now at top of ivtv.h

#58b - checking the irq req during the decoder timeout was bad on decoding.

#58a - was wrong on interrupt mask checking for if it had been masked while
       decoding, so now fixed, didn't seem affect it outside of ff/rw.

#58 - removed osd DMA changes again, seemed to make things freeze decoding
    - Firmware reloads seem to work well most of the time.
    - clear stale bit no longer cleared.
    - now clear the interrupt mask in the decoder timeout if lost.

#57 - fixes to firmware reloading.
    - made ivtvfbctl wait 33333 usec so it won't overpower the decoder.
    - enable firmware reloads again.
    - clear stale busy bit now in dec timeout.

#56 - trying OSD DMA unmapping hopefully the right way this time.

#55b - stop captures with the streamoff api won't work right with these changes
       right now, need to find a different way now, but otherwise this may
       fix encoder timeouts.
     - Have encoder timeout active now, hopefully will stop encoding timeouts
     - placed a decoder timeout hopefully into a better position when 
       scheduling decoding.

#55a - When encoding, and grabbing free buffers, allow there to be less
       sent than asked for, encoder seems to work fine like this.
     - added code to the deq function for buffers, should allow for
       us not to get null buffers as often, tries more than once to
       allocate, and won't send back NULL ones.

#55 - trying down() instead of down_interruptible on semlocking.

#53 - ck, need to learn, never use more than one decoder mailbox :-).
      with decoding DMA especially.

#52 - found bug with audio input for the radio.

#51 - try using both decoder mailboxes for DMA, may be safe now.
    - couple of small fixes for the ff/rw and dec dma errors.

#50 - fixed waitq in encoder possibly, should behave better when encoding
      especially with other streams too.
    - Added a encoder timeout function, need to implement like the dec one.
    - fixed problem with stop capture where it cleared things even if there
      are 2 captures going on so shouldn't be cleared.
    - Used tasklets to halt the encoder dma and start back up when stop/start
      captures, may improve things there.
    - trying to use tasklets to stop DMA for resetting the firmware.
    - stop decoder dma tasklet and other fixes to rewind/fast forward.
    - have DMA jiffies stat now to tell if decoder BUSY flag is stuck and
      reset that, wake up the streams.

#49 - added video pause back for channel changes, still need more testing
      with it enabled to make sure, seems needed for radio stuff.
    - only use one decoder mailbox for DMA, seems to need that for
      keeping freezes from occuring.
    - set API cmd 0xD6 for encoder, needed for saa7114...
	/* 0x00EF = saa7114 0x00FO = saa7115 0x0106 = mic*/
    - check if capturing is occuring before pausing the video.

#48 - fixed radio bug, closing radio device, we were freeing up the
      id before the radio stream was deconstructed, which wasn't a
      working radio stream anymore after 1 use until module reload, 
      this should be fixed.

#47 - Made changes to mailbox api to search for free mailboxes
      when doing DMA calls, know how many decoder/encoder has,
      not need a semlock for enc/dec DMA calls, should optimize
      way mailbox api works in general without too much design
      changes.  Also now don't make excessive read calls to mbox flags
      and don't write out to each of the 16 cmd args, it does not make
      sense to do this.

#46 - Commented out OSD memory free in DMA done, breaks 2.4.
    - Made USE_TASKLET define work since #45a broke that somewhat.
 
#45a - Changed all other instances of DMA calls to tasklets, seems DMA errors
       were happening otherwise

#45 - enabled decoder prebuffer again, seeing if it helps ff/rw at all.
    - Added decoder timeout printing of the DMA status register.
    - Merged back tasklets from osd_stream and ck-ng patches, should be 
      the best implementation yet since I used the prior experiences to
      hopefully set them up better.  There are now t_flags which are used
      to flag the tasklets actions needed.
 
#44 - Followed Jens information and changed the get_user_pages() flags 
      back to what they were before, was wrong there.

#43 - I have found a major problem in the OSD/FB memory usage, seems that
      it was not properly mapping/freeing the user pages, this was causing
      kswap to go crazy after loading data into the framebuffer for extended
      periods of time.  It seems to have not always been easily triggered though
      and from what I can tell was not always a problem depending on the method
      or application and possibly timing of loading.  This could be wrong but
      seems right, just a mystery why this wasn't causing more obvious behavior
      problems, but then again the way the framebuffer acts it just could be
      showing up in that subtle indirect way of just making the fb flaky.

#42 - Added generic mailbox command ioctl, fwapi in utils directory can
      use this, should allow for figuring out mailbox and firmware behavior.

#41 - Digitizer reset had capture setup rerun again, removed that since it
      probably is worse to do so.
    - Found problem with 350 cards, actual reason that is, YUV buffer 
      kludge which defines 0 YUV buffers for decoding wasn't included
      in my merging.

#40 - used copy_to_user stuff for decoding input, left out rest of changes
      till get_user_X problem solved.

#39 - Added Hans patches for compiler warnings, lirc_i2c checking, and
       using pointer arithmetic on firmware searching.

#38b - fixed problem with 350 cards loading.

#38a - fixes from Jim Sager merged.

#38 - removed digitizer off/on stuff on channel changes.

#37 - Merged Yaun/m179 patches, please test since I have no idea if this
      will work for them, I don't own any.

#36 - Try to turn digitizer off/on when changing channels, seems better than
      the video pause at least, may slow it down though?
    - Disable firmware reloads for now, from API command timeouts, seems
      dangerous.

#35 - Fixed up EOS captures so hopefully work better, seem to catch the
      Last GOP everytime now, would miss it at times, DMA wasn't finished
      till 2 seconds it seems.
    - On startcapture clear proper IRQ bits from last capture, use spin_lock
      to make sure other start captures and the last stop capture are done,
      this will make sure since the spinlock will wait till the IRQ handler
      finishes from a prior startcapture. 

#34 - fixed PAL firmware reload for decoder output.
 
#33 - trying encoder firmware reload better, not conflict with digitizer
      resets.
    - removed pause for encoder when changing channels, seems like it only
      would induce black screens and data timeouts.

#32 - remove part checking for active capture before pausing
      sleep in encoding unmute/resume, probably doesn't matter and
      may induce other problems.
    - refresh encoder input after each channel change.
    - after digitizer reset, reload encoder settings, may be needed for Myth.
    - Don't reload decoder settings in NTSC for decoding, seems bad here,
      not sure why, makes the output all black, may be the previous channel
      sleeping thing, hmm.

#31 - try and reset encoder settings after a digitizer reset.

#30 - semlock wasn't held when changing channels in certain ioctl calls, 
      including the main one, so this may have caused channel change lockups.
    - don't sleep on channel freq changes when not capturing.
 
#28 - put register setting stuff in for i2c changes to the saa7127 and saa7115

#27 - firmware reloads fixed so PAL works with them, reset decoder settings,
      fb settings, capture settings after reload.
    - improved flags for reloading firmware, enabled global reload from the
      ivtv_api function for decoding and capture, should work well hopefully.

#26 - added spin_locks back into ivtv-fb.c, seem like they are needed.
 
#25 - removed spinlocks in ivtv-fb.c, seeing if it helps some myth cursor
      problems.

#24 - removed firmware reload for now, was not just one card ;-).
    - print all stream status when debugging.

#23 - Added Hans patch.

#22 - Added NTSC 7.5 IRE setup.
    - Added EndofGOP capture so it will work when picked as an optional ioctl.

#21 - Added firmware reload for when api commands crash firmware.
    - Added digitizer reset from Kevin.
    - setup encoder separate so that it can be done upon fw reload.

#20 - firmware reloads and decoding continues, seems like it should do
      so live too, without doing it though an ioctl.

#19 - trying to get firmware reload to continue decoding.

#18 - Moving decoding back into irq time, should be fine and hopefully gets
      rid of these dma freezes there.

#17 - unmask irq in vsync and dec timeouts, think the irq is getting masked
      somehow and has to be unmasked again.
    - fixes to firmware reload, still probably doesn't work.

#16 - reworking way timeout works, and how decoder checks if data is needed,
      problem seems to be the OSD keep the decoder going fine, so need the
      wake_up stuff running like it does there and clear the BUSY bit when
      waiting too long.

#15 - Worked on making decoder timer keep decoder streams DMA running, seems
      when running multiple ones they can freeze in rare occasions, like the
      encoder used to do.  Have timeout do this job now, seems to work great.
 
#14 - Changed speed control to allow reverse playback and setting B frames when
      in reverse.
    - Haven't had a DMA error yet to test firmware reloading, seems good I
      guess, doing 4 decodes/1 osd/4 encodings at a time to try and trigger it.

#13 - Reworked stop decode to finish last DMA before exiting, like for capture
    - wait longer for decoder stop.
    - Re-Added timeout for decoder, seems to be needed with multiple streams
      decoding on more than one card, also doubled the timeout too.

#12 - Tried reloading firmware different, before it would lock the machine
      so now trying a full reload and different methods of stoping encoding
      and decoding during it.

#11 - Multiple changes to fix DMA errors when decoding, keep machine from
      crashing.
    - Removed decoder timeout stuff, isn't needed anymore.
    - Fixed decoder stop with OSD active, so won't stomp on the current OSD DMA
    - Fixed OSD flags and BUSY flags bugs so they don't get cleared, seems so
      far to fix the DMAP errors on decoding.
    - Reworked firmware reload, haven't tested this yet, but hopefully can
      revive the decoding when a DMA error occurs.

#8-10 - Testing, DO NOT USE 8-10 ;-).

#7 - Added code for firmware reset, not active or used, but in place and ready. 

#1-6 - See mailing list

