Lines Matching +full:no +full:- +full:map
1 // SPDX-License-Identifier: GPL-2.0-only
17 * struct pinctrl_dt_map - mapping table chunk parsed from device tree
20 * @map: the mapping table entries
26 struct pinctrl_map *map; member
31 struct pinctrl_map *map, unsigned num_maps) in dt_free_map() argument
36 kfree_const(map[i].dev_name); in dt_free_map()
37 map[i].dev_name = NULL; in dt_free_map()
41 const struct pinctrl_ops *ops = pctldev->desc->pctlops; in dt_free_map()
42 if (ops->dt_free_map) in dt_free_map()
43 ops->dt_free_map(pctldev, map, num_maps); in dt_free_map()
45 /* There is no pctldev for PIN_MAP_TYPE_DUMMY_STATE */ in dt_free_map()
46 kfree(map); in dt_free_map()
54 list_for_each_entry_safe(dt_map, n1, &p->dt_maps, node) { in pinctrl_dt_free_maps()
55 pinctrl_unregister_mappings(dt_map->map); in pinctrl_dt_free_maps()
56 list_del(&dt_map->node); in pinctrl_dt_free_maps()
57 dt_free_map(dt_map->pctldev, dt_map->map, in pinctrl_dt_free_maps()
58 dt_map->num_maps); in pinctrl_dt_free_maps()
62 of_node_put(p->dev->of_node); in pinctrl_dt_free_maps()
67 struct pinctrl_map *map, unsigned num_maps) in dt_remember_or_free_map() argument
76 devname = kstrdup_const(dev_name(p->dev), GFP_KERNEL); in dt_remember_or_free_map()
80 map[i].dev_name = devname; in dt_remember_or_free_map()
81 map[i].name = statename; in dt_remember_or_free_map()
83 map[i].ctrl_dev_name = dev_name(pctldev->dev); in dt_remember_or_free_map()
91 dt_map->pctldev = pctldev; in dt_remember_or_free_map()
92 dt_map->map = map; in dt_remember_or_free_map()
93 dt_map->num_maps = num_maps; in dt_remember_or_free_map()
94 list_add_tail(&dt_map->node, &p->dt_maps); in dt_remember_or_free_map()
96 return pinctrl_register_mappings(map, num_maps); in dt_remember_or_free_map()
99 dt_free_map(pctldev, map, num_maps); in dt_remember_or_free_map()
100 return -ENOMEM; in dt_remember_or_free_map()
118 struct pinctrl_map *map; in dt_to_map_one_config() local
127 "pinctrl-use-default"); in dt_to_map_one_config()
132 ret = -ENODEV; in dt_to_map_one_config()
135 ret = -EPROBE_DEFER; in dt_to_map_one_config()
139 if (hog_pctldev && (np_pctldev == p->dev->of_node)) { in dt_to_map_one_config()
147 if (np_pctldev == p->dev->of_node) { in dt_to_map_one_config()
149 return -ENODEV; in dt_to_map_one_config()
158 ops = pctldev->desc->pctlops; in dt_to_map_one_config()
159 if (!ops->dt_node_to_map) { in dt_to_map_one_config()
160 dev_err(p->dev, "pctldev %s doesn't support DT\n", in dt_to_map_one_config()
161 dev_name(pctldev->dev)); in dt_to_map_one_config()
162 return -ENODEV; in dt_to_map_one_config()
164 ret = ops->dt_node_to_map(pctldev, np_config, &map, &num_maps); in dt_to_map_one_config()
169 * If we have no valid maps (maybe caused by empty pinctrl node in dt_to_map_one_config()
170 * or typing error) ther is no need remember this, so just in dt_to_map_one_config()
173 dev_info(p->dev, in dt_to_map_one_config()
179 return dt_remember_or_free_map(p, statename, pctldev, map, num_maps); in dt_to_map_one_config()
184 struct pinctrl_map *map; in dt_remember_dummy_state() local
186 map = kzalloc(sizeof(*map), GFP_KERNEL); in dt_remember_dummy_state()
187 if (!map) in dt_remember_dummy_state()
188 return -ENOMEM; in dt_remember_dummy_state()
190 /* There is no pctldev for PIN_MAP_TYPE_DUMMY_STATE */ in dt_remember_dummy_state()
191 map->type = PIN_MAP_TYPE_DUMMY_STATE; in dt_remember_dummy_state()
193 return dt_remember_or_free_map(p, statename, NULL, map, 1); in dt_remember_dummy_state()
198 struct device_node *np = p->dev->of_node; in pinctrl_dt_to_map()
208 /* CONFIG_OF enabled, p->dev not instantiated from DT */ in pinctrl_dt_to_map()
211 dev_dbg(p->dev, in pinctrl_dt_to_map()
212 "no of_node; not parsing pinctrl DT\n"); in pinctrl_dt_to_map()
221 /* Retrieve the pinctrl-* property */ in pinctrl_dt_to_map()
222 propname = kasprintf(GFP_KERNEL, "pinctrl-%d", state); in pinctrl_dt_to_map()
224 return -ENOMEM; in pinctrl_dt_to_map()
230 return -ENODEV; in pinctrl_dt_to_map()
234 list = prop->value; in pinctrl_dt_to_map()
237 /* Determine whether pinctrl-names property names the state */ in pinctrl_dt_to_map()
238 ret = of_property_read_string_index(np, "pinctrl-names", in pinctrl_dt_to_map()
246 statename = prop->name + strlen("pinctrl-"); in pinctrl_dt_to_map()
255 dev_err(p->dev, in pinctrl_dt_to_map()
257 prop->name, config); in pinctrl_dt_to_map()
258 ret = -EINVAL; in pinctrl_dt_to_map()
270 /* No entries in DT? Generate a dummy state table entry */ in pinctrl_dt_to_map()
286 * For pinctrl binding, typically #pinctrl-cells is for the pin controller
287 * device, so either parent or grandparent. See pinctrl-bindings.txt.
291 const char *cells_name = "#pinctrl-cells"; in pinctrl_find_cells_size()
294 error = of_property_read_u32(np->parent, cells_name, &cells_size); in pinctrl_find_cells_size()
296 error = of_property_read_u32(np->parent->parent, in pinctrl_find_cells_size()
299 return -ENOENT; in pinctrl_find_cells_size()
306 * pinctrl_get_list_and_count - Gets the list and it's cell size and number
328 return -ENOENT; in pinctrl_get_list_and_count()
332 return -ENOENT; in pinctrl_get_list_and_count()
341 * pinctrl_count_index_with_args - Count number of elements in a pinctrl entry
365 * pinctrl_copy_args - Populates of_phandle_args based on index
383 out_args->np = (struct device_node *)np; in pinctrl_copy_args()
384 out_args->args_count = nr_cells + 1; in pinctrl_copy_args()
387 return -EINVAL; in pinctrl_copy_args()
392 out_args->args[i] = be32_to_cpup(list++); in pinctrl_copy_args()
398 * pinctrl_parse_index_with_args - Find a node pointed by index in a list