aboutsummaryrefslogtreecommitdiff
path: root/src/mainboard/google/hatch/variants/jinlon/mainboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainboard/google/hatch/variants/jinlon/mainboard.c')
-rw-r--r--src/mainboard/google/hatch/variants/jinlon/mainboard.c55
1 files changed, 55 insertions, 0 deletions
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 0000000000..db041c4ca8
--- /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);
+}