Lines Matching full:pctl

134 	struct axp20x_pctl *pctl = gpiochip_get_data(chip);  in axp20x_gpio_get()  local
140 ret = regmap_read(pctl->regmap, AXP20X_GPIO3_CTRL, &val); in axp20x_gpio_get()
146 ret = regmap_read(pctl->regmap, AXP20X_GPIO20_SS, &val); in axp20x_gpio_get()
150 return !!(val & BIT(offset + pctl->desc->gpio_status_offset)); in axp20x_gpio_get()
156 struct axp20x_pctl *pctl = gpiochip_get_data(chip); in axp20x_gpio_get_direction() local
162 ret = regmap_read(pctl->regmap, AXP20X_GPIO3_CTRL, &val); in axp20x_gpio_get_direction()
175 ret = regmap_read(pctl->regmap, reg, &val); in axp20x_gpio_get_direction()
208 struct axp20x_pctl *pctl = gpiochip_get_data(chip); in axp20x_gpio_set() local
213 regmap_update_bits(pctl->regmap, AXP20X_GPIO3_CTRL, in axp20x_gpio_set()
224 regmap_update_bits(pctl->regmap, reg, in axp20x_gpio_set()
233 struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev); in axp20x_pmx_set() local
238 return regmap_update_bits(pctl->regmap, AXP20X_GPIO3_CTRL, in axp20x_pmx_set()
248 return regmap_update_bits(pctl->regmap, reg, AXP20X_GPIO_FUNCTIONS, in axp20x_pmx_set()
254 struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev); in axp20x_pmx_func_cnt() local
256 return ARRAY_SIZE(pctl->funcs); in axp20x_pmx_func_cnt()
262 struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev); in axp20x_pmx_func_name() local
264 return pctl->funcs[selector].name; in axp20x_pmx_func_name()
272 struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev); in axp20x_pmx_func_groups() local
274 *groups = pctl->funcs[selector].groups; in axp20x_pmx_func_groups()
275 *num_groups = pctl->funcs[selector].ngroups; in axp20x_pmx_func_groups()
283 struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev); in axp20x_pmx_set_mux() local
289 pctl->funcs[function].muxval); in axp20x_pmx_set_mux()
292 mask = pctl->desc->ldo_mask; in axp20x_pmx_set_mux()
294 mask = pctl->desc->adc_mask; in axp20x_pmx_set_mux()
308 return axp20x_pmx_set(pctldev, group, pctl->funcs[function].muxval); in axp20x_pmx_set_mux()
315 struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev); in axp20x_pmx_gpio_set_direction() local
319 pctl->funcs[AXP20X_FUNC_GPIO_IN].muxval); in axp20x_pmx_gpio_set_direction()
322 pctl->funcs[AXP20X_FUNC_GPIO_OUT].muxval); in axp20x_pmx_gpio_set_direction()
336 struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev); in axp20x_groups_cnt() local
338 return pctl->desc->npins; in axp20x_groups_cnt()
344 struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev); in axp20x_group_pins() local
346 *pins = (unsigned int *)&pctl->desc->pins[selector]; in axp20x_group_pins()
355 struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev); in axp20x_group_name() local
357 return pctl->desc->pins[selector].name; in axp20x_group_name()
397 struct axp20x_pctl *pctl = platform_get_drvdata(pdev); in axp20x_build_funcs_groups() local
398 int i, ret, pin, npins = pctl->desc->npins; in axp20x_build_funcs_groups()
400 pctl->funcs[AXP20X_FUNC_GPIO_OUT].name = "gpio_out"; in axp20x_build_funcs_groups()
401 pctl->funcs[AXP20X_FUNC_GPIO_OUT].muxval = AXP20X_MUX_GPIO_OUT; in axp20x_build_funcs_groups()
402 pctl->funcs[AXP20X_FUNC_GPIO_IN].name = "gpio_in"; in axp20x_build_funcs_groups()
403 pctl->funcs[AXP20X_FUNC_GPIO_IN].muxval = AXP20X_MUX_GPIO_IN; in axp20x_build_funcs_groups()
404 pctl->funcs[AXP20X_FUNC_LDO].name = "ldo"; in axp20x_build_funcs_groups()
409 pctl->funcs[AXP20X_FUNC_ADC].name = "adc"; in axp20x_build_funcs_groups()
410 pctl->funcs[AXP20X_FUNC_ADC].muxval = pctl->desc->adc_mux; in axp20x_build_funcs_groups()
414 pctl->funcs[i].ngroups = npins; in axp20x_build_funcs_groups()
415 pctl->funcs[i].groups = devm_kcalloc(&pdev->dev, in axp20x_build_funcs_groups()
418 if (!pctl->funcs[i].groups) in axp20x_build_funcs_groups()
421 pctl->funcs[i].groups[pin] = pctl->desc->pins[pin].name; in axp20x_build_funcs_groups()
424 ret = axp20x_funcs_groups_from_mask(&pdev->dev, pctl->desc->ldo_mask, in axp20x_build_funcs_groups()
425 npins, &pctl->funcs[AXP20X_FUNC_LDO], in axp20x_build_funcs_groups()
426 pctl->desc->pins); in axp20x_build_funcs_groups()
430 ret = axp20x_funcs_groups_from_mask(&pdev->dev, pctl->desc->adc_mask, in axp20x_build_funcs_groups()
431 npins, &pctl->funcs[AXP20X_FUNC_ADC], in axp20x_build_funcs_groups()
432 pctl->desc->pins); in axp20x_build_funcs_groups()
450 struct axp20x_pctl *pctl; in axp20x_pctl_probe() local
463 pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); in axp20x_pctl_probe()
464 if (!pctl) in axp20x_pctl_probe()
467 pctl->chip.base = -1; in axp20x_pctl_probe()
468 pctl->chip.can_sleep = true; in axp20x_pctl_probe()
469 pctl->chip.request = gpiochip_generic_request; in axp20x_pctl_probe()
470 pctl->chip.free = gpiochip_generic_free; in axp20x_pctl_probe()
471 pctl->chip.parent = &pdev->dev; in axp20x_pctl_probe()
472 pctl->chip.label = dev_name(&pdev->dev); in axp20x_pctl_probe()
473 pctl->chip.owner = THIS_MODULE; in axp20x_pctl_probe()
474 pctl->chip.get = axp20x_gpio_get; in axp20x_pctl_probe()
475 pctl->chip.get_direction = axp20x_gpio_get_direction; in axp20x_pctl_probe()
476 pctl->chip.set = axp20x_gpio_set; in axp20x_pctl_probe()
477 pctl->chip.direction_input = axp20x_gpio_input; in axp20x_pctl_probe()
478 pctl->chip.direction_output = axp20x_gpio_output; in axp20x_pctl_probe()
480 pctl->desc = of_device_get_match_data(dev); in axp20x_pctl_probe()
482 pctl->chip.ngpio = pctl->desc->npins; in axp20x_pctl_probe()
484 pctl->regmap = axp20x->regmap; in axp20x_pctl_probe()
485 pctl->dev = &pdev->dev; in axp20x_pctl_probe()
487 platform_set_drvdata(pdev, pctl); in axp20x_pctl_probe()
501 pctrl_desc->pins = pctl->desc->pins; in axp20x_pctl_probe()
502 pctrl_desc->npins = pctl->desc->npins; in axp20x_pctl_probe()
506 pctl->pctl_dev = devm_pinctrl_register(&pdev->dev, pctrl_desc, pctl); in axp20x_pctl_probe()
507 if (IS_ERR(pctl->pctl_dev)) { in axp20x_pctl_probe()
509 return PTR_ERR(pctl->pctl_dev); in axp20x_pctl_probe()
512 ret = devm_gpiochip_add_data(&pdev->dev, &pctl->chip, pctl); in axp20x_pctl_probe()
518 ret = gpiochip_add_pin_range(&pctl->chip, dev_name(&pdev->dev), in axp20x_pctl_probe()
519 pctl->desc->pins->number, in axp20x_pctl_probe()
520 pctl->desc->pins->number, in axp20x_pctl_probe()
521 pctl->desc->npins); in axp20x_pctl_probe()