gpio-track.h 860 B

123456789101112131415161718192021222324252627282930313233
  1. /* arch/arm/mach-s3c24100/include/mach/gpio-core.h
  2. *
  3. * Copyright 2008 Openmoko, Inc.
  4. * Copyright 2008 Simtec Electronics
  5. * Ben Dooks <ben@simtec.co.uk>
  6. * http://armlinux.simtec.co.uk/
  7. *
  8. * S3C2410 - GPIO core support
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #ifndef __ASM_ARCH_GPIO_CORE_H
  15. #define __ASM_ARCH_GPIO_CORE_H __FILE__
  16. #include <mach/regs-gpio.h>
  17. extern struct s3c_gpio_chip s3c24xx_gpios[];
  18. static inline struct s3c_gpio_chip *s3c_gpiolib_getchip(unsigned int pin)
  19. {
  20. struct s3c_gpio_chip *chip;
  21. if (pin > S3C_GPIO_END)
  22. return NULL;
  23. chip = &s3c24xx_gpios[pin/32];
  24. return ((pin - chip->chip.base) < chip->chip.ngpio) ? chip : NULL;
  25. }
  26. #endif /* __ASM_ARCH_GPIO_CORE_H */