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


Groups > linux.kernel > #1738715

Re: [PATCH] Input: add support for the Samsung S6SY761 touchscreen

From Andi Shyti <andi.shyti@samsung.com>
Newsgroups linux.kernel
Subject Re: [PATCH] Input: add support for the Samsung S6SY761 touchscreen
Date 2017-09-25 04:50 +0200
Message-ID <utrD3-7o-3@gated-at.bofh.it> (permalink)
References <us9If-1wS-23@gated-at.bofh.it> <us9If-1wS-21@gated-at.bofh.it> <usgJI-5J0-15@gated-at.bofh.it> <usnBw-1xD-3@gated-at.bofh.it> <uszMn-oq-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Dmitry,

> > > > +static void s6sy761_report_coordinates(struct s6sy761_data *sdata, u8 *event)
> > > > +{
> > > > +	u8 tid = ((event[0] & S6SY761_MASK_TID) >> 2) - 1;
> > > 
> > > Should we make sure that event[0] & S6SY761_MASK_TID is not 0?
> > 
> > I check event[0] already in s6sy761_handle_events (called by the
> > irq handler), if we get here event[0] is for sure positive...
> > 
> > [...]
> > 
> > > > +static void s6sy761_handle_events(struct s6sy761_data *sdata, u8 left_event)
> > > > +{
> > > > +	int i;
> > > > +
> > > > +	for (i = 0; i < left_event; i++) {
> > > > +		u8 *event = &sdata->data[i * S6SY761_EVENT_SIZE];
> > > > +		u8 event_id = event[0] & S6SY761_MASK_EID;
> > > > +
> > > > +		if (!event[0])
> > > > +			return;
> > 		   ^^^^^^^^
> > ... exactly here.
> > 
> > '!event[0]' means also to me that there is nothing left,
> > therefore I can discard whatever is next (given that there is
> > something left).
> 
> What happens if you get event[0] == S6SY761_EVENT_ID_COORDINATE? I.e.
> the value is non-zero, but tid component is 0?

Oh, I see what you mean. It shouldn't happen, in anycase I can
put it under an 'unlikely' statement.

> > > > +	err = devm_request_threaded_irq(&client->dev, client->irq, NULL,
> > > > +					s6sy761_irq_handler,
> > > > +					IRQF_TRIGGER_LOW | IRQF_ONESHOT,
> > > > +					"s6sy761_irq", sdata);
> > > > +	if (err)
> > > > +		return err;
> > > > +
> > > > +	disable_irq(client->irq);
> > > 
> > > Can you request IRQ after allocating and setting up the input device?
> > > Then you do not need to check for its presence in the interrupt handler.
> > 
> > The reason I do it here is because the x and y are embedded in
> > the device itself. This means that I first need to enable the
> > device, read x and y and then register the input device.
> > 
> > At power up I might expect an interrupt coming, thus I need to
> > check if 'input' is not 'NULL'.
> 
> But you do not need interrupts to read x and y, right? So you can power
> device, create input device, set it up as needed, and then request irq,
> or am I missing something?

OK, all right. I'll do that. I will move the irq request after
the input registration.

Thanks again for your review,
Andi

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


Thread

[PATCH] Input: add support for the Samsung S6SY761 touchscreen Andi Shyti <andi.shyti@samsung.com> - 2017-09-21 15:30 +0200
  Re: [PATCH] Input: add support for the Samsung S6SY761 touchscreen Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-09-21 23:00 +0200
    Re: [PATCH] Input: add support for the Samsung S6SY761 touchscreen Andi Shyti <andi.shyti@samsung.com> - 2017-09-22 06:20 +0200
      Re: [PATCH] Input: add support for the Samsung S6SY761 touchscreen Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-09-22 19:20 +0200
        Re: [PATCH] Input: add support for the Samsung S6SY761 touchscreen Andi Shyti <andi.shyti@samsung.com> - 2017-09-25 04:50 +0200

csiph-web