Lines Matching refs:tpc

513 	struct thunderbay_pinctrl *tpc = gpiochip_get_data(chip);  in thb_gpio_read_reg()  local
515 return readl(tpc->base0 + THB_GPIO_REG_OFFSET(pinnr)); in thb_gpio_read_reg()
520 struct thunderbay_pinctrl *tpc = gpiochip_get_data(chip); in thb_gpio_write_reg() local
522 writel(value, (tpc->base0 + THB_GPIO_REG_OFFSET(pinnr))); in thb_gpio_write_reg()
620 static int thunderbay_gpiochip_probe(struct thunderbay_pinctrl *tpc) in thunderbay_gpiochip_probe() argument
622 struct gpio_chip *chip = &tpc->chip; in thunderbay_gpiochip_probe()
625 chip->label = dev_name(tpc->dev); in thunderbay_gpiochip_probe()
626 chip->parent = tpc->dev; in thunderbay_gpiochip_probe()
645 ret = gpiochip_add_data(chip, tpc); in thunderbay_gpiochip_probe()
647 dev_err(tpc->dev, "Failed to add gpiochip\n"); in thunderbay_gpiochip_probe()
655 struct thunderbay_pinctrl *tpc = pinctrl_dev_get_drvdata(pctldev); in thunderbay_request_gpio() local
656 struct gpio_chip *chip = &tpc->chip; in thunderbay_request_gpio()
677 struct thunderbay_pinctrl *tpc = pinctrl_dev_get_drvdata(pctldev); in thunderbay_free_gpio() local
678 struct gpio_chip *chip = &tpc->chip; in thunderbay_free_gpio()
700 struct thunderbay_pinctrl *tpc = pinctrl_dev_get_drvdata(pctldev); in thb_pinctrl_set_mux() local
701 struct gpio_chip *chip = &tpc->chip; in thb_pinctrl_set_mux()
751 static int thunderbay_build_groups(struct thunderbay_pinctrl *tpc) in thunderbay_build_groups() argument
756 tpc->ngroups = tpc->soc->npins; in thunderbay_build_groups()
757 thunderbay_groups = devm_kcalloc(tpc->dev, tpc->ngroups, in thunderbay_build_groups()
762 for (i = 0; i < tpc->ngroups; i++) { in thunderbay_build_groups()
768 pinctrl_generic_add_group(tpc->pctrl, group->name, in thunderbay_build_groups()
774 static int thunderbay_add_functions(struct thunderbay_pinctrl *tpc, struct function_desc *funcs) in thunderbay_add_functions() argument
779 for (i = 0; i < tpc->nfuncs; i++) { in thunderbay_add_functions()
785 group_names = devm_kcalloc(tpc->dev, func->num_group_names, in thunderbay_add_functions()
790 for (j = 0; j < tpc->soc->npins; j++) { in thunderbay_add_functions()
804 for (i = 0; i < tpc->nfuncs; i++) { in thunderbay_add_functions()
805 pinmux_generic_add_function(tpc->pctrl, in thunderbay_add_functions()
815 static int thunderbay_build_functions(struct thunderbay_pinctrl *tpc) in thunderbay_build_functions() argument
825 tpc->nfuncs = 0; in thunderbay_build_functions()
826 thunderbay_funcs = kcalloc(tpc->soc->npins * 8, in thunderbay_build_functions()
832 for (pin = 0; pin < tpc->soc->npins; pin++) { in thunderbay_build_functions()
851 tpc->nfuncs++; in thunderbay_build_functions()
858 tpc->nfuncs * sizeof(*thunderbay_funcs), GFP_KERNEL); in thunderbay_build_functions()
863 return thunderbay_add_functions(tpc, thunderbay_funcs); in thunderbay_build_functions()
866 static int thunderbay_pinconf_set_tristate(struct thunderbay_pinctrl *tpc, in thunderbay_pinconf_set_tristate() argument
869 struct gpio_chip *chip = &tpc->chip; in thunderbay_pinconf_set_tristate()
881 static int thunderbay_pinconf_get_tristate(struct thunderbay_pinctrl *tpc, in thunderbay_pinconf_get_tristate() argument
884 struct gpio_chip *chip = &tpc->chip; in thunderbay_pinconf_get_tristate()
893 static int thunderbay_pinconf_set_pulldown(struct thunderbay_pinctrl *tpc, in thunderbay_pinconf_set_pulldown() argument
896 struct gpio_chip *chip = &tpc->chip; in thunderbay_pinconf_set_pulldown()
908 static int thunderbay_pinconf_get_pulldown(struct thunderbay_pinctrl *tpc, in thunderbay_pinconf_get_pulldown() argument
911 struct gpio_chip *chip = &tpc->chip; in thunderbay_pinconf_get_pulldown()
920 static int thunderbay_pinconf_set_pullup(struct thunderbay_pinctrl *tpc, in thunderbay_pinconf_set_pullup() argument
923 struct gpio_chip *chip = &tpc->chip; in thunderbay_pinconf_set_pullup()
935 static int thunderbay_pinconf_get_pullup(struct thunderbay_pinctrl *tpc, in thunderbay_pinconf_get_pullup() argument
938 struct gpio_chip *chip = &tpc->chip; in thunderbay_pinconf_get_pullup()
947 static int thunderbay_pinconf_set_opendrain(struct thunderbay_pinctrl *tpc, in thunderbay_pinconf_set_opendrain() argument
950 struct gpio_chip *chip = &tpc->chip; in thunderbay_pinconf_set_opendrain()
962 static int thunderbay_pinconf_get_opendrain(struct thunderbay_pinctrl *tpc, in thunderbay_pinconf_get_opendrain() argument
965 struct gpio_chip *chip = &tpc->chip; in thunderbay_pinconf_get_opendrain()
974 static int thunderbay_pinconf_set_pushpull(struct thunderbay_pinctrl *tpc, in thunderbay_pinconf_set_pushpull() argument
977 struct gpio_chip *chip = &tpc->chip; in thunderbay_pinconf_set_pushpull()
989 static int thunderbay_pinconf_get_pushpull(struct thunderbay_pinctrl *tpc, in thunderbay_pinconf_get_pushpull() argument
992 struct gpio_chip *chip = &tpc->chip; in thunderbay_pinconf_get_pushpull()
1001 static int thunderbay_pinconf_set_drivestrength(struct thunderbay_pinctrl *tpc, in thunderbay_pinconf_set_drivestrength() argument
1004 struct gpio_chip *chip = &tpc->chip; in thunderbay_pinconf_set_drivestrength()
1018 static int thunderbay_pinconf_get_drivestrength(struct thunderbay_pinctrl *tpc, in thunderbay_pinconf_get_drivestrength() argument
1021 struct gpio_chip *chip = &tpc->chip; in thunderbay_pinconf_get_drivestrength()
1031 static int thunderbay_pinconf_set_schmitt(struct thunderbay_pinctrl *tpc, in thunderbay_pinconf_set_schmitt() argument
1034 struct gpio_chip *chip = &tpc->chip; in thunderbay_pinconf_set_schmitt()
1046 static int thunderbay_pinconf_get_schmitt(struct thunderbay_pinctrl *tpc, in thunderbay_pinconf_get_schmitt() argument
1049 struct gpio_chip *chip = &tpc->chip; in thunderbay_pinconf_get_schmitt()
1058 static int thunderbay_pinconf_set_slew_rate(struct thunderbay_pinctrl *tpc, in thunderbay_pinconf_set_slew_rate() argument
1061 struct gpio_chip *chip = &tpc->chip; in thunderbay_pinconf_set_slew_rate()
1073 static int thunderbay_pinconf_get_slew_rate(struct thunderbay_pinctrl *tpc, in thunderbay_pinconf_get_slew_rate() argument
1076 struct gpio_chip *chip = &tpc->chip; in thunderbay_pinconf_get_slew_rate()
1088 struct thunderbay_pinctrl *tpc = pinctrl_dev_get_drvdata(pctldev); in thunderbay_pinconf_get() local
1095 ret = thunderbay_pinconf_get_tristate(tpc, pin, &arg); in thunderbay_pinconf_get()
1099 ret = thunderbay_pinconf_get_pulldown(tpc, pin, &arg); in thunderbay_pinconf_get()
1103 ret = thunderbay_pinconf_get_pullup(tpc, pin, &arg); in thunderbay_pinconf_get()
1107 ret = thunderbay_pinconf_get_opendrain(tpc, pin, &arg); in thunderbay_pinconf_get()
1111 ret = thunderbay_pinconf_get_pushpull(tpc, pin, &arg); in thunderbay_pinconf_get()
1115 ret = thunderbay_pinconf_get_drivestrength(tpc, pin, &arg); in thunderbay_pinconf_get()
1119 ret = thunderbay_pinconf_get_schmitt(tpc, pin, &arg); in thunderbay_pinconf_get()
1123 ret = thunderbay_pinconf_get_slew_rate(tpc, pin, &arg); in thunderbay_pinconf_get()
1138 struct thunderbay_pinctrl *tpc = pinctrl_dev_get_drvdata(pctldev); in thunderbay_pinconf_set() local
1150 ret = thunderbay_pinconf_set_tristate(tpc, pin, arg); in thunderbay_pinconf_set()
1154 ret = thunderbay_pinconf_set_pulldown(tpc, pin, arg); in thunderbay_pinconf_set()
1158 ret = thunderbay_pinconf_set_pullup(tpc, pin, arg); in thunderbay_pinconf_set()
1162 ret = thunderbay_pinconf_set_opendrain(tpc, pin, arg); in thunderbay_pinconf_set()
1166 ret = thunderbay_pinconf_set_pushpull(tpc, pin, arg); in thunderbay_pinconf_set()
1170 ret = thunderbay_pinconf_set_drivestrength(tpc, pin, arg); in thunderbay_pinconf_set()
1174 ret = thunderbay_pinconf_set_schmitt(tpc, pin, arg); in thunderbay_pinconf_set()
1178 ret = thunderbay_pinconf_set_slew_rate(tpc, pin, arg); in thunderbay_pinconf_set()
1231 struct thunderbay_pinctrl *tpc; in thunderbay_pinctrl_probe() local
1238 tpc = devm_kzalloc(dev, sizeof(*tpc), GFP_KERNEL); in thunderbay_pinctrl_probe()
1239 if (!tpc) in thunderbay_pinctrl_probe()
1242 tpc->dev = dev; in thunderbay_pinctrl_probe()
1243 tpc->soc = of_id->data; in thunderbay_pinctrl_probe()
1245 tpc->base0 = devm_platform_ioremap_resource(pdev, 0); in thunderbay_pinctrl_probe()
1246 if (IS_ERR(tpc->base0)) in thunderbay_pinctrl_probe()
1247 return PTR_ERR(tpc->base0); in thunderbay_pinctrl_probe()
1249 thunderbay_pinctrl_desc.pins = tpc->soc->pins; in thunderbay_pinctrl_probe()
1250 thunderbay_pinctrl_desc.npins = tpc->soc->npins; in thunderbay_pinctrl_probe()
1253 tpc->pctrl = devm_pinctrl_register(dev, &thunderbay_pinctrl_desc, tpc); in thunderbay_pinctrl_probe()
1254 if (IS_ERR(tpc->pctrl)) in thunderbay_pinctrl_probe()
1255 return PTR_ERR(tpc->pctrl); in thunderbay_pinctrl_probe()
1258 ret = thunderbay_build_groups(tpc); in thunderbay_pinctrl_probe()
1263 ret = thunderbay_build_functions(tpc); in thunderbay_pinctrl_probe()
1268 ret = thunderbay_gpiochip_probe(tpc); in thunderbay_pinctrl_probe()
1272 platform_set_drvdata(pdev, tpc); in thunderbay_pinctrl_probe()