aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/drivers/pcmmio.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-04-15staging: comedi: move out of staging directoryGreg Kroah-Hartman1-777/+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>
2020-07-25staging: comedi: pcm: 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/20200721193806.68010-1-grandmaster@al2klimov.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28staging: comedi: drivers: Remove redundant license textGreg Kroah-Hartman1-10/+0
Now that the SPDX tag is in all comedi files, that identifies the license in a specific and legally-defined manner. So the extra GPL text wording can be removed as it is no longer needed at all. This is done on a quest to remove the 700+ different ways that files in the kernel describe the GPL license text. And there's unneeded stuff like the address (sometimes incorrect) for the FSF which is never needed. No copyright headers or other non-license-description text was removed. Cc: Ian Abbott <abbotti@mev.co.uk> Cc: H Hartley Sweeten <hsweeten@visionengravers.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-06-17Staging: comedi: fix CHECK: Prefer using the BIT macro issues in pcmmio.cRavishankar Karkala Mallikarjunayya1-20/+20
This patch Replace all occurences of (1<<x) by BIT(x) in the file pcmmio.c to get rid of checkpatch.pl "CHECK" output "Prefer using the BIT macro" Signed-off-by: Ravishankar Karkala Mallikarjunayya <ravishankarkm32@gmail.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-03staging: comedi: pcmmio: remove #include "comedi_fc.h"Ian Abbott1-15/+14
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-01-09staging: comedi: pcmmio: rewrite "Devices:" lineIan Abbott1-1/+1
Rewrite the "Devices:" line in the comedi "driver" comment to conform to the usual comedi format for this line. The line should be a comma-separated list where the first item is in the following format: [Manufacturer] BOARD-NAME (comedi-board-name) The "[Manufacturer]" and/or "(comedi-board-name)" parts may be omitted from following items, in which case the parts from the preceding item are used. The "Devices:" line may be continued continued over several lines by using one or more spaces at the start of each continuation line (not counting the space after the "*" in the block comment). 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-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: pcmmio: use comedi_async 'scans_done' to detect EOAH Hartley Sweeten1-9/+3
Remove the private data member 'count' 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-10-29staging: comedi: pcmmio: use comedi_buf_write_samples()H Hartley Sweeten1-5/+2
The dev->read_subdev used in this driver for async commands returns 32-bit samples and should have the SDF_LSAMPL subdev_flag set. It also returns the full scan with each sample so it should have the SDF_PACKED subdev_flag set. Add the missing subdev_flags and use comedi_buf_write_samples() to add the sample to the async buffer. The COMEDI_CB_BLOCK and COMEDI_CB_EOS events will be automatically handled by the core. Remove the unnecessary events 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: pcmmio: use comedi_handle_events()H Hartley Sweeten1-13/+3
Use comedi_handle_events() to automatically (*cancel) the async command for an end-of-acquisition or if an error/overflow occurs. Also, comedi_handle_events() does nothing if no events are set so the local variable 'oldevents' can be removed. 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: pcmmio: return void from pcmmio_start_intr()H Hartley Sweeten1-14/+4
This function always returns '0' so the comedi_event() is never done by the callers. Change the return type to void and remove the comedi_event() dead 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-09-11staging: comedi: pcmmio: 'stop_count' is always 'stop_arg'H Hartley Sweeten1-5/+1
When the cmd->stop_src == TRIG_COUNT, the 'stop_count' is the cmd->stop_arg. For any other stop_src the 'stop_count' is 0, which is also the cmd->stop_arg. Simplify the 'stop_count' initialization. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-11staging: comedi: pcmmio: remove "empty acquisition" async commandH Hartley Sweeten1-16/+3
This driver currently allows a cmd->stop_src == TRIG_COUNT with a cmd->stop_arg of 0. This causes the (*do_cmd) to immediately generate a COMEDI_CB_EOA event without acquiring any data. This "empty acquisition" async command is not really useful. Validate that the cmd->stop_arg is >= 1 in the (*do_cmdtest) and remove the "empty acquisition" 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-08-30staging: comedi: pcmmio: use comedi_subdevice 'readback'H Hartley Sweeten1-22/+7
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-05-28staging: comedi: pcmmio: remove 'continuous' from private dataH Hartley Sweeten1-20/+9
This member of the private data can be determined from the cmd->stop_src. Do that instead and remove the member. Refactor pcmmio_handle_dio_intr() to remove an indent level. For aesthetics, change the switch in pcmmio_cmd() to an 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>
2014-05-28staging: comedi: pcmmio: use comedi_cmd pointerH Hartley Sweeten1-3/+3
Use a local variable to access the comedi_cmd as a pointer instead of getting to from the comedi_subdevice pointer. Remove the unnecessary local variables used for the cmd->chanlist_len. 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-2/+2
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-04-22staging: comedi: pcmmio: fix the cmd->start_arg use for TRIG_INTH Hartley Sweeten1-14/+8
This driver supports a cmd->start_src of TRIG_NOW or TRIG_INT. The cmd->start_arg is trivially validated for both sources to be 0. For a TRIG_INT source, the cmd->start_arg is actually the valid trig_num that is used by the async (*inttrig) callback. Refactor the (*inttrig) function so that the cmd->start_arg is used to check the trig_num instead of the open coded value. For aesthetics, refactor the (*do_cmd) to use if/else instead if the switch when handling the cmd->start_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>
2014-02-14staging: comedi: pcmmio: use comedi_timeout()H Hartley Sweeten1-18/+24
Use comedi_timeout() to wait for the analog input and output end-of- conversions. 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>
2013-12-17staging: comedi: pcmmio: fix final checkpatch warningH Hartley Sweeten1-1/+1
Fis the last checkpatch.pl warning in this driver: WARNING: space prohibited between function name and open parenthesis '(' + comedi_buf_put (s->async, val >> 16)) { 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>
2013-12-17staging: comedi: pcmmio: tidy up the multi-line commentsH Hartley Sweeten1-71/+71
Tidy up the multi-line comments are the beginning of the file to follow the CodingStyle. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-17staging: comedi: pcmmio: update the MODULE_DESCRIPTIONH Hartley Sweeten1-1/+1
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>
2013-12-17staging: comedi: pcmmio: return '0' after successful attachH Hartley Sweeten1-1/+3
The comedi core expects the (*attach) functions to return < 0 to indicate an error or >= 0 for success. Change the return to '0' as that is more typical. 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>
2013-12-17staging: comedi: pcmmio: cleanup the private dataH Hartley Sweeten1-5/+4
Fix the types of some of the private data members. The 'enabled_mask' and 'stop_count' should be unsigned int values. The 'active' and 'continuous' members are flags, change them to unsigned int bit fields. Remove the 'sprivs' pointer. This should have been removed when the subdevice private data was removed. 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>
2013-12-17staging: comedi: pcmmio: remove unused definesH Hartley Sweeten1-20/+0
These defines are not longer used in the driver. 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>
2013-12-17staging: comedi: pcmmio: tidy up pcmmio_start_intr()H Hartley Sweeten1-36/+23
Refactor the function to remove some indent levels. Use pcmmio_dio_write() to write the polarity and enable paged registers instead of using the for () loop to write each register in the pages. The for () loop actually has a bug. It switches the page to the 'enab' registers for the first port then switches to the 'pol' registers for all remaining writes. It also was not using the pagelock spinlock to protect the writes to the page registers. Using the pcmmio_dio_write() helper ensures that the writes to the paged registers complete correctly. 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>
2013-12-17staging: comedi: pcmmio: setup irq routing during (*attach)H Hartley Sweeten1-22/+18
To use interrupts the IRQ routing must be configured and interrupts enabled. Currently both steps are being handled in pcmmio_start_intr(). Move the code that sets the IRQ routing into the attach of the board. At this point interrupts are still disabled. The enable and polarity bits just need to be set in pcmmio_start_intr() to enable 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>
2013-12-17staging: comedi: pcmmio: only hook up async command support if irq is availableH Hartley Sweeten1-21/+18
Refactor the board attach so that the async commands support is only hooked up if the irq is actually available. 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>
2013-12-17staging: comedi: pcmmio: tidy up pcmmio_handle_dio_intr()H Hartley Sweeten1-32/+33
Refactor the code to remove some of the indent levels. Remove 'mytrig', the shift and mask end up making it the same as 'triggered' anyway. 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>
2013-12-17staging: comedi: pcmmio: factor the trigger handling out of interrupt_pcmmio()H Hartley Sweeten1-52/+56
Factor the code that actually handles the digital input triggers out 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>
2013-12-17staging: comedi: pcmmio: use pcmmio_dio_{read, write}() in interrupt_pcmmio()H Hartley Sweeten1-31/+8
Use the helper functions to read/write the PCMMIO_PAGE_INT_ID registers. This allows removing the need to lock/unlock the spinlock 'pagelock' and removes the need for the for () loop that did the read/write of the 3 paged registers. Also, remove the need for the 'got1' local variable by just returning 'IRQ_NONE' if there are not interrupts pending. 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>
2013-12-17staging: comedi: pcmmio: cleanup indent levels in interrupt_pcmmio()H Hartley Sweeten1-109/+73
Remove the extra indent levels in this function that resulted from code removed in previous patches. 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>
2013-12-17staging: comedi: pcmmio: use comedi_legacy_detach() for (*detach)H Hartley Sweeten1-6/+1
The (*detach) of this driver just calls comedi_legacy_detach(). Use that directly for the (*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>
2013-12-17staging: comedi: pcmmio: remove subdevice private dataH Hartley Sweeten1-79/+41
Only subdevice[2], the dio interrupt subdevice, uses the subdevice private data. Move the members from struct pcmmio_subdev_private to struct pcmmio_private and remove the subdevice private data. This also allows removing the allocation and freeing of devpriv->sprivs. 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>
2013-12-17staging: comedi: pcmmio: remove 'num_asic_chans' from subdevice private dataH Hartley Sweeten1-11/+3
The 'num_asic_chans' that support interrupts in the interrupt subdevice is always initialized to '24'. Remove this unneeded information from the subdevice 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>
2013-12-17staging: comedi: pcmmio: remove 'asic_chan' from subdevice private dataH Hartley Sweeten1-9/+2
The first 'asic_chan' that supports interrupts in the interrupt subdevice is always initialized to '0'. Remove this unneeded information from the subdevice 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>
2013-12-17staging: comedi: pcmmio: remove 'first_chan' from subdevice private dataH Hartley Sweeten1-16/+7
The 'first_chan' that supports interrupts in the interrupt subdevice is always initialized to '0'. Remove this unneeded information from the subdevice 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>
2013-12-17staging: comedi: pcmmio: remove 'asic' member from subdevice private dataH Hartley Sweeten1-18/+1
This member of the subdevice private data is always initialized to '0' by the only subdevice that uses it. Since we only have one asic on the board it's really not needed. 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>
2013-12-17staging: comedi: pcmmio: remove unnecessary for () loop and sanity checkH Hartley Sweeten1-6/+2
There is only one asic on the board so the for () loop in the interrupt handler to check multiple asics is not needed. The sanity check of the 'irq' in the interrupt handler is also not needed. If it _is_ wrong we have bigger problems in the kernel. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-17staging: comedi: pcmmio: unwind the digital i/o subdevice initH Hartley Sweeten1-89/+45
The board supported by this driver only has one asic that provides the two digital i/o subdevices. The first dio subdevice has 24 channels that support interrupts. The second dio subdevice also has 24 channels but no interrupt support. To make the code clearer and easier to maintain, remove the for () loop that initialized these subdevices. Also, correctly initialize the interrupt subdevice. The current code does not set the SDF_CMD_READ subdev_flag and does not set the dev->read_subdev pointer in the comedi_device. Use the dev->read_subdev pointer in the interrupt handler to get the interrupt subdevice and private data pointer instead of searching for them. To keep this patch reviewable, the extra indents in interrupt_pcmmio() will be removed later. 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>
2013-12-17staging: comedi: pcmmio: simplify pcmmio_stop_intr()H Hartley Sweeten1-12/+3
This function is only called by the interrupt subdevice so the sanity check of the 'asic' is not necessary. Remove it. The 'nports' is always 3 and the 'firstport' is always 0. Remove the for () loop that clears the registers to disable the interrupts and just use the pcmmio_dio_write() helper to write to the three page registers. This also fixes a bug where the write to the page registers is not protected with the spinlock. 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>
2013-12-17staging: comedi: pcmmio: remove 'iobases' from the subdevice private dataH Hartley Sweeten1-7/+0
This member of the subdevice private data is not longer 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>
2013-12-17staging: comedi: pcmmio: simplify pcmmio_dio_insn_bits()H Hartley Sweeten1-50/+59
Currently this function uses the subdevice private data to get the iobase address needed to update the dio output channel state and read the current state of the input channels. This subdevice private data is in the process of being removed. Use the subdevice 'index' to determine the base 'port' needed to access the correct digital i/o registers. The pcmmio_dio_write() function can then be used to update the outputs. Introduce a new helper function, pcmmio_dio_read(), to read the current state of the input 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>
2013-12-17staging: comedi: pcmmio: simplify pcmmio_dio_insn_config()H Hartley Sweeten1-12/+4
Currently this function uses the subdevice private data to get the iobase address needed to update the channel configuration. This subdevice private data is in the process of being removed. Use the subdevice 'index' to determine the base 'port' needed to access the correct digital i/o registers. The pcmmio_dio_write() function can then be used to update the configuration. 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>
2013-12-17staging: comedi: pcmmio: introduce pcmmio_dio_write()H Hartley Sweeten1-19/+30
The paged registers in the asic need to be spinlock protected to ensure that the page is not changed while writing to the registers. Introduce a helper function to make sure the spinlock is used. Use the new helper in pcmmio_reset(). This is one of the places where the spinlock is not 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>
2013-12-17staging: comedi: pcmmio: rename 'spinlock' in the private dataH Hartley Sweeten1-4/+4
This spinlock_t is meant to protect the page registers in the asic. Rename it 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>
2013-12-17staging: comedi: pcmmio: remove 'subpriv' macroH Hartley Sweeten1-3/+14
This macro relies on a local variable having a specific name. Remove the macro and add a local variable where 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>
2013-12-17staging: comedi: pcmmio: cleanup the digital i/o register definesH Hartley Sweeten1-71/+47
Redefine the registers used to access the digital i/o so that they are based on the dev->iobase of the board instead of the 'asic_iobase' that is stored in the private data. Remove the then unused 'asic_iobase'. 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>
2013-12-17staging: comedi: pcmmio: tidy up init_asics()H Hartley Sweeten1-28/+23
Rename this function so it has namespace associated with the driver. The board supported by this driver only has one WinSystems WS16C48 asic on it that handles the digital i/o. Remove the unnecessary for () loop that would reset multiple asics. 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>