Commit Graph

26 Commits

Author SHA1 Message Date
Peter Huewe 61ca1500c5 [media] video/saa7164: Fix sparse warning: Using plain integer as NULL pointer
This patch fixes the warning "Using plain integer as NULL pointer",
generated by sparse, by replacing
	if (var == 0)
with
	if (!var)
after an allocation
and all other offending 0s with NULL.

KernelVersion: linus' tree-1f0324c

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-03-21 20:32:19 -03:00
Steven Toth bc25068495 [media] saa7164: Checkpatch compliance cleanup
Checkpatch compliance cleanup across files in the saa7164 driver.

Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-29 08:16:39 -02:00
Mauro Carvalho Chehab c7e242baf7 [media] saa7134: Fix lots os spaces at the wrong places
There are lots of checkpatch complains about:

ERROR: space prohibited after that open parenthesis '('
ERROR: space prohibited after that open square bracket '['
ERROR: space prohibited before that close parenthesis ')'
ERROR: space prohibited before that close square bracket ']'

This script should fix all of them:

for i in drivers/media/video/saa7164/*.[ch]; do cat $i|perl -ne 's/\[\ +(.*)/[$1/; s/\ +\]/$1\]/g; s/\(\ +(.*)/($1/g; s/\ +\)/$1)/g; print $_;' >a && mv a $i; done

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 07:55:27 -02:00
Mauro Carvalho Chehab 4d270cfb36 [media] saa7164: Don't use typedefs
According with CodingStyle, drivers shouldn't use typedef, except on very
special cases. This is not the case of saa7164. So, convert all usecases
to struct/enum.

After changing the saa7164-types.h, all we need to do is to run those scripts
to fix all occurrences of the bad types and double check/fix everything that
might be broken after the test (of course, I did a small script to generate those scripts).

for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmBusType_t/enum tmBusType/; print " \>a \&\& mv a tmBusType; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResCmd_t/enum tmComResCmd/; print " \>a \&\& mv a tmComResCmd; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResTermType_t/enum tmComResTermType/; print " \>a \&\& mv a tmComResTermType; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmBufferFlag_t/enum tmBufferFlag/; print " \>a \&\& mv a tmBufferFlag; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResHWDescr_t/struct tmComResHWDescr/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResInterfaceDescr_t/struct tmComResInterfaceDescr/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResBusDescr_t/struct tmComResBusDescr/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmBusType_t/struct tmBusType/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResBusInfo_t/struct tmComResBusInfo/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResInfo_t/struct tmComResInfo/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResCmd_t/struct tmComResCmd/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmDescriptor_t/struct tmDescriptor/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResDescrHeader_t/struct tmComResDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResExtDevDescrHeader_t/struct tmComResExtDevDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResGPIO_t/struct tmComResGPIO/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResPathDescrHeader_t/struct tmComResPathDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResTermType_t/struct tmComResTermType/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResAntTermDescrHeader_t/struct tmComResAntTermDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResTunerDescrHeader_t/struct tmComResTunerDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmBufferFlag_t/struct tmBufferFlag/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmBuffer_t/struct tmBuffer/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmHWStreamParameters_t/struct tmHWStreamParameters/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmStreamParameters_t/struct tmStreamParameters/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResDMATermDescrHeader_t/struct tmComResDMATermDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResTSFormatDescrHeader_t/struct tmComResTSFormatDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResSelDescrHeader_t/struct tmComResSelDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResProcDescrHeader_t/struct tmComResProcDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResEncVideoBitRate_t/struct tmComResEncVideoBitRate/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResEncVideoInputAspectRatio_t/struct tmComResEncVideoInputAspectRatio/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResEncVideoGopStructure_t/struct tmComResEncVideoGopStructure/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResEncoderDescrHeader_t/struct tmComResEncoderDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResAFeatureDescrHeader_t/struct tmComResAFeatureDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResAudioDefaults_t/struct tmComResAudioDefaults/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResEncAudioBitRate_t/struct tmComResEncAudioBitRate/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResTunerStandard_t/struct tmComResTunerStandard/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResTunerStandardAuto_t/struct tmComResTunerStandardAuto/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResPSFormatDescrHeader_t/struct tmComResPSFormatDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResVBIFormatDescrHeader_t/struct tmComResVBIFormatDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResProbeCommit_t/struct tmComResProbeCommit/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResDebugSetLevel_t/struct tmComResDebugSetLevel/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResDebugGetData_t/struct tmComResDebugGetData/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmFwInfoStruct_t/struct tmFwInfoStruct/g; print " $i >a && mv a $i; done

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 07:55:26 -02:00
Steven Toth 2e732d6441 [media] saa7164: Some whitespace cleanup
Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 07:55:18 -02:00
Steven Toth 99b73d38fa [media] saa7164: change debug to saa_debug
Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 07:55:16 -02:00
Steven Toth 1247ff5c0a [media] saa7164: monitor the RISC cpu load via a thread
Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 07:55:14 -02:00
Steven Toth 0b62ceb035 [media] saa7164: collect/show the firmware debugging via a thread
Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 07:55:12 -02:00
Steven Toth e48836b8bd [media] saa7164: add firmware debug message collection and procfs changes
Check for PROCFS and dynamically adjust code.
Cache some PCIe values in the device context.
Provide a mechanism to collect the debug messages
coming from the firmware.

Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 07:55:08 -02:00
Steven Toth e8ce2f2166 [media] saa7164: add NTSC VBI support
IRQ handlers, firmware messages, deferred queue handlers, V4L api's
etc.

Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 07:55:06 -02:00
Steven Toth f6eeece8ec [media] saa7164: Implement resolution control firmware command
.. also fix a minor line 80 wrapping coding style issue.

Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 07:54:57 -02:00
Steven Toth 5fa56ccdac [media] saa7164: allow variable length GOP sizes and switch encoder default to CBR
Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 07:54:49 -02:00
Steven Toth f91d095c92 [media] saa7164: allow encoder output format to be user configurable
Allow PS and TS.

Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 07:54:48 -02:00
Steven Toth 968b11b201 [media] saa7164: implement encoder peak bitrate feature
Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 07:54:46 -02:00
Steven Toth 3ed43cf96a [media] saa7164: allow the IBP reference distance to be configurable
Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 07:54:45 -02:00
Steven Toth 2600d71cc5 [media] saa7164: add support for encoder CBR and VBR optionally
Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 07:54:43 -02:00
Steven Toth eafea21071 [media] saa7164: allow the encoder GOP structure to be configured
Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 07:54:40 -02:00
Steven Toth 7615e434ae [media] saa7164: add various encoder message functions
Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 07:54:34 -02:00
Steven Toth add3f580a4 [media] saa7164: convert buffering structs to be more generic
Current structs assume transport, making a number of changes to
switch to generic functions allowing a smoother integration
for the analog encoder.

Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 07:54:33 -02:00
Steven Toth 9b8b0199b8 [media] saa7164: basic definitions for -encoder.c
Add the skeleton file, update the build environment, copyrights.

Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 07:54:31 -02:00
Tejun Heo 5a0e3ad6af include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files.  percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed.  Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability.  As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

  http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
  only the necessary includes are there.  ie. if only gfp is used,
  gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
  blocks and try to put the new include such that its order conforms
  to its surrounding.  It's put in the include block which contains
  core kernel includes, in the same order that the rest are ordered -
  alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
  doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
  because the file doesn't have fitting include block), it prints out
  an error message indicating which .h file needs to be added to the
  file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
   over 4000 files, deleting around 700 includes and adding ~480 gfp.h
   and ~3000 slab.h inclusions.  The script emitted errors for ~400
   files.

2. Each error was manually checked.  Some didn't need the inclusion,
   some needed manual addition while adding it to implementation .h or
   embedding .c file was more appropriate for others.  This step added
   inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
   from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
   e.g. lib/decompress_*.c used malloc/free() wrappers around slab
   APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
   editing them as sprinkling gfp.h and slab.h inclusions around .h
   files could easily lead to inclusion dependency hell.  Most gfp.h
   inclusion directives were ignored as stuff from gfp.h was usually
   wildly available and often used in preprocessor macros.  Each
   slab.h inclusion directive was examined and added manually as
   necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
   were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
   distributed build env didn't work with gcov compiles) and a few
   more options had to be turned off depending on archs to make things
   build (like ipr on powerpc/64 which failed due to missing writeq).

   * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
   * powerpc and powerpc64 SMP allmodconfig
   * sparc and sparc64 SMP allmodconfig
   * ia64 SMP allmodconfig
   * s390 SMP allmodconfig
   * alpha SMP allmodconfig
   * um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
   a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-30 22:02:32 +09:00
Roel Kluin ad695510bf V4L/DVB (12930): Wrong variable tested
The return of saa7164_i2caddr_to_reglen() was not tested.

Cc: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26 15:10:34 -03:00
Ingo Molnar b1912a85b5 media: video: Fix build in saa7164
-tip testing found that the x86 build (64-bit allyesconfig) fails due to:

  LD      vmlinux.o
  drivers/built-in.o:(.bss+0x4b648): multiple definition of `debug'
  arch/x86/built-in.o:(.kprobes.text+0x88): first defined here
  ld: Warning: size of symbol `debug' changed from 90 in
arch/x86/built-in.o to 4 in drivers/built-in.o
 make: *** [vmlinux.o] Error 1

This is because recent saa7164 changes introduced a global symbol
named 'debug'. The x86 platform code already defines a 'debug'
symbol. (which is named in a too generic way as well - but it
can be used nicely to weed out too generic symbols in drivers ;-)

Rename it to saa_debug.

[mchehab@redhat.com: use module_param_named to preserve old name]

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-09-22 18:58:17 -03:00
Steven Toth 78d155693a V4L/DVB (12930): SAA7164: Removed spurious I2C errors during driver load with DVB-T boards.
Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-09-19 00:14:55 -03:00
Steven Toth 207b42c492 V4L/DVB (12924): SAA7164: Fix some 32/64bit compile time warnings
SAA7164: Fix some 32/64bit compile time warnings

Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-09-19 00:14:47 -03:00
Steven Toth 443c1228d5 V4L/DVB (12923): SAA7164: Add support for the NXP SAA7164 silicon
This patch adds support for all of the known shipping Hauppauge HVR-2200
and HVR-2250 boards. Digital TV ATSC/QAM and DVB-T is enabled at this
time. Both tuners are supported.

Volatiles and typedefs need rework, the rest is coding style compliant.

Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-09-19 00:14:43 -03:00