drm/i915: Detect if MIPI panel based on VBT and initialize only if present
Subsystems (2)
PATCH 1/1 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.
--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_bios.c | 20 +++++++++++++++++++- drivers/gpu/drm/i915/intel_display.c | 4 +++- 3 files changed, 24 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -1229,7 +1229,9 @@ struct intel_vbt_data { } backlight;/* MIPI DSI */ +int is_mipi;struct { +u16 port;u16 panel_id;struct mipi_config *config;struct mipi_pps_data *pps;
drivers/gpu/drm/i915/intel_bios.c +19 -1
@@ -1059,6 +1059,20 @@ parse_device_mapping(struct drm_i915_private *dev_priv,/* skip the device block if device type is invalid */ continue ; } + +#define MIPI_PORT_A 0x15 +#define MIPI_PORT_B 0x16 +#define MIPI_PORT_C 0x17 +#define MIPI_PORT_D 0x18 +if (p_child->common.dvo_port >=MIPI_PORT_A && p_child->common.dvo_port <=MIPI_PORT_D ) { +/* check the device type and confirm its MIPI */ +if (p_child->common.device_type &DEVICE_TYPE_MIPI_OUTPUT ) { +DRM_DEBUG_KMS ("Found MIPI as LFP\n" ); + dev_priv->vbt.is_mipi =1 ; + dev_priv->vbt.dsi.port = p_child->common.dvo_port; + } + } + child_dev_ptr = dev_priv->vbt.child_dev + count; count++; memcpy((void *)child_dev_ptr, (void *)p_child,
@@ -1230,7 +1244,11 @@ intel_parse_bios(struct drm_device *dev)parse_device_mapping (dev_priv, bdb);parse_driver_features (dev_priv, bdb);parse_edp (dev_priv, bdb); -parse_mipi (dev_priv, bdb); + +/* parse MIPI blocks only if LFP type is MIPI */ +if (dev_priv->vbt.is_mipi) +parse_mipi (dev_priv, bdb); +parse_ddi_ports (dev_priv, bdb);if (bios)
drivers/gpu/drm/i915/intel_display.c +3 -1
@@ -11151,7 +11151,9 @@ static void intel_setup_outputs(struct drm_device *dev) } } -intel_dsi_init (dev); +/* There is no detection method for MIPI so rely on VBT */ +if (dev_priv->vbt.is_mipi) +intel_dsi_init (dev); }else if (SUPPORTS_DIGITAL_OUTPUTS (dev)) {bool found = false;
Signature · 1 line
1.8.3.2
Quoted 19 lines · Shobhit Kumar
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.
Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_bios.c | 20 +++++++++++++++++++- drivers/gpu/drm/i915/intel_display.c | 4 +++- 3 files changed, 24 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_drv.h +0
-0
drivers/gpu/drm/i915/i915_drv.h struct intel_vbt_data { · line 1232
Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.h +1
-0@@ -1229,7 +1229,9 @@ struct intel_vbt_data { } backlight;/* MIPI DSI */ +int is_mipi;
There's a "feature" bitfield near the start of the structure, I think you should add that field there and maybe rename it to has_mipi.
drivers/gpu/drm/i915/i915_drv.h struct intel_vbt_data { · line 1234
Quoted 2 lines
drivers/gpu/drm/i915/i915_drv.h +1
-0struct { +u16 port;
We store the port but never use it, is it needed?
Quoted 8 lines
drivers/gpu/drm/i915/i915_drv.h +0
-0u16 panel_id;struct mipi_config *config;struct mipi_pps_data *pps;drivers/gpu/drm/i915/intel_bios.c +0
-0
drivers/gpu/drm/i915/intel_bios.c parse_device_mapping(struct drm_i915_private *dev_priv, · line 1066
Quoted 8 lines
drivers/gpu/drm/i915/intel_bios.c +5
-0@@ -1059,6 +1059,20 @@ parse_device_mapping(struct drm_i915_private *dev_priv,/* skip the device block if device type is invalid */ continue ; } + +#define MIPI_PORT_A 0x15 +#define MIPI_PORT_B 0x16 +#define MIPI_PORT_C 0x17 +#define MIPI_PORT_D 0x18
These should go with the other valid defines for dvo_port in intel_bios.h and be renamed to match, eg. DEVICE_PORT_MIPI_A.
Also this is not what I have in my copy of the VBT documentation, I have (in decimal) MIPI PORT_A = 11, .., PORT_D = 14
Quoted 13 lines
drivers/gpu/drm/i915/intel_bios.c +9
-0+if (p_child->common.dvo_port >=MIPI_PORT_A && p_child->common.dvo_port <=MIPI_PORT_D ) { +/* check the device type and confirm its MIPI */ +if (p_child->common.device_type &DEVICE_TYPE_MIPI_OUTPUT ) { +DRM_DEBUG_KMS ("Found MIPI as LFP\n" ); + dev_priv->vbt.is_mipi =1 ; + dev_priv->vbt.dsi.port = p_child->common.dvo_port; + } + } + child_dev_ptr = dev_priv->vbt.child_dev + count; count++; memcpy((void *)child_dev_ptr, (void *)p_child,
drivers/gpu/drm/i915/intel_bios.c intel_parse_bios(struct drm_device *dev) · line 1250
Quoted 8 lines
drivers/gpu/drm/i915/intel_bios.c +4
-1@@ -1230,7 +1244,11 @@ intel_parse_bios(struct drm_device *dev)parse_device_mapping (dev_priv, bdb);parse_driver_features (dev_priv, bdb);parse_edp (dev_priv, bdb); -parse_mipi (dev_priv, bdb); + +/* parse MIPI blocks only if LFP type is MIPI */ +if (dev_priv->vbt.is_mipi) +parse_mipi (dev_priv, bdb);
Let's put that check inside parse_mipi so we don't break the symetry of those parse_* calls.
Quoted 9 lines
drivers/gpu/drm/i915/intel_bios.c +1
-0+parse_ddi_ports (dev_priv, bdb);if (bios)drivers/gpu/drm/i915/intel_display.c +0
-0
drivers/gpu/drm/i915/intel_display.c static void intel_setup_outputs(struct drm_device *dev) · line 11156
Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c +3
-1@@ -11151,7 +11151,9 @@ static void intel_setup_outputs(struct drm_device *dev) } } -intel_dsi_init (dev); +/* There is no detection method for MIPI so rely on VBT */ +if (dev_priv->vbt.is_mipi) +intel_dsi_init (dev);
Can we have that check inside intel_dsi_init() so we don't have to do it for every platform with DSI?
Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +0
-0}else if (SUPPORTS_DIGITAL_OUTPUTS (dev)) {bool found = false;Signature · 1 line
1.8.3.2
Quoted 22 lines · Damien Lespiau
Quoted 21 lines · Shobhit Kumar
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.
Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_bios.c | 20 +++++++++++++++++++- drivers/gpu/drm/i915/intel_display.c | 4 +++- 3 files changed, 24 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_drv.h +0
-0@@ -1229,7 +1229,9 @@ struct intel_vbt_data { } backlight;
Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.h struct intel_vbt_data { · line 1232
Quoted 2 lines
drivers/gpu/drm/i915/i915_drv.h +1
-0/* MIPI DSI */ +int is_mipi;There's a "feature" bitfield near the start of the structure, I think you should add that field there and maybe rename it to
has_mipi.
will do.
Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.h struct intel_vbt_data { · line 1234
Quoted 3 lines
drivers/gpu/drm/i915/i915_drv.h +1
-0struct { +u16 port;We store the port but never use it, is it needed?
Just wanted to store as we might want to use later while enabling. Shouldn't harm ? In fact we have a need to enable PORT C internally.
Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/i915/i915_drv.h +0
-0u16 panel_id;struct mipi_config *config;struct mipi_pps_data *pps;drivers/gpu/drm/i915/intel_bios.c +0
-0@@ -1059,6 +1059,20 @@ parse_device_mapping(struct drm_i915_private *dev_priv,/* skip the device block if device type is invalid */ continue ; }
Quoted 8 lines
drivers/gpu/drm/i915/intel_bios.c parse_device_mapping(struct drm_i915_private *dev_priv, · line 1066
Quoted 5 lines
drivers/gpu/drm/i915/intel_bios.c +5
-0+ +#define MIPI_PORT_A 0x15 +#define MIPI_PORT_B 0x16 +#define MIPI_PORT_C 0x17 +#define MIPI_PORT_D 0x18These should go with the other valid defines for
dvo_portinintel_bios.hand be renamed to match, eg.DEVICE_PORT_MIPI_A.
Will do
Quoted 3 lines
Also this is not what I have in my copy of the VBT documentation, I have (in decimal) MIPI
PORT_A= 11, ..,PORT_D= 14
What I have say 21..24. Again this is the problem we need to fix.
Quoted 17 lines
Quoted 17 lines
drivers/gpu/drm/i915/intel_bios.c +9
-0+if (p_child->common.dvo_port >=MIPI_PORT_A && p_child->common.dvo_port <=MIPI_PORT_D ) { +/* check the device type and confirm its MIPI */ +if (p_child->common.device_type &DEVICE_TYPE_MIPI_OUTPUT ) { +DRM_DEBUG_KMS ("Found MIPI as LFP\n" ); + dev_priv->vbt.is_mipi =1 ; + dev_priv->vbt.dsi.port = p_child->common.dvo_port; + } + } + child_dev_ptr = dev_priv->vbt.child_dev + count; count++; memcpy((void *)child_dev_ptr, (void *)p_child,@@ -1230,7 +1244,11 @@ intel_parse_bios(struct drm_device *dev)parse_device_mapping (dev_priv, bdb);parse_driver_features (dev_priv, bdb);parse_edp (dev_priv, bdb);
Quoted 8 lines
drivers/gpu/drm/i915/intel_bios.c intel_parse_bios(struct drm_device *dev) · line 1250
Quoted 5 lines
drivers/gpu/drm/i915/intel_bios.c +4
-1-parse_mipi (dev_priv, bdb); + +/* parse MIPI blocks only if LFP type is MIPI */ +if (dev_priv->vbt.is_mipi) +parse_mipi (dev_priv, bdb);Let's put that check inside
parse_mipiso we don't break the symetry of those parse_* calls.
Will do.
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/i915/intel_bios.c +1
-0+parse_ddi_ports (dev_priv, bdb);if (bios)drivers/gpu/drm/i915/intel_display.c +0
-0@@ -11151,7 +11151,9 @@ static void intel_setup_outputs(struct drm_device *dev) } }
Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c static void intel_setup_outputs(struct drm_device *dev) · line 11156
Quoted 4 lines
drivers/gpu/drm/i915/intel_display.c +3
-1-intel_dsi_init (dev); +/* There is no detection method for MIPI so rely on VBT */ +if (dev_priv->vbt.is_mipi) +intel_dsi_init (dev);Can we have that check inside
intel_dsi_init()so we don't have to do it for every platform with DSI?
Will do
regards
Shobhit
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c +0
-1}else if (SUPPORTS_DIGITAL_OUTPUTS (dev)) {bool found = false; --1.8.3.2
Quoted 7 lines · Shobhit
Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.h struct intel_vbt_data { · line 1234
Quoted 2 lines
drivers/gpu/drm/i915/i915_drv.h +1
-0struct { +u16 port;We store the port but never use it, is it needed?
Just wanted to store as we might want to use later while enabling. Shouldn't harm ? In fact we have a need to enable PORT C internally.
Sure, no harm there.
Quoted 4 lines
Quoted 2 lines
Also this is not what I have in my copy of the VBT documentation, I have (in decimal) MIPI
PORT_A= 11, ..,PORT_D= 14What I have say 21..24. Again this is the problem we need to fix.
Mind sending me your version?
Signature · 1 line
Damien
Quoted 8 lines · Shobhit Kumar
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.
Signed-off-by Shobhit Kumar <[email protected]>
Will the mipi patch I've just merged without this one here break machines? If so we need to get this one here into shape asap, for otherwise I need to kick out the mipi patch again. Which we really don't want. -Daniel
Quoted 80 lines
--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_bios.c | 20 +++++++++++++++++++- drivers/gpu/drm/i915/intel_display.c | 4 +++- 3 files changed, 24 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_drv.h +2
-0@@ -1229,7 +1229,9 @@ struct intel_vbt_data { } backlight;/* MIPI DSI */ +int is_mipi;struct { +u16 port;u16 panel_id;struct mipi_config *config;struct mipi_pps_data *pps;drivers/gpu/drm/i915/intel_bios.c +19
-1@@ -1059,6 +1059,20 @@ parse_device_mapping(struct drm_i915_private *dev_priv,/* skip the device block if device type is invalid */ continue ; } + +#define MIPI_PORT_A 0x15 +#define MIPI_PORT_B 0x16 +#define MIPI_PORT_C 0x17 +#define MIPI_PORT_D 0x18 +if (p_child->common.dvo_port >=MIPI_PORT_A && p_child->common.dvo_port <=MIPI_PORT_D ) { +/* check the device type and confirm its MIPI */ +if (p_child->common.device_type &DEVICE_TYPE_MIPI_OUTPUT ) { +DRM_DEBUG_KMS ("Found MIPI as LFP\n" ); + dev_priv->vbt.is_mipi =1 ; + dev_priv->vbt.dsi.port = p_child->common.dvo_port; + } + } + child_dev_ptr = dev_priv->vbt.child_dev + count; count++; memcpy((void *)child_dev_ptr, (void *)p_child,@@ -1230,7 +1244,11 @@ intel_parse_bios(struct drm_device *dev)parse_device_mapping (dev_priv, bdb);parse_driver_features (dev_priv, bdb);parse_edp (dev_priv, bdb); -parse_mipi (dev_priv, bdb); + +/* parse MIPI blocks only if LFP type is MIPI */ +if (dev_priv->vbt.is_mipi) +parse_mipi (dev_priv, bdb); +parse_ddi_ports (dev_priv, bdb);if (bios)drivers/gpu/drm/i915/intel_display.c +3
-1@@ -11151,7 +11151,9 @@ static void intel_setup_outputs(struct drm_device *dev) } } -intel_dsi_init (dev); +/* There is no detection method for MIPI so rely on VBT */ +if (dev_priv->vbt.is_mipi) +intel_dsi_init (dev); }else if (SUPPORTS_DIGITAL_OUTPUTS (dev)) {bool found = false;Signature · 6 lines
1.8.3.2 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 8 lines · Daniel Vetter
Quoted 7 lines · Shobhit Kumar
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.
Quoted 5 lines
Quoted 1 line
Signed-off-by Shobhit Kumar <[email protected]>Will the mipi patch I've just merged without this one here break machines? If so we need to get this one here into shape asap, for otherwise I need to kick out the mipi patch again. Which we really don't want.
Yes it will break. I am working on this patch right now
Regards
Shobhit
Quoted 83 lines
-Daniel
Quoted 80 lines
--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_bios.c | 20 +++++++++++++++++++- drivers/gpu/drm/i915/intel_display.c | 4 +++- 3 files changed, 24 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_drv.h +2
-0@@ -1229,7 +1229,9 @@ struct intel_vbt_data { } backlight;/* MIPI DSI */ +int is_mipi;struct { +u16 port;u16 panel_id;struct mipi_config *config;struct mipi_pps_data *pps;drivers/gpu/drm/i915/intel_bios.c +19
-1@@ -1059,6 +1059,20 @@ parse_device_mapping(struct drm_i915_private *dev_priv,/* skip the device block if device type is invalid */ continue ; } + +#define MIPI_PORT_A 0x15 +#define MIPI_PORT_B 0x16 +#define MIPI_PORT_C 0x17 +#define MIPI_PORT_D 0x18 +if (p_child->common.dvo_port >=MIPI_PORT_A && p_child->common.dvo_port <=MIPI_PORT_D ) { +/* check the device type and confirm its MIPI */ +if (p_child->common.device_type &DEVICE_TYPE_MIPI_OUTPUT ) { +DRM_DEBUG_KMS ("Found MIPI as LFP\n" ); + dev_priv->vbt.is_mipi =1 ; + dev_priv->vbt.dsi.port = p_child->common.dvo_port; + } + } + child_dev_ptr = dev_priv->vbt.child_dev + count; count++; memcpy((void *)child_dev_ptr, (void *)p_child,@@ -1230,7 +1244,11 @@ intel_parse_bios(struct drm_device *dev)parse_device_mapping (dev_priv, bdb);parse_driver_features (dev_priv, bdb);parse_edp (dev_priv, bdb); -parse_mipi (dev_priv, bdb); + +/* parse MIPI blocks only if LFP type is MIPI */ +if (dev_priv->vbt.is_mipi) +parse_mipi (dev_priv, bdb); +parse_ddi_ports (dev_priv, bdb);if (bios)drivers/gpu/drm/i915/intel_display.c +3
-2@@ -11151,7 +11151,9 @@ static void intel_setup_outputs(struct drm_device *dev) } } -intel_dsi_init (dev); +/* There is no detection method for MIPI so rely on VBT */ +if (dev_priv->vbt.is_mipi) +intel_dsi_init (dev); }else if (SUPPORTS_DIGITAL_OUTPUTS (dev)) {bool found = false; --1.8.3.2
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/1 drm/i915: Detect if MIPI panel based on VBT and initialize only if present
In reply to Shobhit KumarIt 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 hs_mipi inside parse_mipi and intel_dsi_init insted of outside
--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_bios.c | 14 ++++++++++++++ drivers/gpu/drm/i915/intel_bios.h | 4 ++++ drivers/gpu/drm/i915/intel_dsi.c | 4 ++++ 4 files changed, 24 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -1209,6 +1209,7 @@ struct intel_vbt_data { unsigned int fdi_rx_polarity_inverted:1;int lvds_ssc_freq;unsigned int bios_lvds_val;/* initial [PCH_]LVDS reg val in VBIOS */ +int has_mipi;enum drrs_support_type drrs_type;
@@ -1230,6 +1231,7 @@ struct intel_vbt_data {/* MIPI DSI */ struct { +u16 port;u16 panel_id;struct mipi_config *config;struct mipi_pps_data *pps;
drivers/gpu/drm/i915/intel_bios.c +14 -0
@@ -744,6 +744,10 @@ parse_mipi(struct drm_i915_private *dev_priv, struct bdb_header *bdb)int i, panel_id, seq_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 */ dev_priv->vbt.dsi.panel_id =MIPI_DSI_UNDEFINED_PANEL_ID ;
@@ -1059,6 +1063,16 @@ parse_device_mapping(struct drm_i915_private *dev_priv,/* skip the device block if device type is invalid */ continue ; } + +if (p_child->common.dvo_port >=DVO_PORT_MIPIA && p_child->common.dvo_port <=DVO_PORT_MIPID ) { +/* check the device type and confirm its MIPI */ +if (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; count++; memcpy((void *)child_dev_ptr, (void *)p_child,
drivers/gpu/drm/i915/intel_bios.h +4 -0
@@ -743,6 +743,10 @@ int intel_parse_bios(struct drm_device *dev);#define DVO_PORT_DPC 8#define DVO_PORT_DPD 9#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 * 6 such enteries will there. Index into correct
drivers/gpu/drm/i915/intel_dsi.c +4 -0
@@ -660,6 +660,10 @@ bool intel_dsi_init(struct drm_device *dev)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 );if (!intel_dsi)return false;
Signature · 1 line
1.8.3.2
Quoted 25 lines · Shobhit Kumar
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 tointel_bios.hand renamed asDVO_PORT_MIPIA
- renamedis_mipitohas_mipiand moved definition as suggested
- Checkhs_mipiinsideparse_mipiandintel_dsi_initinsted of outsideSigned-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_bios.c | 14 ++++++++++++++ drivers/gpu/drm/i915/intel_bios.h | 4 ++++ drivers/gpu/drm/i915/intel_dsi.c | 4 ++++ 4 files changed, 24 insertions(+)drivers/gpu/drm/i915/i915_drv.h +0
-0
drivers/gpu/drm/i915/i915_drv.h struct intel_vbt_data { · line 1212
Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.h +1
-0@@ -1209,6 +1209,7 @@ struct intel_vbt_data { unsigned int fdi_rx_polarity_inverted:1;int lvds_ssc_freq;unsigned int bios_lvds_val;/* initial [PCH_]LVDS reg val in VBIOS */ +int has_mipi;
I meant this can be added in the bitfield (afterfdi_rx_polarity_inverted) so it only takes 1 bit
Otherwise:
--
Damien
PATCH v3 1/1 drm/i915: Detect if MIPI panel based on VBT and initialize only if present
In reply to Shobhit KumarIt 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
--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_bios.c | 14 ++++++++++++++ drivers/gpu/drm/i915/intel_bios.h | 4 ++++ drivers/gpu/drm/i915/intel_dsi.c | 4 ++++ 4 files changed, 24 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -1208,6 +1208,7 @@ struct intel_vbt_data { unsigned int lvds_use_ssc:1; unsigned int display_clock_mode:1; unsigned int fdi_rx_polarity_inverted:1; + unsigned int has_mipi:1;int lvds_ssc_freq;unsigned int bios_lvds_val;/* initial [PCH_]LVDS reg val in VBIOS */
@@ -1231,6 +1232,7 @@ struct intel_vbt_data {/* MIPI DSI */ struct { +u16 port;u16 panel_id;struct mipi_config *config;struct mipi_pps_data *pps;
drivers/gpu/drm/i915/intel_bios.c +14 -0
@@ -744,6 +744,10 @@ parse_mipi(struct drm_i915_private *dev_priv, struct bdb_header *bdb)int i, panel_id, seq_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 */ dev_priv->vbt.dsi.panel_id =MIPI_DSI_UNDEFINED_PANEL_ID ;
@@ -1059,6 +1063,16 @@ parse_device_mapping(struct drm_i915_private *dev_priv,/* skip the device block if device type is invalid */ continue ; } + +if (p_child->common.dvo_port >=DVO_PORT_MIPIA && p_child->common.dvo_port <=DVO_PORT_MIPID ) { +/* check the device type and confirm its MIPI */ +if (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; count++; memcpy((void *)child_dev_ptr, (void *)p_child,
drivers/gpu/drm/i915/intel_bios.h +4 -0
@@ -743,6 +743,10 @@ int intel_parse_bios(struct drm_device *dev);#define DVO_PORT_DPC 8#define DVO_PORT_DPD 9#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 * 6 such enteries will there. Index into correct
drivers/gpu/drm/i915/intel_dsi.c +4 -0
@@ -660,6 +660,10 @@ bool intel_dsi_init(struct drm_device *dev)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 );if (!intel_dsi)return false;
Signature · 1 line
1.8.3.2
Sorry to be such a bore but:
drivers/gpu/drm/i915/intel_dsi.c bool intel_dsi_init(struct drm_device *dev) · line 666
Quoted 10 lines · Shobhit Kumar
drivers/gpu/drm/i915/intel_dsi.c +4
-0@@ -660,6 +660,10 @@ bool intel_dsi_init(struct drm_device *dev)DRM_DEBUG_KMS ("\n" ); +/* There is no detection method for MIPI so rely on VBT */ +if (!dev_priv->vbt.has_mipi) +return false; +
Huum, if we can intel_dsi_init() on VLV, but we don't have a MIPI panel, shouldn't return true here? ie. "intel_dsi_init() was successful, we just don't have a MIPI panel.
Signature · 1 line
Damien
Quoted 9 lines · Damien Lespiau
Sorry to be such a bore but:
Quoted 6 lines · Shobhit Kumar
drivers/gpu/drm/i915/intel_dsi.c +0
-0@@ -660,6 +660,10 @@ bool intel_dsi_init(struct drm_device *dev)DRM_DEBUG_KMS ("\n" );
Quoted 8 lines
drivers/gpu/drm/i915/intel_dsi.c bool intel_dsi_init(struct drm_device *dev) · line 666
Quoted 4 lines
drivers/gpu/drm/i915/intel_dsi.c +4
-0+/* There is no detection method for MIPI so rely on VBT */ +if (!dev_priv->vbt.has_mipi) +return false; +Huum, if we can
intel_dsi_init()on VLV, but we don't have a MIPI panel, shouldn't return true here? ie. "intel_dsi_init()was successful, we just don't have a MIPI panel.
Why does it even have a return value? Either it added the connector and encoder or it didn't.
Signature · 2 lines
Ville Syrjälä Intel OTC
Quoted 19 lines · Ville Syrjälä
Quoted 9 lines · Damien Lespiau
Sorry to be such a bore but:
Quoted 6 lines · Shobhit Kumar
drivers/gpu/drm/i915/intel_dsi.c +0
-0@@ -660,6 +660,10 @@ bool intel_dsi_init(struct drm_device *dev)DRM_DEBUG_KMS ("\n" );Quoted 8 lines
drivers/gpu/drm/i915/intel_dsi.c bool intel_dsi_init(struct drm_device *dev) · line 666
Quoted 4 lines
drivers/gpu/drm/i915/intel_dsi.c +4
-0+/* There is no detection method for MIPI so rely on VBT */ +if (!dev_priv->vbt.has_mipi) +return false; +Huum, if we can
intel_dsi_init()on VLV, but we don't have a MIPI panel, shouldn't return true here? ie. "intel_dsi_init()was successful, we just don't have a MIPI panel.
Quoted 2 lines
Why does it even have a return value? Either it added the connector and encoder or it didn't.
That's even better. I guess we can have a patch on top once this one has landed.
Signature · 1 line
Damien
Quoted 20 lines · Damien Lespiau
Quoted 19 lines · Ville Syrjälä
Quoted 17 lines · Damien Lespiau
Sorry to be such a bore but:
drivers/gpu/drm/i915/intel_dsi.c bool intel_dsi_init(struct drm_device *dev) · line 666
Quoted 10 lines · Shobhit Kumar
drivers/gpu/drm/i915/intel_dsi.c +4
-0@@ -660,6 +660,10 @@ bool intel_dsi_init(struct drm_device *dev)DRM_DEBUG_KMS ("\n" ); +/* There is no detection method for MIPI so rely on VBT */ +if (!dev_priv->vbt.has_mipi) +return false; +Huum, if we can
intel_dsi_init()on VLV, but we don't have a MIPI panel, shouldn't return true here? ie. "intel_dsi_init()was successful, we just don't have a MIPI panel.
Quoted 5 lines
Quoted 2 lines
Why does it even have a return value? Either it added the connector and encoder or it didn't.
That's even better. I guess we can have a patch on top once this one has landed.
dp_init has this since edp init can fail and that decides what we will do with it occasionally. But that's about it wrt reasons for a return value for a encoder init function. Please remove.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 9 lines · Damien Lespiau
Sorry to be such a bore but:
Quoted 6 lines · Shobhit Kumar
drivers/gpu/drm/i915/intel_dsi.c +0
-0@@ -660,6 +660,10 @@ bool intel_dsi_init(struct drm_device *dev)DRM_DEBUG_KMS ("\n" );
Quoted 8 lines
drivers/gpu/drm/i915/intel_dsi.c bool intel_dsi_init(struct drm_device *dev) · line 666
Quoted 4 lines
drivers/gpu/drm/i915/intel_dsi.c +4
-0+/* There is no detection method for MIPI so rely on VBT */ +if (!dev_priv->vbt.has_mipi) +return false; +Huum, if we can
intel_dsi_init()on VLV, but we don't have a MIPI panel, shouldn't return true here? ie. "intel_dsi_init()was successful, we just don't have a MIPI panel.
This check just determines that the design has probably eDP and not MIPI panel attached. Assuming of course that on any design will have either eDP or MIPI as LFP. So I was checking in terms of the OEM design and not platform capability to have DSI.
In fact even in intel_dp_init when in edp_init_connector fails to read DPCD we return false. In fact why we really need to have a return value when we don't even check it and for example intel_dp_init is void intel_dp_init
Regards
Shobhit
Quoted 59 lines · Shobhit Kumar
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 tointel_bios.hand renamed asDVO_PORT_MIPIA
- renamedis_mipitohas_mipiand moved definition as suggested
- Checkhas_mipiinsideparse_mipiandintel_dsi_initinsted of outsidev3: Make
has_mipias a bitfield as suggestedSigned-off-by Shobhit Kumar <[email protected]>Reviewed-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_bios.c | 14 ++++++++++++++ drivers/gpu/drm/i915/intel_bios.h | 4 ++++ drivers/gpu/drm/i915/intel_dsi.c | 4 ++++ 4 files changed, 24 insertions(+)drivers/gpu/drm/i915/i915_drv.h +2
-0@@ -1208,6 +1208,7 @@ struct intel_vbt_data { unsigned int lvds_use_ssc:1; unsigned int display_clock_mode:1; unsigned int fdi_rx_polarity_inverted:1; + unsigned int has_mipi:1;int lvds_ssc_freq;unsigned int bios_lvds_val;/* initial [PCH_]LVDS reg val in VBIOS */ @@ -1231,6 +1232,7 @@ struct intel_vbt_data {/* MIPI DSI */ struct { +u16 port;u16 panel_id;struct mipi_config *config;struct mipi_pps_data *pps;drivers/gpu/drm/i915/intel_bios.c +4
-0@@ -744,6 +744,10 @@ parse_mipi(struct drm_i915_private *dev_priv, struct bdb_header *bdb)int i, panel_id, seq_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 */ dev_priv->vbt.dsi.panel_id =MIPI_DSI_UNDEFINED_PANEL_ID ;
drivers/gpu/drm/i915/intel_bios.c parse_device_mapping(struct drm_i915_private *dev_priv, · line 1067
Quoted 5 lines
drivers/gpu/drm/i915/intel_bios.c +2
-0@@ -1059,6 +1063,16 @@ parse_device_mapping(struct drm_i915_private *dev_priv,/* skip the device block if device type is invalid */ continue ; } + +if (p_child->common.dvo_port >=DVO_PORT_MIPIA && p_child->common.dvo_port <=DVO_PORT_MIPID ) {
checkpatch thinks you should break this line. I agree. And folding in the nested if will make everything neatly fit below 80 chars, so I've done that. Queued for -next, thanks for the patch.
-Daniel
Quoted 48 lines
drivers/gpu/drm/i915/intel_bios.c +8
-0+/* check the device type and confirm its MIPI */ +if (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; count++; memcpy((void *)child_dev_ptr, (void *)p_child,drivers/gpu/drm/i915/intel_bios.h +4
-0@@ -743,6 +743,10 @@ int intel_parse_bios(struct drm_device *dev);#define DVO_PORT_DPC 8#define DVO_PORT_DPD 9#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 * 6 such enteries will there. Index into correct drivers/gpu/drm/i915/intel_dsi.c +4
-0@@ -660,6 +660,10 @@ bool intel_dsi_init(struct drm_device *dev)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 );if (!intel_dsi)return false;Signature · 6 lines
1.8.3.2 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch