Commit 3e6bd011 authored by Shobhit Kumar's avatar Shobhit Kumar Committed by Daniel Vetter

drm/i915: Detect if MIPI panel based on VBT and initialize only if present

It seems by default the VBT has MIPI configuration block as well. The
Generic driver will assume always MIPI if MIPI configuration block is found.
This is causing probelm when actually there is eDP. Fix this by looking
into general definition block which will have device configurations. From here
we can figure out what is the LFP type and initialize MIPI only if MIPI
is found.

v2: Addressed review comments by Damien
    - Moved PORT definitions to intel_bios.h and renamed as DVO_PORT_MIPIA
    - renamed is_mipi to has_mipi and moved definition as suggested
    - Check has_mipi inside parse_mipi and intel_dsi_init insted of outside

v3: Make has_mipi as a bitfield as suggested
Signed-off-by: default avatarShobhit Kumar <shobhit.kumar@intel.com>
Reviewed-by: default avatarDamien Lespiau <damien.lespiau@intel.com>
[danvet: fold in conditions to pack everything neatly below 80 chars.]
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent c98f5062
...@@ -1222,6 +1222,7 @@ struct intel_vbt_data { ...@@ -1222,6 +1222,7 @@ struct intel_vbt_data {
unsigned int lvds_use_ssc:1; unsigned int lvds_use_ssc:1;
unsigned int display_clock_mode:1; unsigned int display_clock_mode:1;
unsigned int fdi_rx_polarity_inverted:1; unsigned int fdi_rx_polarity_inverted:1;
unsigned int has_mipi:1;
int lvds_ssc_freq; int lvds_ssc_freq;
unsigned int bios_lvds_val; /* initial [PCH_]LVDS reg val in VBIOS */ unsigned int bios_lvds_val; /* initial [PCH_]LVDS reg val in VBIOS */
...@@ -1245,6 +1246,7 @@ struct intel_vbt_data { ...@@ -1245,6 +1246,7 @@ struct intel_vbt_data {
/* MIPI DSI */ /* MIPI DSI */
struct { struct {
u16 port;
u16 panel_id; u16 panel_id;
struct mipi_config *config; struct mipi_config *config;
struct mipi_pps_data *pps; struct mipi_pps_data *pps;
......
...@@ -720,6 +720,10 @@ parse_mipi(struct drm_i915_private *dev_priv, struct bdb_header *bdb) ...@@ -720,6 +720,10 @@ parse_mipi(struct drm_i915_private *dev_priv, struct bdb_header *bdb)
int i, panel_id, seq_size; int i, panel_id, seq_size;
u16 block_size; u16 block_size;
/* parse MIPI blocks only if LFP type is MIPI */
if (!dev_priv->vbt.has_mipi)
return;
/* Initialize this to undefined indicating no generic MIPI support */ /* Initialize this to undefined indicating no generic MIPI support */
dev_priv->vbt.dsi.panel_id = MIPI_DSI_UNDEFINED_PANEL_ID; dev_priv->vbt.dsi.panel_id = MIPI_DSI_UNDEFINED_PANEL_ID;
...@@ -1035,6 +1039,15 @@ parse_device_mapping(struct drm_i915_private *dev_priv, ...@@ -1035,6 +1039,15 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
/* skip the device block if device type is invalid */ /* skip the device block if device type is invalid */
continue; continue;
} }
if (p_child->common.dvo_port >= DVO_PORT_MIPIA
&& p_child->common.dvo_port <= DVO_PORT_MIPID
&&p_child->common.device_type & DEVICE_TYPE_MIPI_OUTPUT) {
DRM_DEBUG_KMS("Found MIPI as LFP\n");
dev_priv->vbt.has_mipi = 1;
dev_priv->vbt.dsi.port = p_child->common.dvo_port;
}
child_dev_ptr = dev_priv->vbt.child_dev + count; child_dev_ptr = dev_priv->vbt.child_dev + count;
count++; count++;
memcpy((void *)child_dev_ptr, (void *)p_child, memcpy((void *)child_dev_ptr, (void *)p_child,
......
...@@ -743,6 +743,10 @@ int intel_parse_bios(struct drm_device *dev); ...@@ -743,6 +743,10 @@ int intel_parse_bios(struct drm_device *dev);
#define DVO_PORT_DPC 8 #define DVO_PORT_DPC 8
#define DVO_PORT_DPD 9 #define DVO_PORT_DPD 9
#define DVO_PORT_DPA 10 #define DVO_PORT_DPA 10
#define DVO_PORT_MIPIA 21
#define DVO_PORT_MIPIB 22
#define DVO_PORT_MIPIC 23
#define DVO_PORT_MIPID 24
/* Block 52 contains MIPI Panel info /* Block 52 contains MIPI Panel info
* 6 such enteries will there. Index into correct * 6 such enteries will there. Index into correct
......
...@@ -660,6 +660,10 @@ bool intel_dsi_init(struct drm_device *dev) ...@@ -660,6 +660,10 @@ bool intel_dsi_init(struct drm_device *dev)
DRM_DEBUG_KMS("\n"); DRM_DEBUG_KMS("\n");
/* There is no detection method for MIPI so rely on VBT */
if (!dev_priv->vbt.has_mipi)
return false;
intel_dsi = kzalloc(sizeof(*intel_dsi), GFP_KERNEL); intel_dsi = kzalloc(sizeof(*intel_dsi), GFP_KERNEL);
if (!intel_dsi) if (!intel_dsi)
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment