From 7847a54eed29d26696163d3ff4bb241221d21e5e Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Thu, 26 Feb 2026 14:44:39 +0100 Subject: [PATCH] mb/lenovo: Convert PNP device to generic device Convert the hybrid graphics mux into a generic device and give it an alias so that the driver can reference it by name. Change-Id: Icbf6f298cab9e11acc9363daba68f9fbc613e79d Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/91440 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons --- src/drivers/lenovo/hybrid_graphics/chip.h | 4 ---- src/drivers/lenovo/hybrid_graphics/romstage.c | 7 ++++--- src/mainboard/lenovo/t400/variants/t400/overridetree.cb | 2 +- src/mainboard/lenovo/t410/devicetree.cb | 2 +- src/mainboard/lenovo/t420/devicetree.cb | 2 +- src/mainboard/lenovo/t420s/devicetree.cb | 2 +- src/mainboard/lenovo/t520/devicetree.cb | 2 +- src/mainboard/lenovo/t530/devicetree.cb | 2 +- 8 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/drivers/lenovo/hybrid_graphics/chip.h b/src/drivers/lenovo/hybrid_graphics/chip.h index 4a17138552..81d3552e98 100644 --- a/src/drivers/lenovo/hybrid_graphics/chip.h +++ b/src/drivers/lenovo/hybrid_graphics/chip.h @@ -3,10 +3,6 @@ #ifndef _LENOVO_HYBRID_GRAPHICS_CHIP_H_ #define _LENOVO_HYBRID_GRAPHICS_CHIP_H_ -#define HYBRID_GRAPHICS_PORT 0xff - -#define HYBRID_GRAPHICS_DEVICE 0xf - enum hybrid_graphics_req { HYBRID_GRAPHICS_INTEGRATED = 0, HYBRID_GRAPHICS_DISCRETE = 1, diff --git a/src/drivers/lenovo/hybrid_graphics/romstage.c b/src/drivers/lenovo/hybrid_graphics/romstage.c index 10f94439f8..6860c958f3 100644 --- a/src/drivers/lenovo/hybrid_graphics/romstage.c +++ b/src/drivers/lenovo/hybrid_graphics/romstage.c @@ -5,11 +5,14 @@ #include #include #include +#include #include #include "hybrid_graphics.h" #include "chip.h" +WEAK_DEV_PTR(hg_mux); + /* * Returns the hybrid graphics presence and user's card preferences. */ @@ -19,9 +22,7 @@ void early_hybrid_graphics(bool *enable_igd, bool *enable_peg) const struct device *dev; enum hybrid_graphics_req mode; - /* TODO: Use generic device instead of dummy PNP device */ - dev = dev_find_slot_pnp(HYBRID_GRAPHICS_PORT, HYBRID_GRAPHICS_DEVICE); - + dev = DEV_PTR(hg_mux); if (!dev || !dev->chip_info) { printk(BIOS_ERR, "Hybrid graphics: ERROR\n"); *enable_igd = true; diff --git a/src/mainboard/lenovo/t400/variants/t400/overridetree.cb b/src/mainboard/lenovo/t400/variants/t400/overridetree.cb index c3c3b082a5..1e0c3fe100 100644 --- a/src/mainboard/lenovo/t400/variants/t400/overridetree.cb +++ b/src/mainboard/lenovo/t400/variants/t400/overridetree.cb @@ -4,7 +4,7 @@ chip northbridge/intel/gm45 device pci 1f.0 on # LPC bridge subsystemid 0x17aa 0x20f5 chip drivers/lenovo/hybrid_graphics - device pnp ff.f on end # dummy + device generic 0 alias hg_mux on end # dummy register "detect_gpio" = "21" diff --git a/src/mainboard/lenovo/t410/devicetree.cb b/src/mainboard/lenovo/t410/devicetree.cb index 9ba70d79e8..d4af8253e6 100644 --- a/src/mainboard/lenovo/t410/devicetree.cb +++ b/src/mainboard/lenovo/t410/devicetree.cb @@ -134,7 +134,7 @@ chip northbridge/intel/ironlake register "evente_enable" = "0x2d" end chip drivers/lenovo/hybrid_graphics - device pnp ff.f on end # dummy + device generic 0 alias hg_mux on end # dummy register "detect_gpio" = "21" diff --git a/src/mainboard/lenovo/t420/devicetree.cb b/src/mainboard/lenovo/t420/devicetree.cb index 37ac884eb3..4e4d4a0d8e 100644 --- a/src/mainboard/lenovo/t420/devicetree.cb +++ b/src/mainboard/lenovo/t420/devicetree.cb @@ -153,7 +153,7 @@ chip northbridge/intel/sandybridge register "bdc_gpio_lvl" = "0" end chip drivers/lenovo/hybrid_graphics - device pnp ff.f on end # dummy + device generic 0 alias hg_mux on end # dummy register "detect_gpio" = "21" diff --git a/src/mainboard/lenovo/t420s/devicetree.cb b/src/mainboard/lenovo/t420s/devicetree.cb index 335e025c72..4ae67ec3f8 100644 --- a/src/mainboard/lenovo/t420s/devicetree.cb +++ b/src/mainboard/lenovo/t420s/devicetree.cb @@ -145,7 +145,7 @@ chip northbridge/intel/sandybridge register "bdc_gpio_lvl" = "0" end chip drivers/lenovo/hybrid_graphics - device pnp ff.f on end # dummy + device generic 0 alias hg_mux on end # dummy register "detect_gpio" = "21" diff --git a/src/mainboard/lenovo/t520/devicetree.cb b/src/mainboard/lenovo/t520/devicetree.cb index 74605ca081..9456f85bd4 100644 --- a/src/mainboard/lenovo/t520/devicetree.cb +++ b/src/mainboard/lenovo/t520/devicetree.cb @@ -141,7 +141,7 @@ chip northbridge/intel/sandybridge register "bdc_gpio_lvl" = "0" end chip drivers/lenovo/hybrid_graphics - device pnp ff.f on end # dummy + device generic 0 alias hg_mux on end # dummy register "detect_gpio" = "21" diff --git a/src/mainboard/lenovo/t530/devicetree.cb b/src/mainboard/lenovo/t530/devicetree.cb index 944de3dd49..3ca79999f1 100644 --- a/src/mainboard/lenovo/t530/devicetree.cb +++ b/src/mainboard/lenovo/t530/devicetree.cb @@ -121,7 +121,7 @@ chip northbridge/intel/sandybridge register "bdc_gpio_lvl" = "0" end chip drivers/lenovo/hybrid_graphics - device pnp ff.f on end # dummy + device generic 0 alias hg_mux on end # dummy register "detect_gpio" = "21"