Nico Huber submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved Angel Pons: Looks good to me, approved
soc/intel/common: Hook up GMA ACPI brightness controls

Add framework to hook up the generic src/drivers/intel/gma ACPI
backlight control for platforms using SOC_INTEL_COMMON_BLOCK_GRAPHICS.
Add a weak function to get the struct i915_gpu_controller_info needed
to generate the SSDT, defaulting to NULL, which SoC's will override.

Each SoC will need to override intel_igd_get_controller_info, and
individual boards will need to populate the struct in order for
the backlight control methods to be added to the SSDT.

Change-Id: I993770fdcd0a28cee756df2bd6a795498f175952
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/32549
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
---
M src/soc/intel/common/block/graphics/graphics.c
M src/soc/intel/common/block/include/intelblocks/graphics.h
2 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/src/soc/intel/common/block/graphics/graphics.c b/src/soc/intel/common/block/graphics/graphics.c
index efbc3e7..e1eb6fe 100644
--- a/src/soc/intel/common/block/graphics/graphics.c
+++ b/src/soc/intel/common/block/graphics/graphics.c
@@ -18,6 +18,7 @@
#include <device/mmio.h>
#include <device/pci.h>
#include <device/pci_ids.h>
+#include <drivers/intel/gma/i915.h>
#include <intelblocks/graphics.h>
#include <soc/pci_devs.h>

@@ -32,6 +33,20 @@
pci_dev_init(dev);
}

+__weak const struct i915_gpu_controller_info *
+intel_igd_get_controller_info(struct device *device)
+{
+ return NULL;
+}
+
+static void gma_generate_ssdt(struct device *device)
+{
+ const struct i915_gpu_controller_info *gfx = intel_igd_get_controller_info(device);
+
+ if (gfx)
+ drivers_intel_gma_displays_ssdt_generate(gfx);
+}
+
static int is_graphics_disabled(struct device *dev)
{
/* Check if Graphics PCI device is disabled */
@@ -111,15 +126,16 @@
}

static const struct device_operations graphics_ops = {
- .read_resources = pci_dev_read_resources,
- .set_resources = pci_dev_set_resources,
- .enable_resources = pci_dev_enable_resources,
- .init = graphics_soc_init,
- .ops_pci = &pci_dev_ops_pci,
+ .read_resources = pci_dev_read_resources,
+ .set_resources = pci_dev_set_resources,
+ .enable_resources = pci_dev_enable_resources,
+ .init = graphics_soc_init,
+ .ops_pci = &pci_dev_ops_pci,
#if CONFIG(HAVE_ACPI_TABLES)
- .write_acpi_tables = graphics_soc_write_acpi_opregion,
+ .write_acpi_tables = graphics_soc_write_acpi_opregion,
+ .acpi_fill_ssdt_generator = gma_generate_ssdt,
#endif
- .scan_bus = scan_generic_bus,
+ .scan_bus = scan_generic_bus,
};

static const unsigned short pci_device_ids[] = {
diff --git a/src/soc/intel/common/block/include/intelblocks/graphics.h b/src/soc/intel/common/block/include/intelblocks/graphics.h
index 8e98228..153f9d8 100644
--- a/src/soc/intel/common/block/include/intelblocks/graphics.h
+++ b/src/soc/intel/common/block/include/intelblocks/graphics.h
@@ -44,6 +44,10 @@
uintptr_t graphics_soc_write_acpi_opregion(struct device *device,
uintptr_t current, struct acpi_rsdp *rsdp);

+/* i915 controller info for ACPI backlight controls */
+const struct i915_gpu_controller_info *
+intel_igd_get_controller_info(struct device *device);
+
/* Graphics MMIO register read/write APIs */
uint32_t graphics_gtt_read(unsigned long reg);
void graphics_gtt_write(unsigned long reg, uint32_t data);

To view, visit change 32549. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I993770fdcd0a28cee756df2bd6a795498f175952
Gerrit-Change-Number: 32549
Gerrit-PatchSet: 9
Gerrit-Owner: Matthew Garrett <mjg59@google.com>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Benjamin Doron <benjamin.doron00@gmail.com>
Gerrit-Reviewer: Matt DeVillier <matt.devillier@gmail.com>
Gerrit-Reviewer: Matthew Garrett <mjg59@google.com>
Gerrit-Reviewer: Maxim Polyakov <max.senia.poliak@gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Patrick Rudolph <siro@das-labor.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter@users.sourceforge.net>
Gerrit-CC: Sumeet R Pawnikar <sumeet.r.pawnikar@intel.com>
Gerrit-MessageType: merged