Linus Walleij | 28a8d14 | 2012-02-09 01:52:22 +0100 | [diff] [blame^] | 1 | /* |
| 2 | * Consumer interface the pin control subsystem |
| 3 | * |
| 4 | * Copyright (C) 2012 ST-Ericsson SA |
| 5 | * Written on behalf of Linaro for ST-Ericsson |
| 6 | * Based on bits of regulator core, gpio core and clk core |
| 7 | * |
| 8 | * Author: Linus Walleij <linus.walleij@linaro.org> |
| 9 | * |
| 10 | * License terms: GNU General Public License (GPL) version 2 |
| 11 | */ |
| 12 | #ifndef __LINUX_PINCTRL_CONSUMER_H |
| 13 | #define __LINUX_PINCTRL_CONSUMER_H |
| 14 | |
| 15 | #include <linux/list.h> |
| 16 | #include <linux/seq_file.h> |
| 17 | #include "pinctrl.h" |
| 18 | |
| 19 | /* This struct is private to the core and should be regarded as a cookie */ |
| 20 | struct pinmux; |
| 21 | |
| 22 | #ifdef CONFIG_PINMUX |
| 23 | |
| 24 | /* External interface to pinmux */ |
| 25 | extern int pinmux_request_gpio(unsigned gpio); |
| 26 | extern void pinmux_free_gpio(unsigned gpio); |
| 27 | extern int pinmux_gpio_direction_input(unsigned gpio); |
| 28 | extern int pinmux_gpio_direction_output(unsigned gpio); |
| 29 | extern struct pinmux * __must_check pinmux_get(struct device *dev, const char *name); |
| 30 | extern void pinmux_put(struct pinmux *pmx); |
| 31 | extern int pinmux_enable(struct pinmux *pmx); |
| 32 | extern void pinmux_disable(struct pinmux *pmx); |
| 33 | |
| 34 | #else /* !CONFIG_PINMUX */ |
| 35 | |
| 36 | static inline int pinmux_request_gpio(unsigned gpio) |
| 37 | { |
| 38 | return 0; |
| 39 | } |
| 40 | |
| 41 | static inline void pinmux_free_gpio(unsigned gpio) |
| 42 | { |
| 43 | } |
| 44 | |
| 45 | static inline int pinmux_gpio_direction_input(unsigned gpio) |
| 46 | { |
| 47 | return 0; |
| 48 | } |
| 49 | |
| 50 | static inline int pinmux_gpio_direction_output(unsigned gpio) |
| 51 | { |
| 52 | return 0; |
| 53 | } |
| 54 | |
| 55 | static inline struct pinmux * __must_check pinmux_get(struct device *dev, const char *name) |
| 56 | { |
| 57 | return NULL; |
| 58 | } |
| 59 | |
| 60 | static inline void pinmux_put(struct pinmux *pmx) |
| 61 | { |
| 62 | } |
| 63 | |
| 64 | static inline int pinmux_enable(struct pinmux *pmx) |
| 65 | { |
| 66 | return 0; |
| 67 | } |
| 68 | |
| 69 | static inline void pinmux_disable(struct pinmux *pmx) |
| 70 | { |
| 71 | } |
| 72 | |
| 73 | #endif /* CONFIG_PINMUX */ |
| 74 | |
| 75 | #ifdef CONFIG_PINCONF |
| 76 | |
| 77 | extern int pin_config_get(const char *dev_name, const char *name, |
| 78 | unsigned long *config); |
| 79 | extern int pin_config_set(const char *dev_name, const char *name, |
| 80 | unsigned long config); |
| 81 | extern int pin_config_group_get(const char *dev_name, |
| 82 | const char *pin_group, |
| 83 | unsigned long *config); |
| 84 | extern int pin_config_group_set(const char *dev_name, |
| 85 | const char *pin_group, |
| 86 | unsigned long config); |
| 87 | |
| 88 | #else |
| 89 | |
| 90 | static inline int pin_config_get(const char *dev_name, const char *name, |
| 91 | unsigned long *config) |
| 92 | { |
| 93 | return 0; |
| 94 | } |
| 95 | |
| 96 | static inline int pin_config_set(const char *dev_name, const char *name, |
| 97 | unsigned long config) |
| 98 | { |
| 99 | return 0; |
| 100 | } |
| 101 | |
| 102 | static inline int pin_config_group_get(const char *dev_name, |
| 103 | const char *pin_group, |
| 104 | unsigned long *config) |
| 105 | { |
| 106 | return 0; |
| 107 | } |
| 108 | |
| 109 | static inline int pin_config_group_set(const char *dev_name, |
| 110 | const char *pin_group, |
| 111 | unsigned long config) |
| 112 | { |
| 113 | return 0; |
| 114 | } |
| 115 | |
| 116 | #endif |
| 117 | |
| 118 | #endif /* __LINUX_PINCTRL_CONSUMER_H */ |