Introduce a helper function to program the AMCC interrupt control/
status register to enable/disable interrupts.
Fix the analog input (*cancel). The analog input async command support
is the only interrupt generator. The (*cancel) should always disable
interrupts.
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>
staging: comedi: adl_pci9118: fix ai range/aref programming
Currently the analog input range and aref are set in setup_channel_list().
This works for the (*insn_read) but the (*do_cmd) has a problem.
In (*do_cmd) the ai control register is reset to 0 before the function works
out the bits needed to control the acquisition. This happens after the
setup_channel_list() call so the range is reset to bipolar and the aref to
single-ended.
Introduce a helper function, pci9118_ai_set_range_aref(), to handle the
programming of the range and aref bits. This function first clears the
cached value of the ai control register in the private data then sets the
appropriate bits. The (*insn_read) and (*do_cmd) can then set the other
bits needed to control the acquisition.
Then setup_channel_list() just needs to program the chanlist scan 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>
staging: comedi: adl_pci9118: ai (*insn_read) does not use interrupts
The analog input (*insn_read) in this driver is done as a software-triggered,
polled operation. The PCI9118_AI_CTRL_INT bit in the control register, which
is actually set in setup_channel_list(), should not be set.
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>
staging: comedi: adl_pci9118: cleanup and simplify pci9118_reset()
Change the return type to void, this function always succeeds and the
callers never check the return value.
According to the The User Manual for the PCI-9118, the hardware does not
require any particular "reset" in order to function. Simplify the reset
so it justs gets the board info a known state with interrupts disabled.
There is no reason to initialize the private data members in this function.
They all default to '0' due to the kzalloc() of the private data and the
subdevice operations all initialize them as needed.
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>
staging: comedi: adl_pci9118: move analog output (*insn_write) function
For aesthetics, move the analog output (*insn_write) function so it
is not located in the middle of the analog input functions. Also,
rename it for consistency.
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>
staging: comedi: adl_pci9118: use comedi_subdevice 'readback'
Use the new comedi_subdevice 'readback' member and the core provided
(*insn_read) for the readback of the analog output subdevice channels.
The board is "reset" prior to the subdevice init. Part of this reset
sets all the analog output channels to 0V. Move the initialization of
the 'readback' values after the 'readback' member has been allocated.
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>
staging: comedi: adl_pci9118: move digitial input (*insn_bits) function
For aesthetics, move the digital inputs (*insn_bits) function so it
is not located in the middle of the analog input functions. Also,
rename it for consistency.
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>
staging: comedi: adl_pci9118: move digitial output (*insn_bits) function
For aesthetics, move the digital outputs (*insn_bits) function so it
is not located in the middle of the analog input functions. Also,
rename it for consistency.
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>
staging: comedi: adl_pci9118: tidy up the interrupt control/status register
The register at offset 0x38 is the "interrupt control" register when written
and the "interrupt status" register when read. Both registers use the same
bit defines.
For aesthetics, use a common define for this register.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Writing any value to the "software trigger" register generates a trigger
pulse to start an A/D conversion. Introduce a helper function to clarify
this. For aesthetics, rename the define used for the register.
According to the datasheet the extra delay is not needed after starting
the conversion. 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>
staging: comedi: adl_pci9118: clarify the digital I/O register
The same register is used for both the digital inputs and outputs.
Reading the register returns the state of the 4 digtial input channels
and the 4 digital output channels. Writing to the register updates the
digital outputs.
Add some comments to clarify this and use a single define for the register.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: adl_pci9118: allocate private data in pci9118_common_attach()
The (*auto_attach) and legacy (*attach) both allocate the private data but
don't use it. For aesthetics, move the allocation into the common attach
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>
For aesthetics, rename the struct used for the boardinfo so it has
namespace associated with the driver. Also, rename the local variable
used for the boardinfo pointer to simply 'board'.
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>
The (*auto_attach) in this driver will set the dev->board_name and the comedi core
will set it when using the legacy (*attach). Remove the unnecessary initialization
in pci9118_common_attach().
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>
staging: comedi: adl_pci9118: use 'context' in (*auto_attach)
The pci_device_id 'driver_data' is passed as the 'context' when the (*auto_attach)
mechanism is used to attach this driver. Add a boardid enum and index the boardinfo
so that the "pci9118dg" boardinfo is automatically selected. This allow removing
the pci9118_find_boardinfo() helper.
Unfortunately all the boards supported by this driver have the same device id.
Add commented out entries in the device table for 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>
staging: comedi: adl_pci9118: refactor 'ai_maxdata' in boardinfo
The boards supported by this driver either have 12-bit or 16-bit analog
inputs. For aesthetics, replace the 'ai_maxdata' member in the boardinfo
with a bit-field flag, 'ai_is_16bit', and refactor the subdevice init to
use the new 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>
staging: comedi: adl_pci9118: refactor 'rangelist_ai' in boardinfo
The boards supported by this driver either have "normal" or "high gain"
analog input ranges.
For aesthetics, replace the 'rangelist_ai' member in the boardinfo with
a bit-field flag 'is_hg' to indicate the "high gain" range is used.
Refactor the subdevice init to use the flag to set the correct range_table.
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>
staging: comedi: adl_pci9118: remove 'ai_pacer_min' from boardinfo
This value can easily be calculated based on the minimum sampling rate,
'ai_ns_min', and the base clock speed of the timers. Do that instead and
remove the 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>
staging: comedi: adl_pci9118: remove 'ai_ns_min' from boardinfo
The minimum convert time 'ai_ns_min' is based on the sampling rate of the A/D
converter. This driver supports boards that use different ADC chips for 16-bit
and 12-bit analog inputs. These chips have different sampling rates.
For aesthetics, move the 'ai_ns_min' member from the boardinfo to the private
data. Initialize the member during the attach based on the 'maxdata' of the
analog inputs.
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>
staging: comedi: hwdrv_apci1500: use dev->class_dev in calls to dev_warn()
git-grep reveals that hwdrv_apci1500.c is the only file in comedi that uses
dev->hw_dev in calls to dev_{err,warn}(). The rest of the drivers pass
dev->class_dev to these macros instead. Switch the dev_warn() calls in
this driver to use dev->class_dev as well, for consistency.
Signed-off-by: Chase Southwood <chase.southwood@gmail.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Wed, 3 Sep 2014 12:45:45 +0000 (13:45 +0100)]
staging: comedi: add CMDF_ROUND_... as synonyms for TRIG_ROUND_...
The `TRIG_ROUND_...` macros are some of the values that can be OR-ed
into the `flags` member of `struct comedi_cmd`. They may influence the
rounding of sample timings during operation of the asynchronous command.
The names are a bit of a left-over from earlier times. It would be
better to use the names `CMDF_ROUND_...` to match various other command
flags.
Define `CMDF_ROUND_MASK`, `CMDF_ROUND_NEAREST`, `CMDF_ROUND_DOWN`,
`CMDF_ROUND_UP` and `CMDF_ROUND_UP_NEXT` with the same numeric values as
`TRIG_ROUND_MASK`, `TRIG_ROUND_NEAREST`, `TRIG_ROUND_DOWN`,
`TRIG_ROUND_UP` and `TRIG_ROUND_UP_NEXT`, and redefine the
`TRIG_ROUND_...` macros as synonyms of the `CMDF_ROUND_...` macros.
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>
Ian Abbott [Wed, 3 Sep 2014 12:45:43 +0000 (13:45 +0100)]
staging: comedi: add CMDF_BOGUS as synonym for TRIG_BOGUS
`TRIG_BOGUS` is one of the values that can be OR-ed into the `flags`
member of `struct comedi_cmd`. It causes the comedi core to go through
some of the motions of setting up an asynchronous command without
actually setting it up. If all goes well, it causes the command set-up
to fail with an `EAGAIN` error.
The name `TRIG_BOGUS` is a bit of a left-over from earlier times. A
better name would be `CMDF_BOGUS` to match various other command flags.
Define `CMDF_BOGUS` with the same numeric value as the old `TRIG_BOGUS`
and redefine `TRIG_BOGUS` as a synonym of it.
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>
Ian Abbott [Wed, 3 Sep 2014 12:45:32 +0000 (13:45 +0100)]
staging: comedi: adl_pci9118: use CMDF_WAKE_EOS
Replace use of `TRIG_WAKE_EOS` command flag with the new name
`CMDF_WAKE_EOS`. The numeric value is unchanged. Also change
diagnostic messages to use "CMDF_WAKE_EOS" instead of "TRIG_WAKE_EOS"
and change the Comedi driver description comment to use "CMDF_WAKE_EOS".
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>
Ian Abbott [Wed, 3 Sep 2014 12:45:29 +0000 (13:45 +0100)]
staging: comedi: add CMDF_WAKE_EOS as synonym for TRIG_WAKE_EOS
`TRIG_WAKE_EOS` is one of the values that can be OR-ed into the `flags`
member of `struct comedi_cmd`. It's intended action is tune the
asynchronous command to interrupt at the end of every "scan". The name
is a bit of a left-over from earlier times. A better name would be
`CMDF_WAKE_EOS` to match various other command flags.
Define `CMDF_WAKE_EOS` with the same numeric value as the old
`TRIG_WAKE_EOS` and redefine `TRIG_WAKE_EOS` as a synonym of it.
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>
Ian Abbott [Wed, 3 Sep 2014 12:45:27 +0000 (13:45 +0100)]
staging: comedi: ni_at_a2150: use CMDF_PRIORITY
Replace use of `TRIG_RT` command flag with the equivalent flag
`CMDF_PRIORITY`. The numeric value is unchanged. Also replace
"TRIG_RT" with "CMDF_PRIORITY" in the kernel messages.
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>
Ian Abbott [Wed, 3 Sep 2014 12:45:25 +0000 (13:45 +0100)]
staging: comedi: das16: use CMDF_PRIORITY
Replace use of `TRIG_RT` command flag with the equivalent flag
`CMDF_PRIORITY`. The numeric value is unchanged. Also replace
"TRIG_RT" with "CMDF_PRIORITY" in kernel log messages.
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>
Paul Bolle [Thu, 4 Sep 2014 10:44:53 +0000 (12:44 +0200)]
staging: emxx_udc: remove check for CONFIG_MACH_EMGR
There's a check for CONFIG_MACH_EMGR. But the Kconfig symbol MACH_EMGR
doesn't exist. Remove that check and the single #define it hides. Note
that this macro isn't used by this driver anyway.
Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Mark Einon [Wed, 3 Sep 2014 21:40:55 +0000 (22:40 +0100)]
staging: et131x: Remove spinlock fbr_lock
The spinlock fbr_lock is only used in a single call sequence staring
from et131x_poll. As this call is already locked by napi->poll_lock,
we can remove it.
Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Mark Einon [Wed, 3 Sep 2014 21:40:54 +0000 (22:40 +0100)]
staging: et131x: Remove dead code in isr
Dan Carpenter reports:
The patch c2ebf58ba089: "staging: et131x: Implement NAPI support"
from Aug 21, 2014, leads to the following static checker warning:
drivers/staging/et131x/et131x.c:4004 et131x_isr()
warn: we tested 'status' before and it was 'true'
We don't actually need the dead code, as we're now using NAPI to
handle enabling interrupts - but we do need to enable interrupts if
NAPI is not scheduled - so enable interrupts if this is the case.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>