1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 2020 Unisoc Inc.
10 #include <linux/device.h>
11 #include <linux/regmap.h>
12 #include <video/videomode.h>
14 #include <drm/drm_bridge.h>
15 #include <drm/drm_connector.h>
16 #include <drm/drm_encoder.h>
17 #include <drm/drm_mipi_dsi.h>
18 #include <drm/drm_print.h>
19 #include <drm/drm_panel.h>
21 #define encoder_to_dsi(encoder) \
22 container_of(encoder, struct sprd_dsi, encoder)
29 enum video_burst_mode {
30 VIDEO_NON_BURST_WITH_SYNC_PULSES = 0,
31 VIDEO_NON_BURST_WITH_SYNC_EVENTS,
32 VIDEO_BURST_WITH_SYNC_PULSES
35 enum dsi_color_coding {
36 COLOR_CODE_16BIT_CONFIG1 = 0,
37 COLOR_CODE_16BIT_CONFIG2,
38 COLOR_CODE_16BIT_CONFIG3,
39 COLOR_CODE_18BIT_CONFIG1,
40 COLOR_CODE_18BIT_CONFIG2,
42 COLOR_CODE_20BIT_YCC422_LOOSELY,
43 COLOR_CODE_24BIT_YCC422,
44 COLOR_CODE_16BIT_YCC422,
47 COLOR_CODE_12BIT_YCC420,
48 COLOR_CODE_COMPRESSTION,
68 u8 refin; /* Pre-divider control signal */
69 u8 cp_s; /* 00: SDM_EN=1, 10: SDM_EN=0 */
70 u8 fdk_s; /* PLL mode control: integer or fraction */
73 u8 int_n; /* integer N PLL */
74 u32 ref_clk; /* dphy reference clock, unit: MHz */
75 u32 freq; /* panel config, unit: KHz */
78 u32 nint; /* sigma delta modulator NINT control */
79 u32 kint; /* sigma delta modulator KINT control */
80 u8 lpf_sel; /* low pass filter control */
81 u8 out_sel; /* post divider control */
82 u8 vco_band; /* vco range */
88 struct regmap *regmap;
98 /* maximum time (ns) for data lanes from HS to LP */
100 /* maximum time (ns) for data lanes from LP to HS */
102 /* maximum time (ns) for clk lanes from HS to LP */
104 /* maximum time (ns) for clk lanes from LP to HS */
106 /* maximum time (ns) for BTA operation - REQUIRED */
108 /* enable receiving frame ack packets - for video mode */
110 /* enable receiving tear effect ack packets - for cmd mode */
115 struct drm_device *drm;
116 struct mipi_dsi_host host;
117 struct mipi_dsi_device *slave;
118 struct drm_encoder encoder;
119 struct drm_bridge *panel_bridge;
120 struct dsi_context ctx;
123 int dphy_pll_config(struct dsi_context *ctx);
124 void dphy_timing_config(struct dsi_context *ctx);
126 #endif /* __SPRD_DSI_H__ */