[PATCH 2/4] [POWERPC] Implement support for the GPIO LIB API

Anton Vorontsov avorontsov at ru.mvista.com
Thu Apr 3 23:18:48 EST 2008


On Thu, Apr 03, 2008 at 01:05:51PM +0200, Laurent Pinchart wrote:
> Hi Anton,
> 
> On Tuesday 11 March 2008 19:42, Anton Vorontsov wrote:
> > This patch implements support for the GPIO LIB API. Two calls
> > unimplemented though: irq_to_gpio and gpio_to_irq.
> > 
> > Signed-off-by: Anton Vorontsov <avorontsov at ru.mvista.com>
> > ---
> >  Documentation/powerpc/booting-without-of.txt |   52 ++++++++++++++++++++++++
> >  arch/powerpc/Kconfig                         |    5 ++
> >  include/asm-powerpc/gpio.h                   |   55 ++++++++++++++++++++++++++
> >  3 files changed, 112 insertions(+), 0 deletions(-)
> >  create mode 100644 include/asm-powerpc/gpio.h
> 
> [snip]
> 
> > diff --git a/include/asm-powerpc/gpio.h b/include/asm-powerpc/gpio.h
> > new file mode 100644
> > index 0000000..057840d
> > --- /dev/null
> > +++ b/include/asm-powerpc/gpio.h
> > @@ -0,0 +1,55 @@
> > +/*
> > + * Generic GPIO API implementation for PowerPC.
> > + *
> > + * Copyright (c) 2007-2008  MontaVista Software, Inc.
> > + *
> > + * Author: Anton Vorontsov <avorontsov at ru.mvista.com>
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License as published by
> > + * the Free Software Foundation; either version 2 of the License, or
> > + * (at your option) any later version.
> > + */
> > +
> > +#ifndef __ASM_POWERPC_GPIO_H
> > +#define __ASM_POWERPC_GPIO_H
> > +
> > +#include <asm-generic/gpio.h>
> > +
> > +#ifdef CONFIG_HAVE_GPIO_LIB
> > +
> > +/*
> > + * We don't (yet) implement inlined/rapid versions for on-chip gpios.
> > + * Just call gpiolib.
> > + */
> > +static inline int gpio_get_value(unsigned int gpio)
> > +{
> > +	return __gpio_get_value(gpio);
> > +}
> > +
> > +static inline void gpio_set_value(unsigned int gpio, int value)
> > +{
> > +	__gpio_set_value(gpio, value);
> > +}
> > +
> > +static inline int gpio_cansleep(unsigned int gpio)
> > +{
> > +	return __gpio_cansleep(gpio);
> > +}
> > +
> > +/*
> > + * Not implemented, yet.
> > + */
> > +static inline int gpio_to_irq(unsigned int gpio)
> > +{
> > +	return -ENOSYS;
> > +}
> > +
> > +static inline int irq_to_gpio(unsigned int irq)
> > +{
> > +	return -EINVAL;
> > +}
> 
> You should include <linux/errno.h>.

Yeah, much thanks for catching this!

-- 
Anton Vorontsov
email: cboumailru at gmail.com
irc://irc.freenode.net/bd2



More information about the Linuxppc-dev mailing list