Lines Matching +full:string +full:- +full:array +full:- +full:property
1 // SPDX-License-Identifier: GPL-2.0-only
8 #include <linux/property.h>
10 #include <linux/string.h>
16 * zl3073x_pin_check_freq - verify frequency for given pin
62 dev_warn(zldev->dev, in zl3073x_pin_check_freq()
69 * zl3073x_prop_pin_package_label_set - get package label for the pin
75 * Generates package label string and stores it into pin properties structure.
78 * REF<n> - differential input reference
79 * REF<n>P & REF<n>N - single-ended input reference (P or N pin)
80 * OUT<n> - differential output
81 * OUT<n>P & OUT<n>N - single-ended output (P or N pin)
110 snprintf(props->package_label, sizeof(props->package_label), "%s%u%s", in zl3073x_prop_pin_package_label_set()
114 * string. in zl3073x_prop_pin_package_label_set()
116 props->dpll_props.package_label = props->package_label; in zl3073x_prop_pin_package_label_set()
120 * zl3073x_prop_pin_fwnode_get - get fwnode for given pin
126 * Return: 0 on success, -ENOENT if the firmware node does not exist
137 node_name = "input-pins"; in zl3073x_prop_pin_fwnode_get()
139 node_name = "output-pins"; in zl3073x_prop_pin_fwnode_get()
142 pins_node = device_get_named_child_node(zldev->dev, node_name); in zl3073x_prop_pin_fwnode_get()
144 dev_dbg(zldev->dev, "'%s' sub-node is missing\n", node_name); in zl3073x_prop_pin_fwnode_get()
145 return -ENOENT; in zl3073x_prop_pin_fwnode_get()
163 props->fwnode = pin_node; in zl3073x_prop_pin_fwnode_get()
165 dev_dbg(zldev->dev, "Firmware node for %s %sfound\n", in zl3073x_prop_pin_fwnode_get()
166 props->package_label, pin_node ? "" : "NOT "); in zl3073x_prop_pin_fwnode_get()
168 return pin_node ? 0 : -ENOENT; in zl3073x_prop_pin_fwnode_get()
172 * zl3073x_pin_props_get - get pin properties
179 * generates package label string according pin type and optionally fetches
202 return ERR_PTR(-ENOMEM); in zl3073x_pin_props_get()
206 props->dpll_props.type = DPLL_PIN_TYPE_EXT; in zl3073x_pin_props_get()
207 props->dpll_props.capabilities = in zl3073x_pin_props_get()
211 props->dpll_props.type = DPLL_PIN_TYPE_GNSS; in zl3073x_pin_props_get()
214 props->dpll_props.phase_range.min = S32_MIN; in zl3073x_pin_props_get()
215 props->dpll_props.phase_range.max = S32_MAX; in zl3073x_pin_props_get()
224 /* Look for label property and store the value as board label */ in zl3073x_pin_props_get()
225 fwnode_property_read_string(props->fwnode, "label", in zl3073x_pin_props_get()
226 &props->dpll_props.board_label); in zl3073x_pin_props_get()
228 /* Look for pin type property and translate its value to DPLL in zl3073x_pin_props_get()
231 if (!fwnode_property_read_string(props->fwnode, "connection-type", in zl3073x_pin_props_get()
234 props->dpll_props.type = DPLL_PIN_TYPE_EXT; in zl3073x_pin_props_get()
236 props->dpll_props.type = DPLL_PIN_TYPE_GNSS; in zl3073x_pin_props_get()
238 props->dpll_props.type = DPLL_PIN_TYPE_INT_OSCILLATOR; in zl3073x_pin_props_get()
240 props->dpll_props.type = DPLL_PIN_TYPE_SYNCE_ETH_PORT; in zl3073x_pin_props_get()
242 dev_warn(zldev->dev, in zl3073x_pin_props_get()
248 props->esync_control = fwnode_property_read_bool(props->fwnode, in zl3073x_pin_props_get()
249 "esync-control"); in zl3073x_pin_props_get()
251 /* Read supported frequencies property if it is specified */ in zl3073x_pin_props_get()
252 num_freqs = fwnode_property_count_u64(props->fwnode, in zl3073x_pin_props_get()
253 "supported-frequencies-hz"); in zl3073x_pin_props_get()
255 /* Return if the property does not exist or number is 0 */ in zl3073x_pin_props_get()
260 * So read the frequency list into temporary array. in zl3073x_pin_props_get()
264 rc = -ENOMEM; in zl3073x_pin_props_get()
269 fwnode_property_read_u64_array(props->fwnode, in zl3073x_pin_props_get()
270 "supported-frequencies-hz", freqs, in zl3073x_pin_props_get()
276 rc = -ENOMEM; in zl3073x_pin_props_get()
281 * filter-out frequencies that are not representable by device in zl3073x_pin_props_get()
293 props->dpll_props.freq_supported = ranges; in zl3073x_pin_props_get()
294 props->dpll_props.freq_supported_num = j; in zl3073x_pin_props_get()
296 /* Free temporary array */ in zl3073x_pin_props_get()
304 fwnode_handle_put(props->fwnode); in zl3073x_pin_props_get()
311 * zl3073x_pin_props_put - release pin properties
319 kfree(props->dpll_props.freq_supported); in zl3073x_pin_props_put()
322 if (props->fwnode) in zl3073x_pin_props_put()
323 fwnode_handle_put(props->fwnode); in zl3073x_pin_props_put()
329 * zl3073x_prop_dpll_type_get - get DPLL channel type
341 /* Read dpll types property from firmware */ in zl3073x_prop_dpll_type_get()
342 count = device_property_read_string_array(zldev->dev, "dpll-types", in zl3073x_prop_dpll_type_get()
345 /* Return default if property or entry for given channel is missing */ in zl3073x_prop_dpll_type_get()
354 dev_info(zldev->dev, "Unknown DPLL type '%s', using default\n", in zl3073x_prop_dpll_type_get()