Lines Matching full:pctrl
91 struct pinctrl_dev *pctrl; member
127 static int pm8xxx_read_bank(struct pm8xxx_gpio *pctrl, in pm8xxx_read_bank() argument
133 ret = regmap_write(pctrl->regmap, pin->reg, val); in pm8xxx_read_bank()
135 dev_err(pctrl->dev, "failed to select bank %d\n", bank); in pm8xxx_read_bank()
139 ret = regmap_read(pctrl->regmap, pin->reg, &val); in pm8xxx_read_bank()
141 dev_err(pctrl->dev, "failed to read register %d\n", bank); in pm8xxx_read_bank()
148 static int pm8xxx_write_bank(struct pm8xxx_gpio *pctrl, in pm8xxx_write_bank() argument
158 ret = regmap_write(pctrl->regmap, pin->reg, val); in pm8xxx_write_bank()
160 dev_err(pctrl->dev, "failed to write register\n"); in pm8xxx_write_bank()
167 struct pm8xxx_gpio *pctrl = pinctrl_dev_get_drvdata(pctldev); in pm8xxx_get_groups_count() local
169 return pctrl->npins; in pm8xxx_get_groups_count()
184 struct pm8xxx_gpio *pctrl = pinctrl_dev_get_drvdata(pctldev); in pm8xxx_get_group_pins() local
186 *pins = &pctrl->desc.pins[group].number; in pm8xxx_get_group_pins()
216 struct pm8xxx_gpio *pctrl = pinctrl_dev_get_drvdata(pctldev); in pm8xxx_get_function_groups() local
219 *num_groups = pctrl->npins; in pm8xxx_get_function_groups()
227 struct pm8xxx_gpio *pctrl = pinctrl_dev_get_drvdata(pctldev); in pm8xxx_pinmux_set_mux() local
228 struct pm8xxx_pin_data *pin = pctrl->desc.pins[group].drv_data; in pm8xxx_pinmux_set_mux()
234 pm8xxx_write_bank(pctrl, pin, 4, val); in pm8xxx_pinmux_set_mux()
250 struct pm8xxx_gpio *pctrl = pinctrl_dev_get_drvdata(pctldev); in pm8xxx_pin_config_get() local
251 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_pin_config_get()
320 struct pm8xxx_gpio *pctrl = pinctrl_dev_get_drvdata(pctldev); in pm8xxx_pin_config_set() local
321 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_pin_config_set()
347 dev_err(pctrl->dev, "invalid pull-up strength\n"); in pm8xxx_pin_config_set()
377 dev_err(pctrl->dev, "invalid drive strength\n"); in pm8xxx_pin_config_set()
392 dev_err(pctrl->dev, in pm8xxx_pin_config_set()
402 pm8xxx_write_bank(pctrl, pin, 0, val); in pm8xxx_pin_config_set()
409 pm8xxx_write_bank(pctrl, pin, 1, val); in pm8xxx_pin_config_set()
414 pm8xxx_write_bank(pctrl, pin, 2, val); in pm8xxx_pin_config_set()
420 pm8xxx_write_bank(pctrl, pin, 3, val); in pm8xxx_pin_config_set()
425 pm8xxx_write_bank(pctrl, pin, 4, val); in pm8xxx_pin_config_set()
432 pm8xxx_write_bank(pctrl, pin, 5, val); in pm8xxx_pin_config_set()
455 struct pm8xxx_gpio *pctrl = gpiochip_get_data(chip); in pm8xxx_gpio_direction_input() local
456 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_gpio_direction_input()
462 pm8xxx_write_bank(pctrl, pin, 1, val); in pm8xxx_gpio_direction_input()
471 struct pm8xxx_gpio *pctrl = gpiochip_get_data(chip); in pm8xxx_gpio_direction_output() local
472 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_gpio_direction_output()
482 pm8xxx_write_bank(pctrl, pin, 1, val); in pm8xxx_gpio_direction_output()
489 struct pm8xxx_gpio *pctrl = gpiochip_get_data(chip); in pm8xxx_gpio_get() local
490 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_gpio_get()
511 struct pm8xxx_gpio *pctrl = gpiochip_get_data(chip); in pm8xxx_gpio_set() local
512 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_gpio_set()
521 pm8xxx_write_bank(pctrl, pin, 1, val); in pm8xxx_gpio_set()
546 struct pm8xxx_gpio *pctrl = gpiochip_get_data(chip); in pm8xxx_gpio_dbg_show_one() local
547 struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; in pm8xxx_gpio_dbg_show_one()
604 static int pm8xxx_pin_populate(struct pm8xxx_gpio *pctrl, in pm8xxx_pin_populate() argument
609 val = pm8xxx_read_bank(pctrl, pin, 0); in pm8xxx_pin_populate()
615 val = pm8xxx_read_bank(pctrl, pin, 1); in pm8xxx_pin_populate()
623 val = pm8xxx_read_bank(pctrl, pin, 2); in pm8xxx_pin_populate()
633 val = pm8xxx_read_bank(pctrl, pin, 3); in pm8xxx_pin_populate()
640 val = pm8xxx_read_bank(pctrl, pin, 4); in pm8xxx_pin_populate()
646 val = pm8xxx_read_bank(pctrl, pin, 5); in pm8xxx_pin_populate()
686 struct pm8xxx_gpio *pctrl = container_of(domain->host_data, in pm8xxx_domain_translate() local
690 fwspec->param[0] > pctrl->chip.ngpio) in pm8xxx_domain_translate()
734 struct pm8xxx_gpio *pctrl; in pm8xxx_gpio_probe() local
737 pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); in pm8xxx_gpio_probe()
738 if (!pctrl) in pm8xxx_gpio_probe()
741 pctrl->dev = &pdev->dev; in pm8xxx_gpio_probe()
742 pctrl->npins = (uintptr_t) device_get_match_data(&pdev->dev); in pm8xxx_gpio_probe()
744 pctrl->regmap = dev_get_regmap(pdev->dev.parent, NULL); in pm8xxx_gpio_probe()
745 if (!pctrl->regmap) { in pm8xxx_gpio_probe()
750 pctrl->desc = pm8xxx_pinctrl_desc; in pm8xxx_gpio_probe()
751 pctrl->desc.npins = pctrl->npins; in pm8xxx_gpio_probe()
754 pctrl->desc.npins, in pm8xxx_gpio_probe()
761 pctrl->desc.npins, in pm8xxx_gpio_probe()
767 for (i = 0; i < pctrl->desc.npins; i++) { in pm8xxx_gpio_probe()
770 ret = pm8xxx_pin_populate(pctrl, &pin_data[i]); in pm8xxx_gpio_probe()
778 pctrl->desc.pins = pins; in pm8xxx_gpio_probe()
780 pctrl->desc.num_custom_params = ARRAY_SIZE(pm8xxx_gpio_bindings); in pm8xxx_gpio_probe()
781 pctrl->desc.custom_params = pm8xxx_gpio_bindings; in pm8xxx_gpio_probe()
783 pctrl->desc.custom_conf_items = pm8xxx_conf_items; in pm8xxx_gpio_probe()
786 pctrl->pctrl = devm_pinctrl_register(&pdev->dev, &pctrl->desc, pctrl); in pm8xxx_gpio_probe()
787 if (IS_ERR(pctrl->pctrl)) { in pm8xxx_gpio_probe()
789 return PTR_ERR(pctrl->pctrl); in pm8xxx_gpio_probe()
792 pctrl->chip = pm8xxx_gpio_template; in pm8xxx_gpio_probe()
793 pctrl->chip.base = -1; in pm8xxx_gpio_probe()
794 pctrl->chip.parent = &pdev->dev; in pm8xxx_gpio_probe()
795 pctrl->chip.of_gpio_n_cells = 2; in pm8xxx_gpio_probe()
796 pctrl->chip.label = dev_name(pctrl->dev); in pm8xxx_gpio_probe()
797 pctrl->chip.ngpio = pctrl->npins; in pm8xxx_gpio_probe()
799 parent_node = of_irq_find_parent(pctrl->dev->of_node); in pm8xxx_gpio_probe()
808 girq = &pctrl->chip.irq; in pm8xxx_gpio_probe()
812 girq->fwnode = dev_fwnode(pctrl->dev); in pm8xxx_gpio_probe()
819 ret = gpiochip_add_data(&pctrl->chip, pctrl); in pm8xxx_gpio_probe()
835 if (!of_property_read_bool(pctrl->dev->of_node, "gpio-ranges")) { in pm8xxx_gpio_probe()
836 ret = gpiochip_add_pin_range(&pctrl->chip, dev_name(pctrl->dev), in pm8xxx_gpio_probe()
837 0, 0, pctrl->chip.ngpio); in pm8xxx_gpio_probe()
839 dev_err(pctrl->dev, "failed to add pin range\n"); in pm8xxx_gpio_probe()
844 platform_set_drvdata(pdev, pctrl); in pm8xxx_gpio_probe()
851 gpiochip_remove(&pctrl->chip); in pm8xxx_gpio_probe()
858 struct pm8xxx_gpio *pctrl = platform_get_drvdata(pdev); in pm8xxx_gpio_remove() local
860 gpiochip_remove(&pctrl->chip); in pm8xxx_gpio_remove()