Lines Matching refs:mbox

68 		err = chan->mbox->ops->send_data(chan, data);  in msg_submit()
77 scoped_guard(spinlock_irqsave, &chan->mbox->poll_hrt_lock) in msg_submit()
78 hrtimer_start(&chan->mbox->poll_hrt, 0, HRTIMER_MODE_REL); in msg_submit()
107 struct mbox_controller *mbox = in txdone_hrtimer() local
112 for (i = 0; i < mbox->num_chans; i++) { in txdone_hrtimer()
113 struct mbox_chan *chan = &mbox->chans[i]; in txdone_hrtimer()
116 txdone = chan->mbox->ops->last_tx_done(chan); in txdone_hrtimer()
125 scoped_guard(spinlock_irqsave, &mbox->poll_hrt_lock) { in txdone_hrtimer()
127 hrtimer_forward_now(hrtimer, ms_to_ktime(mbox->txpoll_period)); in txdone_hrtimer()
166 dev_err(chan->mbox->dev, in mbox_chan_txdone()
187 dev_err(chan->mbox->dev, "Client can't run the TX ticker\n"); in mbox_client_txdone()
212 if (chan->mbox->ops->peek_data) in mbox_client_peek_data()
213 return chan->mbox->ops->peek_data(chan); in mbox_client_peek_data()
275 dev_err(chan->mbox->dev, "Try increasing MBOX_TX_QUEUE_LEN\n"); in mbox_send_message()
319 if (!chan->mbox->ops->flush) in mbox_flush()
322 ret = chan->mbox->ops->flush(chan, timeout); in mbox_flush()
335 if (chan->cl || !try_module_get(chan->mbox->dev->driver->owner)) { in __mbox_bind_client()
351 if (chan->mbox->ops->startup) { in __mbox_bind_client()
352 ret = chan->mbox->ops->startup(chan); in __mbox_bind_client()
410 struct mbox_controller *mbox; in mbox_request_channel() local
443 list_for_each_entry(mbox, &mbox_cons, node) { in mbox_request_channel()
444 if (device_match_fwnode(mbox->dev, fwspec.fwnode)) { in mbox_request_channel()
445 if (mbox->fw_xlate) { in mbox_request_channel()
446 chan = mbox->fw_xlate(mbox, &fwspec); in mbox_request_channel()
449 } else if (mbox->of_xlate) { in mbox_request_channel()
450 chan = mbox->of_xlate(mbox, &spec); in mbox_request_channel()
495 if (chan->mbox->ops->shutdown) in mbox_free_channel()
496 chan->mbox->ops->shutdown(chan); in mbox_free_channel()
506 module_put(chan->mbox->dev->driver->owner); in mbox_free_channel()
510 static struct mbox_chan *fw_mbox_index_xlate(struct mbox_controller *mbox, in fw_mbox_index_xlate() argument
513 if (sp->nargs < 1 || sp->args[0] >= mbox->num_chans) in fw_mbox_index_xlate()
516 return &mbox->chans[sp->args[0]]; in fw_mbox_index_xlate()
525 int mbox_controller_register(struct mbox_controller *mbox) in mbox_controller_register() argument
529 if (!mbox || !mbox->dev || !mbox->ops || !mbox->chans || !mbox->num_chans) in mbox_controller_register()
532 if (mbox->txdone_irq) in mbox_controller_register()
534 else if (mbox->txdone_poll) in mbox_controller_register()
541 if (!mbox->ops->last_tx_done) { in mbox_controller_register()
542 dev_err(mbox->dev, "last_tx_done method is absent\n"); in mbox_controller_register()
546 hrtimer_setup(&mbox->poll_hrt, txdone_hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); in mbox_controller_register()
547 spin_lock_init(&mbox->poll_hrt_lock); in mbox_controller_register()
550 for (i = 0; i < mbox->num_chans; i++) { in mbox_controller_register()
551 struct mbox_chan *chan = &mbox->chans[i]; in mbox_controller_register()
554 chan->mbox = mbox; in mbox_controller_register()
560 if (!mbox->fw_xlate && !mbox->of_xlate) in mbox_controller_register()
561 mbox->fw_xlate = fw_mbox_index_xlate; in mbox_controller_register()
564 list_add_tail(&mbox->node, &mbox_cons); in mbox_controller_register()
574 void mbox_controller_unregister(struct mbox_controller *mbox) in mbox_controller_unregister() argument
578 if (!mbox) in mbox_controller_unregister()
582 list_del(&mbox->node); in mbox_controller_unregister()
584 for (i = 0; i < mbox->num_chans; i++) in mbox_controller_unregister()
585 mbox_free_channel(&mbox->chans[i]); in mbox_controller_unregister()
587 if (mbox->txdone_poll) in mbox_controller_unregister()
588 hrtimer_cancel(&mbox->poll_hrt); in mbox_controller_unregister()
595 struct mbox_controller **mbox = res; in __devm_mbox_controller_unregister() local
597 mbox_controller_unregister(*mbox); in __devm_mbox_controller_unregister()
613 struct mbox_controller *mbox) in devm_mbox_controller_register() argument
623 err = mbox_controller_register(mbox); in devm_mbox_controller_register()
630 *ptr = mbox; in devm_mbox_controller_register()