- 17 Dec, 2013 40 commits
-
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
The board supported by this driver only has one WinSystems WS16C48 asic on it that handles the digital i/o. Remove the unnecessary 'asic' parameter that is passed to switch_page(). 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 authored
The board supported by this driver only has one WinSystems WS16C48 asic on it that handles the digital i/o. Remove the 'asics' struct array in the private data and add members for the single 'asic_iobase' and the spinlock used by the asic. 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 authored
The 'pol' and 'enab' members in the private data are never used. The 'num' member is set during the attach but never used. 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 authored
The for () loop that does the request_irq() in this driver is a bit of an overkill. The code appears to have been copied from the pcmuio driver which supports boards with 1 or 2 ASIC devices. The board supported by this driver only has 1 ASIC. Simplify the code and store the irq number in the comedi_device. This allows the core to automatically do the free_irq() when the driver is detached. 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 authored
Add some whitespace to the analog output subdevice init and reorder the init to follow the "norm" in comedi drivers. Remove the init of len_chanlist. This member is only used for subdevices the support async commands. The core will default the value 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>
-
H Hartley Sweeten authored
Rename this function so it has namespace associated with the driver. Move the 'chan' local variable out of the for () loop. The 'chan' is constant for the comedi_insn and only needs to be fetched once from the insn->chanspec. Also, remove the sanity check of the chan. The comedi core will ensure that the chan is valid for the subdevice before calling this 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 authored
Rename wait_dac_ready() so it has namespace associated with the driver. Fix the function so it returns an errno if the conversion times out. Propogate this errno if it happens. Define the analog output status register to remove the magic numbers. 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 authored
Rename this function to have namespace associated with the driver. Refactor the function to remove the extra write to the command register to set the range before writing the DAC value. Since the range is constant for the entire comedi_insn it only needs to be set once. All writes to the DAC after that will use the same range. Define the register map for the analog output 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 authored
The 'iobase' is only used to pass the iobase address of the analog output registers to ao_winsn(). This address is simply dev->iobase + 8. Use that instead and remove the 'iobase' from the subdevice private data. This removes a couple more uses of the ugly 'subpriv' 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 authored
There is only one ai subdevice in this driver so there is no reason to hold the last sample written to each channel in the subdevice private data. Move the data into the device private data, This gets some of the data out of the subdevice private data union and removes some of the uses of the ugly 'subpriv' 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 authored
Add some whitespace to the ai subdevice init and reorder it a bit to follow the "norm" in comedi drivers. Remove the init of s->len_chanlist. This member is only used with subdevices that support async commands. The core will default the value correctly.. The ai subdevice only uses the s->private member to pass the iobase to the analog input registers. It's just a copy of the dev->iobase, use that 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 authored
There are two ADC devices on this board. The first one handles ai channels 0-7 and the second one channels 8-15. Define the offset that is added to the iobase to access the 2nd ADC device. 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 authored
Rename adc_wait_ready() so it has namespace associated with the driver. Fix the function so it returns an errno if the conversion times out. Propogate this errno if it happens. Define the analog input status register to remove the magic numbers. 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 authored
Rename this function to have namespace associated with the driver. Refactor the function to remove the extra write to the command register between each ADC conversion. We only need to do one dummy conversion in order to flush the serial ADC. After that each command will return the result of the previous conversion. Define the register map for the analog input 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 authored
Use the comedi_range_is_bipolar() and comedi_offset_munge() helpers to munge the bipolar analog input 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>
-
H Hartley Sweeten authored
Use the BIP_RANGE and UNI_RANGE macros where appropriate instead of the more generic RANGE macro. Rename the range tables 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>
-