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


Groups > linux.kernel > #1402981

Re: [PATCH v3] Input - surface3_spi: add new driver for the Surface 3

Path csiph.com!news.redatomik.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!137.226.75.22.MISMATCH!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!border2.nntp.ams1.giganews.com!nntp.giganews.com!news.panservice.it!bofh.it!news.nic.it!robomod
From Benjamin Tissoires <benjamin.tissoires@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH v3] Input - surface3_spi: add new driver for the Surface 3
Date Wed, 18 May 2016 15:40:02 +0200
Message-ID <rA9RE-2KE-23@gated-at.bofh.it> (permalink)
References <rzKgx-3g5-3@gated-at.bofh.it> <rzRBn-7V2-1@gated-at.bofh.it> <rzSH7-aP-7@gated-at.bofh.it>
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Disposition inline
X-Scanned-By MIMEDefang 2.68 on 10.5.11.22
X-Greylist Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 18 May 2016 13:31:42 +0000 (UTC)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 65
Organization linux.* mail to news gateway
X-Original-Cc Bastien Nocera <hadess@hadess.net>, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
X-Original-Date Wed, 18 May 2016 15:31:38 +0200
X-Original-Message-ID <20160518133137.GE23234@mail.corp.redhat.com>
X-Original-References <1463480179-11974-1-git-send-email-benjamin.tissoires@redhat.com> <20160517180428.GA9007@dtor-ws> <20160517191355.GD23234@mail.corp.redhat.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1402981

Show key headers only | View raw


On May 17 2016 or thereabouts, Benjamin Tissoires wrote:
> On May 17 2016 or thereabouts, Dmitry Torokhov wrote:
> > Hi Benjamin,
> > 
> > On Tue, May 17, 2016 at 12:16:19PM +0200, Benjamin Tissoires wrote:
> > > This is a basic driver for the Surface 3. I am not so sure it will work
> > > with any firmwares as most values are encoded, but given that I only have
> > > access to my current device with its firmware and I don't have the
> > > datasheet, it should be OK for now.
> > > 
> > > The Surface Pen is not supported (if it is supposed to be). I'll work on
> > > this when I get one.
> > > 
> > > Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> > > ---
> > > Changes in v2:
> > > 
> > > - module renamed from ntrig_spi to surface3_spi
> > > - took into account Dmitry's remarks
> > > - kept the retrieval of the GPIO as mandatory as otherwise the device fails to work
> > > 
> > > Changes in v3:
> > > 
> > > - asm include put at the end
> > > - used proper types in struct surfacae3_ts_data_finger
> > > - dropped temps in surface3_spi_report_touch()
> > > - inlined surface3_spi_request_irq()
> > > - detect IRQ type (falling/rising) depending on the gpiod active low parameter
> > 
> > I do not think that this should be done in the driver. The device either
> > has interrupt descriptor or GpioInt decriptor in DSDT and SPI core/ACPI
> > should do the right thing and configure GPIO as input and set interrupt
> > polarity accordingly, so when you do request_threaded_irq() you only
> > need to specify IRQF_ONESHOT.
> > 
> > See drivers/spi/spi.c - in case there is no interrupt specified we call
> > acpi_dev_gpio_irq_get(). Do you see it called in your case? Or your DSDT
> > has interrupt for the touchscreen device and acpi_spi_add_resource() and
> > acpi_dev_resource_interrupt() are called? You need to trace it and
> > figure out if there is an issue there with setting up interrupt
> > properly.
> 
> Looks like I need to push further the tests. From what I can see, using
> just IRQF_ONESHOT is not sufficient enough and I need to add the trigger
> falling manually (thus this way of doing).
> 

I think I finally got it: I traced irq_get_irq_type() just before
calling devm_request_threaded_irq(), and the trigger flag was properly set.
The thing is that the IRQ was triggered only if I actually set the
trigger in the flag (using "IRQF_ONESHOT | irq_get_irq_type(spi->irq)"
was making it working).

And the final problem I had was that I was requesting the gpiod
for the interrupt. I think this just messed up the gpiochip
configuration and the request irq needs to reset it properly.

So removing a bunch of lines of code solves it :)
(I know, you already told me to remove it in v1, but it did not work at
that time :-P ).

v4 on its way after a few more tests.

Cheers,
Benjamin

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH v3] Input - surface3_spi: add new driver for the Surface 3 Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2016-05-17 12:20 +0200
  Re: [PATCH v3] Input - surface3_spi: add new driver for the Surface  3 Bastien Nocera <hadess@hadess.net> - 2016-05-17 20:00 +0200
  Re: [PATCH v3] Input - surface3_spi: add new driver for the Surface 3 Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-05-17 20:10 +0200
    Re: [PATCH v3] Input - surface3_spi: add new driver for the Surface 3 Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2016-05-17 21:20 +0200
      Re: [PATCH v3] Input - surface3_spi: add new driver for the Surface 3 Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2016-05-18 15:40 +0200

csiph-web