1d76271d2SHyun Kwon /* SPDX-License-Identifier: GPL-2.0 */ 2d76271d2SHyun Kwon /* 3d76271d2SHyun Kwon * ZynqMP DPSUB Subsystem Driver 4d76271d2SHyun Kwon * 5d76271d2SHyun Kwon * Copyright (C) 2017 - 2020 Xilinx, Inc. 6d76271d2SHyun Kwon * 7d76271d2SHyun Kwon * Authors: 8d76271d2SHyun Kwon * - Hyun Woo Kwon <hyun.kwon@xilinx.com> 9d76271d2SHyun Kwon * - Laurent Pinchart <laurent.pinchart@ideasonboard.com> 10d76271d2SHyun Kwon */ 11d76271d2SHyun Kwon 12d76271d2SHyun Kwon #ifndef _ZYNQMP_DPSUB_H_ 13d76271d2SHyun Kwon #define _ZYNQMP_DPSUB_H_ 14d76271d2SHyun Kwon 1568dcffeaSLaurent Pinchart #include <drm/drm_crtc.h> 16e8e35733SLaurent Pinchart #include <drm/drm_encoder.h> 1788beb8ccSLaurent Pinchart #include <drm/drm_plane.h> 18e8e35733SLaurent Pinchart 19d76271d2SHyun Kwon struct clk; 20d76271d2SHyun Kwon struct device; 21e8e35733SLaurent Pinchart struct drm_bridge; 22d76271d2SHyun Kwon struct drm_device; 23d76271d2SHyun Kwon struct zynqmp_disp; 24*ee1229b3SLaurent Pinchart struct zynqmp_disp_layer; 25d76271d2SHyun Kwon struct zynqmp_dp; 26d76271d2SHyun Kwon 2788beb8ccSLaurent Pinchart #define ZYNQMP_DPSUB_NUM_LAYERS 2 2888beb8ccSLaurent Pinchart 29d76271d2SHyun Kwon enum zynqmp_dpsub_format { 30d76271d2SHyun Kwon ZYNQMP_DPSUB_FORMAT_RGB, 31d76271d2SHyun Kwon ZYNQMP_DPSUB_FORMAT_YCRCB444, 32d76271d2SHyun Kwon ZYNQMP_DPSUB_FORMAT_YCRCB422, 33d76271d2SHyun Kwon ZYNQMP_DPSUB_FORMAT_YONLY, 34d76271d2SHyun Kwon }; 35d76271d2SHyun Kwon 36d76271d2SHyun Kwon /** 37d76271d2SHyun Kwon * struct zynqmp_dpsub - ZynqMP DisplayPort Subsystem 38d76271d2SHyun Kwon * @drm: The DRM/KMS device 39d76271d2SHyun Kwon * @dev: The physical device 40d76271d2SHyun Kwon * @apb_clk: The APB clock 411682ade6SLaurent Pinchart * @vid_clk: Video clock 421682ade6SLaurent Pinchart * @vid_clk_from_ps: True of the video clock comes from PS, false from PL 43c979296eSLaurent Pinchart * @aud_clk: Audio clock 44c979296eSLaurent Pinchart * @aud_clk_from_ps: True of the audio clock comes from PS, false from PL 4588beb8ccSLaurent Pinchart * @planes: The DRM planes 4668dcffeaSLaurent Pinchart * @crtc: The DRM CRTC 47e8e35733SLaurent Pinchart * @encoder: The dummy DRM encoder 48e8e35733SLaurent Pinchart * @bridge: The DP encoder bridge 49d76271d2SHyun Kwon * @disp: The display controller 50d76271d2SHyun Kwon * @dp: The DisplayPort controller 51d76271d2SHyun Kwon * @dma_align: DMA alignment constraint (must be a power of 2) 52d76271d2SHyun Kwon */ 53d76271d2SHyun Kwon struct zynqmp_dpsub { 54d76271d2SHyun Kwon struct drm_device drm; 55d76271d2SHyun Kwon struct device *dev; 56d76271d2SHyun Kwon 57d76271d2SHyun Kwon struct clk *apb_clk; 581682ade6SLaurent Pinchart struct clk *vid_clk; 591682ade6SLaurent Pinchart bool vid_clk_from_ps; 60c979296eSLaurent Pinchart struct clk *aud_clk; 61c979296eSLaurent Pinchart bool aud_clk_from_ps; 62d76271d2SHyun Kwon 6388beb8ccSLaurent Pinchart struct drm_plane planes[ZYNQMP_DPSUB_NUM_LAYERS]; 6468dcffeaSLaurent Pinchart struct drm_crtc crtc; 65e8e35733SLaurent Pinchart struct drm_encoder encoder; 66e8e35733SLaurent Pinchart struct drm_bridge *bridge; 67e8e35733SLaurent Pinchart 68d76271d2SHyun Kwon struct zynqmp_disp *disp; 69*ee1229b3SLaurent Pinchart struct zynqmp_disp_layer *layers[ZYNQMP_DPSUB_NUM_LAYERS]; 70d76271d2SHyun Kwon struct zynqmp_dp *dp; 71d76271d2SHyun Kwon 72d76271d2SHyun Kwon unsigned int dma_align; 73d76271d2SHyun Kwon }; 74d76271d2SHyun Kwon 75d76271d2SHyun Kwon static inline struct zynqmp_dpsub *to_zynqmp_dpsub(struct drm_device *drm) 76d76271d2SHyun Kwon { 77d76271d2SHyun Kwon return container_of(drm, struct zynqmp_dpsub, drm); 78d76271d2SHyun Kwon } 79d76271d2SHyun Kwon 80c979296eSLaurent Pinchart bool zynqmp_dpsub_audio_enabled(struct zynqmp_dpsub *dpsub); 81c979296eSLaurent Pinchart unsigned int zynqmp_dpsub_get_audio_clk_rate(struct zynqmp_dpsub *dpsub); 82c979296eSLaurent Pinchart 83d76271d2SHyun Kwon #endif /* _ZYNQMP_DPSUB_H_ */ 84