Lines Matching full:pctl
1699 static inline struct pic32_gpio_bank *pctl_to_bank(struct pic32_pinctrl *pctl, in pctl_to_bank() argument
1702 return &pctl->gpio_banks[pin / PINS_PER_BANK]; in pctl_to_bank()
1707 struct pic32_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); in pic32_pinctrl_get_groups_count() local
1709 return pctl->ngroups; in pic32_pinctrl_get_groups_count()
1715 struct pic32_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); in pic32_pinctrl_get_group_name() local
1717 return pctl->groups[group].name; in pic32_pinctrl_get_group_name()
1725 struct pic32_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); in pic32_pinctrl_get_group_pins() local
1727 *pins = &pctl->groups[group].pin; in pic32_pinctrl_get_group_pins()
1743 struct pic32_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); in pic32_pinmux_get_functions_count() local
1745 return pctl->nfunctions; in pic32_pinmux_get_functions_count()
1751 struct pic32_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); in pic32_pinmux_get_function_name() local
1753 return pctl->functions[func].name; in pic32_pinmux_get_function_name()
1761 struct pic32_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); in pic32_pinmux_get_function_groups() local
1763 *groups = pctl->functions[func].groups; in pic32_pinmux_get_function_groups()
1764 *num_groups = pctl->functions[func].ngroups; in pic32_pinmux_get_function_groups()
1772 struct pic32_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); in pic32_pinmux_enable() local
1773 const struct pic32_pin_group *pg = &pctl->groups[group]; in pic32_pinmux_enable()
1774 const struct pic32_function *pf = &pctl->functions[func]; in pic32_pinmux_enable()
1780 dev_dbg(pctl->dev, in pic32_pinmux_enable()
1784 writel(functions->muxval, pctl->reg_base + functions->muxreg); in pic32_pinmux_enable()
1792 dev_err(pctl->dev, "cannot mux pin %u to function %u\n", group, func); in pic32_pinmux_enable()
1801 struct pic32_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); in pic32_gpio_request_enable() local
1805 dev_dbg(pctl->dev, "requesting gpio %d in bank %d with mask 0x%x\n", in pic32_gpio_request_enable()
1881 struct pic32_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); in pic32_pinconf_get() local
1882 struct pic32_gpio_bank *bank = pctl_to_bank(pctl, pin); in pic32_pinconf_get()
1910 dev_err(pctl->dev, "Property %u not supported\n", param); in pic32_pinconf_get()
1922 struct pic32_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); in pic32_pinconf_set() local
1923 struct pic32_gpio_bank *bank = pctl_to_bank(pctl, pin); in pic32_pinconf_set()
1930 dev_dbg(pctl->dev, "setting pin %d bank %d mask 0x%x\n", in pic32_pinconf_set()
1939 dev_dbg(pctl->dev, " pullup\n"); in pic32_pinconf_set()
1943 dev_dbg(pctl->dev, " pulldown\n"); in pic32_pinconf_set()
1947 dev_dbg(pctl->dev, " digital\n"); in pic32_pinconf_set()
1951 dev_dbg(pctl->dev, " analog\n"); in pic32_pinconf_set()
1955 dev_dbg(pctl->dev, " opendrain\n"); in pic32_pinconf_set()
1966 dev_err(pctl->dev, "Property %u not supported\n", in pic32_pinconf_set()
2163 struct pic32_pinctrl *pctl; in pic32_pinctrl_probe() local
2166 pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); in pic32_pinctrl_probe()
2167 if (!pctl) in pic32_pinctrl_probe()
2169 pctl->dev = &pdev->dev; in pic32_pinctrl_probe()
2170 dev_set_drvdata(&pdev->dev, pctl); in pic32_pinctrl_probe()
2172 pctl->reg_base = devm_platform_ioremap_resource(pdev, 0); in pic32_pinctrl_probe()
2173 if (IS_ERR(pctl->reg_base)) in pic32_pinctrl_probe()
2174 return PTR_ERR(pctl->reg_base); in pic32_pinctrl_probe()
2176 pctl->clk = devm_clk_get(&pdev->dev, NULL); in pic32_pinctrl_probe()
2177 if (IS_ERR(pctl->clk)) { in pic32_pinctrl_probe()
2178 ret = PTR_ERR(pctl->clk); in pic32_pinctrl_probe()
2183 ret = clk_prepare_enable(pctl->clk); in pic32_pinctrl_probe()
2189 pctl->pins = pic32_pins; in pic32_pinctrl_probe()
2190 pctl->npins = ARRAY_SIZE(pic32_pins); in pic32_pinctrl_probe()
2191 pctl->functions = pic32_functions; in pic32_pinctrl_probe()
2192 pctl->nfunctions = ARRAY_SIZE(pic32_functions); in pic32_pinctrl_probe()
2193 pctl->groups = pic32_groups; in pic32_pinctrl_probe()
2194 pctl->ngroups = ARRAY_SIZE(pic32_groups); in pic32_pinctrl_probe()
2195 pctl->gpio_banks = pic32_gpio_banks; in pic32_pinctrl_probe()
2196 pctl->nbanks = ARRAY_SIZE(pic32_gpio_banks); in pic32_pinctrl_probe()
2198 pic32_pinctrl_desc.pins = pctl->pins; in pic32_pinctrl_probe()
2199 pic32_pinctrl_desc.npins = pctl->npins; in pic32_pinctrl_probe()
2203 pctl->pctldev = devm_pinctrl_register(&pdev->dev, &pic32_pinctrl_desc, in pic32_pinctrl_probe()
2204 pctl); in pic32_pinctrl_probe()
2205 if (IS_ERR(pctl->pctldev)) { in pic32_pinctrl_probe()
2207 return PTR_ERR(pctl->pctldev); in pic32_pinctrl_probe()