WSL2-Linux-Kernel/drivers/staging/comedi
Ian Abbott 15d5193104 staging: comedi: ni_mio_common: fix AO timer off-by-one regression
As reported by Éric Piel on the Comedi mailing list (see
<https://groups.google.com/forum/#!topic/comedi_list/ueZiR7vTLOU/discussion>),
the analog output asynchronous commands are running too fast with a
period 50 ns shorter than it should be.  This affects all boards with AO
command support that are supported by the "ni_pcimio", "ni_atmio", and
"ni_mio_cs" drivers.

This is a regression bug introduced by commit 080e6795cb ("staging:
comedi: ni_mio_common: Cleans up/clarifies ni_ao_cmd"), specifically,
this line in `ni_ao_cmd_set_update()`:

		/* following line: N-1 per STC */
		ni_stc_writel(dev, trigvar - 1, NISTC_AO_UI_LOADA_REG);

The `trigvar` variable value comes from a call to `ni_ns_to_timer()`
which converts a timer period in nanoseconds to a hardware divisor
value. The function already reduces the divisor by 1 as required by the
hardware, so the above line should not reduce it further by 1.  Fix it
by replacing `trigvar` by `trigvar - 1` in the above line, and remove
the misleading comment.

Reported-by: Éric Piel <piel@delmic.com>
Fixes: 080e6795cb ("staging: comedi: ni_mio_common: Cleans up/clarifies ni_ao_cmd")
Cc: Éric Piel <piel@delmic.com>
Cc: Spencer E. Olson <olsonse@umich.edu>
Cc: <stable@vger.kernel.org> # 4.7+
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-16 09:13:53 +02:00
..
drivers staging: comedi: ni_mio_common: fix AO timer off-by-one regression 2017-07-16 09:13:53 +02:00
kcomedilib Staging: comedi: kcomedilib: Add module_init/exit function 2016-12-06 10:08:01 +01:00
Kconfig staging: comedi: labpc: fix isadma dependency 2017-04-08 12:54:09 +02:00
Makefile
TODO comedi: note a coverity discovered hole that needs fixing 2016-03-05 14:56:55 -08:00
comedi.h staging: comedi: make constants slightly more consistent 2016-10-16 10:26:16 +02:00
comedi_buf.c staging: comedi: support vm_access_process for mmap'd buffer 2017-04-25 20:43:42 +02:00
comedi_compat32.c staging: comedi: fix cast warning in comedi_compat32.c 2015-07-14 18:21:15 -07:00
comedi_compat32.h staging: comedi: comedi_compat32.h: add identifiers to function parameters 2017-01-03 15:27:55 +01:00
comedi_fops.c staging: comedi: use centralized error clean-up in comedi_init() 2017-06-24 00:37:07 +08:00
comedi_internal.h staging: comedi: support vm_access_process for mmap'd buffer 2017-04-25 20:43:42 +02:00
comedi_pci.c staging: comedi: comedi_pci.c: Fix kernel-doc Return tags 2015-10-02 11:43:21 +02:00
comedi_pci.h drivers: staging: comedi: fix function prototypes 2017-01-03 15:27:12 +01:00
comedi_pcmcia.c staging: comedi: comedi_pcmcia.[ch]: add identifiers to function parameters 2017-01-03 15:27:55 +01:00
comedi_pcmcia.h staging: comedi: comedi_pcmcia.[ch]: add identifiers to function parameters 2017-01-03 15:27:55 +01:00
comedi_usb.c staging: comedi: comedi_usb.c: improve function documentation 2015-10-02 11:43:21 +02:00
comedi_usb.h staging: comedi: comedi_usb.h: add identifiers to function parameters 2017-01-03 15:27:55 +01:00
comedidev.h Staging: comedi: comedidev.h: Drop old style zero-length array 2017-01-03 15:29:06 +01:00
comedilib.h staging: comedi: comedilib.h: Coding style warning fix for block comments 2015-12-21 16:01:12 -08:00
drivers.c Staging: comedi: Align the * in block comments 2016-10-02 17:29:11 +02:00
proc.c Staging: comedi: proc: Warn if unable to create proc entry 2017-01-03 15:30:21 +01:00
range.c staging: comedi: improve comedi_check_chanlist() documentation 2015-08-05 11:55:44 -07:00