aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/drivers/pcl818.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-04-15staging: comedi: move out of staging directoryGreg Kroah-Hartman1-1137/+0
The comedi code came into the kernel back in 2008, but traces its lifetime to much much earlier. It's been polished and buffed and there's really nothing preventing it from being part of the "real" portion of the kernel. So move it to drivers/comedi/ as it belongs there. Many thanks to the hundreds of developers who did the work to make this happen. Cc: Ian Abbott <abbotti@mev.co.uk> Cc: H Hartley Sweeten <hsweeten@visionengravers.com> Link: https://lore.kernel.org/r/YHauop4u3sP6lz8j@kroah.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: comedi: pcl818: Fix endian problem for AI command dataIan Abbott1-1/+1
The analog input subdevice supports Comedi asynchronous commands that use Comedi's 16-bit sample format. However, the call to `comedi_buf_write_samples()` is passing the address of a 32-bit integer parameter. On bigendian machines, this will copy 2 bytes from the wrong end of the 32-bit value. Fix it by changing the type of the parameter holding the sample value to `unsigned short`. [Note: the bug was introduced in commit edf4537bcbf5 ("staging: comedi: pcl818: use comedi_buf_write_samples()") but the patch applies better to commit d615416de615 ("staging: comedi: pcl818: introduce pcl818_ai_write_sample()").] Fixes: d615416de615 ("staging: comedi: pcl818: introduce pcl818_ai_write_sample()") Cc: <stable@vger.kernel.org> # 4.0+ Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Link: https://lore.kernel.org/r/20210223143055.257402-10-abbotti@mev.co.uk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-25staging: comedi: pcl: Replace HTTP links with HTTPS onesAlexander A. Klimov1-1/+1
Rationale: Reduces attack surface on kernel devs opening the links for MITM as HTTPS traffic is much harder to manipulate. Deterministic algorithm: For each file: If not .svg: For each line: If doesn't contain `\bxmlns\b`: For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`: If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`: If both the HTTP and HTTPS versions return 200 OK and serve the same content: Replace HTTP with HTTPS. Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de> Link: https://lore.kernel.org/r/20200721192750.67925-1-grandmaster@al2klimov.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-11staging: comedi: remove redundant variable segposColin Ian King1-2/+2
Variable segpos is being assigned but is never used hence it is redundant and can be removed. Cleans up clang warning: warning: variable 'segpos' set but not used [-Wunused-but-set-variable] Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28staging: comedi: add SPDX identifiers to all greybus driver filesGreg Kroah-Hartman1-0/+1
It's good to have SPDX identifiers in all files to make it easier to audit the kernel tree for correct licenses. Update the drivers/staging/comedi files files with the correct SPDX license identifier based on the license text in the file itself. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This work is based on a script and data from Thomas Gleixner, Philippe Ombredanne, and Kate Stewart. Cc: Ian Abbott <abbotti@mev.co.uk> Cc: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Kate Stewart <kstewart@linuxfoundation.org> Cc: Philippe Ombredanne <pombredanne@nexb.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-16staging: comedi: Align the * on block commentsJakub Jedelsky1-3/+3
Block comments should align the * on each line as reported by checkpatch Signed-off-by: Jakub Jedelsky <jakub.jedelsky@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-12staging: comedi: pcl818: remove unused "boards constants"H Hartley Sweeten1-9/+0
These defines are not used. Remove them to get rid of the checkpatch.pl issue about avoiding CamelCase. 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-10-12staging: comedi: pcl818: prefer using the BIT macroH Hartley Sweeten1-16/+15
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>
2015-04-03staging: comedi: pcl818: remove #include "comedi_fc.h"Ian Abbott1-19/+21
As preparation for removal of "comedi_fc.h", replace calls to the `cfc_check_trigger_...` functions from "comedi_fc.h" with the replacement `comedi_check_trigger_...` functions from "../comedidev.h" and remove the inclusion of "comedi_fc.h". Signed-off-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-03-01staging: comedi: pcl818: convert driver to use the comedi_8254 moduleH Hartley Sweeten1-51/+29
This driver uses an 8254 timer to generate the pacer clock used for analog input data acquisition. Convert it to use the comedi_8254 module to provide support for the 8254 timer. Note that the pacer does not have to be stopped when starting a new async command in pcl818_ai_cmd() or when the card is initialy reset by pcl818_reset(). The counters are all reset when the driver is initially attached and the counters used by the pacer are stopped when a command is canceled. 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-02-07STAGING: Fix pcl818.c coding style issue: line over 80 charactersSimon Guo1-5/+10
Correct one coding style problem(detected by checkpatch.pl) in pcl818.c. - line over 80 characters Signed-off-by: Simon Guo <wei.guo.simon@gmail.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-07STAGING: Fix pcl818.c coding style issue: code indent should use tabs where possibleSimon Guo1-98/+91
Correct one coding style problem(detected by checkpatch.pl) in pcl818.c. - code indent should use tabs where possible It is fixed by reformatting the comment block to usual comment style. And with the reformatting, following coding style problem is also fixed: - please, no space before tabs Signed-off-by: Simon Guo <wei.guo.simon@gmail.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-25staging: comedi: pcl818: introduce pcl818_ai_write_sample()H Hartley Sweeten1-32/+9
This driver can acquire analog input samples during the async command with DMA, by using the FIFO, or sample-by-sample using the End-Of-Conversion interrupt. All three methods do the following sequence: 1) check for channel dropout 2) add the sample to the async buffer 3) advance the channel dropout detection and detect the end of the command Merge this sequence into a new 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>
2015-01-25staging: comedi: drivers: remove inappropriate COMEDI_CB_EOA eventsH Hartley Sweeten1-4/+4
Hardware errors should be reported with the COMEDI_CB_ERROR event. This event will cause the async command to cancel. It's not necessary to also set the COMEDI_CB_EOA event. Remove these events. 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-01-17staging: comedi: pcl818: use common function to setup dmaH Hartley Sweeten1-35/+13
THe pcl818_ai_setup_dma() and pcl818_ai_setup_next_dma() functions are similar other than the buffer switch and the inclusion of the "unread_samples" in pcl818_ai_setup_next_dma() when calculating the dma size. Merge these two functions by initializing the 'dma->cur_dma' in the callers and passing '0' for the "unread_samples" when first starting the DMA. 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-01-17staging: comedi: pcl818: simplify the dma->size calculationsH Hartley Sweeten1-31/+27
Currently this driver determines the number of DMA "runs" needed and the size of the "last" DMA transfer in order to perform a command. As long as there are more "runs" required, the dma->size is set to the buffer maxsize. On the last "run" the buffer is set to the "last" size. Refactor the driver to use the comedi core helpers to determine the DMA size based on the buffer maxsize and the number of samples remaining in the command. This allows removing the 'dma_runs_to_end' and 'last_dma_run' mamebers from the private data. Also remove the 'ai_data_len' member which is set but never 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>
2015-01-17staging: comedi: pcl818: remove depends on ISA_DMA_API limitationH Hartley Sweeten1-93/+39
Use the new comedi_isadma module to provide the ISA DMA support. This removes all the ISA_DMA_API code from this driver and allows the driver to be used on platforms that don't support the ISA_DMA_API. 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-01-17staging: comedi: pcl818: introduce pcl818_isadma_disable()H Hartley Sweeten1-3/+12
According to Documentation/DMA-ISA-LPC.txt, the DMA lock needs to be claimed before using any of the ISA DMA routines. Introduce a helper function to disable the ISA DMA controller and add the necessary locking 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-01-17staging: comedi: pcl818: introduce pcl818_isadma_program()H Hartley Sweeten1-15/+18
Introduce a helper function to program the ISA DMA controller. Program the ISA DMA as described in Documentation/DMA-ISA-LPC.txt. 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-01-17staging: comedi: pcl818: fix pcl818_handle_dma() for short DMA transactionH Hartley Sweeten1-17/+17
Currently this function always transfers the full DMA buffer to the comedi async buffer. When the cmd->stop_src == TRIG_COUNT the last DMA transfer might be smaller than the buffer size. This results in invalid data being added to the asunc buffer. Add a 'size' member to the DMA descriptor and initialize it with the actual size of the DMA transfer. Use that in pcl818_handle_dma() to return the proper number of samples. Use the comedi_bytes_to_samples() helper to convert the byte size to comedi samples. Remove the unnecessary 'bufptr' local variable. 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-01-17staging: comedi: pcl818: remove VIRT_TO_BUS dependancyH Hartley Sweeten1-13/+12
Use dma_{alloc,free}_coherent() to allocate and free the DMA buffers. This removes the dependancy on VIRT_TO_BUS. 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-01-17staging: comedi: pcl818: introduce struct pcl818_dma_descH Hartley Sweeten1-19/+25
For aesthetics, introduce a struct to hold the DMA descriptor 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-01-17staging: comedi: pcl818: introduce pcl818_dma_free()H Hartley Sweeten1-6/+17
For aesthetics, move the freeing of the DMA channel and the buffers to a 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>
2015-01-17staging: comedi: pcl818: introduce pcl818_alloc_dma()H Hartley Sweeten1-25/+32
DMA is optional with this driver. Introduce a helper function to request the DMA channel and allocate the buffers. Don't fail the driver attach if the user passed an invalid DMA channel or the channel cannot be requested. 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>
2014-11-26staging: comedi: drivers: have core hook up default (*insn_read) for readbackH Hartley Sweeten1-1/+0
Most of the comedi drivers that provide readback for write only subdevices now use the comedi core comedi_alloc_subdev_readback() helper to allocate the subdevice 'reaback' member instead of using some member in their private data. These drivers also hook up the (*insn_read) callback to the comedi_readback_insn_read() helper to provide the readback. Have the core automatically hook up the (*insn_read) callback after allocating the memory if the driver has not already hooked it up to a private 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>
2014-11-05staging: comedi: pcl818: use comedi_async 'scans_done' to detect EOAH Hartley Sweeten1-9/+6
Remove the private data member 'ai_act_scan' and use the comedi_async 'scans_done' member to detect the end-of-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>
2014-11-05staging: comedi: pcl818: remove private data member 'ai_act_chan'H Hartley Sweeten1-2/+0
This member of the private data is set to '0' but never 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>
2014-11-03staging: comedi: drivers: move comedi_async 'cur_chan' tracking into the coreH Hartley Sweeten1-5/+1
The commedi_async 'cur_chan' member is used to track the current position in the chanlist for a scan. Currently only a couple comedi drivers use this member. For aeshtetics, move the 'cur_chan' tracking into the core for non-SDF_PACKED subdevices. The 'cur_chan' will be updated after reading or writing samples to the async buffer by comedi_inc_scan_progress(). All non-SDF_PACKED subdevices will then automatiaclly track the 'cur_chan'. Some of the drivers use the 'cur_chan' to detect the end of scan event when counting scans. The COMEDI_CB_EOS event is automatically added by the core when the end of scan is detected. The drivers just need to check if the 'cur_chan' is 0 to count the number of scans completed. 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>
2014-10-29staging: comedi: pcl818: use comedi_buf_write_samples()H Hartley Sweeten1-5/+3
For aesthetics, use comedi_buf_write_samples() to add the sample to the async buffer. The core will add the COMEDI_CB_BLOCK event when data is written to the async buffer. Remove the unnecessary event in 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>
2014-10-20staging: comedi: pcl818: use comedi_bytes_per_scan()H Hartley Sweeten1-1/+1
This inline function is just a wrapper around comedi_bytes_per_scan(). 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>
2014-10-20staging: comedi: pcl818: use comedi_handle_events()H Hartley Sweeten1-1/+1
cfc_handle_events() is just a wrapper around comedi_handle_events(). 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>
2014-09-11staging: comedi: pcl818: replace comedi_board() callsIan Abbott1-4/+4
The `comedi_board(dev)` inline function calls just return `dev->board_ptr`. Expand the inline function calls. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-30staging: comedi: pcl818: use comedi_subdevice 'readback'H Hartley Sweeten1-22/+11
Use the new comedi_subdevice 'readback' member and the core provided (*insn_read) for the readback of the analog output subdevice 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>
2014-07-17staging: comedi: pcl818: remove use of comedi_error()H Hartley Sweeten1-4/+5
The comedi_error() function is just a wrapper around dev_err() that adds the dev->driver->driver_name prefix to the message and a terminating new-line character. The addition of the driver_name is just added noise and some of the users of comedi_error() add unnecessary additional new-line characters. Use dev_err() directly instead of comedi_error() to avoid any confusion and so that all the comedi generated kernel messages have the same format. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-28staging: comedi: pcl818: use cfc_bytes_per_scan()H Hartley Sweeten1-1/+1
Use the comedi_fc helper to get the number of bytes per scan. 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>
2014-05-28staging: comedi: pcl818: use comedi_fc helpers to validate timer argH Hartley Sweeten1-7/+4
Use the comedi_fc helper cfc_check_trigger_arg_is() to validate the trigger argument when the source is TRIG_TIMER. The minimum test is not needed, this was already validated in Step 3. All the arguments are unsigned int, change the local variable to an unsigned int and rename it for aesthetic reasons. 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>
2014-05-23staging: comedi: pass subdevice to comedi_buf_put()Ian Abbott1-3/+3
Change the parameters of `comedi_buf_put()` to pass a pointer to the comedi subdevice instead of a pointer to the "async" structure belonging to the subdevice. The function puts a sample value in the comedi buffer, but currently only deals with 16-bit sample types. A future version could deal with 16 or 32-bit sample types depending on the value of the SDF_LSAMPL subdevice flag. The main aim at the moment is to replace all the `struct comedi_async *` parameters with `struct comedi_subdevice *` parameters in the comedi driver API. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-17staging: comedi: pcl818: use cfc_handle_events()H Hartley Sweeten1-6/+1
Use the comedi_fc helper function to automatically call the subdevice (*cancel) function when needed and call comedi_event(). Update the Kconfig so that COMEDI_PCL818 selects COMEDI_FC. 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>
2014-03-06staging: comedi: pcl818: clarify pcl818_reset()H Hartley Sweeten1-16/+15
Like done in the pcl812 driver, use the boardinfo to determine what should be reset. 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>
2014-03-06staging: comedi: pcl818: tidy up the remaining register definesH Hartley Sweeten1-5/+10
For aesthetics, rename the timer/counter enable request register and define its 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>
2014-03-06staging: comedi: pcl818: cleanup ai_cmd()H Hartley Sweeten1-68/+43
Rename this function so it has namespace associated with the driver. The cmd->scan_begin_src is always TRIG_FOLLOW and the only valid cmd->convert_src is TRIG_TIMER or TRIG_EXT so pcl818_ai_cmd_mode() is always called with a 'mode' of 1 or 3. The 'mode' actually indicates the trigger source. Absorb pcl818_ai_cmd_mode() into this function and simplify the code. This also removes the need for a forward declaration. 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>
2014-03-06staging: comedi: pcl818: absorb pcl818_ai_mode13dma_int()H Hartley Sweeten1-37/+16
Absorb this function into pcl818_ai_cmd_mode() and simplify 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>
2014-03-06staging: comedi: pcl818: define the mode register bitsH Hartley Sweeten1-27/+31
Define the bits in the register to remove the magic values. Tidy up pcl818_ai_cancel(). The 0x73 mask of the value read from the control register will disable dma and interrupts but it does not change the trigger mode. So the software trigger following it might not work. Just disable the trigger and clear any pending end-of-conversion. 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>
2014-03-06staging: comedi: pcl818: cleanup setup_channel_list()H Hartley Sweeten1-44/+52
Move this function to remove the need for the forward declaration. Rename it so it has namespace associated with the driver. Remove the unnecessary comedi_subdevice parameter from the function. The hardware has per-channel programmable gain. This function first sets the range for each channel then sets the mux register to automatically scan the channels. The use of 'muxonechan' when programming the ranges is incorrect. Only the low 4-bits are supposed to be set when programming the ranges. Introduce a couple helper functions to set the range for a channel and to set the first/last channels to scan. Tidy up the range and mux register defines. 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>
2014-03-06staging: comedi: pcl818: define the status register bitsH Hartley Sweeten1-9/+11
Define the bits in the status register and remove the magic values. Writing any value to the status register clears any pending interrupt. For aesthetics, rename the status register and remove the "clrint" 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>
2014-03-06staging: comedi: pcl818: tidy up analog input registersH Hartley Sweeten1-8/+5
For aesthetics, rename the analog input register defines and convert the offsets to hex. 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>
2014-03-06staging: comedi: pcl818: introduce pcl818_ai_soft_trig()H Hartley Sweeten1-3/+7
Introduce a helper function to start a software triggered analog input conversion. 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>
2014-03-06staging: comedi: pcl818: introduce pcl818_ai_clear_eoc()H Hartley Sweeten1-11/+14
Introduce a helper function to clear the end-of-conversion flag. This flag is set when an analog input conversion is finished and the hardware generates an interrupt request. Writing any value to the register resets the flag and re-enables the interrupt. Remove the clearing of the flag in pcl818_handle_eoc(). The interrupt function will handle clearing the 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>
2014-03-06staging: comedi: pcl818: tidy up the analog input (*insn_read)H Hartley Sweeten1-37/+36
For aesthetics, move this function out of the async command support code. For safety, the INT request (end-of-conversion flag) should be cleared before doing each conversion and after the final data sample is read. This driver already clears the flag before starting a conversion but it does not clear the flag after the final sample. Refactor the function a bit so that the flag is cleared for a conversion timeout and after the last sample. Do a bit of other tidying up during the move. 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>
2014-03-06staging: comedi: pcl818: tidy up the analog output subdeviceH Hartley Sweeten1-53/+54
For aesthetics, tidy up the analog output subdevice code. Change the regsiter map defines to simplify the code. Move the analog subdevice support functions out of the analog input support functions. Tidy them up a bit during the move. Reverse the logic of the subdevice init and add some whitespace. 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>