1
0
Fork 0
Commit Graph

562635 Commits (131497acd88a4456d99247cee457baefd2817835)

Author SHA1 Message Date
Glen Lee 0f34e924f6 staging: wilc1000: linux_wlan_spi.c: return linux error value
return linux error value instead of 0 or 1 and use -EINVAL. Related codes
also changed together.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-21 13:20:04 -08:00
Leo Kim 6d04d7a0d9 staging: wilc1000: wilc_deinit(): fixes inconsistent returns
This patch fixes the warning reported by smatch.
 - wilc_deinit() warn: inconsistent returns 'sem:&hif_drv->sem_cfg_values'

This semaphore protect a cfg_values variable but cfg_values variables was not
used here. So, just remove this line.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-21 13:20:04 -08:00
Leo Kim cb3b05c384 staging: wilc1000: wilc_init(): fixes inconsistent returns
This patch fixes the warning reported by smatch.
 - wilc_init() warn: inconsistent returns 'sem:&hif_drv->sem_cfg_values'

No need to up the sema here since down was not called before get here.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-21 13:20:04 -08:00
Leo Kim 653bb46301 staging: wilc1000: fixes potential null dereference 'wid.val'
This patch fixes the error reported by smatch.
 - Handle_ListenStateExpired() error: potential null dereference 'wid.val'
If kmalloc failed, referenced to a NULL pointer.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-21 13:20:04 -08:00
Leo Kim 369a1d3bd3 staging: wilc1000: replace explicit NULL comparisons with !
This patch replace explicit NULL comparison with ! operator to simplify code.
Reported by checkpatch.pl for Comparison to NULL could be written !XXX" or "XXX".

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-21 13:20:04 -08:00
Glen Lee 3bac1c51dc staging: wilc1000: linux_wlan_spi.c: fix NULL comparison style
This patch fixes checkpatch CHECK:comparison to NULL could be written "b".

Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-21 13:20:04 -08:00
Glen Lee d850659800 staging: wilc1000: linux_wlan_spi.c: add a blank
This patch fixes checkpatch warning: missing a blank like after declarations.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-21 13:20:04 -08:00
Glen Lee 5b46e16702 staging: wilc1000: linux_wlan_spi.c: remove braces for single statement
This patches fixes checkpatch warning: braces {} are not necessary for single
statement blocks. Remove some comments also.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-21 13:20:04 -08:00
Glen Lee 28e9ad2aca staging: wilc1000: wilc_sdio_cmd52: return linux error value
This patch changes return value with linux error value, not 1 or 0.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-21 13:20:04 -08:00
Glen Lee 6f8bded288 staging: wilc1000: wilc_sdio_cmd53: return linux error value
This patch changes return value with linux error value, not 1 or 0.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-21 13:20:04 -08:00
Glen Lee 58ed46f795 staging: wilc1000: linux_wlan_sdio.c: remove braces
This patch fixes checkpatch warning braces{} are not necessary for single
statment blocks.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-21 13:20:04 -08:00
Glen Lee 3cf9c9a7ff staging: wilc1000: linux_wlan_sdio.c: fix checkpatch warning line over 80
This patch fixes checkpatch warning line over 80 characters.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-21 13:20:04 -08:00
Glen Lee 491a2ed74d staging: wilc1000: remove unused functions
This patch removes unused function pointer hif_sync and hif_clear_int, and
removes it's related functions sdio_clear_int, sdio_sync, wilc_spi_clear_int
and wilc_spi_sync.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-21 13:20:04 -08:00
Glen Lee 28b01ff594 staging: wilc1000: remove wilc_debug_func of hif_init
This patch removes wilc_debug_func of hif_init and remove it's related
functions as well because it is not used anymore.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-21 13:20:04 -08:00
Glen Lee ac1da162e4 staging: wilc1000: sdio/spi: use device print api instead of custom one
This patch use device print api instead of driver defined print. Remove
varialbe dPrint as well. String "[wilc sdio]" and "[wilc spi]" are also removed
from all the print statment if exist because it shows which device the message
is related to.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-21 13:20:04 -08:00
Glen Lee 67e2a07ed8 staging: wilc1000: move all of wilc_wlan_dev_t to struct wilc
linux_wlan.c and wilc_wlan.c was separated into two part at the beginning
to support various platforms. They are in charge of send/receive control and
packet data, so they will be merged into one file wlan.c later.
First of all, wilc_wlan_dev_t which is used as global variable of wilc_wlan.c
will be moved into struct wilc.
This patch moves all members of wilc_wlan_dev_t to struct wilc and use wilc
instead of g_wlan. Finally remove wilc_wlan_dev_t and g_wlan.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-21 13:20:04 -08:00
Glen Lee 21ee5092ca staging: wilc1000: remove unused varialbe tx_buffer_offset
This patch removes unused variable tx_buffer_offset of wilc_wlan_dev_t.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-21 13:20:04 -08:00
Glen Lee a3629a9ee3 staging: wilc1000: remove io_type of wilc_wlan_dev_t
io_type of wilc_wlan_dev_t is unneeded, we can use io_type of struct wilc.
Remove io_type of wilc_wlan_dev_t and use io_type of wilc.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-21 13:20:04 -08:00
Glen Lee af9ae09ae0 staging: wilc1000: wilc_wlan.c: remove hif_func of wilc_wlan_dev_t
hif_func of wilc_wlan_dev_t is duplicate because we have same struct
wilc_hif_func ops of struct wilc which is available in wilc_wlan.c.
Rename ops of struct wilc with hif_func and remove hif_func of wilc_wlan_dev_t,
and use wilc->hif_func instead of g_wlan.hif_func in all functions.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-21 13:20:04 -08:00
Glen Lee 9e6627ac72 staging: wilc1000: use kernel define byte order macros
This patch removes define BIG_ENDIAN and use kernel define byte order macros
instead of swap itself. Remove unused BYTE_SWAP macro and __CHECK_ENDIAN__
in Makefile also.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-21 13:20:04 -08:00
Glen Lee b719302da6 staging: wilc1000: rename index to tcp_pending_ack_idx
This patch renames "index" of struct txq_entry_t to tcp_pending_ack_idx
since this name could be confused index of txq_entry_t. It is index of
tcp pending ack.

It fixes 8e55639d06 ("staging: wilc1000: rename tcp_PendingAck_index
of struct txq_entry_t")

Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-21 13:20:04 -08:00
Glen Lee a5038d56f8 staging: wilc1000: remove wilc memory allocation config
This patch remove memory allocation options in Kconfig. It was used a long time
ago to aquire memory, which we will not use this config anymore.
Remove it's config, related define and codes as well. We will take
PREALLOCATE_AT_LOADING_DRIVER as it is default.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-21 13:20:04 -08:00
Glen Lee c6e3a5b3ef staging: wilc1000: remove define COMPLEMENT_BOOT
This patch removes define COMPLEMENT_BOOT in Makefile. The feature was removed
by commit b46d68825c ('staging: wilc1000: remove COMPLEMENT_BOOT') but
the define was not removed. So remove completely.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-21 13:20:04 -08:00
Martin Kepplinger e60378c17c iio: mma8452: use enum for channel index
This gets rid of some magic numbers by adding an enum.

Signed-off-by: Martin Kepplinger <martin.kepplinger@theobroma-systems.com>
Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-19 16:45:42 +00:00
Martin Kepplinger 8e34f2c8d2 iio: mma8452: remove unused register description
Signed-off-by: Martin Kepplinger <martin.kepplinger@theobroma-systems.com>
Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-19 16:44:56 +00:00
Bhaktipriya Shridhar 34708a0ce8 Staging: iio: accel: sca3000: Fixed NULL comparison style
The variable u8 **rx_p, is a pointer-to-pointer and hence the check
should
be "if (!*rx_p)" and not "if (!rx_p)".
In the earlier version, checkpatch.pl gave the following check, which
was incorrect:
CHECK: Comparison to NULL could be written "!rx_p"
+       if (*rx_p == NULL) {

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-19 16:40:55 +00:00
Marc Titinger 6e17c98a00 iio: ina2xx: add ABI documentation entry sysfs-bus-iio-ina2xx-adc
Documentation for attributes:

 * in_allow_async_readout
 * in_shunt_resistor

Signed-off-by: Marc Titinger <mtitinger@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-19 15:08:00 +00:00
Marc Titinger 75e1a3a789 iio: ina2xx: fix channel order in software buffer
POWER and CURRENT were swapped out in the buffer:
was current2 and power3, correct order is power2 and current3.

Signed-off-by: Marc Titinger <mtitinger@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-19 15:06:28 +00:00
H Hartley Sweeten e209f7cc20 staging: comedi: adv_pci1710: rename pci171x_ai_*()
Rename these functions so they have namespace associated with the 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-12-18 14:56:30 -08:00
H Hartley Sweeten 6f05ce9cce staging: comedi: adv_pci1710: rename pci171x_ai_{cmd,cmdtest}()
Rename these functions so they have namespace associated with the 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-12-18 14:56:30 -08:00
H Hartley Sweeten 5ce4385232 staging: comedi: adv_pci1710: fix ai (*insn_read)
An (*insn_read) can only happen if the subdevice is in a non-busy state,
i.e. an async command is not running. The board reset and subdevice
(*cancel) will ensure that the control bits (devpriv->ctrl) are already
cleared.

The (*insn_read) only needs to enable the software trigger before reading
samples. It should also disable the software trigger when done. Fix the
(*insn_read) to do this.

For aesthetics, rename the function so it has namespace associated with
the 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-12-18 14:56:30 -08:00
H Hartley Sweeten d0445303f8 staging: comedi: adv_pci1710: fix counter 0 internal clock source
There are a number of descrepencies in the various manuals for the boards
that this driver supports. Some show a 10 MHz clock for counters 1 and 2
others show a 1 MHz clock. Counter 0 can use either a div 10 of that clock
or an external clock (up to 10 MHz).

Currently this driver initializes counters 1 and 2 with a 10 MHz clock.
For consistency, return 1 MHz (10 MHz/10) for counter 0 when the user
queries the internal clock source with INSN_CONFIG_GET_CLOCK_SRC.

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-12-18 14:56:30 -08:00
H Hartley Sweeten 0c917a9365 staging: comedi: adv_pci1710: tidy up pci1710_reset()
Change the return type to void, this function always succeeds and the
caller does not check the return value anyway.

Fix the initial programming of the control register. The SW bit enables
the software trigger and should not be set here. Setting CNT0 selects the
external clock source for counter 0 (the user counter). It makes more
sense to select the internal 1 MHz clock.

Remove the unnecessary initialization of the private data members. This
function is only called during the (*auto_attach) after the private
data was kzalloc'ed.

Remove the redundant clearing of the A/D FIFO and pending interrupts.
Just do it once.

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-12-18 14:56:30 -08:00
H Hartley Sweeten adbc9ec7fe staging: comedi: adv_pci1710: ai (*cancel) should not enable software trigger
The (*cancel) operation should do just that. Remove the setting of the SW bit
which enables the software trigger.

For aesthetics, rename the function so it has namespace associated with the
driver and add a couple comments.

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-12-18 14:56:30 -08:00
H Hartley Sweeten d3e8ab48db staging: comedi: adv_pci1710: post increment 'subdev' in (*auto_attach)
For aesthetics, post-increment the 'subdev' index when used to get a
comedi_subdevice pointer instead of incrementing it after the subdevice
is initialized.

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-12-18 14:56:30 -08:00
H Hartley Sweeten 7387332558 staging: comedi: adv_pci1710: tidy up analog input subdev_flags
Remove the SDF_COMMON flag, the analog reference is not programmable and
the default aref (AREF_GROUND -> SDF_GROUND) provides adequate information
about the reference.

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-12-18 14:56:30 -08:00
H Hartley Sweeten 1ef6e0a48e staging: comedi: adv_pci1710: tidy up analog output subdev_flags
Remove the SDF_COMMON flag, the analog reference is not programmable and
the default aref (AREF_GROUND -> SDF_GROUND) provides adequate information
about the reference.

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-12-18 14:56:30 -08:00
H Hartley Sweeten 976e893b61 staging: comedi: adv_pci1710: support external analog output reference
The analog outputs can use an external reference to create the D/A output
range. Add an entry to the comedi_lrange table for it and modify the
(*insn_write) to support it.

Note that the D/A output range is 0 to +Vref with a -Vref. The comedi_lrange
does not include the sign of the range. It simmply allows the user to convert
between the 12-bit samples values (0x0000 - 0x0fff) and a physical value (0.0
to 1.0) using the comedilib comedi_to_phys() and comedi_from_phys() functions.
A physical value of 0.0 would actually be 0V with a -Vref and -V with a +Vref
and 1.0 would be +V with a -Vref and 0V with a -Vref. Ths user will need to
work this out but at least they can now use the external reference.

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-12-18 14:56:30 -08:00
H Hartley Sweeten baacf6ca54 staging: comedi: adv_pci1710: rename pci171x_ao_insn_write()
Rename this function so it has namespace associated with the driver.

For aesthetics, move the function so it is located in the middle of
the analog input support functions.

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-12-18 14:56:30 -08:00
H Hartley Sweeten 6039278668 staging: comedi: adv_pci1710: rename pci171x_d[io]_insn_bits
Rename these functions so they have namespace associated with the driver.

For aesthetics, move the functions so they are not located in the middle
of the analog input/output support functions.

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-12-18 14:56:30 -08:00
H Hartley Sweeten f1f4ce6462 staging: comedi: adv_pci1710: rename pci171x_insn_counter_config()
Rename this function so it has namespace associated with the 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-12-18 14:56:30 -08:00
H Hartley Sweeten 96d57c15ab staging: comedi: adv_pci1710: rename interrupt_service_pci1710()
Rename this function so it has namespace associated with the 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-12-18 14:56:30 -08:00
H Hartley Sweeten b5b147dcb4 staging: comedi: adv_pci1710: tidy up boardinfo definition
Remove the unnecessary comments and rename the 'rangelist_ai' member for
aesthetics.

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-12-18 14:56:30 -08:00
H Hartley Sweeten dbdb624822 staging: comedi: adv_pci1710: remove 'has_large_fifo' and 'has_diff_ai' boardinfo
The pci1711/31 boards are the only ones that have a smaller FIFO (1K vs 4K) and
single-ended analog inputs (no differential).

Replace the 'has_large_fifo' and 'has_diff_ai' members of the boardinfo with
'is_pci1711' and use that to determine how to initialize the analog input
subdev_flags as well as the private data 'max_samples'.

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-12-18 14:56:30 -08:00
H Hartley Sweeten 88601533ae staging: comedi: adv_pci1710: remove 'has_di_do' boardinfo
This member of the boardinfo isn't really necessary. All the boards
except the pci1713 have 16 digital inputs and 16 digital outputs.

There is already a 'is_pci1713' member in the boardinfo so that can
be used to determine the subdevices for the digital inputs and outputs
need to be allocated and initialized.

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-12-18 14:56:30 -08:00
H Hartley Sweeten 0b458e7304 staging: comedi: adv_pci1710: remove 'n_aichan' boardinfo
This member of the boardinfo isn't really necessary. All the boards
have analog inputs, the pci1713 has 32 channels the rest have 16
channels.

There is already a 'is_pci1713' member in the boardinfo so that can
be used to determine the number of channels for the analog input
subdevice.

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-12-18 14:56:30 -08:00
H Hartley Sweeten 92c65e5553 staging: comedi: adv_pci1710: define the mux control register bits
For aesthetics, define some macros to set the bits in the mux control
register. Also, rename the 'mux_ext' 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-12-18 14:56:30 -08:00
H Hartley Sweeten 7603900fc7 staging: comedi: adv_pci1710: refactor ai range programming
The gain codes used to program the analog output range are currently
stored in const char arrays. The values look a bit "magic" and it's
not clear how they associate with the comedi_lrange without looking
through user manuals.

Refactor the ai range programming to clarify the driver and remove
the magic numbers. Also, refine the bits in the range register that
set the differential and unipolar 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-12-18 14:56:30 -08:00
H Hartley Sweeten 19cbb8fb79 staging: comedi: adv_pci1710: don't "reset" board when detaching
Currently this driver calls pci1710_reset() during the (*detach) of
the driver. That function does the following:

  1) program the control register to stop any operations
  2) clears the analog input FIFO
  3) clears any pending interrupts
  4) sets all the analog output channels to unipolar 5V range and 0V output
  5) sets all the digital outputs to 0V

Before detaching the comedi core will (*cancel) any running async commands.
This will handle 1-3 above.

Depending on the application, it might not be safe to reset the analog and
digital outputs when the driver is detached.

Remove the board reset when detaching and just use comedi_pci_detach()
directly for the driver (*detach).

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-12-18 14:56:30 -08:00
H Hartley Sweeten 8a8d0875a5 staging: comedi: adv_pci1710: remove 'has_counter' boardinfo
All the boards supported by this driver have a 8254 counter. Channels
1 and 2 are used to create the cascaded 32-bit analog input pacer.
Counter 0 is available for the user on all the boards except the PCI-1713.

Remove the 'has_counter' boardinfo and use the 'is_pci1713' boardinfo to
determine if the user counter subdevice needs to be allocated and
initialized.

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-12-18 14:56:30 -08:00