2013-08-27 20:12:18 +08:00
|
|
|
/*
|
|
|
|
* Copyright © 2013 Intel Corporation
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
* Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _INTEL_DSI_H
|
|
|
|
#define _INTEL_DSI_H
|
|
|
|
|
|
|
|
#include <drm/drmP.h>
|
|
|
|
#include <drm/drm_crtc.h>
|
2015-01-16 20:27:23 +08:00
|
|
|
#include <drm/drm_mipi_dsi.h>
|
2013-08-27 20:12:18 +08:00
|
|
|
#include "intel_drv.h"
|
|
|
|
|
2014-12-05 16:43:41 +08:00
|
|
|
/* Dual Link support */
|
|
|
|
#define DSI_DUAL_LINK_NONE 0
|
|
|
|
#define DSI_DUAL_LINK_FRONT_BACK 1
|
|
|
|
#define DSI_DUAL_LINK_PIXEL_ALT 2
|
|
|
|
|
2016-02-11 23:03:27 +08:00
|
|
|
int dsi_pixel_format_bpp(int pixel_format);
|
|
|
|
|
2015-01-16 20:27:23 +08:00
|
|
|
struct intel_dsi_host;
|
|
|
|
|
2013-08-27 20:12:18 +08:00
|
|
|
struct intel_dsi {
|
|
|
|
struct intel_encoder base;
|
|
|
|
|
2015-01-23 21:30:56 +08:00
|
|
|
struct drm_panel *panel;
|
2015-01-16 20:27:23 +08:00
|
|
|
struct intel_dsi_host *dsi_hosts[I915_MAX_PORTS];
|
2013-08-27 20:12:18 +08:00
|
|
|
|
2015-06-26 17:02:09 +08:00
|
|
|
/* GPIO Desc for CRC based Panel control */
|
|
|
|
struct gpio_desc *gpio_panel;
|
|
|
|
|
2013-08-27 20:12:18 +08:00
|
|
|
struct intel_connector *attached_connector;
|
|
|
|
|
2014-11-14 22:54:22 +08:00
|
|
|
/* bit mask of ports being driven */
|
|
|
|
u16 ports;
|
|
|
|
|
2013-08-27 20:12:18 +08:00
|
|
|
/* if true, use HS mode, otherwise LP */
|
|
|
|
bool hs;
|
|
|
|
|
|
|
|
/* virtual channel */
|
|
|
|
int channel;
|
|
|
|
|
2014-04-14 13:48:24 +08:00
|
|
|
/* Video mode or command mode */
|
|
|
|
u16 operation_mode;
|
|
|
|
|
2013-08-27 20:12:18 +08:00
|
|
|
/* number of DSI lanes */
|
|
|
|
unsigned int lane_count;
|
|
|
|
|
|
|
|
/* video mode pixel format for MIPI_DSI_FUNC_PRG register */
|
|
|
|
u32 pixel_format;
|
|
|
|
|
|
|
|
/* video mode format for MIPI_VIDEO_MODE_FORMAT register */
|
|
|
|
u32 video_mode_format;
|
|
|
|
|
|
|
|
/* eot for MIPI_EOT_DISABLE register */
|
2014-04-09 16:29:33 +08:00
|
|
|
u8 eotp_pkt;
|
|
|
|
u8 clock_stop;
|
2013-12-10 14:45:00 +08:00
|
|
|
|
2014-04-09 16:29:33 +08:00
|
|
|
u8 escape_clk_div;
|
2014-12-05 16:39:28 +08:00
|
|
|
u8 dual_link;
|
2014-12-05 16:43:41 +08:00
|
|
|
u8 pixel_overlap;
|
2013-12-10 14:45:00 +08:00
|
|
|
u32 port_bits;
|
|
|
|
u32 bw_timer;
|
|
|
|
u32 dphy_reg;
|
|
|
|
u32 video_frmt_cfg_bits;
|
|
|
|
u16 lp_byte_clk;
|
|
|
|
|
|
|
|
/* timeouts in byte clocks */
|
|
|
|
u16 lp_rx_timeout;
|
|
|
|
u16 turn_arnd_val;
|
|
|
|
u16 rst_timer_val;
|
|
|
|
u16 hs_to_lp_count;
|
|
|
|
u16 clk_lp_to_hs_count;
|
|
|
|
u16 clk_hs_to_lp_count;
|
2014-04-14 13:48:25 +08:00
|
|
|
|
|
|
|
u16 init_count;
|
2014-07-30 23:04:57 +08:00
|
|
|
u32 pclk;
|
|
|
|
u16 burst_mode_ratio;
|
2014-04-14 13:48:26 +08:00
|
|
|
|
|
|
|
/* all delays in ms */
|
|
|
|
u16 backlight_off_delay;
|
|
|
|
u16 backlight_on_delay;
|
|
|
|
u16 panel_on_delay;
|
|
|
|
u16 panel_off_delay;
|
|
|
|
u16 panel_pwr_cycle_delay;
|
2013-08-27 20:12:18 +08:00
|
|
|
};
|
|
|
|
|
2015-01-16 20:27:23 +08:00
|
|
|
struct intel_dsi_host {
|
|
|
|
struct mipi_dsi_host base;
|
|
|
|
struct intel_dsi *intel_dsi;
|
|
|
|
enum port port;
|
|
|
|
|
|
|
|
/* our little hack */
|
|
|
|
struct mipi_dsi_device *device;
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline struct intel_dsi_host *to_intel_dsi_host(struct mipi_dsi_host *h)
|
|
|
|
{
|
|
|
|
return container_of(h, struct intel_dsi_host, base);
|
|
|
|
}
|
|
|
|
|
2014-11-14 22:54:21 +08:00
|
|
|
#define for_each_dsi_port(__port, __ports_mask) \
|
|
|
|
for ((__port) = PORT_A; (__port) < I915_MAX_PORTS; (__port)++) \
|
2015-11-25 03:21:56 +08:00
|
|
|
for_each_if ((__ports_mask) & (1 << (__port)))
|
2014-11-14 22:54:21 +08:00
|
|
|
|
2013-08-27 20:12:18 +08:00
|
|
|
static inline struct intel_dsi *enc_to_intel_dsi(struct drm_encoder *encoder)
|
|
|
|
{
|
|
|
|
return container_of(encoder, struct intel_dsi, base.base);
|
|
|
|
}
|
|
|
|
|
2015-09-01 22:11:38 +08:00
|
|
|
extern void intel_enable_dsi_pll(struct intel_encoder *encoder);
|
2015-09-01 22:11:39 +08:00
|
|
|
extern void intel_disable_dsi_pll(struct intel_encoder *encoder);
|
2016-01-08 18:45:39 +08:00
|
|
|
extern u32 intel_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp);
|
2015-09-01 22:11:44 +08:00
|
|
|
extern void intel_dsi_reset_clocks(struct intel_encoder *encoder,
|
|
|
|
enum port port);
|
2013-08-28 04:40:56 +08:00
|
|
|
|
2015-01-23 21:30:56 +08:00
|
|
|
struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id);
|
2014-05-24 00:05:27 +08:00
|
|
|
|
2013-08-27 20:12:18 +08:00
|
|
|
#endif /* _INTEL_DSI_H */
|