Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1252645 > unrolled thread

[PATCH 2/3] pinctrl: intel: Allow requesting pins which are in ACPI mode as GPIOs

Started byMika Westerberg <mika.westerberg@linux.intel.com>
First post2015-10-21 12:10 +0200
Last post2015-10-27 13:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/3] pinctrl: intel: Allow requesting pins which are in ACPI mode as GPIOs Mika Westerberg <mika.westerberg@linux.intel.com> - 2015-10-21 12:10 +0200
    Re: [PATCH 2/3] pinctrl: intel: Allow requesting pins which are in  ACPI mode as GPIOs Linus Walleij <linus.walleij@linaro.org> - 2015-10-27 13:40 +0100

#1252645 — [PATCH 2/3] pinctrl: intel: Allow requesting pins which are in ACPI mode as GPIOs

FromMika Westerberg <mika.westerberg@linux.intel.com>
Date2015-10-21 12:10 +0200
Subject[PATCH 2/3] pinctrl: intel: Allow requesting pins which are in ACPI mode as GPIOs
Message-ID<qlYvg-8ai-1@gated-at.bofh.it>
Reserved for ACPI actually means that in such case the GPIO hardware will
not update the interrupt status register (GPI_IS) even if the pin is
configured to trigger an interrupt. It will update GPI_GPE_STS instead and
does not trigger an interrupt.

Allow using such pins as GPIOs, only prevent their usage as interrupts.

We also rename function intel_pad_reserved_for_acpi() to be
intel_pad_acpi_mode() which reflects the actual meaning better.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/pinctrl/intel/pinctrl-intel.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index 53e9ababdb95..88cd39d48902 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -160,8 +160,7 @@ static bool intel_pad_owned_by_host(struct intel_pinctrl *pctrl, unsigned pin)
 	return !(readl(padown) & PADOWN_MASK(padno));
 }
 
-static bool intel_pad_reserved_for_acpi(struct intel_pinctrl *pctrl,
-					unsigned pin)
+static bool intel_pad_acpi_mode(struct intel_pinctrl *pctrl, unsigned pin)
 {
 	const struct intel_community *community;
 	unsigned padno, gpp, offset;
@@ -217,7 +216,6 @@ static bool intel_pad_locked(struct intel_pinctrl *pctrl, unsigned pin)
 static bool intel_pad_usable(struct intel_pinctrl *pctrl, unsigned pin)
 {
 	return intel_pad_owned_by_host(pctrl, pin) &&
-		!intel_pad_reserved_for_acpi(pctrl, pin) &&
 		!intel_pad_locked(pctrl, pin);
 }
 
@@ -270,7 +268,7 @@ static void intel_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
 	seq_printf(s, "0x%08x 0x%08x", cfg0, cfg1);
 
 	locked = intel_pad_locked(pctrl, pin);
-	acpi = intel_pad_reserved_for_acpi(pctrl, pin);
+	acpi = intel_pad_acpi_mode(pctrl, pin);
 
 	if (locked || acpi) {
 		seq_puts(s, " [");
@@ -737,6 +735,16 @@ static int intel_gpio_irq_type(struct irq_data *d, unsigned type)
 	if (!reg)
 		return -EINVAL;
 
+	/*
+	 * If the pin is in ACPI mode it is still usable as a GPIO but it
+	 * cannot be used as IRQ because GPI_IS status bit will not be
+	 * updated by the host controller hardware.
+	 */
+	if (intel_pad_acpi_mode(pctrl, pin)) {
+		dev_warn(pctrl->dev, "pin %u cannot be used as IRQ\n", pin);
+		return -EPERM;
+	}
+
 	spin_lock_irqsave(&pctrl->lock, flags);
 
 	value = readl(reg);
-- 
2.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1256733 — Re: [PATCH 2/3] pinctrl: intel: Allow requesting pins which are in ACPI mode as GPIOs

FromLinus Walleij <linus.walleij@linaro.org>
Date2015-10-27 13:40 +0100
SubjectRe: [PATCH 2/3] pinctrl: intel: Allow requesting pins which are in ACPI mode as GPIOs
Message-ID<qobHI-5cG-23@gated-at.bofh.it>
In reply to#1252645
On Wed, Oct 21, 2015 at 12:08 PM, Mika Westerberg
<mika.westerberg@linux.intel.com> wrote:

> Reserved for ACPI actually means that in such case the GPIO hardware will
> not update the interrupt status register (GPI_IS) even if the pin is
> configured to trigger an interrupt. It will update GPI_GPE_STS instead and
> does not trigger an interrupt.
>
> Allow using such pins as GPIOs, only prevent their usage as interrupts.
>
> We also rename function intel_pad_reserved_for_acpi() to be
> intel_pad_acpi_mode() which reflects the actual meaning better.
>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Patch applied.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web