Commit dcceb1ea authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] cec: add CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK flag

Currently if none of the requested logical addresses can be claimed, the
framework will fall back to the Unregistered logical address.

Add a flag to enable this explicitly. By default it will just go back to
the unconfigured state.

Usually Unregistered is not something you want since the functionality is
very limited. Unless the application has support for this, it will fail
to work correctly. So require that the application explicitly requests
this.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 277f963c
...@@ -144,7 +144,7 @@ logical address types are already defined will return with error ``EBUSY``. ...@@ -144,7 +144,7 @@ logical address types are already defined will return with error ``EBUSY``.
- ``flags`` - ``flags``
- Flags. No flags are defined yet, so set this to 0. - Flags. See :ref:`cec-log-addrs-flags` for a list of available flags.
- .. row 7 - .. row 7
...@@ -201,6 +201,25 @@ logical address types are already defined will return with error ``EBUSY``. ...@@ -201,6 +201,25 @@ logical address types are already defined will return with error ``EBUSY``.
give the CEC framework more information about the device type, even give the CEC framework more information about the device type, even
though the framework won't use it directly in the CEC message. though the framework won't use it directly in the CEC message.
.. _cec-log-addrs-flags:
.. flat-table:: Flags for struct cec_log_addrs
:header-rows: 0
:stub-columns: 0
:widths: 3 1 4
- .. _`CEC-LOG-ADDRS-FL-ALLOW-UNREG-FALLBACK`:
- ``CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK``
- 1
- By default if no logical address of the requested type can be claimed, then
it will go back to the unconfigured state. If this flag is set, then it will
fallback to the Unregistered logical address. Note that if the Unregistered
logical address was explicitly requested, then this flag has no effect.
.. _cec-versions: .. _cec-versions:
.. flat-table:: CEC Versions .. flat-table:: CEC Versions
......
...@@ -1047,6 +1047,10 @@ static int cec_config_thread_func(void *arg) ...@@ -1047,6 +1047,10 @@ static int cec_config_thread_func(void *arg)
dprintk(1, "could not claim LA %d\n", i); dprintk(1, "could not claim LA %d\n", i);
} }
if (adap->log_addrs.log_addr_mask == 0 &&
!(las->flags & CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK))
goto unconfigure;
configured: configured:
if (adap->log_addrs.log_addr_mask == 0) { if (adap->log_addrs.log_addr_mask == 0) {
/* Fall back to unregistered */ /* Fall back to unregistered */
......
...@@ -162,7 +162,7 @@ static long cec_adap_s_log_addrs(struct cec_adapter *adap, struct cec_fh *fh, ...@@ -162,7 +162,7 @@ static long cec_adap_s_log_addrs(struct cec_adapter *adap, struct cec_fh *fh,
return -ENOTTY; return -ENOTTY;
if (copy_from_user(&log_addrs, parg, sizeof(log_addrs))) if (copy_from_user(&log_addrs, parg, sizeof(log_addrs)))
return -EFAULT; return -EFAULT;
log_addrs.flags = 0; log_addrs.flags &= CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK;
mutex_lock(&adap->lock); mutex_lock(&adap->lock);
if (!adap->is_configuring && if (!adap->is_configuring &&
(!log_addrs.num_log_addrs || !adap->is_configured) && (!log_addrs.num_log_addrs || !adap->is_configured) &&
......
...@@ -364,7 +364,7 @@ struct cec_caps { ...@@ -364,7 +364,7 @@ struct cec_caps {
* @num_log_addrs: how many logical addresses should be claimed. Set by the * @num_log_addrs: how many logical addresses should be claimed. Set by the
* caller. * caller.
* @vendor_id: the vendor ID of the device. Set by the caller. * @vendor_id: the vendor ID of the device. Set by the caller.
* @flags: set to 0. * @flags: flags.
* @osd_name: the OSD name of the device. Set by the caller. * @osd_name: the OSD name of the device. Set by the caller.
* @primary_device_type: the primary device type for each logical address. * @primary_device_type: the primary device type for each logical address.
* Set by the caller. * Set by the caller.
...@@ -389,6 +389,9 @@ struct cec_log_addrs { ...@@ -389,6 +389,9 @@ struct cec_log_addrs {
__u8 features[CEC_MAX_LOG_ADDRS][12]; __u8 features[CEC_MAX_LOG_ADDRS][12];
}; };
/* Allow a fallback to unregistered */
#define CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK (1 << 0)
/* Events */ /* Events */
/* Event that occurs when the adapter state changes */ /* Event that occurs when the adapter state changes */
......
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