lkml.org 
[lkml]   [2012]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 1/1] gpio: add Lynxpoint chipset gpio driver.
Date
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.

g.



\
 
 \ /
  Last update: 2012-12-11 00:21    [W:0.085 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site