Lines Matching +full:long +full:- +full:term

1 // SPDX-License-Identifier: GPL-2.0-only
26 #include <linux/pinctrl/pinconf-generic.h>
32 #include "pinctrl-intel.h"
33 #include "pinctrl-tangier.h"
66 #define pin_to_bufno(f, p) ((p) - (f)->pin_base)
74 for (i = 0; i < tp->nfamilies; i++) { in tng_get_family()
75 family = &tp->families[i]; in tng_get_family()
76 if (pin >= family->pin_base && in tng_get_family()
77 pin < family->pin_base + family->npins) in tng_get_family()
81 dev_warn(tp->dev, "failed to find family for pin %u\n", pin); in tng_get_family()
93 return !family->protected; in tng_buf_available()
106 return family->regs + BUFCFG_OFFSET + bufno * 4; in tng_get_bufcfg()
114 return -EBUSY; in tng_read_bufcfg()
139 return tp->ngroups; in tng_get_groups_count()
147 return tp->groups[group].grp.name; in tng_get_group_name()
155 *pins = tp->groups[group].grp.pins; in tng_get_group_pins()
156 *npins = tp->groups[group].grp.npins; in tng_get_group_pins()
193 return tp->nfunctions; in tng_get_functions_count()
201 return tp->functions[function].func.name; in tng_get_function_name()
211 *groups = tp->functions[function].func.groups; in tng_get_function_groups()
212 *ngroups = tp->functions[function].func.ngroups; in tng_get_function_groups()
221 const struct intel_pingroup *grp = &tp->groups[group]; in tng_pinmux_set_mux()
222 u32 bits = grp->mode << BUFCFG_PINMODE_SHIFT; in tng_pinmux_set_mux()
230 for (i = 0; i < grp->grp.npins; i++) { in tng_pinmux_set_mux()
231 if (!tng_buf_available(tp, grp->grp.pins[i])) in tng_pinmux_set_mux()
232 return -EBUSY; in tng_pinmux_set_mux()
235 guard(raw_spinlock_irqsave)(&tp->lock); in tng_pinmux_set_mux()
238 for (i = 0; i < grp->grp.npins; i++) in tng_pinmux_set_mux()
239 tng_update_bufcfg(tp, grp->grp.pins[i], bits, mask); in tng_pinmux_set_mux()
253 return -EBUSY; in tng_gpio_request_enable()
255 guard(raw_spinlock_irqsave)(&tp->lock); in tng_gpio_request_enable()
271 unsigned long *config) in tng_config_get()
275 u32 value, term; in tng_config_get() local
281 return -ENOTSUPP; in tng_config_get()
283 term = (value & BUFCFG_PUPD_VAL_MASK) >> BUFCFG_PUPD_VAL_SHIFT; in tng_config_get()
288 return -EINVAL; in tng_config_get()
293 return -EINVAL; in tng_config_get()
295 switch (term) { in tng_config_get()
314 return -EINVAL; in tng_config_get()
316 switch (term) { in tng_config_get()
335 return -EINVAL; in tng_config_get()
340 return -EINVAL; in tng_config_get()
349 return -ENOTSUPP; in tng_config_get()
357 unsigned long config) in tng_config_set_pin()
361 u32 mask, term, value = 0; in tng_config_set_pin() local
371 term = BUFCFG_PUPD_VAL_50K; in tng_config_set_pin()
375 term = BUFCFG_PUPD_VAL_20K; in tng_config_set_pin()
378 term = BUFCFG_PUPD_VAL_2K; in tng_config_set_pin()
381 term = BUFCFG_PUPD_VAL_910; in tng_config_set_pin()
384 return -EINVAL; in tng_config_set_pin()
388 value = BUFCFG_PU_EN | (term << BUFCFG_PUPD_VAL_SHIFT); in tng_config_set_pin()
394 term = BUFCFG_PUPD_VAL_50K; in tng_config_set_pin()
398 term = BUFCFG_PUPD_VAL_20K; in tng_config_set_pin()
401 term = BUFCFG_PUPD_VAL_2K; in tng_config_set_pin()
404 term = BUFCFG_PUPD_VAL_910; in tng_config_set_pin()
407 return -EINVAL; in tng_config_set_pin()
411 value = BUFCFG_PD_EN | (term << BUFCFG_PUPD_VAL_SHIFT); in tng_config_set_pin()
430 return -EINVAL; in tng_config_set_pin()
433 guard(raw_spinlock_irqsave)(&tp->lock); in tng_config_set_pin()
441 unsigned long *configs, unsigned int nconfigs) in tng_config_set()
448 return -ENOTSUPP; in tng_config_set()
464 return -ENOTSUPP; in tng_config_set()
472 unsigned int group, unsigned long *config) in tng_config_group_get()
486 unsigned int group, unsigned long *configs, in tng_config_group_set()
524 struct device *dev = &pdev->dev; in tng_pinctrl_probe()
533 return -ENOMEM; in tng_pinctrl_probe()
535 tp->dev = dev; in tng_pinctrl_probe()
536 raw_spin_lock_init(&tp->lock); in tng_pinctrl_probe()
546 families_len = size_mul(sizeof(*families), tp->nfamilies); in tng_pinctrl_probe()
547 families = devm_kmemdup(dev, tp->families, families_len, GFP_KERNEL); in tng_pinctrl_probe()
549 return -ENOMEM; in tng_pinctrl_probe()
552 for (i = 0; i < tp->nfamilies; i++) { in tng_pinctrl_probe()
555 family->regs = regs + family->barno * TNG_FAMILY_LEN; in tng_pinctrl_probe()
558 tp->families = families; in tng_pinctrl_probe()
559 tp->pctldesc = tng_pinctrl_desc; in tng_pinctrl_probe()
560 tp->pctldesc.name = dev_name(dev); in tng_pinctrl_probe()
561 tp->pctldesc.pins = tp->pins; in tng_pinctrl_probe()
562 tp->pctldesc.npins = tp->npins; in tng_pinctrl_probe()
564 tp->pctldev = devm_pinctrl_register(dev, &tp->pctldesc, tp); in tng_pinctrl_probe()
565 if (IS_ERR(tp->pctldev)) in tng_pinctrl_probe()
566 return dev_err_probe(dev, PTR_ERR(tp->pctldev), in tng_pinctrl_probe()
576 data = device_get_match_data(&pdev->dev); in devm_tng_pinctrl_probe()
578 return -ENODATA; in devm_tng_pinctrl_probe()