Lines Matching full:mbox
74 /* Try to submit a message to the MBOX controller */ in msg_submit()
75 err = chan->mbox->ops->send_data(chan, data); in msg_submit()
85 spin_lock_irqsave(&chan->mbox->poll_hrt_lock, flags); in msg_submit()
86 hrtimer_start(&chan->mbox->poll_hrt, 0, HRTIMER_MODE_REL); in msg_submit()
87 spin_unlock_irqrestore(&chan->mbox->poll_hrt_lock, flags); in msg_submit()
117 struct mbox_controller *mbox = in txdone_hrtimer() local
123 for (i = 0; i < mbox->num_chans; i++) { in txdone_hrtimer()
124 struct mbox_chan *chan = &mbox->chans[i]; in txdone_hrtimer()
127 txdone = chan->mbox->ops->last_tx_done(chan); in txdone_hrtimer()
136 spin_lock_irqsave(&mbox->poll_hrt_lock, flags); in txdone_hrtimer()
138 hrtimer_forward_now(hrtimer, ms_to_ktime(mbox->txpoll_period)); in txdone_hrtimer()
139 spin_unlock_irqrestore(&mbox->poll_hrt_lock, flags); in txdone_hrtimer()
177 dev_err(chan->mbox->dev, in mbox_chan_txdone()
198 dev_err(chan->mbox->dev, "Client can't run the TX ticker\n"); in mbox_client_txdone()
223 if (chan->mbox->ops->peek_data) in mbox_client_peek_data()
224 return chan->mbox->ops->peek_data(chan); in mbox_client_peek_data()
263 dev_err(chan->mbox->dev, "Try increasing MBOX_TX_QUEUE_LEN\n"); in mbox_send_message()
307 if (!chan->mbox->ops->flush) in mbox_flush()
310 ret = chan->mbox->ops->flush(chan, timeout); in mbox_flush()
324 if (chan->cl || !try_module_get(chan->mbox->dev->driver->owner)) { in __mbox_bind_client()
341 if (chan->mbox->ops->startup) { in __mbox_bind_client()
342 ret = chan->mbox->ops->startup(chan); in __mbox_bind_client()
403 struct mbox_controller *mbox; in mbox_request_channel() local
413 ret = of_parse_phandle_with_args(dev->of_node, "mboxes", "#mbox-cells", in mbox_request_channel()
423 list_for_each_entry(mbox, &mbox_cons, node) in mbox_request_channel()
424 if (mbox->dev->of_node == spec.np) { in mbox_request_channel()
425 chan = mbox->of_xlate(mbox, &spec); in mbox_request_channel()
457 index = of_property_match_string(np, "mbox-names", name); in mbox_request_channel_byname()
479 if (chan->mbox->ops->shutdown) in mbox_free_channel()
480 chan->mbox->ops->shutdown(chan); in mbox_free_channel()
489 module_put(chan->mbox->dev->driver->owner); in mbox_free_channel()
495 of_mbox_index_xlate(struct mbox_controller *mbox, in of_mbox_index_xlate() argument
500 if (ind >= mbox->num_chans) in of_mbox_index_xlate()
503 return &mbox->chans[ind]; in of_mbox_index_xlate()
508 * @mbox: Pointer to the mailbox controller.
512 int mbox_controller_register(struct mbox_controller *mbox) in mbox_controller_register() argument
517 if (!mbox || !mbox->dev || !mbox->ops || !mbox->num_chans) in mbox_controller_register()
520 if (mbox->txdone_irq) in mbox_controller_register()
522 else if (mbox->txdone_poll) in mbox_controller_register()
529 if (!mbox->ops->last_tx_done) { in mbox_controller_register()
530 dev_err(mbox->dev, "last_tx_done method is absent\n"); in mbox_controller_register()
534 hrtimer_setup(&mbox->poll_hrt, txdone_hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); in mbox_controller_register()
535 spin_lock_init(&mbox->poll_hrt_lock); in mbox_controller_register()
538 for (i = 0; i < mbox->num_chans; i++) { in mbox_controller_register()
539 struct mbox_chan *chan = &mbox->chans[i]; in mbox_controller_register()
542 chan->mbox = mbox; in mbox_controller_register()
547 if (!mbox->of_xlate) in mbox_controller_register()
548 mbox->of_xlate = of_mbox_index_xlate; in mbox_controller_register()
551 list_add_tail(&mbox->node, &mbox_cons); in mbox_controller_register()
560 * @mbox: Pointer to the mailbox controller.
562 void mbox_controller_unregister(struct mbox_controller *mbox) in mbox_controller_unregister() argument
566 if (!mbox) in mbox_controller_unregister()
571 list_del(&mbox->node); in mbox_controller_unregister()
573 for (i = 0; i < mbox->num_chans; i++) in mbox_controller_unregister()
574 mbox_free_channel(&mbox->chans[i]); in mbox_controller_unregister()
576 if (mbox->txdone_poll) in mbox_controller_unregister()
577 hrtimer_cancel(&mbox->poll_hrt); in mbox_controller_unregister()
585 struct mbox_controller **mbox = res; in __devm_mbox_controller_unregister() local
587 mbox_controller_unregister(*mbox); in __devm_mbox_controller_unregister()
592 struct mbox_controller **mbox = res; in devm_mbox_controller_match() local
594 if (WARN_ON(!mbox || !*mbox)) in devm_mbox_controller_match()
597 return *mbox == data; in devm_mbox_controller_match()
603 * @mbox: mailbox controller being registered
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()
639 * @mbox: mailbox controller being unregistered
646 void devm_mbox_controller_unregister(struct device *dev, struct mbox_controller *mbox) in devm_mbox_controller_unregister() argument
649 devm_mbox_controller_match, mbox)); in devm_mbox_controller_unregister()