Commit 832f3336 authored by Spencer E. Olson's avatar Spencer E. Olson Committed by Greg Kroah-Hartman

staging: comedi: add facility to directly query subdevice timing constraints

Adds facility to directly query the hardware speed limits of subdevices,
in particular for scan_begin and convert signals.  This information can be
critical for integrating comedi with other hardware modules, and also
comedi modules together with software where software requires specific
timing capabilities in order to properly coordinate multiple devices.

Currently, comedi_command_test almost satisfies this need, but really only
for when *_src == TRIG_TIMER.  For *_src == TRIG_EXT, comedi_command_test
does not help at all.  For many subdevices, one might simply use
*_src==TRIG_TIMER in command_test in order to determine these limits.  For
other subdevices, this tactic does not work since *_src == TRIG_TIMER might
not be valid.  There is also the possibility that the timing limits are
different between the TRIG_TIMER and TRIG_EXT modes.
Signed-off-by: default avatarSpencer E. Olson <olsonse@umich.edu>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 20438d93
......@@ -301,6 +301,8 @@ enum comedi_io_direction {
* @INSN_CONFIG_PWM_SET_H_BRIDGE: Set PWM H bridge duty cycle and polarity for
* a relay simultaneously.
* @INSN_CONFIG_PWM_GET_H_BRIDGE: Get PWM H bridge duty cycle and polarity.
* @INSN_CONFIG_GET_CMD_TIMING_CONSTRAINTS: Get the hardware timing restraints,
* regardless of trigger sources.
*/
enum configuration_ids {
INSN_CONFIG_DIO_INPUT = COMEDI_INPUT,
......@@ -344,7 +346,8 @@ enum configuration_ids {
INSN_CONFIG_PWM_GET_PERIOD = 5001,
INSN_CONFIG_GET_PWM_STATUS = 5002,
INSN_CONFIG_PWM_SET_H_BRIDGE = 5003,
INSN_CONFIG_PWM_GET_H_BRIDGE = 5004
INSN_CONFIG_PWM_GET_H_BRIDGE = 5004,
INSN_CONFIG_GET_CMD_TIMING_CONSTRAINTS = 5005,
};
/**
......
......@@ -1216,6 +1216,10 @@ static int check_insn_config_length(struct comedi_insn *insn,
if (insn->n == 6)
return 0;
break;
case INSN_CONFIG_GET_CMD_TIMING_CONSTRAINTS:
if (insn->n >= 4)
return 0;
break;
/*
* by default we allow the insn since we don't have checks for
* all possible cases yet
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment