From c0d15c1ffdc08b0760e6bca5067ea734b77e9972 Mon Sep 17 00:00:00 2001 From: kettenis Date: Sun, 11 Sep 2022 18:07:26 +0000 Subject: [PATCH] Register the I2C controller with ACPI. Skip this on the SC8280XP SoC for now as the AML on the Lenovo X13S tries to do I2C transactions to a device that doesn't respond leading to the ACPI thread spinning until the transaction times out. ok mlarkin@, deraadt@ --- sys/dev/acpi/qciic.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/sys/dev/acpi/qciic.c b/sys/dev/acpi/qciic.c index 501d6f09af2..ad10f410825 100644 --- a/sys/dev/acpi/qciic.c +++ b/sys/dev/acpi/qciic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qciic.c,v 1.3 2022/09/10 13:05:41 kettenis Exp $ */ +/* $OpenBSD: qciic.c,v 1.4 2022/09/11 18:07:26 kettenis Exp $ */ /* * Copyright (c) 2022 Mark Kettenis * @@ -58,6 +58,7 @@ struct qciic_softc { bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; + struct acpi_softc *sc_acpi; struct aml_node *sc_node; struct device *sc_iic; @@ -127,6 +128,7 @@ qciic_attach(struct device *parent, struct device *self, void *aux) struct acpi_attach_args *aaa = aux; struct i2cbus_attach_args iba; + sc->sc_acpi = (struct acpi_softc *)parent; sc->sc_node = aaa->aaa_node; printf(" %s", aaa->aaa_node->name); @@ -149,6 +151,18 @@ qciic_attach(struct device *parent, struct device *self, void *aux) sc->sc_ic.ic_intr_disestablish = qciic_i2c_intr_disestablish; sc->sc_ic.ic_intr_string = qciic_i2c_intr_string; +#ifndef SMALL_KERNEL + /* + * XXX Registering the I2C9 node with ACPI leads to AML + * executing I2C transaction that fail and spin with the + * kernel lock held until they fail. + */ + if (strcmp(aaa->aaa_dev, "QCOM0610") != 0) { + sc->sc_node->i2c = &sc->sc_ic; + acpi_register_gsb(sc->sc_acpi, sc->sc_node); + } +#endif + memset(&iba, 0, sizeof(iba)); iba.iba_name = "iic"; iba.iba_tag = &sc->sc_ic; -- 2.20.1