1133add5bSMaxime Ripard // SPDX-License-Identifier: GPL-2.0+ 2133add5bSMaxime Ripard /* 3133add5bSMaxime Ripard * Copyright (c) 2016 Allwinnertech Co., Ltd. 4133add5bSMaxime Ripard * Copyright (C) 2017-2018 Bootlin 5133add5bSMaxime Ripard * 6133add5bSMaxime Ripard * Maxime Ripard <maxime.ripard@bootlin.com> 7133add5bSMaxime Ripard */ 8133add5bSMaxime Ripard 9133add5bSMaxime Ripard #ifndef _SUN6I_MIPI_DSI_H_ 10133add5bSMaxime Ripard #define _SUN6I_MIPI_DSI_H_ 11133add5bSMaxime Ripard 12133add5bSMaxime Ripard #include <drm/drm_connector.h> 13133add5bSMaxime Ripard #include <drm/drm_encoder.h> 14133add5bSMaxime Ripard #include <drm/drm_mipi_dsi.h> 15133add5bSMaxime Ripard 1685fb3526SMaxime Ripard #define SUN6I_DSI_TCON_DIV 4 1785fb3526SMaxime Ripard 18*1fa734a8SSamuel Holland struct sun6i_dsi_variant { 19*1fa734a8SSamuel Holland bool has_mod_clk; 20*1fa734a8SSamuel Holland bool set_mod_clk; 21*1fa734a8SSamuel Holland }; 22*1fa734a8SSamuel Holland 23133add5bSMaxime Ripard struct sun6i_dsi { 24133add5bSMaxime Ripard struct drm_connector connector; 25133add5bSMaxime Ripard struct drm_encoder encoder; 26133add5bSMaxime Ripard struct mipi_dsi_host host; 27133add5bSMaxime Ripard 28133add5bSMaxime Ripard struct clk *bus_clk; 29133add5bSMaxime Ripard struct clk *mod_clk; 30133add5bSMaxime Ripard struct regmap *regs; 311c056ad8SJagan Teki struct regulator *regulator; 32133add5bSMaxime Ripard struct reset_control *reset; 33bb3b6fcbSMaxime Ripard struct phy *dphy; 34133add5bSMaxime Ripard 35133add5bSMaxime Ripard struct device *dev; 36133add5bSMaxime Ripard struct mipi_dsi_device *device; 371a2703bdSSamuel Holland struct drm_device *drm; 38133add5bSMaxime Ripard struct drm_panel *panel; 39*1fa734a8SSamuel Holland 40*1fa734a8SSamuel Holland const struct sun6i_dsi_variant *variant; 41133add5bSMaxime Ripard }; 42133add5bSMaxime Ripard host_to_sun6i_dsi(struct mipi_dsi_host * host)43133add5bSMaxime Ripardstatic inline struct sun6i_dsi *host_to_sun6i_dsi(struct mipi_dsi_host *host) 44133add5bSMaxime Ripard { 45133add5bSMaxime Ripard return container_of(host, struct sun6i_dsi, host); 46133add5bSMaxime Ripard }; 47133add5bSMaxime Ripard connector_to_sun6i_dsi(struct drm_connector * connector)48133add5bSMaxime Ripardstatic inline struct sun6i_dsi *connector_to_sun6i_dsi(struct drm_connector *connector) 49133add5bSMaxime Ripard { 50133add5bSMaxime Ripard return container_of(connector, struct sun6i_dsi, connector); 51133add5bSMaxime Ripard }; 52133add5bSMaxime Ripard encoder_to_sun6i_dsi(const struct drm_encoder * encoder)53133add5bSMaxime Ripardstatic inline struct sun6i_dsi *encoder_to_sun6i_dsi(const struct drm_encoder *encoder) 54133add5bSMaxime Ripard { 55133add5bSMaxime Ripard return container_of(encoder, struct sun6i_dsi, encoder); 56133add5bSMaxime Ripard }; 57133add5bSMaxime Ripard 58133add5bSMaxime Ripard #endif /* _SUN6I_MIPI_DSI_H_ */ 59