* [PATCH 4.14] comedi: adv_pci1760: Fix PWM instruction handling
@ 2023-01-23 10:36 Ian Abbott
2023-01-25 16:51 ` Greg Kroah-Hartman
0 siblings, 1 reply; 2+ messages in thread
From: Ian Abbott @ 2023-01-23 10:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, Ian Abbott
commit 2efb6edd52dc50273f5e68ad863dd1b1fb2f2d1c upstream.
(Actually, this is fixing the "Read the Current Status" command sent to
the device's outgoing mailbox, but it is only currently used for the PWM
instructions.)
The PCI-1760 is operated mostly by sending commands to a set of Outgoing
Mailbox registers, waiting for the command to complete, and reading the
result from the Incoming Mailbox registers. One of these commands is
the "Read the Current Status" command. The number of this command is
0x07 (see the User's Manual for the PCI-1760 at
<https://advdownload.advantech.com/productfile/Downloadfile2/1-11P6653/PCI-1760.pdf>.
The `PCI1760_CMD_GET_STATUS` macro defined in the driver should expand
to this command number 0x07, but unfortunately it currently expands to
0x03. (Command number 0x03 is not defined in the User's Manual.)
Correct the definition of the `PCI1760_CMD_GET_STATUS` macro to fix it.
This is used by all the PWM subdevice related instructions handled by
`pci1760_pwm_insn_config()` which are probably all broken. The effect
of sending the undefined command number 0x03 is not known.
Fixes: 14b93bb6bbf0 ("staging: comedi: adv_pci_dio: separate out PCI-1760 support")
Cc: <stable@vger.kernel.org> # v4.5+
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20230103143754.17564-1-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
Should apply OK to v4.5 to v4.18 inclusive. [IA]
---
drivers/staging/comedi/drivers/adv_pci1760.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/comedi/drivers/adv_pci1760.c b/drivers/staging/comedi/drivers/adv_pci1760.c
index 9f525ff7290c..67b0cf0b9066 100644
--- a/drivers/staging/comedi/drivers/adv_pci1760.c
+++ b/drivers/staging/comedi/drivers/adv_pci1760.c
@@ -68,7 +68,7 @@
#define PCI1760_CMD_CLR_IMB2 0x00 /* Clears IMB2 */
#define PCI1760_CMD_SET_DO 0x01 /* Set output state */
#define PCI1760_CMD_GET_DO 0x02 /* Read output status */
-#define PCI1760_CMD_GET_STATUS 0x03 /* Read current status */
+#define PCI1760_CMD_GET_STATUS 0x07 /* Read current status */
#define PCI1760_CMD_GET_FW_VER 0x0e /* Read firware version */
#define PCI1760_CMD_GET_HW_VER 0x0f /* Read hardware version */
#define PCI1760_CMD_SET_PWM_HI(x) (0x10 + (x) * 2) /* Set "hi" period */
--
2.39.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 4.14] comedi: adv_pci1760: Fix PWM instruction handling
2023-01-23 10:36 [PATCH 4.14] comedi: adv_pci1760: Fix PWM instruction handling Ian Abbott
@ 2023-01-25 16:51 ` Greg Kroah-Hartman
0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2023-01-25 16:51 UTC (permalink / raw)
To: Ian Abbott; +Cc: stable
On Mon, Jan 23, 2023 at 10:36:41AM +0000, Ian Abbott wrote:
> commit 2efb6edd52dc50273f5e68ad863dd1b1fb2f2d1c upstream.
>
> (Actually, this is fixing the "Read the Current Status" command sent to
> the device's outgoing mailbox, but it is only currently used for the PWM
> instructions.)
>
> The PCI-1760 is operated mostly by sending commands to a set of Outgoing
> Mailbox registers, waiting for the command to complete, and reading the
> result from the Incoming Mailbox registers. One of these commands is
> the "Read the Current Status" command. The number of this command is
> 0x07 (see the User's Manual for the PCI-1760 at
> <https://advdownload.advantech.com/productfile/Downloadfile2/1-11P6653/PCI-1760.pdf>.
> The `PCI1760_CMD_GET_STATUS` macro defined in the driver should expand
> to this command number 0x07, but unfortunately it currently expands to
> 0x03. (Command number 0x03 is not defined in the User's Manual.)
> Correct the definition of the `PCI1760_CMD_GET_STATUS` macro to fix it.
>
> This is used by all the PWM subdevice related instructions handled by
> `pci1760_pwm_insn_config()` which are probably all broken. The effect
> of sending the undefined command number 0x03 is not known.
>
> Fixes: 14b93bb6bbf0 ("staging: comedi: adv_pci_dio: separate out PCI-1760 support")
> Cc: <stable@vger.kernel.org> # v4.5+
> Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
> Link: https://lore.kernel.org/r/20230103143754.17564-1-abbotti@mev.co.uk
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> Should apply OK to v4.5 to v4.18 inclusive. [IA]
Now queued up,t hanks.
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-25 16:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-23 10:36 [PATCH 4.14] comedi: adv_pci1760: Fix PWM instruction handling Ian Abbott
2023-01-25 16:51 ` Greg Kroah-Hartman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.