Lines Matching +full:pin +full:- +full:con +full:- +full:pdn
1 // SPDX-License-Identifier: GPL-2.0+
3 // pin-controller/pin-mux/pin-config/gpio-driver for Samsung's SoC's.
30 #include "pinctrl-samsung.h"
40 { "samsung,pin-pud", PINCFG_TYPE_PUD },
41 { "samsung,pin-drv", PINCFG_TYPE_DRV },
42 { "samsung,pin-con-pdn", PINCFG_TYPE_CON_PDN },
43 { "samsung,pin-pud-pdn", PINCFG_TYPE_PUD_PDN },
44 { "samsung,pin-val", PINCFG_TYPE_DAT },
53 return pmx->nr_groups; in samsung_get_group_count()
61 return pmx->pin_groups[group].name; in samsung_get_group_name()
71 *pins = pmx->pin_groups[group].pins; in samsung_get_group_pins()
72 *num_pins = pmx->pin_groups[group].num_pins; in samsung_get_group_pins()
90 return -ENOMEM; in reserve_map()
92 memset(new_map + old_num, 0, (new_num - old_num) * sizeof(*new_map)); in reserve_map()
105 return -ENOSPC; in add_map_mux()
123 return -ENOSPC; in add_map_configs()
128 return -ENOMEM; in add_map_configs()
149 return -ENOMEM; in add_config()
189 ret = of_property_read_u32(np, "samsung,pin-function", &val); in samsung_dt_subnode_to_map()
201 } else if (ret != -EINVAL) { in samsung_dt_subnode_to_map()
226 num_maps, group, np->full_name); in samsung_dt_subnode_to_map()
264 return samsung_dt_subnode_to_map(drvdata, pctldev->dev, in samsung_dt_node_to_map()
270 ret = samsung_dt_subnode_to_map(drvdata, pctldev->dev, np, map, in samsung_dt_node_to_map()
284 static int samsung_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin,
286 static const char * const reg_names[] = {"CON", "DAT", "PUD", "DRV", "CON_PDN",
290 struct seq_file *s, unsigned int pin) in samsung_pin_dbg_show() argument
298 ret = samsung_pinconf_get(pctldev, pin, &config); in samsung_pin_dbg_show()
320 /* check if the selector is a valid pin function selector */
326 return drvdata->nr_functions; in samsung_get_functions_count()
329 /* return the name of the pin function specified */
336 return drvdata->pmx_functions[selector].name; in samsung_pinmux_get_fname()
347 *groups = drvdata->pmx_functions[selector].groups; in samsung_pinmux_get_groups()
348 *num_groups = drvdata->pmx_functions[selector].num_groups; in samsung_pinmux_get_groups()
353 * given a pin number that is local to a pin controller, find out the pin bank
354 * and the register base of the pin bank.
357 unsigned pin, void __iomem **reg, u32 *offset, in pin_to_reg_bank() argument
362 b = drvdata->pin_banks; in pin_to_reg_bank()
364 while ((pin >= b->pin_base) && in pin_to_reg_bank()
365 ((b->pin_base + b->nr_pins - 1) < pin)) in pin_to_reg_bank()
368 *reg = b->pctl_base + b->pctl_offset; in pin_to_reg_bank()
369 *offset = pin - b->pin_base; in pin_to_reg_bank()
388 func = &drvdata->pmx_functions[selector]; in samsung_pinmux_setup()
389 grp = &drvdata->pin_groups[group]; in samsung_pinmux_setup()
391 pin_to_reg_bank(drvdata, grp->pins[0] - drvdata->pin_base, in samsung_pinmux_setup()
393 type = bank->type; in samsung_pinmux_setup()
394 mask = (1 << type->fld_width[PINCFG_TYPE_FUNC]) - 1; in samsung_pinmux_setup()
395 shift = pin_offset * type->fld_width[PINCFG_TYPE_FUNC]; in samsung_pinmux_setup()
398 shift -= 32; in samsung_pinmux_setup()
402 raw_spin_lock_irqsave(&bank->slock, flags); in samsung_pinmux_setup()
404 data = readl(reg + type->reg_offset[PINCFG_TYPE_FUNC]); in samsung_pinmux_setup()
406 data |= func->val << shift; in samsung_pinmux_setup()
407 writel(data, reg + type->reg_offset[PINCFG_TYPE_FUNC]); in samsung_pinmux_setup()
409 raw_spin_unlock_irqrestore(&bank->slock, flags); in samsung_pinmux_setup()
429 /* set or get the pin config settings for a specified pin */
430 static int samsung_pinconf_rw(struct pinctrl_dev *pctldev, unsigned int pin, in samsung_pinconf_rw() argument
443 pin_to_reg_bank(drvdata, pin - drvdata->pin_base, ®_base, in samsung_pinconf_rw()
445 type = bank->type; in samsung_pinconf_rw()
447 if (cfg_type >= PINCFG_TYPE_NUM || !type->fld_width[cfg_type]) in samsung_pinconf_rw()
448 return -EINVAL; in samsung_pinconf_rw()
450 width = type->fld_width[cfg_type]; in samsung_pinconf_rw()
451 cfg_reg = type->reg_offset[cfg_type]; in samsung_pinconf_rw()
453 raw_spin_lock_irqsave(&bank->slock, flags); in samsung_pinconf_rw()
455 mask = (1 << width) - 1; in samsung_pinconf_rw()
470 raw_spin_unlock_irqrestore(&bank->slock, flags); in samsung_pinconf_rw()
475 /* set the pin config settings for a specified pin */
476 static int samsung_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin, in samsung_pinconf_set() argument
482 ret = samsung_pinconf_rw(pctldev, pin, &configs[i], true); in samsung_pinconf_set()
490 /* get the pin config settings for a specified pin */
491 static int samsung_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin, in samsung_pinconf_get() argument
494 return samsung_pinconf_rw(pctldev, pin, config, false); in samsung_pinconf_get()
497 /* set the pin config settings for a specified pin group */
507 pins = drvdata->pin_groups[group].pins; in samsung_pinconf_group_set()
509 for (cnt = 0; cnt < drvdata->pin_groups[group].num_pins; cnt++) in samsung_pinconf_group_set()
515 /* get the pin config settings for a specified pin group */
523 pins = drvdata->pin_groups[group].pins; in samsung_pinconf_group_get()
537 * The samsung_gpio_set_vlaue() should be called with "bank->slock" held
544 const struct samsung_pin_bank_type *type = bank->type; in samsung_gpio_set_value()
548 reg = bank->pctl_base + bank->pctl_offset; in samsung_gpio_set_value()
550 data = readl(reg + type->reg_offset[PINCFG_TYPE_DAT]); in samsung_gpio_set_value()
554 writel(data, reg + type->reg_offset[PINCFG_TYPE_DAT]); in samsung_gpio_set_value()
563 raw_spin_lock_irqsave(&bank->slock, flags); in samsung_gpio_set()
565 raw_spin_unlock_irqrestore(&bank->slock, flags); in samsung_gpio_set()
574 const struct samsung_pin_bank_type *type = bank->type; in samsung_gpio_get()
576 reg = bank->pctl_base + bank->pctl_offset; in samsung_gpio_get()
578 data = readl(reg + type->reg_offset[PINCFG_TYPE_DAT]); in samsung_gpio_get()
585 * The samsung_gpio_set_direction() should be called with "bank->slock" held
599 type = bank->type; in samsung_gpio_set_direction()
601 reg = bank->pctl_base + bank->pctl_offset in samsung_gpio_set_direction()
602 + type->reg_offset[PINCFG_TYPE_FUNC]; in samsung_gpio_set_direction()
604 mask = (1 << type->fld_width[PINCFG_TYPE_FUNC]) - 1; in samsung_gpio_set_direction()
605 shift = offset * type->fld_width[PINCFG_TYPE_FUNC]; in samsung_gpio_set_direction()
608 shift -= 32; in samsung_gpio_set_direction()
628 raw_spin_lock_irqsave(&bank->slock, flags); in samsung_gpio_direction_input()
630 raw_spin_unlock_irqrestore(&bank->slock, flags); in samsung_gpio_direction_input()
642 raw_spin_lock_irqsave(&bank->slock, flags); in samsung_gpio_direction_output()
645 raw_spin_unlock_irqrestore(&bank->slock, flags); in samsung_gpio_direction_output()
651 * gpiolib gpio_to_irq callback function. Creates a mapping between a GPIO pin
659 if (!bank->irq_domain) in samsung_gpio_to_irq()
660 return -ENXIO; in samsung_gpio_to_irq()
662 virq = irq_create_mapping(bank->irq_domain, offset); in samsung_gpio_to_irq()
664 return (virq) ? : -ENXIO; in samsung_gpio_to_irq()
672 struct pinctrl_desc *ctrldesc = &drvdata->pctl; in samsung_pinctrl_create_groups()
677 groups = devm_kcalloc(dev, ctrldesc->npins, sizeof(*groups), in samsung_pinctrl_create_groups()
680 return ERR_PTR(-EINVAL); in samsung_pinctrl_create_groups()
683 pdesc = ctrldesc->pins; in samsung_pinctrl_create_groups()
684 for (i = 0; i < ctrldesc->npins; ++i, ++pdesc, ++grp) { in samsung_pinctrl_create_groups()
685 grp->name = pdesc->name; in samsung_pinctrl_create_groups()
686 grp->pins = &pdesc->number; in samsung_pinctrl_create_groups()
687 grp->num_pins = 1; in samsung_pinctrl_create_groups()
690 *cnt = ctrldesc->npins; in samsung_pinctrl_create_groups()
703 if (of_property_read_u32(func_np, "samsung,pin-function", &func->val)) in samsung_pinctrl_create_function()
708 dev_err(dev, "invalid pin list in %pOFn node", func_np); in samsung_pinctrl_create_function()
709 return -EINVAL; in samsung_pinctrl_create_function()
712 func->name = func_np->full_name; in samsung_pinctrl_create_function()
714 func->groups = devm_kcalloc(dev, npins, sizeof(char *), GFP_KERNEL); in samsung_pinctrl_create_function()
715 if (!func->groups) in samsung_pinctrl_create_function()
716 return -ENOMEM; in samsung_pinctrl_create_function()
725 "failed to read pin name %d from %pOFn node\n", in samsung_pinctrl_create_function()
730 func->groups[i] = gname; in samsung_pinctrl_create_function()
733 func->num_groups = npins; in samsung_pinctrl_create_function()
743 struct device_node *dev_np = dev->of_node; in samsung_pinctrl_create_functions()
749 * Iterate over all the child nodes of the pin controller node in samsung_pinctrl_create_functions()
750 * and create pin groups and pin function lists. in samsung_pinctrl_create_functions()
757 "samsung,pin-function", NULL)) in samsung_pinctrl_create_functions()
765 "samsung,pin-function", NULL)) in samsung_pinctrl_create_functions()
774 return ERR_PTR(-ENOMEM); in samsung_pinctrl_create_functions()
778 * Iterate over all the child nodes of the pin controller node in samsung_pinctrl_create_functions()
779 * and create pin groups and pin function lists. in samsung_pinctrl_create_functions()
819 * Parse the information about all the available pin groups and pin functions
820 * from device node of the pin-controller. A pin group is formed with all
827 struct device *dev = &pdev->dev; in samsung_pinctrl_parse_dt()
834 dev_err(dev, "failed to parse pin groups\n"); in samsung_pinctrl_parse_dt()
840 dev_err(dev, "failed to parse pin functions\n"); in samsung_pinctrl_parse_dt()
844 drvdata->pin_groups = groups; in samsung_pinctrl_parse_dt()
845 drvdata->nr_groups = grp_cnt; in samsung_pinctrl_parse_dt()
846 drvdata->pmx_functions = functions; in samsung_pinctrl_parse_dt()
847 drvdata->nr_functions = func_cnt; in samsung_pinctrl_parse_dt()
856 struct pinctrl_desc *ctrldesc = &drvdata->pctl; in samsung_pinctrl_register()
860 int pin, bank, ret; in samsung_pinctrl_register() local
862 ctrldesc->name = "samsung-pinctrl"; in samsung_pinctrl_register()
863 ctrldesc->owner = THIS_MODULE; in samsung_pinctrl_register()
864 ctrldesc->pctlops = &samsung_pctrl_ops; in samsung_pinctrl_register()
865 ctrldesc->pmxops = &samsung_pinmux_ops; in samsung_pinctrl_register()
866 ctrldesc->confops = &samsung_pinconf_ops; in samsung_pinctrl_register()
868 pindesc = devm_kcalloc(&pdev->dev, in samsung_pinctrl_register()
869 drvdata->nr_pins, sizeof(*pindesc), in samsung_pinctrl_register()
872 return -ENOMEM; in samsung_pinctrl_register()
873 ctrldesc->pins = pindesc; in samsung_pinctrl_register()
874 ctrldesc->npins = drvdata->nr_pins; in samsung_pinctrl_register()
876 /* dynamically populate the pin number and pin name for pindesc */ in samsung_pinctrl_register()
877 for (pin = 0, pdesc = pindesc; pin < ctrldesc->npins; pin++, pdesc++) in samsung_pinctrl_register()
878 pdesc->number = pin + drvdata->pin_base; in samsung_pinctrl_register()
882 * the pins which belong to this pin-controller. in samsung_pinctrl_register()
884 pin_names = devm_kzalloc(&pdev->dev, in samsung_pinctrl_register()
886 drvdata->nr_pins), in samsung_pinctrl_register()
889 return -ENOMEM; in samsung_pinctrl_register()
891 /* for each pin, the name of the pin is pin-bank name + pin number */ in samsung_pinctrl_register()
892 for (bank = 0; bank < drvdata->nr_banks; bank++) { in samsung_pinctrl_register()
893 pin_bank = &drvdata->pin_banks[bank]; in samsung_pinctrl_register()
894 for (pin = 0; pin < pin_bank->nr_pins; pin++) { in samsung_pinctrl_register()
895 sprintf(pin_names, "%s-%d", pin_bank->name, pin); in samsung_pinctrl_register()
896 pdesc = pindesc + pin_bank->pin_base + pin; in samsung_pinctrl_register()
897 pdesc->name = pin_names; in samsung_pinctrl_register()
906 drvdata->pctl_dev = devm_pinctrl_register(&pdev->dev, ctrldesc, in samsung_pinctrl_register()
908 if (IS_ERR(drvdata->pctl_dev)) { in samsung_pinctrl_register()
909 dev_err(&pdev->dev, "could not register pinctrl driver\n"); in samsung_pinctrl_register()
910 return PTR_ERR(drvdata->pctl_dev); in samsung_pinctrl_register()
913 for (bank = 0; bank < drvdata->nr_banks; ++bank) { in samsung_pinctrl_register()
914 pin_bank = &drvdata->pin_banks[bank]; in samsung_pinctrl_register()
915 pin_bank->grange.name = pin_bank->name; in samsung_pinctrl_register()
916 pin_bank->grange.id = bank; in samsung_pinctrl_register()
917 pin_bank->grange.pin_base = drvdata->pin_base in samsung_pinctrl_register()
918 + pin_bank->pin_base; in samsung_pinctrl_register()
919 pin_bank->grange.base = pin_bank->grange.pin_base; in samsung_pinctrl_register()
920 pin_bank->grange.npins = pin_bank->nr_pins; in samsung_pinctrl_register()
921 pin_bank->grange.gc = &pin_bank->gpio_chip; in samsung_pinctrl_register()
922 pinctrl_add_gpio_range(drvdata->pctl_dev, &pin_bank->grange); in samsung_pinctrl_register()
932 struct samsung_pin_bank *bank = drvdata->pin_banks; in samsung_pinctrl_unregister()
935 for (i = 0; i < drvdata->nr_banks; ++i, ++bank) in samsung_pinctrl_unregister()
936 pinctrl_remove_gpio_range(drvdata->pctl_dev, &bank->grange); in samsung_pinctrl_unregister()
956 struct samsung_pin_bank *bank = drvdata->pin_banks; in samsung_gpiolib_register()
961 for (i = 0; i < drvdata->nr_banks; ++i, ++bank) { in samsung_gpiolib_register()
962 bank->gpio_chip = samsung_gpiolib_chip; in samsung_gpiolib_register()
964 gc = &bank->gpio_chip; in samsung_gpiolib_register()
965 gc->base = bank->grange.base; in samsung_gpiolib_register()
966 gc->ngpio = bank->nr_pins; in samsung_gpiolib_register()
967 gc->parent = &pdev->dev; in samsung_gpiolib_register()
968 gc->fwnode = bank->fwnode; in samsung_gpiolib_register()
969 gc->label = bank->name; in samsung_gpiolib_register()
971 ret = devm_gpiochip_add_data(&pdev->dev, gc, bank); in samsung_gpiolib_register()
973 dev_err(&pdev->dev, "failed to register gpio_chip %s, error code: %d\n", in samsung_gpiolib_register()
974 gc->label, ret); in samsung_gpiolib_register()
985 struct device_node *node = pdev->dev.of_node; in samsung_pinctrl_get_soc_data_for_of_alias()
991 dev_err(&pdev->dev, "failed to get alias id\n"); in samsung_pinctrl_get_soc_data_for_of_alias()
995 of_data = of_device_get_match_data(&pdev->dev); in samsung_pinctrl_get_soc_data_for_of_alias()
996 if (id >= of_data->num_ctrl) { in samsung_pinctrl_get_soc_data_for_of_alias()
997 dev_err(&pdev->dev, "invalid alias id %d\n", id); in samsung_pinctrl_get_soc_data_for_of_alias()
1001 return &(of_data->ctrl[id]); in samsung_pinctrl_get_soc_data_for_of_alias()
1009 bank = d->pin_banks; in samsung_banks_node_put()
1010 for (i = 0; i < d->nr_banks; ++i, ++bank) in samsung_banks_node_put()
1011 fwnode_handle_put(bank->fwnode); in samsung_banks_node_put()
1015 * Iterate over all driver pin banks to find one matching the name of node,
1016 * skipping optional "-gpio" node suffix. When found, assign node to the bank.
1020 const char *suffix = "-gpio-bank"; in samsung_banks_node_get()
1023 /* Pin bank names are up to 4 characters */ in samsung_banks_node_get()
1028 bank = d->pin_banks; in samsung_banks_node_get()
1029 for (i = 0; i < d->nr_banks; ++i, ++bank) { in samsung_banks_node_get()
1030 strscpy(node_name, bank->name, sizeof(node_name)); in samsung_banks_node_get()
1033 dev_err(dev, "Too long pin bank name '%s', ignoring\n", in samsung_banks_node_get()
1034 bank->name); in samsung_banks_node_get()
1043 if (of_node_name_eq(np, bank->name)) in samsung_banks_node_get()
1048 bank->fwnode = child; in samsung_banks_node_get()
1050 dev_warn(dev, "Missing node for bank %s - invalid DTB\n", in samsung_banks_node_get()
1051 bank->name); in samsung_banks_node_get()
1070 return ERR_PTR(-ENOENT); in samsung_pinctrl_get_soc_data()
1072 d->suspend = ctrl->suspend; in samsung_pinctrl_get_soc_data()
1073 d->resume = ctrl->resume; in samsung_pinctrl_get_soc_data()
1074 d->nr_banks = ctrl->nr_banks; in samsung_pinctrl_get_soc_data()
1075 d->pin_banks = devm_kcalloc(&pdev->dev, d->nr_banks, in samsung_pinctrl_get_soc_data()
1076 sizeof(*d->pin_banks), GFP_KERNEL); in samsung_pinctrl_get_soc_data()
1077 if (!d->pin_banks) in samsung_pinctrl_get_soc_data()
1078 return ERR_PTR(-ENOMEM); in samsung_pinctrl_get_soc_data()
1080 if (ctrl->nr_ext_resources + 1 > SAMSUNG_PINCTRL_NUM_RESOURCES) in samsung_pinctrl_get_soc_data()
1081 return ERR_PTR(-EINVAL); in samsung_pinctrl_get_soc_data()
1083 for (i = 0; i < ctrl->nr_ext_resources + 1; i++) { in samsung_pinctrl_get_soc_data()
1086 dev_err(&pdev->dev, "failed to get mem%d resource\n", i); in samsung_pinctrl_get_soc_data()
1087 return ERR_PTR(-EINVAL); in samsung_pinctrl_get_soc_data()
1089 virt_base[i] = devm_ioremap(&pdev->dev, res->start, in samsung_pinctrl_get_soc_data()
1092 dev_err(&pdev->dev, "failed to ioremap %pR\n", res); in samsung_pinctrl_get_soc_data()
1093 return ERR_PTR(-EIO); in samsung_pinctrl_get_soc_data()
1097 bank = d->pin_banks; in samsung_pinctrl_get_soc_data()
1098 bdata = ctrl->pin_banks; in samsung_pinctrl_get_soc_data()
1099 for (i = 0; i < ctrl->nr_banks; ++i, ++bdata, ++bank) { in samsung_pinctrl_get_soc_data()
1100 bank->type = bdata->type; in samsung_pinctrl_get_soc_data()
1101 bank->pctl_offset = bdata->pctl_offset; in samsung_pinctrl_get_soc_data()
1102 bank->nr_pins = bdata->nr_pins; in samsung_pinctrl_get_soc_data()
1103 bank->eint_func = bdata->eint_func; in samsung_pinctrl_get_soc_data()
1104 bank->eint_type = bdata->eint_type; in samsung_pinctrl_get_soc_data()
1105 bank->eint_mask = bdata->eint_mask; in samsung_pinctrl_get_soc_data()
1106 bank->eint_offset = bdata->eint_offset; in samsung_pinctrl_get_soc_data()
1107 bank->name = bdata->name; in samsung_pinctrl_get_soc_data()
1109 raw_spin_lock_init(&bank->slock); in samsung_pinctrl_get_soc_data()
1110 bank->drvdata = d; in samsung_pinctrl_get_soc_data()
1111 bank->pin_base = d->nr_pins; in samsung_pinctrl_get_soc_data()
1112 d->nr_pins += bank->nr_pins; in samsung_pinctrl_get_soc_data()
1114 bank->eint_base = virt_base[0]; in samsung_pinctrl_get_soc_data()
1115 bank->pctl_base = virt_base[bdata->pctl_res_idx]; in samsung_pinctrl_get_soc_data()
1122 d->virt_base = virt_base[0]; in samsung_pinctrl_get_soc_data()
1124 samsung_banks_node_get(&pdev->dev, d); in samsung_pinctrl_get_soc_data()
1126 d->pin_base = pin_base; in samsung_pinctrl_get_soc_data()
1127 pin_base += d->nr_pins; in samsung_pinctrl_get_soc_data()
1136 struct device *dev = &pdev->dev; in samsung_pinctrl_probe()
1141 return -ENOMEM; in samsung_pinctrl_probe()
1145 dev_err(&pdev->dev, "driver data not available\n"); in samsung_pinctrl_probe()
1148 drvdata->dev = dev; in samsung_pinctrl_probe()
1151 if (ret < 0 && ret != -ENXIO) in samsung_pinctrl_probe()
1154 drvdata->irq = ret; in samsung_pinctrl_probe()
1156 if (ctrl->retention_data) { in samsung_pinctrl_probe()
1157 drvdata->retention_ctrl = ctrl->retention_data->init(drvdata, in samsung_pinctrl_probe()
1158 ctrl->retention_data); in samsung_pinctrl_probe()
1159 if (IS_ERR(drvdata->retention_ctrl)) { in samsung_pinctrl_probe()
1160 ret = PTR_ERR(drvdata->retention_ctrl); in samsung_pinctrl_probe()
1169 if (ctrl->eint_gpio_init) in samsung_pinctrl_probe()
1170 ctrl->eint_gpio_init(drvdata); in samsung_pinctrl_probe()
1171 if (ctrl->eint_wkup_init) in samsung_pinctrl_probe()
1172 ctrl->eint_wkup_init(drvdata); in samsung_pinctrl_probe()
1190 * samsung_pinctrl_suspend - save pinctrl state for suspend
1199 for (i = 0; i < drvdata->nr_banks; i++) { in samsung_pinctrl_suspend()
1200 struct samsung_pin_bank *bank = &drvdata->pin_banks[i]; in samsung_pinctrl_suspend()
1201 void __iomem *reg = bank->pctl_base + bank->pctl_offset; in samsung_pinctrl_suspend()
1202 const u8 *offs = bank->type->reg_offset; in samsung_pinctrl_suspend()
1203 const u8 *widths = bank->type->fld_width; in samsung_pinctrl_suspend()
1212 bank->pm_save[type] = readl(reg + offs[type]); in samsung_pinctrl_suspend()
1214 if (widths[PINCFG_TYPE_FUNC] * bank->nr_pins > 32) { in samsung_pinctrl_suspend()
1216 bank->pm_save[PINCFG_TYPE_NUM] = in samsung_pinctrl_suspend()
1218 pr_debug("Save %s @ %p (con %#010x %08x)\n", in samsung_pinctrl_suspend()
1219 bank->name, reg, in samsung_pinctrl_suspend()
1220 bank->pm_save[PINCFG_TYPE_FUNC], in samsung_pinctrl_suspend()
1221 bank->pm_save[PINCFG_TYPE_NUM]); in samsung_pinctrl_suspend()
1223 pr_debug("Save %s @ %p (con %#010x)\n", bank->name, in samsung_pinctrl_suspend()
1224 reg, bank->pm_save[PINCFG_TYPE_FUNC]); in samsung_pinctrl_suspend()
1228 if (drvdata->suspend) in samsung_pinctrl_suspend()
1229 drvdata->suspend(drvdata); in samsung_pinctrl_suspend()
1230 if (drvdata->retention_ctrl && drvdata->retention_ctrl->enable) in samsung_pinctrl_suspend()
1231 drvdata->retention_ctrl->enable(drvdata); in samsung_pinctrl_suspend()
1237 * samsung_pinctrl_resume - restore pinctrl state from suspend
1249 if (drvdata->resume) in samsung_pinctrl_resume()
1250 drvdata->resume(drvdata); in samsung_pinctrl_resume()
1252 for (i = 0; i < drvdata->nr_banks; i++) { in samsung_pinctrl_resume()
1253 struct samsung_pin_bank *bank = &drvdata->pin_banks[i]; in samsung_pinctrl_resume()
1254 void __iomem *reg = bank->pctl_base + bank->pctl_offset; in samsung_pinctrl_resume()
1255 const u8 *offs = bank->type->reg_offset; in samsung_pinctrl_resume()
1256 const u8 *widths = bank->type->fld_width; in samsung_pinctrl_resume()
1263 if (widths[PINCFG_TYPE_FUNC] * bank->nr_pins > 32) { in samsung_pinctrl_resume()
1265 pr_debug("%s @ %p (con %#010x %08x => %#010x %08x)\n", in samsung_pinctrl_resume()
1266 bank->name, reg, in samsung_pinctrl_resume()
1269 bank->pm_save[PINCFG_TYPE_FUNC], in samsung_pinctrl_resume()
1270 bank->pm_save[PINCFG_TYPE_NUM]); in samsung_pinctrl_resume()
1271 writel(bank->pm_save[PINCFG_TYPE_NUM], in samsung_pinctrl_resume()
1274 pr_debug("%s @ %p (con %#010x => %#010x)\n", bank->name, in samsung_pinctrl_resume()
1276 bank->pm_save[PINCFG_TYPE_FUNC]); in samsung_pinctrl_resume()
1280 writel(bank->pm_save[type], reg + offs[type]); in samsung_pinctrl_resume()
1283 if (drvdata->retention_ctrl && drvdata->retention_ctrl->disable) in samsung_pinctrl_resume()
1284 drvdata->retention_ctrl->disable(drvdata); in samsung_pinctrl_resume()
1291 { .compatible = "samsung,exynos3250-pinctrl",
1293 { .compatible = "samsung,exynos4210-pinctrl",
1295 { .compatible = "samsung,exynos4x12-pinctrl",
1297 { .compatible = "samsung,exynos5250-pinctrl",
1299 { .compatible = "samsung,exynos5260-pinctrl",
1301 { .compatible = "samsung,exynos5410-pinctrl",
1303 { .compatible = "samsung,exynos5420-pinctrl",
1305 { .compatible = "samsung,s5pv210-pinctrl",
1309 { .compatible = "samsung,exynos5433-pinctrl",
1311 { .compatible = "samsung,exynos7-pinctrl",
1313 { .compatible = "samsung,exynos7885-pinctrl",
1315 { .compatible = "samsung,exynos850-pinctrl",
1317 { .compatible = "samsung,exynosautov9-pinctrl",
1319 { .compatible = "tesla,fsd-pinctrl",
1323 { .compatible = "samsung,s3c64xx-pinctrl",
1327 { .compatible = "samsung,s3c2412-pinctrl",
1329 { .compatible = "samsung,s3c2416-pinctrl",
1331 { .compatible = "samsung,s3c2440-pinctrl",
1333 { .compatible = "samsung,s3c2450-pinctrl",
1347 .name = "samsung-pinctrl",