Re: [PATCH 1/1] gpio: add Lynxpoint chipset gpio driver.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 11 Dec 2012 01:34:04 +0100, Linus Walleij <linus.walleij@xxxxxxxxxx> wrote:
> On Tue, Dec 11, 2012 at 12:07 AM, Grant Likely
> <grant.likely@xxxxxxxxxxxx> wrote:
> > On Fri,  7 Dec 2012 16:01:39 +0200, Mathias Nyman <mathias.nyman@xxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx>
> >> ---
> >> +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.

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux