staging: comedi: addi_apci_3120: tidy up analog input subdevice init
For aesthetics, add some white space to the analog input subdevice
initialization.
The async command support in this driver is pretty messed up. I'm not
really sure if it actually works yet. Luckly this driver was not
setting the SDF_CMD_READ subdev_flag so the command support was not
actually getting enabled.
The command support only works if an interrupt is available. Refactor
the subdevice init so that the command support is only hooked up if
we have an interrupt. For now always disable the command support. Once
the driver has been cleaned up the command will be enabled.
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 comedi core expects (*insn_write) functions to write insn->n values and
return the number of values written or an errno. This function currently
returns insn->n but it only writes a single data value.
Fix the function to work like the core expects.
There are two registers used to update the analog outputs. Offset 0x08 is
used to update channels 0-3 and offset 0x0a to update channels 4-7. Bits
14 and 15 in each register set the mux to select which channel to update.
The lower 14 bits are the value used to set the DAC.
For aesthetics, tidy up the defines used for the register offsets and bits
in the 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>
staging: comedi: addi_apci_3120: remove analog output reset
The apci3120_reset() function is called at the end of the (*auto_attach) and
with the (*detach) is called to unload the driver. Part of this function
resets all the analog output channels to 0V.
There are two problems with this.
1) Only the APCI-3120 has analog outputs, the APCI-3001 does not.
2) The DA_READY bit in the status register needs to be checked before each
write to update the analog outputs. It's unknown what the DA_READY bit
does on the APCI-3001 board.
Just remove the analog output reset to avoid any problems.
Also, remove the unnecessary udelay() in apci3120_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>
staging: comedi: addi_apci_3120: remove private data 'iobase'
This member of the private data holds the start address of PCI BAR 1 that is
used to access the board registers. The start address is also stored in the
comedi_device 'iobase' member. Use that instead and remove the private data
member.
Remove some unnecessary casts when reading the board 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>
staging: comedi: addi_apci_3120: use correct iobase to read board register
The board registers are accessed using the bse address devpriv->iobase not
devpriv->i_IobaseAmcc. Fix a read in apci3120_interrupt() that is using the
wrong base address.
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: addi_apci_3120: use correct iobase to write AMCC registers
The AMCC registers are accessed using the base address devpriv->i_IobaseAmcc
not devpriv->i_IobaseAddon. Fix a couple writes in apci3120_interrupt_dma()
that are using the wrong base address.
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: addi_apci_3120: remove unipolar range from analog outputs
The analog outputs of the APCI-3120 have a 14-bit bipolar range and use straight
binary values (0x0000 = -10V to 0x3fff = +10V) to set the outputs. This driver
tries to fake a unipolar range by munging the comedi data values to only output
0V to +10V signals (0x0000 to 0x1fff values are munged to 0x2000 - 0x3fff).
This causes problems with the comedilib API functions that convert between comedi
values and physical values. It's also possible for the user to pass a data value
that would get munged and actually change the wrong channel.
Fix this by change the subdevice range_table to range_bipolar10 and remove the
munging in apci3120_ao_insn_write().
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>
According to ADDI-DATA, this board was discontinued last year and they
feel that no further development is needed for this driver. Remove the
driver from comedi to help with the addi-data cleanup.
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>
Factor the urb handling and resubmit out of the analog input urb
completion handler and tidy it up. This allows a common exit path
to be used in the completion handler to stop the async command and
handle the events.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: Bernd Porr <mail@berndporr.me.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Factor the urb handling and resubmit out of the analog output urb
completion handler and tidy it up. This allows a common exit path
to be used in the completion handler to stop the async command and
handle the events.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: Bernd Porr <mail@berndporr.me.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Factor the urb handling and resubmit out of the completion handler and
tidy it up. This allows a common exit path to be used in the completion
handler to stop the async command and handle the events.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: Bernd Porr <mail@berndporr.me.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Factor the urb handling and resubmit out of the analog input urb
completion handler and tidy it up. This allows a common exit path
to be used in the completion handler to stop the async command and
handle the events.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: Bernd Porr <mail@berndporr.me.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Factor the urb handling and resubmit out of the analog output urb
completion handler and tidy it up. This allows a common exit path
to be used in the completion handler to stop the async command and
handle the events.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: Bernd Porr <mail@berndporr.me.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: addi_apci_3120: simplify analog input boardinfo
There are two boards supported by this driver. One with 16-bit analog
inputs and the other 12-bit analog inputs.
Add a bit field flag, 'ai_is_16bit', to the boardinfo and remove the
'i_AiMaxdata' member. Use the new flag to initialize tne analog input
subdevice maxdata correctly.
For aesthetics, adjust the whitespace in the boardinfo 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>
staging: comedi: addi_apci_3120: simplify analog output boardinfo
There are two boards supported by this driver. One with eight 14-bit analog
outputs and the other without analog outputs.
Add a bit field flag, 'has_ao', to the boardinfo and remove the 'i_NbrAoChannel'
and 'i_AoMaxdata' members. Use the new flag to determine if the analog output
subdevice needs to be initialized and open code the n_chan and maxdata.
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>
All boardinfo entries have this member set as '16'. This is also the Analog
Input 'n_chan'. For aesthetics, initialize the Analog Input 'len_chanlist'
with s->n_chan and remove the boardinfo 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>
All boardinfo entries have this member set as '16'. This will initialize
the Analog Input 'n_chan' and cause the 'i_NbrAiChannelDiff' member to
never get used. Remove both members and initialize the Analog Input 'n_chan'
with 16 directly.
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_apci3120: remove need for boardinfo access
The apci3120_ai_insn_config() function is broken in this driver. It does
not follow the comedi API and will fail to work correctly.
For now just remove the need for the boardinfo access to allow additional
cleanup. The 'i_NbrAiChannel' is actually the subdevice 'n_chan' use that
instead and remove the boardinfo access.
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 hardware has an eeprom but the boardinfo properly defines the subdevice
support so reading the eeprom and setting the 's_EeParameters' use is not
necessary. Since the boardinfo only has one entry its not really necessary.
Also, providing a subdevice the read the eeprom is not really interesting.
Remove the eeprom support code along with the boardinfo and initialize the
subdevices directly.
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 comedi_device 'board_name' is set to this member during the (*auto_attach)
of the addi-data that still use this boardinfo drivers. For aesthetics, use
the dev->board_name instead of the boardinfo in the drivers.
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 subdevices that don't initialize any of the callbacks don't really
exist. Remove the unnecessary initialzation and just set the type to
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>
The subdevices that don't initialize any of the callbacks don't really
exist. Remove the unnecessary initialzation and just set the type to
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>
staging: comedi: addi_apci_1500: remove subdevice callbacks from boardinfo
This driver only has one boardinfo entry so the subdevice callbacks are
always the same. Remvoe the callbacks from the boardinfo and use them
directly when initializing the subdevices.
Remove all the subdevice callback initialization that would be set to
NULL.
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: addi_apci_035: remove subdevice callbacks from boardinfo
This driver only has one boardinfo entry so the subdevice callbacks are
always the same. Remvoe the callbacks from the boardinfo and use them
directly when initializing the subdevices.
Remove all the subdevice callback initialization that would be set to
NULL.
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: addi_common.c: remove included source file
The addi_apci_035 and addi_apci_1500 are the only drivers left that
include this source file. Copy the i_ADDIDATA_InsnReadEeprom() function
from that file to those drivers and remove the addi_common.c file.
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 addi_apci_035 and addi_apci_1500 are the only drivers left that use
this function in addi_common.c. The function simply calls the 'interrupt'
function that is in the boardinfo of the driver. Both drivers use the
same 'interrupt' function for all boardnfo entries.
Remove the i_ADDI_Reset() function as well as the 'interrupt' boardinfo
and use the 'interrupt' function directly when doing the request_irq().
In addition, the addi_apci_3120 driver has a private v_ADDI_Interrupt()
function that is doing the same thing. Remove that one as well.
Fix the return type of 'interrupt' functions in the drivers and add the
return vaules.
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 addi_apci_035 and addi_apci_1500 are the only drivers left that use
this function in addi_common.c. The addi_common code adds a lot of bloat
to the drivers.
Copy the addi_auto_attach() code to the (*auto_attach) functions of the
drivers and remove the function. This will help with removing the bloat.
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 addi_apci_035 and addi_apci_1500 are the only drivers left that use
this function in addi_common.c. The function simply calls the 'reset'
function that is in the boardinfo of the driver. Both drivers use the
same 'reset' function for all boardnfo entries.
Remove the i_ADDI_Reset() function as well as the 'reset' boardinfo and
just call the 'reset' function directly.
The i_ADDI_Reset() is called by addi_auto_attach() in addi_common.c after
a sucessful attach. Modify the (*auto_attach) in the drivers to call the
'reset' function directly and remove it from addi_auto_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>
The addi_apci_035 and addi_apci_1500 are the only drivers left that use
this function in addi_common.c. Remove the function an add a private
comedi_driver (*detach) function to those drivers.
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: comedidev.h: don't expose COMEDI_CB_* defines to userspace
The COMEDI_CB_* defines are the comedi_async "events" that the drivers set
to let the core detect the state of running async commands. These "events"
are only relevant to the kernel modules and should not be exposed to
userspace in the comedi.h user API header.
Move the defines to comedidev.h to avoid exposing them. For aesthetics,
convert the defines to bit shifts to better indicate that they are bitmask
values. Cleanup the documentation.
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>
Ian Abbott [Mon, 13 Oct 2014 12:41:22 +0000 (13:41 +0100)]
staging: comedi: cb_pcimdas: add support for PCIe-DAS1602/16
The Measurement Computing PCIe-DAS1602/16 is a PCI-Express version of
the PCIM-DAS1602/16, but has a different PCI device ID. Add support
for this device and update the driver description, Kconfig description
and MODULE_DESCRIPTION.
Thanks to Christoph Langbein for supplying the PCI device ID.
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>
The Comedi driver comment mentions a couple of manual configuration
options, but manual configuration via the COMEDI_DEVCONFIG ioctl and
comedi "attach" handler is no longer supported by this driver. Update
the comment appropriately.
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>
Aya Mahfouz [Sun, 26 Oct 2014 17:46:00 +0000 (19:46 +0200)]
staging: media: lirc: lirc_sir.c: use pr_debug and dev_dbg instead of dprintk
This patch removes the custom printk macro dprintk and replaces most of
the calls made to it by dev_dbg. pr_debug was used when the calling
function did not provide the appropiate device variable.
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Aya Mahfouz [Sun, 26 Oct 2014 17:59:43 +0000 (19:59 +0200)]
staging: media: lirc: lirc_zilog.c: replace custom print macros with dev_* and pr_*
This patch removes the custom printk macros dprintk, zilog_notify,
zilog_error, and zilog_info. All the calls to these macros were
replaced by dev_dbg, dev_notice, dev_err, and dev_info respectively
whenever possible. There were cases in which pr_debug, pr_notice,
pr_err and pr_info were used. It was when the calling function did
not provide an appropiate dev variable.
Applying this patch will trigger the out of memory checkpatch warning
for two lines. It will be fixed in a separate patch.
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Melike Yurtoglu [Sun, 26 Oct 2014 21:55:22 +0000 (23:55 +0200)]
staging: ozwpan: Fix incorrect type in assignments
This patch fixes following sparse warnings:
drivers/staging/ozwpan/ozhcd.c:1917:35: warning: incorrect type in
assignment (different base types)
drivers/staging/ozwpan/ozhcd.c:1917:35: expected restricted __le16
[usertype] wHubCharacteristics
drivers/staging/ozwpan/ozhcd.c:1917:35: got unsigned short [unsigned]
[usertype] <noident>
Tapasweni Pathak [Sun, 26 Oct 2014 13:50:16 +0000 (19:20 +0530)]
staging: android: Replace timeval with timespec64
'timeval' is used to print timestamps in seconds and millisecond.
32-bit systems using 'struct timeval' will break in the year 2038,
So we have to replace that code with more appropriate types.
This patch changes the android driver to use timespec64.
Since this is a staging driver and the output is only used for a
debugfs file, it is fine to slightly change the output and
use nanoseconds instead. ktime_to_timespec64, is used which will return
seconds and nanoseconds.
Aya Mahfouz [Sat, 25 Oct 2014 21:40:15 +0000 (23:40 +0200)]
staging: dgnc: dgnc_driver: remove all occurences of trcbuf_size
This patch removes the variable trcbuf_size given there is no real
use for it anymore. All of the debug variables in this driver is
basically dead code.
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>