media: cec: expose the new connector info API

Until now the connector info API was a kernel-internal API only.
This moves it to the public API and adds the new ioctl to retrieve
this information.

Signed-off-by: Dariusz Marcinkiewicz <darekm@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
Dariusz Marcinkiewicz 2019-08-23 09:20:58 -03:00 committed by Mauro Carvalho Chehab
parent 806e0cdfee
commit 9098c1c251
5 changed files with 62 additions and 36 deletions

View file

@ -317,6 +317,8 @@ static inline int cec_is_unconfigured(__u16 log_addr_mask)
#define CEC_CAP_NEEDS_HPD (1 << 6)
/* Hardware can monitor CEC pin transitions */
#define CEC_CAP_MONITOR_PIN (1 << 7)
/* CEC_ADAP_G_CONNECTOR_INFO is available */
#define CEC_CAP_CONNECTOR_INFO (1 << 8)
/**
* struct cec_caps - CEC capabilities structure.
@ -375,6 +377,34 @@ struct cec_log_addrs {
/* CDC-Only device: supports only CDC messages */
#define CEC_LOG_ADDRS_FL_CDC_ONLY (1 << 2)
/**
* struct cec_drm_connector_info - tells which drm connector is
* associated with the CEC adapter.
* @card_no: drm card number
* @connector_id: drm connector ID
*/
struct cec_drm_connector_info {
__u32 card_no;
__u32 connector_id;
};
#define CEC_CONNECTOR_TYPE_NO_CONNECTOR 0
#define CEC_CONNECTOR_TYPE_DRM 1
/**
* struct cec_connector_info - tells if and which connector is
* associated with the CEC adapter.
* @type: connector type (if any)
* @drm: drm connector info
*/
struct cec_connector_info {
__u32 type;
union {
struct cec_drm_connector_info drm;
__u32 raw[16];
};
};
/* Events */
/* Event that occurs when the adapter state changes */
@ -398,10 +428,17 @@ struct cec_log_addrs {
* struct cec_event_state_change - used when the CEC adapter changes state.
* @phys_addr: the current physical address
* @log_addr_mask: the current logical address mask
* @have_conn_info: if non-zero, then HDMI connector information is available.
* This field is only valid if CEC_CAP_CONNECTOR_INFO is set. If that
* capability is set and @have_conn_info is zero, then that indicates
* that the HDMI connector device is not instantiated, either because
* the HDMI driver is still configuring the device or because the HDMI
* device was unbound.
*/
struct cec_event_state_change {
__u16 phys_addr;
__u16 log_addr_mask;
__u16 have_conn_info;
};
/**
@ -476,6 +513,9 @@ struct cec_event {
#define CEC_G_MODE _IOR('a', 8, __u32)
#define CEC_S_MODE _IOW('a', 9, __u32)
/* Get the connector info */
#define CEC_ADAP_G_CONNECTOR_INFO _IOR('a', 10, struct cec_connector_info)
/*
* The remainder of this header defines all CEC messages and operands.
* The format matters since it the cec-ctl utility parses it to generate