drivers/gpu/drm/logicvc/logicvc_of.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/logicvc/logicvc_of.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/logicvc/logicvc_of.c
Extension
.c
Size
4490 bytes
Lines
186
Domain
Driver Families
Bucket
drivers/gpu
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 (!strcmp(sv[i].string, string)) {
			*value = sv[i].value;
			return 0;
		}

		i++;
	}

	return -EINVAL;
}

int logicvc_of_property_parse_u32(struct device_node *of_node,
				  unsigned int index, u32 *target)
{
	struct logicvc_of_property *property;
	const char *string;
	u32 value;
	int ret;

	if (index >= LOGICVC_OF_PROPERTY_MAXIMUM)
		return -EINVAL;

	property = &logicvc_of_properties[index];

	if (!property->optional &&
	    !of_property_read_bool(of_node, property->name))
		return -ENODEV;

	if (property->sv) {
		ret = of_property_read_string(of_node, property->name, &string);
		if (ret)
			return ret;

		ret = logicvc_of_property_sv_value(property->sv, string,
						   &value);
		if (ret)
			return ret;
	} else {
		ret = of_property_read_u32(of_node, property->name, &value);
		if (ret)
			return ret;
	}

	if (property->range[0] || property->range[1])
		if (value < property->range[0] || value > property->range[1])
			return -ERANGE;

	*target = value;

	return 0;
}

void logicvc_of_property_parse_bool(struct device_node *of_node,
				    unsigned int index, bool *target)
{
	struct logicvc_of_property *property;

	if (index >= LOGICVC_OF_PROPERTY_MAXIMUM) {
		/* Fallback. */
		*target = false;
		return;
	}

	property = &logicvc_of_properties[index];
	*target = of_property_read_bool(of_node, property->name);
}

bool logicvc_of_node_is_layer(struct device_node *of_node)
{
	return !of_node_cmp(of_node->name, "layer");
}

Annotation

Implementation Notes