Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Internal interface between the core pin control system and the
0004  * pin config portions
0005  *
0006  * Copyright (C) 2011 ST-Ericsson SA
0007  * Written on behalf of Linaro for ST-Ericsson
0008  * Based on bits of regulator core, gpio core and clk core
0009  *
0010  * Author: Linus Walleij <linus.walleij@linaro.org>
0011  */
0012 
0013 #ifdef CONFIG_PINCONF
0014 
0015 int pinconf_check_ops(struct pinctrl_dev *pctldev);
0016 int pinconf_validate_map(const struct pinctrl_map *map, int i);
0017 int pinconf_map_to_setting(const struct pinctrl_map *map,
0018               struct pinctrl_setting *setting);
0019 void pinconf_free_setting(const struct pinctrl_setting *setting);
0020 int pinconf_apply_setting(const struct pinctrl_setting *setting);
0021 
0022 int pinconf_set_config(struct pinctrl_dev *pctldev, unsigned pin,
0023                unsigned long *configs, size_t nconfigs);
0024 
0025 /*
0026  * You will only be interested in these if you're using PINCONF
0027  * so don't supply any stubs for these.
0028  */
0029 int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
0030                unsigned long *config);
0031 int pin_config_group_get(const char *dev_name, const char *pin_group,
0032              unsigned long *config);
0033 
0034 #else
0035 
0036 static inline int pinconf_check_ops(struct pinctrl_dev *pctldev)
0037 {
0038     return 0;
0039 }
0040 
0041 static inline int pinconf_validate_map(const struct pinctrl_map *map, int i)
0042 {
0043     return 0;
0044 }
0045 
0046 static inline int pinconf_map_to_setting(const struct pinctrl_map *map,
0047               struct pinctrl_setting *setting)
0048 {
0049     return 0;
0050 }
0051 
0052 static inline void pinconf_free_setting(const struct pinctrl_setting *setting)
0053 {
0054 }
0055 
0056 static inline int pinconf_apply_setting(const struct pinctrl_setting *setting)
0057 {
0058     return 0;
0059 }
0060 
0061 static inline int pinconf_set_config(struct pinctrl_dev *pctldev, unsigned pin,
0062                      unsigned long *configs, size_t nconfigs)
0063 {
0064     return -ENOTSUPP;
0065 }
0066 
0067 #endif
0068 
0069 #if defined(CONFIG_PINCONF) && defined(CONFIG_DEBUG_FS)
0070 
0071 void pinconf_show_map(struct seq_file *s, const struct pinctrl_map *map);
0072 void pinconf_show_setting(struct seq_file *s,
0073               const struct pinctrl_setting *setting);
0074 void pinconf_init_device_debugfs(struct dentry *devroot,
0075                  struct pinctrl_dev *pctldev);
0076 
0077 #else
0078 
0079 static inline void pinconf_show_map(struct seq_file *s,
0080                     const struct pinctrl_map *map)
0081 {
0082 }
0083 
0084 static inline void pinconf_show_setting(struct seq_file *s,
0085                     const struct pinctrl_setting *setting)
0086 {
0087 }
0088 
0089 static inline void pinconf_init_device_debugfs(struct dentry *devroot,
0090                            struct pinctrl_dev *pctldev)
0091 {
0092 }
0093 
0094 #endif
0095 
0096 /*
0097  * The following functions are available if the driver uses the generic
0098  * pin config.
0099  */
0100 
0101 #if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_DEBUG_FS)
0102 
0103 void pinconf_generic_dump_pins(struct pinctrl_dev *pctldev,
0104                    struct seq_file *s, const char *gname,
0105                    unsigned pin);
0106 
0107 void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
0108                  struct seq_file *s, unsigned long config);
0109 #else
0110 
0111 static inline void pinconf_generic_dump_pins(struct pinctrl_dev *pctldev,
0112                          struct seq_file *s,
0113                          const char *gname, unsigned pin)
0114 {
0115     return;
0116 }
0117 
0118 static inline void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
0119                            struct seq_file *s,
0120                            unsigned long config)
0121 {
0122     return;
0123 }
0124 #endif
0125 
0126 #if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_OF)
0127 int pinconf_generic_parse_dt_config(struct device_node *np,
0128                     struct pinctrl_dev *pctldev,
0129                     unsigned long **configs,
0130                     unsigned int *nconfigs);
0131 #endif