summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/drivers/intel/pmc_mux/chip.h2
-rw-r--r--src/soc/intel/common/block/include/intelblocks/pmc.h9
-rw-r--r--src/soc/intel/tigerlake/pmc.c20
3 files changed, 31 insertions, 0 deletions
diff --git a/src/drivers/intel/pmc_mux/chip.h b/src/drivers/intel/pmc_mux/chip.h
index dcca2a3ecc..f73a07047f 100644
--- a/src/drivers/intel/pmc_mux/chip.h
+++ b/src/drivers/intel/pmc_mux/chip.h
@@ -3,6 +3,8 @@
#ifndef __DRIVERS_INTEL_PMC_MUX_H__
#define __DRIVERS_INTEL_PMC_MUX_H__
+extern struct chip_operations drivers_intel_pmc_mux_ops;
+
struct drivers_intel_pmc_mux_config {
};
diff --git a/src/soc/intel/common/block/include/intelblocks/pmc.h b/src/soc/intel/common/block/include/intelblocks/pmc.h
index 329bbe9bd7..75e212740d 100644
--- a/src/soc/intel/common/block/include/intelblocks/pmc.h
+++ b/src/soc/intel/common/block/include/intelblocks/pmc.h
@@ -51,4 +51,13 @@ int pmc_soc_get_resources(struct pmc_resource_config *cfg);
/* API to set ACPI mode */
void pmc_set_acpi_mode(void);
+/*
+ * Returns a reference to the PMC MUX device for the given port number.
+ * Returns NULL if not found or SoC does not support PMC MUX.
+ *
+ * Input: Port number (0-based)
+ * Output: Const pointer to PMC MUX device
+ */
+const struct device *soc_get_pmc_mux_device(int port_number);
+
#endif /* SOC_INTEL_COMMON_BLOCK_PMC_H */
diff --git a/src/soc/intel/tigerlake/pmc.c b/src/soc/intel/tigerlake/pmc.c
index c24898faf3..84a18e3865 100644
--- a/src/soc/intel/tigerlake/pmc.c
+++ b/src/soc/intel/tigerlake/pmc.c
@@ -11,6 +11,7 @@
#include <console/console.h>
#include <device/mmio.h>
#include <device/device.h>
+#include <drivers/intel/pmc_mux/chip.h>
#include <intelblocks/pmc.h>
#include <intelblocks/pmclib.h>
#include <intelblocks/rtc.h>
@@ -123,6 +124,25 @@ static void soc_pmc_fill_ssdt(const struct device *dev)
dev_path(dev));
}
+/* By default, TGL uses the PMC MUX for all ports, so port_number is unused */
+const struct device *soc_get_pmc_mux_device(int port_number)
+{
+ const struct device *pmc;
+ struct device *child;
+
+ child = NULL;
+ pmc = pcidev_path_on_root(PCH_DEVFN_PMC);
+ if (!pmc || !pmc->link_list)
+ return NULL;
+
+ while ((child = dev_bus_each_child(pmc->link_list, child)) != NULL)
+ if (child->chip_ops == &drivers_intel_pmc_mux_ops)
+ break;
+
+ /* child will either be the correct device or NULL if not found */
+ return child;
+}
+
struct device_operations pmc_ops = {
.read_resources = soc_pmc_read_resources,
.set_resources = noop_set_resources,