Lines Matching refs:mbox
55 struct mbox_controller *mbox; member
97 struct mbox_chan *sti_mbox_to_channel(struct mbox_controller *mbox, in sti_mbox_to_channel() argument
104 for (i = 0; i < mbox->num_chans; i++) { in sti_mbox_to_channel()
105 chan_info = mbox->chans[i].con_priv; in sti_mbox_to_channel()
109 return &mbox->chans[i]; in sti_mbox_to_channel()
112 dev_err(mbox->dev, in sti_mbox_to_channel()
163 struct mbox_controller *mbox = mdev->mbox; in sti_mbox_irq_to_channel() local
179 chan = sti_mbox_to_channel(mbox, instance, channel); in sti_mbox_irq_to_channel()
181 dev_dbg(mbox->dev, in sti_mbox_irq_to_channel()
303 struct mbox_controller *mbox = chan_info->mdev->mbox; in sti_mbox_shutdown_chan() local
306 for (i = 0; i < mbox->num_chans; i++) in sti_mbox_shutdown_chan()
307 if (chan == &mbox->chans[i]) in sti_mbox_shutdown_chan()
310 if (mbox->num_chans == i) { in sti_mbox_shutdown_chan()
311 dev_warn(mbox->dev, "Request to free non-existent channel\n"); in sti_mbox_shutdown_chan()
321 static struct mbox_chan *sti_mbox_xlate(struct mbox_controller *mbox, in sti_mbox_xlate() argument
324 struct sti_mbox_device *mdev = dev_get_drvdata(mbox->dev); in sti_mbox_xlate()
334 dev_err(mbox->dev, in sti_mbox_xlate()
340 for (i = 0; i < mbox->num_chans; i++) { in sti_mbox_xlate()
341 chan_info = mbox->chans[i].con_priv; in sti_mbox_xlate()
345 mbox->dev == chan_info->mdev->dev && in sti_mbox_xlate()
349 dev_err(mbox->dev, "Channel in use\n"); in sti_mbox_xlate()
358 chan = &mbox->chans[i]; in sti_mbox_xlate()
362 dev_err(mbox->dev, "No free channels left\n"); in sti_mbox_xlate()
366 chan_info = devm_kzalloc(mbox->dev, sizeof(*chan_info), GFP_KERNEL); in sti_mbox_xlate()
376 dev_info(mbox->dev, in sti_mbox_xlate()
407 struct mbox_controller *mbox; in sti_mbox_probe() local
435 mbox = devm_kzalloc(&pdev->dev, sizeof(*mbox), GFP_KERNEL); in sti_mbox_probe()
436 if (!mbox) in sti_mbox_probe()
445 mdev->mbox = mbox; in sti_mbox_probe()
450 mbox->txdone_irq = false; in sti_mbox_probe()
451 mbox->txdone_poll = true; in sti_mbox_probe()
452 mbox->txpoll_period = 100; in sti_mbox_probe()
453 mbox->ops = &sti_mbox_ops; in sti_mbox_probe()
454 mbox->dev = mdev->dev; in sti_mbox_probe()
455 mbox->of_xlate = sti_mbox_xlate; in sti_mbox_probe()
456 mbox->chans = chans; in sti_mbox_probe()
457 mbox->num_chans = STI_MBOX_CHAN_MAX; in sti_mbox_probe()
459 ret = devm_mbox_controller_register(&pdev->dev, mbox); in sti_mbox_probe()