Lines Matching full:pctl

83 	struct mvebu_pinctrl *pctl, unsigned pid)  in mvebu_pinctrl_find_group_by_pid()  argument
86 for (n = 0; n < pctl->num_groups; n++) { in mvebu_pinctrl_find_group_by_pid()
87 if (pid >= pctl->groups[n].pins[0] && in mvebu_pinctrl_find_group_by_pid()
88 pid < pctl->groups[n].pins[0] + in mvebu_pinctrl_find_group_by_pid()
89 pctl->groups[n].npins) in mvebu_pinctrl_find_group_by_pid()
90 return &pctl->groups[n]; in mvebu_pinctrl_find_group_by_pid()
96 struct mvebu_pinctrl *pctl, const char *name) in mvebu_pinctrl_find_group_by_name() argument
100 for (n = 0; n < pctl->num_groups; n++) { in mvebu_pinctrl_find_group_by_name()
101 if (strcmp(name, pctl->groups[n].name) == 0) in mvebu_pinctrl_find_group_by_name()
102 return &pctl->groups[n]; in mvebu_pinctrl_find_group_by_name()
109 struct mvebu_pinctrl *pctl, struct mvebu_pinctrl_group *grp, in mvebu_pinctrl_find_setting_by_val() argument
116 if (!pctl->variant || (pctl->variant & in mvebu_pinctrl_find_setting_by_val()
126 struct mvebu_pinctrl *pctl, struct mvebu_pinctrl_group *grp, in mvebu_pinctrl_find_setting_by_name() argument
133 if (!pctl->variant || (pctl->variant & in mvebu_pinctrl_find_setting_by_name()
143 struct mvebu_pinctrl *pctl, struct mvebu_pinctrl_group *grp) in mvebu_pinctrl_find_gpio_setting() argument
150 if (!pctl->variant || (pctl->variant & in mvebu_pinctrl_find_gpio_setting()
160 struct mvebu_pinctrl *pctl, const char *name) in mvebu_pinctrl_find_function_by_name() argument
164 for (n = 0; n < pctl->num_functions; n++) { in mvebu_pinctrl_find_function_by_name()
165 if (strcmp(name, pctl->functions[n].name) == 0) in mvebu_pinctrl_find_function_by_name()
166 return &pctl->functions[n]; in mvebu_pinctrl_find_function_by_name()
175 struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); in mvebu_pinconf_group_get() local
176 struct mvebu_pinctrl_group *grp = &pctl->groups[gid]; in mvebu_pinconf_group_get()
188 struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); in mvebu_pinconf_group_set() local
189 struct mvebu_pinctrl_group *grp = &pctl->groups[gid]; in mvebu_pinconf_group_set()
207 struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); in mvebu_pinconf_group_dbg_show() local
208 struct mvebu_pinctrl_group *grp = &pctl->groups[gid]; in mvebu_pinconf_group_dbg_show()
216 curr = mvebu_pinctrl_find_setting_by_val(pctl, grp, config); in mvebu_pinconf_group_dbg_show()
241 if (pctl->variant && in mvebu_pinconf_group_dbg_show()
242 !(pctl->variant & grp->settings[n].variant)) in mvebu_pinconf_group_dbg_show()
270 struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); in mvebu_pinmux_get_funcs_count() local
272 return pctl->num_functions; in mvebu_pinmux_get_funcs_count()
278 struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); in mvebu_pinmux_get_func_name() local
280 return pctl->functions[fid].name; in mvebu_pinmux_get_func_name()
287 struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); in mvebu_pinmux_get_groups() local
289 *groups = pctl->functions[fid].groups; in mvebu_pinmux_get_groups()
290 *num_groups = pctl->functions[fid].num_groups; in mvebu_pinmux_get_groups()
297 struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); in mvebu_pinmux_set() local
298 struct mvebu_pinctrl_function *func = &pctl->functions[fid]; in mvebu_pinmux_set()
299 struct mvebu_pinctrl_group *grp = &pctl->groups[gid]; in mvebu_pinmux_set()
304 setting = mvebu_pinctrl_find_setting_by_name(pctl, grp, in mvebu_pinmux_set()
307 dev_err(pctl->dev, in mvebu_pinmux_set()
316 dev_err(pctl->dev, "cannot set group %s to %s\n", in mvebu_pinmux_set()
327 struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); in mvebu_pinmux_gpio_request_enable() local
332 grp = mvebu_pinctrl_find_group_by_pid(pctl, offset); in mvebu_pinmux_gpio_request_enable()
339 setting = mvebu_pinctrl_find_gpio_setting(pctl, grp); in mvebu_pinmux_gpio_request_enable()
351 struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); in mvebu_pinmux_gpio_set_direction() local
355 grp = mvebu_pinctrl_find_group_by_pid(pctl, offset); in mvebu_pinmux_gpio_set_direction()
362 setting = mvebu_pinctrl_find_gpio_setting(pctl, grp); in mvebu_pinmux_gpio_set_direction()
384 struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); in mvebu_pinctrl_get_groups_count() local
385 return pctl->num_groups; in mvebu_pinctrl_get_groups_count()
391 struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); in mvebu_pinctrl_get_group_name() local
392 return pctl->groups[gid].name; in mvebu_pinctrl_get_group_name()
399 struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); in mvebu_pinctrl_get_group_pins() local
400 *pins = pctl->groups[gid].pins; in mvebu_pinctrl_get_group_pins()
401 *num_pins = pctl->groups[gid].npins; in mvebu_pinctrl_get_group_pins()
410 struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); in mvebu_pinctrl_dt_node_to_map() local
421 dev_err(pctl->dev, in mvebu_pinctrl_dt_node_to_map()
428 dev_err(pctl->dev, in mvebu_pinctrl_dt_node_to_map()
440 mvebu_pinctrl_find_group_by_name(pctl, group); in mvebu_pinctrl_dt_node_to_map()
443 dev_err(pctl->dev, "unknown pin %s", group); in mvebu_pinctrl_dt_node_to_map()
447 if (!mvebu_pinctrl_find_setting_by_name(pctl, grp, function)) { in mvebu_pinctrl_dt_node_to_map()
448 dev_err(pctl->dev, "unsupported function %s on pin %s", in mvebu_pinctrl_dt_node_to_map()
502 struct mvebu_pinctrl *pctl) in mvebu_pinctrl_build_functions() argument
505 int num = 0, funcsize = pctl->desc.npins; in mvebu_pinctrl_build_functions()
516 for (n = 0; n < pctl->num_groups; n++) { in mvebu_pinctrl_build_functions()
517 struct mvebu_pinctrl_group *grp = &pctl->groups[n]; in mvebu_pinctrl_build_functions()
522 if (pctl->variant && in mvebu_pinctrl_build_functions()
523 !(pctl->variant & grp->settings[s].variant)) in mvebu_pinctrl_build_functions()
532 pctl->desc.npins); in mvebu_pinctrl_build_functions()
540 pctl->num_functions = num; in mvebu_pinctrl_build_functions()
541 pctl->functions = funcs; in mvebu_pinctrl_build_functions()
543 for (n = 0; n < pctl->num_groups; n++) { in mvebu_pinctrl_build_functions()
544 struct mvebu_pinctrl_group *grp = &pctl->groups[n]; in mvebu_pinctrl_build_functions()
550 if (pctl->variant && in mvebu_pinctrl_build_functions()
551 !(pctl->variant & grp->settings[s].variant)) in mvebu_pinctrl_build_functions()
554 f = mvebu_pinctrl_find_function_by_name(pctl, in mvebu_pinctrl_build_functions()
581 struct mvebu_pinctrl *pctl; in mvebu_pinctrl_probe() local
594 pctl = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_pinctrl), in mvebu_pinctrl_probe()
596 if (!pctl) in mvebu_pinctrl_probe()
599 pctl->desc.name = dev_name(&pdev->dev); in mvebu_pinctrl_probe()
600 pctl->desc.owner = THIS_MODULE; in mvebu_pinctrl_probe()
601 pctl->desc.pctlops = &mvebu_pinctrl_ops; in mvebu_pinctrl_probe()
602 pctl->desc.pmxops = &mvebu_pinmux_ops; in mvebu_pinctrl_probe()
603 pctl->desc.confops = &mvebu_pinconf_ops; in mvebu_pinctrl_probe()
604 pctl->variant = soc->variant; in mvebu_pinctrl_probe()
605 pctl->dev = &pdev->dev; in mvebu_pinctrl_probe()
606 platform_set_drvdata(pdev, pctl); in mvebu_pinctrl_probe()
610 pctl->num_groups = 0; in mvebu_pinctrl_probe()
611 pctl->desc.npins = 0; in mvebu_pinctrl_probe()
615 pctl->desc.npins += ctrl->npins; in mvebu_pinctrl_probe()
626 pctl->num_groups += ctrl->npins; in mvebu_pinctrl_probe()
629 pctl->num_groups += 1; in mvebu_pinctrl_probe()
634 pctl->desc.npins, in mvebu_pinctrl_probe()
640 for (n = 0; n < pctl->desc.npins; n++) in mvebu_pinctrl_probe()
642 pctl->desc.pins = pdesc; in mvebu_pinctrl_probe()
647 size = pctl->num_groups * sizeof(*pctl->groups) + noname * 8; in mvebu_pinctrl_probe()
652 pctl->groups = p; in mvebu_pinctrl_probe()
653 noname_buf = p + pctl->num_groups * sizeof(*pctl->groups); in mvebu_pinctrl_probe()
662 pctl->groups[gid].gid = gid; in mvebu_pinctrl_probe()
663 pctl->groups[gid].ctrl = ctrl; in mvebu_pinctrl_probe()
664 pctl->groups[gid].data = data; in mvebu_pinctrl_probe()
665 pctl->groups[gid].name = ctrl->name; in mvebu_pinctrl_probe()
666 pctl->groups[gid].pins = ctrl->pins; in mvebu_pinctrl_probe()
667 pctl->groups[gid].npins = ctrl->npins; in mvebu_pinctrl_probe()
675 pctl->groups[gid].name = noname_buf; in mvebu_pinctrl_probe()
676 pctl->groups[gid].npins = 1; in mvebu_pinctrl_probe()
682 pctl->groups[gid].gid = gid; in mvebu_pinctrl_probe()
683 pctl->groups[gid].ctrl = ctrl; in mvebu_pinctrl_probe()
684 pctl->groups[gid].data = data; in mvebu_pinctrl_probe()
685 pctl->groups[gid].name = noname_buf; in mvebu_pinctrl_probe()
686 pctl->groups[gid].pins = &ctrl->pins[k]; in mvebu_pinctrl_probe()
687 pctl->groups[gid].npins = 1; in mvebu_pinctrl_probe()
710 if (pctl->variant && !(pctl->variant & set->variant)) in mvebu_pinctrl_probe()
729 grp = mvebu_pinctrl_find_group_by_pid(pctl, mode->pid); in mvebu_pinctrl_probe()
740 ret = mvebu_pinctrl_build_functions(pdev, pctl); in mvebu_pinctrl_probe()
746 pctl->pctldev = devm_pinctrl_register(&pdev->dev, &pctl->desc, pctl); in mvebu_pinctrl_probe()
747 if (IS_ERR(pctl->pctldev)) { in mvebu_pinctrl_probe()
749 return PTR_ERR(pctl->pctldev); in mvebu_pinctrl_probe()
756 pinctrl_add_gpio_range(pctl->pctldev, &soc->gpioranges[n]); in mvebu_pinctrl_probe()