Lines Matching +full:master +full:- +full:dsi
1 // SPDX-License-Identifier: GPL-2.0-only
25 struct mipi_dsi_host dsi; member
31 #define mipi_to_adp(x) container_of(x, struct adp_mipi_drv_private, dsi)
38 ret = readl_poll_timeout(adp->mipi + DSI_CMD_PKT_STATUS, in adp_dsi_gen_pkt_hdr_write()
42 dev_err(adp->dsi.dev, "failed to get available command FIFO\n"); in adp_dsi_gen_pkt_hdr_write()
46 writel(hdr_val, adp->mipi + DSI_GEN_HDR); in adp_dsi_gen_pkt_hdr_write()
49 ret = readl_poll_timeout(adp->mipi + DSI_CMD_PKT_STATUS, in adp_dsi_gen_pkt_hdr_write()
53 dev_err(adp->dsi.dev, "failed to write command FIFO\n"); in adp_dsi_gen_pkt_hdr_write()
63 const u8 *tx_buf = packet->payload; in adp_dsi_write()
64 int len = packet->payload_length, pld_data_bytes = sizeof(u32), ret; in adp_dsi_write()
72 writel(le32_to_cpu(word), adp->mipi + DSI_GEN_PLD_DATA); in adp_dsi_write()
76 writel(le32_to_cpu(word), adp->mipi + DSI_GEN_PLD_DATA); in adp_dsi_write()
78 len -= pld_data_bytes; in adp_dsi_write()
81 ret = readl_poll_timeout(adp->mipi + DSI_CMD_PKT_STATUS, in adp_dsi_write()
85 dev_err(adp->dsi.dev, in adp_dsi_write()
92 memcpy(&word, packet->header, sizeof(packet->header)); in adp_dsi_write()
99 int i, j, ret, len = msg->rx_len; in adp_dsi_read()
100 u8 *buf = msg->rx_buf; in adp_dsi_read()
104 ret = readl_poll_timeout(adp->mipi + DSI_CMD_PKT_STATUS, in adp_dsi_read()
108 dev_err(adp->dsi.dev, "Timeout during read operation\n"); in adp_dsi_read()
114 ret = readl_poll_timeout(adp->mipi + DSI_CMD_PKT_STATUS, in adp_dsi_read()
118 dev_err(adp->dsi.dev, "Read payload FIFO is empty\n"); in adp_dsi_read()
122 val = readl(adp->mipi + DSI_GEN_PLD_DATA); in adp_dsi_read()
139 dev_err(adp->dsi.dev, "failed to create packet: %d\n", ret); in adp_dsi_host_transfer()
147 if (msg->rx_buf && msg->rx_len) { in adp_dsi_host_transfer()
151 nb_bytes = msg->rx_len; in adp_dsi_host_transfer()
159 static int adp_dsi_bind(struct device *dev, struct device *master, void *data) in adp_dsi_bind() argument
164 static void adp_dsi_unbind(struct device *dev, struct device *master, void *data) in adp_dsi_unbind() argument
180 next = devm_drm_of_get_bridge(adp->dsi.dev, adp->dsi.dev->of_node, 1, 0); in adp_dsi_host_attach()
184 adp->next_bridge = next; in adp_dsi_host_attach()
186 drm_bridge_add(&adp->bridge); in adp_dsi_host_attach()
188 ret = component_add(host->dev, &adp_dsi_component_ops); in adp_dsi_host_attach()
191 drm_bridge_remove(&adp->bridge); in adp_dsi_host_attach()
203 component_del(host->dev, &adp_dsi_component_ops); in adp_dsi_host_detach()
204 drm_bridge_remove(&adp->bridge); in adp_dsi_host_detach()
220 return drm_bridge_attach(bridge->encoder, adp->next_bridge, bridge, flags); in adp_dsi_bridge_attach()
231 adp = devm_kzalloc(&pdev->dev, sizeof(*adp), GFP_KERNEL); in adp_mipi_probe()
233 return -ENOMEM; in adp_mipi_probe()
235 adp->mipi = devm_platform_ioremap_resource(pdev, 0); in adp_mipi_probe()
236 if (IS_ERR(adp->mipi)) { in adp_mipi_probe()
237 dev_err(&pdev->dev, "failed to map mipi mmio"); in adp_mipi_probe()
238 return PTR_ERR(adp->mipi); in adp_mipi_probe()
241 adp->dsi.dev = &pdev->dev; in adp_mipi_probe()
242 adp->dsi.ops = &adp_dsi_host_ops; in adp_mipi_probe()
243 adp->bridge.funcs = &adp_dsi_bridge_funcs; in adp_mipi_probe()
244 adp->bridge.of_node = pdev->dev.of_node; in adp_mipi_probe()
245 adp->bridge.type = DRM_MODE_CONNECTOR_DSI; in adp_mipi_probe()
246 dev_set_drvdata(&pdev->dev, adp); in adp_mipi_probe()
247 return mipi_dsi_host_register(&adp->dsi); in adp_mipi_probe()
252 struct device *dev = &pdev->dev; in adp_mipi_remove()
255 mipi_dsi_host_unregister(&adp->dsi); in adp_mipi_remove()
259 { .compatible = "apple,h7-display-pipe-mipi", },
266 .name = "adp-mipi",