Lines Matching +full:driver +full:- +full:strength +full:- +full:ohm

1 // SPDX-License-Identifier: GPL-2.0-only
2 // Copyright (C) 2013-2017 Broadcom
13 #include <linux/pinctrl/pinconf-generic.h>
19 #include "../pinctrl-utils.h"
56 * bcm281xx_pin_type - types of pin register
70 * bcm281xx_pin_function- define pin function
79 * bcm281xx_pinctrl_data - Broadcom-specific pinctrl data
80 * @reg_base - base of pinctrl registers
921 /* Every pin can implement all ALT1-ALT4 functions */
948 if (pin >= pdata->npins) in pin_type_get()
951 return *(enum bcm281xx_pin_type *)(pdata->pins[pin].drv_data); in pin_type_get()
984 return pdata->npins; in bcm281xx_pinctrl_get_groups_count()
992 return pdata->pins[group].name; in bcm281xx_pinctrl_get_group_name()
1002 *pins = &pdata->pins[group].number; in bcm281xx_pinctrl_get_group_pins()
1012 seq_printf(s, " %s", dev_name(pctldev->dev)); in bcm281xx_pinctrl_pin_dbg_show()
1028 return pdata->nfunctions; in bcm281xx_pinctrl_get_fcns_count()
1036 return pdata->functions[function].name; in bcm281xx_pinctrl_get_fcn_name()
1046 *groups = pdata->functions[function].groups; in bcm281xx_pinctrl_get_fcn_groups()
1047 *num_groups = pdata->functions[function].ngroups; in bcm281xx_pinctrl_get_fcn_groups()
1057 const struct bcm281xx_pin_function *f = &pdata->functions[function]; in bcm281xx_pinmux_set()
1058 u32 offset = 4 * pdata->pins[group].number; in bcm281xx_pinmux_set()
1061 dev_dbg(pctldev->dev, in bcm281xx_pinmux_set()
1063 __func__, f->name, function, pdata->pins[group].name, in bcm281xx_pinmux_set()
1064 pdata->pins[group].number, offset); in bcm281xx_pinmux_set()
1066 rc = regmap_update_bits(pdata->regmap, offset, in bcm281xx_pinmux_set()
1070 dev_err(pctldev->dev, in bcm281xx_pinmux_set()
1072 pdata->pins[group].name, pdata->pins[group].number); in bcm281xx_pinmux_set()
1088 return -ENOTSUPP; in bcm281xx_pinctrl_pin_config_get()
1117 * The pin bias can only be one of pull-up, pull-down, or in bcm281xx_std_pin_update()
1119 * property, and the default value from pinconf-generic is in bcm281xx_std_pin_update()
1165 /* Valid range is 2-16 mA, even numbers only */ in bcm281xx_std_pin_update()
1167 dev_err(pctldev->dev, in bcm281xx_std_pin_update()
1168 "Invalid Drive Strength value (%d) for " in bcm281xx_std_pin_update()
1171 arg, pdata->pins[pin].name, pin); in bcm281xx_std_pin_update()
1172 return -EINVAL; in bcm281xx_std_pin_update()
1174 bcm281xx_pin_update(val, mask, (arg/2)-1, in bcm281xx_std_pin_update()
1180 dev_err(pctldev->dev, in bcm281xx_std_pin_update()
1182 param, pdata->pins[pin].name, pin); in bcm281xx_std_pin_update()
1183 return -EINVAL; in bcm281xx_std_pin_update()
1192 * The pull-up strength for an I2C pin is represented by bits 4-6 in the
1194 * 0b000: No pull-up
1195 * 0b001: 1200 Ohm
1196 * 0b010: 1800 Ohm
1197 * 0b011: 720 Ohm
1198 * 0b100: 2700 Ohm
1199 * 0b101: 831 Ohm
1200 * 0b110: 1080 Ohm
1201 * 0b111: 568 Ohm
1202 * This array maps pull-up strength in Ohms to register values (1+index).
1232 dev_err(pctldev->dev, in bcm281xx_i2c_pin_update()
1233 "Invalid pull-up value (%d) for pin %s " in bcm281xx_i2c_pin_update()
1236 arg, pdata->pins[pin].name, pin); in bcm281xx_i2c_pin_update()
1237 return -EINVAL; in bcm281xx_i2c_pin_update()
1267 dev_err(pctldev->dev, in bcm281xx_i2c_pin_update()
1269 param, pdata->pins[pin].name, pin); in bcm281xx_i2c_pin_update()
1270 return -EINVAL; in bcm281xx_i2c_pin_update()
1312 dev_err(pctldev->dev, in bcm281xx_hdmi_pin_update()
1314 param, pdata->pins[pin].name, pin); in bcm281xx_hdmi_pin_update()
1315 return -EINVAL; in bcm281xx_hdmi_pin_update()
1356 dev_err(pctldev->dev, "Unknown pin type for pin %s (%d).\n", in bcm281xx_pinctrl_pin_config_set()
1357 pdata->pins[pin].name, pin); in bcm281xx_pinctrl_pin_config_set()
1358 return -EINVAL; in bcm281xx_pinctrl_pin_config_set()
1365 dev_dbg(pctldev->dev, in bcm281xx_pinctrl_pin_config_set()
1367 __func__, pdata->pins[pin].name, pin, cfg_val, cfg_mask); in bcm281xx_pinctrl_pin_config_set()
1369 rc = regmap_update_bits(pdata->regmap, offset, cfg_mask, cfg_val); in bcm281xx_pinctrl_pin_config_set()
1371 dev_err(pctldev->dev, in bcm281xx_pinctrl_pin_config_set()
1373 pdata->pins[pin].name, pin); in bcm281xx_pinctrl_pin_config_set()
1399 pdata->reg_base = devm_platform_ioremap_resource(pdev, 0); in bcm281xx_pinctrl_probe()
1400 if (IS_ERR(pdata->reg_base)) { in bcm281xx_pinctrl_probe()
1401 dev_err(&pdev->dev, "Failed to ioremap MEM resource\n"); in bcm281xx_pinctrl_probe()
1402 return PTR_ERR(pdata->reg_base); in bcm281xx_pinctrl_probe()
1406 pdata->regmap = devm_regmap_init_mmio(&pdev->dev, pdata->reg_base, in bcm281xx_pinctrl_probe()
1408 if (IS_ERR(pdata->regmap)) { in bcm281xx_pinctrl_probe()
1409 dev_err(&pdev->dev, "Regmap MMIO init failed.\n"); in bcm281xx_pinctrl_probe()
1410 return -ENODEV; in bcm281xx_pinctrl_probe()
1413 bcm281xx_pinctrl_desc.name = dev_name(&pdev->dev); in bcm281xx_pinctrl_probe()
1417 pctl = devm_pinctrl_register(&pdev->dev, &bcm281xx_pinctrl_desc, pdata); in bcm281xx_pinctrl_probe()
1419 dev_err(&pdev->dev, "Failed to register pinctrl\n"); in bcm281xx_pinctrl_probe()
1429 { .compatible = "brcm,bcm11351-pinctrl", },
1434 .driver = {
1435 .name = "bcm281xx-pinctrl",