Commit 89377aa5156a93e73a3f7c7ccdc0d0fecf65e0d2
Committed by
Linus Walleij
1 parent
5c084ec820
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
pinctrl: lantiq: Staticize non-exported symbols
Both ltq_pinctrl_dt_node_to_map() and ltq_pinctrl_dt_free_map() are not referenced outside of this file. Make them static. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: John Crispin <blogic@openwrt.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Showing 1 changed file with 6 additions and 6 deletions Inline Diff
drivers/pinctrl/pinctrl-lantiq.c
1 | /* | 1 | /* |
2 | * linux/drivers/pinctrl/pinctrl-lantiq.c | 2 | * linux/drivers/pinctrl/pinctrl-lantiq.c |
3 | * based on linux/drivers/pinctrl/pinctrl-pxa3xx.c | 3 | * based on linux/drivers/pinctrl/pinctrl-pxa3xx.c |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License version 2 as | 6 | * it under the terms of the GNU General Public License version 2 as |
7 | * publishhed by the Free Software Foundation. | 7 | * publishhed by the Free Software Foundation. |
8 | * | 8 | * |
9 | * Copyright (C) 2012 John Crispin <blogic@openwrt.org> | 9 | * Copyright (C) 2012 John Crispin <blogic@openwrt.org> |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/device.h> | 13 | #include <linux/device.h> |
14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | #include <linux/of.h> | 17 | #include <linux/of.h> |
18 | 18 | ||
19 | #include "pinctrl-lantiq.h" | 19 | #include "pinctrl-lantiq.h" |
20 | 20 | ||
21 | static int ltq_get_group_count(struct pinctrl_dev *pctrldev) | 21 | static int ltq_get_group_count(struct pinctrl_dev *pctrldev) |
22 | { | 22 | { |
23 | struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); | 23 | struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); |
24 | return info->num_grps; | 24 | return info->num_grps; |
25 | } | 25 | } |
26 | 26 | ||
27 | static const char *ltq_get_group_name(struct pinctrl_dev *pctrldev, | 27 | static const char *ltq_get_group_name(struct pinctrl_dev *pctrldev, |
28 | unsigned selector) | 28 | unsigned selector) |
29 | { | 29 | { |
30 | struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); | 30 | struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); |
31 | if (selector >= info->num_grps) | 31 | if (selector >= info->num_grps) |
32 | return NULL; | 32 | return NULL; |
33 | return info->grps[selector].name; | 33 | return info->grps[selector].name; |
34 | } | 34 | } |
35 | 35 | ||
36 | static int ltq_get_group_pins(struct pinctrl_dev *pctrldev, | 36 | static int ltq_get_group_pins(struct pinctrl_dev *pctrldev, |
37 | unsigned selector, | 37 | unsigned selector, |
38 | const unsigned **pins, | 38 | const unsigned **pins, |
39 | unsigned *num_pins) | 39 | unsigned *num_pins) |
40 | { | 40 | { |
41 | struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); | 41 | struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); |
42 | if (selector >= info->num_grps) | 42 | if (selector >= info->num_grps) |
43 | return -EINVAL; | 43 | return -EINVAL; |
44 | *pins = info->grps[selector].pins; | 44 | *pins = info->grps[selector].pins; |
45 | *num_pins = info->grps[selector].npins; | 45 | *num_pins = info->grps[selector].npins; |
46 | return 0; | 46 | return 0; |
47 | } | 47 | } |
48 | 48 | ||
49 | void ltq_pinctrl_dt_free_map(struct pinctrl_dev *pctldev, | 49 | static void ltq_pinctrl_dt_free_map(struct pinctrl_dev *pctldev, |
50 | struct pinctrl_map *map, unsigned num_maps) | 50 | struct pinctrl_map *map, unsigned num_maps) |
51 | { | 51 | { |
52 | int i; | 52 | int i; |
53 | 53 | ||
54 | for (i = 0; i < num_maps; i++) | 54 | for (i = 0; i < num_maps; i++) |
55 | if (map[i].type == PIN_MAP_TYPE_CONFIGS_PIN) | 55 | if (map[i].type == PIN_MAP_TYPE_CONFIGS_PIN) |
56 | kfree(map[i].data.configs.configs); | 56 | kfree(map[i].data.configs.configs); |
57 | kfree(map); | 57 | kfree(map); |
58 | } | 58 | } |
59 | 59 | ||
60 | static void ltq_pinctrl_pin_dbg_show(struct pinctrl_dev *pctldev, | 60 | static void ltq_pinctrl_pin_dbg_show(struct pinctrl_dev *pctldev, |
61 | struct seq_file *s, | 61 | struct seq_file *s, |
62 | unsigned offset) | 62 | unsigned offset) |
63 | { | 63 | { |
64 | seq_printf(s, " %s", dev_name(pctldev->dev)); | 64 | seq_printf(s, " %s", dev_name(pctldev->dev)); |
65 | } | 65 | } |
66 | 66 | ||
67 | static int ltq_pinctrl_dt_subnode_to_map(struct pinctrl_dev *pctldev, | 67 | static int ltq_pinctrl_dt_subnode_to_map(struct pinctrl_dev *pctldev, |
68 | struct device_node *np, | 68 | struct device_node *np, |
69 | struct pinctrl_map **map) | 69 | struct pinctrl_map **map) |
70 | { | 70 | { |
71 | struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctldev); | 71 | struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctldev); |
72 | unsigned long configs[3]; | 72 | unsigned long configs[3]; |
73 | unsigned num_configs = 0; | 73 | unsigned num_configs = 0; |
74 | struct property *prop; | 74 | struct property *prop; |
75 | const char *group, *pin; | 75 | const char *group, *pin; |
76 | const char *function; | 76 | const char *function; |
77 | int ret, i; | 77 | int ret, i; |
78 | 78 | ||
79 | ret = of_property_read_string(np, "lantiq,function", &function); | 79 | ret = of_property_read_string(np, "lantiq,function", &function); |
80 | if (!ret) { | 80 | if (!ret) { |
81 | of_property_for_each_string(np, "lantiq,groups", prop, group) { | 81 | of_property_for_each_string(np, "lantiq,groups", prop, group) { |
82 | (*map)->type = PIN_MAP_TYPE_MUX_GROUP; | 82 | (*map)->type = PIN_MAP_TYPE_MUX_GROUP; |
83 | (*map)->name = function; | 83 | (*map)->name = function; |
84 | (*map)->data.mux.group = group; | 84 | (*map)->data.mux.group = group; |
85 | (*map)->data.mux.function = function; | 85 | (*map)->data.mux.function = function; |
86 | (*map)++; | 86 | (*map)++; |
87 | } | 87 | } |
88 | if (of_find_property(np, "lantiq,pins", NULL)) | 88 | if (of_find_property(np, "lantiq,pins", NULL)) |
89 | dev_err(pctldev->dev, | 89 | dev_err(pctldev->dev, |
90 | "%s mixes pins and groups settings\n", | 90 | "%s mixes pins and groups settings\n", |
91 | np->name); | 91 | np->name); |
92 | return 0; | 92 | return 0; |
93 | } | 93 | } |
94 | 94 | ||
95 | for (i = 0; i < info->num_params; i++) { | 95 | for (i = 0; i < info->num_params; i++) { |
96 | u32 val; | 96 | u32 val; |
97 | int ret = of_property_read_u32(np, | 97 | int ret = of_property_read_u32(np, |
98 | info->params[i].property, &val); | 98 | info->params[i].property, &val); |
99 | if (!ret) | 99 | if (!ret) |
100 | configs[num_configs++] = | 100 | configs[num_configs++] = |
101 | LTQ_PINCONF_PACK(info->params[i].param, | 101 | LTQ_PINCONF_PACK(info->params[i].param, |
102 | val); | 102 | val); |
103 | } | 103 | } |
104 | 104 | ||
105 | if (!num_configs) | 105 | if (!num_configs) |
106 | return -EINVAL; | 106 | return -EINVAL; |
107 | 107 | ||
108 | of_property_for_each_string(np, "lantiq,pins", prop, pin) { | 108 | of_property_for_each_string(np, "lantiq,pins", prop, pin) { |
109 | (*map)->data.configs.configs = kmemdup(configs, | 109 | (*map)->data.configs.configs = kmemdup(configs, |
110 | num_configs * sizeof(unsigned long), | 110 | num_configs * sizeof(unsigned long), |
111 | GFP_KERNEL); | 111 | GFP_KERNEL); |
112 | (*map)->type = PIN_MAP_TYPE_CONFIGS_PIN; | 112 | (*map)->type = PIN_MAP_TYPE_CONFIGS_PIN; |
113 | (*map)->name = pin; | 113 | (*map)->name = pin; |
114 | (*map)->data.configs.group_or_pin = pin; | 114 | (*map)->data.configs.group_or_pin = pin; |
115 | (*map)->data.configs.num_configs = num_configs; | 115 | (*map)->data.configs.num_configs = num_configs; |
116 | (*map)++; | 116 | (*map)++; |
117 | } | 117 | } |
118 | return 0; | 118 | return 0; |
119 | } | 119 | } |
120 | 120 | ||
121 | static int ltq_pinctrl_dt_subnode_size(struct device_node *np) | 121 | static int ltq_pinctrl_dt_subnode_size(struct device_node *np) |
122 | { | 122 | { |
123 | int ret; | 123 | int ret; |
124 | 124 | ||
125 | ret = of_property_count_strings(np, "lantiq,groups"); | 125 | ret = of_property_count_strings(np, "lantiq,groups"); |
126 | if (ret < 0) | 126 | if (ret < 0) |
127 | ret = of_property_count_strings(np, "lantiq,pins"); | 127 | ret = of_property_count_strings(np, "lantiq,pins"); |
128 | return ret; | 128 | return ret; |
129 | } | 129 | } |
130 | 130 | ||
131 | int ltq_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, | 131 | static int ltq_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, |
132 | struct device_node *np_config, | 132 | struct device_node *np_config, |
133 | struct pinctrl_map **map, | 133 | struct pinctrl_map **map, |
134 | unsigned *num_maps) | 134 | unsigned *num_maps) |
135 | { | 135 | { |
136 | struct pinctrl_map *tmp; | 136 | struct pinctrl_map *tmp; |
137 | struct device_node *np; | 137 | struct device_node *np; |
138 | int ret; | 138 | int ret; |
139 | 139 | ||
140 | *num_maps = 0; | 140 | *num_maps = 0; |
141 | for_each_child_of_node(np_config, np) | 141 | for_each_child_of_node(np_config, np) |
142 | *num_maps += ltq_pinctrl_dt_subnode_size(np); | 142 | *num_maps += ltq_pinctrl_dt_subnode_size(np); |
143 | *map = kzalloc(*num_maps * sizeof(struct pinctrl_map), GFP_KERNEL); | 143 | *map = kzalloc(*num_maps * sizeof(struct pinctrl_map), GFP_KERNEL); |
144 | if (!*map) | 144 | if (!*map) |
145 | return -ENOMEM; | 145 | return -ENOMEM; |
146 | tmp = *map; | 146 | tmp = *map; |
147 | 147 | ||
148 | for_each_child_of_node(np_config, np) { | 148 | for_each_child_of_node(np_config, np) { |
149 | ret = ltq_pinctrl_dt_subnode_to_map(pctldev, np, &tmp); | 149 | ret = ltq_pinctrl_dt_subnode_to_map(pctldev, np, &tmp); |
150 | if (ret < 0) { | 150 | if (ret < 0) { |
151 | ltq_pinctrl_dt_free_map(pctldev, *map, *num_maps); | 151 | ltq_pinctrl_dt_free_map(pctldev, *map, *num_maps); |
152 | return ret; | 152 | return ret; |
153 | } | 153 | } |
154 | } | 154 | } |
155 | return 0; | 155 | return 0; |
156 | } | 156 | } |
157 | 157 | ||
158 | static struct pinctrl_ops ltq_pctrl_ops = { | 158 | static struct pinctrl_ops ltq_pctrl_ops = { |
159 | .get_groups_count = ltq_get_group_count, | 159 | .get_groups_count = ltq_get_group_count, |
160 | .get_group_name = ltq_get_group_name, | 160 | .get_group_name = ltq_get_group_name, |
161 | .get_group_pins = ltq_get_group_pins, | 161 | .get_group_pins = ltq_get_group_pins, |
162 | .pin_dbg_show = ltq_pinctrl_pin_dbg_show, | 162 | .pin_dbg_show = ltq_pinctrl_pin_dbg_show, |
163 | .dt_node_to_map = ltq_pinctrl_dt_node_to_map, | 163 | .dt_node_to_map = ltq_pinctrl_dt_node_to_map, |
164 | .dt_free_map = ltq_pinctrl_dt_free_map, | 164 | .dt_free_map = ltq_pinctrl_dt_free_map, |
165 | }; | 165 | }; |
166 | 166 | ||
167 | static int ltq_pmx_func_count(struct pinctrl_dev *pctrldev) | 167 | static int ltq_pmx_func_count(struct pinctrl_dev *pctrldev) |
168 | { | 168 | { |
169 | struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); | 169 | struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); |
170 | 170 | ||
171 | return info->num_funcs; | 171 | return info->num_funcs; |
172 | } | 172 | } |
173 | 173 | ||
174 | static const char *ltq_pmx_func_name(struct pinctrl_dev *pctrldev, | 174 | static const char *ltq_pmx_func_name(struct pinctrl_dev *pctrldev, |
175 | unsigned selector) | 175 | unsigned selector) |
176 | { | 176 | { |
177 | struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); | 177 | struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); |
178 | 178 | ||
179 | if (selector >= info->num_funcs) | 179 | if (selector >= info->num_funcs) |
180 | return NULL; | 180 | return NULL; |
181 | 181 | ||
182 | return info->funcs[selector].name; | 182 | return info->funcs[selector].name; |
183 | } | 183 | } |
184 | 184 | ||
185 | static int ltq_pmx_get_groups(struct pinctrl_dev *pctrldev, | 185 | static int ltq_pmx_get_groups(struct pinctrl_dev *pctrldev, |
186 | unsigned func, | 186 | unsigned func, |
187 | const char * const **groups, | 187 | const char * const **groups, |
188 | unsigned * const num_groups) | 188 | unsigned * const num_groups) |
189 | { | 189 | { |
190 | struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); | 190 | struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); |
191 | 191 | ||
192 | *groups = info->funcs[func].groups; | 192 | *groups = info->funcs[func].groups; |
193 | *num_groups = info->funcs[func].num_groups; | 193 | *num_groups = info->funcs[func].num_groups; |
194 | 194 | ||
195 | return 0; | 195 | return 0; |
196 | } | 196 | } |
197 | 197 | ||
198 | /* Return function number. If failure, return negative value. */ | 198 | /* Return function number. If failure, return negative value. */ |
199 | static int match_mux(const struct ltq_mfp_pin *mfp, unsigned mux) | 199 | static int match_mux(const struct ltq_mfp_pin *mfp, unsigned mux) |
200 | { | 200 | { |
201 | int i; | 201 | int i; |
202 | for (i = 0; i < LTQ_MAX_MUX; i++) { | 202 | for (i = 0; i < LTQ_MAX_MUX; i++) { |
203 | if (mfp->func[i] == mux) | 203 | if (mfp->func[i] == mux) |
204 | break; | 204 | break; |
205 | } | 205 | } |
206 | if (i >= LTQ_MAX_MUX) | 206 | if (i >= LTQ_MAX_MUX) |
207 | return -EINVAL; | 207 | return -EINVAL; |
208 | return i; | 208 | return i; |
209 | } | 209 | } |
210 | 210 | ||
211 | /* dont assume .mfp is linearly mapped. find the mfp with the correct .pin */ | 211 | /* dont assume .mfp is linearly mapped. find the mfp with the correct .pin */ |
212 | static int match_mfp(const struct ltq_pinmux_info *info, int pin) | 212 | static int match_mfp(const struct ltq_pinmux_info *info, int pin) |
213 | { | 213 | { |
214 | int i; | 214 | int i; |
215 | for (i = 0; i < info->num_mfp; i++) { | 215 | for (i = 0; i < info->num_mfp; i++) { |
216 | if (info->mfp[i].pin == pin) | 216 | if (info->mfp[i].pin == pin) |
217 | return i; | 217 | return i; |
218 | } | 218 | } |
219 | return -1; | 219 | return -1; |
220 | } | 220 | } |
221 | 221 | ||
222 | /* check whether current pin configuration is valid. Negative for failure */ | 222 | /* check whether current pin configuration is valid. Negative for failure */ |
223 | static int match_group_mux(const struct ltq_pin_group *grp, | 223 | static int match_group_mux(const struct ltq_pin_group *grp, |
224 | const struct ltq_pinmux_info *info, | 224 | const struct ltq_pinmux_info *info, |
225 | unsigned mux) | 225 | unsigned mux) |
226 | { | 226 | { |
227 | int i, pin, ret = 0; | 227 | int i, pin, ret = 0; |
228 | for (i = 0; i < grp->npins; i++) { | 228 | for (i = 0; i < grp->npins; i++) { |
229 | pin = match_mfp(info, grp->pins[i]); | 229 | pin = match_mfp(info, grp->pins[i]); |
230 | if (pin < 0) { | 230 | if (pin < 0) { |
231 | dev_err(info->dev, "could not find mfp for pin %d\n", | 231 | dev_err(info->dev, "could not find mfp for pin %d\n", |
232 | grp->pins[i]); | 232 | grp->pins[i]); |
233 | return -EINVAL; | 233 | return -EINVAL; |
234 | } | 234 | } |
235 | ret = match_mux(&info->mfp[pin], mux); | 235 | ret = match_mux(&info->mfp[pin], mux); |
236 | if (ret < 0) { | 236 | if (ret < 0) { |
237 | dev_err(info->dev, "Can't find mux %d on pin%d\n", | 237 | dev_err(info->dev, "Can't find mux %d on pin%d\n", |
238 | mux, pin); | 238 | mux, pin); |
239 | break; | 239 | break; |
240 | } | 240 | } |
241 | } | 241 | } |
242 | return ret; | 242 | return ret; |
243 | } | 243 | } |
244 | 244 | ||
245 | static int ltq_pmx_enable(struct pinctrl_dev *pctrldev, | 245 | static int ltq_pmx_enable(struct pinctrl_dev *pctrldev, |
246 | unsigned func, | 246 | unsigned func, |
247 | unsigned group) | 247 | unsigned group) |
248 | { | 248 | { |
249 | struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); | 249 | struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); |
250 | const struct ltq_pin_group *pin_grp = &info->grps[group]; | 250 | const struct ltq_pin_group *pin_grp = &info->grps[group]; |
251 | int i, pin, pin_func, ret; | 251 | int i, pin, pin_func, ret; |
252 | 252 | ||
253 | if (!pin_grp->npins || | 253 | if (!pin_grp->npins || |
254 | (match_group_mux(pin_grp, info, pin_grp->mux) < 0)) { | 254 | (match_group_mux(pin_grp, info, pin_grp->mux) < 0)) { |
255 | dev_err(info->dev, "Failed to set the pin group: %s\n", | 255 | dev_err(info->dev, "Failed to set the pin group: %s\n", |
256 | info->grps[group].name); | 256 | info->grps[group].name); |
257 | return -EINVAL; | 257 | return -EINVAL; |
258 | } | 258 | } |
259 | for (i = 0; i < pin_grp->npins; i++) { | 259 | for (i = 0; i < pin_grp->npins; i++) { |
260 | pin = match_mfp(info, pin_grp->pins[i]); | 260 | pin = match_mfp(info, pin_grp->pins[i]); |
261 | if (pin < 0) { | 261 | if (pin < 0) { |
262 | dev_err(info->dev, "could not find mfp for pin %d\n", | 262 | dev_err(info->dev, "could not find mfp for pin %d\n", |
263 | pin_grp->pins[i]); | 263 | pin_grp->pins[i]); |
264 | return -EINVAL; | 264 | return -EINVAL; |
265 | } | 265 | } |
266 | pin_func = match_mux(&info->mfp[pin], pin_grp->mux); | 266 | pin_func = match_mux(&info->mfp[pin], pin_grp->mux); |
267 | ret = info->apply_mux(pctrldev, pin, pin_func); | 267 | ret = info->apply_mux(pctrldev, pin, pin_func); |
268 | if (ret) { | 268 | if (ret) { |
269 | dev_err(info->dev, | 269 | dev_err(info->dev, |
270 | "failed to apply mux %d for pin %d\n", | 270 | "failed to apply mux %d for pin %d\n", |
271 | pin_func, pin); | 271 | pin_func, pin); |
272 | return ret; | 272 | return ret; |
273 | } | 273 | } |
274 | } | 274 | } |
275 | return 0; | 275 | return 0; |
276 | } | 276 | } |
277 | 277 | ||
278 | static int ltq_pmx_gpio_request_enable(struct pinctrl_dev *pctrldev, | 278 | static int ltq_pmx_gpio_request_enable(struct pinctrl_dev *pctrldev, |
279 | struct pinctrl_gpio_range *range, | 279 | struct pinctrl_gpio_range *range, |
280 | unsigned pin) | 280 | unsigned pin) |
281 | { | 281 | { |
282 | struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); | 282 | struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); |
283 | int mfp = match_mfp(info, pin + (range->id * 32)); | 283 | int mfp = match_mfp(info, pin + (range->id * 32)); |
284 | int pin_func; | 284 | int pin_func; |
285 | 285 | ||
286 | if (mfp < 0) { | 286 | if (mfp < 0) { |
287 | dev_err(info->dev, "could not find mfp for pin %d\n", pin); | 287 | dev_err(info->dev, "could not find mfp for pin %d\n", pin); |
288 | return -EINVAL; | 288 | return -EINVAL; |
289 | } | 289 | } |
290 | 290 | ||
291 | pin_func = match_mux(&info->mfp[mfp], 0); | 291 | pin_func = match_mux(&info->mfp[mfp], 0); |
292 | if (pin_func < 0) { | 292 | if (pin_func < 0) { |
293 | dev_err(info->dev, "No GPIO function on pin%d\n", mfp); | 293 | dev_err(info->dev, "No GPIO function on pin%d\n", mfp); |
294 | return -EINVAL; | 294 | return -EINVAL; |
295 | } | 295 | } |
296 | 296 | ||
297 | return info->apply_mux(pctrldev, mfp, pin_func); | 297 | return info->apply_mux(pctrldev, mfp, pin_func); |
298 | } | 298 | } |
299 | 299 | ||
300 | static struct pinmux_ops ltq_pmx_ops = { | 300 | static struct pinmux_ops ltq_pmx_ops = { |
301 | .get_functions_count = ltq_pmx_func_count, | 301 | .get_functions_count = ltq_pmx_func_count, |
302 | .get_function_name = ltq_pmx_func_name, | 302 | .get_function_name = ltq_pmx_func_name, |
303 | .get_function_groups = ltq_pmx_get_groups, | 303 | .get_function_groups = ltq_pmx_get_groups, |
304 | .enable = ltq_pmx_enable, | 304 | .enable = ltq_pmx_enable, |
305 | .gpio_request_enable = ltq_pmx_gpio_request_enable, | 305 | .gpio_request_enable = ltq_pmx_gpio_request_enable, |
306 | }; | 306 | }; |
307 | 307 | ||
308 | /* | 308 | /* |
309 | * allow different socs to register with the generic part of the lanti | 309 | * allow different socs to register with the generic part of the lanti |
310 | * pinctrl code | 310 | * pinctrl code |
311 | */ | 311 | */ |
312 | int ltq_pinctrl_register(struct platform_device *pdev, | 312 | int ltq_pinctrl_register(struct platform_device *pdev, |
313 | struct ltq_pinmux_info *info) | 313 | struct ltq_pinmux_info *info) |
314 | { | 314 | { |
315 | struct pinctrl_desc *desc; | 315 | struct pinctrl_desc *desc; |
316 | 316 | ||
317 | if (!info) | 317 | if (!info) |
318 | return -EINVAL; | 318 | return -EINVAL; |
319 | desc = info->desc; | 319 | desc = info->desc; |
320 | desc->pctlops = <q_pctrl_ops; | 320 | desc->pctlops = <q_pctrl_ops; |
321 | desc->pmxops = <q_pmx_ops; | 321 | desc->pmxops = <q_pmx_ops; |
322 | info->dev = &pdev->dev; | 322 | info->dev = &pdev->dev; |
323 | 323 | ||
324 | info->pctrl = pinctrl_register(desc, &pdev->dev, info); | 324 | info->pctrl = pinctrl_register(desc, &pdev->dev, info); |
325 | if (!info->pctrl) { | 325 | if (!info->pctrl) { |
326 | dev_err(&pdev->dev, "failed to register LTQ pinmux driver\n"); | 326 | dev_err(&pdev->dev, "failed to register LTQ pinmux driver\n"); |
327 | return -EINVAL; | 327 | return -EINVAL; |
328 | } | 328 | } |
329 | platform_set_drvdata(pdev, info); | 329 | platform_set_drvdata(pdev, info); |
330 | return 0; | 330 | return 0; |
331 | } | 331 | } |
332 | 332 |