linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Hemanth V" <hemanthv@ti.com>
To: "Datta, Shubhrajyoti" <shubhrajyoti@ti.com>
Cc: "linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
Subject: RE: [RFC][PATCH1/2] SFH7741: proximity sensor driver support
Date: Tue, 4 May 2010 11:46:09 +0530 (IST)	[thread overview]
Message-ID: <52275.10.24.255.17.1272953769.squirrel@dbdmail.itg.ti.com> (raw)
In-Reply-To: <0680EC522D0CC943BC586913CF3768C003B3164BC3@dbde02.ent.ti.com>

>> ----- Original Message -----
>> From: "Datta, Shubhrajyoti" <shubhrajyoti@ti.com>
>> >
>> > From: Datta, Shubhrajyoti
>> > Sent: Monday, May 03, 2010 11:07 AM
>> > To: Datta, Shubhrajyoti
>> > Subject: [RFC][PATCH1/2] SFH7741: proximity sensor driver support
>> >
>>
>> > +
>> > +static irqreturn_t sfh7741_isr(int irq, void *dev_id)
>> > +{
>> > + struct sfh7741_drvdata *ddata = dev_id;
>> > +
>> > + int proximity = gpio_get_value(ddata->proximity_out);
>> > + input_report_abs(ddata->input, ABS_DISTANCE, proximity);
>> > + input_sync(ddata->input);
>> > +
>> > + return IRQ_HANDLED;
>> > +}
>> > +
>> > +static int __devinit sfh7741_setup(struct device *dev,
>> > + struct sfh7741_drvdata *ddata
>> > + )
>> > +{
>> > + int  error;
>> > + char *desc = "sfh7741";
>> > +
>> > + error = gpio_request(ddata->proximity_out, desc);
>> > + if (error < 0) {
>> > + dev_err(dev, "failed to request GPIO %d, error %d\n",
>> > + ddata->proximity_out, error);
>> > + return error;
>> > + }
>> > +
>> > + error = gpio_direction_input(ddata->proximity_out);
>> > + if (error < 0) {
>> > + dev_err(dev, "failed to configure direction for GPIO %d,\
>> > + error %d\n", ddata->proximity_out, error);
>> > + goto fail1;
>> > + }
>> > +
>>
>> General comment about GPIO,
>> It might be better to have GPIO configuration as part of board file,
>> rather than being part of the driver. This is should make the driver
>> more generic.
> I read GPIO in the ISR how can I take care of that?

A generic read function pointer could be defined as part
of platform data, which could be used to retieve gpio value



      reply	other threads:[~2010-05-04  6:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-03  5:46 [RFC][PATCH1/2] SFH7741: proximity sensor driver support Datta, Shubhrajyoti
2010-05-03  7:56 ` Hemanth V
2010-05-03  9:07   ` Datta, Shubhrajyoti
2010-05-04  6:16     ` Hemanth V [this message]

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=52275.10.24.255.17.1272953769.squirrel@dbdmail.itg.ti.com \
    --to=hemanthv@ti.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=shubhrajyoti@ti.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).