aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/drivers/adv_pci1710.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
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>
2015-12-18staging: comedi: adv_pci1710: rename pci171x_ai_*()H Hartley Sweeten1-11/+11
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-18staging: comedi: adv_pci1710: rename pci171x_ai_{cmd,cmdtest}()H Hartley Sweeten1-4/+4
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-18staging: comedi: adv_pci1710: fix ai (*insn_read)H Hartley Sweeten1-4/+9
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-18staging: comedi: adv_pci1710: fix counter 0 internal clock sourceH Hartley Sweeten1-1/+1
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-18staging: comedi: adv_pci1710: tidy up pci1710_reset()H Hartley Sweeten1-12/+12
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-18staging: comedi: adv_pci1710: ai (*cancel) should not enable software triggerH Hartley Sweeten1-5/+8
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-18staging: comedi: adv_pci1710: post increment 'subdev' in (*auto_attach)H Hartley Sweeten1-13/+5
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-18staging: comedi: adv_pci1710: tidy up analog input subdev_flagsH Hartley Sweeten1-1/+1
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-18staging: comedi: adv_pci1710: tidy up analog output subdev_flagsH Hartley Sweeten1-1/+2
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-18staging: comedi: adv_pci1710: support external analog output referenceH Hartley Sweeten1-5/+8
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-18staging: comedi: adv_pci1710: rename pci171x_ao_insn_write()H Hartley Sweeten1-26/+26
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-18staging: comedi: adv_pci1710: rename pci171x_d[io]_insn_bitsH Hartley Sweeten1-25/+25
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-18staging: comedi: adv_pci1710: rename pci171x_insn_counter_config()H Hartley Sweeten1-2/+2
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-18staging: comedi: adv_pci1710: rename interrupt_service_pci1710()H Hartley Sweeten1-2/+2
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-18staging: comedi: adv_pci1710: tidy up boardinfo definitionH Hartley Sweeten1-8/+8
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-18staging: comedi: adv_pci1710: remove 'has_large_fifo' and 'has_diff_ai' boardinfoH Hartley Sweeten1-10/+5
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-18staging: comedi: adv_pci1710: remove 'has_di_do' boardinfoH Hartley Sweeten1-12/+10
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-18staging: comedi: adv_pci1710: remove 'n_aichan' boardinfoH Hartley Sweeten1-35/+26
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-18staging: comedi: adv_pci1710: define the mux control register bitsH Hartley Sweeten1-5/+9
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-18staging: comedi: adv_pci1710: refactor ai range programmingH Hartley Sweeten1-53/+55
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-18staging: comedi: adv_pci1710: don't "reset" board when detachingH Hartley Sweeten1-8/+1
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-18staging: comedi: adv_pci1710: remove 'has_counter' boardinfoH Hartley Sweeten1-7/+3
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-18staging: comedi: adv_pci1710: remove 'has_irq' boardinfoH Hartley Sweeten1-7/+1
All the boards supported by this driver can use an interrupt. Remove the unnecessary boardinfo. 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-11-15staging: comedi: adv_pci1710: separate out PCI-1720 support as a new driverH Hartley Sweeten1-103/+6
The PCI-1710 series boards are multifunction data acquisition boards with analog inputs and outputs, digital inputs and outputs, and counter/timer functions. The PCI-1720 is a simple 4 channel analog output board. It also uses a unique register map. Separate out the PCI-1720 support as a new driver, adv_pci1720, to ease maintainability. Fix some issues with the PCI-1720 support in the new driver: 1) the registers are all 8-bit 2) remove the analog output "reset" when the driver attaches/detaches 3) disable "synchronized output" to simplify the analog outputs 4) remove the need for the private data 5) add support for the BoardID register to allow multiple cards 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-13staging: comedi: adv_pci1710: rename private data member 'ai_et_MuxVal'H Hartley Sweeten1-4/+5
Rename thie CamelCase member of the private data. Add a comment in the interrupt handler to clarify why the channel interval is updated again. 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-13staging: comedi: adv_pci1710: tidy up PCI1720_* register definesH Hartley Sweeten1-21/+20
The PCI-1720 board is supported by this driver but uses a different register map. For aesthetics, rename the defines to match the PCI171X_* format. 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-13staging: comedi: adv_pci1710: tidy up remaining PCI171x_* registersH Hartley Sweeten1-46/+47
Rename these CamelCase 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>
2015-10-13staging: comedi: adv_pci1710: tidy up control register and bitsH Hartley Sweeten1-40/+38
Rename the CamelCase and use the BIT macro to define the bits. Also, rename the associated CamelCase members 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-10-13staging: comedi: adv_pci1710: tidy up status register and bitsH Hartley Sweeten1-17/+15
Rename the CamelCase 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>
2015-10-13staging: comedi: adv_pci1710: tidy up multi-line commentsH Hartley Sweeten1-34/+19
Reformat the multi-line comments in the kernel CodingStyle. And refactor them to follow the normal format for comedi drivers. 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: adv_pci1710: remove #include "comedi_fc.h"Ian Abbott1-17/+18
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-20staging: comedi: adv_pci1710: include new "comedi_pci.h" headerIan Abbott1-2/+1
Include the new "../comedi_pci.h" header instead of <linux/pci.h> and "../comedidev.h", which will now get included indirectly. 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-09Merge 4.0-rc3 into staging-nextGreg Kroah-Hartman1-2/+1
We want the staging fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06staging: comedi: drivers/*.c: fix common misspellingsH Hartley Sweeten1-1/+1
Fix these common misspellings: s/dependancy/dependency s/occured/occurred s/informations/information s/intialize/initialize s/serveral/several s/interrups/interrupts s/acknowledgement/acknowledgment s/suppport/support s/writting/writing 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-03-01staging: comedi: adv_pci1710: fix AI INSN_READ for non-zero channelIan Abbott1-2/+1
Reading of analog input channels by the `INSN_READ` comedi instruction is broken for all except channel 0. `pci171x_ai_insn_read()` calls `pci171x_ai_read_sample()` with the wrong value for the third parameter. It is supposed to be the current index in a channel list (which is always of length 1 in this case, so the index should be 0), but instead it is passing the actual channel number. `pci171x_ai_read_sample()` checks the channel number encoded in the raw sample value read from the hardware matches the channel number stored in the specified index of the previously set up channel list and returns `-ENODATA` if it doesn't match. Since the index should always be 0 in this case, the match will fail unless the channel number is also 0. Fix it by passing 0 as the channel index. Note that when the bug first appeared, it was `pci171x_ai_dropout()` that was called with the wrong parameter value. `pci171x_ai_dropout()` got replaced with `pci171x_ai_read_sample()` in commit 7fd2dae2500d ("staging: comedi: adv_pci1710: introduce pci171x_ai_read_sample()"). Fixes: 16c7eb6047bb ("staging: comedi: adv_pci1710: always enable PCI171x_PARANOIDCHECK code") Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Cc: stable <stable@vger.kernel.org> # 3.16+ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-01staging: comedi: adv_pci1710: convert driver to use the comedi_8254 moduleH Hartley Sweeten1-146/+60
This driver uses an 8254 timer to generate the pacer clock used for analog input data acquisition. It also provides a comedi_subdevice to allow the user to use channel 0 of the 8254 timer. Currently the subdevice support does not work correctly due to and (*insn_config) that does not follow the comedi API. Convert it to use the comedi_8254 module to provide support for the 8254 timer and proper support 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>
2015-01-25staging: comedi: adv_pci1710: absorb move_block_from_fifo()H Hartley Sweeten1-35/+29
This function is only called by pci1710_handle_fifo(). Absorb it and clean up pci1710_handle_fifo(). 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: adv_pci1710: transfer all ai samples in one stepH Hartley Sweeten1-13/+2
The two step process to transfer the ai samples in pci1710_handle_fifo() doesn't make any sense. If the async buffer does not have enough room for the samples the core will set the async event COMEDI_CB_OVERFLOW which will cause the async command to cancel. Splitting the transfer doesn't add any value. Transfer all the samples in one step to 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>
2015-01-25staging: comedi: adv_pci1710: remove 'turn' param from move_block_from_fifo()H Hartley Sweeten1-3/+3
This parameter is not used in the function. It was only used in some debug messages that were previously removed. Remove the parameter. 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: adv_pci1710: do comedi_handle_events() in common code patchH Hartley Sweeten1-8/+2
The pci1710_handle_every_sample() and pci1710_handle_fifo() helpers, called by the interrupt handler, both have multiple comedi_handle_events() calls. Remove these and just do a single comedi_handle_events() at the end of the 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>
2015-01-25staging: comedi: adv_pci1710: introduce pci171x_ai_read_sample()H Hartley Sweeten1-35/+33
Introduce a helper function to read an analog input sample, check for channel dropout, and mask the sample to the maxdata of 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>
2015-01-25staging: comedi: adv_pci1710: tidy up setup_channel_list()H Hartley Sweeten1-25/+26
Rename this function so it has namespace associated with the driver. Tidy up the code to clarify the function. Remove the unnecessary static const array muxonechan[]. 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: adv_pci1710: clarify the 'act_chanlist'H Hartley Sweeten1-9/+11
This driver saves the channel list of a scan in the private data and uses that list to check analog input samples for data dropout. Currently the channel numbers are shifted 12 bits so that they match the channel number in the samples that are read from the board. All of the shifts make the driver a bit harder to follow. Store the channel numbers directly to the 'act_chanlist' and shift the sample value instead when checking for the dropout. Add a comment for 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>
2015-01-25staging: comedi: adv_pci1710: refactor boardinfo 'cardtype'H Hartley Sweeten1-36/+18
The 'cardtype' in the boardinfo is only used to: 1) determine if the board is a pci1720 during the attach of the driver and when reseting the board 2) determine is the board is not a pci1713 when checking for analog input data dropout There is also an unnecessary use of the 'cardtype' when canceling an analog input async command. Remove the 'cardtype' member and add two bit-field flags, 'is_pci1713' and 'is_pci1720'. Refactor the driver to use the new flags. Remove the unnecessary cardtype handling in pci171x_ai_cancel(). 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: adv_pci1710: remove boardinfo 'rangelist_ao'H Hartley Sweeten1-8/+4
This boardinfo is not necessary. All the boards with analog outputs have the same range options except for the pci1720 board. That board type is already handled specially during the driver attach. Remove the boardinfo and add the subdevice range_table initialization in the cardtype switch. Rename the range tables to clarify that they are "analog output" ranges. 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: adv_pci1710: update the MODULE_DESCRIPTIONH Hartley Sweeten1-1/+1
Change the MODULE_DESCRIPTION to something more useful 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>
2015-01-25staging: comedi: adv_pci1710: remove function separation commentsH Hartley Sweeten1-15/+0
Remove the remaining, unnecessary, function separation 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-01-25staging: comedi: adv_pci1710: rename 'this_board' local variablesH Hartley Sweeten1-29/+29
For aesthetics, rename all the 'this_board' local variables to simply 'board'. That's more common in comed drivers. 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: adv_pci1710: tidy up analog input subdevice initH Hartley Sweeten1-20/+15
For aesthetics, add some whitespace to the analog input subdevice init and rename the (*insn_read) support function. Also remove the unnecessary 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>