1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright: 2017 Cadence Design Systems, Inc. 4 * 5 * Author: Boris Brezillon <boris.brezillon@bootlin.com> 6 */ 7 8 #ifndef __CDNS_DSI_H__ 9 #define __CDNS_DSI_H__ 10 11 #include <drm/drm_bridge.h> 12 #include <drm/drm_mipi_dsi.h> 13 14 #include <linux/bits.h> 15 #include <linux/completion.h> 16 #include <linux/phy/phy.h> 17 18 struct clk; 19 struct reset_control; 20 21 struct cdns_dsi_output { 22 struct mipi_dsi_device *dev; 23 struct drm_bridge *bridge; 24 union phy_configure_opts phy_opts; 25 }; 26 27 enum cdns_dsi_input_id { 28 CDNS_SDI_INPUT, 29 CDNS_DPI_INPUT, 30 CDNS_DSC_INPUT, 31 }; 32 33 struct cdns_dsi_cfg { 34 unsigned int hfp; 35 unsigned int hsa; 36 unsigned int hbp; 37 unsigned int hact; 38 unsigned int htotal; 39 }; 40 41 struct cdns_dsi_input { 42 enum cdns_dsi_input_id id; 43 struct drm_bridge bridge; 44 }; 45 46 struct cdns_dsi; 47 48 /** 49 * struct cdns_dsi_platform_ops - CDNS DSI Platform operations 50 * @init: Called in the CDNS DSI probe 51 * @deinit: Called in the CDNS DSI remove 52 * @enable: Called at the beginning of CDNS DSI bridge enable 53 * @disable: Called at the end of CDNS DSI bridge disable 54 */ 55 struct cdns_dsi_platform_ops { 56 int (*init)(struct cdns_dsi *dsi); 57 void (*deinit)(struct cdns_dsi *dsi); 58 void (*enable)(struct cdns_dsi *dsi); 59 void (*disable)(struct cdns_dsi *dsi); 60 }; 61 62 struct cdns_dsi { 63 struct mipi_dsi_host base; 64 void __iomem *regs; 65 #ifdef CONFIG_DRM_CDNS_DSI_J721E 66 void __iomem *j721e_regs; 67 #endif 68 const struct cdns_dsi_platform_ops *platform_ops; 69 struct cdns_dsi_input input; 70 struct cdns_dsi_output output; 71 unsigned int direct_cmd_fifo_depth; 72 unsigned int rx_fifo_depth; 73 struct completion direct_cmd_comp; 74 struct clk *dsi_p_clk; 75 struct reset_control *dsi_p_rst; 76 struct clk *dsi_sys_clk; 77 bool link_initialized; 78 bool phy_initialized; 79 struct phy *dphy; 80 }; 81 82 #endif /* !__CDNS_DSI_H__ */ 83