diff mbox series

[RFC,05/15] drm/i915: Init vbt fields when read from oprom/spi

Message ID 20240108230517.1497504-6-radhakrishna.sripada@intel.com (mailing list archive)
State New, archived
Headers show
Series VBT read Cleanup | expand

Commit Message

Sripada, Radhakrishna Jan. 8, 2024, 11:05 p.m. UTC
For some platforms where vbt does not reside in opregion,
vbt needs to be cached for debug purposes. Cache them for
future usage.

Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
---
 drivers/gpu/drm/i915/display/intel_bios.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
index 0e09454ba79c..0944802ecbd5 100644
--- a/drivers/gpu/drm/i915/display/intel_bios.c
+++ b/drivers/gpu/drm/i915/display/intel_bios.c
@@ -2994,6 +2994,8 @@  static struct vbt_header *spi_oprom_get_vbt(struct drm_i915_private *i915)
 	if (!intel_bios_is_valid_vbt(vbt, vbt_size))
 		goto err_free_vbt;
 
+	i915->display.vbt.vbt = vbt;
+	i915->display.vbt.vbt_size = vbt_size;
 	drm_dbg_kms(&i915->drm, "Found valid VBT in SPI flash\n");
 
 	return (struct vbt_header *)vbt;
@@ -3053,6 +3055,8 @@  static struct vbt_header *oprom_get_vbt(struct drm_i915_private *i915)
 
 	pci_unmap_rom(pdev, oprom);
 
+	i915->display.vbt.vbt = vbt;
+	i915->display.vbt.vbt_size = vbt_size;
 	drm_dbg_kms(&i915->drm, "Found valid VBT in PCI ROM\n");
 
 	return vbt;
@@ -3134,8 +3138,6 @@  void intel_bios_init(struct drm_i915_private *i915)
 	/* Further processing on pre-parsed or generated child device data */
 	parse_sdvo_device_mapping(i915);
 	parse_ddi_ports(i915);
-
-	kfree(oprom_vbt);
 }
 
 static void intel_bios_init_panel(struct drm_i915_private *i915,
@@ -3207,6 +3209,9 @@  void intel_bios_driver_remove(struct drm_i915_private *i915)
 		list_del(&entry->node);
 		kfree(entry);
 	}
+
+	/* FIXME: Handle vbt free in opregion case. */
+	kfree(vbt->vbt);
 }
 
 void intel_bios_fini_panel(struct intel_panel *panel)