Gustavo Padovan [Thu, 28 Apr 2016 13:46:56 +0000 (10:46 -0300)]
staging/android: style fix: alignment to match the open parenthesis
Fix checks reported by checkpatch.pl.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gustavo Padovan [Thu, 28 Apr 2016 13:46:55 +0000 (10:46 -0300)]
staging/android: improve documentation for sync_file
num_fences was missing a colon mark and sync_file_create() now have
better description.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gustavo Padovan [Thu, 28 Apr 2016 13:46:54 +0000 (10:46 -0300)]
staging/android: prepare sync_file for de-staging
Move its functions and structs to their own file. Also moves function's
docs to the .c file.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gustavo Padovan [Thu, 28 Apr 2016 13:46:53 +0000 (10:46 -0300)]
staging/android: remove name arg from sync_file_create()
Simplifies the API to only receive the fence it needs to add to the
sync and create a name for the sync_file based on the fence context and
seqno.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gustavo Padovan [Thu, 28 Apr 2016 13:46:52 +0000 (10:46 -0300)]
staging/android: make sync_file_fdget() static
There is no plan in the near future to use this function outside of this
file so keep it as static.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gustavo Padovan [Thu, 28 Apr 2016 13:46:51 +0000 (10:46 -0300)]
staging/android: make sync_file_merge() static
There is no plan in the near future to use this function outside of this
file so keep it as static.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gustavo Padovan [Thu, 28 Apr 2016 13:46:50 +0000 (10:46 -0300)]
staging/android: move sync_file functions comments to sync.c
To keep comments in line with drivers/dma-buf/ move all sync_file comments
to sync.c.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gustavo Padovan [Thu, 28 Apr 2016 13:46:49 +0000 (10:46 -0300)]
staging/android: drop sync_file_install() and sync_file_put()
These two functions are just wrappers for one line functions, they
call fd_install() and fput() respectively, so just get rid of them
and use fd_install() and fput() directly for more simplicity.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gustavo Padovan [Thu, 28 Apr 2016 13:46:48 +0000 (10:46 -0300)]
staging/android: remove redundant comments on sync_merge_data
struct sync_merge_data already have documentation on top of the
struct definition. No need to duplicate it.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gustavo Padovan [Tue, 26 Apr 2016 15:32:28 +0000 (12:32 -0300)]
staging/android: refactor SYNC IOCTLs
Change SYNC_IOC_FILE_INFO (former SYNC_IOC_FENCE_INFO) behaviour to avoid
future API breaks and optimize buffer allocation.
Now num_fences can be filled by the caller to inform how many fences it
wants to retrieve from the kernel. If the num_fences passed is greater
than zero info->sync_fence_info should point to a buffer with enough space
to fit all fences.
However if num_fences passed to the kernel is 0, the kernel will reply
with number of fences of the sync_file.
Sending first an ioctl with num_fences = 0 can optimize buffer allocation,
in a first call with num_fences = 0 userspace will receive the actual
number of fences in the num_fences filed.
Then it can allocate a buffer with the correct size on sync_fence_info and
call SYNC_IOC_FILE_INFO again, but now with the actual value of num_fences
in the sync_file.
info->sync_fence_info was converted to __u64 pointer to prevent 32bit
compatibility issues. And a flags member was added.
An example userspace code for the later would be:
struct sync_file_info *info;
int err, size, num_fences;
info = malloc(sizeof(*info));
info.flags = 0;
err = ioctl(fd, SYNC_IOC_FILE_INFO, info);
num_fences = info->num_fences;
if (num_fences) {
info.flags = 0;
size = sizeof(struct sync_fence_info) * num_fences;
info->num_fences = num_fences;
info->sync_fence_info = (uint64_t) calloc(num_fences,
sizeof(struct sync_fence_info));
err = ioctl(fd, SYNC_IOC_FILE_INFO, info);
}
Finally the IOCTLs numbers were changed to avoid any potential old
userspace running the old API to get weird errors. Changing the opcodes
will make them fail right away. This is just a precaution, there no
upstream users of these interfaces yet and the only user is Android, but
we don't expect anyone trying to run android userspace and all it
dependencies on top of upstream kernels.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Greg Hackmann <ghackmann@google.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gustavo Padovan [Tue, 26 Apr 2016 15:32:27 +0000 (12:32 -0300)]
kernel.h: add u64_to_user_ptr()
This function had copies in 3 different files. Unify them in kernel.h.
Cc: Joe Perches <joe@perches.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Acked-by: Daniel Vetter <daniel.vetter@intel.com> [drm/i915/]
Acked-by: Rob Clark <robdclark@gmail.com> [drm/msm/]
Acked-by: Lucas Stach <l.stach@pengutronix.de> [drm/etinav/]
Acked-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Leo Sperling [Thu, 14 Apr 2016 11:25:26 +0000 (13:25 +0200)]
staging: android: Fix grammar error in Kconfig file
Remove the "s" from kills so that the help message is easier to understand
Signed-off-by: Leo Sperling <leosperling97@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Laura Abbott [Mon, 11 Apr 2016 17:51:11 +0000 (10:51 -0700)]
MAINTAINERS: Add Android Ion as a separate entry
The android drivers have a few other people reviewing patches.
Add a separate entry to ensure patches go to the right people.
Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jes Sorensen [Fri, 15 Apr 2016 19:01:46 +0000 (15:01 -0400)]
staging: rtl8723au: Add warning about this driver being deprecated
This driver is deprecated and superseded by rtl8xxxu. It will be
removed in a future kernel release.
Add a warning to Kconfig and at device init time to notify users and
allow them time to switch over.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
H Hartley Sweeten [Thu, 21 Apr 2016 19:04:46 +0000 (12:04 -0700)]
staging: comedi: mite: don't expose CHSR_* bit defines
These bit defines are only used in the mite driver. Move them so they
are not needlessly exposed.
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>
H Hartley Sweeten [Thu, 21 Apr 2016 19:04:45 +0000 (12:04 -0700)]
staging: comedi: mite: return void from mite_ack_linkc()
Currently this function returns the value read from the mite channel
status register. None of the callers use, or need, the returned value.
For aesthetics, change the return to void.
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>
H Hartley Sweeten [Thu, 21 Apr 2016 19:04:44 +0000 (12:04 -0700)]
staging: comedi: mite: make mite_ack_linkc() handle mite_sync_dma()
The mite dma is always synced on a LINKC status. Some of the mite users
sync the dma regadless of the status.
Add a 'sync' parameter to mite_ack_linkc() to force a dma sync. Then do
the dma sync as needed.
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>
H Hartley Sweeten [Thu, 21 Apr 2016 19:04:43 +0000 (12:04 -0700)]
staging: comedi: ni_mio_common: handle_a_interrupt() does not need ai_mite_status
This function only handles the analog input interrupts, the dma was already
handled.
Remove the unecessary parameter and fix ni_E_interrupts() so that the comedi
events are properly handled.
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>
H Hartley Sweeten [Thu, 21 Apr 2016 19:04:42 +0000 (12:04 -0700)]
staging: comedi: ni_mio_common: simplify AI LINKC handling
Simplfy the LINKC handing for the analog input dma by moving it into
the main interrupt handler. This function already hold the spinlock
mite_channel_lock so call mite_sync_dma() directly instead of using
the helper function.
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>
H Hartley Sweeten [Thu, 21 Apr 2016 19:04:41 +0000 (12:04 -0700)]
staging: comedi: ni_mio_common: fix interrupt handler for dev->read_subdev
There may not be a dev->read_subdev, i.e. an analog input subdevice, that
supports async commands. If it doesn't exist the interrupt/dma will never
be enabled. Fix ni_E_interrupt() so that the analog input subdevice is
only handled if it exists.
This also fixes minor NULL dereference issue in handle_a_interrupt().
If the dev->read_subdev is NULL the comedi_async pointer (s->async) will
not be allocated by the device postconfig so there is no way to get a
valid comedi_cmd (&s->async->cmd).
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>
H Hartley Sweeten [Thu, 21 Apr 2016 19:04:40 +0000 (12:04 -0700)]
staging: comedi: ni_mio_common: handle_b_interrupt() does not need ao_mite_status
This function only handles the analog input interrupts, the dma was already
handled.
Remove the unecessary parameter and fix ni_E_interrupts() so that the comedi
events are properly handled.
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>
H Hartley Sweeten [Thu, 21 Apr 2016 19:04:39 +0000 (12:04 -0700)]
staging: comedi: ni_mio_common: fix interrupt handler for dev->write_subdev
There may not be a dev->write_subdev, i.e. an analog output subdevice, that
supports async commands. If it doesn't exist the interrupt/dma will never
be enabled. Fix ni_E_interrupt() so that the analog output subdevice is
only handled if it exists.
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>
H Hartley Sweeten [Thu, 21 Apr 2016 19:04:38 +0000 (12:04 -0700)]
staging: comedi: ni_mio_common: absorb mite_handle_b_linkc()
Simplfy the LINKC handing by removing the helper function and moving
the mite_sync_dma() into the main interrupt handler.
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>
H Hartley Sweeten [Thu, 21 Apr 2016 19:04:37 +0000 (12:04 -0700)]
staging: comedi: mite: check for transfer errors in mite_ack_linkc()
Currently only some of the users of mite dma check for transfer errors.
The ni_mio_common code does the check for the analog input and analog
output subdevices. The m-series digital I/O subdevice and the counter
subdevices (handled by ni_tiocmd) do not check.
The ni_pcidio driver checks for the digital input subdevice.
The ni_660x driver counter subdevices (handled by ni_tiocmd) also do
not check.
Move the transfer error checking into mite_ack_linkc() so that the
drivers that use mite don't have to deal with it. This also makes
sure that all the subdevices that use mite for dma will cancel the
async command if a transfer error is detected.
Simplfy the transfer error check by just checking the CHSR_XFERR bit.
This bit will be set if one or more transfer processes terminated with
an error. The actual error is determined by the LERR, MERR, and DERR
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>
H Hartley Sweeten [Wed, 20 Apr 2016 17:36:43 +0000 (10:36 -0700)]
staging: comedi: mite: cleanup remaining mite register/bits
For aesthetics, convert the register/bit enums into defines and
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>
H Hartley Sweeten [Wed, 20 Apr 2016 17:36:42 +0000 (10:36 -0700)]
staging: comedi: mite: remove BUG_ON() in MITE_IODWBSR_1_WSIZE_bits()
Prior to calling this function pci_ioremap_bar() is called. If the
pci_resource_len(), i.e. the 'size', was 0 the ioremap would fail
so this function would never be called. So the first BUG_ON() can
never occur.
The 'order' returned by ilog2() will always be > 0 so the second
BUG_ON() will also never occur.
Remove the unnecessary BUG_ON() checks and tidy up the function.
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>
H Hartley Sweeten [Wed, 20 Apr 2016 17:36:41 +0000 (10:36 -0700)]
staging: comedi: mite: document the mite_struct spinlock_t
Add a comment to fix the checkpatch.pl issue:
CHECK: spinlock_t definition without comment
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>
H Hartley Sweeten [Wed, 20 Apr 2016 17:36:40 +0000 (10:36 -0700)]
staging: comedi: mite: rename CamelCase CHSR bit enums
Rename the CamelCase symbols to fix the checkpatch.pl issues.
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>
H Hartley Sweeten [Wed, 20 Apr 2016 17:36:39 +0000 (10:36 -0700)]
staging: comedi: mite: introduce mite_sync_dma()
The struct mite_channel 'dir' member specifies if the dma is input
or output. Wrap the mite_sync_input_dma() and mite_sync_output_dma()
functions with a single mite_sync_dma() so that the drivers don't
have to worry about the sync direction.
The functions that actually sync the input/output dma currently return
-1 if an overflow/underrun is detected otherwise they return 0. If an
overflow/underrun is detected the async->event COMEDI_CB_OVERFLOW is
also set.
The callers never check the return value anyway so just make the
functions return void. The async->event can be checked if necessary
to detect any errors.
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>
H Hartley Sweeten [Wed, 20 Apr 2016 17:36:38 +0000 (10:36 -0700)]
staging: comedi: mite: don't expose unnecessary register/bit info
Most of the mite registers are only accessed by the mite driver.
There is no reason to expose the register/bit info. Remove this
info from the header.
For aesthetics, convert the bit info enums into defines and use
the BIT() macro to define them. Tidy up the inline functions for
the retry limit and drq reqs bits in the config 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>
H Hartley Sweeten [Wed, 20 Apr 2016 17:36:37 +0000 (10:36 -0700)]
staging: comedi: mite: introduce mite_ack_linkc()
Introduce a helper function to handle the ack of a LINKC interrupt.
Tidy up the drivers that use the new helper.
The extra check for CHSR_INT in the ni_pcidio driver is not necessary.
This bit will be set if any of the interrupt sources, including CHSR_LINKC,
have generated an interrupt. Remove the extra check.
The mite_get_status() function is now only used by the mite driver.
Make it static and remove the export.
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>
H Hartley Sweeten [Wed, 20 Apr 2016 17:36:36 +0000 (10:36 -0700)]
staging: comedi: mite: don't expose mite_dma_reset()
This function is only called by the mite driver. Remove the inline
function from the header and make it static in the driver.
Use the function in mite_prep_dma() instead of duplicating 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>
H Hartley Sweeten [Wed, 20 Apr 2016 17:36:35 +0000 (10:36 -0700)]
staging: comedi: ni_pcidio: remove redundant mite disarm/reset
The mite_release_channel() will disarm and reset the mite channel.
Remove the redundant calls in ni_pcidio_release_di_mite_channel().
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>
H Hartley Sweeten [Wed, 20 Apr 2016 17:36:34 +0000 (10:36 -0700)]
staging: comedi: mite: remove mite_struct member 'daq_phys_addr'
This member of mite_struct is only used to map the mite I/O window.
For aesthetics, remove it and use a local variable instead.
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>
H Hartley Sweeten [Wed, 20 Apr 2016 17:36:33 +0000 (10:36 -0700)]
staging: comedi: mite: remove mite_struct member 'mite_phys_addr'
This member of mite_struct is set but never used. Just remove it.
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>
H Hartley Sweeten [Wed, 20 Apr 2016 17:36:32 +0000 (10:36 -0700)]
staging: comedi: mite: don't export internal functions
The functions that get the number of bytes written to and read from
memory are only used internally by the mite driver when syncing the
dma channel. Make them static and remove the exports.
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>
H Hartley Sweeten [Wed, 20 Apr 2016 17:36:31 +0000 (10:36 -0700)]
staging: comedi: mite: remove mite_dma_tcr()
This exported function is not used by any of the comedi drivers. The
only call point in mite.c is commented out. Remove the unused function
and the export.
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>
H Hartley Sweeten [Wed, 20 Apr 2016 17:36:30 +0000 (10:36 -0700)]
staging: comedi: mite: remove TOP_OF_PAGE() macro
This macro is not used. Remove it.
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>
H Hartley Sweeten [Wed, 20 Apr 2016 17:36:29 +0000 (10:36 -0700)]
staging: comedi: mite: Prefer 'unsigned int' to bare use of 'unsigned'
Fix the checkpatch.pl issues.
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>
H Hartley Sweeten [Thu, 14 Apr 2016 16:58:07 +0000 (09:58 -0700)]
staging: comedi: ni_mio_common: introduce NI_STC_DMA_CHAN_SEL()
The inline helper ni_stc_dma_channel_select_bitfield() returns the
bits needed to select a MITE channel to use for DMA. The MITE code
is setup to handle up to 8 channels but in reality only channels 0
to 3 are used by most of the drivers. The PCI-6032E and PCI-6033E
boards can also use channels 4 and 5.
For aesthetics, convert this inline function into a macro and
remove the BUG() which will never occur.
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>
H Hartley Sweeten [Thu, 14 Apr 2016 16:58:06 +0000 (09:58 -0700)]
staging: comedi: mite.h: rename CHSR_LxERR_mask
Fix the checkpatch.pl issue:
CHECK: Avoid CamelCase: <CHSR_LxERR_mask>
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>
H Hartley Sweeten [Thu, 14 Apr 2016 16:58:05 +0000 (09:58 -0700)]
staging: comedi: ni_mio_common: fix CamelCase in ni_serial_hw_readwrite8()
Fix the checkpatch.pl issue:
CHECK: Avoid CamelCase: <Error>
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>
H Hartley Sweeten [Thu, 14 Apr 2016 16:58:04 +0000 (09:58 -0700)]
staging: comedi: ni_mio_common: remove 'fudge_factor_80_to_20Mhz'
For aesthetics, remove this local variable to fix the checkpatch.pl issue:
CHECK: Avoid CamelCase: <fudge_factor_80_to_20Mhz>
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>
H Hartley Sweeten [Thu, 14 Apr 2016 16:58:03 +0000 (09:58 -0700)]
staging: comedi: ni_mio_common: usleep_range is preferred over udelay
Fix the checkpatch.pl issues.
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>
H Hartley Sweeten [Thu, 14 Apr 2016 16:58:02 +0000 (09:58 -0700)]
staging: comedi: ni_mio_common: tidy up ni_gpct_write_register()
The 'bits' value passed to this function is properly set by the callers
so the BUG_ON() can never occur when writing to the NITIO_G[01]_INT_ENA
and NITIO_G01_RESET registers. Remove the BUG_ON() checks.
For aesthetic, also remove the static const variables. They don't add
any additional clarity.
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>
H Hartley Sweeten [Thu, 14 Apr 2016 16:58:01 +0000 (09:58 -0700)]
staging: comedi: ni_mio_common: tidy up AO scan begin
The (*do_cmdtest) validates that the cmd->scan_begin_src will only be
TRIG_TIMER or TRIG_EXT. Refactor ni_ao_cmd_set_update() and remove the
BUG() which can never occur.
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>
H Hartley Sweeten [Thu, 14 Apr 2016 16:58:00 +0000 (09:58 -0700)]
staging: comedi: ni_mio_common: tidy up AO trigger selection
The AO subdevice (*cancel), ni_ao_reset(), always sets the private
data 'ao_trigger_select' to 0. So when a command is started the
'trigsel' value in ni_ao_cmd_set_trigger() will always start as 0.
Remove the unnecessary member from the private data.
The (*do_cmdtest) validates that the cmd->start_src will only be
TRIG_INT or TRIG_EXT. Refactor ni_ao_cmd_set_trigger() and remove
the BUG() which can never occur.
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>
H Hartley Sweeten [Thu, 14 Apr 2016 16:57:59 +0000 (09:57 -0700)]
staging: comedi: ni_mio_common: convert NI_GPCT_SUBDEV to a macro
The 'counter_index' is always in range (0 to < NUM_GPCT, which is 2).
For aesthetics, convert this inline function into a macro and remove
the BUG() which can never occur.
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>
H Hartley Sweeten [Thu, 14 Apr 2016 16:57:58 +0000 (09:57 -0700)]
staging: comedi: ni_mio_common: fix logical continuations
Fix the checkpatch.pl issues:
CHECK: Logical continuations should be on the previous line
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>
H Hartley Sweeten [Thu, 14 Apr 2016 16:57:57 +0000 (09:57 -0700)]
staging: comedi: ni_mio_common: multiple assignments should be avoided
Fix the checkpatch.pl issues.
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>
H Hartley Sweeten [Thu, 14 Apr 2016 16:57:56 +0000 (09:57 -0700)]
staging: comedi: ni_mio_common: fix lines over 80 characters
Fix the checkpatch.pl issues.
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>
H Hartley Sweeten [Thu, 14 Apr 2016 16:57:55 +0000 (09:57 -0700)]
staging: comedi: ni_mio_common: tidy up block comments
Fix the checkpatch.pl issues.
WARNING: Block comments use * on subsequent lines
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>
H Hartley Sweeten [Thu, 14 Apr 2016 16:57:54 +0000 (09:57 -0700)]
staging: comedi: ni_mio_common: use 'unsigned int' instead of kernel types
Generally comedi drivers use 'unsigned int' types instead of the kernel type
'u32' for unsigned 32-bit values.
For aesthetics, change all the 'u32' and 'uin32_t' types and fix the
checkpatch.pl issues about:
CHECK: Prefer kernel type 'u32' over 'uint32_t'
The various i/o helpers use for reading and writing the 32/16/8-bit registers
all start with an 'unsigned int' value for writing and finally return an
'unsigned int' value. For aesthetics, change all the 'uint16_t' and 'uint8_t'
types for insigned int and fix the checkpatch.pl issues about:
CHECK: Prefer kernel type 'u16' over 'uint16_t'
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>
H Hartley Sweeten [Thu, 14 Apr 2016 16:57:53 +0000 (09:57 -0700)]
staging: comedi: ni_mio_common: Prefer 'unsigned int' to bare use of 'unsigned'
Fix the checkpatch.pl issues.
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>
H Hartley Sweeten [Thu, 14 Apr 2016 16:57:52 +0000 (09:57 -0700)]
staging: comedi: ni_mio_common: tidy up DIO subdevice ifdef'ery
This file is is bit of a mess. It's included by the ni_atmio, ni_mio_cs, and
ni_pcimio drivers. The ni_pcimio driver is the only one that uses DMA. It
defines PCIDMA so that the dma code is compiled it. This causes a bunch
of ifdef'ery in the file.
The DIO subdevice for the ni_pcidio "is_m_series" boards is quite different
from the standard e-series DIO. Mainly it supports async commands that use
DMA.
Tidy up some of the ifdef'ery by adding ifdef to the subdevice init. Move
the is_m_series check to the main interrupt handler so that the unneded
handle_cdio_interrupt() can be blocked out for the ni_atmio and ni_mio_cs
drivers.
Consolidate the other ifdef's to block out the affected 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>
H Hartley Sweeten [Thu, 14 Apr 2016 16:57:51 +0000 (09:57 -0700)]
staging: comedi: ni_mio_common: tidy up mite dma channel releases
Absorb the inline helper functions that call ni_set_bitfield() to clear
the dma channel selection 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>
H Hartley Sweeten [Thu, 14 Apr 2016 16:57:50 +0000 (09:57 -0700)]
staging: comedi: ni_mio_common: tidy up mite dma channel requests
Tidy up the functions that request the mite dma channels by absorbing the
inline helper functions that call ni_set_bitfield() to set the channel
selection bits.
Add support for the NI_M_CDIO_DMA_SEL_REG register to ni_set_bitfield()
so that all the soft_reg_copy_lock spinlocking is done in one place.
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>
H Hartley Sweeten [Thu, 14 Apr 2016 16:57:49 +0000 (09:57 -0700)]
staging: comedi: ni_mio_common: remove some unnecessary BUG_ON()
The mite dma channels are only requested by a subdevice with a (*do_cmd)
and they are released by a (*cancel). The comedi core will only call the
(*do_cmd) if the subdevice is not already running a command and all
commands are terminated by the core with a (*cancel).
Remove the BUG_ON() checks in the request functions which can never
happen.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:42:06 +0000 (12:42 -0700)]
staging: comedi: das1800: update the MODULE_DESCRIPTION
Change the MODULE_DESCRIPTION to something more usefull than the
generic "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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:42:05 +0000 (12:42 -0700)]
staging: comedi: das1800: allow setting the external trigger polarity
The external pin TGIN can be used to start and/or stop the analog input
command. Currently the driver only supports negative edge polarity for
this signal.
Add support to allow the user to select positive edge polarity using
the CR_INVERT flag.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:42:04 +0000 (12:42 -0700)]
staging: comedi: das1800: clarify the analog input cmd triggers
Clarify the documentation in the comedi driver comment block to
better explain the cmd triggert.
Add a comment to step 2b of the (*do_cmdtest) to clarify the
trigger check.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:42:03 +0000 (12:42 -0700)]
staging: comedi: das1800: fix comments about the 'ao' board range
The waveform analog outputs on the 'ao' boards are not currently
supported. Modify the comment about the analog output range on
these boards so that the information is saved but fixes the
checkpatch.pl issues:
WARNING: Block comments use a trailing */ on a separate line
Move the comment so it's grouped with the comedi_lrange info.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:42:02 +0000 (12:42 -0700)]
staging: comedi: das1800: fix lines over 80 characters
These comments are just extra cruft. Remove them to fix the
checkpatch.pl issues:
WARNING: line over 80 characters
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:42:01 +0000 (12:42 -0700)]
staging: comedi: das1800: fix comments in das1800_ai_handler()
Fix the checkpatch.pl issues:
WARNING: line over 80 characters
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:42:00 +0000 (12:42 -0700)]
staging: comedi: das1800: fix comments in das1800_ai_cmd()
Fix the checkpatch.pl issues:
WARNING: Block comments use a trailing */ on a separate line
WARNING: line over 80 characters
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:59 +0000 (12:41 -0700)]
staging: comedi: das1800: remove the function comments
These comments are just added cruft. 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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:58 +0000 (12:41 -0700)]
staging: comedi: das1800: clarify step 4 of the ai (*do_cmdtest)
This step of the (*do_cmdtest) fixes the timing arguments when the
cmd->convert_src is TRIG_TIMER. The code is compact but it's a bit
hard to understand the "burst mode" vs. "non burst mode" (i.e. paced)
timing.
Clarify the fixup by splitting it into separate functions to check
the arguments based on if the command is doing 'paced' or 'burst'
timing. Add some comments to clarify the fixups.
This also fixes a minor issue with the 'burst' timing. When the
cmd->scan_begin_src is also TRIG_TIMER the pacer clock is used to
start each scan. The cmd->scan_begin_arg specifies the scan time.
The minimum (not maximum) value for this time must be large enough
for the 'burst' conversion time to sample all the channels.
The current 'max' check limits the scan time to the minimum time
(i.e. the max conversion speed).
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:57 +0000 (12:41 -0700)]
staging: comedi: das1800: remove the private data member comments
The comments about the members of the private data are not really
necessary and removing them fixes a couple checkpatch.pl issues.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:56 +0000 (12:41 -0700)]
staging: comedi: das1800: move comment about max conversion speeds
For aesthetics, move this information into the comedi comment block.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:55 +0000 (12:41 -0700)]
staging: comedi: das1800: change type of private data 'fifo_buf'
Fix the checkpatch.pl issue:
CHECK: Prefer kernel type 'u16' over 'uint16_t'
Change the type to 'unsigned short' as that is more typical in comedi
drivers.
Use sizeof(*p) instead of sizeof(type) when allocation the buffer.
Also fix the checkpatch.pl issue:
WARNING: line over 80 characters
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:54 +0000 (12:41 -0700)]
staging: comedi: das1800: cleanup copyright and comedi comment blocks
Tidy up these multi-line comments to fix the checkpatch.pl issues:
WARNING: Block comments use * on subsequent lines
WARNING: line over 80 characters
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:53 +0000 (12:41 -0700)]
staging: comedi: das1800: document the spinlock
The comedi_device spinlock is used to protect the indirect addressing
selected by the DAS1800_SELECT register. It also prevents races between
the interrupt handler and the analog input (*poll).
Update the comments to make this clear.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:52 +0000 (12:41 -0700)]
staging: comedi: das1800: absorb control_a_bits()
Absorb this helper function into the analog input (*do_cmd).
For aesthetics, convert the switch code into if/else.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:51 +0000 (12:41 -0700)]
staging: comedi: das1800: use comedi_timeout()
Use the helper function to handle the busywaiting for the analog
input conversion to complete.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:50 +0000 (12:41 -0700)]
staging: comedi: das1800: refactor program_chanlist()
Refactor this function so it can be used to program the chanlist for
the analog input (*do_cmd) and (*insn_read).
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:49 +0000 (12:41 -0700)]
staging: comedi: das1800: absorb control_c_bits()
Absorb this helper function into the analog input (*do_cmd).
For aesthetics, convert the switch code into if/else.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:48 +0000 (12:41 -0700)]
staging: comedi: das1800: introduce das1800_ai_chanspec_bits()
Introduce a helper function for the common code needed to set the
control c register bits for a channel specification.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:47 +0000 (12:41 -0700)]
staging: comedi: das1800: add analog output readback
Use the core provided readback support to allow reading back the last
value written to the analog output channels.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:46 +0000 (12:41 -0700)]
staging: comedi: das1800: change type of 'ai_speed' boardinfo
This value is compared against the unsigned int cmd->convert_arg to
check the minimum value (max speed) for the analog input conversion
timing.
For aesthetics, change the type to match the cmd->convert_arg type.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:45 +0000 (12:41 -0700)]
staging: comedi: das1800: remove 'qram_len' boardinfo
The "hc" type boards have 64 analog input channels with a 64
entry queue. All the others have 16 channels and a 256 entry
queue.
EXP-1800 expansion boards can be used to increase the number
of analog inputs on the 16 channel boards, 16 channels per
EXP-1800, for a total of 256 channels.
Remove the 'qram_len' member of the boardinfo and use the
'id' member to determine the number of channels.
Add a comment about the number of channels and the unclear
mapping of the channels when EXP-1800 boards are used.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:44 +0000 (12:41 -0700)]
staging: comedi: das1800: refactor 'range_ai' boardinfo
The boards supported by this driver have analog inputs with gains
of 1, 10, 50, and 250 ("01" type) or 1, 2, 4, and 8 ("02" type).
Unfortunately, the "01"/"02" type cannot be determined from the
boards id or by probing.
Replace the 'range_ai' member of the boardinfo with a bit-field flag,
'is_01_series' and only set it for the "01" type boards. Remove the
unnecessary initialization for the "02" type boards.
For aesthetics, rename the comedi_lrange arrays and document the gain.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:43 +0000 (12:41 -0700)]
staging: comedi: das1800: remove 'ao_ability' boardinfo
The "da" and "hc" type boards have normal analog outputs. The
"ao" type boards have move advanced analog outputs with waveform
generation capability.
Remove the 'ao_ability' member of the boardinfo and use the
'id' member to determine if the subdevice should be initialized.
The "ao" waveform analog outputs are not currently supported.
For aesthetics, add an else if for the initialization of the
subdevice for these boards.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:42 +0000 (12:41 -0700)]
staging: comedi: das1800: remove 'ao_n_chan' boardinfo
The "st-da" board types have 4 analog output channels. All other
board types, with analog outputs, only have 2 channels.
Remove the 'ao_n_chan' member of the boardinfo and use the
'id' member to determine the subdevice 'n_chan'.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:41 +0000 (12:41 -0700)]
staging: comedi: das1800: tidy up das1800_ao_insn_write()
The (*insn_write) functions are supposed to write insn->n values to the
specified channel. Tidy up this function and make it work like the core
expects.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:40 +0000 (12:41 -0700)]
staging: comedi: das1800: initialize all analog outputs
The current code used to initialize the analog outputs only sets the
last channel. The other channels will be reloaded with the last value
that was written to them.
Move the code into the subdevice init and properly initialize all the
channels to 0V.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:39 +0000 (12:41 -0700)]
staging: comedi: das1800: remove 'do_n_chan' boardinfo
The "hc" type boards have 8 digtial outputs. All other board
types have 4.
Remove the 'do_n_chan' member of the boardinfo and use the
'id' member to determine the subdevice 'n_chan'.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:38 +0000 (12:41 -0700)]
staging: comedi: das1800: remove 'resolution' boardinfo
The "hr" type boards have 16-bit analog inputs and outputs.
All other board types have 12-bit.
Remove the 'resolution' member of the boardinfo and use the
'id' member to determine the subdevices 'maxdata'.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:37 +0000 (12:41 -0700)]
staging: comedi: das1800: use comedi_offset_munge() for analog output
The analog outputs expect 2's complement data. For aesthetics, use
the helper function to handle the munging instead of depending on
the boardinfo 'resolution'.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:36 +0000 (12:41 -0700)]
staging: comedi: das1800: remove 'common' boardinfo member
The "hc" type boards do not support common mode analog inputs
all the other board types do.
Remove the unnecessary member from the boardinfo and use the
'id' member to determine if the SDF_COMMON flag should be set
for the 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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:35 +0000 (12:41 -0700)]
staging: comedi: das1800: tidy up das1800_probe()
Refactor das1800_probe() to return an errno instead of the boardinfo
pointer.
Add the board 'id' to the boardinfo to tidy up this function to clarify
the sanity check when the user provided a board name when trying to
attach to the driver.
Currently when this function probes for a boardinfo based on the board
id it returns the wrong boardinfo for the "st-da" and "hr-da" types.
This causes the analog input subdevice for those boards to not be
available. Fix the probe so that a proper boardinfo is used.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:34 +0000 (12:41 -0700)]
staging: comedi: das1800: tidy up boardinfo
For aesthetics, add some whitespace to the boardinfo array.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:33 +0000 (12:41 -0700)]
staging: comedi: das1800: tidy up analog input subdevice init
For aesthetics, add some whitespace to the subdevice init and rename
the subdevice 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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:32 +0000 (12:41 -0700)]
staging: comedi: das1800: tidy up analog output subdevice init
For aesthetics, add some whitespace to the subdevice init and rename
the (*insn_write) function.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:31 +0000 (12:41 -0700)]
staging: comedi: das1800: tidy up digital input subdevice init
For aesthetics, add some whitespace to the subdevice init and rename
the (*insn_bits) function.
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>
H Hartley Sweeten [Fri, 8 Apr 2016 19:41:30 +0000 (12:41 -0700)]
staging: comedi: das1800: tidy up digital output subdevice init
For aesthetics, add some whitespace to the subdevice init and rename
the (*insn_bits) function.
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>
H Hartley Sweeten [Mon, 11 Apr 2016 18:18:21 +0000 (11:18 -0700)]
staging: comedi: plx9080.h: rename CamelCase enum value
Rename the enum value to fix the checkpatch.pl issue:
CHECK: Avoid CamelCase: <MARB_PCIv21_MODE>
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>
H Hartley Sweeten [Mon, 11 Apr 2016 18:32:18 +0000 (11:32 -0700)]
staging: comedi: comedi_8254.h: tidy up the register map defines
Tidy up the defines to fix the checkpatch.pl issues:
CHECK: Prefer using 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>
H Hartley Sweeten [Mon, 11 Apr 2016 18:23:25 +0000 (11:23 -0700)]
staging: comedi: amcc_s5933.h: tidy up comment issues
Tidy up the comments to fix the checkpatch.pl isses:
WARNING: Block comments use * on subsequent lines
WARNING: line over 80 characters
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>
H Hartley Sweeten [Mon, 11 Apr 2016 18:12:57 +0000 (11:12 -0700)]
staging: comedi: ni_stc.h: tidy up block comments
Tidy up the block comments to fix the checkpatch.pl issues:
WARNING: Block comments use * on subsequent lines
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>
H Hartley Sweeten [Mon, 11 Apr 2016 18:12:56 +0000 (11:12 -0700)]
staging: comedi: ni_stc.h: Prefer kernel type 'u8' over 'uint8_t'
Change the type to fix the checkpatch.pl issues.
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>