Patrick Georgi submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Mathew King: Looks good to me, approved
mb/google/hatch/var/jinlon: Disable EPS on some SKUs

Disable EPS on the SKUs that do not have it.

Change-Id: I7305097beea3484634933ab856fd084933868a10
Signed-off-by: Rajat Jain <rajatja@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/39156
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Mathew King <mathewk@chromium.org>
---
M src/mainboard/google/hatch/variants/jinlon/Makefile.inc
A src/mainboard/google/hatch/variants/jinlon/include/variant/sku.h
A src/mainboard/google/hatch/variants/jinlon/mainboard.c
3 files changed, 79 insertions(+), 0 deletions(-)

diff --git a/src/mainboard/google/hatch/variants/jinlon/Makefile.inc b/src/mainboard/google/hatch/variants/jinlon/Makefile.inc
index c57d090..d38a577 100644
--- a/src/mainboard/google/hatch/variants/jinlon/Makefile.inc
+++ b/src/mainboard/google/hatch/variants/jinlon/Makefile.inc
@@ -25,4 +25,5 @@

bootblock-y += gpio.c
ramstage-y += gpio.c
+ramstage-y += mainboard.c
ramstage-y += ramstage.c
diff --git a/src/mainboard/google/hatch/variants/jinlon/include/variant/sku.h b/src/mainboard/google/hatch/variants/jinlon/include/variant/sku.h
new file mode 100644
index 0000000..1d45fcd
--- /dev/null
+++ b/src/mainboard/google/hatch/variants/jinlon/include/variant/sku.h
@@ -0,0 +1,23 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2020 Google LLC
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef __JINLON_SKU_H__
+#define __JINLON_SKU_H__
+
+/*
+ * SKU definition taken from
+ * https://buganizer.corp.google.com/issues/145688887#comment16
+ */
+enum {
+ JINLON_SKU_01 = 1, /* No LTE, No view-angle-manegement */
+ JINLON_SKU_02 = 2, /* No LTE, view-angle-manegement */
+ JINLON_SKU_21 = 21, /* LTE, No view-angle-manegement */
+ JINLON_SKU_22 = 22, /* LTE, view-angle-manegement */
+};
+
+#endif /* __JINLON_SKU_H__ */
diff --git a/src/mainboard/google/hatch/variants/jinlon/mainboard.c b/src/mainboard/google/hatch/variants/jinlon/mainboard.c
new file mode 100644
index 0000000..db041c4
--- /dev/null
+++ b/src/mainboard/google/hatch/variants/jinlon/mainboard.c
@@ -0,0 +1,55 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2020 Google LLC
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#include <baseboard/variants.h>
+#include <bootstate.h>
+#include <ec/google/chromeec/ec.h>
+#include <device/device.h>
+#include <drivers/gfx/generic/chip.h>
+#include <variant/sku.h>
+
+static bool eps_sku(uint32_t sku_id)
+{
+ /*
+ * Assume EPS SKU by default, helpful for testing on
+ * unprovisioned or development SKUs.
+ */
+ if (sku_id == JINLON_SKU_01 || sku_id == JINLON_SKU_21)
+ return false;
+ else
+ return true;
+}
+
+static void check_for_eps(uint32_t sku_id)
+{
+ struct device *gfx_dev;
+
+ if (eps_sku(sku_id)) {
+ printk(BIOS_INFO, "SKU ID %u has EPS\n", sku_id);
+ return;
+ }
+
+ gfx_dev = find_gfx_dev();
+ if (!gfx_dev) {
+ printk(BIOS_ERR,
+ "Error! No EPS dev, view-angle-management won't work\n");
+ return;
+ }
+
+ printk(BIOS_INFO,
+ "SKU ID %u doesn't have EPS, disabling...\n",
+ sku_id);
+ gfx_dev->enabled = 0;
+}
+
+void variant_devtree_update(void)
+{
+ uint32_t sku_id = google_chromeec_get_board_sku();
+
+ /* Disable EPS on SKUs that do not support it */
+ check_for_eps(sku_id);
+}

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

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I7305097beea3484634933ab856fd084933868a10
Gerrit-Change-Number: 39156
Gerrit-PatchSet: 4
Gerrit-Owner: Rajat Jain <rajatja@google.com>
Gerrit-Reviewer: Duncan Laurie <dlaurie@chromium.org>
Gerrit-Reviewer: Furquan Shaikh <furquan@google.com>
Gerrit-Reviewer: Martin Roth <martinroth@google.com>
Gerrit-Reviewer: Mathew King <mathewk@chromium.org>
Gerrit-Reviewer: Patrick Georgi <pgeorgi@google.com>
Gerrit-Reviewer: Rajat Jain <rajatja@google.com>
Gerrit-Reviewer: Shelley Chen <shchen@google.com>
Gerrit-Reviewer: Tim Wawrzynczak <twawrzynczak@chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged