diff options
author | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2021-11-13 11:05:24 +0000 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2022-04-24 07:41:06 +0100 |
commit | dad272bd03d541dc7c0ff8331756eccf659f6f02 (patch) | |
tree | 55002517ee58b428922c25108f1e09b07e00b67d /drivers/media/cec/core/cec-core.c | |
parent | e2ed5024ac2bc27d4bfc99fd58f5ab54de8fa965 (diff) | |
download | linux-dad272bd03d541dc7c0ff8331756eccf659f6f02.tar.bz2 |
media: cec: add xfer_timeout_ms field
Allow drivers to change the transmit timeout value, i.e. after how
long should a transmit be considered 'lost', i.e. the corresponding
cec_transmit_done_ts was never called.
Some CEC devices have their own timeout, and so this timeout value must be
longer than that hardware timeout value. If it is shorter then the
framework would consider the transmit lost, even though it is effectively
still in progress at the hardware level.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media/cec/core/cec-core.c')
-rw-r--r-- | drivers/media/cec/core/cec-core.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/media/cec/core/cec-core.c b/drivers/media/cec/core/cec-core.c index 6038be40b448..af358e901b5f 100644 --- a/drivers/media/cec/core/cec-core.c +++ b/drivers/media/cec/core/cec-core.c @@ -20,6 +20,18 @@ #define CEC_NUM_DEVICES 256 #define CEC_NAME "cec" +/* + * 400 ms is the time it takes for one 16 byte message to be + * transferred and 5 is the maximum number of retries. Add + * another 100 ms as a margin. So if the transmit doesn't + * finish before that time something is really wrong and we + * have to time out. + * + * This is a sign that something it really wrong and a warning + * will be issued. + */ +#define CEC_XFER_TIMEOUT_MS (5 * 400 + 100) + int cec_debug; module_param_named(debug, cec_debug, int, 0644); MODULE_PARM_DESC(debug, "debug level (0-2)"); @@ -331,6 +343,8 @@ int cec_register_adapter(struct cec_adapter *adap, adap->owner = parent->driver->owner; adap->devnode.dev.parent = parent; + if (!adap->xfer_timeout_ms) + adap->xfer_timeout_ms = CEC_XFER_TIMEOUT_MS; #ifdef CONFIG_MEDIA_CEC_RC if (adap->capabilities & CEC_CAP_RC) { |