linux/include/drm/bridge/dw_mipi_dsi.h
<<
>>
Prefs
   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#include <linux/types.h>
  13
  14#include <drm/drm_modes.h>
  15
  16struct drm_display_mode;
  17struct drm_encoder;
  18struct dw_mipi_dsi;
  19struct mipi_dsi_device;
  20struct platform_device;
  21
  22struct dw_mipi_dsi_dphy_timing {
  23        u16 data_hs2lp;
  24        u16 data_lp2hs;
  25        u16 clk_hs2lp;
  26        u16 clk_lp2hs;
  27};
  28
  29struct dw_mipi_dsi_phy_ops {
  30        int (*init)(void *priv_data);
  31        void (*power_on)(void *priv_data);
  32        void (*power_off)(void *priv_data);
  33        int (*get_lane_mbps)(void *priv_data,
  34                             const struct drm_display_mode *mode,
  35                             unsigned long mode_flags, u32 lanes, u32 format,
  36                             unsigned int *lane_mbps);
  37        int (*get_timing)(void *priv_data, unsigned int lane_mbps,
  38                          struct dw_mipi_dsi_dphy_timing *timing);
  39        int (*get_esc_clk_rate)(void *priv_data, unsigned int *esc_clk_rate);
  40};
  41
  42struct dw_mipi_dsi_host_ops {
  43        int (*attach)(void *priv_data,
  44                      struct mipi_dsi_device *dsi);
  45        int (*detach)(void *priv_data,
  46                      struct mipi_dsi_device *dsi);
  47};
  48
  49struct dw_mipi_dsi_plat_data {
  50        void __iomem *base;
  51        unsigned int max_data_lanes;
  52
  53        enum drm_mode_status (*mode_valid)(void *priv_data,
  54                                           const struct drm_display_mode *mode);
  55
  56        const struct dw_mipi_dsi_phy_ops *phy_ops;
  57        const struct dw_mipi_dsi_host_ops *host_ops;
  58
  59        void *priv_data;
  60};
  61
  62struct dw_mipi_dsi *dw_mipi_dsi_probe(struct platform_device *pdev,
  63                                      const struct dw_mipi_dsi_plat_data
  64                                      *plat_data);
  65void dw_mipi_dsi_remove(struct dw_mipi_dsi *dsi);
  66int dw_mipi_dsi_bind(struct dw_mipi_dsi *dsi, struct drm_encoder *encoder);
  67void dw_mipi_dsi_unbind(struct dw_mipi_dsi *dsi);
  68void dw_mipi_dsi_set_slave(struct dw_mipi_dsi *dsi, struct dw_mipi_dsi *slave);
  69
  70#endif /* __DW_MIPI_DSI__ */
  71