Lines Matching refs:tp
68 static const struct tng_family *tng_get_family(struct tng_pinctrl *tp, in tng_get_family() argument
74 for (i = 0; i < tp->nfamilies; i++) { in tng_get_family()
75 family = &tp->families[i]; in tng_get_family()
81 dev_warn(tp->dev, "failed to find family for pin %u\n", pin); in tng_get_family()
85 static bool tng_buf_available(struct tng_pinctrl *tp, unsigned int pin) in tng_buf_available() argument
89 family = tng_get_family(tp, pin); in tng_buf_available()
96 static void __iomem *tng_get_bufcfg(struct tng_pinctrl *tp, unsigned int pin) in tng_get_bufcfg() argument
101 family = tng_get_family(tp, pin); in tng_get_bufcfg()
109 static int tng_read_bufcfg(struct tng_pinctrl *tp, unsigned int pin, u32 *value) in tng_read_bufcfg() argument
113 if (!tng_buf_available(tp, pin)) in tng_read_bufcfg()
116 bufcfg = tng_get_bufcfg(tp, pin); in tng_read_bufcfg()
122 static void tng_update_bufcfg(struct tng_pinctrl *tp, unsigned int pin, in tng_update_bufcfg() argument
128 bufcfg = tng_get_bufcfg(tp, pin); in tng_update_bufcfg()
137 struct tng_pinctrl *tp = pinctrl_dev_get_drvdata(pctldev); in tng_get_groups_count() local
139 return tp->ngroups; in tng_get_groups_count()
145 struct tng_pinctrl *tp = pinctrl_dev_get_drvdata(pctldev); in tng_get_group_name() local
147 return tp->groups[group].grp.name; in tng_get_group_name()
153 struct tng_pinctrl *tp = pinctrl_dev_get_drvdata(pctldev); in tng_get_group_pins() local
155 *pins = tp->groups[group].grp.pins; in tng_get_group_pins()
156 *npins = tp->groups[group].grp.npins; in tng_get_group_pins()
163 struct tng_pinctrl *tp = pinctrl_dev_get_drvdata(pctldev); in tng_pin_dbg_show() local
167 ret = tng_read_bufcfg(tp, pin, &value); in tng_pin_dbg_show()
191 struct tng_pinctrl *tp = pinctrl_dev_get_drvdata(pctldev); in tng_get_functions_count() local
193 return tp->nfunctions; in tng_get_functions_count()
199 struct tng_pinctrl *tp = pinctrl_dev_get_drvdata(pctldev); in tng_get_function_name() local
201 return tp->functions[function].func.name; in tng_get_function_name()
209 struct tng_pinctrl *tp = pinctrl_dev_get_drvdata(pctldev); in tng_get_function_groups() local
211 *groups = tp->functions[function].func.groups; in tng_get_function_groups()
212 *ngroups = tp->functions[function].func.ngroups; in tng_get_function_groups()
220 struct tng_pinctrl *tp = pinctrl_dev_get_drvdata(pctldev); in tng_pinmux_set_mux() local
221 const struct intel_pingroup *grp = &tp->groups[group]; in tng_pinmux_set_mux()
231 if (!tng_buf_available(tp, grp->grp.pins[i])) in tng_pinmux_set_mux()
235 guard(raw_spinlock_irqsave)(&tp->lock); in tng_pinmux_set_mux()
239 tng_update_bufcfg(tp, grp->grp.pins[i], bits, mask); in tng_pinmux_set_mux()
248 struct tng_pinctrl *tp = pinctrl_dev_get_drvdata(pctldev); in tng_gpio_request_enable() local
252 if (!tng_buf_available(tp, pin)) in tng_gpio_request_enable()
255 guard(raw_spinlock_irqsave)(&tp->lock); in tng_gpio_request_enable()
257 tng_update_bufcfg(tp, pin, bits, mask); in tng_gpio_request_enable()
273 struct tng_pinctrl *tp = pinctrl_dev_get_drvdata(pctldev); in tng_config_get() local
279 ret = tng_read_bufcfg(tp, pin, &value); in tng_config_get()
356 static int tng_config_set_pin(struct tng_pinctrl *tp, unsigned int pin, in tng_config_set_pin() argument
433 guard(raw_spinlock_irqsave)(&tp->lock); in tng_config_set_pin()
435 tng_update_bufcfg(tp, pin, value, mask); in tng_config_set_pin()
443 struct tng_pinctrl *tp = pinctrl_dev_get_drvdata(pctldev); in tng_config_set() local
447 if (!tng_buf_available(tp, pin)) in tng_config_set()
458 ret = tng_config_set_pin(tp, pin, configs[i]); in tng_config_set()
526 struct tng_pinctrl *tp; in tng_pinctrl_probe() local
531 tp = devm_kmemdup(dev, data, sizeof(*data), GFP_KERNEL); in tng_pinctrl_probe()
532 if (!tp) 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()
552 for (i = 0; i < tp->nfamilies; i++) { 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()