Lines Matching refs:mbox
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
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()
492 if (chan->mbox->ops->shutdown) in mbox_free_channel()
493 chan->mbox->ops->shutdown(chan); in mbox_free_channel()
502 module_put(chan->mbox->dev->driver->owner); in mbox_free_channel()
508 of_mbox_index_xlate(struct mbox_controller *mbox, in of_mbox_index_xlate() argument
513 if (ind >= mbox->num_chans) in of_mbox_index_xlate()
516 return &mbox->chans[ind]; in of_mbox_index_xlate()
525 int mbox_controller_register(struct mbox_controller *mbox) in mbox_controller_register() argument
530 if (!mbox || !mbox->dev || !mbox->ops || !mbox->num_chans) in mbox_controller_register()
533 if (mbox->txdone_irq) in mbox_controller_register()
535 else if (mbox->txdone_poll) in mbox_controller_register()
542 if (!mbox->ops->last_tx_done) { in mbox_controller_register()
543 dev_err(mbox->dev, "last_tx_done method is absent\n"); in mbox_controller_register()
547 hrtimer_init(&mbox->poll_hrt, CLOCK_MONOTONIC, in mbox_controller_register()
549 mbox->poll_hrt.function = txdone_hrtimer; in mbox_controller_register()
550 spin_lock_init(&mbox->poll_hrt_lock); in mbox_controller_register()
553 for (i = 0; i < mbox->num_chans; i++) { in mbox_controller_register()
554 struct mbox_chan *chan = &mbox->chans[i]; in mbox_controller_register()
557 chan->mbox = mbox; in mbox_controller_register()
562 if (!mbox->of_xlate) in mbox_controller_register()
563 mbox->of_xlate = of_mbox_index_xlate; in mbox_controller_register()
566 list_add_tail(&mbox->node, &mbox_cons); in mbox_controller_register()
577 void mbox_controller_unregister(struct mbox_controller *mbox) in mbox_controller_unregister() argument
581 if (!mbox) in mbox_controller_unregister()
586 list_del(&mbox->node); in mbox_controller_unregister()
588 for (i = 0; i < mbox->num_chans; i++) in mbox_controller_unregister()
589 mbox_free_channel(&mbox->chans[i]); in mbox_controller_unregister()
591 if (mbox->txdone_poll) in mbox_controller_unregister()
592 hrtimer_cancel(&mbox->poll_hrt); in mbox_controller_unregister()
600 struct mbox_controller **mbox = res; in __devm_mbox_controller_unregister() local
602 mbox_controller_unregister(*mbox); in __devm_mbox_controller_unregister()
607 struct mbox_controller **mbox = res; in devm_mbox_controller_match() local
609 if (WARN_ON(!mbox || !*mbox)) in devm_mbox_controller_match()
612 return *mbox == data; in devm_mbox_controller_match()
628 struct mbox_controller *mbox) in devm_mbox_controller_register() argument
638 err = mbox_controller_register(mbox); in devm_mbox_controller_register()
645 *ptr = mbox; in devm_mbox_controller_register()
661 void devm_mbox_controller_unregister(struct device *dev, struct mbox_controller *mbox) in devm_mbox_controller_unregister() argument
664 devm_mbox_controller_match, mbox)); in devm_mbox_controller_unregister()