mb/lenovo/t400: Switch to new hybrid graphics driver
Use new hybrid graphics driver to get device state. Move remaining code to romstage.c. Tested on Lenovo T500: * Linux 4.11.4 on Fedora 25 * Integrated (using NGI) * Discrete (using VGA OpROM) * Switchable (using NGI and VGA OpROM), tested with DRI_PRIME No regressions found. Change-Id: Iad2eccaab19c71f11308853ba9326d8186e67c93 Signed-off-by: Patrick Rudolph <siro@das-labor.org> Reviewed-on: https://review.coreboot.org/20793 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
parent
d7dcc44eb9
commit
24680d0902
|
@ -112,14 +112,3 @@ static const struct pci_driver hybrid_peg_nvidia __pci_driver = {
|
||||||
.vendor = PCI_VENDOR_ID_NVIDIA,
|
.vendor = PCI_VENDOR_ID_NVIDIA,
|
||||||
.devices = pci_device_ids_nvidia,
|
.devices = pci_device_ids_nvidia,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const unsigned short pci_device_ids_amd[] = {
|
|
||||||
0x9591, /* ATI Mobility Radeon HD 3650 Lenovo T500/W500 */
|
|
||||||
0x95c4, /* ATI Mobility Radeon HD 3470 Lenovo T400/R400 */
|
|
||||||
0 };
|
|
||||||
|
|
||||||
static const struct pci_driver hybrid_peg_amd __pci_driver = {
|
|
||||||
.ops = &hybrid_graphics_ops,
|
|
||||||
.vendor = PCI_VENDOR_ID_ATI,
|
|
||||||
.devices = pci_device_ids_amd,
|
|
||||||
};
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
|
||||||
select INTEL_INT15
|
select INTEL_INT15
|
||||||
select SUPERIO_NSC_PC87382
|
select SUPERIO_NSC_PC87382
|
||||||
select SUPERIO_NSC_PC87384
|
select SUPERIO_NSC_PC87384
|
||||||
|
select DRIVERS_LENOVO_HYBRID_GRAPHICS
|
||||||
|
|
||||||
config MAINBOARD_DIR
|
config MAINBOARD_DIR
|
||||||
string
|
string
|
||||||
|
|
|
@ -17,5 +17,4 @@ romstage-y += dock.c
|
||||||
|
|
||||||
ramstage-y += dock.c
|
ramstage-y += dock.c
|
||||||
ramstage-y += cstates.c
|
ramstage-y += cstates.c
|
||||||
romstage-y += hybrid_graphics.c
|
|
||||||
ramstage-y += blc.c
|
ramstage-y += blc.c
|
||||||
|
|
|
@ -206,6 +206,25 @@ chip northbridge/intel/gm45
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
chip drivers/lenovo/hybrid_graphics
|
||||||
|
device pnp ff.f on end # dummy
|
||||||
|
|
||||||
|
register "detect_gpio" = "21"
|
||||||
|
|
||||||
|
register "has_panel_hybrid_gpio" = "1"
|
||||||
|
register "panel_hybrid_gpio" = "22"
|
||||||
|
register "panel_integrated_lvl" = "0"
|
||||||
|
|
||||||
|
register "has_backlight_gpio" = "1"
|
||||||
|
register "backlight_gpio" = "19"
|
||||||
|
register "backlight_integrated_lvl" = "0"
|
||||||
|
|
||||||
|
register "has_dgpu_power_gpio" = "1"
|
||||||
|
register "dgpu_power_gpio" = "49"
|
||||||
|
register "dgpu_power_off_lvl" = "0"
|
||||||
|
|
||||||
|
register "has_thinker1" = "0"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
device pci 1f.2 on # SATA/IDE 1
|
device pci 1f.2 on # SATA/IDE 1
|
||||||
subsystemid 0x17aa 0x20f8
|
subsystemid 0x17aa 0x20f8
|
||||||
|
|
|
@ -1,91 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of the coreboot project.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012 secunet Security Networks AG
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation; version 2 of
|
|
||||||
* the License.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*/
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <southbridge/intel/common/gpio.h>
|
|
||||||
#include <northbridge/intel/gm45/gm45.h>
|
|
||||||
#include <console/console.h>
|
|
||||||
#include <option.h>
|
|
||||||
|
|
||||||
#define HYBRID_GRAPHICS_INTEGRATED_ONLY 0
|
|
||||||
#define HYBRID_GRAPHICS_DISCRETE_ONLY 1
|
|
||||||
#define HYBRID_GRAPHICS_SWITCHABLE 2
|
|
||||||
|
|
||||||
#define MUX_GPIO 22
|
|
||||||
#define BCL_CTL_GPIO 19
|
|
||||||
#define GFX_PWR_EN_GPIO 49
|
|
||||||
|
|
||||||
#define HYBRID_DETECT_GPIO 21
|
|
||||||
|
|
||||||
void hybrid_graphics_init(sysinfo_t *sysinfo);
|
|
||||||
|
|
||||||
static bool hybrid_graphics_installed(void)
|
|
||||||
{
|
|
||||||
if (get_gpio(HYBRID_DETECT_GPIO))
|
|
||||||
return false;
|
|
||||||
else
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void hybrid_graphics_init(sysinfo_t *sysinfo)
|
|
||||||
{
|
|
||||||
/* Set default mode */
|
|
||||||
uint8_t hybrid_graphics_mode =
|
|
||||||
HYBRID_GRAPHICS_INTEGRATED_ONLY;
|
|
||||||
|
|
||||||
if (!hybrid_graphics_installed()) {
|
|
||||||
printk(BIOS_DEBUG, "Hybrid graphics not installed.\n");
|
|
||||||
/* The display is not connected to a mux or switchable. */
|
|
||||||
sysinfo->enable_igd = 1;
|
|
||||||
sysinfo->enable_peg = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
printk(BIOS_DEBUG, "Hybrid graphics available: ");
|
|
||||||
get_option(&hybrid_graphics_mode, "hybrid_graphics_mode");
|
|
||||||
|
|
||||||
/* Select appropriate hybrid graphics device */
|
|
||||||
switch (hybrid_graphics_mode) {
|
|
||||||
default:
|
|
||||||
case HYBRID_GRAPHICS_INTEGRATED_ONLY:
|
|
||||||
printk(BIOS_DEBUG, "Activating Integrated Only.\n");
|
|
||||||
set_gpio(MUX_GPIO, GPIO_LEVEL_LOW);
|
|
||||||
set_gpio(BCL_CTL_GPIO, GPIO_LEVEL_LOW);
|
|
||||||
set_gpio(GFX_PWR_EN_GPIO, GPIO_LEVEL_LOW);
|
|
||||||
|
|
||||||
sysinfo->enable_igd = 1;
|
|
||||||
sysinfo->enable_peg = 0;
|
|
||||||
break;
|
|
||||||
case HYBRID_GRAPHICS_DISCRETE_ONLY:
|
|
||||||
printk(BIOS_DEBUG, "Activating Discrete Only.\n");
|
|
||||||
set_gpio(MUX_GPIO, GPIO_LEVEL_HIGH);
|
|
||||||
set_gpio(BCL_CTL_GPIO, GPIO_LEVEL_HIGH);
|
|
||||||
set_gpio(GFX_PWR_EN_GPIO, GPIO_LEVEL_HIGH);
|
|
||||||
|
|
||||||
sysinfo->enable_igd = 0;
|
|
||||||
sysinfo->enable_peg = 1;
|
|
||||||
break;
|
|
||||||
case HYBRID_GRAPHICS_SWITCHABLE:
|
|
||||||
printk(BIOS_DEBUG, "Activating Switchable (both GPUs).\n");
|
|
||||||
set_gpio(MUX_GPIO, GPIO_LEVEL_LOW);
|
|
||||||
set_gpio(BCL_CTL_GPIO, GPIO_LEVEL_LOW);
|
|
||||||
set_gpio(GFX_PWR_EN_GPIO, GPIO_LEVEL_HIGH);
|
|
||||||
|
|
||||||
sysinfo->enable_igd = 1;
|
|
||||||
sysinfo->enable_peg = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <southbridge/intel/i82801ix/i82801ix.h>
|
#include <southbridge/intel/i82801ix/i82801ix.h>
|
||||||
#include <northbridge/intel/gm45/gm45.h>
|
#include <northbridge/intel/gm45/gm45.h>
|
||||||
|
#include <drivers/lenovo/hybrid_graphics/hybrid_graphics.h>
|
||||||
#include <timestamp.h>
|
#include <timestamp.h>
|
||||||
#include "dock.h"
|
#include "dock.h"
|
||||||
#include "gpio.h"
|
#include "gpio.h"
|
||||||
|
@ -38,7 +39,15 @@
|
||||||
#define LPC_DEV PCI_DEV(0, 0x1f, 0)
|
#define LPC_DEV PCI_DEV(0, 0x1f, 0)
|
||||||
#define MCH_DEV PCI_DEV(0, 0, 0)
|
#define MCH_DEV PCI_DEV(0, 0, 0)
|
||||||
|
|
||||||
void hybrid_graphics_init(sysinfo_t *sysinfo);
|
static void hybrid_graphics_init(sysinfo_t *sysinfo)
|
||||||
|
{
|
||||||
|
bool peg, igd;
|
||||||
|
|
||||||
|
early_hybrid_graphics(&igd, &peg);
|
||||||
|
|
||||||
|
sysinfo->enable_igd = igd;
|
||||||
|
sysinfo->enable_peg = peg;
|
||||||
|
}
|
||||||
|
|
||||||
static void early_lpc_setup(void)
|
static void early_lpc_setup(void)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue