Commit Graph

5028 Commits

Author SHA1 Message Date
Himangi Saraogi
cb90e78dcc staging:comedi: Fix sparse warnings of incorrect type in assignment
This patch fixes the following sparse warnings:
drivers/staging/comedi/drivers/mite.c:343:44: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/mite.c:343:44:    expected unsigned int [unsigned] [usertype] count
drivers/staging/comedi/drivers/mite.c:343:44:    got restricted __le32 [usertype] <noident>
drivers/staging/comedi/drivers/mite.c:344:43: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/mite.c:344:43:    expected unsigned int [unsigned] [usertype] addr
drivers/staging/comedi/drivers/mite.c:344:43:    got restricted __le32 [usertype] <noident>
drivers/staging/comedi/drivers/mite.c:346:43: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/mite.c:346:43:    expected unsigned int [unsigned] [usertype] next
drivers/staging/comedi/drivers/mite.c:346:43:    got restricted __le32 [usertype] <noident>
drivers/staging/comedi/drivers/mite.c:351:45: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/mite.c:351:45:    expected unsigned int [unsigned] [usertype] next
drivers/staging/comedi/drivers/mite.c:351:45:    got restricted __le32 [usertype] <noident>

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
2014-03-13 17:36:55 -07:00
Himangi Saraogi
5c7895c05f staging:comedi: Fix sparse warnings
This patch fixes the following sparse warnings:

drivers/staging/comedi/drivers/gsc_hpdi.c:367:53: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/gsc_hpdi.c:367:53:    expected unsigned int volatile [unsigned] [usertype] pci_start_addr
drivers/staging/comedi/drivers/gsc_hpdi.c:367:53:    got restricted __le32 [usertype] <noident>
drivers/staging/comedi/drivers/gsc_hpdi.c:370:55: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/gsc_hpdi.c:370:55:    expected unsigned int volatile [unsigned] [usertype] local_start_addr
drivers/staging/comedi/drivers/gsc_hpdi.c:370:55:    got restricted __le32 [usertype] <noident>
drivers/staging/comedi/drivers/gsc_hpdi.c:371:52: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/gsc_hpdi.c:371:52:    expected unsigned int volatile [unsigned] [usertype] transfer_size
drivers/staging/comedi/drivers/gsc_hpdi.c:371:52:    got restricted __le32 [usertype] <noident>
drivers/staging/comedi/drivers/gsc_hpdi.c:373:43: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/gsc_hpdi.c:373:43:    expected unsigned int volatile [unsigned] [usertype] next
drivers/staging/comedi/drivers/gsc_hpdi.c:373:43:    got restricted __le32 [usertype] <noident>
drivers/staging/comedi/drivers/gsc_hpdi.c:390:39: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/gsc_hpdi.c:390:39:    expected unsigned int volatile [unsigned] [usertype] next
drivers/staging/comedi/drivers/gsc_hpdi.c:390:39:    got restricted __le32 [usertype] <noident>
drivers/staging/comedi/drivers/gsc_hpdi.c:704:15: warning: cast to restricted __le32
drivers/staging/comedi/drivers/gsc_hpdi.c:707:15: warning: cast to restricted __le32
drivers/staging/comedi/drivers/cb_pcidas64.c:1495:56: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/cb_pcidas64.c:1495:56:    expected unsigned int volatile [unsigned] [usertype] pci_start_addr
drivers/staging/comedi/drivers/cb_pcidas64.c:1495:56:    got restricted __le32 [usertype] <noident>
drivers/staging/comedi/drivers/cb_pcidas64.c:1498:66: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/cb_pcidas64.c:1498:66:    expected unsigned int volatile [unsigned] [usertype] local_start_addr
drivers/staging/comedi/drivers/cb_pcidas64.c:1498:66:    got restricted __le32 [usertype] <noident>
drivers/staging/comedi/drivers/cb_pcidas64.c:1502:66: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/cb_pcidas64.c:1502:66:    expected unsigned int volatile [unsigned] [usertype] local_start_addr
drivers/staging/comedi/drivers/cb_pcidas64.c:1502:66:    got restricted __le32 [usertype] <noident>
drivers/staging/comedi/drivers/cb_pcidas64.c:1505:55: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/cb_pcidas64.c:1505:55:    expected unsigned int volatile [unsigned] [usertype] transfer_size
drivers/staging/comedi/drivers/cb_pcidas64.c:1505:55:    got restricted __le32 [usertype] <noident>
drivers/staging/comedi/drivers/cb_pcidas64.c:1506:46: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/cb_pcidas64.c:1506:46:    expected unsigned int volatile [unsigned] [usertype] next
drivers/staging/comedi/drivers/cb_pcidas64.c:1506:46:    got restricted __le32 [usertype] <noident>
drivers/staging/comedi/drivers/cb_pcidas64.c:1515:64: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/cb_pcidas64.c:1515:64:    expected unsigned int volatile [unsigned] [usertype] pci_start_addr
drivers/staging/comedi/drivers/cb_pcidas64.c:1515:64:    got restricted __le32 [usertype] <noident>
drivers/staging/comedi/drivers/cb_pcidas64.c:1517:66: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/cb_pcidas64.c:1517:66:    expected unsigned int volatile [unsigned] [usertype] local_start_addr
drivers/staging/comedi/drivers/cb_pcidas64.c:1517:66:    got restricted __le32 [usertype] <noident>
drivers/staging/comedi/drivers/cb_pcidas64.c:1520:63: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/cb_pcidas64.c:1520:63:    expected unsigned int volatile [unsigned] [usertype] transfer_size
drivers/staging/comedi/drivers/cb_pcidas64.c:1520:63:    got restricted __le32 [usertype] <noident>
drivers/staging/comedi/drivers/cb_pcidas64.c:1521:54: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/cb_pcidas64.c:1521:54:    expected unsigned int volatile [unsigned] [usertype] next
drivers/staging/comedi/drivers/cb_pcidas64.c:1521:54:    got restricted __le32 [usertype] <noident>
drivers/staging/comedi/drivers/cb_pcidas64.c:2540:63: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/cb_pcidas64.c:2540:63:    expected unsigned int volatile [unsigned] [usertype] transfer_size
drivers/staging/comedi/drivers/cb_pcidas64.c:2540:63:    got restricted __le32 [usertype] <noident>
drivers/staging/comedi/drivers/cb_pcidas64.c:2890:58: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/cb_pcidas64.c:2890:58:    expected unsigned int volatile [unsigned] [usertype] transfer_size
drivers/staging/comedi/drivers/cb_pcidas64.c:2890:58:    got restricted __le32 [usertype] <noident>
drivers/staging/comedi/drivers/cb_pcidas64.c:2893:21: warning: cast to restricted __le32
drivers/staging/comedi/drivers/cb_pcidas64.c:2895:49: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/cb_pcidas64.c:2895:49:    expected unsigned int volatile [unsigned] [usertype] next
drivers/staging/comedi/drivers/cb_pcidas64.c:2895:49:    got restricted __le32 [usertype] <noident>
drivers/staging/comedi/drivers/cb_pcidas64.c:2898:21: warning: cast to restricted __le32
drivers/staging/comedi/drivers/cb_pcidas64.c:2900:54: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers/cb_pcidas64.c:2900:54:    expected unsigned int volatile [unsigned] [usertype] next
drivers/staging/comedi/drivers/cb_pcidas64.c:2900:54:    got restricted __le32 [usertype] <noident>

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
2014-03-10 23:39:40 -07:00
Nick Davies
3cf477b56c Staging: comedi: ni_tio Fixed whitespace coding style warnings
Fixed coding style warnings in ni_tio.h which had an extra space
after the function pointer name.

Signed-off-by: Nick Davies <git@nicolasdavies.com.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-08 21:13:31 -08:00
Conrad Meyer
d2ff1d2067 Staging: comedi: do not initialize statics to 0 (apci1500)
Minor style cleanup per checkpatch.pl.

Signed-off-by: Conrad Meyer <cse.cem@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-08 19:02:12 -08:00
Conrad Meyer
c9847a6eeb Staging: comedi: Kill comment art in hwdrv_apci1500.c
Nudge the commenting in this mess a little further from 'bad.' Much of
it was incorrectly indented.

Another sed cleanup:
  $ sed -i -e '/\/\*\*\*\*\*\*\*\*\**\//,1d' addi-data/hwdrv_apci1500.c

Signed-off-by: Conrad Meyer <cse.cem@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-08 19:02:12 -08:00
Conrad Meyer
d0ba1e38e0 Staging: comedi: Fix some raw printks with dev_warn()
Brought to you with the help of sed and manual clean-up after.

  $ sed -i -e 's|printk("\\n|dev_warn(dev->hw_dev,\n\t"|' \
    addi-data/hwdrv_apci1500.c

Since all of these printk()s were for invalid API inputs and most of
them returned -EINVAL, I fixed the rest of them to return -EINVAL as
well.

Signed-off-by: Conrad Meyer <cse.cem@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-08 19:02:12 -08:00
Fred Akers
56b1fcfdeb Staging: comedi: range: remove unnecessary sanity check
This check is unnecessary because range_table will always be
initialized to range_unknown by comedi_device_postconfig() for
drivers that do not initialize range_table or range_table_list

Signed-off-by: Fred Akers <knivey@botops.net>
Reviewed-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-03-08 18:59:48 -08:00
Fred Akers
afdc37ee79 Staging: comedi: range: tidy up comedi_check_chanlist()
Refactor this function to remove an extra indent level

Signed-off-by: Fred Akers <knivey@botops.net>
Reviewed-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-03-08 18:59:48 -08:00
Conrad Meyer
f3c25d5690 Staging: comedi: Fix 80-char line limit style issue in addi_apci_1500.c
Rename some very long functions in addi-data/hwdrv_apci1500.c.

Signed-off-by: Conrad Meyer <cse.cem@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-08 17:33:07 -08:00
Chase Southwood
11899188be Staging: comedi: addi-data: tidy up counter register map defines in hwdrv_apci1564.c
This patch fixes the register map defines for the counter registers such
that they are all the real offsets to each register, rather than a mix of
real offsets and adders to those offsets.

Signed-off-by: Chase Southwood <chase.southwood@yahoo.com>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-08 17:31:50 -08:00
Chase Southwood
b9d5c8cfdf Staging: comedi: addi-data: tidy up timer register map defines in hwdrv_apci1564.c
This patch for fixes the register map defines for the timer registers such
that they are all the real offsets to each register, rather than a mix of
real offsets and adders to those offsets.

Signed-off-by: Chase Southwood <chase.southwood@yahoo.com>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-08 17:30:07 -08:00
Chase Southwood
cef51fd887 Staging: comedi: addi-data: tidy up watchdog register
This patch for fixes the register map defines for the watchdog registers
such that they are all the real offsets to each register, rather than a
mix of real offsets and adders to those offsets.

Signed-off-by: Chase Southwood <chase.southwood@yahoo.com>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-08 17:29:35 -08:00
Chase Southwood
48cf60d164 Staging: comedi: addi-data: tidy up digital output register map defines in hwdrv_apci1564.c
This patch fixes the register map defines for the digital output registers
such that they are all the real offsets to each register, rather than a
mix of real offsets and adders to those offsets.

Further, some of the old defines were being used incorrectly in the
i_APCI1564_Reset() function.  Upon swapping the old defines out for the
new ones in this function, their use has been corrected.

Signed-off-by: Chase Southwood <chase.southwood@yahoo.com>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-08 17:28:53 -08:00
Chase Southwood
7df867327d Staging: comedi: addi-data: tidy up digital input register map defines in hwdrv_apci1564.c
This patch fixes the register map defines for the digital input registers
such that they are all the real offsets to each register, rather than a
mix of real offsets and adders to those offsets.

Further, some of the old defines were being used incorrectly in the
i_APCI1564_Reset() function.  Upon swapping the old defines out for the
new ones in this function, their use has been corrected.

Signed-off-by: Chase Southwood <chase.southwood@yahoo.com>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-08 17:28:53 -08:00
John de la Garza
d2b7f4c429 comedi:drivers:poc.c: unnecessary space before function pointer arguments
Removed unnecessary space before function pointer arguments.

Signed-off-by: John de la Garza <john@jjdev.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-06 17:31:44 -08:00
H Hartley Sweeten
bc7d7fc0e3 staging: comedi: pcl818: clarify pcl818_reset()
Like done in the pcl812 driver, use the boardinfo to determine what
should be reset.

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-03-06 17:06:19 -08:00
H Hartley Sweeten
708df4c449 staging: comedi: pcl812: clarify pcl812_reset()
Instead of using the 'board_type' and the switch, use the boardinfo
to determine what should be reset.

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-03-06 17:06:19 -08:00
H Hartley Sweeten
1be6b015e7 staging: comedi: pcl818: tidy up the remaining register defines
For aesthetics, rename the timer/counter enable request register
and define its 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>
2014-03-06 17:06:19 -08:00
H Hartley Sweeten
e8e7709f33 staging: comedi: pcl816: tidy up the remaining register defines
For aesthetics, rename the clear INT request 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>
2014-03-06 17:06:18 -08:00
H Hartley Sweeten
10a2c50278 staging: comedi: pcl812: tidy up the remaining register defines
The PCL812_CNTENABLE define is not used in this driver. Remove it.

For aesthetics, rename the software trigger 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>
2014-03-06 17:06:18 -08:00
H Hartley Sweeten
d5f874367a staging: comedi: pcl818: cleanup ai_cmd()
Rename this function so it has namespace associated with the driver.

The cmd->scan_begin_src is always TRIG_FOLLOW and the only valid
cmd->convert_src is TRIG_TIMER or TRIG_EXT so pcl818_ai_cmd_mode()
is always called with a 'mode' of 1 or 3. The 'mode' actually indicates
the trigger source.

Absorb pcl818_ai_cmd_mode() into this function and simplify the code.

This also removes the need for a forward declaration.

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-03-06 17:06:18 -08:00
H Hartley Sweeten
b8d17c4a5f staging: comedi: pcl818: absorb pcl818_ai_mode13dma_int()
Absorb this function into pcl818_ai_cmd_mode() and 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>
2014-03-06 17:06:18 -08:00
H Hartley Sweeten
5af366ffad staging: comedi: pcl818: define the mode register bits
Define the bits in the register to remove the magic values.

Tidy up pcl818_ai_cancel(). The 0x73 mask of the value read from
the control register will disable dma and interrupts but it does
not change the trigger mode. So the software trigger following it
might not work.

Just disable the trigger and clear any pending 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>
2014-03-06 17:06:18 -08:00
H Hartley Sweeten
6cf215d730 staging: comedi: pcl816: define the mode register bits
Define the bits in the register to remove the magic values.

Fix pcl816_ai_cancel(). The 0x73 mask of the value read from the control
register will not stop the A/D as indicated by the comment. This would just
clear the DS1, POE, and EXT bits which would only disable the external
trigger. Setting the control register to '0' would then stop the A/D which
means the software trigger following it would not work. Just disable the
trigger and clear any pending end-of-conversion.

Make sure the A/D trigger is disabled at the end of the (*insn_read).

Remove a couple unnecessary devpriv->dev checks. The pcl816_ai_cmd() and
pcl816_ai_poll() functions are only hooked up when devpriv->dma is valid.

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-03-06 17:06:18 -08:00
H Hartley Sweeten
89513858ae staging: comedi: pcl812: define the mode register bits
For aesthetics, rename this register.

Define the bits in the register to remove the magic values.

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-03-06 17:06:18 -08:00
H Hartley Sweeten
933ccd824d staging: comedi: pcl818: cleanup setup_channel_list()
Move this function to remove the need for the forward declaration. Rename it
so it has namespace associated with the driver. Remove the unnecessary
comedi_subdevice parameter from the function.

The hardware has per-channel programmable gain. This function first sets the
range for each channel then sets the mux register to automatically scan the
channels.

The use of 'muxonechan' when programming the ranges is incorrect. Only the low
4-bits are supposed to be set when programming the ranges.

Introduce a couple helper functions to set the range for a channel and to set
the first/last channels to scan.

Tidy up the range and mux register 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>
2014-03-06 17:06:18 -08:00
H Hartley Sweeten
19720c07f1 staging: comedi: pcl816: cleanup setup_channel_list()
Move this function to remove the need for the forward declaration. Rename it
so it has namespace associated with the driver. Remove the unnecessary
comedi_subdevice parameter from the function.

The hardware has per-channel programmable gain. This function first sets the
range for each channel then sets the mux register to automatically scan the
channels.

Remove the need for the 'ai_act_chanlist' member in the private data. It is
only used to set the first/last channel to scan.

Introduce a couple helper functions to set the range for a channel and to set
the first/last channels to scan.

Tidy up the range and mux register 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>
2014-03-06 17:06:18 -08:00
H Hartley Sweeten
4384aaadc2 staging: comedi: pcl812: cleanup setup_range_channel()
Move this function to remove the need for the forward declaration. Rename it
so it has namespace associated with the driver. Remove the unnecessary
comedi_subdevice parameter from the function.

The hardware does not support analog input channel scanning so the mux and
range need to be set before each (*insn_read) and when advancing to the next
channel in an async command. Instead of storing the last chan/range in the
private data just store the chanspec to determine if the mux and range need
to be changed.

Refactor pcl812_reset() a bit so we can use the helper function to set the
mux and range.

Define the bits in the mux register to remove the magic values.

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-03-06 17:06:18 -08:00
H Hartley Sweeten
598e61e6dd staging: comedi: pcl812: define the status register bits
Define the bits in the status register.

Writing any value to the status register clears any pending interrupt.
For aesthetics, rename the status register and remove the "clrint"
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>
2014-03-06 17:06:17 -08:00
H Hartley Sweeten
f72196eca4 staging: comedi: pcl816: define the status register bits
Define the bits in the status 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>
2014-03-06 17:06:17 -08:00
H Hartley Sweeten
8d0b5e15df staging: comedi: pcl818: define the status register bits
Define the bits in the status register and remove the magic values.

Writing any value to the status register clears any pending interrupt.
For aesthetics, rename the status register and remove the "clrint"
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>
2014-03-06 17:06:17 -08:00
H Hartley Sweeten
906a183ff0 staging: comedi: pcl818: tidy up analog input registers
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>
2014-03-06 17:06:17 -08:00
H Hartley Sweeten
c99e0e196c staging: comedi: pcl816: tidy up analog input registers
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>
2014-03-06 17:06:17 -08:00
H Hartley Sweeten
9ab7fbd861 staging: comedi: pcl812: tidy up analog input registers
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>
2014-03-06 17:06:16 -08:00
H Hartley Sweeten
1e66bb255e staging: comedi: pcl812: introduce pcl812_ai_soft_trig()
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>
2014-03-06 17:06:16 -08:00
H Hartley Sweeten
939d33d688 staging: comedi: pcl816: introduce pcl816_ai_soft_trig()
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>
2014-03-06 17:06:16 -08:00
H Hartley Sweeten
9fdef9c84a staging: comedi: pcl818: introduce pcl818_ai_soft_trig()
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>
2014-03-06 17:06:16 -08:00
H Hartley Sweeten
9fd3effaa7 staging: comedi: pcl818: introduce pcl818_ai_clear_eoc()
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>
2014-03-06 17:06:16 -08:00
H Hartley Sweeten
97880eaf9b staging: comedi: pcl816: introduce pcl816_ai_clear_eoc()
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>
2014-03-06 17:06:16 -08:00
H Hartley Sweeten
079dc9fe77 staging: comedi: pcl812: introduce pcl812_ai_clear_eoc()
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>
2014-03-06 17:06:16 -08:00
H Hartley Sweeten
30bcb039d5 staging: comedi: pcl812: tidy up the analog input (*insn_read)
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>
2014-03-06 17:06:16 -08:00
H Hartley Sweeten
937a370688 staging: comedi: pcl816: tidy up the analog input (*insn_read)
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>
2014-03-06 17:06:15 -08:00
H Hartley Sweeten
8916f5bcdf staging: comedi: pcl818: tidy up the analog input (*insn_read)
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>
2014-03-06 17:06:15 -08:00
H Hartley Sweeten
9350557325 staging: comedi: pcl818: tidy up the analog output subdevice
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>
2014-03-06 17:06:15 -08:00
H Hartley Sweeten
ab8769af9f staging: comedi: pcl812: tidy up the analog output subdevice
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>
2014-03-06 17:06:15 -08:00
H Hartley Sweeten
dc91741921 staging: comedi: pcl816: move pcl816_reset()
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>
2014-03-06 17:06:15 -08:00
H Hartley Sweeten
4ab490b372 staging: comedi: pcl818: tidy up the digital subdevices
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>
2014-03-06 17:06:15 -08:00
H Hartley Sweeten
c1cd5623b1 staging: comedi: pcl816: add support for digital subdevices
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>
2014-03-06 17:06:15 -08:00
H Hartley Sweeten
d4507f915b staging: comedi: pcl812: tidy up the digital subdevices
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>
2014-03-06 17:06:15 -08:00
H Hartley Sweeten
e09469409c staging: comedi: pcl818: consolidate the common interrupt code
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>
2014-03-06 17:06:14 -08:00