Lines Matching +full:bias +full:- +full:pull +full:- +full:pin +full:- +full:default
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Core driver for the generic pin config portions of the pin control subsystem
5 * Copyright (C) 2011 ST-Ericsson SA
6 * Written on behalf of Linaro for ST-Ericsson
22 #include <linux/pinctrl/pinconf-generic.h>
28 #include "pinctrl-utils.h"
32 PCONFDUMP(PIN_CONFIG_BIAS_BUS_HOLD, "input bias bus hold", NULL, false),
33 PCONFDUMP(PIN_CONFIG_BIAS_DISABLE, "input bias disabled", NULL, false),
34 PCONFDUMP(PIN_CONFIG_BIAS_HIGH_IMPEDANCE, "input bias high impedance", NULL, false),
35 PCONFDUMP(PIN_CONFIG_BIAS_PULL_DOWN, "input bias pull down", "ohms", true),
37 "input bias pull to pin specific state", "ohms", true),
38 PCONFDUMP(PIN_CONFIG_BIAS_PULL_UP, "input bias pull up", "ohms", true),
41 PCONFDUMP(PIN_CONFIG_DRIVE_PUSH_PULL, "output drive push pull", NULL, false),
49 PCONFDUMP(PIN_CONFIG_MODE_LOW_POWER, "pin low power", "mode", true),
51 PCONFDUMP(PIN_CONFIG_OUTPUT, "pin output", "level", true),
53 PCONFDUMP(PIN_CONFIG_POWER_SOURCE, "pin power source", "selector", true),
61 unsigned int pin, in pinconf_generic_dump_one() argument
74 ret = pin_config_group_get(dev_name(pctldev->dev), in pinconf_generic_dump_one()
77 ret = pin_config_get_for_pin(pctldev, pin, &config); in pinconf_generic_dump_one()
79 if (ret == -EINVAL || ret == -ENOTSUPP) in pinconf_generic_dump_one()
103 * pinconf_generic_dump_pins - Print information about pin or group of pins
107 * @pin: Pin number specyfying pin
109 * Print the pinconf configuration for the requested pin(s) to @s. Pins can be
110 * specified either by pin using @pin or by group using @gname. Only one needs
114 const char *gname, unsigned int pin) in pinconf_generic_dump_pins() argument
116 const struct pinconf_ops *ops = pctldev->desc->confops; in pinconf_generic_dump_pins()
119 if (!ops->is_generic) in pinconf_generic_dump_pins()
123 pinconf_generic_dump_one(pctldev, s, gname, pin, conf_items, in pinconf_generic_dump_pins()
125 /* driver-specific parameters */ in pinconf_generic_dump_pins()
126 if (pctldev->desc->num_custom_params && in pinconf_generic_dump_pins()
127 pctldev->desc->custom_conf_items) in pinconf_generic_dump_pins()
128 pinconf_generic_dump_one(pctldev, s, gname, pin, in pinconf_generic_dump_pins()
129 pctldev->desc->custom_conf_items, in pinconf_generic_dump_pins()
130 pctldev->desc->num_custom_params, in pinconf_generic_dump_pins()
146 if (!pctldev->desc->num_custom_params || in pinconf_generic_dump_config()
147 !pctldev->desc->custom_conf_items) in pinconf_generic_dump_config()
150 for (i = 0; i < pctldev->desc->num_custom_params; i++) { in pinconf_generic_dump_config()
152 pctldev->desc->custom_conf_items[i].param) in pinconf_generic_dump_config()
155 pctldev->desc->custom_conf_items[i].display, in pinconf_generic_dump_config()
164 { "bias-bus-hold", PIN_CONFIG_BIAS_BUS_HOLD, 0 },
165 { "bias-disable", PIN_CONFIG_BIAS_DISABLE, 0 },
166 { "bias-high-impedance", PIN_CONFIG_BIAS_HIGH_IMPEDANCE, 0 },
167 { "bias-pull-up", PIN_CONFIG_BIAS_PULL_UP, 1 },
168 { "bias-pull-pin-default", PIN_CONFIG_BIAS_PULL_PIN_DEFAULT, 1 },
169 { "bias-pull-down", PIN_CONFIG_BIAS_PULL_DOWN, 1 },
170 { "drive-open-drain", PIN_CONFIG_DRIVE_OPEN_DRAIN, 0 },
171 { "drive-open-source", PIN_CONFIG_DRIVE_OPEN_SOURCE, 0 },
172 { "drive-push-pull", PIN_CONFIG_DRIVE_PUSH_PULL, 0 },
173 { "drive-strength", PIN_CONFIG_DRIVE_STRENGTH, 0 },
174 { "drive-strength-microamp", PIN_CONFIG_DRIVE_STRENGTH_UA, 0 },
175 { "input-debounce", PIN_CONFIG_INPUT_DEBOUNCE, 0 },
176 { "input-disable", PIN_CONFIG_INPUT_ENABLE, 0 },
177 { "input-enable", PIN_CONFIG_INPUT_ENABLE, 1 },
178 { "input-schmitt", PIN_CONFIG_INPUT_SCHMITT, 0 },
179 { "input-schmitt-disable", PIN_CONFIG_INPUT_SCHMITT_ENABLE, 0 },
180 { "input-schmitt-enable", PIN_CONFIG_INPUT_SCHMITT_ENABLE, 1 },
181 { "input-schmitt-microvolts", PIN_CONFIG_INPUT_SCHMITT_UV, 0 },
182 { "low-power-disable", PIN_CONFIG_MODE_LOW_POWER, 0 },
183 { "low-power-enable", PIN_CONFIG_MODE_LOW_POWER, 1 },
184 { "output-disable", PIN_CONFIG_OUTPUT_ENABLE, 0 },
185 { "output-enable", PIN_CONFIG_OUTPUT_ENABLE, 1 },
186 { "output-high", PIN_CONFIG_OUTPUT, 1, },
187 { "output-impedance-ohms", PIN_CONFIG_OUTPUT_IMPEDANCE_OHMS, 0 },
188 { "output-low", PIN_CONFIG_OUTPUT, 0, },
189 { "power-source", PIN_CONFIG_POWER_SOURCE, 0 },
190 { "sleep-hardware-state", PIN_CONFIG_SLEEP_HARDWARE_STATE, 0 },
191 { "slew-rate", PIN_CONFIG_SLEW_RATE, 0 },
192 { "skew-delay", PIN_CONFIG_SKEW_DELAY, 0 },
196 * parse_dt_cfg() - Parse DT pinconf parameters
220 ret = of_property_read_u32(np, par->property, &val); in parse_dt_cfg()
223 if (ret == -EINVAL) in parse_dt_cfg()
226 /* use default value, when no value is specified */ in parse_dt_cfg()
228 val = par->default_value; in parse_dt_cfg()
230 pr_debug("found %s with value %u\n", par->property, val); in parse_dt_cfg()
231 cfg[*ncfg] = pinconf_to_config_packed(par->param, val); in parse_dt_cfg()
255 return -EINVAL; in pinconf_generic_parse_dt_config()
260 max_cfg += pctldev->desc->num_custom_params; in pinconf_generic_parse_dt_config()
263 return -ENOMEM; in pinconf_generic_parse_dt_config()
266 if (pctldev && pctldev->desc->num_custom_params && in pinconf_generic_parse_dt_config()
267 pctldev->desc->custom_params) in pinconf_generic_parse_dt_config()
268 parse_dt_cfg(np, pctldev->desc->custom_params, in pinconf_generic_parse_dt_config()
269 pctldev->desc->num_custom_params, cfg, &ncfg); in pinconf_generic_parse_dt_config()
286 ret = -ENOMEM; in pinconf_generic_parse_dt_config()
305 struct device *dev = pctldev->dev; in pinconf_generic_dt_subnode_to_map()
331 if (ret != -EINVAL) in pinconf_generic_dt_subnode_to_map()