- 07 Mar, 2014 40 commits
-
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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. Move the call in pcl816_ai_cancel() so that the flag is reset after stopping the A/D. 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
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 a redundant call in pcl812_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>
-
H Hartley Sweeten authored
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. The driver currently does not do this. Refactor the function a bit so it's more like the pcl818 and pcl816 drivers and use common code to clear the flag for a 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>
-
H Hartley Sweeten authored
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 does that but it's a bit awkward with the initial clear being outside the for loop that reads the samples. Refactor the function a bit so it's more like the pcl818 driver and we can use common code to clear the flag for a 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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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>
-
H Hartley Sweeten authored
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. Add some whitespace to the subdevice init. 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
For aesthetics, move this function to follow the pcl812 and pcl818 drivers better. Remove the commented out cut-and-paste code from the pcl818 driver. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
H Hartley Sweeten authored
For aesthetics, tidy up the digtial subdevice code. Rename the register map defines for the digital input and output ports. Move the two digital subdevice (*insn_bits) functions out of the analog support functions. Tidy them up a bit 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>
-
H Hartley Sweeten authored
The PCL-816 boards have 16 digital inputs and 16 digtial outputs. Add the subdevice support for these channels. Allocate additional subdevice space to the analog outputs. This code is not currently in the driver so mark the subdevice as COMEDI_SUBD_UNUSED. 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
For aesthetics, tidy up the digtial subdevice code. rename the register map defines for the digital input and output ports. Move the two digital subdevice (*insn_bits) functions out of the analog support functions. Tidy them up a bit during the move. Add some whitespace to the subdevice init. 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 DMA, FIFO, and EOC interrupt handler functions, that are called by the _real_ interrupt function, always return IRQ_HANDLED. Change the return type for these functions to void and move the final return to the real interrupt function. Change the parameters to the handler functions to the comedi_device and comedi_subdevice pointers. At some point in the handler functions the interrupt request is cleared. Move this to the real interrupt function. Also at some point in the handlers, comedi_event() is called to pass any events to the comedi subsystem. Move this to the real interrupt function also. For aesthetics, and to clarify the code, rename the interrupt function and the handler functions. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
H Hartley Sweeten authored
This driver only supports interrupt driven DMA transfers for async command support. Absorb the interrupt_pcl816_ai_mode13_dma() helper into the interrupt handler to clarify the code. At some point during the interrupt, comedi_event() is called to pass any events to the comedi subsystem. Move this to the interrupt handler. Add a comedi_event() call to pcl816_ai_poll() due to the removal of the call from transfer_from_dma_buf(). For aesthetics, rename the interrupt function so it has namespace associated with the driver. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
H Hartley Sweeten authored
The DMA and EOC interrupt handler functions, that are called by the _real_ interrupt function, always return IRQ_HANDLED. Change the return type for these functions to void and move the final return to the real interrupt function. Change the parameters to the handler functions to the comedi_device and comedi_subdevice pointers. At some point in the handler functions the interrupt request is cleared. Move this to the real interrupt function. Also at some point in the handlers, comedi_event() is called to pass any events to the comedi subsystem. Move this to the real interrupt function also. For aesthetics, and to clarify the code, rename the interrupt function and the handler functions. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
H Hartley Sweeten authored
This member of the private data is not needed. We can determine the interrupt mode based on the 'dma' and 'usefifo' members. Refactor the interrupt handler and the (*cancel) function to not use the 'ai_mode' and remove the setting of this member in the (*do_cmd) heler functions. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
H Hartley Sweeten authored
This member of the private data is not needed. Refactor the interrupt handler and the (*cancel) function to not use the 'int816_mode' and remove the setting of this member in the (*do_cmd) heler 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
If an async ai command is not running or the ai_mode is 0 the interrupt routine doesn't do anything other than spew some noise and clear the interrupt request in the hardware. Because this driver is manually attached, the "premature interrupt" check in the interrupt handler should never happen. The interrupt is only hooked up during the attach and it's released during the detach. Combine these checks so that the interrupt function exits quick if it has nothing to handle. Remove the noise. 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
If an async ai command is not running or the int816_mode is 0 the interrupt routine doesn't do anything other than spew some noise and clear the interrupt request in the hardware. Because this driver is manually attached, the "premature interrupt" check in the interrupt handler should never happen. The interrupt is only hooked up during the attach and it's released during the detach. Combine these checks so that the interrupt function exits quick if it has nothing to handle. Remove the noise. 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
Because this driver is manually attached, the "spurious interrupt" check in the interrupt handler should never happen. The interrupt is only hooked up during the attach and it's released during the detach. Leave the check but remove the noise. Also make sure to clear the interrupt request in the hardware. 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
When using DMA, the async command (*cancel) operation is delayed until the current DMA transfer is complete. When the DMA transfer finishes the interrupt routine detects this and calls the (*cancel) again which should then cancel the async command. The current logic does not work when cmd->stop_src == TRIG_NONE. In this case the (*cancel) function keeps delaying the cancel. The actual DMA does stop because the DMA handler is not called to setup the next transfer but the (*cancel) code is never executed. Rename the 'irq_was_now_closed' flag in the private data to 'ai_cmd_canceled' to clarify what it is. Only set the flag in the (*cancel) when a DMA transfer is running and the async command has not already been canceled. The interrupt routine then does not need all the extra checks. 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 flag in the private data is set when an async command is canceled with the ai (*cancel) operation. Rename the flag to 'ai_cmd_canceled' to clarify its use. Move the check for the flag in the interrupt handler. If the async command was canceled there is no reason to handle the interrupt. Just clear interrupt and return. Also, make sure to clear the interrupt when the device is not attached. 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
If an async command is not running the (*cancel) function doesn't do anything. Exit the function early if this is the case. This allows reducing the indent level in the rest of the function. Also, move the setting of the 'irq_was_now_closed' to the only place wher it actually gets left set to 1 and remove the goto. 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
If an async command is not running the (*cancel) function doesn't do anything. Exit the function early if this is the case. This allows reducing the indent level in the rest of the function. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
H Hartley Sweeten authored
The DMA, FIFO, and EOC interrupt handlers all have common code that checks for channel dropout when running an async command. Factor this common code into a helper function. Only return the sample if the channel is valid. The EOC handler was previously returning the value then checking for channel dropout. 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 clarify the code, introduce a helper function to read the analog input data sample from the FIFO and optionally return the channel that the sample was for. The channel is used to check for dropped 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>
-
H Hartley Sweeten authored
The A/D FIFO uses two registers to get each analog data sample. PCL818_FI_DATALO is the LSB of the data and PCL818_FI_DATAHI is the MSB of the data. The current define for PCL818_FI_DATAHI is incorrect and results in the LSB getting read twice. 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 DMA, FIFO, and EOC interrupt handlers all have common code that bumps the counters in the private data that keep track of what channel is being sampled next and when all the data has been sampled. Factor this common code into a helper function. Make sure the COMEDI_CB_BLOCK event is set when advancing to the next channel so that when the comedi_event() is finally called the core will wake the async_queue to return the analog input data. Also, make sure the COMEDI_CB_EOS event is set at the completion of each 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>
-
H Hartley Sweeten authored
Factor out the code that bumps the counters in the private data that keep track of what channel is being samples next and when all the data has been sampled. Don't clear the events in the driver. The comedi core will clear the events at the end of the comedi_event(). Make sure the COMEDI_CB_BLOCK event is set when advancing to the next channel so that when the comedi_event() is finally called the core will wake the async_queue to return the analog input data. Also, make sure the COMEDI_CB_EOS event is set at the completion of each 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>
-
H Hartley Sweeten authored
The DMA and EOC interrupt handlers all have common code that bumps the counters in the private data that keep track of what channel is being sampled next and when all the data has been sampled. Factor this common code into a helper function. Don't clear the events in the driver. The comedi core will clear the events at the end of the comedi_event(). Make sure the COMEDI_CB_BLOCK event is set when advancing to the next channel so that when the comedi_event() is finally called the core will wake the async_queue to return the analog input data. Also, make sure the COMEDI_CB_EOS event is set at the completion of each 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>
-
H Hartley Sweeten authored
This driver only supports async commands if a DMA channel is available. Modify the subdevice init so that the command support only gets hooked up if we can do 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>
-
H Hartley Sweeten authored
According to the users manual, when using interrupt (non-DMA) transfers this hardware generates an interrupt at the start of a conversion. This requires the interrupt routine to busywait until the end-of-conversion. It appears this was unreliable and interrupt only async command support was removed at some time. Async command support is still available when DMA is used. Remove the unreachable interrupt only handler code. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
H Hartley Sweeten authored
The interrupt is only generated by the hardware at the completion of an A/D conversion. Because of this the sanity check to make sure that the A/D conversion is complete and data is available is probably unnecessary but it doesn't hurt anything. The busywait loop is a different issue. Interrupt routines should not busywait. That's just mean... Remove the bustwait and use pcl818_ai_eoc() to check for the 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>
-
H Hartley Sweeten authored
The interrupt is only generated by the hardware at the completion of an A/D conversion. Because of this the sanity check to make sure that the A/D conversion is complete and data is available is probably unnecessary but it doesn't hurt anything. The busywait loop is a different issue. Interrupt routines should not busywait. That's just mean... Remove the bustwait and use pcl812_ai_eoc() to check for the 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>
-
H Hartley Sweeten authored
This member of the private data is not used. Remove it. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
H Hartley Sweeten authored
This member of the private data is only used in the initial dma setup. Refactor that code to not need it and remove the member. 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>
-