Lines Matching +full:mbox +full:- +full:name

1 // SPDX-License-Identifier: GPL-2.0
4 * Author: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
19 struct mbox_controller mbox; member
31 static inline struct mtk_adsp_mbox_priv *get_mtk_adsp_mbox_priv(struct mbox_controller *mbox) in get_mtk_adsp_mbox_priv() argument
33 return container_of(mbox, struct mtk_adsp_mbox_priv, mbox); in get_mtk_adsp_mbox_priv()
39 struct mtk_adsp_mbox_priv *priv = get_mtk_adsp_mbox_priv(chan->mbox); in mtk_adsp_mbox_irq()
40 u32 op = readl(priv->va_mboxreg + priv->cfg->set_out); in mtk_adsp_mbox_irq()
42 writel(op, priv->va_mboxreg + priv->cfg->clr_out); in mtk_adsp_mbox_irq()
56 static struct mbox_chan *mtk_adsp_mbox_xlate(struct mbox_controller *mbox, in mtk_adsp_mbox_xlate() argument
59 return mbox->chans; in mtk_adsp_mbox_xlate()
64 struct mtk_adsp_mbox_priv *priv = get_mtk_adsp_mbox_priv(chan->mbox); in mtk_adsp_mbox_startup()
66 /* Clear ADSP mbox command */ in mtk_adsp_mbox_startup()
67 writel(0xFFFFFFFF, priv->va_mboxreg + priv->cfg->clr_in); in mtk_adsp_mbox_startup()
68 writel(0xFFFFFFFF, priv->va_mboxreg + priv->cfg->clr_out); in mtk_adsp_mbox_startup()
75 struct mtk_adsp_mbox_priv *priv = get_mtk_adsp_mbox_priv(chan->mbox); in mtk_adsp_mbox_shutdown()
77 /* Clear ADSP mbox command */ in mtk_adsp_mbox_shutdown()
78 writel(0xFFFFFFFF, priv->va_mboxreg + priv->cfg->clr_in); in mtk_adsp_mbox_shutdown()
79 writel(0xFFFFFFFF, priv->va_mboxreg + priv->cfg->clr_out); in mtk_adsp_mbox_shutdown()
84 struct mtk_adsp_mbox_priv *priv = get_mtk_adsp_mbox_priv(chan->mbox); in mtk_adsp_mbox_send_data()
87 writel(*msg, priv->va_mboxreg + priv->cfg->set_in); in mtk_adsp_mbox_send_data()
94 struct mtk_adsp_mbox_priv *priv = get_mtk_adsp_mbox_priv(chan->mbox); in mtk_adsp_mbox_last_tx_done()
96 return readl(priv->va_mboxreg + priv->cfg->set_in) == 0; in mtk_adsp_mbox_last_tx_done()
108 struct device *dev = &pdev->dev; in mtk_adsp_mbox_probe()
111 struct mbox_controller *mbox; in mtk_adsp_mbox_probe() local
116 return -ENOMEM; in mtk_adsp_mbox_probe()
118 mbox = &priv->mbox; in mtk_adsp_mbox_probe()
119 mbox->dev = dev; in mtk_adsp_mbox_probe()
120 mbox->ops = &mtk_adsp_mbox_chan_ops; in mtk_adsp_mbox_probe()
121 mbox->txdone_irq = false; in mtk_adsp_mbox_probe()
122 mbox->txdone_poll = true; in mtk_adsp_mbox_probe()
123 mbox->of_xlate = mtk_adsp_mbox_xlate; in mtk_adsp_mbox_probe()
124 mbox->num_chans = 1; in mtk_adsp_mbox_probe()
125 mbox->chans = devm_kzalloc(dev, sizeof(*mbox->chans), GFP_KERNEL); in mtk_adsp_mbox_probe()
126 if (!mbox->chans) in mtk_adsp_mbox_probe()
127 return -ENOMEM; in mtk_adsp_mbox_probe()
129 priv->va_mboxreg = devm_platform_ioremap_resource(pdev, 0); in mtk_adsp_mbox_probe()
130 if (IS_ERR(priv->va_mboxreg)) in mtk_adsp_mbox_probe()
131 return PTR_ERR(priv->va_mboxreg); in mtk_adsp_mbox_probe()
135 return -EINVAL; in mtk_adsp_mbox_probe()
136 priv->cfg = cfg; in mtk_adsp_mbox_probe()
144 dev_name(dev), mbox->chans); in mtk_adsp_mbox_probe()
150 return devm_mbox_controller_register(dev, &priv->mbox); in mtk_adsp_mbox_probe()
168 { .compatible = "mediatek,mt8186-adsp-mbox", .data = &mt8186_adsp_mbox_cfg },
169 { .compatible = "mediatek,mt8195-adsp-mbox", .data = &mt8195_adsp_mbox_cfg },
177 .name = "mtk_adsp_mbox",
183 MODULE_AUTHOR("Allen-KH Cheng <Allen-KH.Cheng@mediatek.com>");