Lines Matching full:mbox
77 /* Try to submit a message to the MBOX controller */ in msg_submit()
78 err = chan->mbox->ops->send_data(chan, data); in msg_submit()
88 spin_lock_irqsave(&chan->mbox->poll_hrt_lock, flags); in msg_submit()
89 hrtimer_start(&chan->mbox->poll_hrt, 0, HRTIMER_MODE_REL); in msg_submit()
90 spin_unlock_irqrestore(&chan->mbox->poll_hrt_lock, flags); in msg_submit()
120 struct mbox_controller *mbox = in txdone_hrtimer() local
126 for (i = 0; i < mbox->num_chans; i++) { in txdone_hrtimer()
127 struct mbox_chan *chan = &mbox->chans[i]; in txdone_hrtimer()
130 txdone = chan->mbox->ops->last_tx_done(chan); in txdone_hrtimer()
139 spin_lock_irqsave(&mbox->poll_hrt_lock, flags); in txdone_hrtimer()
141 hrtimer_forward_now(hrtimer, ms_to_ktime(mbox->txpoll_period)); in txdone_hrtimer()
142 spin_unlock_irqrestore(&mbox->poll_hrt_lock, flags); in txdone_hrtimer()
180 dev_err(chan->mbox->dev, in mbox_chan_txdone()
201 dev_err(chan->mbox->dev, "Client can't run the TX ticker\n"); in mbox_client_txdone()
226 if (chan->mbox->ops->peek_data) in mbox_client_peek_data()
227 return chan->mbox->ops->peek_data(chan); in mbox_client_peek_data()
266 dev_err(chan->mbox->dev, "Try increasing MBOX_TX_QUEUE_LEN\n"); in mbox_send_message()
310 if (!chan->mbox->ops->flush) in mbox_flush()
313 ret = chan->mbox->ops->flush(chan, timeout); in mbox_flush()
327 if (chan->cl || !try_module_get(chan->mbox->dev->driver->owner)) { in __mbox_bind_client()
344 if (chan->mbox->ops->startup) { in __mbox_bind_client()
345 ret = chan->mbox->ops->startup(chan); in __mbox_bind_client()
406 struct mbox_controller *mbox; in mbox_request_channel() local
419 "#mbox-cells", index, &spec)) { in mbox_request_channel()
426 list_for_each_entry(mbox, &mbox_cons, node) in mbox_request_channel()
427 if (mbox->dev->of_node == spec.np) { in mbox_request_channel()
428 chan = mbox->of_xlate(mbox, &spec); in mbox_request_channel()
460 index = of_property_match_string(np, "mbox-names", name); in mbox_request_channel_byname()
482 if (chan->mbox->ops->shutdown) in mbox_free_channel()
483 chan->mbox->ops->shutdown(chan); in mbox_free_channel()
492 module_put(chan->mbox->dev->driver->owner); in mbox_free_channel()
498 of_mbox_index_xlate(struct mbox_controller *mbox, in of_mbox_index_xlate() argument
503 if (ind >= mbox->num_chans) in of_mbox_index_xlate()
506 return &mbox->chans[ind]; in of_mbox_index_xlate()
511 * @mbox: Pointer to the mailbox controller.
515 int mbox_controller_register(struct mbox_controller *mbox) in mbox_controller_register() argument
520 if (!mbox || !mbox->dev || !mbox->ops || !mbox->num_chans) in mbox_controller_register()
523 if (mbox->txdone_irq) in mbox_controller_register()
525 else if (mbox->txdone_poll) in mbox_controller_register()
532 if (!mbox->ops->last_tx_done) { in mbox_controller_register()
533 dev_err(mbox->dev, "last_tx_done method is absent\n"); in mbox_controller_register()
537 hrtimer_init(&mbox->poll_hrt, CLOCK_MONOTONIC, in mbox_controller_register()
539 mbox->poll_hrt.function = txdone_hrtimer; in mbox_controller_register()
540 spin_lock_init(&mbox->poll_hrt_lock); in mbox_controller_register()
543 for (i = 0; i < mbox->num_chans; i++) { in mbox_controller_register()
544 struct mbox_chan *chan = &mbox->chans[i]; in mbox_controller_register()
547 chan->mbox = mbox; in mbox_controller_register()
552 if (!mbox->of_xlate) in mbox_controller_register()
553 mbox->of_xlate = of_mbox_index_xlate; in mbox_controller_register()
556 list_add_tail(&mbox->node, &mbox_cons); in mbox_controller_register()
565 * @mbox: Pointer to the mailbox controller.
567 void mbox_controller_unregister(struct mbox_controller *mbox) in mbox_controller_unregister() argument
571 if (!mbox) in mbox_controller_unregister()
576 list_del(&mbox->node); in mbox_controller_unregister()
578 for (i = 0; i < mbox->num_chans; i++) in mbox_controller_unregister()
579 mbox_free_channel(&mbox->chans[i]); in mbox_controller_unregister()
581 if (mbox->txdone_poll) in mbox_controller_unregister()
582 hrtimer_cancel(&mbox->poll_hrt); in mbox_controller_unregister()
590 struct mbox_controller **mbox = res; in __devm_mbox_controller_unregister() local
592 mbox_controller_unregister(*mbox); in __devm_mbox_controller_unregister()
597 struct mbox_controller **mbox = res; in devm_mbox_controller_match() local
599 if (WARN_ON(!mbox || !*mbox)) in devm_mbox_controller_match()
602 return *mbox == data; in devm_mbox_controller_match()
608 * @mbox: mailbox controller being registered
618 struct mbox_controller *mbox) in devm_mbox_controller_register() argument
628 err = mbox_controller_register(mbox); in devm_mbox_controller_register()
635 *ptr = mbox; in devm_mbox_controller_register()
644 * @mbox: mailbox controller being unregistered
651 void devm_mbox_controller_unregister(struct device *dev, struct mbox_controller *mbox) in devm_mbox_controller_unregister() argument
654 devm_mbox_controller_match, mbox)); in devm_mbox_controller_unregister()