Lines Matching full:pctl

127 	struct axp20x_pctl *pctl = gpiochip_get_data(chip);  in axp20x_gpio_get()  local
131 ret = regmap_read(pctl->regmap, AXP20X_GPIO20_SS, &val); in axp20x_gpio_get()
135 return !!(val & BIT(offset + pctl->desc->gpio_status_offset)); in axp20x_gpio_get()
141 struct axp20x_pctl *pctl = gpiochip_get_data(chip); in axp20x_gpio_get_direction() local
149 ret = regmap_read(pctl->regmap, reg, &val); in axp20x_gpio_get_direction()
182 struct axp20x_pctl *pctl = gpiochip_get_data(chip); in axp20x_gpio_set() local
189 regmap_update_bits(pctl->regmap, reg, in axp20x_gpio_set()
198 struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev); in axp20x_pmx_set() local
205 return regmap_update_bits(pctl->regmap, reg, AXP20X_GPIO_FUNCTIONS, in axp20x_pmx_set()
211 struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev); in axp20x_pmx_func_cnt() local
213 return ARRAY_SIZE(pctl->funcs); in axp20x_pmx_func_cnt()
219 struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev); in axp20x_pmx_func_name() local
221 return pctl->funcs[selector].name; in axp20x_pmx_func_name()
229 struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev); in axp20x_pmx_func_groups() local
231 *groups = pctl->funcs[selector].groups; in axp20x_pmx_func_groups()
232 *num_groups = pctl->funcs[selector].ngroups; in axp20x_pmx_func_groups()
240 struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev); in axp20x_pmx_set_mux() local
246 pctl->funcs[function].muxval); in axp20x_pmx_set_mux()
249 mask = pctl->desc->ldo_mask; in axp20x_pmx_set_mux()
251 mask = pctl->desc->adc_mask; in axp20x_pmx_set_mux()
265 return axp20x_pmx_set(pctldev, group, pctl->funcs[function].muxval); in axp20x_pmx_set_mux()
272 struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev); in axp20x_pmx_gpio_set_direction() local
276 pctl->funcs[AXP20X_FUNC_GPIO_IN].muxval); in axp20x_pmx_gpio_set_direction()
279 pctl->funcs[AXP20X_FUNC_GPIO_OUT].muxval); in axp20x_pmx_gpio_set_direction()
293 struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev); in axp20x_groups_cnt() local
295 return pctl->desc->npins; in axp20x_groups_cnt()
301 struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev); in axp20x_group_pins() local
303 *pins = (unsigned int *)&pctl->desc->pins[selector]; in axp20x_group_pins()
312 struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev); in axp20x_group_name() local
314 return pctl->desc->pins[selector].name; in axp20x_group_name()
354 struct axp20x_pctl *pctl = platform_get_drvdata(pdev); in axp20x_build_funcs_groups() local
355 int i, ret, pin, npins = pctl->desc->npins; in axp20x_build_funcs_groups()
357 pctl->funcs[AXP20X_FUNC_GPIO_OUT].name = "gpio_out"; in axp20x_build_funcs_groups()
358 pctl->funcs[AXP20X_FUNC_GPIO_OUT].muxval = AXP20X_MUX_GPIO_OUT; in axp20x_build_funcs_groups()
359 pctl->funcs[AXP20X_FUNC_GPIO_IN].name = "gpio_in"; in axp20x_build_funcs_groups()
360 pctl->funcs[AXP20X_FUNC_GPIO_IN].muxval = AXP20X_MUX_GPIO_IN; in axp20x_build_funcs_groups()
361 pctl->funcs[AXP20X_FUNC_LDO].name = "ldo"; in axp20x_build_funcs_groups()
366 pctl->funcs[AXP20X_FUNC_ADC].name = "adc"; in axp20x_build_funcs_groups()
367 pctl->funcs[AXP20X_FUNC_ADC].muxval = pctl->desc->adc_mux; in axp20x_build_funcs_groups()
371 pctl->funcs[i].ngroups = npins; in axp20x_build_funcs_groups()
372 pctl->funcs[i].groups = devm_kcalloc(&pdev->dev, in axp20x_build_funcs_groups()
375 if (!pctl->funcs[i].groups) in axp20x_build_funcs_groups()
378 pctl->funcs[i].groups[pin] = pctl->desc->pins[pin].name; in axp20x_build_funcs_groups()
381 ret = axp20x_funcs_groups_from_mask(&pdev->dev, pctl->desc->ldo_mask, in axp20x_build_funcs_groups()
382 npins, &pctl->funcs[AXP20X_FUNC_LDO], in axp20x_build_funcs_groups()
383 pctl->desc->pins); in axp20x_build_funcs_groups()
387 ret = axp20x_funcs_groups_from_mask(&pdev->dev, pctl->desc->adc_mask, in axp20x_build_funcs_groups()
388 npins, &pctl->funcs[AXP20X_FUNC_ADC], in axp20x_build_funcs_groups()
389 pctl->desc->pins); in axp20x_build_funcs_groups()
407 struct axp20x_pctl *pctl; in axp20x_pctl_probe() local
420 pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); in axp20x_pctl_probe()
421 if (!pctl) in axp20x_pctl_probe()
424 pctl->chip.base = -1; in axp20x_pctl_probe()
425 pctl->chip.can_sleep = true; in axp20x_pctl_probe()
426 pctl->chip.request = gpiochip_generic_request; in axp20x_pctl_probe()
427 pctl->chip.free = gpiochip_generic_free; in axp20x_pctl_probe()
428 pctl->chip.parent = &pdev->dev; in axp20x_pctl_probe()
429 pctl->chip.label = dev_name(&pdev->dev); in axp20x_pctl_probe()
430 pctl->chip.owner = THIS_MODULE; in axp20x_pctl_probe()
431 pctl->chip.get = axp20x_gpio_get; in axp20x_pctl_probe()
432 pctl->chip.get_direction = axp20x_gpio_get_direction; in axp20x_pctl_probe()
433 pctl->chip.set = axp20x_gpio_set; in axp20x_pctl_probe()
434 pctl->chip.direction_input = axp20x_gpio_input; in axp20x_pctl_probe()
435 pctl->chip.direction_output = axp20x_gpio_output; in axp20x_pctl_probe()
437 pctl->desc = of_device_get_match_data(dev); in axp20x_pctl_probe()
439 pctl->chip.ngpio = pctl->desc->npins; in axp20x_pctl_probe()
441 pctl->regmap = axp20x->regmap; in axp20x_pctl_probe()
442 pctl->dev = &pdev->dev; in axp20x_pctl_probe()
444 platform_set_drvdata(pdev, pctl); in axp20x_pctl_probe()
458 pctrl_desc->pins = pctl->desc->pins; in axp20x_pctl_probe()
459 pctrl_desc->npins = pctl->desc->npins; in axp20x_pctl_probe()
463 pctl->pctl_dev = devm_pinctrl_register(&pdev->dev, pctrl_desc, pctl); in axp20x_pctl_probe()
464 if (IS_ERR(pctl->pctl_dev)) { in axp20x_pctl_probe()
466 return PTR_ERR(pctl->pctl_dev); in axp20x_pctl_probe()
469 ret = devm_gpiochip_add_data(&pdev->dev, &pctl->chip, pctl); in axp20x_pctl_probe()
475 ret = gpiochip_add_pin_range(&pctl->chip, dev_name(&pdev->dev), in axp20x_pctl_probe()
476 pctl->desc->pins->number, in axp20x_pctl_probe()
477 pctl->desc->pins->number, in axp20x_pctl_probe()
478 pctl->desc->npins); in axp20x_pctl_probe()