Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gpio-cfg-helpers.h
Go to the documentation of this file.
1 /* linux/arch/arm/plat-samsung/include/plat/gpio-cfg-helper.h
2  *
3  * Copyright 2008 Openmoko, Inc.
4  * Copyright 2008 Simtec Electronics
5  * http://armlinux.simtec.co.uk/
6  * Ben Dooks <[email protected]>
7  *
8  * Samsung Platform - GPIO pin configuration helper definitions
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 
15 /* This is meant for core cpu support, machine or other driver files
16  * should not be including this header.
17  */
18 
19 #ifndef __PLAT_GPIO_CFG_HELPERS_H
20 #define __PLAT_GPIO_CFG_HELPERS_H __FILE__
21 
22 /* As a note, all gpio configuration functions are entered exclusively, either
23  * with the relevant lock held or the system prevented from doing anything else
24  * by disabling interrupts.
25 */
26 
27 static inline int samsung_gpio_do_setcfg(struct samsung_gpio_chip *chip,
28  unsigned int off, unsigned int config)
29 {
30  return (chip->config->set_config)(chip, off, config);
31 }
32 
33 static inline unsigned samsung_gpio_do_getcfg(struct samsung_gpio_chip *chip,
34  unsigned int off)
35 {
36  return (chip->config->get_config)(chip, off);
37 }
38 
39 static inline int samsung_gpio_do_setpull(struct samsung_gpio_chip *chip,
40  unsigned int off, samsung_gpio_pull_t pull)
41 {
42  return (chip->config->set_pull)(chip, off, pull);
43 }
44 
45 static inline samsung_gpio_pull_t samsung_gpio_do_getpull(struct samsung_gpio_chip *chip,
46  unsigned int off)
47 {
48  return chip->config->get_pull(chip, off);
49 }
50 
51 /* Pull-{up,down} resistor controls.
52  *
53  * S3C2410,S3C2440 = Pull-UP,
54  * S3C2412,S3C2413 = Pull-Down
55  * S3C6400,S3C6410 = Pull-Both [None,Down,Up,Undef]
56  * S3C2443 = Pull-Both [not same as S3C6400]
57  */
58 
68 extern int s3c24xx_gpio_setpull_1up(struct samsung_gpio_chip *chip,
69  unsigned int off, samsung_gpio_pull_t pull);
70 
80 extern int s3c24xx_gpio_setpull_1down(struct samsung_gpio_chip *chip,
81  unsigned int off, samsung_gpio_pull_t pull);
82 
98 extern int samsung_gpio_setpull_updown(struct samsung_gpio_chip *chip,
99  unsigned int off, samsung_gpio_pull_t pull);
100 
112  unsigned int off);
113 
123  unsigned int off);
124 
134  unsigned int off);
135 
149 extern int s3c2443_gpio_setpull(struct samsung_gpio_chip *chip,
150  unsigned int off, samsung_gpio_pull_t pull);
151 
161  unsigned int off);
162 
163 #endif /* __PLAT_GPIO_CFG_HELPERS_H */