Lines Matching +full:audio +full:- +full:ports

1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (C) 2017 - 2020 Xilinx, Inc.
8 * - Hyun Woo Kwon <hyun.kwon@xilinx.com>
9 * - Laurent Pinchart <laurent.pinchart@ideasonboard.com>
13 #include <linux/dma-mapping.h>
31 /* -----------------------------------------------------------------------------
39 if (!dpsub->drm) in zynqmp_dpsub_suspend()
42 return drm_mode_config_helper_suspend(&dpsub->drm->dev); in zynqmp_dpsub_suspend()
49 if (!dpsub->drm) in zynqmp_dpsub_resume()
52 return drm_mode_config_helper_resume(&dpsub->drm->dev); in zynqmp_dpsub_resume()
59 /* -----------------------------------------------------------------------------
64 * zynqmp_dpsub_audio_enabled - If the audio is enabled
67 * Return if the audio is enabled depending on the audio clock.
69 * Return: true if audio is enabled, or false.
73 return !!dpsub->aud_clk; in zynqmp_dpsub_audio_enabled()
77 * zynqmp_dpsub_get_audio_clk_rate - Get the current audio clock rate
80 * Return: the current audio clock rate.
86 return clk_get_rate(dpsub->aud_clk); in zynqmp_dpsub_get_audio_clk_rate()
89 /* -----------------------------------------------------------------------------
97 dpsub->apb_clk = devm_clk_get(dpsub->dev, "dp_apb_clk"); in zynqmp_dpsub_init_clocks()
98 if (IS_ERR(dpsub->apb_clk)) in zynqmp_dpsub_init_clocks()
99 return PTR_ERR(dpsub->apb_clk); in zynqmp_dpsub_init_clocks()
101 ret = clk_prepare_enable(dpsub->apb_clk); in zynqmp_dpsub_init_clocks()
103 dev_err(dpsub->dev, "failed to enable the APB clock\n"); in zynqmp_dpsub_init_clocks()
111 dpsub->vid_clk = devm_clk_get(dpsub->dev, "dp_live_video_in_clk"); in zynqmp_dpsub_init_clocks()
112 if (!IS_ERR(dpsub->vid_clk)) in zynqmp_dpsub_init_clocks()
113 dpsub->vid_clk_from_ps = false; in zynqmp_dpsub_init_clocks()
114 else if (PTR_ERR(dpsub->vid_clk) == -EPROBE_DEFER) in zynqmp_dpsub_init_clocks()
115 return PTR_ERR(dpsub->vid_clk); in zynqmp_dpsub_init_clocks()
117 if (IS_ERR_OR_NULL(dpsub->vid_clk)) { in zynqmp_dpsub_init_clocks()
118 dpsub->vid_clk = devm_clk_get(dpsub->dev, "dp_vtc_pixel_clk_in"); in zynqmp_dpsub_init_clocks()
119 if (IS_ERR(dpsub->vid_clk)) { in zynqmp_dpsub_init_clocks()
120 dev_err(dpsub->dev, "failed to init any video clock\n"); in zynqmp_dpsub_init_clocks()
121 return PTR_ERR(dpsub->vid_clk); in zynqmp_dpsub_init_clocks()
123 dpsub->vid_clk_from_ps = true; in zynqmp_dpsub_init_clocks()
127 * Try the live PL audio clock, and fall back to the PS clock if the in zynqmp_dpsub_init_clocks()
128 * live PL audio clock isn't valid. Missing audio clock disables audio in zynqmp_dpsub_init_clocks()
131 dpsub->aud_clk = devm_clk_get(dpsub->dev, "dp_live_audio_aclk"); in zynqmp_dpsub_init_clocks()
132 if (!IS_ERR(dpsub->aud_clk)) { in zynqmp_dpsub_init_clocks()
133 dpsub->aud_clk_from_ps = false; in zynqmp_dpsub_init_clocks()
137 dpsub->aud_clk = devm_clk_get(dpsub->dev, "dp_aud_clk"); in zynqmp_dpsub_init_clocks()
138 if (!IS_ERR(dpsub->aud_clk)) { in zynqmp_dpsub_init_clocks()
139 dpsub->aud_clk_from_ps = true; in zynqmp_dpsub_init_clocks()
143 dev_info(dpsub->dev, "audio disabled due to missing clock\n"); in zynqmp_dpsub_init_clocks()
154 * ports, consider that only the DP output port is connected if no in zynqmp_dpsub_parse_dt()
155 * ports child no exists. in zynqmp_dpsub_parse_dt()
157 np = of_get_child_by_name(dpsub->dev->of_node, "ports"); in zynqmp_dpsub_parse_dt()
160 dev_warn(dpsub->dev, "missing ports, update DT bindings\n"); in zynqmp_dpsub_parse_dt()
161 dpsub->connected_ports = BIT(ZYNQMP_DPSUB_PORT_OUT_DP); in zynqmp_dpsub_parse_dt()
162 dpsub->dma_enabled = true; in zynqmp_dpsub_parse_dt()
166 /* Check which ports are connected. */ in zynqmp_dpsub_parse_dt()
170 np = of_graph_get_remote_node(dpsub->dev->of_node, i, -1); in zynqmp_dpsub_parse_dt()
172 dpsub->connected_ports |= BIT(i); in zynqmp_dpsub_parse_dt()
178 if ((dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_LIVE_VIDEO)) && in zynqmp_dpsub_parse_dt()
179 (dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_LIVE_GFX))) { in zynqmp_dpsub_parse_dt()
180 dev_err(dpsub->dev, "only one live video input is supported\n"); in zynqmp_dpsub_parse_dt()
181 return -EINVAL; in zynqmp_dpsub_parse_dt()
184 if ((dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_LIVE_VIDEO)) || in zynqmp_dpsub_parse_dt()
185 (dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_LIVE_GFX))) { in zynqmp_dpsub_parse_dt()
186 if (dpsub->vid_clk_from_ps) { in zynqmp_dpsub_parse_dt()
187 dev_err(dpsub->dev, in zynqmp_dpsub_parse_dt()
189 return -EINVAL; in zynqmp_dpsub_parse_dt()
192 dpsub->dma_enabled = true; in zynqmp_dpsub_parse_dt()
195 if (dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_LIVE_AUDIO)) in zynqmp_dpsub_parse_dt()
196 dev_warn(dpsub->dev, "live audio unsupported, ignoring\n"); in zynqmp_dpsub_parse_dt()
198 if ((dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_OUT_VIDEO)) || in zynqmp_dpsub_parse_dt()
199 (dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_OUT_AUDIO))) in zynqmp_dpsub_parse_dt()
200 dev_warn(dpsub->dev, "output to PL unsupported, ignoring\n"); in zynqmp_dpsub_parse_dt()
202 if (!(dpsub->connected_ports & BIT(ZYNQMP_DPSUB_PORT_OUT_DP))) { in zynqmp_dpsub_parse_dt()
203 dev_err(dpsub->dev, "DP output port not connected\n"); in zynqmp_dpsub_parse_dt()
204 return -EINVAL; in zynqmp_dpsub_parse_dt()
212 kfree(dpsub->disp); in zynqmp_dpsub_release()
213 kfree(dpsub->dp); in zynqmp_dpsub_release()
225 return -ENOMEM; in zynqmp_dpsub_probe()
227 dpsub->dev = &pdev->dev; in zynqmp_dpsub_probe()
230 ret = dma_set_mask(dpsub->dev, DMA_BIT_MASK(ZYNQMP_DISP_MAX_DMA_BIT)); in zynqmp_dpsub_probe()
235 of_reserved_mem_device_init(&pdev->dev); in zynqmp_dpsub_probe()
245 pm_runtime_enable(&pdev->dev); in zynqmp_dpsub_probe()
259 drm_bridge_add(dpsub->bridge); in zynqmp_dpsub_probe()
261 if (dpsub->dma_enabled) { in zynqmp_dpsub_probe()
267 dev_info(&pdev->dev, "ZynqMP DisplayPort Subsystem driver probed"); in zynqmp_dpsub_probe()
272 drm_bridge_remove(dpsub->bridge); in zynqmp_dpsub_probe()
277 pm_runtime_disable(&pdev->dev); in zynqmp_dpsub_probe()
278 clk_disable_unprepare(dpsub->apb_clk); in zynqmp_dpsub_probe()
280 of_reserved_mem_device_release(&pdev->dev); in zynqmp_dpsub_probe()
281 if (!dpsub->drm) in zynqmp_dpsub_probe()
290 if (dpsub->drm) in zynqmp_dpsub_remove()
293 drm_bridge_remove(dpsub->bridge); in zynqmp_dpsub_remove()
297 pm_runtime_disable(&pdev->dev); in zynqmp_dpsub_remove()
298 clk_disable_unprepare(dpsub->apb_clk); in zynqmp_dpsub_remove()
299 of_reserved_mem_device_release(&pdev->dev); in zynqmp_dpsub_remove()
301 if (!dpsub->drm) in zynqmp_dpsub_remove()
309 if (!dpsub->drm) in zynqmp_dpsub_shutdown()
312 drm_atomic_helper_shutdown(&dpsub->drm->dev); in zynqmp_dpsub_shutdown()
316 { .compatible = "xlnx,zynqmp-dpsub-1.7", },
326 .name = "zynqmp-dpsub",