Граф коммитов

7630 Коммитов

Автор SHA1 Сообщение Дата
Dan Carpenter 358d577ce1 staging: comedi: me4000: use bitwise AND instead of logical
This was supposed to bitwise AND but there is a typo.

Fixes: 1a02387063 ('staging: comedi: me4000: remove 'board' from me4000_ai_insn_read()')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:37:58 -07:00
Ian Abbott ad83dbd974 staging: comedi: adl_pci7x3x: fix digital output on PCI-7230
The "adl_pci7x3x" driver replaced the "adl_pci7230" and "adl_pci7432"
drivers in commits 8f567c373c ("staging: comedi: new adl_pci7x3x
driver") and 657f77d173 ("staging: comedi: remove adl_pci7230 and
adl_pci7432 drivers").  Although the new driver code agrees with the
user manuals for the respective boards, digital outputs stopped working
on the PCI-7230.  This has 16 digital output channels and the previous
adl_pci7230 driver shifted the 16 bit output state left by 16 bits
before writing to the hardware register.  The new adl_pci7x3x driver
doesn't do that.  Fix it in `adl_pci7x3x_do_insn_bits()` by checking
for the special case of the subdevice having only 16 channels and
duplicating the 16 bit output state into both halves of the 32-bit
register.  That should work both for what the board actually does and
for what the user manual says it should do.

Fixes: 8f567c373c ("staging: comedi: new adl_pci7x3x driver")
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: <stable@vger.kernel.org> # 3.13+, needs backporting for 3.7 to 3.12
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:37:58 -07:00
H Hartley Sweeten 1c38d03ea9 staging: comedi: hwdrv_apci3501: remove "magic" numbers in apci3501_read_insn_timer()
Use register bit defines from addi_tcw.h to remove the "magic" numbers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:36:18 -07:00
H Hartley Sweeten 0d5e03079d staging: comedi: hwdrv_apci3501: remove "magic" numbers in apci3501_write_insn_timer()
Use register bit defines from addi_tcw.h to remove the "magic" numbers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:36:18 -07:00
H Hartley Sweeten 7dc68e3504 staging: comedi: hwdrv_apci3501: remove "magic" numbers in apci3501_config_insn_timer()
Use register bit defines from addi_tcw.h to remove the "magic" numbers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:36:18 -07:00
H Hartley Sweeten 020e05e74d staging: comedi: addi_apci_3501: remove "magic" numbers in apci3501_interrupt()
Use register bit defines from addi_tcw.h to remove the "magic" numbers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:36:18 -07:00
H Hartley Sweeten cd5d0ae481 staging: comedi: addi_apci_3501: use addi_tcw.h for the timer registers
The APCI3501_TIMER_* register defines in this driver are that same as
the ADDI_TCW_* defines with an additional offset.

Add a 'tcw' (timer/counter/watchdog) member to the private data to
hold the address for the iobase of the registers. Use that and the
defines from addi_tcw.h to address the registers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:36:17 -07:00
H Hartley Sweeten f821bf57a4 staging: comedi: addi_apci_3501: rename CamelCase vars in apci3501_interrupt()
Rename the CamelCase local variables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:36:17 -07:00
H Hartley Sweeten 63316aae91 staging: comedi: addi_apci_3501: prefer using the BIT macro
Change the register bit defines to use the BIT macro.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:36:17 -07:00
H Hartley Sweeten cd07fbf27b staging: comedi: addi_apci_3501: rename private data 'i_IobaseAmcc'
Rename this CamelCase member of the private data.

Also, fix the type of the member, it holds a pci_resource_start()
address and should be an unsigned long.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:36:17 -07:00
H Hartley Sweeten c85c26b8d0 staging: comedi: hwdrv_apci3501: refactor apci3501_config_insn_timer()
The handling for the watchdog and timer modes is very similar. Refactor
this function to use a common code path for both modes.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:36:17 -07:00
H Hartley Sweeten bde879ae6e staging: comedi: hwdrv_apci3501: rename 'ul_Command1' in apci3501_config_insn_timer()
Rename this CamelCase local variable.

For aesthetics, split the mask/set operations.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:36:17 -07:00
H Hartley Sweeten f7f909e09f staging: comedi: hwdrv_apci3501: refactor apci3501_read_insn_timer()
The handling of the ADDIDATA_WATCHDOG and ADDIDATA_TIMER is identical.
Refactor this function to use a common code path for both timer modes.

Remove the incorrect dev_err() noise. The subdevice is valid but the
timer_mode is not supported.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:36:17 -07:00
H Hartley Sweeten 626bb280d0 staging: comedi: hwdrv_apci3501: refactor apci3501_write_insn_timer()
The handling of the ADDIDATA_WATCHDOG and ADDIDATA_TIMER is identical
except for the "stop" operation. Refactor this function to use a common
code path for both timer modes.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:36:17 -07:00
H Hartley Sweeten e078d25639 staging: comedi: hwdrv_apci3501: rename 'ul_Command1' in apci3501_write_insn_timer()
Rename this CamelCase local variable.

For aesthetics, split the mask/set operations.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:36:17 -07:00
H Hartley Sweeten 4434a99eaa staging: comedi: addi_apci_3501: rename private data 'b_TimerSelectMode'
Rename this CamelCase member of the private data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:36:17 -07:00
H Hartley Sweeten a66f2017ec staging: comedi: hwdrv_apci3501: remove useless read/mask to stop watchdog
The watchdog is stopped in apci3501_write_insn_timer() by writing a 0 to
the timer control register. There is no need to read the register first
and mask it (as done when the timer is used as a timer).

Reported-by: coverity (CID 1227052)
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:36:16 -07:00
H Hartley Sweeten 2be8ae5898 staging: comedi: comedi_fops: absorb comedi_free_board_minor()
This function is only called by comedi_cleanup_board_minors() and the
'minor' parameter will always be < COMEDI_NUM_BOARD_MINORS.

For aesthetics, absorb the function and remove the unnecessary BUG_ON().

Split the comedi_clear_board_minor() out to clarify that the return value
is a comedi_device pointer.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:35:49 -07:00
H Hartley Sweeten c4237a2b59 staging: comedi: comedi_fops: remove BUG_ON() in comedi_dev_get_from_board_minor()
This function is only called by comedi_dev_get_from_minor() and the 'minor'
value will always be < COMEDI_NUM_BOARD_MINORS. Remove the unnecessary
BUG_ON().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:35:49 -07:00
H Hartley Sweeten 5104a89887 staging: comedi: comedi_fops: remove BUG_ON() in comedi_free_subdevice_minor()
Drivers should not crash the kernel.

This function is only called by comedi_device_detach_cleanup() and the
s->minor will always be valid or the device wouldn't have attached in
the first place.

Leave the checks for safety in accessing the comedi_subdevice_minor_table
array but remove the BUG_ON() calls.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:35:49 -07:00
H Hartley Sweeten 6b3703f4cb staging: comedi: comedi_fops: remove BUG_ON() in comedi_cleanup()
The BUG_ON() checks in this function are not necessary.

comedi_cleanup_board_minors() clears all the entries in the
comedi_board_minor_table array and will call comedi_device_cleanup()
for all attached devices. comedi_device_cleanup() will then
clear the entries in the comedi_subdevice_minor_table array with
comedi_free_subdevice_minor().

Remove the BUG_ON(), drivers should not crash the kernel.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:35:49 -07:00
H Hartley Sweeten 0bb6419ccf staging: comedi: comedi_fops: remove remaining BUG_ON() checks
The BUG_ON() checks in comedi_subdevice_from_minor() and
comedi_dev_get_from_subdevice_minor() are not necessary.

The 'minor' numbers for a given comedi driver are setup by
comedi_dev_get_from_subdevice_minor() and will always be in
the correct range.

Drivers should not crash the kernel, remove the BUG_ON() checks.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:35:49 -07:00
H Hartley Sweeten 5babc1bc4d staging: comedi: hwdrv_apci1564: remove magic numbers in apci1564_counter_insn_read()
Use the bit defines from addi_tcw.h to remove the magic numbers in this
function.

Add the missing define for ADDI_TCW_STATUS_HARDWARE_TRIG.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:34:57 -07:00
H Hartley Sweeten c6288a3beb staging: comedi: hwdrv_apci1564: tidy up apci1564_counter_insn_write()
Clear the gate and trig bits in the common code path.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:34:57 -07:00
H Hartley Sweeten 1f5d767fab staging: comedi: hwdrv_apci1564: fix counter "mode" setting
According to the (broken) original driver, data[4] passed to this function
is the "timer mode". It appears the original code used the wrong shift to
set the bits.

Use the ADDI_TCW_CTRL_MODE() macro so that the correct bits get set.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:34:57 -07:00
H Hartley Sweeten 835f8fe952 staging: comedi: hwdrv_apci1564: remove useless code in apci1564_counter_insn_config()
The gate, trig, and ena, bits in the 'ctrl' are cleared at the start of
the function. There is no reason clear these bits for each step.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:34:57 -07:00
H Hartley Sweeten 18543b13fc staging: comedi: hwdrv_apci1564: remove magic number in apci1564_timer_insn_read()
Use the bit define from addi_tcw.h to remove the magic number.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:34:57 -07:00
H Hartley Sweeten 9a2d58c7f8 staging: comedi: hwdrv_apci1564: tidy up apci1564_timer_insn_write()
Clear the gate and trig bits in the common code path.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:34:57 -07:00
H Hartley Sweeten d9fca73c80 staging: comedi: hwdrv_apci1564: use addi_tcw.h defines
Use the ADDI_TCW_CTRL_REG bit defines in addi_tcw.h to remove the "magic"
numbers.

Add some missing bit defines and mask defines to addi_tcw.h to help
cleanup the code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:34:57 -07:00
H Hartley Sweeten 836b8f2304 staging: comedi: addi_apci_1564: tidy up APCI1564_EEPROM_REG bit defines
Use the BIT() macro to define the bits.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:34:57 -07:00
H Hartley Sweeten 9f750d15a1 staging: comedi: addi_apci_1564: define the APCI1564_DI_IRQ_REG bits
Define the bits in this register. Remove the old defines in hwdrv_apci1564.c.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:34:57 -07:00
H Hartley Sweeten dbaa1490f9 staging: comedi: addi_apci_1564: define the APCI1564_DO_IRQ_REG bits
Define the bits in this register.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:34:57 -07:00
H Hartley Sweeten fa1219e03e staging: comedi: addi_apci_1564: define the APCI1564_DO_INT_STATUS_REG bits
Define the bits in this register.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:34:57 -07:00
H Hartley Sweeten 59c8f0dd76 staging: comedi: addi_apci_1564: define the APCI1564_DO_INT_CTRL_REG bits
Define the bits in this register. Remove the old defines in hwdrv_apci1564.c.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:34:56 -07:00
H Hartley Sweeten d5387751c3 staging: comedi: hwdrv_apci1564: remove unused defines
These defines are not used. Remove them.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:34:56 -07:00
H Hartley Sweeten 2afc5d49d0 staging: comedi: addi_tcw.h: prefer using the BIT macro
Use the BIT macro to define the register bits.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:34:56 -07:00
Abhilash Jindal d38c59e9ab staging: comedi: serial2002: Use monotonic clock
Wall time obtained from do_gettimeofday is susceptible to sudden jumps due to
user setting the time or due to NTP.

Monotonic time is constantly increasing time better suited for comparing two
timestamps.

Signed-off-by: Abhilash Jindal <klock.android@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 17:33:22 -07:00
H Hartley Sweeten 365741e6a6 staging: comedi: ni_usb6501: fix possible out-of-bounds access
Coverity reports a possible Out-of-bounds access (ARRAY_VS_SINGLETON)
with the 'const u8 *port' parameter passed to ni6501_port_command().
This param is an actual array for the SET_PORT_DIR operation, called
by ni6501_dio_insn_config(). But for the WRITE_PORT and READ_PORT
operations, called by ni6501_dio_insn_bits(), it is just the address
of an u8 local variable.

Fix the coverity issue by changing the parameter to an unsigned int
and pass the raw values from ni6501_dio_insn_config() and
ni6501_dio_insn_bits(). ni6501_port_command() then handles the masking
and shifting needed to load the value into the u8 transmit buffer.

For consistency, change the access of the 'bitmap' parameter from an
array access to a pointer operation.

Reported-by: coverity (CID 1248624)
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 17:33:22 -07:00
Greg Kroah-Hartman f70d631832 Merge 4.2-rc6 into staging-next
We want the IIO and staging fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-10 09:07:25 -07:00
H Hartley Sweeten b96e53df92 staging: comedi: me4000: update MODULE_DESCRIPTION
Change the MODULE_DESCRIPTION to something more useful than "Comedi low-
level driver"

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-07 15:03:31 -07:00
H Hartley Sweeten 4627c547c0 staging: comedi: me4000: updata driver status in comedi comment
Firmware loading was fixed by:

Commit: ac584af5
"staging: comedi: me4000: fix firmware downloading"

Change the driver status to "untested" and remove the comments about
the driver being broken,

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-07 15:03:31 -07:00
H Hartley Sweeten 751dcb48c7 staging: comedi: me4000: cleanup multi-line comments
Format the multi-line comments in the kernel CodingStyle.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-07 15:03:31 -07:00
H Hartley Sweeten 3fe6929bbb staging: comedi: me4000: usleep_range is preferred over udelay
Fix checkpatch issue: "CHECK: usleep_range is preferred over udelay; see
Documentation/timers/timers-howto.txt".  `udelay()` is only used in the
firmware upload process.  Replace them with `usleep_range()` with a
reasonable upper limit.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-07 15:03:31 -07:00
H Hartley Sweeten 7022781c46 staging: comedi: me4000: introduce me4000_ai_get_sample()
The hardware returns two's complement values for the analog input
samples. These need to be converted to the unsigned binary format
that the comedi core expects. Introduce a helper function to handle
this.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-07 15:03:31 -07:00
H Hartley Sweeten 36d59d70ba staging: comedi: me4000: comedi_handle_events() will stop conversions
The irq handler does not need to manually stop conversions and disable
interrupts when "end-of-acquisition", "error", or "overflow" events are
detected. The comedi_handle_events() will call the subdevice (*cancel)
when these are detected and stop the acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-07 15:03:31 -07:00
H Hartley Sweeten b36e4fa78d staging: comedi: me4000: tidy up analog output subdevice init
For aesthetics, add some white space to the analog output subdevice
initialization.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-07 15:03:31 -07:00
H Hartley Sweeten 607d993942 staging: comedi: me4000: fix me4000_detach()
There is no real reason to reset the board when detaching. The comedi core
will ensure that any commands are canceled before the detach.

But the PLX interrupts should be disabled.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-07 15:03:31 -07:00
H Hartley Sweeten 8f3f3eb7a2 staging: comedi: me4000: only enable PLX interrupt if we have and irq
Currently me4000_reset() always enables the PLX interrupt. Move the
enable of the interrupt into me4000_auto_attach() and only do the
enable if we actually have and irq.

Make sure the PLX interrupt is disabled in me4000_reset() before we
try to request the irq.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-07 15:03:30 -07:00
H Hartley Sweeten b047d9ccc3 staging: comedi: me4000: introduce me4000_ai_reset()
Introduce a helper function to stop any ai conversions and reset the
ai control register. This consolidates the common code in me4000_reset()
and me4000_ai_cancel().

Use the new helper in the ai (*insn_read) to ensure that the ai control
register is set to a known state after reading the samples.

The ai control register will now always be '0' after the (*cancel) of
a command or doing an (*insn_read). Knowing this the programming of
the register for single acquisition mode in the (*insn_read) can be
simplified.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-07 15:03:30 -07:00
H Hartley Sweeten a31b50ed1b staging: comedi: me4000: clear the ME4000_AI_CTRL_REG in me4000_reset()
Reset the analog input control register after ensuring that any active
conversions have been stopped. This mimics what the ai subdevice (*cancel)
does.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-07 15:03:30 -07:00