ec/google/chromeec: Update the USBC ACPI device hierarchy

Type C connector class driver in kernel (v5.4) expects the Type C ACPI
device under ChromeEC ACPI device scope. Currently the Type C ACPI
device is populated under ChromeEC device's parent. This leads to
incorrect casting of Type C's parent device and hence a crash. Move the
Type C device under ChromeEC ACPI device.

BUG=b:153518804
TEST=Build and boot the mainboard. Ensure that the USBC ACPI device is
populated under ChromeEC ACPI device.
Scope (\_SB.PCI0.LPCB.EC0.CREC)
{
	Device (USBC)
	{
		Name (_HID, "GOOG0014")  // _HID: Hardware ID
		...
	}
}

Change-Id: I628489bc420d7a3db4ad3cb93d085d568c6de507
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/40354
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Aamir Bohra <aamir.bohra@intel.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
This commit is contained in:
Karthikeyan Ramasubramanian 2020-04-13 18:03:29 -06:00 committed by Furquan Shaikh
parent b2634c1f98
commit a95907b066
1 changed files with 5 additions and 4 deletions

View File

@ -16,6 +16,7 @@
#include "ec.h" #include "ec.h"
#include "ec_commands.h" #include "ec_commands.h"
#define GOOGLE_CHROMEEC_USBC_DEVICE_PARENT "CREC"
#define GOOGLE_CHROMEEC_USBC_DEVICE_HID "GOOG0014" #define GOOGLE_CHROMEEC_USBC_DEVICE_HID "GOOG0014"
#define GOOGLE_CHROMEEC_USBC_DEVICE_NAME "USBC" #define GOOGLE_CHROMEEC_USBC_DEVICE_NAME "USBC"
@ -219,8 +220,8 @@ void google_chromeec_fill_ssdt_generator(struct device *dev)
if (google_chromeec_get_num_pd_ports(&num_ports)) if (google_chromeec_get_num_pd_ports(&num_ports))
return; return;
/* Reference the existing device's scope */ /* Add TypeC device under the existing device + ".CREC" scope */
acpigen_write_scope(acpi_device_path(dev)); acpigen_write_scope(acpi_device_path_join(dev, GOOGLE_CHROMEEC_USBC_DEVICE_PARENT));
fill_ssdt_typec_device(num_ports); fill_ssdt_typec_device(num_ports);
acpigen_pop_len(); /* Scope */ acpigen_pop_len(); /* Scope */
} }