Angel Pons | f5627e8 | 2020-04-05 15:46:52 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Bora Guvendik | d2c6365 | 2017-09-19 14:04:37 -0700 | [diff] [blame] | 2 | |
| 3 | #include <intelblocks/sd.h> |
| 4 | #include "chip.h" |
| 5 | |
Angel Pons | bda02b0 | 2020-09-28 01:10:40 +0200 | [diff] [blame] | 6 | int sd_fill_soc_gpio_info(struct acpi_gpio *gpio, const struct device *dev) |
Bora Guvendik | d2c6365 | 2017-09-19 14:04:37 -0700 | [diff] [blame] | 7 | { |
Kyösti Mälkki | 8950cfb | 2019-07-13 22:16:25 +0300 | [diff] [blame] | 8 | config_t *config = config_of(dev); |
Bora Guvendik | d2c6365 | 2017-09-19 14:04:37 -0700 | [diff] [blame] | 9 | |
| 10 | if (!config->sdcard_cd_gpio) |
| 11 | return -1; |
| 12 | |
| 13 | gpio->type = ACPI_GPIO_TYPE_INTERRUPT; |
| 14 | gpio->pull = ACPI_GPIO_PULL_NONE; |
| 15 | gpio->irq.mode = ACPI_IRQ_EDGE_TRIGGERED; |
| 16 | gpio->irq.polarity = ACPI_IRQ_ACTIVE_BOTH; |
| 17 | gpio->irq.shared = ACPI_IRQ_SHARED; |
| 18 | gpio->irq.wake = ACPI_IRQ_WAKE; |
| 19 | gpio->interrupt_debounce_timeout = 10000; /* 100ms */ |
| 20 | gpio->pin_count = 1; |
| 21 | gpio->pins[0] = config->sdcard_cd_gpio; |
| 22 | |
| 23 | return 0; |
| 24 | } |