Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0+
0002 /*
0003  * Copyright (c) 2016 Allwinnertech Co., Ltd.
0004  * Copyright (C) 2017-2018 Bootlin
0005  *
0006  * Maxime Ripard <maxime.ripard@bootlin.com>
0007  */
0008 
0009 #ifndef _SUN6I_MIPI_DSI_H_
0010 #define _SUN6I_MIPI_DSI_H_
0011 
0012 #include <drm/drm_connector.h>
0013 #include <drm/drm_encoder.h>
0014 #include <drm/drm_mipi_dsi.h>
0015 
0016 #define SUN6I_DSI_TCON_DIV  4
0017 
0018 struct sun6i_dsi {
0019     struct drm_connector    connector;
0020     struct drm_encoder  encoder;
0021     struct mipi_dsi_host    host;
0022 
0023     struct clk      *bus_clk;
0024     struct clk      *mod_clk;
0025     struct regmap       *regs;
0026     struct regulator    *regulator;
0027     struct reset_control    *reset;
0028     struct phy      *dphy;
0029 
0030     struct device       *dev;
0031     struct mipi_dsi_device  *device;
0032     struct drm_device   *drm;
0033     struct drm_panel    *panel;
0034 };
0035 
0036 static inline struct sun6i_dsi *host_to_sun6i_dsi(struct mipi_dsi_host *host)
0037 {
0038     return container_of(host, struct sun6i_dsi, host);
0039 };
0040 
0041 static inline struct sun6i_dsi *connector_to_sun6i_dsi(struct drm_connector *connector)
0042 {
0043     return container_of(connector, struct sun6i_dsi, connector);
0044 };
0045 
0046 static inline struct sun6i_dsi *encoder_to_sun6i_dsi(const struct drm_encoder *encoder)
0047 {
0048     return container_of(encoder, struct sun6i_dsi, encoder);
0049 };
0050 
0051 #endif /* _SUN6I_MIPI_DSI_H_ */