blob: a4b89c580373183678f1303efeeb2cd0e607f5e2 [file] [log] [blame]
Angel Pons32abdd62020-04-05 15:47:03 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Aamir Bohra3ee54bb2018-10-17 11:55:01 +05302
3#include <intelblocks/sd.h>
Subrata Banikdf29d232019-07-05 16:00:38 +05304#include <soc/soc_chip.h>
Aamir Bohra3ee54bb2018-10-17 11:55:01 +05305
Furquan Shaikh3b54fdf2020-04-24 21:52:27 -07006int sd_fill_soc_gpio_info(struct acpi_gpio *gpio, const struct device *dev)
Aamir Bohra3ee54bb2018-10-17 11:55:01 +05307{
Kyösti Mälkki8950cfb2019-07-13 22:16:25 +03008 config_t *config = config_of(dev);
Aamir Bohra3ee54bb2018-10-17 11:55:01 +05309
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}