[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160725170839.GA27415@dtor-ws>
Date: Mon, 25 Jul 2016 10:08:39 -0700
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: maxime.ripard@...e-electrons.com
Cc: Quentin Schulz <quentin.schulz@...e-electrons.com>,
jic23@...nel.org, knaack.h@....de, lars@...afoo.de,
pmeerw@...erw.net, wens@...e.org, lee.jones@...aro.org,
antoine.tenart@...e-electrons.com,
thomas.petazzoni@...e-electrons.com, linux-kernel@...r.kernel.org,
linux-iio@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-input@...r.kernel.org
Subject: Re: [PATCH 4/5] input: touchscreen: support Allwinner SoCs'
touchscreen
On Mon, Jul 25, 2016 at 11:45:42AM +0200, maxime.ripard@...e-electrons.com wrote:
> Hi Dmitry,
>
> On Wed, Jul 20, 2016 at 11:41:40PM -0700, Dmitry Torokhov wrote:
> > On Thu, Jul 21, 2016 at 08:29:50AM +0200, Maxime Ripard wrote:
> > > On Wed, Jul 20, 2016 at 10:29:10AM +0200, Quentin Schulz wrote:
> > > > + irq = regmap_irq_get_virq(sunxi_gpadc_mfd_dev->regmap_irqc, irq);
> > > > + ret = devm_request_any_context_irq(&pdev->dev, irq,
> > > > + sunxi_gpadc_tp_up_irq_handler, 0,
> > > > + "tp_up", info);
> > > > + if (ret < 0) {
> > > > + dev_err(&pdev->dev,
> > > > + "could not request TP_UP_PENDING interrupt: %d\n", ret);
> > > > + goto err;
> > > > + }
> > >
> > > You enable the interrupts...
> > >
> > > > + info->tp_up_irq = irq;
> > > > + disable_irq(irq);
> > > > +
> > > > + ret = input_register_device(input);
> > > > + if (ret) {
> > > > + dev_err(&pdev->dev, "failed to register input device\n");
> > > > + goto err;
> > > > + }
> > >
> > > ... but your driver isn't registered yet. How does input_report and
> > > input_sync behave in such a case?
> >
> > This is explicitly allowed:
> >
> > "
> > ...
> > * NOTE: input_event() may be safely used right after input device was
> > * allocated with input_allocate_device(), even before it is registered
> > * with input_register_device(), but the event will not reach any of the
> > * input handlers. Such early invocation of input_event() may be used
> > * to 'seed' initial state of a switch or initial position of absolute
> > * axis, etc.
> > */
> > "
>
> Good to know. Still, it feels like it should be handled explicitly,
> instead of relying on the fact that we only call input_event in our
> handler and that it works that way.
Why? It is the documented property of input API and it is done so
precisely so that you can register interrupt before registering input
device. That is done because once registered input device is supposed to
be fully-functional. It does not matter for this driver but there are
drivers out there that require interrupt handling as part of their
"open" method.
Thanks.
--
Dmitry
Powered by blists - more mailing lists