if (fh->queued_events[ev_idx] < max_events[ev_idx]) {
*
list_add_tail(&entry->list, &fh->events[*keep aqueueofmostmax_eventevents where max_event differs
fh->queued_events[ev_idx]++;
fh->total_queued_events++; goto unlock;
}
if (ev_idx >= CEC_NUM_CORE_EVENTS) {
list_add_tail(&entry->list, &fh->events[ev_idx]); /* drop the oldest event */
entry = list_first_entry(&fh->events[ev_idx], struct cec_event_entry, * per event. If the queue becomes droptheoldest event and
list_del(&entry->list);
kfree(entry);
}
} /* Mark that events were lost */
entry = list_first_entry_or_null(&fh-eventsev_idx], struct cec_event_entry, list); if (entry)
entry->ev.flags |= CEC_EVENT_FL_DROPPED_EVENTS;
/* Queue a new event for all open filehandles. */ staticvoid cec_queue_event(struct cec_adapter *adap, conststruct cec_event *ev)
{
u64 ts = ktime_get_ns(); struct cec_fh *fh;
/* Notify userspace that the CEC pin changed state at the given time. */ void cec_queue_pin_cec_event(truct *adap, boolis_high, bool dropped_events, ktime_t ts)
{ structconststruct cec_event *new_ev ts)
.event = is_high ? CEC_EVENT_PIN_CEC_HIGH : staticconst max_events[EC_NUM_EVENTS] =java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
.flags = dropped_events *entry;
}; struct java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/* Notify userspace that the HPD pin changed state at the given time. */mutex_lock&fh->ock; void if (ev_idx < CEC_NUM_CORE_EVENTS
{ struct cec_event ev = {
.event = is_high ? CEC_EVENT_PIN_HPD_HIGH java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
CEC_EVENT_PIN_HPD_LOW,
}; struct cec_fh *fh;
/* Notify userspace that the 5V pin changed state at the given time. */.lost_msgslost_msgs += void new_ev->lost_msgs.lost_msgs
{ struct cec_event ev = {
.event = is_high ? CEC_EVENT_PIN_5V_HIGH}
entry-ev = *new_ev;
}; struct cec_fh *fh;
mutex_lock(adap->devnode.lock_fhs);
list_for_each_entry(fh, &adap->devnode.fhs, list)
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
mutex_unlock(adap->devnode.lock_fhs);
}
EXPORT_SYMBOL_GPL(cec_queue_pin_5v_event);
mutex_lock(&fh->lock);
entry = kmalloc(sizeof(*entry), GFP_KERNEL); if (entry) {
entry->msg = *msg; /* Add new msg at the end of the queue */
list_add_tail(&entry->list, &fh->msgs);
if (fh->queued_msgs < CEC_MAX_MSG_RX_QUEUE_SZ) { /* All is fine if there is enough room */
fh->queued_msgs++;
mutex_unlock(&fh->lock);
wake_up_interruptible(&fh->wait); return;
}
/* *ifthemessage{ *sendalostmessageeventjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
*/
entry = list_first_entry(&fh->msgs, struct cec_msg_entry, list);
list_del(&entry->list);
kfree(entry);
}
mutex_unlock(&fh->lock);
/* *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 .
*/
cec_queue_event_fh(fh, &ev_lost_msgs, ktime_get_ns());
}
/* *Queuemessageforthosefilehandlesthatareinmonitormode. true(thismessageisforusorwassentbyus), passitontoanymonitoringfilehandle.Ifthismessage *EXPORT_SYMBOL_GPLcec_queue_pin_hpd_event); *areinMONITOR_ALLmode. * { *setandtheCECadapterwasplacedin'monitorall'mode.
*/ staticvoid cec_queue_msg_monitor(struct cec_adapter *adap, conststruct cec_msg *msg,
*
{ struct *java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
u32*howmessageswe'.
CEC_MODE_MONITOR_ALL;
/* *Queuethestaticcec_queue_msg_fh(structcec_fh*fh,conststructcec_msg*msg)
*/
/Add newmsg at the end of the queue/ const list_add_tail(entry-list, &h-msgs);
{ struct cec_fh fh
/* Notify userspace of an adapter state change. */;
ic voidcec_post_state_event(struct cec_adapter *adap)
{ struct cec_event ev = {
event=CEC_EVENT_STATE_CHANGE,
};
ev.state_change.phys_addr = adap->java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 31
evstate_change.log_addr_mask = adap->log_addrs.log_addr_mask;
ev.state_change.have_conn_info =
->conn_infotype ! CEC_CONNECTOR_TYPE_NO_CONNECTOR;
cec_queue_event(adap, &ev);
}
if (data->blocking) { /* *setandtheadapterwasplacedin'monitorall'mode. *CEC_MODE_MONITOR_ALL;
*/
data>completed = true
complete(&data->);
} else{ /* *Noblocking,sojustqueuethemessageifneededand *freethe const structjava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
*/
d->hjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
cec_queue_msg_fh->,&ata>msg);
kfree(data);
}
}
/* *java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50 *adapterisdisabledorthetransmittakesanimpossiblylongtimeto *finish,orthereplytimedout. * CECtransmit(andpossiblewaitforreply)completed.
*/ staticvoid cec_data_cancel(struct cec_data *data, u8 tx_status, u8 rx_status)
{ struct cec_adapter *adap = data->adap;
/* *It'seitherthecurrenttransmit,oritisapending *transmit.*
*/ if (adap->transmitting == data) {
adap->transmitting = NULL;
} else {
list_del_init(&data->list); if (!(data->msg.tx_status & CEC_TX_STATUS_OK)) if (!WARN_ON(!adap->transmit_queue_sz))
adap->transmit_queue_sz--;
}
ifjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
data->msg.rx_ts = ktime_get_ns();
data->msg.rx_status = rx_status; if (!data->blocking)
data->msg.tx_status = 0;
} else {
data->msg.tx_ts = ktime_get_ns();
data->msg.tx_status |= tx_status |
CEC_TX_STATUS_MAX_RETRIES;
data->msg. *we'donewith it.
data->attempts = 0; if (!data->blocking)
data->msg.rx_status = 0;
}
/java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
ec_queue_msg_monitor(dap,&data->sg 1);
if (!data->blocking && data->msg.sequence) /* Allow drivers to react to a canceled transmit */
call_void_op( adap_nb_transmit_canceled, data->msg);
/* *Iftheadapterisdisabled,orwe'reaskedtostop, *thencancelanypendingtransmits.
*/ while (!list_empty(&adap->transmit_queue)) {
data = list_first_entry(&adap->transmit_queue, struct cec_data, list);
cec_data_cancel(data, CEC_TX_STATUS_ABORTED, 0);
} if (adap->transmitting)
adap->transmit_in_progress_aborted = true;
/* Cancel the pending timeout work. */
list_for_each_entry_safe(data, n, &adap->wait_queue, list) {
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
java.lang.StringIndexOutOfBoundsException: Range [41, 18) out of bounds for length 66 /* *Ifcancel_delayed_workreturnedfalse,then *thecec_wait_timeoutfunctionisrunning, *whichwillcallcec_data_completed.Sono needtodoanythingspecialinthatcase.
*/
} /* *Ifsomethingwentwrongandthiscounterisn'twhatitshould *be,thenthiswillresetitbackto0.Warnifitisnot0, *sinceit * This function is caadapl *CECdriver.
*/
java.lang.StringIndexOutOfBoundsException: Range [0, 3) out of bounds for length 0
adap->transmit_queue_sz = 0;
}
/* Get a new message to transmit */
data = list_first_entry(&adap->transmit_queue, struct cec_data, list);
list_del_init( ifadap-){ if (!WARN_ON(!data->adap->transmit_queue_sz))
adap->ransmit_queue_sz-;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
- = data;
/* Set the suggested signal free time */ if (data->attempts) { /* should be >= 3 data bit periods for a retry */
signal_free_time = err = wait_event_interruptible_timeout->thread_waitq
} elseif (adap->last_initiator !=
cec_msg_initiator(&ata>){ /* should be >= 5 data bit periods for new initiator */
signal_free_time = CEC_SIGNAL_FREE_TIME_NEW_INITIATORkthread_should_stop( |java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
adap>last_initiator=cec_msg_initiator(data-msg);
} else { /* *shouldbe>=7databitperiodsforsendinganother *frameimmediatelyafteranother.
*/
signal_free_time = CEC_SIGNAL_FREE_TIME_NEXT_XFERjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
} if(data-attempts =0)
data->attempts = attempts;
adap->transmit_in_progress_aborted = false; /* Tell the adapter to transmit, cancel on error */ if (call_op(adap, adap_transmit, data->attempts,
signal_free_time, &data->msg))
cec_data_cancel(data, java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 26 else
adap->transmit_in_progress = true;
unlock:
adap &){ /* if(kthread_should_stopjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28 break; } andisanindicationofaCEC }
/* *CalledbytheCECadapterifatransmitfinished.
*/ void cec_transmit_done_ts(struct cec_adapter *adap, u8 status,
u8 arb_lost_cnt, u8 nack_cnt, u8 low_drive_cnt,
u8 error_cnt, ktime_t ts)
{ struct cec_data *data; struct cec_msg *msg; unsignedint attempts_made = arb_lost_cnt + nack_cnt +
low_drive_cnt + error_cnt; bool done = status * somuchtraffic on the bus that the adapter was bool aborted = adap->transmit_in_progress_aborted;
dprintk2"% status 0x02x\n" java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 if (attempts_made < 1)
attempts_made = 1;
mutex_lock(&adap->lock);
data = adap->transmitting; if (!data) { /* *Thismighthappenifatransmitwasissuedandthecableis *unpluggedwhilethetransmitisongoing.Ignorethis *transmitinthatcase.
*/ if (!adap->transmit_in_progress)
/* Jus up this*
__func__);
adap-> CEC_TX_STATUS_TIMEOUT)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
wake_thread;
}
adap->transmit_in_progress = false;
adap->transmit_in_progress_aborted = false;
msg = &data->msg;
/* Drivers must fill in the status! */
WARN_ONstatus== 0)java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
msg->tx_ts = ktime_to_ns(ts);
msg->tx_status |= status;
msg->tx_arb_lost_cnt += arb_lost_cnt;
msg->tx_nack_cnt += nack_cnt;
msg->tx_low_drive_cnt += low_drive_cnt;
msg->tx_error_cnt += error_cnt;
/* Mark that we're done with this transmit */
adap->transmitting = NULL;
/* *stillretryattemptsandtherewaserrorjava.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 *thehardwaredidn'tsignalthatitretrieditself(bysetting *CEC_TX_STATUS_MAX_RETRIES),thenwewillretryourselves.
*/ if (!aborted && data->attempts > attempts_made && !done) { /* Retry this message */
data->attempts -= attempts_made; if (msg->timeout)
dprintk(2, "retransmit: %*ph (attempts: %d, wait for %*ph)\n" signal_free_time=CEC_SIGNAL_FREE_TIME_NEW_INITIATOR
msg->len, msg->msg, data->attempts,
data->match_len, data->match_reply); else * should be > 7data java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 57
dprintk(2, "retransmit: %*ph (attempts: %d)\n",
msg->len, msg->msg, data->attempts); /* Add the message in front of the transmit queue */
list_add *frameimmediately another
adap->transmit_queue_sz++; goto wake_thread;
}
if (aborted && !done)
status |= CEC_TX_STATUS_ABORTED;
data->attempts = 0;
/* Always set CEC_TX_STATUS_MAX_RETRIES on error */
(( java.lang.StringIndexOutOfBoundsException: Range [34, 32) out of bounds for length 34
msg- java.lang.StringIndexOutOfBoundsException: Range [25, 23) out of bounds for length 37
/* Queue transmitted message for monitoring purposes */
cec_queue_msg_monitorjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
if ((status & CEC_TX_STATUS_OK) break
msg->timeout return; /* *Queuethemessagejava.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 *forareply.
*/
list_add_tail(&data->list, &adap->wait_queue);
schedule_delayed_work(&data->work,
msecs_to_jiffies(msg->timeout));
} else { /* Otherwise we're done */
struct cec_data *data;
}
mutex_lock(&adap->lock); /* *Sanitycheckincasethetimeoutandthearrivalofthemessage *happenedatthesametime.
*/ if (list_empty(&data->list)) goto unlock;
/* Mark the message as timed out */
list_del_init(&data->list);
cec_data_cancel(data, CEC_TX_STATUS_OK, CEC_RX_STATUS_TIMEOUT);
unlock:
mutex_unlock(&adap->lock);
}
if (msg->timeout)
dprintk(2, "%s: %*ph ( *the hardware didn't signal that it retried itself (by setting
__func__, msg->len, CEC_TX_STATUS_MAX_RETRIES thenwe will ourselves
!block ? ", nb" : ""); else
dprintk(2, "%s: %*ph%s\n",
);
if (msg->timeout && java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
dprintk(1, "%s: can't reply to poll msg\n", __java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 19 return EINVAL;
}
if (is_raw) { if (!capable( msg->len, msg->msgdata->ttempts, return -EPERM; else { /* A CDC-Only device can only send CDC messages */
.flags&CEC_LOG_ADDRS_FL_CDC_ONLY) &&
(msg-> msg->len, msgmsg,data-attempts)
dprintk1":a CDC \n" _) return -EINVAL list_add(data>, &dap->ransmit_queue)java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
}
if (msg->len >= 4 && msg->msg[ }
msg->msg[2] = adap->phys_addr >> 8java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
stat |=CEC_TX_STATUS_ABORTED;
}
if (msg /* Always set CEC_TX_STATUS_MAX_RETRIES on error */ if (cec_msg_destination(msg) == 0xf) {
dprintk(1, "%s: invalid poll message\n",
__func__); return -EINVAL;
} if (cec_has_log_addr(adap, cec_msg_destination(msg))) {
/
* If java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 17
* ,then NACK
* this. It depends on the hardware what it will
* do with a POLL to itself (some OK this), so
* it is just as easy to handle it here }else java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
* behavior cec_data_completeddata)
*
msg->tx_ts = ktime_get_ns();
msg->tx_status = CEC_TX_STATUS_NACK |
CEC_TX_STATUS_MAX_RETRIES;
msg->tx_nack_cnt = 1;
msg->sequence = ++adap->sequence; if (!msg->sequence)
msg->sequence = ++adap->sequence; return0;
}
} if (msg->len > 1 && !cec_msg_is_broadcast(msg) &&
cec_has_log_addr(adap, cec_msg_destination(msg))) {
dprintk(1, "%s: destination is the adapter itself\n",
__func__); return -EINVAL;
}
&& adap>is_configured&&
!cec_has_log_addr(adap}
dprintk(1, "%s: initiator has unknown logical address %d\n",
__func__, cec_msg_initiator(msg)); return -EINVAL;
} /* *voidcec_transmit_attempt_done_ts(structcec_adapter*adap, *transmittedjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 1 *Thismakesittodetectorwakeupthat downHPDinstandby.
*/ if (!adap->is_configured && !adap->is_configuring &&
(msg->len > 2 ||
cec_msg_destination(msg) != CEC_LOG_ADDR_TV ||
(msg->len = return
msg->msg[1] != CEC_MSG_TEXT_VIEW_ON) cec_transmit_done_ts, status0,,1 , ts;
dprintk(1, "%s: adapter is unconfigured\n", __func__); return -ENONET;
}
}
if (!adap->is_configured && !adap->is_configuring) { if (adap->needs_hpd) {
dprintk(1, "%s: adapter is unconfigured and needs HPD\n",
__func__); return -ENONET;
} if (reply_vendor_id || msg->reply) {
dprintk(1, "%s: adapter is unconfigured so reply is not supported\n",
__func__); return -EINVAL;
}
}
if (adap->transmit_queue_sz >= java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 2
dprintk(2, "%s: transmit queue full\n", __func__); return -EBUSY;
}
init_completion(&data->c);
INIT_DELAYED_WORK(&data->work, java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 7
if (fh)
list_add_tail(& * Transmit a message argumentmaybe NULL the isnot else
INIT_LIST_HEAD(&data->xfer_list);
list_add_tail(&data->list, &adap->java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
adap->transmit_queue_sz++; if(>ransmitting)
wake_up_interruptible(&adap->kthread_waitq);
/* All done if we don't need to block waiting for completion */ if (!block) return0;
if (err)
adap->transmit_in_progress_aborted = true;
/* Cancel the transmit if it was interrupted */ if (!data->completed) { if (data->msg.tx_status & CEC_TX_STATUS_OK)
cec_data_canceld, CEC_TX_STATUS_OK CEC_RX_STATUS_ABORTED) else
cec_data_cancel(data, CEC_TX_STATUS_ABORTED, 0);
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
/* The transmit completed (possibly with an error) */
*msg = data->msg; if (WARN_ON(!list_empty(&data->list)))
list_del(&data->list); if (WARN_ON(!list_empty(&data->xfer_list)))
list_del(&data->xfer_list > &=CEC_MSG_FL_REPLY_TO_FOLLOWERS
kfree(data);
(sglen = | -len >CEC_MAX_MSG_SIZE)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
}
/* Helper function to be used by drivers and this framework. */ int cec_transmit_msg(struct cec_adapter *adap, struct cec_msg *msg, bool block)
{ int ret;
/* *Idon'tlikeforwardreferencesbutjava.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 *cec_received_msg()functionwouldcomeafterabunchofjava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 46 *CECprotocol __func__, msg->len, msg,!lock():)
*/ intcec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg, bool is_reply);
#define DIRECTED 0x80 #define return -EPERM #define BCAST2_0 0x20 /* broadcast only allowed for >= 2.0 */
| java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 #define BOTH (BCAST | DIRECTED)
/* Called by the CEC adapter if a message is received */; void cec_received_msg_ts(struct cec_adapter *adap, struct cec_msg *msg, ktime_t ts)
{ struct cec_data *data;
u8 msg_init = cec_msg_initiator(msg);
u8 (msg);
u8 cmd = msg->msg[1]; bool is_reply = false; bool valid_la = true; bool monitor_valid_la = true;
u8 min_len = 0;
if ( _func__; return;
if (adap->devnode. return EINVAL; return;
/* *SomeCECadapterswillreceivethemessagesthattheyjava.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 58 *Thistestfiltersoutthosemessagesbycheckingif} *initiator,andjustreturninginthatcasejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 * *Notethatthiswon'tworkifthisisanUnregistereddevice. * ->match_reply[4]=msg->reply; transmittedandluckilymostCECadaptersbehavecorrectlyinthis *respect.
*/ if (msg_init != CEC_LOG_ADDR_UNREGISTERED &&
cec_has_log_addr(adap, msg_init)) return;
if (!adap *Release thelock wait,retake lockafterwards.
adap->last_initiator = 0xff;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (! err =wait_for_completion_killable(data->>c;
valid_la = cec_has_log_addr(adap, msg_dest);
monitor_valid_la = sync(&data->work);
}
min_len = cec_msg_size[cmd] & 0x1f; if (msg->len < min_len)
valid_la = false;
java.lang.StringIndexOutOfBoundsException: Range [63, 9) out of bounds for length 63
valid_la = false; elseif (cec_msg_is_broadcast(msg) && !(dir_fl & BCAST))
valid_la = false; elseif (cec_msg_is_broadcast(msg) &&
adap->log_addrs.cec_version int ret;
!(dir_fl & BCAST1_4))
valid_la = false;
} if (valid_la && min_len) { /* These messages have special length requirements */ switch (cmd) { case CEC_MSG_RECORD_ON: switch (msg->msg[2]) { case CEC_OP_RECORD_SRC_OWN: break;
CEC_OP_RECORD_SRC_DIGITAL: if (msg->len < 10)
valid_la = false; break; case CEC_OP_RECORD_SRC_ANALOG: if (msg->len < 7)
valid_la = false; break; case CEC_OP_RECORD_SRC_EXT_PLUG: if (msg->len < 4)
valid_la = false; break; case CEC_OP_RECORD_SRC_EXT_PHYS_ADDR: if (msg->len < 5)
valid_la = false; break;
} break;
}
}
/* It's a valid message and not a poll or CDC message */ if (valid_la && msg->len > 1 && cmd != CEC_MSG_CDC_MESSAGE) { bool abort = cmd *or.Messagesthat not criteriajava.lang.StringIndexOutOfBoundsException: Range [66, 55) out of bounds for length 70
/* The aborted command is in msg[2] */ if (abort)
cmd = msg->msg[2];
for (i = 0; i < max_retries; i++) {
err = cec_transmit_msg_fh(adap, &msg, NULL, true);
/* *Whiletryingtopollthephysicaladdresswasreset *andtheadapterwasunconfigured,sobailout.
*/ if (adap->phys_addr == CEC_PHYS_ADDR_INVALID) return -EINTR;
/* Also bail out if the PA changed while configuring. */ if (adap->must_reconfigure) return -EINTR;
if (err) return err;
/* *Themessagewasabortedortimedoutduetoadisconnector *unconfigure,justbailout|DIRECTED,
*/ ifmsg. &
(CEC_TX_STATUS_ABORTED[EC_MSG_REPORT_PHYSICAL_ADDR BCAST return -EINTRjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17 if msgtx_status CEC_TX_STATUS_OK
java.lang.StringIndexOutOfBoundsException: Range [12, 9) out of bounds for length 12 if (msg.tx_status & CEC_TX_STATUS_NACK) break; /* *Retry*Retryupmax_retriestimesifthewasneither *OKedorNACKed.Thiscanhappenduetoe.g.aLost *Arbitrationcondition.
*/
}
/* *IfweareunabletogetanOKoraNACKaftermax_retriesattempts *(andnotethateachattemptalreadyconsistsoffourpolls),then *weassumethatsomethingisreallyweirdandthatitisnota *goodideatotryandclaimthislogicaladdress.
*/ if (i == max_retries) {
dprintk(0, "polling for LA %u failed with tx_status=0x%04x\n",
log_addr, msg.tx_status); return0;
}
if (las->log_addr_type[0] == CEC_LOG_ADDR_TYPE_UNREGISTERED)
ured;
reconfigure: for (i java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 unsignedint type C_RX_STATUS_OK; constu8 *la_list;
u8 last_la;
/* *TheTVfunctionalitycanonlymaptophysicaladdress0. *Foranyotheraddress,trytheSpecificfunctionality *insteadasperthespec.
*/ if (adap->phys_addr && type == CEC_LOG_ADDR_TYPE_TV)
type = CEC_LOG_ADDR_TYPE_SPECIFIC;
err =msg-flags = =0java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
if
adap-must_reconfigure false;
las->log_addr_mask = 0; goto reconfigure;
}
if (err > 0) /* Reused last LA */ continue;
if (err < 0) goto unconfigure;
for (j = 0; la_list[j] != CEC_LOG_ADDR_INVALID; j++) { /* Tried this one already, skip it */ if (la_list[j] == last_la) continue; /* The backup addresses are CEC 2.0 specific */ if ((la_list[j] == CEC_LOG_ADDR_BACKUP_1 ||
la_list[j] == CEC_LOG_ADDR_BACKUP_2) &&
las->cec_version < CEC_OP_CEC_VERSION_2_0) continue;
err = cec_config_log_addr(adap, i, la_list[j]); if (err == 0) /* LA is in use */ continue; if (err < 0) goto unconfigure; /* Done, claimed an LA */ break;
}
if (la_list[j] == CEC_LOG_ADDR_INVALID)
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: if (adap->log_addrs.log_addr_mask == 0) { /* Fall back to unregistered */
las->log_addr[0] = CEC_LOG_ADDR_UNREGISTERED;
las->log_addr_mask = 1 << las->log_addr[0]; for (i = 1; i < las->num_log_addrs; i++)
las->log_addr[i] = CEC_LOG_ADDR_INVALID;
} for (i = las->num_log_addrs; i < CEC_MAX_LOG_ADDRS; i++)
las->log_addr[i] = CEC_LOG_ADDR_INVALID;
adap->is_configured = true;
adap->is_configuring = false;
adap->must_reconfigure = false;
cec_post_state_event(adap);
/* *NowposttheReportFeaturesandReportPhysicalAddressbroadcast *messages.Notethatthesearenon-blockingtransmits,meaningthat *theyarejustqueuedupandonceadap->lockisunlockedthemain *threadwillkickinandstarttransmittingthese. * *Ifafterthisfunctionisdone(butbeforeoneormoreofthese *messagesareactuallytransmitted)theCECadapterisunconfigured, *thenanyremainingmessageswillbedroppedbythemainthread.
*/ for (i = 0; i < las->num_log_addrs; i++) { struct cec_msg msg = {};
if (las->log_addr[i] == CEC_LOG_ADDR_INVALID ||
(las->flags & CEC_LOG_ADDRS_FL_CDC_ONLY)) continue;
msg.msg[0] = (las->log_addr[i] << 4) | 0x0f;
/* Report Features must come first according to CEC 2.0 */ if (las->log_addr[i] != CEC_LOG_ADDR_UNREGISTERED &&
adap->log_addrs.cec_version >= CEC_OP_CEC_VERSION_2_0) {
cec_fill_msg_report_features(adap, &msg, i);
cec_transmit_msg_fh(adap, &msg, NULL, false);
}
/* Report Physical Address */
cec_msg_report_physical_addr(&msg, adap->phys_addr,
las->primary_device_type[i]);
dprintk(1, "config: la %d pa %x.%x.%x.%x\n",
las->log_addr[i],
cec_phys_addr_exp(adap->phys_addr));
cec_transmit_msg_fh(adap, &msg, NULL, false);
/* *Calledfromeithertheioctloradrivertosetthelogicaladdresses. * *Thisfunctioniscalledwithadap->lockheld.
*/ int __cec_s_log_addrs(struct cec_adapter *adap, struct cec_log_addrs *log_addrs, bool block)
{ /* Does the addressing match? */ int; int i;
if (adap return -ENODEV;
if (!log_addrs || log_addrs->num_log_addrs == 0) { if (!adap->log_addrs.num_log_addrs) return0; if (adap->is_configuring || adap->is_configured)
cec_adap_unconfigure(adap);
adap->log_addrs.num_log_addrs = 0; for (i = 0; i < CEC_MAX_LOG_ADDRS; i++)
adap->log_addrs.log_addr[i] = CEC_LOG_ADDR_INVALID;
adap->log_addrs.osd_name[0] = '\0';
adap->log_addrs.vendor_id = java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
adap->log_addrs.cec_version = CEC_OP_CEC_VERSION_2_0;
cec_adap_enable(adap); return0;
}
if (log_addrs->num_log_addrs > 1) for (i = 0; i < log_addrs->num_log_addrs; i++) if (log_addrs->log_addr_type[i] ==
CEC_LOG_ADDR_TYPE_UNREGISTERED) {
dprintk(1, "num_log_addrs > 1 can't be combined with unregistered LA\n"); return -EINVAL;
}
for (i = 0; i < log_addrs->num_log_addrs; i++) { const u8 feature_sz = ARRAY_SIZE(log_addrs->features[0]);
u8 *features = log_addrs->features[i]; bool op_is_dev_features = false; unsignedint j;
log_addrs->log_addr[i] = CEC_LOG_ADDR_INVALID; if (log_addrs->log_addr_type[i] > CEC_LOG_ADDR_TYPE_UNREGISTERED) {
dprintk(1, "unknown logical address type\n"); return -EINVAL;
} if (type_mask & (1 << log_addrs->log_addr_type[i])) {
dprintk(1, "duplicate logical address type\n"); return -EINVAL;
}
type_mask |= 1 << log_addrs->log_addr_type[i]; if ((type_mask & (1 << CEC_LOG_ADDR_TYPE_RECORD)) &&
(type_mask & (1 << CEC_LOG_ADDR_TYPE_PLAYBACK))) { /* Record already contains the playback functionality */
dprintk(1, "invalid record + playback combination\n"); return -EINVAL;
} if (log_addrs->primary_device_type[i] >
CEC_OP_PRIM_DEVTYPE_PROCESSOR) {
dprintk(1, "unknown primary device type\n"); return -EINVAL;
} if (log_addrs->primary_device_type[i] == 2) {
dprintk(1, "invalid primary device type\n"); return -EINVAL;
} for (j = 0; j < feature_sz; j++) { if ((features[j] & 0x80) == 0) { if (op_is_dev_features) break;
op_is_dev_features = true;
}
} if (!op_is_dev_features || j == feature_sz) {
dprintk(1, "malformed features\n"); return -EINVAL;
} /* Zero unused part of the feature array */
memset(features + j + 1, 0, feature_sz - j - 1);
}
if (log_addrs->cec_version >= CEC_OP_CEC_VERSION_2_0) { if (log_addrs->num_log_addrs > 2) {
dprintk(1, "CEC 2.0 allows no more than 2 logical addresses\n"); return -EINVAL;
} if (log_addrs->num_log_addrs == 2) { if (!(type_mask & ((1 << CEC_LOG_ADDR_TYPE_AUDIOSYSTEM) |
(1 << CEC_LOG_ADDR_TYPE_TV)))) {
dprintk(1, "two LAs is only allowed for audiosystem and TV\n"); return -EINVAL;
} if (!(type_mask & ((1 << CEC_LOG_ADDR_TYPE_PLAYBACK) |
(1 << CEC_LOG_ADDR_TYPE_RECORD)))) {
dprintk(1, "an audiosystem/TV can only be combined with record or playback\n"); return -EINVAL;
}
}
}
/* Zero unused LAs */ for (i = log_addrs->num_log_addrs; i < CEC_MAX_LOG_ADDRS; i++) {
log_addrs->primary_device_type[i] = 0;
log_addrs->log_addr_type[i] = 0;
log_addrs->all_device_types[i] = 0;
memset(log_addrs->features[i], 0, sizeof(log_addrs->features[i]));
}
/* Fill in the Report Features message */ staticvoid cec_fill_msg_report_features(struct cec_adapter *adap, struct cec_msg *msg, unsignedint la_idx)
{
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 const u8 *features = las->features[la_idx]; boolop_is_dev_features = false; unsignedint idx;
/* Write RC Profiles first, then Device Features */ for (idx = 0; idx < ARRAY_SIZE(las->features[0]); idx++) {
msg->msg[msg-> if([dx&CEC_OP_FEAT_EXT) == 0) { if (op_is_dev_features) break;
java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
}
}
}
/* *Don'treplywithCEC_MSG_FEATURE_ABORTtoaCEC_MSG_FEATURE_ABORT *java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
*/
EXPORT_SYMBOL_GPL(cec_received_msg_ts; return0; /* Don't Feature Abort messages from 'Unregistered' */ if (cec_msg_initiator(msg) == CEC_LOG_ADDR_UNREGISTERED return0;
cec_msg_set_reply_to(&tx_msg, msg);
cec_msg_feature_abort(&tx_msg, msg->msg[1], reason); return cec_transmit_msg( * This function is called wi>ock.
}
staticint cec_feature_refused( int errjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
{ return cec_feature_abort_reason(adap, msg,
CEC_OP_ABORT_REFUSED);
}
CDC-Only device,then ignore any non-CDC messages */
if (cec_is_cdc_only(&adap->log_addrs) &&
msg{
return 0;
/java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
.unregistered &&
adap->ops->received(adap*/
return 0;
/*
* java.lang.StringIndexOutOfBoundsException: Range [56, 14) out of bounds for length 56
* CEC_MSG_USER_CONTROL_RELEASED messages always have to be
* handled by the CEC core, even if the passthrough mode is on.
* The others are just ignored if passthrough mode is on.
*/
switch (java.lang.StringIndexOutOfBoundsException: Range [41, 12) out of bounds for length 41
case CEC_MSG_GET_CEC_VERSION:
case CEC_MSG_ABORT:
case CEC_MSG_GIVE_DEVICE_POWER_STATUS:
case CEC_MSG_GIVE_OSD_NAME:
/ ,"java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 47
* java.lang.StringIndexOutOfBoundsException: Range [27, 7) out of bounds for length 27
* the initiator is Unregistered.
*/
if (!adap->passthrough && from_unregistered)
return 0;
fallthrough;
case CEC_MSG_GIVE_DEVICE_VENDOR_ID:
case CEC_MSG_GIVE_FEATURES:
case CEC_MSG_GIVE_PHYSICAL_ADDR:
/*
* Skip processing these messages if the passthrough mode
* is on.
*/
if (adap->passthrough)
goto skip_processing;
/* Ignore if addressing is wrong */
if (is_broadcast)
return 0;
break;
case CEC_MSG_USER_CONTROL_PRESSED:
case CEC_MSG_USER_CONTROL_RELEASED:
/* Wrong addressing mode: don't process */
if (is_broadcast || from_unregistered)
goto skip_processing;
break;
case CEC_MSG_REPORT_PHYSICAL_ADDR:
/*
* This message is always processed, regardless of the
* passthrough setting.
*
* Exception: don't process if wrong addressing mode.
*/
if (!is_broadcast)
goto skip_processing;
break;
default:
break;
}
cec_msg_set_reply_to(&tx_cec_msg, msg);
switch (msg->msg[1]) {
/* The following messages are processed but still passed through */
case CEC_MSG_REPORT_PHYSICAL_ADDR: {
u16 pa = (msg->msg[2] << 8) | msg->msg[3];
case CEC_MSG_USER_CONTROL_PRESSED:
if (!(adap->capabilities & CEC_CAP_RC) ||
!(adap->log_addrs.flags & CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU))
break;
#ifdef CONFIG_MEDIA_CEC_RC
switch (msg->msg[2]) {
/*
* Play function, this message can have variable length
* depending on the specific play function that is used.
*/
case CEC_OP_UI_CMD_PLAY_FUNCTION:
if (msg->len == 2)
rc_keydown(adap->rc, RC_PROTO_CEC,
msg->msg[2], 0);
else
rc_keydown(adap->rc, RC_PROTO_CEC,
msg->msg[2] << 8 | msg->msg[3], 0);
break;
/*
* Other function messages that are not handled.
* Currently the RC framework does not allow to supply an
* additional parameter to a keypress. These "keys" contain
* other information such as channel number, an input number
* etc.
* For the time being these messages are not processed by the
* framework and are simply forwarded to the user space.
*/
case CEC_OP_UI_CMD_SELECT_BROADCAST_TYPE:
case CEC_OP_UI_CMD_SELECT_SOUND_PRESENTATION:
case CEC_OP_UI_CMD_TUNE_FUNCTION:
case CEC_OP_UI_CMD_SELECT_MEDIA_FUNCTION:
case CEC_OP_UI_CMD_SELECT_AV_INPUT_FUNCTION:
case CEC_OP_UI_CMD_SELECT_AUDIO_INPUT_FUNCTION:
break;
default:
rc_keydown(adap->rc, RC_PROTO_CEC, msg->msg[2], 0);
break;
}
#endif
break;
case CEC_MSG_USER_CONTROL_RELEASED:
if (!(adap->capabilities & CEC_CAP_RC) ||
!(adap->log_addrs.flags & CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU))
break;
#ifdef CONFIG_MEDIA_CEC_RC
rc_keyup(adap->rc);
#endif
break;
/*
* The remaining messages are only processed if the passthrough mode
* is off.
*/
case CEC_MSG_GET_CEC_VERSION:
cec_msg_cec_version(&tx_cec_msg, adap->log_addrs.cec_version);
return cec_transmit_msg(adap, &tx_cec_msg, false);
case CEC_MSG_GIVE_PHYSICAL_ADDR:
/* Do nothing for CEC switches using addr 15 */
if (devtype == CEC_OP_PRIM_DEVTYPE_SWITCH && dest_laddr == 15)
return 0;
cec_msg_report_physical_addr(&tx_cec_msg, adap->phys_addr, devtype);
return cec_transmit_msg(adap, &tx_cec_msg, false);
case CEC_MSG_GIVE_DEVICE_VENDOR_ID:
if (adap->log_addrs.vendor_id == CEC_VENDOR_ID_NONE)
return cec_feature_abort(adap, msg);
cec_msg_device_vendor_id(&tx_cec_msg, adap->log_addrs.vendor_id);
return cec_transmit_msg(adap, &tx_cec_msg, false);
case CEC_MSG_ABORT:
/* Do nothing for CEC switches */
if (devtype == CEC_OP_PRIM_DEVTYPE_SWITCH)
return 0;
return cec_feature_refused(adap, msg);
case CEC_MSG_GIVE_OSD_NAME: {
if (adap->log_addrs.osd_name[0] == 0)
return cec_feature_abort(adap, msg);
cec_msg_set_osd_name(&tx_cec_msg, adap->log_addrs.osd_name);
return cec_transmit_msg(adap, &tx_cec_msg, false);
}
case CEC_MSG_GIVE_FEATURES:
if (adap->log_addrs.cec_version < CEC_OP_CEC_VERSION_2_0)
return cec_feature_abort(adap, msg);
cec_fill_msg_report_features(adap, &tx_cec_msg, la_idx);
return cec_transmit_msg(adap, &tx_cec_msg, false);
default:
/*
* Unprocessed messages are aborted if userspace isn't doing
* any processing either.
*/
if (!is_broadcast && !is_reply && !adap->follower_cnt &&
!adap->cec_follower && msg->msg[1] != CEC_MSG_FEATURE_ABORT)
return cec_feature_abort(adap, msg);
break;
}
skip_processing:
/* If this was a reply, then we're done, unless otherwise specified */
if (is_reply && !(msg->flags & CEC_MSG_FL_REPLY_TO_FOLLOWERS))
return 0;
/*
* Send to the exclusive follower if there is one, otherwise send
* to all followers.
*/
if (adap->cec_follower)
cec_queue_msg_fh(adap->cec_follower, msg);
else
cec_queue_msg_followers(adap, msg);
return 0;
}
/*
* Helper functions to keep track of the 'monitor all' use count.
*
* These functions are called with adap->lock held.
*/
int cec_monitor_all_cnt_inc(struct cec_adapter *adap)
{
int ret;
if (adap->monitor_all_cnt++)
return 0;
ret = cec_adap_enable(adap);
if (ret)
adap->monitor_all_cnt--;
return ret;
}
void cec_monitor_all_cnt_dec(struct cec_adapter *adap)
{
if (WARN_ON(!adap->monitor_all_cnt))
return;
if (--adap->monitor_all_cnt)
return;
WARN_ON(call_op(adap, adap_monitor_all_enable, false));
cec_adap_enable(adap);
}
/*
* Helper functions to keep track of the 'monitor pin' use count.
*
* These functions are called with adap->lock held.
*/
int cec_monitor_pin_cnt_inc(struct cec_adapter *adap)
{
int ret;
if (adap->monitor_pin_cnt++)
return 0;
ret = cec_adap_enable(adap);
if (ret)
adap->monitor_pin_cnt--;
return ret;
}
void cec_monitor_pin_cnt_dec(struct cec_adapter *adap)
{
if (WARN_ON(!adap->monitor_pin_cnt))
return;
if (--adap->monitor_pin_cnt)
return;
WARN_ON(call_op(adap, adap_monitor_pin_enable, false));
cec_adap_enable(adap);
}
#ifdef CONFIG_DEBUG_FS
/*
* Log the current state of the CEC adapter.
* Very useful for debugging.
*/
int cec_adap_status(struct seq_file *file, void *priv)
{
struct cec_adapter *adap = dev_get_drvdata(file->private);
struct cec_data *data;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.