ec/lenovo/h8: Reintroduce h8_mb_init() for specific boards
Mainboard specific dock-init mechanism introduced https://review.coreboot.org/c/coreboot/+/36093 works on most boards, but https://ticket.coreboot.org/issues/256 shows that some boards (e.g. x201 and t410) need communication with h8 EC to enable or disable dock, (in dock_connect() and dock_disconnect() respectively) so they must be done after the h8 EC is brought up, which is not garanteed in the above mainboard specific dock-init mechanism. This time, a hook function h8_mb_init() will be called at the end of h8_enable(). (in place of the ancient h8_mainboard_init_dock() removed in CB:36093) Its default implementation is a weak empty function, but could be overrided with a strong one for boards needing to perform actions which should be done after h8 EC is brought up. This should fix the regression detected in https://ticket.coreboot.org/issues/256 Change-Id: I3674fbfeab2ea2cd2a4453a8e77521157d553388 Signed-off-by: Bill XIE <persmule@hardenedlinux.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/39708 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Rudolph <siro@das-labor.org>
This commit is contained in:
parent
702cf30e98
commit
4611ad8930
|
@ -221,6 +221,8 @@ struct device_operations h8_dev_ops = {
|
||||||
.init = h8_init,
|
.init = h8_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void __weak h8_mb_init(void){ /* NOOP */ }
|
||||||
|
|
||||||
static void h8_enable(struct device *dev)
|
static void h8_enable(struct device *dev)
|
||||||
{
|
{
|
||||||
struct ec_lenovo_h8_config *conf = dev->chip_info;
|
struct ec_lenovo_h8_config *conf = dev->chip_info;
|
||||||
|
@ -340,6 +342,7 @@ static void h8_enable(struct device *dev)
|
||||||
h8_charge_priority(val);
|
h8_charge_priority(val);
|
||||||
|
|
||||||
h8_set_audio_mute(0);
|
h8_set_audio_mute(0);
|
||||||
|
h8_mb_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct chip_operations ec_lenovo_h8_ops = {
|
struct chip_operations ec_lenovo_h8_ops = {
|
||||||
|
|
|
@ -35,6 +35,11 @@ bool h8_wwan_nv_enable(void);
|
||||||
bool h8_has_wwan(const struct device *dev);
|
bool h8_has_wwan(const struct device *dev);
|
||||||
|
|
||||||
void h8_ssdt_generator(const struct device *dev);
|
void h8_ssdt_generator(const struct device *dev);
|
||||||
|
/*
|
||||||
|
* boards needing specific h8-related inits could override it
|
||||||
|
*/
|
||||||
|
void h8_mb_init(void);
|
||||||
|
|
||||||
|
|
||||||
/* EC registers */
|
/* EC registers */
|
||||||
#define H8_CONFIG0 0x00
|
#define H8_CONFIG0 0x00
|
||||||
|
|
|
@ -7,14 +7,15 @@
|
||||||
#include <ec/lenovo/h8/h8.h>
|
#include <ec/lenovo/h8/h8.h>
|
||||||
#include <ec/acpi/ec.h>
|
#include <ec/acpi/ec.h>
|
||||||
|
|
||||||
void init_dock(void)
|
void h8_mb_init(void)
|
||||||
{
|
{
|
||||||
if (dock_present()) {
|
if (dock_present()) {
|
||||||
printk(BIOS_DEBUG, "dock is connected\n");
|
printk(BIOS_DEBUG, "dock is connected\n");
|
||||||
dock_connect();
|
dock_connect();
|
||||||
} else
|
} else {
|
||||||
printk(BIOS_DEBUG, "dock is not connected\n");
|
printk(BIOS_DEBUG, "dock is not connected\n");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void dock_connect(void)
|
void dock_connect(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,7 +10,6 @@ static void mainboard_enable(struct device *dev)
|
||||||
install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS,
|
install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS,
|
||||||
GMA_INT15_PANEL_FIT_DEFAULT,
|
GMA_INT15_PANEL_FIT_DEFAULT,
|
||||||
GMA_INT15_BOOT_DISPLAY_LFP, 2);
|
GMA_INT15_BOOT_DISPLAY_LFP, 2);
|
||||||
init_dock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct chip_operations mainboard_ops = {
|
struct chip_operations mainboard_ops = {
|
||||||
|
|
|
@ -7,14 +7,15 @@
|
||||||
#include <ec/lenovo/h8/h8.h>
|
#include <ec/lenovo/h8/h8.h>
|
||||||
#include <ec/acpi/ec.h>
|
#include <ec/acpi/ec.h>
|
||||||
|
|
||||||
void init_dock(void)
|
void h8_mb_init(void)
|
||||||
{
|
{
|
||||||
if (dock_present()) {
|
if (dock_present()) {
|
||||||
printk(BIOS_DEBUG, "dock is connected\n");
|
printk(BIOS_DEBUG, "dock is connected\n");
|
||||||
dock_connect();
|
dock_connect();
|
||||||
} else
|
} else {
|
||||||
printk(BIOS_DEBUG, "dock is not connected\n");
|
printk(BIOS_DEBUG, "dock is not connected\n");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void dock_connect(void)
|
void dock_connect(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,8 +25,6 @@ static void mainboard_enable(struct device *dev)
|
||||||
install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS,
|
install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS,
|
||||||
GMA_INT15_PANEL_FIT_DEFAULT,
|
GMA_INT15_PANEL_FIT_DEFAULT,
|
||||||
GMA_INT15_BOOT_DISPLAY_LFP, 2);
|
GMA_INT15_BOOT_DISPLAY_LFP, 2);
|
||||||
|
|
||||||
init_dock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct chip_operations mainboard_ops = {
|
struct chip_operations mainboard_ops = {
|
||||||
|
|
Loading…
Reference in New Issue