From: Grant Likely <grant.likely@secretlab.ca>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Mathias Nyman <mathias.nyman@linux.intel.com>,
mika.westerberg@linux.intel.com, rafael.j.wysocki@intel.com,
linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org
Subject: Re: [PATCH 1/1] gpio: add Lynxpoint chipset gpio driver.
Date: Tue, 11 Dec 2012 16:48:16 +0000 [thread overview]
Message-ID: <20121211164817.0570F3E0C3E@localhost> (raw)
In-Reply-To: <CACRpkdaaFZ2Ai1tWy5KYxF9dVWmc8s4Lj8DajACAFYHdBFxBtg@mail.gmail.com>
On Tue, 11 Dec 2012 01:34:04 +0100, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Tue, Dec 11, 2012 at 12:07 AM, Grant Likely
> <grant.likely@secretlab.ca> wrote:
> > On Fri, 7 Dec 2012 16:01:39 +0200, Mathias Nyman <mathias.nyman@linux.intel.com> wrote:
> >> Add gpio support for Intel Lynxpoint chipset.
> >> Lynxpoint supports 94 gpio pins which can generate interrupts.
> >> Driver will fail requests for pins that are marked as owned by ACPI, or
> >> set in an alternate mode (non-gpio).
> >>
> >> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
> >> ---
> >> +static void lp_gpio_set(struct gpio_chip *chip, unsigned gpio, int value)
> >> +{
> >> + struct lp_gpio *lg = container_of(chip, struct lp_gpio, chip);
> >> + unsigned long reg = gpio_reg(chip, gpio, LP_CONFIG1);
> >> + unsigned long flags;
> >> +
> >> + spin_lock_irqsave(&lg->lock, flags);
> >> +
> >> + if (value)
> >> + outl(inl(reg) | OUT_LVL_BIT, reg);
> >> + else
> >> + outl(inl(reg) & ~OUT_LVL_BIT, reg);
> >> +
> >> + spin_unlock_irqrestore(&lg->lock, flags);
> >> +}
> >
> > A *lot* of drivers implement their own GPIO ops like this, and they all
> > end up looking the same. Please take a look at
> > drivers/gpio/gpio-generic.c and see if you can use the stock operations
> > provided there.
>
> I was under the impression that the generic code could not be
> used off-the-shelf for drivers doing irqchips (like this one).
>
> But maybe I'm mistaken or it's trivial to fix?
There's two parts to the generic code, a library of helper ops and a
full fledged platform driver. The library can be used without the
platform driver bit.
g.
next prev parent reply other threads:[~2012-12-11 16:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-07 14:01 [PATCH 0/1] gpio: add Lynxpoint chipset gpio driver Mathias Nyman
2012-12-07 14:01 ` [PATCH 1/1] " Mathias Nyman
2012-12-10 9:48 ` Linus Walleij
2012-12-10 14:06 ` Mathias Nyman
2012-12-10 21:48 ` Linus Walleij
2012-12-10 23:07 ` Grant Likely
2012-12-10 23:07 ` Grant Likely
2012-12-11 0:34 ` Linus Walleij
2012-12-11 16:48 ` Grant Likely [this message]
2012-12-11 11:40 ` Mathias Nyman
2012-12-11 16:52 ` Grant Likely
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=20121211164817.0570F3E0C3E@localhost \
--to=grant.likely@secretlab.ca \
--cc=linus.walleij@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
--cc=mika.westerberg@linux.intel.com \
--cc=rafael.j.wysocki@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.