1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Copyright (C) STMicroelectronics SA 2017 4 * 5 * Authors: Philippe Cornu <philippe.cornu@st.com> 6 * Yannick Fertre <yannick.fertre@st.com> 7 */ 8 9 #ifndef __DW_MIPI_DSI__ 10 #define __DW_MIPI_DSI__ 11 12 struct dw_mipi_dsi; 13 14 struct dw_mipi_dsi_phy_ops { 15 int (*init)(void *priv_data); 16 int (*get_lane_mbps)(void *priv_data, 17 const struct drm_display_mode *mode, 18 unsigned long mode_flags, u32 lanes, u32 format, 19 unsigned int *lane_mbps); 20 }; 21 22 struct dw_mipi_dsi_host_ops { 23 int (*attach)(void *priv_data, 24 struct mipi_dsi_device *dsi); 25 int (*detach)(void *priv_data, 26 struct mipi_dsi_device *dsi); 27 }; 28 29 struct dw_mipi_dsi_plat_data { 30 void __iomem *base; 31 unsigned int max_data_lanes; 32 33 enum drm_mode_status (*mode_valid)(void *priv_data, 34 const struct drm_display_mode *mode); 35 36 const struct dw_mipi_dsi_phy_ops *phy_ops; 37 const struct dw_mipi_dsi_host_ops *host_ops; 38 39 void *priv_data; 40 }; 41 42 struct dw_mipi_dsi *dw_mipi_dsi_probe(struct platform_device *pdev, 43 const struct dw_mipi_dsi_plat_data 44 *plat_data); 45 void dw_mipi_dsi_remove(struct dw_mipi_dsi *dsi); 46 int dw_mipi_dsi_bind(struct dw_mipi_dsi *dsi, struct drm_encoder *encoder); 47 void dw_mipi_dsi_unbind(struct dw_mipi_dsi *dsi); 48 void dw_mipi_dsi_set_slave(struct dw_mipi_dsi *dsi, struct dw_mipi_dsi *slave); 49 50 #endif /* __DW_MIPI_DSI__ */ 51