• Home
  • Raw
  • Download

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

1 // SPDX-License-Identifier: GPL-2.0-only
25 #include <linux/pinctrl/pinconf-generic.h>
31 #include "pinctrl-intel.h"
32 #include "pinctrl-tangier.h"
65 #define pin_to_bufno(f, p) ((p) - (f)->pin_base)
73 for (i = 0; i < tp->nfamilies; i++) { in tng_get_family()
74 family = &tp->families[i]; in tng_get_family()
75 if (pin >= family->pin_base && in tng_get_family()
76 pin < family->pin_base + family->npins) in tng_get_family()
80 dev_warn(tp->dev, "failed to find family for pin %u\n", pin); in tng_get_family()
92 return !family->protected; in tng_buf_available()
105 return family->regs + BUFCFG_OFFSET + bufno * 4; in tng_get_bufcfg()
113 return -EBUSY; in tng_read_bufcfg()
138 return tp->ngroups; in tng_get_groups_count()
146 return tp->groups[group].grp.name; in tng_get_group_name()
154 *pins = tp->groups[group].grp.pins; in tng_get_group_pins()
155 *npins = tp->groups[group].grp.npins; in tng_get_group_pins()
192 return tp->nfunctions; in tng_get_functions_count()
200 return tp->functions[function].func.name; in tng_get_function_name()
210 *groups = tp->functions[function].func.groups; in tng_get_function_groups()
211 *ngroups = tp->functions[function].func.ngroups; in tng_get_function_groups()
220 const struct intel_pingroup *grp = &tp->groups[group]; in tng_pinmux_set_mux()
221 u32 bits = grp->mode << BUFCFG_PINMODE_SHIFT; in tng_pinmux_set_mux()
223 unsigned long flags; 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()
236 raw_spin_lock_irqsave(&tp->lock, flags); in tng_pinmux_set_mux()
237 for (i = 0; i < grp->grp.npins; i++) in tng_pinmux_set_mux()
238 tng_update_bufcfg(tp, grp->grp.pins[i], bits, mask); in tng_pinmux_set_mux()
239 raw_spin_unlock_irqrestore(&tp->lock, flags); in tng_pinmux_set_mux()
251 unsigned long flags; in tng_gpio_request_enable()
254 return -EBUSY; in tng_gpio_request_enable()
256 raw_spin_lock_irqsave(&tp->lock, flags); in tng_gpio_request_enable()
258 raw_spin_unlock_irqrestore(&tp->lock, flags); in tng_gpio_request_enable()
272 unsigned long *config) in tng_config_get()
276 u32 value, term; in tng_config_get() local
282 return -ENOTSUPP; in tng_config_get()
284 term = (value & BUFCFG_PUPD_VAL_MASK) >> BUFCFG_PUPD_VAL_SHIFT; in tng_config_get()
289 return -EINVAL; in tng_config_get()
294 return -EINVAL; in tng_config_get()
296 switch (term) { in tng_config_get()
315 return -EINVAL; in tng_config_get()
317 switch (term) { in tng_config_get()
336 return -EINVAL; in tng_config_get()
341 return -EINVAL; in tng_config_get()
350 return -ENOTSUPP; in tng_config_get()
358 unsigned long config) in tng_config_set_pin()
362 u32 mask, term, value = 0; in tng_config_set_pin() local
363 unsigned long flags; in tng_config_set_pin()
377 term = BUFCFG_PUPD_VAL_50K; in tng_config_set_pin()
380 term = BUFCFG_PUPD_VAL_20K; in tng_config_set_pin()
383 term = BUFCFG_PUPD_VAL_2K; in tng_config_set_pin()
386 return -EINVAL; in tng_config_set_pin()
390 value = BUFCFG_PU_EN | (term << BUFCFG_PUPD_VAL_SHIFT); in tng_config_set_pin()
400 term = BUFCFG_PUPD_VAL_50K; in tng_config_set_pin()
403 term = BUFCFG_PUPD_VAL_20K; in tng_config_set_pin()
406 term = BUFCFG_PUPD_VAL_2K; in tng_config_set_pin()
409 return -EINVAL; in tng_config_set_pin()
413 value = BUFCFG_PD_EN | (term << BUFCFG_PUPD_VAL_SHIFT); in tng_config_set_pin()
432 return -EINVAL; in tng_config_set_pin()
435 raw_spin_lock_irqsave(&tp->lock, flags); in tng_config_set_pin()
437 raw_spin_unlock_irqrestore(&tp->lock, flags); in tng_config_set_pin()
443 unsigned long *configs, unsigned int nconfigs) in tng_config_set()
450 return -ENOTSUPP; in tng_config_set()
466 return -ENOTSUPP; in tng_config_set()
474 unsigned int group, unsigned long *config) in tng_config_group_get()
488 unsigned int group, unsigned long *configs, in tng_config_group_set()
526 struct device *dev = &pdev->dev; in tng_pinctrl_probe()
535 return -ENOMEM; in tng_pinctrl_probe()
537 tp->dev = dev; in tng_pinctrl_probe()
538 raw_spin_lock_init(&tp->lock); in tng_pinctrl_probe()
548 families_len = size_mul(sizeof(*families), tp->nfamilies); in tng_pinctrl_probe()
549 families = devm_kmemdup(dev, tp->families, families_len, GFP_KERNEL); in tng_pinctrl_probe()
551 return -ENOMEM; in tng_pinctrl_probe()
554 for (i = 0; i < tp->nfamilies; i++) { in tng_pinctrl_probe()
557 family->regs = regs + family->barno * TNG_FAMILY_LEN; in tng_pinctrl_probe()
560 tp->families = families; in tng_pinctrl_probe()
561 tp->pctldesc = tng_pinctrl_desc; in tng_pinctrl_probe()
562 tp->pctldesc.name = dev_name(dev); in tng_pinctrl_probe()
563 tp->pctldesc.pins = tp->pins; in tng_pinctrl_probe()
564 tp->pctldesc.npins = tp->npins; in tng_pinctrl_probe()
566 tp->pctldev = devm_pinctrl_register(dev, &tp->pctldesc, tp); in tng_pinctrl_probe()
567 if (IS_ERR(tp->pctldev)) in tng_pinctrl_probe()
568 return dev_err_probe(dev, PTR_ERR(tp->pctldev), in tng_pinctrl_probe()
578 data = device_get_match_data(&pdev->dev); in devm_tng_pinctrl_probe()
580 return -ENODATA; in devm_tng_pinctrl_probe()