linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Brian Norris <briannorris@chromium.org>
Cc: "Michał Stanek" <mst@semihalf.com>,
	linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org, stanekm@google.com,
	stable@vger.kernel.org, "Marcin Wojtas" <mw@semihalf.com>,
	levinale@chromium.org, andriy.shevchenko@linux.intel.com,
	"Linus Walleij" <linus.walleij@linaro.org>,
	bgolaszewski@baylibre.com, rafael.j.wysocki@intel.com,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>
Subject: Re: [PATCH] pinctrl: cherryview: Add quirk with custom translation of ACPI GPIO numbers
Date: Fri, 17 Apr 2020 12:05:00 +0300	[thread overview]
Message-ID: <20200417090500.GM2586@lahna.fi.intel.com> (raw)
In-Reply-To: <20200417020641.GA145784@google.com>

On Thu, Apr 16, 2020 at 07:06:41PM -0700, Brian Norris wrote:
> If you just read the last sentence from Michal, you get the wrong
> picture. There's no hard-coding of gpiochipX numbers going on. We only
> had the pin offsets "hardcoded" (in ACPI), and the kernel driver
> unilaterally changed from a contiguous mapping to a non-contiguous
> mapping.

OK, I now understand the issue. My apologies that I was not able to
figure that out from the previous explanation.

So indeed if relative GPIO numbering inside the gpiochip was changed
then it is kernel regression and needs to be dealt with.

> How do you recommend determining (both pre- and
> post-commit-03c4749dd6c7ff94) whether pin 22 is at offset 22, vs. offset
> 19?

I wonder if we can add back the previous GPIO base like this?

diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c b/drivers/pinctrl/intel/pinctrl-cherryview.c
index 4c74fdde576d..f53de56bb763 100644
--- a/drivers/pinctrl/intel/pinctrl-cherryview.c
+++ b/drivers/pinctrl/intel/pinctrl-cherryview.c
@@ -1591,17 +1591,18 @@ static int chv_gpio_add_pin_ranges(struct gpio_chip *chip)
 	struct chv_pinctrl *pctrl = gpiochip_get_data(chip);
 	const struct chv_community *community = pctrl->community;
 	const struct chv_gpio_pinrange *range;
-	int ret, i;
+	int ret, i, offset;
 
-	for (i = 0; i < community->ngpio_ranges; i++) {
+	for (i = 0, offset = 0; i < community->ngpio_ranges; i++) {
 		range = &community->gpio_ranges[i];
-		ret = gpiochip_add_pin_range(chip, dev_name(pctrl->dev),
-					     range->base, range->base,
-					     range->npins);
+		ret = gpiochip_add_pin_range(chip, dev_name(pctrl->dev), offset,
+					     range->base, range->npins);
 		if (ret) {
 			dev_err(pctrl->dev, "failed to add GPIO pin range\n");
 			return ret;
 		}
+
+		offset += range->npins;
 	}
 
 	return 0;

  reply	other threads:[~2020-04-17  9:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-05 19:48 [PATCH] pinctrl: cherryview: Add quirk with custom translation of ACPI GPIO numbers Michal Stanek
2020-02-06  8:31 ` Mika Westerberg
2020-02-06 22:26   ` Michał Stanek
2020-02-07  7:56     ` Mika Westerberg
2020-02-08 18:43       ` Michał Stanek
2020-02-10 10:14         ` Mika Westerberg
2020-03-10 14:12           ` Michał Stanek
2020-03-10 14:49             ` Mika Westerberg
2020-03-25 22:50               ` Linus Walleij
2020-04-17  2:06               ` Brian Norris
2020-04-17  9:05                 ` Mika Westerberg [this message]
2020-04-18  0:55                   ` Brian Norris
2020-08-18 13:59                     ` Andy Shevchenko
2020-02-10 12:13         ` Linus Walleij
2020-02-06  9:25 ` Andy Shevchenko
2020-02-06 18:31   ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200417090500.GM2586@lahna.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=briannorris@chromium.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=levinale@chromium.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@semihalf.com \
    --cc=mw@semihalf.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=stanekm@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).