linux/drivers/pinctrl/pinconf.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0-only */
   2/*
   3 * Internal interface between the core pin control system and the
   4 * pin config portions
   5 *
   6 * Copyright (C) 2011 ST-Ericsson SA
   7 * Written on behalf of Linaro for ST-Ericsson
   8 * Based on bits of regulator core, gpio core and clk core
   9 *
  10 * Author: Linus Walleij <linus.walleij@linaro.org>
  11 */
  12
  13#ifdef CONFIG_PINCONF
  14
  15int pinconf_check_ops(struct pinctrl_dev *pctldev);
  16int pinconf_validate_map(const struct pinctrl_map *map, int i);
  17int pinconf_map_to_setting(const struct pinctrl_map *map,
  18                          struct pinctrl_setting *setting);
  19void pinconf_free_setting(const struct pinctrl_setting *setting);
  20int pinconf_apply_setting(const struct pinctrl_setting *setting);
  21
  22int pinconf_set_config(struct pinctrl_dev *pctldev, unsigned pin,
  23                       unsigned long *configs, size_t nconfigs);
  24
  25/*
  26 * You will only be interested in these if you're using PINCONF
  27 * so don't supply any stubs for these.
  28 */
  29int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
  30                           unsigned long *config);
  31int pin_config_group_get(const char *dev_name, const char *pin_group,
  32                         unsigned long *config);
  33
  34#else
  35
  36static inline int pinconf_check_ops(struct pinctrl_dev *pctldev)
  37{
  38        return 0;
  39}
  40
  41static inline int pinconf_validate_map(const struct pinctrl_map *map, int i)
  42{
  43        return 0;
  44}
  45
  46static inline int pinconf_map_to_setting(const struct pinctrl_map *map,
  47                          struct pinctrl_setting *setting)
  48{
  49        return 0;
  50}
  51
  52static inline void pinconf_free_setting(const struct pinctrl_setting *setting)
  53{
  54}
  55
  56static inline int pinconf_apply_setting(const struct pinctrl_setting *setting)
  57{
  58        return 0;
  59}
  60
  61static inline int pinconf_set_config(struct pinctrl_dev *pctldev, unsigned pin,
  62                                     unsigned long *configs, size_t nconfigs)
  63{
  64        return -ENOTSUPP;
  65}
  66
  67#endif
  68
  69#if defined(CONFIG_PINCONF) && defined(CONFIG_DEBUG_FS)
  70
  71void pinconf_show_map(struct seq_file *s, const struct pinctrl_map *map);
  72void pinconf_show_setting(struct seq_file *s,
  73                          const struct pinctrl_setting *setting);
  74void pinconf_init_device_debugfs(struct dentry *devroot,
  75                                 struct pinctrl_dev *pctldev);
  76
  77#else
  78
  79static inline void pinconf_show_map(struct seq_file *s,
  80                                    const struct pinctrl_map *map)
  81{
  82}
  83
  84static inline void pinconf_show_setting(struct seq_file *s,
  85                                        const struct pinctrl_setting *setting)
  86{
  87}
  88
  89static inline void pinconf_init_device_debugfs(struct dentry *devroot,
  90                                               struct pinctrl_dev *pctldev)
  91{
  92}
  93
  94#endif
  95
  96/*
  97 * The following functions are available if the driver uses the generic
  98 * pin config.
  99 */
 100
 101#if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_DEBUG_FS)
 102
 103void pinconf_generic_dump_pins(struct pinctrl_dev *pctldev,
 104                               struct seq_file *s, const char *gname,
 105                               unsigned pin);
 106
 107void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
 108                                 struct seq_file *s, unsigned long config);
 109#else
 110
 111static inline void pinconf_generic_dump_pins(struct pinctrl_dev *pctldev,
 112                                             struct seq_file *s,
 113                                             const char *gname, unsigned pin)
 114{
 115        return;
 116}
 117
 118static inline void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
 119                                               struct seq_file *s,
 120                                               unsigned long config)
 121{
 122        return;
 123}
 124#endif
 125
 126#if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_OF)
 127int pinconf_generic_parse_dt_config(struct device_node *np,
 128                                    struct pinctrl_dev *pctldev,
 129                                    unsigned long **configs,
 130                                    unsigned int *nconfigs);
 131#endif
 132