Commit Graph

57 Commits (34a991587a5cc9f78960c2c9beea217866458c41)

Author SHA1 Message Date
Tomas Winkler 8041f92a20 staging/easycap: easycap_probe: drop more unused variables
wMaxPacketSize are  bEndpointAddress assigned but not used

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-05-18 14:30:08 -07:00
Tomas Winkler 1d243c2e18 staging/easycap: probe: simplify the endpoints tests
we are interested only in isochronous in endpoints
so we can simplify the flow

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-05-18 14:30:07 -07:00
Tomas Winkler 49c30e5764 staging/easycap: easycap_probe: drop verbose printouts
reduce printouts of not necessary information

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-05-18 14:30:07 -07:00
Tomas Winkler 57903f29cd staging/easycap: easycap_probe: drop unuzed variables
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-04-20 18:08:08 -07:00
Tomas Winkler ad30d7af14 staging/easycap: easycap_probe: take out duplicated code from ifdef - else
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-04-20 18:08:07 -07:00
Tomas Winkler 11ff12feb4 staging/easycap: easycap_probe : rename usb variables to common names
1. rename usb variables to more common names

struct usb_device *pusb_device -> usbdev
struct usb_host_interface *pusb_host_interface -> alt
struct usb_endpoint_descriptor *pepd ->
struct usb_interface_descriptor *pusb_interface_descriptor -> interface;

2. use usb_altnum_to_altsetting to access alternative settings

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-04-20 18:08:07 -07:00
Tomas Winkler fd1b821c31 staging/easycap: revamp reset function
fix indentation and drop success statements printouts
that just causes code be less readable

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-04-20 13:48:25 -07:00
Tomas Winkler cb81fa07f8 staging/easycap: kill EASYCAP_IS_VIDEODEV_CLIENT compilation conditional
remove EASYCAP_IS_VIDEODEV_CLIENT and irrelevant code as the define
is always set in the in-kernel driver

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:56 -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 febd32bcfd staging/easycap: replace if(false == var) with if (!var)
's/(false == \([^ ]\+\))/(!\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 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 a90f36206f staging/easycap: more style fixing in easycap_main.c
mostly indentation fixes and some line over 80 characters fixes

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:02 -08:00
Tomas Winkler c750665850 staging/easycap: add first level indentation to easycap_main
Add first level indentation to easayca_main.c
This created around 300 lines over 80 characters.
Around 100 of straight forward once were fixed in this patch.
The another 200 require more code movement and need to be fixed
later

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-28 15:24:17 -08:00
Tomas Winkler fc3cc2caa0 staging/easycap: use USB_SUBCLASS_AUDIOSTREAMING instead of 0x02
use USB_SUBCLASS_AUDIOSTREAMING constant from usb/audio.h
instead of 0x02

Cc: Mike Thomas <rmthomas@sciolus.org>
Cc: Dan Carpenter <error27@gmail.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-02-23 14:15:35 -08:00
Tomas Winkler dfcce7bf09 staging/easycap: easycap_usb_probe: more indentation cleanups
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-23 14:15:35 -08:00
Tomas Winkler b4a5916e6b staging/easycap: revamp inputset population code
make inputset population to be more compact and readable

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-23 14:15:35 -08:00
Tomas Winkler e03da5e2b7 staging/easycap: fix style issues in easycap_usb_probe function
fix some code styles and drop too verbose printouts
and non relevant code

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-23 14:15:34 -08:00
Tomas Winkler 073f482526 staging/easycap: use %p for printing pointers
use %p instead of %X
drop casting of pointer to long long int

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-18 12:42:12 -08:00
Tomas Winkler 30516058e2 staging/easycap: kill EASYCAP_NEEDS_V4L2_DEVICE_H and EASYCAP_NEEDS_V4L2_FOPS
EASYCAP_NEEDS_V4L2_DEVICE_H and EASYCAP_NEEDS_V4L2_FOPS are required in
in-tree driver

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-18 12:42:12 -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 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 8d6139547c stagine/easycap: use module paramter for default encoding instead of ifdef
remove PREFER_NTSC ifdef as it cannot be possible put into Kconfig

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:05 -08:00
Tomas Winkler aff512c8a4 staging/easycap: prefer printk over SAY in module entry functions
Use INFO level when registering driver and ERR for error.
Drop messages from oneliner exit function

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:04 -08:00
Tomas Winkler ee99aa4928 staging/easycap: remove paranoid argument checks in usb probe/disconnect
remove checks for NULL for usb_interface. USB bus won't call these
functions with NULL

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:04 -08:00
Tomas Winkler 7dcef374d1 staging/easycap: add level 1 tabs in usb_probe/disconnect function
Add first level indentation before revamping the functions
This of course breaks 80 characters limit but it will be
fixed through the revamp

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-02-04 12:44:34 -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 27d1766927 staging/easycap: rename variable s32 to tmp
1. naming variable s32 is confusing since it is also
a type name.
2. use s32 instead of __s32, the later is for user space

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 b737f3b8cf staging/easycap: remove explicit NULL initialization
remove intializations to NULL where not needed and let the compiler
find flows with unitilized variables.
Fix one such flow in easycap_vma_fault function

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 6911e7e4a6 staging/easycap: improve coding style when checking return value
use idiom 'if (rc)' for checking return value
instead of if (0 != rc)

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 e0a691e352 staging/easycap: fix artificial line breaks
fix style issue:
		if (NULL !=
				pdata_urb->purb) {
created by the patch:
	'staging/easycap: don't cast NULL pointer'

After dropping the casting there is no longer 80 columns
limitation

Reported-by: Dan Carpenter <error27@gmail.com>
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 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 f2b3c685b9 staging/easycap: kill EASYCAP_NEEDS_UNLOCKED_IOCTL
we can kill this option for in-kernel driver

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 0edbc24c5d staging/easycap: make OSS compilation optional instead of ALSA
OSS is deprecated yet currently it is reported to be more stable
therefore we keep it but make it optional
Revert the conditional compilation:
	add  CONFIG_EASYCAP_OSS and kill EASYCAP_NEEDS_ALSA
move oss-only code from easycap_sound.c to easycap_sound_oss.c

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 07:32:53 +08:00
Tomas Winkler 5c0c6c395e staging/easycap: implement strerror function
Replace long switch statements that just print out errno
with strerror function. It reduces around 700 lines from the code.

The function should be probably dropped at all but leave for now
to not break currently expected debug output.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-01-25 07:30:05 +08:00
Tomas Winkler d090bf5749 staging: easycap: make functions local to easycap_main.c static
1. remove declarations from the header file
2. rearange code in main.c to reduce number of forward declarations

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:05 +08:00
Tomas Winkler 02149cf7c7 staging: easycap: group module parameters handling
1. For readability group module parameters handling on one place
2. Introduce kernel config option EASY_DEBUG

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:05 +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
Mike Thomas 18545cfd36 Staging: easycap: Make easycap_debug non-static
The parameter easycap_debug appears in macros JOT and JOM and therefore
needs to be visible from all source files.  The easycap_ prefix should
be sufficient to avoid namespace clashes outside the module.

Signed-off-by: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-01-21 12:20:56 -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 268dfede46 staging/easycap: Improve interface to the videodev module
The changes here represent an intermediate step towards bringing the
driver within the V4L2 framework.

Signed-off-by: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-11-09 16:31:16 -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 849322a0f1 staging/easycap: Add option to show conspicuous indication of signal loss
A new module parameter turns on the option of displaying a testcard when
the analogue input signal is lost (more precisely: when the hardware
detects no field/frame synchronization).  This feature has been requested
in the context of security cameras used at night.

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 40b8d50ac9 staging/easycap: Implement interlaced modes and reduced framerates
Interlaced modes are requested by tvtime.  Reduced framerates are
preferred by some userspace programs, e.g. astronomy applications.

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