Lines Matching +full:pctl +full:- +full:regmap

1 // SPDX-License-Identifier: GPL-2.0-only
2 // Copyright (C) 2013-2017 Broadcom
12 #include <linux/pinctrl/pinconf-generic.h>
13 #include <linux/regmap.h>
16 #include "../pinctrl-utils.h"
53 * bcm281xx_pin_type - types of pin register
67 * bcm281xx_pin_function- define pin function
76 * bcm281xx_pinctrl_data - Broadcom-specific pinctrl data
77 * @reg_base - base of pinctrl registers
89 struct regmap *regmap; member
918 /* Every pin can implement all ALT1-ALT4 functions */
945 if (pin >= pdata->npins) in pin_type_get()
948 return *(enum bcm281xx_pin_type *)(pdata->pins[pin].drv_data); in pin_type_get()
981 return pdata->npins; in bcm281xx_pinctrl_get_groups_count()
989 return pdata->pins[group].name; in bcm281xx_pinctrl_get_group_name()
999 *pins = &pdata->pins[group].number; in bcm281xx_pinctrl_get_group_pins()
1009 seq_printf(s, " %s", dev_name(pctldev->dev)); in bcm281xx_pinctrl_pin_dbg_show()
1025 return pdata->nfunctions; in bcm281xx_pinctrl_get_fcns_count()
1033 return pdata->functions[function].name; in bcm281xx_pinctrl_get_fcn_name()
1043 *groups = pdata->functions[function].groups; in bcm281xx_pinctrl_get_fcn_groups()
1044 *num_groups = pdata->functions[function].ngroups; in bcm281xx_pinctrl_get_fcn_groups()
1054 const struct bcm281xx_pin_function *f = &pdata->functions[function]; in bcm281xx_pinmux_set()
1055 u32 offset = 4 * pdata->pins[group].number; in bcm281xx_pinmux_set()
1058 dev_dbg(pctldev->dev, in bcm281xx_pinmux_set()
1060 __func__, f->name, function, pdata->pins[group].name, in bcm281xx_pinmux_set()
1061 pdata->pins[group].number, offset); in bcm281xx_pinmux_set()
1063 rc = regmap_update_bits(pdata->regmap, offset, in bcm281xx_pinmux_set()
1067 dev_err(pctldev->dev, in bcm281xx_pinmux_set()
1069 pdata->pins[group].name, pdata->pins[group].number); in bcm281xx_pinmux_set()
1085 return -ENOTSUPP; in bcm281xx_pinctrl_pin_config_get()
1114 * The pin bias can only be one of pull-up, pull-down, or in bcm281xx_std_pin_update()
1116 * property, and the default value from pinconf-generic is in bcm281xx_std_pin_update()
1162 /* Valid range is 2-16 mA, even numbers only */ in bcm281xx_std_pin_update()
1164 dev_err(pctldev->dev, in bcm281xx_std_pin_update()
1168 arg, pdata->pins[pin].name, pin); in bcm281xx_std_pin_update()
1169 return -EINVAL; in bcm281xx_std_pin_update()
1171 bcm281xx_pin_update(val, mask, (arg/2)-1, in bcm281xx_std_pin_update()
1177 dev_err(pctldev->dev, in bcm281xx_std_pin_update()
1179 param, pdata->pins[pin].name, pin); in bcm281xx_std_pin_update()
1180 return -EINVAL; in bcm281xx_std_pin_update()
1189 * The pull-up strength for an I2C pin is represented by bits 4-6 in the
1191 * 0b000: No pull-up
1199 * This array maps pull-up strength in Ohms to register values (1+index).
1229 dev_err(pctldev->dev, in bcm281xx_i2c_pin_update()
1230 "Invalid pull-up value (%d) for pin %s " in bcm281xx_i2c_pin_update()
1233 arg, pdata->pins[pin].name, pin); in bcm281xx_i2c_pin_update()
1234 return -EINVAL; in bcm281xx_i2c_pin_update()
1264 dev_err(pctldev->dev, in bcm281xx_i2c_pin_update()
1266 param, pdata->pins[pin].name, pin); in bcm281xx_i2c_pin_update()
1267 return -EINVAL; in bcm281xx_i2c_pin_update()
1309 dev_err(pctldev->dev, in bcm281xx_hdmi_pin_update()
1311 param, pdata->pins[pin].name, pin); in bcm281xx_hdmi_pin_update()
1312 return -EINVAL; in bcm281xx_hdmi_pin_update()
1353 dev_err(pctldev->dev, "Unknown pin type for pin %s (%d).\n", in bcm281xx_pinctrl_pin_config_set()
1354 pdata->pins[pin].name, pin); in bcm281xx_pinctrl_pin_config_set()
1355 return -EINVAL; in bcm281xx_pinctrl_pin_config_set()
1362 dev_dbg(pctldev->dev, in bcm281xx_pinctrl_pin_config_set()
1364 __func__, pdata->pins[pin].name, pin, cfg_val, cfg_mask); in bcm281xx_pinctrl_pin_config_set()
1366 rc = regmap_update_bits(pdata->regmap, offset, cfg_mask, cfg_val); in bcm281xx_pinctrl_pin_config_set()
1368 dev_err(pctldev->dev, in bcm281xx_pinctrl_pin_config_set()
1370 pdata->pins[pin].name, pin); in bcm281xx_pinctrl_pin_config_set()
1393 struct pinctrl_dev *pctl; in bcm281xx_pinctrl_probe() local
1396 pdata->reg_base = devm_platform_ioremap_resource(pdev, 0); in bcm281xx_pinctrl_probe()
1397 if (IS_ERR(pdata->reg_base)) { in bcm281xx_pinctrl_probe()
1398 dev_err(&pdev->dev, "Failed to ioremap MEM resource\n"); in bcm281xx_pinctrl_probe()
1399 return PTR_ERR(pdata->reg_base); in bcm281xx_pinctrl_probe()
1403 pdata->regmap = devm_regmap_init_mmio(&pdev->dev, pdata->reg_base, in bcm281xx_pinctrl_probe()
1405 if (IS_ERR(pdata->regmap)) { in bcm281xx_pinctrl_probe()
1406 dev_err(&pdev->dev, "Regmap MMIO init failed.\n"); in bcm281xx_pinctrl_probe()
1407 return -ENODEV; in bcm281xx_pinctrl_probe()
1410 bcm281xx_pinctrl_desc.name = dev_name(&pdev->dev); in bcm281xx_pinctrl_probe()
1414 pctl = devm_pinctrl_register(&pdev->dev, &bcm281xx_pinctrl_desc, pdata); in bcm281xx_pinctrl_probe()
1415 if (IS_ERR(pctl)) { in bcm281xx_pinctrl_probe()
1416 dev_err(&pdev->dev, "Failed to register pinctrl\n"); in bcm281xx_pinctrl_probe()
1417 return PTR_ERR(pctl); in bcm281xx_pinctrl_probe()
1426 { .compatible = "brcm,bcm11351-pinctrl", },
1432 .name = "bcm281xx-pinctrl",