drivers/dpll/zl3073x/prop.c

Source file repositories/reference/linux-study-clean/drivers/dpll/zl3073x/prop.c

File Facts

System
Linux kernel
Corpus path
drivers/dpll/zl3073x/prop.c
Extension
.c
Size
10413 bytes
Lines
382
Domain
Driver Families
Bucket
drivers/dpll
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (zl3073x_pin_check_freq(zldev, dir, index, freqs[i])) {
			ranges[j] = freq;
			j++;
		}
	}

	/* Save number of freq ranges and pointer to them into pin properties */
	props->dpll_props.freq_supported = ranges;
	props->dpll_props.freq_supported_num = j;

	/* Free temporary array */
	kfree(freqs);

	return props;

err_alloc_ranges:
	kfree(freqs);
err_alloc_freqs:
	fwnode_handle_put(props->fwnode);
	kfree(props);

	return ERR_PTR(rc);
}

/**
 * zl3073x_pin_props_put - release pin properties
 * @props: pin properties to free
 *
 * The function deallocates given pin properties structure.
 */
void zl3073x_pin_props_put(struct zl3073x_pin_props *props)
{
	/* Free supported frequency ranges list if it is present */
	kfree(props->dpll_props.freq_supported);

	/* Put firmware handle if it is present */
	if (props->fwnode)
		fwnode_handle_put(props->fwnode);

	kfree(props);
}

/**
 * zl3073x_prop_dpll_type_get - get DPLL channel type
 * @zldev: pointer to zl3073x device
 * @index: DPLL channel index
 *
 * Return: DPLL type for given DPLL channel
 */
enum dpll_type
zl3073x_prop_dpll_type_get(struct zl3073x_dev *zldev, u8 index)
{
	const char *types[ZL3073X_MAX_CHANNELS];
	int count;

	/* Read dpll types property from firmware */
	count = device_property_read_string_array(zldev->dev, "dpll-types",
						  types, ARRAY_SIZE(types));

	/* Return default if property or entry for given channel is missing */
	if (index >= count)
		return DPLL_TYPE_PPS;

	if (!strcmp(types[index], "pps"))
		return DPLL_TYPE_PPS;
	else if (!strcmp(types[index], "eec"))
		return DPLL_TYPE_EEC;

	dev_info(zldev->dev, "Unknown DPLL type '%s', using default\n",
		 types[index]);

	return DPLL_TYPE_PPS; /* Default */
}

Annotation

Implementation Notes