Lines Matching +full:gp +full:- +full:pwm2

1 // SPDX-License-Identifier: GPL-2.0
16 #include <linux/pinctrl/pinconf-generic.h>
20 #include "pinctrl-intel.h"
57 * struct mrfld_family - Intel pin family description
76 .npins = (e) - (s) + 1, \
83 .npins = (e) - (s) + 1, \
173 /* Family 6: GP SSP (22 pins) */
386 FUNCTION("pwm2", mrfld_pwm2_groups),
409 * struct mrfld_pinctrl - Intel Merrifield pinctrl private structure
440 #define pin_to_bufno(f, p) ((p) - (f)->pin_base)
448 for (i = 0; i < mp->nfamilies; i++) { in mrfld_get_family()
449 family = &mp->families[i]; in mrfld_get_family()
450 if (pin >= family->pin_base && in mrfld_get_family()
451 pin < family->pin_base + family->npins) in mrfld_get_family()
455 dev_warn(mp->dev, "failed to find family for pin %u\n", pin); in mrfld_get_family()
467 return !family->protected; in mrfld_buf_available()
480 return family->regs + BUFCFG_OFFSET + bufno * 4; in mrfld_get_bufcfg()
488 return -EBUSY; in mrfld_read_bufcfg()
515 return mp->ngroups; in mrfld_get_groups_count()
523 return mp->groups[group].grp.name; in mrfld_get_group_name()
531 *pins = mp->groups[group].grp.pins; in mrfld_get_group_pins()
532 *npins = mp->groups[group].grp.npins; in mrfld_get_group_pins()
569 return mp->nfunctions; in mrfld_get_functions_count()
577 return mp->functions[function].name; in mrfld_get_function_name()
587 *groups = mp->functions[function].groups; in mrfld_get_function_groups()
588 *ngroups = mp->functions[function].ngroups; in mrfld_get_function_groups()
597 const struct intel_pingroup *grp = &mp->groups[group]; in mrfld_pinmux_set_mux()
598 u32 bits = grp->mode << BUFCFG_PINMODE_SHIFT; in mrfld_pinmux_set_mux()
607 for (i = 0; i < grp->grp.npins; i++) { in mrfld_pinmux_set_mux()
608 if (!mrfld_buf_available(mp, grp->grp.pins[i])) in mrfld_pinmux_set_mux()
609 return -EBUSY; in mrfld_pinmux_set_mux()
613 raw_spin_lock_irqsave(&mp->lock, flags); in mrfld_pinmux_set_mux()
614 for (i = 0; i < grp->grp.npins; i++) in mrfld_pinmux_set_mux()
615 mrfld_update_bufcfg(mp, grp->grp.pins[i], bits, mask); in mrfld_pinmux_set_mux()
616 raw_spin_unlock_irqrestore(&mp->lock, flags); in mrfld_pinmux_set_mux()
631 return -EBUSY; in mrfld_gpio_request_enable()
633 raw_spin_lock_irqsave(&mp->lock, flags); in mrfld_gpio_request_enable()
635 raw_spin_unlock_irqrestore(&mp->lock, flags); in mrfld_gpio_request_enable()
659 return -ENOTSUPP; in mrfld_config_get()
666 return -EINVAL; in mrfld_config_get()
671 return -EINVAL; in mrfld_config_get()
692 return -EINVAL; in mrfld_config_get()
713 return -EINVAL; in mrfld_config_get()
724 return -ENOTSUPP; in mrfld_config_get()
763 return -EINVAL; in mrfld_config_set_pin()
787 return -EINVAL; in mrfld_config_set_pin()
805 raw_spin_lock_irqsave(&mp->lock, flags); in mrfld_config_set_pin()
807 raw_spin_unlock_irqrestore(&mp->lock, flags); in mrfld_config_set_pin()
820 return -ENOTSUPP; in mrfld_config_set()
835 return -ENOTSUPP; in mrfld_config_set()
904 mp = devm_kzalloc(&pdev->dev, sizeof(*mp), GFP_KERNEL); in mrfld_pinctrl_probe()
906 return -ENOMEM; in mrfld_pinctrl_probe()
908 mp->dev = &pdev->dev; in mrfld_pinctrl_probe()
909 raw_spin_lock_init(&mp->lock); in mrfld_pinctrl_probe()
920 families = devm_kmemdup(&pdev->dev, mrfld_families, in mrfld_pinctrl_probe()
924 return -ENOMEM; in mrfld_pinctrl_probe()
930 family->regs = regs + family->barno * MRFLD_FAMILY_LEN; in mrfld_pinctrl_probe()
933 mp->families = families; in mrfld_pinctrl_probe()
934 mp->nfamilies = nfamilies; in mrfld_pinctrl_probe()
935 mp->functions = mrfld_functions; in mrfld_pinctrl_probe()
936 mp->nfunctions = ARRAY_SIZE(mrfld_functions); in mrfld_pinctrl_probe()
937 mp->groups = mrfld_groups; in mrfld_pinctrl_probe()
938 mp->ngroups = ARRAY_SIZE(mrfld_groups); in mrfld_pinctrl_probe()
939 mp->pctldesc = mrfld_pinctrl_desc; in mrfld_pinctrl_probe()
940 mp->pctldesc.name = dev_name(&pdev->dev); in mrfld_pinctrl_probe()
941 mp->pctldesc.pins = mrfld_pins; in mrfld_pinctrl_probe()
942 mp->pctldesc.npins = ARRAY_SIZE(mrfld_pins); in mrfld_pinctrl_probe()
944 mp->pctldev = devm_pinctrl_register(&pdev->dev, &mp->pctldesc, mp); in mrfld_pinctrl_probe()
945 if (IS_ERR(mp->pctldev)) { in mrfld_pinctrl_probe()
946 dev_err(&pdev->dev, "failed to register pinctrl driver\n"); in mrfld_pinctrl_probe()
947 return PTR_ERR(mp->pctldev); in mrfld_pinctrl_probe()
963 .name = "pinctrl-merrifield",
983 MODULE_ALIAS("platform:pinctrl-merrifield");