Lines Matching +full:i +full:- +full:drive
1 // SPDX-License-Identifier: GPL-2.0-only
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"
39 PCONFDUMP(PIN_CONFIG_DRIVE_OPEN_DRAIN, "output drive open drain", NULL, false),
40 PCONFDUMP(PIN_CONFIG_DRIVE_OPEN_SOURCE, "output drive open source", NULL, false),
41 PCONFDUMP(PIN_CONFIG_DRIVE_PUSH_PULL, "output drive push pull", NULL, false),
42 PCONFDUMP(PIN_CONFIG_DRIVE_STRENGTH, "output drive strength", "mA", true),
43 PCONFDUMP(PIN_CONFIG_DRIVE_STRENGTH_UA, "output drive strength", "uA", true),
65 int i; in pinconf_generic_dump_one() local
67 for (i = 0; i < nitems; i++) { in pinconf_generic_dump_one()
72 config = pinconf_to_config_packed(items[i].param, 0); in pinconf_generic_dump_one()
74 ret = pin_config_group_get(dev_name(pctldev->dev), in pinconf_generic_dump_one()
79 if (ret == -EINVAL || ret == -ENOTSUPP) in pinconf_generic_dump_one()
82 seq_printf(s, "ERROR READING CONFIG SETTING %d ", i); in pinconf_generic_dump_one()
89 seq_puts(s, items[i].display); in pinconf_generic_dump_one()
91 if (items[i].has_arg) { in pinconf_generic_dump_one()
94 if (items[i].format) in pinconf_generic_dump_one()
95 seq_printf(s, " %s)", items[i].format); in pinconf_generic_dump_one()
103 * pinconf_generic_dump_pins - Print information about pin or group of pins
116 const struct pinconf_ops *ops = pctldev->desc->confops; in pinconf_generic_dump_pins()
119 if (!ops->is_generic) 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()
129 pctldev->desc->custom_conf_items, in pinconf_generic_dump_pins()
130 pctldev->desc->num_custom_params, in pinconf_generic_dump_pins()
137 int i; in pinconf_generic_dump_config() local
139 for (i = 0; i < ARRAY_SIZE(conf_items); i++) { in pinconf_generic_dump_config()
140 if (pinconf_to_config_param(config) != conf_items[i].param) in pinconf_generic_dump_config()
142 seq_printf(s, "%s: 0x%x", conf_items[i].display, in pinconf_generic_dump_config()
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
213 int i; in parse_dt_cfg() local
215 for (i = 0; i < count; i++) { in parse_dt_cfg()
218 const struct pinconf_generic_params *par = ¶ms[i]; in parse_dt_cfg()
220 ret = of_property_read_u32(np, par->property, &val); in parse_dt_cfg()
223 if (ret == -EINVAL) 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()