Lines Matching +full:pxa3xx +full:- +full:gpio

1 // SPDX-License-Identifier: GPL-2.0-only
3 * linux/drivers/pinctrl/pinctrl-lantiq.c
4 * based on linux/drivers/pinctrl/pinctrl-pxa3xx.c
17 #include "pinctrl-lantiq.h"
22 return info->num_grps; in ltq_get_group_count()
29 if (selector >= info->num_grps) in ltq_get_group_name()
31 return info->grps[selector].name; in ltq_get_group_name()
40 if (selector >= info->num_grps) in ltq_get_group_pins()
41 return -EINVAL; in ltq_get_group_pins()
42 *pins = info->grps[selector].pins; in ltq_get_group_pins()
43 *num_pins = info->grps[selector].npins; in ltq_get_group_pins()
63 seq_printf(s, " %s", dev_name(pctldev->dev)); in ltq_pinctrl_pin_dbg_show()
81 dev_err(pctldev->dev, "%pOFn defines neither pins nor groups\n", in ltq_pinctrl_dt_subnode_to_map()
87 dev_err(pctldev->dev, "%pOFn defines both pins and groups\n", in ltq_pinctrl_dt_subnode_to_map()
95 (*map)->type = PIN_MAP_TYPE_MUX_GROUP; in ltq_pinctrl_dt_subnode_to_map()
96 (*map)->name = function; in ltq_pinctrl_dt_subnode_to_map()
97 (*map)->data.mux.group = group; in ltq_pinctrl_dt_subnode_to_map()
98 (*map)->data.mux.function = function; in ltq_pinctrl_dt_subnode_to_map()
103 for (i = 0; i < info->num_params; i++) { in ltq_pinctrl_dt_subnode_to_map()
106 info->params[i].property, &val); in ltq_pinctrl_dt_subnode_to_map()
109 LTQ_PINCONF_PACK(info->params[i].param, in ltq_pinctrl_dt_subnode_to_map()
117 (*map)->data.configs.configs = kmemdup(configs, in ltq_pinctrl_dt_subnode_to_map()
120 (*map)->type = PIN_MAP_TYPE_CONFIGS_PIN; in ltq_pinctrl_dt_subnode_to_map()
121 (*map)->name = pin; in ltq_pinctrl_dt_subnode_to_map()
122 (*map)->data.configs.group_or_pin = pin; in ltq_pinctrl_dt_subnode_to_map()
123 (*map)->data.configs.num_configs = num_configs; in ltq_pinctrl_dt_subnode_to_map()
127 (*map)->data.configs.configs = kmemdup(configs, in ltq_pinctrl_dt_subnode_to_map()
130 (*map)->type = PIN_MAP_TYPE_CONFIGS_GROUP; in ltq_pinctrl_dt_subnode_to_map()
131 (*map)->name = group; in ltq_pinctrl_dt_subnode_to_map()
132 (*map)->data.configs.group_or_pin = group; in ltq_pinctrl_dt_subnode_to_map()
133 (*map)->data.configs.num_configs = num_configs; in ltq_pinctrl_dt_subnode_to_map()
162 return -ENOMEM; in ltq_pinctrl_dt_node_to_map()
167 *num_maps = ((int)(tmp - *map)); in ltq_pinctrl_dt_node_to_map()
185 return info->num_funcs; in ltq_pmx_func_count()
193 if (selector >= info->num_funcs) in ltq_pmx_func_name()
196 return info->funcs[selector].name; in ltq_pmx_func_name()
206 *groups = info->funcs[func].groups; in ltq_pmx_get_groups()
207 *num_groups = info->funcs[func].num_groups; in ltq_pmx_get_groups()
217 if (mfp->func[i] == mux) in match_mux()
221 return -EINVAL; in match_mux()
229 for (i = 0; i < info->num_mfp; i++) { in match_mfp()
230 if (info->mfp[i].pin == pin) in match_mfp()
233 return -1; in match_mfp()
242 for (i = 0; i < grp->npins; i++) { in match_group_mux()
243 pin = match_mfp(info, grp->pins[i]); in match_group_mux()
245 dev_err(info->dev, "could not find mfp for pin %d\n", in match_group_mux()
246 grp->pins[i]); in match_group_mux()
247 return -EINVAL; in match_group_mux()
249 ret = match_mux(&info->mfp[pin], mux); in match_group_mux()
251 dev_err(info->dev, "Can't find mux %d on pin%d\n", in match_group_mux()
264 const struct ltq_pin_group *pin_grp = &info->grps[group]; in ltq_pmx_set()
267 if (!pin_grp->npins || in ltq_pmx_set()
268 (match_group_mux(pin_grp, info, pin_grp->mux) < 0)) { in ltq_pmx_set()
269 dev_err(info->dev, "Failed to set the pin group: %s\n", in ltq_pmx_set()
270 info->grps[group].name); in ltq_pmx_set()
271 return -EINVAL; in ltq_pmx_set()
273 for (i = 0; i < pin_grp->npins; i++) { in ltq_pmx_set()
274 pin = match_mfp(info, pin_grp->pins[i]); in ltq_pmx_set()
276 dev_err(info->dev, "could not find mfp for pin %d\n", in ltq_pmx_set()
277 pin_grp->pins[i]); in ltq_pmx_set()
278 return -EINVAL; in ltq_pmx_set()
280 pin_func = match_mux(&info->mfp[pin], pin_grp->mux); in ltq_pmx_set()
281 ret = info->apply_mux(pctrldev, pin, pin_func); in ltq_pmx_set()
283 dev_err(info->dev, in ltq_pmx_set()
301 dev_err(info->dev, "could not find mfp for pin %d\n", pin); in ltq_pmx_gpio_request_enable()
302 return -EINVAL; in ltq_pmx_gpio_request_enable()
305 pin_func = match_mux(&info->mfp[mfp], 0); in ltq_pmx_gpio_request_enable()
307 dev_err(info->dev, "No GPIO function on pin%d\n", mfp); in ltq_pmx_gpio_request_enable()
308 return -EINVAL; in ltq_pmx_gpio_request_enable()
311 return info->apply_mux(pctrldev, mfp, pin_func); in ltq_pmx_gpio_request_enable()
332 return -EINVAL; in ltq_pinctrl_register()
333 desc = info->desc; in ltq_pinctrl_register()
334 desc->pctlops = &ltq_pctrl_ops; in ltq_pinctrl_register()
335 desc->pmxops = &ltq_pmx_ops; in ltq_pinctrl_register()
336 info->dev = &pdev->dev; in ltq_pinctrl_register()
338 info->pctrl = devm_pinctrl_register(&pdev->dev, desc, info); in ltq_pinctrl_register()
339 if (IS_ERR(info->pctrl)) { in ltq_pinctrl_register()
340 dev_err(&pdev->dev, "failed to register LTQ pinmux driver\n"); in ltq_pinctrl_register()
341 return PTR_ERR(info->pctrl); in ltq_pinctrl_register()