Message ID | 20200126220508.54.Ieac541912f8390ac07a3c9b693fb46858e3b813e@changeid |
---|---|
State | RFC |
Delegated to: | Bin Meng |
Headers | show
Return-Path: <u-boot-bounces@lists.denx.de> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=Y8SfCjIS; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 485dLV2tzHz9sR1 for <incoming@patchwork.ozlabs.org>; Mon, 27 Jan 2020 16:18:10 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BB8B981849; Mon, 27 Jan 2020 06:12:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Y8SfCjIS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9EB25817E6; Mon, 27 Jan 2020 06:09:39 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id ACB4581726 for <u-boot@lists.denx.de>; Mon, 27 Jan 2020 06:09:10 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x143.google.com with SMTP id t17so6410457ilm.13 for <u-boot@lists.denx.de>; Sun, 26 Jan 2020 21:09:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nMhcMjt8g/Yw+uo7FXusVJtTVYBdKJTNcpSBZIkKSXk=; b=Y8SfCjISZkfWfWvOuExvHxFd4mJeFQ/cWc+RyAALxnOCJ9Z0tiS36mCeaKwg/dxWmY Aa5vxt838CJc3HQQTN97l2dR/WY6wEuiTGtQ0XYRmvdkuJXHfp4kx8hJRjr9TgChqJF+ 9Hxyc0KpdjrwAqlgW34osSpCFW6UJezFPSLZM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nMhcMjt8g/Yw+uo7FXusVJtTVYBdKJTNcpSBZIkKSXk=; b=FxLiGWHRg3TZi1BBME35BTDg8pVqWVvESZZedr3gAVDveJbHHLzgIgQUEIBkpYw949 rPfWE8UNpu2AGOI3knb2govuVtId4juWjj8A+sHiFgCuOXWwlREXjy7n+s8FjIBvv+AG mXu7Yos0dzDLXqlbvIBKZwKM6YtpYYkqx86rSIsSgUs1fkwMaDVBVY6jjNuZeX/AVmQC CeZyICAznNDS94R//0AyoJdg+ZVRX4nqcrimBuAzoSVYW4LyL/O9JlPXryeCUGaaS7tL tIXDAVt+mQNghw10qu/8YOgxpECW67Jcr+XFNJBlZtX6/hY/sCcg6ksVZrNSt1vkoq7t LQ3g== X-Gm-Message-State: APjAAAVoJsjDc0JPQZM+qkonJz+GRwXdKq6paSsWBjc93faQaEQLN393 o2C8772s21UQ2nLCdbr/5fAmCVIJAichxA== X-Google-Smtp-Source: APXvYqyQ2se7whfOqvyWWqwGP7aVXiQx5FCOB4MT3Dq2+GpBZayZKUESmpQ5I8yp+6OLX0WceYx7Xw== X-Received: by 2002:a05:6e02:692:: with SMTP id o18mr7135059ils.238.1580101746958; Sun, 26 Jan 2020 21:09:06 -0800 (PST) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id h23sm4313195ilf.57.2020.01.26.21.09.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jan 2020 21:09:06 -0800 (PST) From: Simon Glass <sjg@chromium.org> To: U-Boot Mailing List <u-boot@lists.denx.de> Subject: [PATCH 054/108] x86: gpio: Add support for obtaining ACPI info for a GPIO Date: Sun, 26 Jan 2020 22:06:01 -0700 Message-Id: <20200126220508.54.Ieac541912f8390ac07a3c9b693fb46858e3b813e@changeid> X-Mailer: git-send-email 2.25.0.341.g760bfbb309-goog In-Reply-To: <20200127050655.170614-1-sjg@chromium.org> References: <20200127050655.170614-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 Precedence: list List-Id: U-Boot discussion <u-boot.lists.denx.de> List-Unsubscribe: <https://lists.denx.de/options/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=unsubscribe> List-Archive: <https://lists.denx.de/pipermail/u-boot/> List-Post: <mailto:u-boot@lists.denx.de> List-Help: <mailto:u-boot-request@lists.denx.de?subject=help> List-Subscribe: <https://lists.denx.de/listinfo/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=subscribe> Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" <u-boot-bounces@lists.denx.de> X-Virus-Scanned: clamav-milter 0.101.4 at phobos.denx.de X-Virus-Status: Clean |
Series |
RFC: dm: Add programatic generation of ACPI tables
|
expand
|
diff --git a/drivers/gpio/intel_gpio.c b/drivers/gpio/intel_gpio.c index c56b362c4e..51ea23df89 100644 --- a/drivers/gpio/intel_gpio.c +++ b/drivers/gpio/intel_gpio.c @@ -4,6 +4,7 @@ */ #include <common.h> +#include <acpi_device.h> #include <dm.h> #include <errno.h> #include <fdtdec.h> @@ -127,6 +128,33 @@ static int intel_gpio_xlate(struct udevice *orig_dev, struct gpio_desc *desc, return 0; } +#if CONFIG_IS_ENABLED(ACPIGEN) +static int intel_gpio_get_acpi(const struct gpio_desc *desc, + struct acpi_gpio *gpio) +{ + struct udevice *pinctrl; + int ret; + + if (!dm_gpio_is_valid(desc)) + return -ENOENT; + pinctrl = dev_get_parent(desc->dev); + + memset(gpio, '\0', sizeof(*gpio)); + + gpio->type = ACPI_GPIO_TYPE_IO; + gpio->pull = ACPI_GPIO_PULL_DEFAULT; + gpio->io_restrict = ACPI_GPIO_IO_RESTRICT_OUTPUT; + gpio->polarity = ACPI_GPIO_ACTIVE_HIGH; + gpio->pin_count = 1; + gpio->pins[0] = intel_pinctrl_get_acpi_pin(pinctrl, desc->offset); + ret = acpi_device_path(pinctrl, gpio->resource, sizeof(gpio->resource)); + if (ret) + return log_msg_ret("resource", ret); + + return 0; +} +#endif + static int intel_gpio_probe(struct udevice *dev) { return 0; @@ -151,6 +179,9 @@ static const struct dm_gpio_ops gpio_intel_ops = { .set_value = intel_gpio_set_value, .get_function = intel_gpio_get_function, .xlate = intel_gpio_xlate, +#if CONFIG_IS_ENABLED(ACPIGEN) + .get_acpi = intel_gpio_get_acpi, +#endif }; static const struct udevice_id intel_intel_gpio_ids[] = {
Implement the method that converts a GPIO into the form used by ACPI, so that GPIOs can be added to ACPI tables. Signed-off-by: Simon Glass <sjg@chromium.org> --- drivers/gpio/intel_gpio.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)