Lines Matching refs:pci
316 struct rk805_pctrl_info *pci = gpiochip_get_data(chip); in rk805_gpio_get() local
319 ret = regmap_read(pci->rk808->regmap, pci->pin_cfg[offset].reg, &val); in rk805_gpio_get()
321 dev_err(pci->dev, "get gpio%d value failed\n", offset); in rk805_gpio_get()
325 return !!(val & pci->pin_cfg[offset].val_msk); in rk805_gpio_get()
332 struct rk805_pctrl_info *pci = gpiochip_get_data(chip); in rk805_gpio_set() local
335 ret = regmap_update_bits(pci->rk808->regmap, in rk805_gpio_set()
336 pci->pin_cfg[offset].reg, in rk805_gpio_set()
337 pci->pin_cfg[offset].val_msk, in rk805_gpio_set()
338 value ? pci->pin_cfg[offset].val_msk : 0); in rk805_gpio_set()
340 dev_err(pci->dev, "set gpio%d value %d failed\n", in rk805_gpio_set()
353 struct rk805_pctrl_info *pci = gpiochip_get_data(chip); in rk805_gpio_get_direction() local
358 if (!pci->pin_cfg[offset].dir_msk) in rk805_gpio_get_direction()
361 ret = regmap_read(pci->rk808->regmap, in rk805_gpio_get_direction()
362 pci->pin_cfg[offset].reg, in rk805_gpio_get_direction()
365 dev_err(pci->dev, "get gpio%d direction failed\n", offset); in rk805_gpio_get_direction()
369 if (val & pci->pin_cfg[offset].dir_msk) in rk805_gpio_get_direction()
392 struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); in rk805_pinctrl_get_groups_count() local
394 return pci->num_pin_groups; in rk805_pinctrl_get_groups_count()
400 struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); in rk805_pinctrl_get_group_name() local
402 return pci->groups[group].name; in rk805_pinctrl_get_group_name()
410 struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); in rk805_pinctrl_get_group_pins() local
412 *pins = pci->groups[group].pins; in rk805_pinctrl_get_group_pins()
413 *num_pins = pci->groups[group].npins; in rk805_pinctrl_get_group_pins()
428 struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); in rk805_pinctrl_get_funcs_count() local
430 return pci->num_functions; in rk805_pinctrl_get_funcs_count()
436 struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); in rk805_pinctrl_get_func_name() local
438 return pci->functions[function].name; in rk805_pinctrl_get_func_name()
446 struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); in rk805_pinctrl_get_func_groups() local
448 *groups = pci->functions[function].groups; in rk805_pinctrl_get_func_groups()
449 *num_groups = pci->functions[function].ngroups; in rk805_pinctrl_get_func_groups()
458 struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); in _rk805_pinctrl_set_mux() local
461 if (!pci->pin_cfg[offset].fun_msk) in _rk805_pinctrl_set_mux()
464 mux <<= ffs(pci->pin_cfg[offset].fun_msk) - 1; in _rk805_pinctrl_set_mux()
465 ret = regmap_update_bits(pci->rk808->regmap, in _rk805_pinctrl_set_mux()
466 pci->pin_cfg[offset].fun_reg, in _rk805_pinctrl_set_mux()
467 pci->pin_cfg[offset].fun_msk, mux); in _rk805_pinctrl_set_mux()
470 dev_err(pci->dev, "set gpio%d func%d failed\n", offset, mux); in _rk805_pinctrl_set_mux()
479 struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); in rk805_pinctrl_set_mux() local
480 int mux = pci->functions[function].mux_option; in rk805_pinctrl_set_mux()
490 struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); in rk805_pinctrl_gpio_request_enable() local
492 switch (pci->rk808->variant) { in rk805_pinctrl_gpio_request_enable()
508 struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); in rk805_pmx_gpio_set_direction() local
512 if (!pci->pin_cfg[offset].dir_msk) in rk805_pmx_gpio_set_direction()
515 ret = regmap_update_bits(pci->rk808->regmap, in rk805_pmx_gpio_set_direction()
516 pci->pin_cfg[offset].reg, in rk805_pmx_gpio_set_direction()
517 pci->pin_cfg[offset].dir_msk, in rk805_pmx_gpio_set_direction()
518 input ? 0 : pci->pin_cfg[offset].dir_msk); in rk805_pmx_gpio_set_direction()
520 dev_err(pci->dev, "set gpio%d direction failed\n", offset); in rk805_pmx_gpio_set_direction()
539 struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); in rk805_pinconf_get() local
546 arg = rk805_gpio_get(&pci->gpio_chip, pin); in rk805_pinconf_get()
549 dev_err(pci->dev, "Properties not supported\n"); in rk805_pinconf_get()
562 struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); in rk805_pinconf_set() local
572 rk805_gpio_set(&pci->gpio_chip, pin, arg); in rk805_pinconf_set()
576 if (pci->rk808->variant != RK805_ID && arg) { in rk805_pinconf_set()
582 dev_err(pci->dev, "Properties not supported\n"); in rk805_pinconf_set()
605 struct rk805_pctrl_info *pci; in rk805_pinctrl_probe() local
610 pci = devm_kzalloc(&pdev->dev, sizeof(*pci), GFP_KERNEL); in rk805_pinctrl_probe()
611 if (!pci) in rk805_pinctrl_probe()
614 pci->dev = &pdev->dev; in rk805_pinctrl_probe()
615 pci->rk808 = dev_get_drvdata(pdev->dev.parent); in rk805_pinctrl_probe()
617 pci->pinctrl_desc = rk805_pinctrl_desc; in rk805_pinctrl_probe()
618 pci->gpio_chip = rk805_gpio_chip; in rk805_pinctrl_probe()
619 pci->gpio_chip.parent = &pdev->dev; in rk805_pinctrl_probe()
621 platform_set_drvdata(pdev, pci); in rk805_pinctrl_probe()
623 switch (pci->rk808->variant) { in rk805_pinctrl_probe()
625 pci->pins = rk805_pins_desc; in rk805_pinctrl_probe()
626 pci->num_pins = ARRAY_SIZE(rk805_pins_desc); in rk805_pinctrl_probe()
627 pci->functions = rk805_pin_functions; in rk805_pinctrl_probe()
628 pci->num_functions = ARRAY_SIZE(rk805_pin_functions); in rk805_pinctrl_probe()
629 pci->groups = rk805_pin_groups; in rk805_pinctrl_probe()
630 pci->num_pin_groups = ARRAY_SIZE(rk805_pin_groups); in rk805_pinctrl_probe()
631 pci->pinctrl_desc.pins = rk805_pins_desc; in rk805_pinctrl_probe()
632 pci->pinctrl_desc.npins = ARRAY_SIZE(rk805_pins_desc); in rk805_pinctrl_probe()
633 pci->pin_cfg = rk805_gpio_cfgs; in rk805_pinctrl_probe()
634 pci->gpio_chip.ngpio = ARRAY_SIZE(rk805_gpio_cfgs); in rk805_pinctrl_probe()
637 pci->pins = rk806_pins_desc; in rk805_pinctrl_probe()
638 pci->num_pins = ARRAY_SIZE(rk806_pins_desc); in rk805_pinctrl_probe()
639 pci->functions = rk806_pin_functions; in rk805_pinctrl_probe()
640 pci->num_functions = ARRAY_SIZE(rk806_pin_functions); in rk805_pinctrl_probe()
641 pci->groups = rk806_pin_groups; in rk805_pinctrl_probe()
642 pci->num_pin_groups = ARRAY_SIZE(rk806_pin_groups); in rk805_pinctrl_probe()
643 pci->pinctrl_desc.pins = rk806_pins_desc; in rk805_pinctrl_probe()
644 pci->pinctrl_desc.npins = ARRAY_SIZE(rk806_pins_desc); in rk805_pinctrl_probe()
645 pci->pin_cfg = rk806_gpio_cfgs; in rk805_pinctrl_probe()
646 pci->gpio_chip.ngpio = ARRAY_SIZE(rk806_gpio_cfgs); in rk805_pinctrl_probe()
649 pci->pins = rk816_pins_desc; in rk805_pinctrl_probe()
650 pci->num_pins = ARRAY_SIZE(rk816_pins_desc); in rk805_pinctrl_probe()
651 pci->functions = rk816_pin_functions; in rk805_pinctrl_probe()
652 pci->num_functions = ARRAY_SIZE(rk816_pin_functions); in rk805_pinctrl_probe()
653 pci->groups = rk816_pin_groups; in rk805_pinctrl_probe()
654 pci->num_pin_groups = ARRAY_SIZE(rk816_pin_groups); in rk805_pinctrl_probe()
655 pci->pinctrl_desc.pins = rk816_pins_desc; in rk805_pinctrl_probe()
656 pci->pinctrl_desc.npins = ARRAY_SIZE(rk816_pins_desc); in rk805_pinctrl_probe()
657 pci->pin_cfg = rk816_gpio_cfgs; in rk805_pinctrl_probe()
658 pci->gpio_chip.ngpio = ARRAY_SIZE(rk816_gpio_cfgs); in rk805_pinctrl_probe()
662 pci->rk808->variant); in rk805_pinctrl_probe()
667 ret = devm_gpiochip_add_data(&pdev->dev, &pci->gpio_chip, pci); in rk805_pinctrl_probe()
674 pci->pctl = devm_pinctrl_register(&pdev->dev, &pci->pinctrl_desc, pci); in rk805_pinctrl_probe()
675 if (IS_ERR(pci->pctl)) { in rk805_pinctrl_probe()
677 return PTR_ERR(pci->pctl); in rk805_pinctrl_probe()
681 ret = gpiochip_add_pin_range(&pci->gpio_chip, dev_name(&pdev->dev), in rk805_pinctrl_probe()
682 0, 0, pci->gpio_chip.ngpio); in rk805_pinctrl_probe()