~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/pinctrl/pinctrl.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/linux/pinctrl/pinctrl.h (Version linux-6.12-rc7) and /include/linux/pinctrl/pinctrl.h (Version linux-4.20.17)


  1 /* SPDX-License-Identifier: GPL-2.0-only */    << 
  2 /*                                                  1 /*
  3  * Interface the pinctrl subsystem                  2  * Interface the pinctrl subsystem
  4  *                                                  3  *
  5  * Copyright (C) 2011 ST-Ericsson SA                4  * Copyright (C) 2011 ST-Ericsson SA
  6  * Written on behalf of Linaro for ST-Ericsson      5  * Written on behalf of Linaro for ST-Ericsson
  7  * This interface is used in the core to keep       6  * This interface is used in the core to keep track of pins.
  8  *                                                  7  *
  9  * Author: Linus Walleij <linus.walleij@linaro      8  * Author: Linus Walleij <linus.walleij@linaro.org>
                                                   >>   9  *
                                                   >>  10  * License terms: GNU General Public License (GPL) version 2
 10  */                                                11  */
 11 #ifndef __LINUX_PINCTRL_PINCTRL_H                  12 #ifndef __LINUX_PINCTRL_PINCTRL_H
 12 #define __LINUX_PINCTRL_PINCTRL_H                  13 #define __LINUX_PINCTRL_PINCTRL_H
 13                                                    14 
 14 #include <linux/types.h>                       !!  15 #ifdef CONFIG_PINCTRL
 15                                                    16 
 16 struct device;                                 !!  17 #include <linux/radix-tree.h>
 17 struct device_node;                            !!  18 #include <linux/list.h>
 18 struct gpio_chip;                              !!  19 #include <linux/seq_file.h>
 19 struct module;                                 !!  20 #include <linux/pinctrl/pinctrl-state.h>
 20 struct seq_file;                               !!  21 #include <linux/pinctrl/devinfo.h>
 21                                                    22 
 22 struct pin_config_item;                        !!  23 struct device;
 23 struct pinconf_generic_params;                 << 
 24 struct pinconf_ops;                            << 
 25 struct pinctrl_dev;                                24 struct pinctrl_dev;
 26 struct pinctrl_map;                                25 struct pinctrl_map;
 27 struct pinmux_ops;                                 26 struct pinmux_ops;
 28                                                !!  27 struct pinconf_ops;
 29 /**                                            !!  28 struct pin_config_item;
 30  * struct pingroup - provides information on p !!  29 struct gpio_chip;
 31  * @name: a name for pingroup                  !!  30 struct device_node;
 32  * @pins: an array of pins in the pingroup     << 
 33  * @npins: number of pins in the pingroup      << 
 34  */                                            << 
 35 struct pingroup {                              << 
 36         const char *name;                      << 
 37         const unsigned int *pins;              << 
 38         size_t npins;                          << 
 39 };                                             << 
 40                                                << 
 41 /* Convenience macro to define a single named  << 
 42 #define PINCTRL_PINGROUP(_name, _pins, _npins) << 
 43 (struct pingroup) {                            << 
 44         .name = _name,                         << 
 45         .pins = _pins,                         << 
 46         .npins = _npins,                       << 
 47 }                                              << 
 48                                                    31 
 49 /**                                                32 /**
 50  * struct pinctrl_pin_desc - boards/machines p     33  * struct pinctrl_pin_desc - boards/machines provide information on their
 51  * pins, pads or other muxable units in this s     34  * pins, pads or other muxable units in this struct
 52  * @number: unique pin number from the global      35  * @number: unique pin number from the global pin number space
 53  * @name: a name for this pin                      36  * @name: a name for this pin
 54  * @drv_data: driver-defined per-pin data. pin     37  * @drv_data: driver-defined per-pin data. pinctrl core does not touch this
 55  */                                                38  */
 56 struct pinctrl_pin_desc {                          39 struct pinctrl_pin_desc {
 57         unsigned int number;                   !!  40         unsigned number;
 58         const char *name;                          41         const char *name;
 59         void *drv_data;                            42         void *drv_data;
 60 };                                                 43 };
 61                                                    44 
 62 /* Convenience macro to define a single named      45 /* Convenience macro to define a single named or anonymous pin descriptor */
 63 #define PINCTRL_PIN(a, b) { .number = a, .name     46 #define PINCTRL_PIN(a, b) { .number = a, .name = b }
 64 #define PINCTRL_PIN_ANON(a) { .number = a }        47 #define PINCTRL_PIN_ANON(a) { .number = a }
 65                                                    48 
 66 /**                                                49 /**
 67  * struct pinctrl_gpio_range - each pin contro     50  * struct pinctrl_gpio_range - each pin controller can provide subranges of
 68  * the GPIO number space to be handled by the      51  * the GPIO number space to be handled by the controller
 69  * @node: list node for internal use               52  * @node: list node for internal use
 70  * @name: a name for the chip in this range        53  * @name: a name for the chip in this range
 71  * @id: an ID number for the chip in this rang     54  * @id: an ID number for the chip in this range
 72  * @base: base offset of the GPIO range            55  * @base: base offset of the GPIO range
 73  * @pin_base: base pin number of the GPIO rang     56  * @pin_base: base pin number of the GPIO range if pins == NULL
 74  * @npins: number of pins in the GPIO range, i << 
 75  * @pins: enumeration of pins in GPIO range or     57  * @pins: enumeration of pins in GPIO range or NULL
                                                   >>  58  * @npins: number of pins in the GPIO range, including the base number
 76  * @gc: an optional pointer to a gpio_chip         59  * @gc: an optional pointer to a gpio_chip
 77  */                                                60  */
 78 struct pinctrl_gpio_range {                        61 struct pinctrl_gpio_range {
 79         struct list_head node;                     62         struct list_head node;
 80         const char *name;                          63         const char *name;
 81         unsigned int id;                           64         unsigned int id;
 82         unsigned int base;                         65         unsigned int base;
 83         unsigned int pin_base;                     66         unsigned int pin_base;
                                                   >>  67         unsigned const *pins;
 84         unsigned int npins;                        68         unsigned int npins;
 85         unsigned int const *pins;              << 
 86         struct gpio_chip *gc;                      69         struct gpio_chip *gc;
 87 };                                                 70 };
 88                                                    71 
 89 /**                                                72 /**
 90  * struct pinctrl_ops - global pin control ope     73  * struct pinctrl_ops - global pin control operations, to be implemented by
 91  * pin controller drivers.                         74  * pin controller drivers.
 92  * @get_groups_count: Returns the count of tot     75  * @get_groups_count: Returns the count of total number of groups registered.
 93  * @get_group_name: return the group name of t     76  * @get_group_name: return the group name of the pin group
 94  * @get_group_pins: return an array of pins co     77  * @get_group_pins: return an array of pins corresponding to a certain
 95  *      group selector @pins, and the size of      78  *      group selector @pins, and the size of the array in @num_pins
 96  * @pin_dbg_show: optional debugfs display hoo     79  * @pin_dbg_show: optional debugfs display hook that will provide per-device
 97  *      info for a certain pin in debugfs          80  *      info for a certain pin in debugfs
 98  * @dt_node_to_map: parse a device tree "pin c     81  * @dt_node_to_map: parse a device tree "pin configuration node", and create
 99  *      mapping table entries for it. These ar     82  *      mapping table entries for it. These are returned through the @map and
100  *      @num_maps output parameters. This func     83  *      @num_maps output parameters. This function is optional, and may be
101  *      omitted for pinctrl drivers that do no     84  *      omitted for pinctrl drivers that do not support device tree.
102  * @dt_free_map: free mapping table entries cr     85  * @dt_free_map: free mapping table entries created via @dt_node_to_map. The
103  *      top-level @map pointer must be freed,      86  *      top-level @map pointer must be freed, along with any dynamically
104  *      allocated members of the mapping table     87  *      allocated members of the mapping table entries themselves. This
105  *      function is optional, and may be omitt     88  *      function is optional, and may be omitted for pinctrl drivers that do
106  *      not support device tree.                   89  *      not support device tree.
107  */                                                90  */
108 struct pinctrl_ops {                               91 struct pinctrl_ops {
109         int (*get_groups_count) (struct pinctr     92         int (*get_groups_count) (struct pinctrl_dev *pctldev);
110         const char *(*get_group_name) (struct      93         const char *(*get_group_name) (struct pinctrl_dev *pctldev,
111                                        unsigne !!  94                                        unsigned selector);
112         int (*get_group_pins) (struct pinctrl_     95         int (*get_group_pins) (struct pinctrl_dev *pctldev,
113                                unsigned int se !!  96                                unsigned selector,
114                                const unsigned  !!  97                                const unsigned **pins,
115                                unsigned int *n !!  98                                unsigned *num_pins);
116         void (*pin_dbg_show) (struct pinctrl_d     99         void (*pin_dbg_show) (struct pinctrl_dev *pctldev, struct seq_file *s,
117                               unsigned int off !! 100                           unsigned offset);
118         int (*dt_node_to_map) (struct pinctrl_    101         int (*dt_node_to_map) (struct pinctrl_dev *pctldev,
119                                struct device_n    102                                struct device_node *np_config,
120                                struct pinctrl_ !! 103                                struct pinctrl_map **map, unsigned *num_maps);
121         void (*dt_free_map) (struct pinctrl_de    104         void (*dt_free_map) (struct pinctrl_dev *pctldev,
122                              struct pinctrl_ma !! 105                              struct pinctrl_map *map, unsigned num_maps);
123 };                                                106 };
124                                                   107 
125 /**                                               108 /**
126  * struct pinctrl_desc - pin controller descri    109  * struct pinctrl_desc - pin controller descriptor, register this to pin
127  * control subsystem                              110  * control subsystem
128  * @name: name for the pin controller             111  * @name: name for the pin controller
129  * @pins: an array of pin descriptors describi    112  * @pins: an array of pin descriptors describing all the pins handled by
130  *      this pin controller                       113  *      this pin controller
131  * @npins: number of descriptors in the array,    114  * @npins: number of descriptors in the array, usually just ARRAY_SIZE()
132  *      of the pins field above                   115  *      of the pins field above
133  * @pctlops: pin control operation vtable, to     116  * @pctlops: pin control operation vtable, to support global concepts like
134  *      grouping of pins, this is optional.       117  *      grouping of pins, this is optional.
135  * @pmxops: pinmux operations vtable, if you s    118  * @pmxops: pinmux operations vtable, if you support pinmuxing in your driver
136  * @confops: pin config operations vtable, if     119  * @confops: pin config operations vtable, if you support pin configuration in
137  *      your driver                               120  *      your driver
138  * @owner: module providing the pin controller    121  * @owner: module providing the pin controller, used for refcounting
139  * @num_custom_params: Number of driver-specif    122  * @num_custom_params: Number of driver-specific custom parameters to be parsed
140  *      from the hardware description             123  *      from the hardware description
141  * @custom_params: List of driver_specific cus    124  * @custom_params: List of driver_specific custom parameters to be parsed from
142  *      the hardware description                  125  *      the hardware description
143  * @custom_conf_items: Information how to prin    126  * @custom_conf_items: Information how to print @params in debugfs, must be
144  *      the same size as the @custom_params, i    127  *      the same size as the @custom_params, i.e. @num_custom_params
145  * @link_consumers: If true create a device li << 
146  *      consumers (i.e. the devices requesting << 
147  *      sometimes necessary to ascertain the r << 
148  *      example.                               << 
149  */                                               128  */
150 struct pinctrl_desc {                             129 struct pinctrl_desc {
151         const char *name;                         130         const char *name;
152         const struct pinctrl_pin_desc *pins;      131         const struct pinctrl_pin_desc *pins;
153         unsigned int npins;                       132         unsigned int npins;
154         const struct pinctrl_ops *pctlops;        133         const struct pinctrl_ops *pctlops;
155         const struct pinmux_ops *pmxops;          134         const struct pinmux_ops *pmxops;
156         const struct pinconf_ops *confops;        135         const struct pinconf_ops *confops;
157         struct module *owner;                     136         struct module *owner;
158 #ifdef CONFIG_GENERIC_PINCONF                     137 #ifdef CONFIG_GENERIC_PINCONF
159         unsigned int num_custom_params;           138         unsigned int num_custom_params;
160         const struct pinconf_generic_params *c    139         const struct pinconf_generic_params *custom_params;
161         const struct pin_config_item *custom_c    140         const struct pin_config_item *custom_conf_items;
162 #endif                                            141 #endif
163         bool link_consumers;                   << 
164 };                                                142 };
165                                                   143 
166 /* External interface to pin controller */        144 /* External interface to pin controller */
167                                                   145 
168 extern int pinctrl_register_and_init(struct pi    146 extern int pinctrl_register_and_init(struct pinctrl_desc *pctldesc,
169                                      struct de    147                                      struct device *dev, void *driver_data,
170                                      struct pi    148                                      struct pinctrl_dev **pctldev);
171 extern int pinctrl_enable(struct pinctrl_dev *    149 extern int pinctrl_enable(struct pinctrl_dev *pctldev);
172                                                   150 
173 /* Please use pinctrl_register_and_init() and     151 /* Please use pinctrl_register_and_init() and pinctrl_enable() instead */
174 extern struct pinctrl_dev *pinctrl_register(st    152 extern struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
175                                 struct device     153                                 struct device *dev, void *driver_data);
176                                                   154 
177 extern void pinctrl_unregister(struct pinctrl_    155 extern void pinctrl_unregister(struct pinctrl_dev *pctldev);
178                                                   156 
179 extern int devm_pinctrl_register_and_init(stru    157 extern int devm_pinctrl_register_and_init(struct device *dev,
180                                 struct pinctrl    158                                 struct pinctrl_desc *pctldesc,
181                                 void *driver_d    159                                 void *driver_data,
182                                 struct pinctrl    160                                 struct pinctrl_dev **pctldev);
183                                                   161 
184 /* Please use devm_pinctrl_register_and_init()    162 /* Please use devm_pinctrl_register_and_init() instead */
185 extern struct pinctrl_dev *devm_pinctrl_regist    163 extern struct pinctrl_dev *devm_pinctrl_register(struct device *dev,
186                                 struct pinctrl    164                                 struct pinctrl_desc *pctldesc,
187                                 void *driver_d    165                                 void *driver_data);
188                                                   166 
189 extern void devm_pinctrl_unregister(struct dev    167 extern void devm_pinctrl_unregister(struct device *dev,
190                                 struct pinctrl    168                                 struct pinctrl_dev *pctldev);
191                                                   169 
                                                   >> 170 extern bool pin_is_valid(struct pinctrl_dev *pctldev, int pin);
192 extern void pinctrl_add_gpio_range(struct pinc    171 extern void pinctrl_add_gpio_range(struct pinctrl_dev *pctldev,
193                                 struct pinctrl    172                                 struct pinctrl_gpio_range *range);
194 extern void pinctrl_add_gpio_ranges(struct pin    173 extern void pinctrl_add_gpio_ranges(struct pinctrl_dev *pctldev,
195                                 struct pinctrl    174                                 struct pinctrl_gpio_range *ranges,
196                                 unsigned int n !! 175                                 unsigned nranges);
197 extern void pinctrl_remove_gpio_range(struct p    176 extern void pinctrl_remove_gpio_range(struct pinctrl_dev *pctldev,
198                                 struct pinctrl    177                                 struct pinctrl_gpio_range *range);
199                                                   178 
200 extern struct pinctrl_dev *pinctrl_find_and_ad    179 extern struct pinctrl_dev *pinctrl_find_and_add_gpio_range(const char *devname,
201                 struct pinctrl_gpio_range *ran    180                 struct pinctrl_gpio_range *range);
202 extern struct pinctrl_gpio_range *                181 extern struct pinctrl_gpio_range *
203 pinctrl_find_gpio_range_from_pin(struct pinctr    182 pinctrl_find_gpio_range_from_pin(struct pinctrl_dev *pctldev,
204                                  unsigned int     183                                  unsigned int pin);
205 extern int pinctrl_get_group_pins(struct pinct    184 extern int pinctrl_get_group_pins(struct pinctrl_dev *pctldev,
206                                   const char * !! 185                                 const char *pin_group, const unsigned **pins,
207                                   unsigned int !! 186                                 unsigned *num_pins);
208                                                << 
209 /**                                            << 
210  * struct pinfunction - Description about a fu << 
211  * @name: Name of the function                 << 
212  * @groups: An array of groups for this functi << 
213  * @ngroups: Number of groups in @groups       << 
214  */                                            << 
215 struct pinfunction {                           << 
216         const char *name;                      << 
217         const char * const *groups;            << 
218         size_t ngroups;                        << 
219 };                                             << 
220                                                   187 
221 /* Convenience macro to define a single named  !! 188 #ifdef CONFIG_OF
222 #define PINCTRL_PINFUNCTION(_name, _groups, _n << 
223 (struct pinfunction) {                         << 
224                 .name = (_name),               << 
225                 .groups = (_groups),           << 
226                 .ngroups = (_ngroups),         << 
227         }                                      << 
228                                                << 
229 #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG << 
230 extern struct pinctrl_dev *of_pinctrl_get(stru    189 extern struct pinctrl_dev *of_pinctrl_get(struct device_node *np);
231 #else                                             190 #else
232 static inline                                     191 static inline
233 struct pinctrl_dev *of_pinctrl_get(struct devi    192 struct pinctrl_dev *of_pinctrl_get(struct device_node *np)
234 {                                                 193 {
235         return NULL;                              194         return NULL;
236 }                                                 195 }
237 #endif /* CONFIG_OF */                            196 #endif /* CONFIG_OF */
238                                                   197 
239 extern const char *pinctrl_dev_get_name(struct    198 extern const char *pinctrl_dev_get_name(struct pinctrl_dev *pctldev);
240 extern const char *pinctrl_dev_get_devname(str    199 extern const char *pinctrl_dev_get_devname(struct pinctrl_dev *pctldev);
241 extern void *pinctrl_dev_get_drvdata(struct pi    200 extern void *pinctrl_dev_get_drvdata(struct pinctrl_dev *pctldev);
                                                   >> 201 #else
                                                   >> 202 
                                                   >> 203 struct pinctrl_dev;
                                                   >> 204 
                                                   >> 205 /* Sufficiently stupid default functions when pinctrl is not in use */
                                                   >> 206 static inline bool pin_is_valid(struct pinctrl_dev *pctldev, int pin)
                                                   >> 207 {
                                                   >> 208         return pin >= 0;
                                                   >> 209 }
                                                   >> 210 
                                                   >> 211 #endif /* !CONFIG_PINCTRL */
242                                                   212 
243 #endif /* __LINUX_PINCTRL_PINCTRL_H */            213 #endif /* __LINUX_PINCTRL_PINCTRL_H */
244                                                   214 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php