Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp889937ybt; Fri, 26 Jun 2020 14:12:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxC54NbUCVmEAdi+PvmZPwlLVM1eAim0kNvDWBiZdquQYQnzv95aZ3V+MaRrzxsg5qXeLDG X-Received: by 2002:a17:906:694d:: with SMTP id c13mr4148196ejs.337.1593205920108; Fri, 26 Jun 2020 14:12:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593205920; cv=none; d=google.com; s=arc-20160816; b=q0FTc83xE12ndBD2JIC0VYJqpofhcGu5xbPMvU3e6fTpt8RDQaHwMDm3xE6hoPjM6o y0Zmwk3Bra7TirIL75QyMV9zgDi4CMQLgX42St8Ap3cg1mQ9I6mohygfbd7YLnTgCpVD 3WorwhvTWzPYLVLBoBKvwuK2LrXPag1aa2bVdzHr6ae6bYggLrdivt0lD82opQkgw/Yd Q1PCSD0QCbWnkhL/3B7Ri82ddFWmuPZIf7QhWO7XWzs/qNPbhI+we2QgWou0TZDidP0n ByfwCTpZA6EBUjMLLF1Mk1mIrlC5+KMoJ5Mnrx8sosbppwCXoGgtOnkP0X1nXr3JTANc gGAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=SqHQ9DZWlxsE7qIqsV85VvjMJJNMgqXueRXxvJ29fgI=; b=HH3xapQWuQkqeeOesjvRqJ7gGeKNXpCSPNeTayOj7aQ+CoXVu2O7tNs7AlSaynqPe4 rjDlDHauBLCCogxuGaoZlyDoSL+fK+FJQynhxchbefvAZnR+ydHrnOjAtMjtlKgLmmZQ +IatipZxQ/stYZa/4DsSHhQVuwj2yBFT5bZ+I1mn82nIYONRuB3O6a0bhENoMpAeIE97 wmcc+6nQ0Nv4Cvf8QJfbrheLUwfO7eNA08Vgz2qddMSZ9he2RpMZQwyc1OGChsw8ewQ/ 3lspCwcb4USSbyD9+8mQBbvYRdkI3RU2pOKUeOX0QlL2vU6KiiCeNQ3Vyt11Kz8UV07S N15w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=nM6YJHrx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hh4si17754458ejb.549.2020.06.26.14.11.36; Fri, 26 Jun 2020 14:12:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=nM6YJHrx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726311AbgFZVKl (ORCPT + 99 others); Fri, 26 Jun 2020 17:10:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725880AbgFZVKk (ORCPT ); Fri, 26 Jun 2020 17:10:40 -0400 Received: from mail-qv1-xf4a.google.com (mail-qv1-xf4a.google.com [IPv6:2607:f8b0:4864:20::f4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F52AC03E97A for ; Fri, 26 Jun 2020 14:10:40 -0700 (PDT) Received: by mail-qv1-xf4a.google.com with SMTP id v1so7235569qvx.8 for ; Fri, 26 Jun 2020 14:10:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=SqHQ9DZWlxsE7qIqsV85VvjMJJNMgqXueRXxvJ29fgI=; b=nM6YJHrx8LdaSjUWSkIKwhAbVqGDbNri4NlhGXkImmnI6EUEOZO82ZVoGm8q/XELDm bnNAzmNAhVPBIi0bVifIvUYvTS9zfYQfH2U/PU8U69Guzkxl10Tnjk06C3s4cW1NXqB4 Hh1g0qte6QgyiiXCKmxejoA2zfSAr76RNnDRQ58CCe7rmhv8oiwtfOuU0rb/0gg8Iitj SNRupPbGmkO6jtdA/qNCs9wlmnQICBkZhbK2/+RZbA7EC3bAFwn3WrpjgKQ3Vc4K5W6c 1WWDqAc8BGw8QPd8UxZixp75Fvc3/xaI1GHAvRz+FlqtCZ0+uXv/dMuv2ctKZmdYc858 XnDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=SqHQ9DZWlxsE7qIqsV85VvjMJJNMgqXueRXxvJ29fgI=; b=YEV0KR+7M+yof0wjZa06zu6F/1OdzAVqyvchYEFgW9HFrcMU9AtWGdbdCoj7YxNWIh 5aa9CQl+yhKWNsK3DUGF/w2ahjoVXgrSujgjF3yOuhw7B9ALItN8DHshXUx5lxQJxSNP uJjn6sAessNVzX3waJb4Ba+WmqPlAjua35ee7ba6cU5Re1WQ2Wu/2vx9zqzynihQfQop vUIuONFICq36anclA94mRrSRyQQ6YuUoQTYfNs9LbmZq4rF7hs/JBzLLVNO6tDWjJ4Oo HHJAiHdCw35GlLSVoTQ7rFT99DossXCbOoKI1DjZYDsFromxotKZlPbGsMM+/vOS22t+ HwkA== X-Gm-Message-State: AOAM533jacS0cl7jg3v4fXvSv5tMHg2qCk3498V3JYPlx6BZsst4NkQw e8yJoMinbaSRQKyMKFrDuM2+KBUX96kS X-Received: by 2002:a0c:bf47:: with SMTP id b7mr4962051qvj.167.1593205839758; Fri, 26 Jun 2020 14:10:39 -0700 (PDT) Date: Fri, 26 Jun 2020 14:10:26 -0700 Message-Id: <20200626211026.513520-1-furquan@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog Subject: [PATCH] pinctrl: amd: Honor IRQ trigger type requested by the caller From: Furquan Shaikh To: Linus Walleij Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Shyam-sundar.S-k@amd.com, akshu.agrawal@amd.com, adurbin@google.com, dtor@google.com, Furquan Shaikh Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This change drops the override in `amd_gpio_irq_set_type()` that ignores the IRQ trigger type settings from the caller. The device driver (caller) is in a better position to identify the right trigger type for the device based on the usage as well as the information exposed by the BIOS. There are instances where the device driver might want to configure the trigger type differently in different modes. An example of this is gpio-keys driver which configures IRQ type as trigger on both edges (to identify assert and deassert events) when in S0 and reconfigures the trigger type using the information provided by the BIOS when going into suspend to ensure that the wake happens on the required edge. This override in `amd_gpio_irq_set_type()` prevents the caller from being able to reconfigure trigger type once it is set either based on ACPI information or the type used by the first caller for IRQ on a given GPIO line. Without this change, pen-insert gpio key (used by garaged stylus on a Chromebook) works fine in S0 (i.e. insert and eject events are correctly identified), however, BIOS configuration for wake on only pen eject i.e. only-rising edge or only-falling edge is not honored. With this change, it was verified that pen-insert gpio key behavior is correct in both S0 and for wakeup from S3. Signed-off-by: Furquan Shaikh --- drivers/pinctrl/pinctrl-amd.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c index 1fe62a35bb12..c34e6a950b3f 100644 --- a/drivers/pinctrl/pinctrl-amd.c +++ b/drivers/pinctrl/pinctrl-amd.c @@ -417,22 +417,13 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type) { int ret = 0; u32 pin_reg, pin_reg_irq_en, mask; - unsigned long flags, irq_flags; + unsigned long flags; struct gpio_chip *gc = irq_data_get_irq_chip_data(d); struct amd_gpio *gpio_dev = gpiochip_get_data(gc); raw_spin_lock_irqsave(&gpio_dev->lock, flags); pin_reg = readl(gpio_dev->base + (d->hwirq)*4); - /* Ignore the settings coming from the client and - * read the values from the ACPI tables - * while setting the trigger type - */ - - irq_flags = irq_get_trigger_type(d->irq); - if (irq_flags != IRQ_TYPE_NONE) - type = irq_flags; - switch (type & IRQ_TYPE_SENSE_MASK) { case IRQ_TYPE_EDGE_RISING: pin_reg &= ~BIT(LEVEL_TRIG_OFF); -- 2.27.0.212.ge8ba1cc988-goog