blob: 55c75780b3b29e2dbefcefba6c9ff5556e70f21c [file] [log] [blame]
Linus Walleijae6b4d82011-10-19 18:14:33 +02001/*
2 * Internal interface between the core pin control system and the
3 * pin config portions
4 *
5 * Copyright (C) 2011 ST-Ericsson SA
6 * Written on behalf of Linaro for ST-Ericsson
7 * Based on bits of regulator core, gpio core and clk core
8 *
9 * Author: Linus Walleij <linus.walleij@linaro.org>
10 *
11 * License terms: GNU General Public License (GPL) version 2
12 */
13
14#ifdef CONFIG_PINCONF
15
Tony Lindgrenb9130b72012-01-24 16:28:08 -080016int pinconf_check_ops(struct pinctrl_dev *pctldev);
Stephen Warren1e2082b2012-03-02 13:05:48 -070017int pinconf_validate_map(struct pinctrl_map const *map, int i);
Stephen Warren1e2082b2012-03-02 13:05:48 -070018int pinconf_map_to_setting(struct pinctrl_map const *map,
19 struct pinctrl_setting *setting);
20void pinconf_free_setting(struct pinctrl_setting const *setting);
21int pinconf_apply_setting(struct pinctrl_setting const *setting);
Linus Walleijae6b4d82011-10-19 18:14:33 +020022
Linus Walleij394349f2011-11-24 18:27:15 +010023/*
24 * You will only be interested in these if you're using PINCONF
25 * so don't supply any stubs for these.
26 */
27int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
28 unsigned long *config);
29int pin_config_group_get(const char *dev_name, const char *pin_group,
30 unsigned long *config);
31
Linus Walleijae6b4d82011-10-19 18:14:33 +020032#else
33
Tony Lindgrenb9130b72012-01-24 16:28:08 -080034static inline int pinconf_check_ops(struct pinctrl_dev *pctldev)
Linus Walleijae6b4d82011-10-19 18:14:33 +020035{
36 return 0;
37}
38
Stephen Warren1e2082b2012-03-02 13:05:48 -070039static inline int pinconf_validate_map(struct pinctrl_map const *map, int i)
40{
41 return 0;
42}
43
44static inline int pinconf_map_to_setting(struct pinctrl_map const *map,
45 struct pinctrl_setting *setting)
46{
47 return 0;
48}
49
50static inline void pinconf_free_setting(struct pinctrl_setting const *setting)
51{
52}
53
54static inline int pinconf_apply_setting(struct pinctrl_setting const *setting)
55{
56 return 0;
57}
58
Stephen Warrenc736d732012-04-11 16:45:45 -060059#endif
60
Viresh Kumar96593af2012-04-16 14:22:34 +053061#if defined(CONFIG_PINCONF) && defined(CONFIG_DEBUG_FS)
Stephen Warrenc736d732012-04-11 16:45:45 -060062
63void pinconf_show_map(struct seq_file *s, struct pinctrl_map const *map);
64void pinconf_show_setting(struct seq_file *s,
65 struct pinctrl_setting const *setting);
66void pinconf_init_device_debugfs(struct dentry *devroot,
67 struct pinctrl_dev *pctldev);
68
69#else
70
Stephen Warren1e2082b2012-03-02 13:05:48 -070071static inline void pinconf_show_map(struct seq_file *s,
72 struct pinctrl_map const *map)
73{
74}
75
76static inline void pinconf_show_setting(struct seq_file *s,
77 struct pinctrl_setting const *setting)
78{
79}
80
Linus Walleijae6b4d82011-10-19 18:14:33 +020081static inline void pinconf_init_device_debugfs(struct dentry *devroot,
82 struct pinctrl_dev *pctldev)
83{
84}
85
86#endif
Linus Walleij394349f2011-11-24 18:27:15 +010087
88/*
89 * The following functions are available if the driver uses the generic
90 * pin config.
91 */
92
Sachin Kamatbf4d7be2013-03-13 17:13:46 +053093#if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_DEBUG_FS)
Linus Walleij394349f2011-11-24 18:27:15 +010094
Soren Brinkmanndd4d01f2015-01-09 07:43:46 -080095void pinconf_generic_dump_pins(struct pinctrl_dev *pctldev,
96 struct seq_file *s, const char *gname,
97 unsigned pin);
Linus Walleij394349f2011-11-24 18:27:15 +010098
Haojian Zhuang9cfd1722013-02-17 19:42:53 +080099void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
100 struct seq_file *s, unsigned long config);
Linus Walleij394349f2011-11-24 18:27:15 +0100101#else
102
Soren Brinkmanndd4d01f2015-01-09 07:43:46 -0800103static inline void pinconf_generic_dump_pins(struct pinctrl_dev *pctldev,
104 struct seq_file *s,
105 const char *gname, unsigned pin)
Linus Walleij394349f2011-11-24 18:27:15 +0100106{
107 return;
108}
109
Haojian Zhuang9cfd1722013-02-17 19:42:53 +0800110static inline void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
111 struct seq_file *s,
112 unsigned long config)
113{
114 return;
115}
Linus Walleij394349f2011-11-24 18:27:15 +0100116#endif
Heiko Stübner7db9af42013-06-10 21:40:29 +0200117
118#if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_OF)
119int pinconf_generic_parse_dt_config(struct device_node *np,
Soren Brinkmanndd4d01f2015-01-09 07:43:46 -0800120 struct pinctrl_dev *pctldev,
Heiko Stübner7db9af42013-06-10 21:40:29 +0200121 unsigned long **configs,
122 unsigned int *nconfigs);
123#endif