• Home
  • Raw
  • Download

Lines Matching refs:adap

40 	return &fh->adap->devnode;  in cec_devnode_data()
50 struct cec_adapter *adap = fh->adap; in cec_poll() local
55 mutex_lock(&adap->lock); in cec_poll()
56 if (adap->is_configured && in cec_poll()
57 adap->transmit_queue_sz < CEC_MAX_MSG_TX_QUEUE_SZ) in cec_poll()
64 mutex_unlock(&adap->lock); in cec_poll()
68 static bool cec_is_busy(const struct cec_adapter *adap, in cec_is_busy() argument
71 bool valid_initiator = adap->cec_initiator && adap->cec_initiator == fh; in cec_is_busy()
72 bool valid_follower = adap->cec_follower && adap->cec_follower == fh; in cec_is_busy()
83 return adap->cec_initiator || in cec_is_busy()
87 static long cec_adap_g_caps(struct cec_adapter *adap, in cec_adap_g_caps() argument
92 strlcpy(caps.driver, adap->devnode.dev.parent->driver->name, in cec_adap_g_caps()
94 strlcpy(caps.name, adap->name, sizeof(caps.name)); in cec_adap_g_caps()
95 caps.available_log_addrs = adap->available_log_addrs; in cec_adap_g_caps()
96 caps.capabilities = adap->capabilities; in cec_adap_g_caps()
103 static long cec_adap_g_phys_addr(struct cec_adapter *adap, in cec_adap_g_phys_addr() argument
108 mutex_lock(&adap->lock); in cec_adap_g_phys_addr()
109 phys_addr = adap->phys_addr; in cec_adap_g_phys_addr()
110 mutex_unlock(&adap->lock); in cec_adap_g_phys_addr()
133 static long cec_adap_s_phys_addr(struct cec_adapter *adap, struct cec_fh *fh, in cec_adap_s_phys_addr() argument
139 if (!(adap->capabilities & CEC_CAP_PHYS_ADDR)) in cec_adap_s_phys_addr()
147 mutex_lock(&adap->lock); in cec_adap_s_phys_addr()
148 if (cec_is_busy(adap, fh)) in cec_adap_s_phys_addr()
151 __cec_s_phys_addr(adap, phys_addr, block); in cec_adap_s_phys_addr()
152 mutex_unlock(&adap->lock); in cec_adap_s_phys_addr()
156 static long cec_adap_g_log_addrs(struct cec_adapter *adap, in cec_adap_g_log_addrs() argument
161 mutex_lock(&adap->lock); in cec_adap_g_log_addrs()
162 log_addrs = adap->log_addrs; in cec_adap_g_log_addrs()
163 if (!adap->is_configured) in cec_adap_g_log_addrs()
166 mutex_unlock(&adap->lock); in cec_adap_g_log_addrs()
173 static long cec_adap_s_log_addrs(struct cec_adapter *adap, struct cec_fh *fh, in cec_adap_s_log_addrs() argument
179 if (!(adap->capabilities & CEC_CAP_LOG_ADDRS)) in cec_adap_s_log_addrs()
186 mutex_lock(&adap->lock); in cec_adap_s_log_addrs()
187 if (!adap->is_configuring && in cec_adap_s_log_addrs()
188 (!log_addrs.num_log_addrs || !adap->is_configured) && in cec_adap_s_log_addrs()
189 !cec_is_busy(adap, fh)) { in cec_adap_s_log_addrs()
190 err = __cec_s_log_addrs(adap, &log_addrs, block); in cec_adap_s_log_addrs()
192 log_addrs = adap->log_addrs; in cec_adap_s_log_addrs()
194 mutex_unlock(&adap->lock); in cec_adap_s_log_addrs()
202 static long cec_transmit(struct cec_adapter *adap, struct cec_fh *fh, in cec_transmit() argument
208 if (!(adap->capabilities & CEC_CAP_TRANSMIT)) in cec_transmit()
214 if ((adap->log_addrs.flags & CEC_LOG_ADDRS_FL_CDC_ONLY) && in cec_transmit()
218 mutex_lock(&adap->lock); in cec_transmit()
219 if (adap->log_addrs.num_log_addrs == 0) in cec_transmit()
221 else if (adap->is_configuring) in cec_transmit()
223 else if (!adap->is_configured && in cec_transmit()
224 (adap->needs_hpd || msg.msg[0] != 0xf0)) in cec_transmit()
226 else if (cec_is_busy(adap, fh)) in cec_transmit()
229 err = cec_transmit_msg_fh(adap, &msg, fh, block); in cec_transmit()
230 mutex_unlock(&adap->lock); in cec_transmit()
289 static long cec_receive(struct cec_adapter *adap, struct cec_fh *fh, in cec_receive() argument
307 static long cec_dqevent(struct cec_adapter *adap, struct cec_fh *fh, in cec_dqevent() argument
357 static long cec_g_mode(struct cec_adapter *adap, struct cec_fh *fh, in cec_g_mode() argument
367 static long cec_s_mode(struct cec_adapter *adap, struct cec_fh *fh, in cec_s_mode() argument
392 !(adap->capabilities & CEC_CAP_MONITOR_ALL)) { in cec_s_mode()
398 !(adap->capabilities & CEC_CAP_MONITOR_PIN)) { in cec_s_mode()
405 !(adap->capabilities & CEC_CAP_TRANSMIT)) && in cec_s_mode()
423 mutex_lock(&adap->lock); in cec_s_mode()
430 adap->cec_follower && adap->cec_follower != fh) in cec_s_mode()
437 adap->cec_initiator && adap->cec_initiator != fh) in cec_s_mode()
446 err = cec_monitor_all_cnt_inc(adap); in cec_s_mode()
448 cec_monitor_all_cnt_dec(adap); in cec_s_mode()
453 mutex_unlock(&adap->lock); in cec_s_mode()
458 adap->follower_cnt--; in cec_s_mode()
460 adap->monitor_pin_cnt--; in cec_s_mode()
462 adap->follower_cnt++; in cec_s_mode()
468 ev.event = adap->cec_pin_is_high ? CEC_EVENT_PIN_CEC_HIGH : in cec_s_mode()
471 adap->monitor_pin_cnt++; in cec_s_mode()
475 adap->passthrough = in cec_s_mode()
477 adap->cec_follower = fh; in cec_s_mode()
478 } else if (adap->cec_follower == fh) { in cec_s_mode()
479 adap->passthrough = false; in cec_s_mode()
480 adap->cec_follower = NULL; in cec_s_mode()
483 adap->cec_initiator = fh; in cec_s_mode()
484 else if (adap->cec_initiator == fh) in cec_s_mode()
485 adap->cec_initiator = NULL; in cec_s_mode()
488 mutex_unlock(&adap->lock); in cec_s_mode()
496 struct cec_adapter *adap = fh->adap; in cec_ioctl() local
505 return cec_adap_g_caps(adap, parg); in cec_ioctl()
508 return cec_adap_g_phys_addr(adap, parg); in cec_ioctl()
511 return cec_adap_s_phys_addr(adap, fh, block, parg); in cec_ioctl()
514 return cec_adap_g_log_addrs(adap, parg); in cec_ioctl()
517 return cec_adap_s_log_addrs(adap, fh, block, parg); in cec_ioctl()
520 return cec_transmit(adap, fh, block, parg); in cec_ioctl()
523 return cec_receive(adap, fh, block, parg); in cec_ioctl()
526 return cec_dqevent(adap, fh, block, parg); in cec_ioctl()
529 return cec_g_mode(adap, fh, parg); in cec_ioctl()
532 return cec_s_mode(adap, fh, parg); in cec_ioctl()
543 struct cec_adapter *adap = to_cec_adapter(devnode); in cec_open() local
567 fh->adap = adap; in cec_open()
577 !adap->needs_hpd && in cec_open()
578 adap->phys_addr == CEC_PHYS_ADDR_INVALID) { in cec_open()
579 err = adap->ops->adap_enable(adap, true); in cec_open()
589 ev_state.state_change.phys_addr = adap->phys_addr; in cec_open()
590 ev_state.state_change.log_addr_mask = adap->log_addrs.log_addr_mask; in cec_open()
603 struct cec_adapter *adap = to_cec_adapter(devnode); in cec_release() local
607 mutex_lock(&adap->lock); in cec_release()
608 if (adap->cec_initiator == fh) in cec_release()
609 adap->cec_initiator = NULL; in cec_release()
610 if (adap->cec_follower == fh) { in cec_release()
611 adap->cec_follower = NULL; in cec_release()
612 adap->passthrough = false; in cec_release()
615 adap->follower_cnt--; in cec_release()
617 adap->monitor_pin_cnt--; in cec_release()
619 cec_monitor_all_cnt_dec(adap); in cec_release()
620 mutex_unlock(&adap->lock); in cec_release()
625 !adap->needs_hpd && in cec_release()
626 adap->phys_addr == CEC_PHYS_ADDR_INVALID) { in cec_release()
627 WARN_ON(adap->ops->adap_enable(adap, false)); in cec_release()
632 mutex_lock(&adap->lock); in cec_release()
641 mutex_unlock(&adap->lock); in cec_release()