Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Interface the pinconfig portions of the pinctrl subsystem
0004  *
0005  * Copyright (C) 2011 ST-Ericsson SA
0006  * Written on behalf of Linaro for ST-Ericsson
0007  * This interface is used in the core to keep track of pins.
0008  *
0009  * Author: Linus Walleij <linus.walleij@linaro.org>
0010  */
0011 #ifndef __LINUX_PINCTRL_PINCONF_H
0012 #define __LINUX_PINCTRL_PINCONF_H
0013 
0014 #include <linux/types.h>
0015 
0016 struct pinctrl_dev;
0017 struct seq_file;
0018 
0019 /**
0020  * struct pinconf_ops - pin config operations, to be implemented by
0021  * pin configuration capable drivers.
0022  * @is_generic: for pin controllers that want to use the generic interface,
0023  *  this flag tells the framework that it's generic.
0024  * @pin_config_get: get the config of a certain pin, if the requested config
0025  *  is not available on this controller this should return -ENOTSUPP
0026  *  and if it is available but disabled it should return -EINVAL
0027  * @pin_config_set: configure an individual pin
0028  * @pin_config_group_get: get configurations for an entire pin group; should
0029  *  return -ENOTSUPP and -EINVAL using the same rules as pin_config_get.
0030  * @pin_config_group_set: configure all pins in a group
0031  * @pin_config_dbg_show: optional debugfs display hook that will provide
0032  *  per-device info for a certain pin in debugfs
0033  * @pin_config_group_dbg_show: optional debugfs display hook that will provide
0034  *  per-device info for a certain group in debugfs
0035  * @pin_config_config_dbg_show: optional debugfs display hook that will decode
0036  *  and display a driver's pin configuration parameter
0037  */
0038 struct pinconf_ops {
0039 #ifdef CONFIG_GENERIC_PINCONF
0040     bool is_generic;
0041 #endif
0042     int (*pin_config_get) (struct pinctrl_dev *pctldev,
0043                    unsigned pin,
0044                    unsigned long *config);
0045     int (*pin_config_set) (struct pinctrl_dev *pctldev,
0046                    unsigned pin,
0047                    unsigned long *configs,
0048                    unsigned num_configs);
0049     int (*pin_config_group_get) (struct pinctrl_dev *pctldev,
0050                      unsigned selector,
0051                      unsigned long *config);
0052     int (*pin_config_group_set) (struct pinctrl_dev *pctldev,
0053                      unsigned selector,
0054                      unsigned long *configs,
0055                      unsigned num_configs);
0056     void (*pin_config_dbg_show) (struct pinctrl_dev *pctldev,
0057                      struct seq_file *s,
0058                      unsigned offset);
0059     void (*pin_config_group_dbg_show) (struct pinctrl_dev *pctldev,
0060                        struct seq_file *s,
0061                        unsigned selector);
0062     void (*pin_config_config_dbg_show) (struct pinctrl_dev *pctldev,
0063                         struct seq_file *s,
0064                         unsigned long config);
0065 };
0066 
0067 #endif /* __LINUX_PINCTRL_PINCONF_H */