diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2016-03-30 10:00:09 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2016-03-30 10:00:09 +0000 |
commit | df3210756b0daff1d1eb642ce3aa526c1bb532ef (patch) | |
tree | 051b636604a8b8ece37fc3374069280c6f8bf01c /sys/dev/acpi | |
parent | b2fa04dffe018a9e04710ad671d8ab94e75946ee (diff) |
Hook up the gpio interrupt on devices that use it for card detection.
Makes the SD card slot on machines based on Intel's Bay Trail SoC fully
functional.
ok jsg@
Diffstat (limited to 'sys/dev/acpi')
-rw-r--r-- | sys/dev/acpi/sdhc_acpi.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/sys/dev/acpi/sdhc_acpi.c b/sys/dev/acpi/sdhc_acpi.c index 6948be0209a..b9b688d6606 100644 --- a/sys/dev/acpi/sdhc_acpi.c +++ b/sys/dev/acpi/sdhc_acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sdhc_acpi.c,v 1.4 2016/03/29 18:04:09 kettenis Exp $ */ +/* $OpenBSD: sdhc_acpi.c,v 1.5 2016/03/30 10:00:08 kettenis Exp $ */ /* * Copyright (c) 2016 Mark Kettenis * @@ -46,6 +46,7 @@ struct sdhc_acpi_softc { struct aml_node *sc_gpio_int_node; struct aml_node *sc_gpio_io_node; uint16_t sc_gpio_int_pin; + uint16_t sc_gpio_int_flags; uint16_t sc_gpio_io_pin; struct sdhc_host *sc_host; @@ -68,6 +69,7 @@ const char *sdhc_hids[] = { int sdhc_acpi_parse_resources(union acpi_resource *, void *); int sdhc_acpi_card_detect(struct sdhc_softc *); +void sdhc_acpi_card_detect_intr(void *); int sdhc_acpi_match(struct device *parent, void *match, void *aux) @@ -120,6 +122,13 @@ sdhc_acpi_attach(struct device *parent, struct device *self, void *aux) if (sc->sc_gpio_io_node && sc->sc_gpio_io_node->gpio) sc->sc.sc_card_detect = sdhc_acpi_card_detect; + if (sc->sc_gpio_int_node && sc->sc_gpio_int_node->gpio) { + struct acpi_gpio *gpio = sc->sc_gpio_int_node->gpio; + + gpio->intr_establish(gpio->cookie, sc->sc_gpio_int_pin, + sc->sc_gpio_int_flags, sdhc_acpi_card_detect_intr, sc); + } + printf("\n"); sc->sc.sc_host = &sc->sc_host; @@ -150,6 +159,7 @@ sdhc_acpi_parse_resources(union acpi_resource *crs, void *arg) if (crs->lr_gpio.type == LR_GPIO_INT) { sc->sc_gpio_int_node = node; sc->sc_gpio_int_pin = pin; + sc->sc_gpio_int_flags = crs->lr_gpio.tflags; } else if (crs->lr_gpio.type == LR_GPIO_IO) { sc->sc_gpio_io_node = node; sc->sc_gpio_io_pin = pin; @@ -177,3 +187,11 @@ sdhc_acpi_card_detect(struct sdhc_softc *ssc) /* Card detect GPIO signal is active-low. */ return !gpio->read_pin(gpio->cookie, pin); } + +void +sdhc_acpi_card_detect_intr(void *arg) +{ + struct sdhc_acpi_softc *sc = arg; + + sdhc_needs_discover(&sc->sc); +} |