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

media: cec: add optional adap_configured callback

This new optional callback is called when the adapter is fully configured
or fully unconfigured. Some drivers may have to take action when this
happens.
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent dad272bd
...@@ -109,6 +109,7 @@ your driver: ...@@ -109,6 +109,7 @@ your driver:
int (*adap_monitor_all_enable)(struct cec_adapter *adap, bool enable); int (*adap_monitor_all_enable)(struct cec_adapter *adap, bool enable);
int (*adap_monitor_pin_enable)(struct cec_adapter *adap, bool enable); int (*adap_monitor_pin_enable)(struct cec_adapter *adap, bool enable);
int (*adap_log_addr)(struct cec_adapter *adap, u8 logical_addr); int (*adap_log_addr)(struct cec_adapter *adap, u8 logical_addr);
void (*adap_configured)(struct cec_adapter *adap, bool configured);
int (*adap_transmit)(struct cec_adapter *adap, u8 attempts, int (*adap_transmit)(struct cec_adapter *adap, u8 attempts,
u32 signal_free_time, struct cec_msg *msg); u32 signal_free_time, struct cec_msg *msg);
void (*adap_status)(struct cec_adapter *adap, struct seq_file *file); void (*adap_status)(struct cec_adapter *adap, struct seq_file *file);
...@@ -117,7 +118,7 @@ your driver: ...@@ -117,7 +118,7 @@ your driver:
/* Error injection callbacks */ /* Error injection callbacks */
... ...
/* High-level callbacks */ /* High-level callback */
... ...
}; };
...@@ -178,6 +179,16 @@ can receive directed messages to that address. ...@@ -178,6 +179,16 @@ can receive directed messages to that address.
Note that adap_log_addr must return 0 if logical_addr is CEC_LOG_ADDR_INVALID. Note that adap_log_addr must return 0 if logical_addr is CEC_LOG_ADDR_INVALID.
Called when the adapter is fully configured or unconfigured::
void (*adap_configured)(struct cec_adapter *adap, bool configured);
If configured == true, then the adapter is fully configured, i.e. all logical
addresses have been successfully claimed. If configured == false, then the
adapter is unconfigured. If the driver has to take specific actions after
(un)configuration, then that can be done through this optional callback.
To transmit a new message:: To transmit a new message::
int (*adap_transmit)(struct cec_adapter *adap, u8 attempts, int (*adap_transmit)(struct cec_adapter *adap, u8 attempts,
......
...@@ -1336,6 +1336,7 @@ static void cec_adap_unconfigure(struct cec_adapter *adap) ...@@ -1336,6 +1336,7 @@ static void cec_adap_unconfigure(struct cec_adapter *adap)
cec_flush(adap); cec_flush(adap);
wake_up_interruptible(&adap->kthread_waitq); wake_up_interruptible(&adap->kthread_waitq);
cec_post_state_event(adap); cec_post_state_event(adap);
call_void_op(adap, adap_configured, false);
} }
/* /*
...@@ -1517,6 +1518,7 @@ static int cec_config_thread_func(void *arg) ...@@ -1517,6 +1518,7 @@ static int cec_config_thread_func(void *arg)
adap->kthread_config = NULL; adap->kthread_config = NULL;
complete(&adap->config_completion); complete(&adap->config_completion);
mutex_unlock(&adap->lock); mutex_unlock(&adap->lock);
call_void_op(adap, adap_configured, true);
return 0; return 0;
unconfigure: unconfigure:
......
...@@ -118,6 +118,7 @@ struct cec_adap_ops { ...@@ -118,6 +118,7 @@ struct cec_adap_ops {
int (*adap_monitor_all_enable)(struct cec_adapter *adap, bool enable); int (*adap_monitor_all_enable)(struct cec_adapter *adap, bool enable);
int (*adap_monitor_pin_enable)(struct cec_adapter *adap, bool enable); int (*adap_monitor_pin_enable)(struct cec_adapter *adap, bool enable);
int (*adap_log_addr)(struct cec_adapter *adap, u8 logical_addr); int (*adap_log_addr)(struct cec_adapter *adap, u8 logical_addr);
void (*adap_configured)(struct cec_adapter *adap, bool configured);
int (*adap_transmit)(struct cec_adapter *adap, u8 attempts, int (*adap_transmit)(struct cec_adapter *adap, u8 attempts,
u32 signal_free_time, struct cec_msg *msg); u32 signal_free_time, struct cec_msg *msg);
void (*adap_status)(struct cec_adapter *adap, struct seq_file *file); void (*adap_status)(struct cec_adapter *adap, struct seq_file *file);
......
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