Lines Matching full:pctrl
125 static inline void __iomem *spacemit_pin_to_reg(struct spacemit_pinctrl *pctrl, in spacemit_pin_to_reg() argument
128 return pctrl->regs + spacemit_pin_to_offset(pin); in spacemit_pin_to_reg()
141 static const struct spacemit_pin *spacemit_get_pin(struct spacemit_pinctrl *pctrl, in spacemit_get_pin() argument
144 const struct spacemit_pin *pdata = pctrl->data->data; in spacemit_get_pin()
147 for (i = 0; i < pctrl->data->npins; i++) { in spacemit_get_pin()
172 struct spacemit_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in spacemit_pctrl_dbg_show() local
173 const struct spacemit_pin *spin = spacemit_get_pin(pctrl, pin); in spacemit_pctrl_dbg_show()
181 reg = spacemit_pin_to_reg(pctrl, pin); in spacemit_pctrl_dbg_show()
268 struct spacemit_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in spacemit_pctrl_check_power() local
269 struct device *dev = pctrl->dev; in spacemit_pctrl_check_power()
300 struct spacemit_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in spacemit_pctrl_dt_node_to_map() local
301 struct device *dev = pctrl->dev; in spacemit_pctrl_dt_node_to_map()
322 guard(mutex)(&pctrl->mutex); in spacemit_pctrl_dt_node_to_map()
360 pinmuxs[i].pin = spacemit_get_pin(pctrl, pins[i]); in spacemit_pctrl_dt_node_to_map()
421 struct spacemit_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in spacemit_pmx_set_mux() local
437 reg = spacemit_pin_to_reg(pctrl, spin->pin); in spacemit_pmx_set_mux()
440 guard(raw_spinlock_irqsave)(&pctrl->lock); in spacemit_pmx_set_mux()
452 struct spacemit_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in spacemit_request_gpio() local
453 const struct spacemit_pin *spin = spacemit_get_pin(pctrl, pin); in spacemit_request_gpio()
456 reg = spacemit_pin_to_reg(pctrl, pin); in spacemit_request_gpio()
457 guard(raw_spinlock_irqsave)(&pctrl->lock); in spacemit_request_gpio()
475 struct spacemit_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in spacemit_pinconf_get() local
482 value = readl(spacemit_pin_to_reg(pctrl, pin)); in spacemit_pinconf_get()
603 static int spacemit_pin_set_config(struct spacemit_pinctrl *pctrl, in spacemit_pin_set_config() argument
606 const struct spacemit_pin *spin = spacemit_get_pin(pctrl, pin); in spacemit_pin_set_config()
613 reg = spacemit_pin_to_reg(pctrl, spin->pin); in spacemit_pin_set_config()
615 guard(raw_spinlock_irqsave)(&pctrl->lock); in spacemit_pin_set_config()
626 struct spacemit_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in spacemit_pinconf_set() local
627 const struct spacemit_pin *spin = spacemit_get_pin(pctrl, pin); in spacemit_pinconf_set()
633 return spacemit_pin_set_config(pctrl, pin, value); in spacemit_pinconf_set()
641 struct spacemit_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in spacemit_pinconf_group_set() local
651 spin = spacemit_get_pin(pctrl, group->grp.pins[0]); in spacemit_pinconf_group_set()
656 spacemit_pin_set_config(pctrl, group->grp.pins[i], value); in spacemit_pinconf_group_set()
685 struct spacemit_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in spacemit_pinconf_dbg_show() local
686 const struct spacemit_pin *spin = spacemit_get_pin(pctrl, pin); in spacemit_pinconf_dbg_show()
688 void __iomem *reg = spacemit_pin_to_reg(pctrl, pin); in spacemit_pinconf_dbg_show()
722 struct spacemit_pinctrl *pctrl; in spacemit_pinctrl_probe() local
733 pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); in spacemit_pinctrl_probe()
734 if (!pctrl) in spacemit_pinctrl_probe()
737 pctrl->regs = devm_platform_ioremap_resource(pdev, 0); in spacemit_pinctrl_probe()
738 if (IS_ERR(pctrl->regs)) in spacemit_pinctrl_probe()
739 return PTR_ERR(pctrl->regs); in spacemit_pinctrl_probe()
741 pctrl->pdesc.name = dev_name(dev); in spacemit_pinctrl_probe()
742 pctrl->pdesc.pins = pctrl_data->pins; in spacemit_pinctrl_probe()
743 pctrl->pdesc.npins = pctrl_data->npins; in spacemit_pinctrl_probe()
744 pctrl->pdesc.pctlops = &spacemit_pctrl_ops; in spacemit_pinctrl_probe()
745 pctrl->pdesc.pmxops = &spacemit_pmx_ops; in spacemit_pinctrl_probe()
746 pctrl->pdesc.confops = &spacemit_pinconf_ops; in spacemit_pinctrl_probe()
747 pctrl->pdesc.owner = THIS_MODULE; in spacemit_pinctrl_probe()
749 pctrl->data = pctrl_data; in spacemit_pinctrl_probe()
750 pctrl->dev = dev; in spacemit_pinctrl_probe()
751 raw_spin_lock_init(&pctrl->lock); in spacemit_pinctrl_probe()
752 mutex_init(&pctrl->mutex); in spacemit_pinctrl_probe()
754 platform_set_drvdata(pdev, pctrl); in spacemit_pinctrl_probe()
756 ret = devm_pinctrl_register_and_init(dev, &pctrl->pdesc, in spacemit_pinctrl_probe()
757 pctrl, &pctrl->pctl_dev); in spacemit_pinctrl_probe()
762 return pinctrl_enable(pctrl->pctl_dev); in spacemit_pinctrl_probe()