Skip to content

Commit 570d925

Browse files
warped-rudijnettlet
authored andcommitted
MXC-CEC: Provide send notifications
Inform userland after an outgoing transmission has been completed (ACKed or NAKed). Signed-off-by: Rudi <[email protected]>
1 parent 5ea3176 commit 570d925

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

drivers/mxc/hdmi-cec/mxc_hdmi-cec.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ static ssize_t hdmi_cec_write(struct file *file, const char __user *buf,
397397
int ret = 0;
398398
u8 i, msg_len, val;
399399
u8 msg[MAX_MESSAGE_LEN];
400+
struct hdmi_cec_event *event;
400401
struct hdmi_cec_priv *priv = file->private_data;
401402

402403
pr_debug("function : %s\n", __func__);
@@ -445,6 +446,24 @@ static ssize_t hdmi_cec_write(struct file *file, const char __user *buf,
445446
ret = -EPIPE; /* other error */
446447

447448
priv->tx_answer = CEC_TX_AVAIL;
449+
450+
if (ret >= 0 || ret == -EIO) {
451+
mutex_lock(&priv->lock);
452+
453+
event = alloc_event();
454+
if (event) {
455+
event->event_type = (ret == -EIO) ?
456+
MESSAGE_TYPE_NOACK : MESSAGE_TYPE_SEND_SUCCESS;
457+
event->msg_len = msg_len;
458+
memcpy(event->msg, msg, msg_len);
459+
460+
list_add_tail(&event->list, &ev_pending);
461+
wake_up(&rx_queue);
462+
}
463+
464+
mutex_unlock(&priv->lock);
465+
}
466+
448467
return ret;
449468
}
450469

0 commit comments

Comments
 (0)