All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: "mika.westerberg@linux.intel.com" <mika.westerberg@linux.intel.com>
Cc: "Tirdea, Irina" <irina.tirdea@intel.com>,
	Bastien Nocera <hadess@hadess.net>,
	Aleksei Mamlin <mamlinav@gmail.com>,
	Karsten Merker <merker@debian.org>,
	"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	"Purdila, Octavian" <octavian.purdila@intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH v9 2/9] Input: goodix - reset device at init
Date: Tue, 13 Oct 2015 23:23:03 -0700	[thread overview]
Message-ID: <20151014062303.GC20406@dtor-ws> (raw)
In-Reply-To: <20151013100724.GG1492@lahna.fi.intel.com>

On Tue, Oct 13, 2015 at 01:07:24PM +0300, mika.westerberg@linux.intel.com wrote:
> On Tue, Oct 13, 2015 at 08:54:12AM +0000, Tirdea, Irina wrote:
> > > > I did not use devm_gpiod_get_optional() in order to ignore more errors
> > > > than -ENOENT. This is needed because the ACPI gpio core will fall back
> > > > to indexed gpios if named gpios are not found. In the common case of
> > > > having 2 indexed gpio pins declared in the ACPI table, the first
> > > > devm_gpiod_get() will successfully get indexed gpio pin 0 and the
> > > > second devm_gpiod_get() will try to get the same gpio pin 0 and return
> > > > -EBUSY. Considering this, I thought it is better to just ignore all errors in
> > > > order not to break any platforms currently using this driver.
> > > 
> > > This seems like issue with ACPI gpio lookup implementation. If I am
> > > requesting named gpio and it is not present then I definitely do not
> > > need to be returned some random gpio. Doing so breaks all other drivers
> > > that use several names to retrieve GPIOs. We basically can't trust GPIO
> > > API on ACPI systems.
> > > 
> > 
> > I'm not sure there is a way to avoid fall back to indexed gpios when requesting
> > named gpios.
> > Adding Mika to this thread as he might help answer this.
> 
> Before ACPI 5.1 _DSD device properties were introduced all we had was an
> array of GPIOs returned by _CRS ACPI method. Ordering of those GPIOs
> could change from one vendor to another :-(
> 
> We can (and do) use acpi_dev_add_driver_gpios() to pass correct mappings
> where _DSD is not present based on the device ACPI ID for instance. Not
> all drivers do that, though.
> 
> I would like to get rid of the fallback completely at some point. We
> have had already problems with the API because then some ACPI only
> drivers did this:
> 
> 	reset_gpio = gpiod_get_index(dev, NULL, 0);
> 	power_gpio = gpiod_get_index(dev, NULL, 1);
> 
> which might not do what is expected on DT systems. That's why
> acpi_dev_add_driver_gpios() was added in the first place IIRC.

I understand why one might use acpi_dev_add_driver_gpios() to augment
data in ACPI, however here we have completely different issue: driver
that expects named gpios gets returned gpio that has nothing to do with
what it requested, because gpiolib acpi code always falls back to
unnamed gpio if it does not find named gpio. That can be acceptable if
driver uses the same con_id for all requests to gpiolib, but is not
working when driver supplies different con_ids.

Thanks.

-- 
Dmitry

  reply	other threads:[~2015-10-14  6:23 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-12 15:24 [PATCH v9 0/9] Goodix touchscreen enhancements Irina Tirdea
2015-10-12 15:24 ` Irina Tirdea
2015-10-12 15:24 ` [PATCH v9 1/9] Input: goodix - use actual config length for each device type Irina Tirdea
2015-10-12 15:24 ` [PATCH v9 2/9] Input: goodix - reset device at init Irina Tirdea
2015-10-12 16:48   ` Dmitry Torokhov
2015-10-13  6:38     ` Tirdea, Irina
2015-10-13  7:08       ` Dmitry Torokhov
2015-10-13  7:08         ` Dmitry Torokhov
2015-10-13  8:54         ` Tirdea, Irina
2015-10-13 10:07           ` mika.westerberg
2015-10-14  6:23             ` Dmitry Torokhov [this message]
2015-10-14 11:18               ` mika.westerberg
2015-10-14 13:44                 ` mika.westerberg
2015-10-14 13:44                   ` mika.westerberg-VuQAYsv1563Yd54FQh9/CA
2015-10-19 14:32                   ` Tirdea, Irina
2015-10-19 14:52                     ` mika.westerberg
2015-10-30 16:33                       ` Dmitry Torokhov
2015-10-31 17:28                         ` Dmitry Torokhov
2015-11-02 10:17                         ` mika.westerberg
2015-11-02 10:17                           ` mika.westerberg-VuQAYsv1563Yd54FQh9/CA
2015-10-12 15:24 ` [PATCH v9 3/9] Input: goodix - write configuration data to device Irina Tirdea
2015-10-12 15:24 ` [PATCH v9 4/9] Input: goodix - add power management support Irina Tirdea
2015-10-12 15:24 ` [PATCH v9 5/9] Input: goodix - use goodix_i2c_write_u8 instead of i2c_master_send Irina Tirdea
2015-10-12 15:24 ` [PATCH v9 6/9] Input: goodix - add support for ESD Irina Tirdea
2015-10-12 15:24 ` [PATCH v9 7/9] Input: goodix - add sysfs interface to dump config Irina Tirdea
2015-10-12 15:24 ` [PATCH v9 8/9] Input: goodix - add runtime power management support Irina Tirdea
2015-10-12 15:24 ` [PATCH v9 9/9] Input: goodix - sort includes using inverse Xmas tree order Irina Tirdea
2015-10-12 15:39   ` Mark Rutland
2015-10-12 15:39     ` Mark Rutland
2015-10-12 15:40     ` Bastien Nocera
2015-10-12 15:51       ` Mark Rutland
2015-10-12 15:51         ` Mark Rutland
2015-10-12 15:53         ` Bastien Nocera
2015-10-12 16:30           ` Dmitry Torokhov
2015-10-12 16:30             ` Dmitry Torokhov
2015-10-13  6:42             ` Tirdea, Irina
2015-10-13  6:42               ` Tirdea, Irina
2015-10-26 15:06 ` [PATCH v9 0/9] Goodix touchscreen enhancements Bastien Nocera
2015-10-26 15:06   ` Bastien Nocera
2015-10-26 18:21   ` Karsten Merker
2015-10-26 18:40     ` Bastien Nocera
2015-10-26 23:32     ` Dmitry Torokhov
2015-10-27  9:13       ` Tirdea, Irina
2015-10-27  9:13         ` Tirdea, Irina
2015-10-27  9:15     ` Tirdea, Irina
2015-10-27  9:15       ` Tirdea, Irina

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=20151014062303.GC20406@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=hadess@hadess.net \
    --cc=irina.tirdea@intel.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mamlinav@gmail.com \
    --cc=mark.rutland@arm.com \
    --cc=merker@debian.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=octavian.purdila@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.