Lines Matching +full:pinctrl +full:- +full:3

1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (C) 2023 BayLibre Incorporated - https://www.baylibre.com/
11 #include <linux/pinctrl/pinmux.h>
30 #define TPS6594_PINCTRL_DISABLE_WDOG_FUNCTION 3
38 #define TPS6594_PINCTRL_SYNCCLKOUT_FUNCTION_GPIO8 3
39 #define TPS6594_PINCTRL_CLK32KOUT_FUNCTION_GPIO9 3
51 #define TPS65224_PINCTRL_NINT_FUNCTION 3
52 #define TPS65224_PINCTRL_TRIG_WDOG_FUNCTION 3
53 #define TPS65224_PINCTRL_PB_FUNCTION 3
54 #define TPS65224_PINCTRL_ADC_IN_FUNCTION 3
59 #define TPS65224_PINCTRL_SYNCCLKIN_FUNCTION_GPIO5 3
76 PINCTRL_PIN(2, "GPIO2"), PINCTRL_PIN(3, "GPIO3"),
169 PINCTRL_PIN(2, "GPIO2"), PINCTRL_PIN(3, "GPIO3"),
341 return -EINVAL; in tps6594_gpio_regmap_xlate()
347 struct tps6594_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctldev); in tps6594_pmx_func_cnt() local
349 return pinctrl->func_cnt; in tps6594_pmx_func_cnt()
355 struct tps6594_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctldev); in tps6594_pmx_func_name() local
357 return pinctrl->funcs[selector].pinfunction.name; in tps6594_pmx_func_name()
365 struct tps6594_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctldev); in tps6594_pmx_func_groups() local
367 *groups = pinctrl->funcs[selector].pinfunction.groups; in tps6594_pmx_func_groups()
368 *num_groups = pinctrl->funcs[selector].pinfunction.ngroups; in tps6594_pmx_func_groups()
373 static int tps6594_pmx_set(struct tps6594_pinctrl *pinctrl, unsigned int pin, in tps6594_pmx_set() argument
377 u8 mux_sel_mask = pinctrl->mux_sel_mask; in tps6594_pmx_set()
379 if (pinctrl->tps->chip_id == TPS65224 && pin == 5) { in tps6594_pmx_set()
384 return regmap_update_bits(pinctrl->tps->regmap, in tps6594_pmx_set()
392 struct tps6594_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctldev); in tps6594_pmx_set_mux() local
393 u8 muxval = pinctrl->funcs[function].muxval; in tps6594_pmx_set_mux()
394 unsigned int remap_cnt = pinctrl->remap_cnt; in tps6594_pmx_set_mux()
395 struct muxval_remap *remap = pinctrl->remap; in tps6594_pmx_set_mux()
404 return tps6594_pmx_set(pinctrl, group, muxval); in tps6594_pmx_set_mux()
411 struct tps6594_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctldev); in tps6594_pmx_gpio_set_direction() local
412 u8 muxval = pinctrl->funcs[TPS6594_PINCTRL_GPIO_FUNCTION].muxval; in tps6594_pmx_gpio_set_direction()
414 return tps6594_pmx_set(pinctrl, offset, muxval); in tps6594_pmx_gpio_set_direction()
428 struct tps6594_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctldev); in tps6594_groups_cnt() local
430 return pinctrl->num_pins; in tps6594_groups_cnt()
437 struct tps6594_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctldev); in tps6594_group_pins() local
439 *pins = &pinctrl->pins[selector].number; in tps6594_group_pins()
448 struct tps6594_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctldev); in tps6594_group_name() local
450 return pinctrl->pins[selector].name; in tps6594_group_name()
463 struct tps6594 *tps = dev_get_drvdata(pdev->dev.parent); in tps6594_pinctrl_probe()
464 struct device *dev = &pdev->dev; in tps6594_pinctrl_probe()
465 struct tps6594_pinctrl *pinctrl; in tps6594_pinctrl_probe() local
471 return -ENOMEM; in tps6594_pinctrl_probe()
473 pinctrl = devm_kzalloc(dev, sizeof(*pinctrl), GFP_KERNEL); in tps6594_pinctrl_probe()
474 if (!pinctrl) in tps6594_pinctrl_probe()
475 return -ENOMEM; in tps6594_pinctrl_probe()
477 switch (tps->chip_id) { in tps6594_pinctrl_probe()
479 pctrl_desc->pins = tps65224_pins; in tps6594_pinctrl_probe()
480 pctrl_desc->npins = ARRAY_SIZE(tps65224_pins); in tps6594_pinctrl_probe()
482 *pinctrl = tps65224_template_pinctrl; in tps6594_pinctrl_probe()
490 pctrl_desc->pins = tps6594_pins; in tps6594_pinctrl_probe()
491 pctrl_desc->npins = ARRAY_SIZE(tps6594_pins); in tps6594_pinctrl_probe()
493 *pinctrl = tps6594_template_pinctrl; in tps6594_pinctrl_probe()
502 pinctrl->tps = tps; in tps6594_pinctrl_probe()
504 pctrl_desc->name = dev_name(dev); in tps6594_pinctrl_probe()
505 pctrl_desc->owner = THIS_MODULE; in tps6594_pinctrl_probe()
506 pctrl_desc->pctlops = &tps6594_pctrl_ops; in tps6594_pinctrl_probe()
507 pctrl_desc->pmxops = &tps6594_pmx_ops; in tps6594_pinctrl_probe()
509 config.parent = tps->dev; in tps6594_pinctrl_probe()
510 config.regmap = tps->regmap; in tps6594_pinctrl_probe()
516 pinctrl->pctl_dev = devm_pinctrl_register(dev, pctrl_desc, pinctrl); in tps6594_pinctrl_probe()
517 if (IS_ERR(pinctrl->pctl_dev)) in tps6594_pinctrl_probe()
518 return dev_err_probe(dev, PTR_ERR(pinctrl->pctl_dev), in tps6594_pinctrl_probe()
519 "Couldn't register pinctrl driver\n"); in tps6594_pinctrl_probe()
521 pinctrl->gpio_regmap = devm_gpio_regmap_register(dev, &config); in tps6594_pinctrl_probe()
522 if (IS_ERR(pinctrl->gpio_regmap)) in tps6594_pinctrl_probe()
523 return dev_err_probe(dev, PTR_ERR(pinctrl->gpio_regmap), in tps6594_pinctrl_probe()
530 { "tps6594-pinctrl", },
538 .name = "tps6594-pinctrl",
546 MODULE_DESCRIPTION("TPS6594 pinctrl and GPIO driver");