Commit Graph

29 Commits

Author SHA1 Message Date
Tomas Winkler c0b3a8a034 staging/easycap: reduce code duplication for ssa stk settings
reduce code duplication in register settings

instead of
	if (ntsc)
		<CODE BLOCK>
	else
		<CODE BLOCK>
use

	cfg = (ntsc) ? <chip>configNTSC : <chip>configPAL;
	<CODE BLOCK>

in addition change while loops to more readable for loops

Cc: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-03-07 13:52:55 -08:00
Tomas Winkler fd49b78798 staging/easycap: wait_i2c should be static
wait_i2c is only used from easycap_low.c
so remove it from the easycap.h and mark it static

Cc: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-03-07 13:52:55 -08:00
Tomas Winkler 6888393c43 staging/easycap: convert comparison to NULL into boolean
convert if (NULL != ptr) to if (ptr)
convert if (NULL == ptr) to if (!ptr)

Cc: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-03-07 13:24:04 -08:00
Tomas Winkler 27d683ab79 staging/easycap: replace if(true == var) with if (var)
's/(true == \([^ ]\+\))/(\1)/g'

Cc: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-03-07 13:24:03 -08:00
Tomas Winkler 3e17e39e11 staging/easycap: style changes in easycap_low.c
remove uneedet brackets in ifs and switches
drop pointless castings
other small fixes

Cc: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Reviewed-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-02-18 12:40:01 -08:00
Tomas Winkler ccb6d2e5dc staging/easycap: don't mask return value of usb_control_msg() by 0xFF
masking return value of usb_control_msg() will mask negative
error values into positive.

Cc: Mike Thomas <rmthomas@sciolus.org>
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Reviewed-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-02-18 12:40:00 -08:00
Tomas Winkler 72075789ea staging/easycap: add first level indetnation for easycap_low.c
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Reviewed-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-02-18 12:40:00 -08:00
Tomas Winkler 2ef0c05e80 staging/easycap: replace NOREADBACK with moduel parameter
NOREADBACK doesn't justify Kconfig option so we use module
paramter for it.

Cc: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-02-09 11:59:07 -08:00
Tomas Winkler 32851b325e staging/easycap: use regget for register back reading
Use regget to reading back what was written to a register.
This required changning size argument to regget signature

On the way remove usless variable casting

Cc: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-02-09 11:59:07 -08:00
Tomas Winkler 73132ce45a stagine/easycap: make functions regset and regget static
regget and regset functions are used only from within
easycap_low.c so they can be static
Move the functions to avoid forward declarations
Move GET and SET macro definitions into the c-file

Cc: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-02-09 11:59:07 -08:00
Tomas Winkler 4d59fde3d1 staging/easycap: add first level indentation to regget/set functions
Cc: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-02-09 11:59:06 -08:00
Tomas Winkler a78392aa34 staging/easycap: remove EASYCAP_SILENT option
This has simulated a fault condition of probing for audio capability

Cc: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-02-09 11:59:06 -08:00
Tomas Winkler 055e3a3a2c staging/easycap: replace underscored types with regular once
the underscored types should be used in user space headers only

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-02-04 12:44:33 -08:00
Tomas Winkler 0117f77904 staging/easycap: rename variable u8 to tmp
naming variable u8 is confusing since it is also a type name.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-02-04 12:44:32 -08:00
Tomas Winkler 3fc0dae888 staging/easycap: repace #if defined with simpler #ifdef
for sake of readability replace #if defined with #ifdef
and #if (!defined with #ifndef

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-02-04 12:44:31 -08:00
Tomas Winkler 3c1fb66ede staging/easycap: don't cast NULL pointer
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-02-04 12:44:30 -08:00
Tomas Winkler b4f63e9a0f staging: easycap: remove redunant headers
place all globals to easycap.h, which is included
by all c-files
easycap_standard: fix declaration vs. definiton conflict

Cc: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-01-25 06:43:04 +08:00
Tomas Winkler dbf4805ee6 staging: easycap: fix sparse warnings 'Should it be static'
easycap_main.c:41:23: warning: symbol 'easycapdc60_dongle' was not declared. Should it be static?
easycap_main.c:49:22: warning: symbol 'easycap_usb_device_id_table' was not declared. Should it be static?
easycap_main.c:69:30: warning: symbol 'easycap_fops' was not declared. Should it be static?
easycap_main.c:82:29: warning: symbol 'easycap_vm_ops' was not declared. Should it be static?
easycap_main.c:87:25: warning: symbol 'easycap_class' was not declared. Should it be static?
easycap_main.c:95:35: warning: symbol 'v4l2_fops' was not declared. Should it be static?
easycap_main.c:5071:1: warning: symbol 'easycap_module_init' was not declared. Should it be static?
easycap_main.c:5101:1: warning: symbol 'easycap_module_exit' was not declared. Should it be static?
easycap_low.c:45:50: warning: symbol 'stk1160configPAL' was not declared. Should it be static?
easycap_low.c:87:28: warning: symbol 'stk1160configNTSC' was not declared. Should it be static?
easycap_low.c:129:50: warning: symbol 'saa7113configPAL' was not declared. Should it be static?
easycap_low.c:187:28: warning: symbol 'saa7113configNTSC' was not declared. Should it be static?
easycap_ioctl.c:915:5: warning: symbol 'adjust_mute' was not declared. Should it be static?
easycap_settings.c:42:31: warning: symbol 'easycap_standard' was not declared. Should it be static?
easycap_settings.c:312:23: warning: symbol 'easycap_format' was not declared. Should it be static?
easycap_settings.c:607:23: warning: symbol 'easycap_control' was not declared. Should it be static?

Cc: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-01-25 06:43:03 +08:00
Tomas Winkler 1dc6e41825 staging: easycap: drop redunant backslashes from the code
remove \ from the code where C syntex doesnt require it

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-01-21 12:29:35 -08:00
Tomas Winkler 2a9a05c432 Staging: easycap: fix sparse warnings for module parameters
easycap_main.c:34:5: warning: symbol 'easycap_debug' was not declared. Should it be static?
easycap_main.c:36:5: warning: symbol 'easycap_gain' was not declared. Should it be static?

These two variables actually were declared in several places.
The variables are used in several files.
I've fixed "easycap_debug" so it gets declared in one place only and included properly.
For "easycap_gain" made it static and I created added a
->gain member to the easycap struct.  This seems cleaner than using a
global variable and later on we may make this controlable via sysfs.

Cc:Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-01-21 12:27:19 -08:00
Mike Thomas a985591729 staging: easycap: add ALSA support
This is necessary because some distributions are disabling OSS entirely.

Signed-off-by: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-01-21 12:25:55 -08:00
Randy Dunlap 62af33ec6e staging/easycap: make module params private/static, fix build
The easycap driver has module parameters (bars, gain, & debug)
with global scope that intrude on the kernel namespace and cause
build problems.  Change the names of them to be driver-specific
and make 2 of them static.

drivers/built-in.o:(.bss+0x97c00): multiple definition of `debug'
ld: Warning: size of symbol `debug' changed from 58 in arch/x86/built-in.o to 4 in drivers/built-in.o

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-11-16 12:31:49 -08:00
Mike Thomas ae59dad4fe staging/easycap: Eliminate BKL
No locking is required for normal operation of the driver, but locking
is needed to prevent an Oops during some hot-unplugging scenarios.  The
BKL is replaced here by mutex locks together with traps to detect null
pointers following asynchronous device disconnection.

Signed-off-by: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-11-09 16:31:15 -08:00
Mike Thomas 94155cf419 staging/easycap: Add option to set the hardware audio gain
A new module parameter adjusts the gain of the AC'97 audio chip, if
one is present.  Attenuation as well as amplification should be possible
according to the datasheet, but attenuation seems not to work yet.

Signed-off-by: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-11-09 16:31:15 -08:00
Mike Thomas f36bc37a48 staging/easycap: Improve hardware initialization
Sometimes at startup the video urbs consistently and persistently deliver
bad data, each video frame (not isoc frame) containing an excess of
precisely two bytes.  A brute-force cure implemented here is to
repeatedly reinitialize the registers of the SAA7113H chip and the
STK1160 USB bridge until good behaviour is obtained.

Signed-off-by: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-11-09 16:31:14 -08:00
Mike Thomas e68703cfe8 staging/easycap: Make code re-entrant
In order to allow multiple EasyCAP dongles to operate simultaneously
without mutual interference all static variables have been eliminated
except for a persistent inventory of plugged-in dongles at module level.

Signed-off-by: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-11-09 16:31:14 -08:00
Mike Thomas ce36cedab3 staging/easycap: Remove obsolete routines
The so-called bridger routine has proved unnecessary following general
improvements elsewhere.  The explain_() functions were a convenience
during early development, but are unnecessary and inappropriate now.

Signed-off-by: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-11-09 16:31:14 -08:00
Mike Thomas 7ebc8760b3 Staging: easycap: Upsample microphone audio
Upsampling from 8000 Hz mono to 32000 Hz stereo improves audio/video
synchronization when userspace programs adopt default buffering.  This
is an experimental feature.

Signed-off-by: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-07-22 11:08:55 -07:00
R.M. Thomas 702422bd2d Staging: easycap: add easycap driver
This adds the easycap USB video adapter driver to
the staging directory.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-06-18 12:34:42 -07:00