Lines Matching refs:mbox
77 err = chan->mbox->ops->send_data(chan, data); in msg_submit()
88 if (!hrtimer_active(&chan->mbox->poll_hrt)) in msg_submit()
89 hrtimer_start(&chan->mbox->poll_hrt, 0, HRTIMER_MODE_REL); in msg_submit()
119 struct mbox_controller *mbox = in txdone_hrtimer() local
124 for (i = 0; i < mbox->num_chans; i++) { in txdone_hrtimer()
125 struct mbox_chan *chan = &mbox->chans[i]; in txdone_hrtimer()
129 txdone = chan->mbox->ops->last_tx_done(chan); in txdone_hrtimer()
136 hrtimer_forward_now(hrtimer, ms_to_ktime(mbox->txpoll_period)); in txdone_hrtimer()
173 dev_err(chan->mbox->dev, in mbox_chan_txdone()
194 dev_err(chan->mbox->dev, "Client can't run the TX ticker\n"); in mbox_client_txdone()
219 if (chan->mbox->ops->peek_data) in mbox_client_peek_data()
220 return chan->mbox->ops->peek_data(chan); in mbox_client_peek_data()
259 dev_err(chan->mbox->dev, "Try increasing MBOX_TX_QUEUE_LEN\n"); in mbox_send_message()
303 if (!chan->mbox->ops->flush) in mbox_flush()
306 ret = chan->mbox->ops->flush(chan, timeout); in mbox_flush()
334 struct mbox_controller *mbox; in mbox_request_channel() local
355 list_for_each_entry(mbox, &mbox_cons, node) in mbox_request_channel()
356 if (mbox->dev->of_node == spec.np) { in mbox_request_channel()
357 chan = mbox->of_xlate(mbox, &spec); in mbox_request_channel()
369 if (chan->cl || !try_module_get(mbox->dev->driver->owner)) { in mbox_request_channel()
387 if (chan->mbox->ops->startup) { in mbox_request_channel()
388 ret = chan->mbox->ops->startup(chan); in mbox_request_channel()
445 if (chan->mbox->ops->shutdown) in mbox_free_channel()
446 chan->mbox->ops->shutdown(chan); in mbox_free_channel()
455 module_put(chan->mbox->dev->driver->owner); in mbox_free_channel()
461 of_mbox_index_xlate(struct mbox_controller *mbox, in of_mbox_index_xlate() argument
466 if (ind >= mbox->num_chans) in of_mbox_index_xlate()
469 return &mbox->chans[ind]; in of_mbox_index_xlate()
478 int mbox_controller_register(struct mbox_controller *mbox) in mbox_controller_register() argument
483 if (!mbox || !mbox->dev || !mbox->ops || !mbox->num_chans) in mbox_controller_register()
486 if (mbox->txdone_irq) in mbox_controller_register()
488 else if (mbox->txdone_poll) in mbox_controller_register()
495 if (!mbox->ops->last_tx_done) { in mbox_controller_register()
496 dev_err(mbox->dev, "last_tx_done method is absent\n"); in mbox_controller_register()
500 hrtimer_init(&mbox->poll_hrt, CLOCK_MONOTONIC, in mbox_controller_register()
502 mbox->poll_hrt.function = txdone_hrtimer; in mbox_controller_register()
505 for (i = 0; i < mbox->num_chans; i++) { in mbox_controller_register()
506 struct mbox_chan *chan = &mbox->chans[i]; in mbox_controller_register()
509 chan->mbox = mbox; in mbox_controller_register()
514 if (!mbox->of_xlate) in mbox_controller_register()
515 mbox->of_xlate = of_mbox_index_xlate; in mbox_controller_register()
518 list_add_tail(&mbox->node, &mbox_cons); in mbox_controller_register()
529 void mbox_controller_unregister(struct mbox_controller *mbox) in mbox_controller_unregister() argument
533 if (!mbox) in mbox_controller_unregister()
538 list_del(&mbox->node); in mbox_controller_unregister()
540 for (i = 0; i < mbox->num_chans; i++) in mbox_controller_unregister()
541 mbox_free_channel(&mbox->chans[i]); in mbox_controller_unregister()
543 if (mbox->txdone_poll) in mbox_controller_unregister()
544 hrtimer_cancel(&mbox->poll_hrt); in mbox_controller_unregister()
552 struct mbox_controller **mbox = res; in __devm_mbox_controller_unregister() local
554 mbox_controller_unregister(*mbox); in __devm_mbox_controller_unregister()
559 struct mbox_controller **mbox = res; in devm_mbox_controller_match() local
561 if (WARN_ON(!mbox || !*mbox)) in devm_mbox_controller_match()
564 return *mbox == data; in devm_mbox_controller_match()
580 struct mbox_controller *mbox) in devm_mbox_controller_register() argument
590 err = mbox_controller_register(mbox); in devm_mbox_controller_register()
597 *ptr = mbox; in devm_mbox_controller_register()
613 void devm_mbox_controller_unregister(struct device *dev, struct mbox_controller *mbox) in devm_mbox_controller_unregister() argument
616 devm_mbox_controller_match, mbox)); in devm_mbox_controller_unregister()