drivers/dpll/zl3073x/out.h

Source file repositories/reference/linux-study-clean/drivers/dpll/zl3073x/out.h

File Facts

System
Linux kernel
Corpus path
drivers/dpll/zl3073x/out.h
Extension
.h
Size
3383 bytes
Lines
138
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

struct zl3073x_out {
	struct_group(cfg, /* Config */
		u32	div;
		u32	width;
		u32	esync_n_period;
		u32	esync_n_width;
		s32	phase_comp;
		u8	mode;
	);
	struct_group(inv, /* Invariants */
		u8	ctrl;
	);
};

int zl3073x_out_state_fetch(struct zl3073x_dev *zldev, u8 index);
const struct zl3073x_out *zl3073x_out_state_get(struct zl3073x_dev *zldev,
						u8 index);

int zl3073x_out_state_set(struct zl3073x_dev *zldev, u8 index,
			  const struct zl3073x_out *out);

/**
 * zl3073x_out_clock_type_get - get output clock type
 * @out: pointer to out state
 *
 * Return: clock type of given output (ZL_OUTPUT_MODE_CLOCK_TYPE_*)
 */
static inline u8 zl3073x_out_clock_type_get(const struct zl3073x_out *out)
{
	return FIELD_GET(ZL_OUTPUT_MODE_CLOCK_TYPE, out->mode);
}

/**
 * zl3073x_out_clock_type_set - set output clock type
 * @out: pointer to out state
 * @type: clock type (ZL_OUTPUT_MODE_CLOCK_TYPE_*)
 */
static inline void
zl3073x_out_clock_type_set(struct zl3073x_out *out, u8 type)
{
	FIELD_MODIFY(ZL_OUTPUT_MODE_CLOCK_TYPE, &out->mode, type);
}

/**
 * zl3073x_out_signal_format_get - get output signal format
 * @out: pointer to out state
 *
 * Return: signal format of given output
 */
static inline u8 zl3073x_out_signal_format_get(const struct zl3073x_out *out)
{
	return FIELD_GET(ZL_OUTPUT_MODE_SIGNAL_FORMAT, out->mode);
}

/**
 * zl3073x_out_is_diff - check if the given output is differential
 * @out: pointer to out state
 *
 * Return: true if output is differential, false if output is single-ended
 */
static inline bool zl3073x_out_is_diff(const struct zl3073x_out *out)
{
	switch (zl3073x_out_signal_format_get(out)) {
	case ZL_OUTPUT_MODE_SIGNAL_FORMAT_LVDS:
	case ZL_OUTPUT_MODE_SIGNAL_FORMAT_DIFF:
	case ZL_OUTPUT_MODE_SIGNAL_FORMAT_LOWVCM:
		return true;
	default:
		break;
	}

	return false;
}

/**
 * zl3073x_out_is_enabled - check if the given output is enabled
 * @out: pointer to out state
 *
 * Return: true if output is enabled, false if output is disabled
 */
static inline bool zl3073x_out_is_enabled(const struct zl3073x_out *out)
{
	return !!FIELD_GET(ZL_OUTPUT_CTRL_EN, out->ctrl);
}

/**
 * zl3073x_out_is_ndiv - check if the given output is in N-div mode
 * @out: pointer to out state
 *
 * Return: true if output is in N-div mode, false otherwise

Annotation

Implementation Notes