Lines Matching refs:tp

67 static const struct tng_family *tng_get_family(struct tng_pinctrl *tp,  in tng_get_family()  argument
73 for (i = 0; i < tp->nfamilies; i++) { in tng_get_family()
74 family = &tp->families[i]; in tng_get_family()
80 dev_warn(tp->dev, "failed to find family for pin %u\n", pin); in tng_get_family()
84 static bool tng_buf_available(struct tng_pinctrl *tp, unsigned int pin) in tng_buf_available() argument
88 family = tng_get_family(tp, pin); in tng_buf_available()
95 static void __iomem *tng_get_bufcfg(struct tng_pinctrl *tp, unsigned int pin) in tng_get_bufcfg() argument
100 family = tng_get_family(tp, pin); in tng_get_bufcfg()
108 static int tng_read_bufcfg(struct tng_pinctrl *tp, unsigned int pin, u32 *value) in tng_read_bufcfg() argument
112 if (!tng_buf_available(tp, pin)) in tng_read_bufcfg()
115 bufcfg = tng_get_bufcfg(tp, pin); in tng_read_bufcfg()
121 static void tng_update_bufcfg(struct tng_pinctrl *tp, unsigned int pin, in tng_update_bufcfg() argument
127 bufcfg = tng_get_bufcfg(tp, pin); in tng_update_bufcfg()
136 struct tng_pinctrl *tp = pinctrl_dev_get_drvdata(pctldev); in tng_get_groups_count() local
138 return tp->ngroups; in tng_get_groups_count()
144 struct tng_pinctrl *tp = pinctrl_dev_get_drvdata(pctldev); in tng_get_group_name() local
146 return tp->groups[group].grp.name; in tng_get_group_name()
152 struct tng_pinctrl *tp = pinctrl_dev_get_drvdata(pctldev); in tng_get_group_pins() local
154 *pins = tp->groups[group].grp.pins; in tng_get_group_pins()
155 *npins = tp->groups[group].grp.npins; in tng_get_group_pins()
162 struct tng_pinctrl *tp = pinctrl_dev_get_drvdata(pctldev); in tng_pin_dbg_show() local
166 ret = tng_read_bufcfg(tp, pin, &value); in tng_pin_dbg_show()
190 struct tng_pinctrl *tp = pinctrl_dev_get_drvdata(pctldev); in tng_get_functions_count() local
192 return tp->nfunctions; in tng_get_functions_count()
198 struct tng_pinctrl *tp = pinctrl_dev_get_drvdata(pctldev); in tng_get_function_name() local
200 return tp->functions[function].func.name; in tng_get_function_name()
208 struct tng_pinctrl *tp = pinctrl_dev_get_drvdata(pctldev); in tng_get_function_groups() local
210 *groups = tp->functions[function].func.groups; in tng_get_function_groups()
211 *ngroups = tp->functions[function].func.ngroups; in tng_get_function_groups()
219 struct tng_pinctrl *tp = pinctrl_dev_get_drvdata(pctldev); in tng_pinmux_set_mux() local
220 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()
236 raw_spin_lock_irqsave(&tp->lock, flags); 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()
248 struct tng_pinctrl *tp = pinctrl_dev_get_drvdata(pctldev); in tng_gpio_request_enable() local
253 if (!tng_buf_available(tp, pin)) in tng_gpio_request_enable()
256 raw_spin_lock_irqsave(&tp->lock, flags); in tng_gpio_request_enable()
257 tng_update_bufcfg(tp, pin, bits, mask); in tng_gpio_request_enable()
258 raw_spin_unlock_irqrestore(&tp->lock, flags); in tng_gpio_request_enable()
274 struct tng_pinctrl *tp = pinctrl_dev_get_drvdata(pctldev); in tng_config_get() local
280 ret = tng_read_bufcfg(tp, pin, &value); in tng_config_get()
357 static int tng_config_set_pin(struct tng_pinctrl *tp, unsigned int pin, in tng_config_set_pin() argument
435 raw_spin_lock_irqsave(&tp->lock, flags); in tng_config_set_pin()
436 tng_update_bufcfg(tp, pin, value, mask); in tng_config_set_pin()
437 raw_spin_unlock_irqrestore(&tp->lock, flags); in tng_config_set_pin()
445 struct tng_pinctrl *tp = pinctrl_dev_get_drvdata(pctldev); in tng_config_set() local
449 if (!tng_buf_available(tp, pin)) in tng_config_set()
460 ret = tng_config_set_pin(tp, pin, configs[i]); in tng_config_set()
528 struct tng_pinctrl *tp; in tng_pinctrl_probe() local
533 tp = devm_kmemdup(dev, data, sizeof(*data), GFP_KERNEL); in tng_pinctrl_probe()
534 if (!tp) 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()
554 for (i = 0; i < tp->nfamilies; i++) { 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()