1 /* 2 * Interface the pinconfig portions of the pinctrl subsystem 3 * 4 * Copyright (C) 2011 ST-Ericsson SA 5 * Written on behalf of Linaro for ST-Ericsson 6 * This interface is used in the core to keep track of pins. 7 * 8 * Author: Linus Walleij <[email protected]> 9 * 10 * License terms: GNU General Public License (GPL) version 2 11 */ 12 #ifndef __LINUX_PINCTRL_PINCONF_H 13 #define __LINUX_PINCTRL_PINCONF_H 14 15 #ifdef CONFIG_PINCONF 16 17 struct pinctrl_dev; 18 struct seq_file; 19 20 /** 21 * struct pinconf_ops - pin config operations, to be implemented by 22 * pin configuration capable drivers. 23 * @pin_config_get: get the config of a certain pin, if the requested config 24 * is not available on this controller this should return -ENOTSUPP 25 * and if it is available but disabled it should return -EINVAL 26 * @pin_config_get: get the config of a certain pin 27 * @pin_config_set: configure an individual pin 28 * @pin_config_group_get: get configurations for an entire pin group 29 * @pin_config_group_set: configure all pins in a group 30 * @pin_config_dbg_show: optional debugfs display hook that will provide 31 * per-device info for a certain pin in debugfs 32 * @pin_config_group_dbg_show: optional debugfs display hook that will provide 33 * per-device info for a certain group in debugfs 34 */ 35 struct pinconf_ops { 36 int (*pin_config_get) (struct pinctrl_dev *pctldev, 37 unsigned pin, 38 unsigned long *config); 39 int (*pin_config_set) (struct pinctrl_dev *pctldev, 40 unsigned pin, 41 unsigned long config); 42 int (*pin_config_group_get) (struct pinctrl_dev *pctldev, 43 unsigned selector, 44 unsigned long *config); 45 int (*pin_config_group_set) (struct pinctrl_dev *pctldev, 46 unsigned selector, 47 unsigned long config); 48 void (*pin_config_dbg_show) (struct pinctrl_dev *pctldev, 49 struct seq_file *s, 50 unsigned offset); 51 void (*pin_config_group_dbg_show) (struct pinctrl_dev *pctldev, 52 struct seq_file *s, 53 unsigned selector); 54 }; 55 56 extern int pin_config_get(const char *dev_name, const char *name, 57 unsigned long *config); 58 extern int pin_config_set(const char *dev_name, const char *name, 59 unsigned long config); 60 extern int pin_config_group_get(const char *dev_name, 61 const char *pin_group, 62 unsigned long *config); 63 extern int pin_config_group_set(const char *dev_name, 64 const char *pin_group, 65 unsigned long config); 66 67 #else 68 69 static inline int pin_config_get(const char *dev_name, const char *name, 70 unsigned long *config) 71 { 72 return 0; 73 } 74 75 static inline int pin_config_set(const char *dev_name, const char *name, 76 unsigned long config) 77 { 78 return 0; 79 } 80 81 static inline int pin_config_group_get(const char *dev_name, 82 const char *pin_group, 83 unsigned long *config) 84 { 85 return 0; 86 } 87 88 static inline int pin_config_group_set(const char *dev_name, 89 const char *pin_group, 90 unsigned long config) 91 { 92 return 0; 93 } 94 95 #endif 96 97 #endif /* __LINUX_PINCTRL_PINCONF_H */ 98