/* SPDX-License-Identifier: GPL-2.0-only */12#ifndef _ZL3073X_OUT_H3#define _ZL3073X_OUT_H45#include <linux/bitfield.h>6#include <linux/types.h>78#include "regs.h"910struct zl3073x_dev;1112/**13* struct zl3073x_out - output state14* @div: output divisor15* @width: output pulse width16* @esync_n_period: embedded sync or n-pin period (for n-div formats)17* @esync_n_width: embedded sync or n-pin pulse width18* @phase_comp: phase compensation19* @ctrl: output control20* @mode: output mode21*/22struct zl3073x_out {23u32 div;24u32 width;25u32 esync_n_period;26u32 esync_n_width;27s32 phase_comp;28u8 ctrl;29u8 mode;30};3132int zl3073x_out_state_fetch(struct zl3073x_dev *zldev, u8 index);33const struct zl3073x_out *zl3073x_out_state_get(struct zl3073x_dev *zldev,34u8 index);3536int zl3073x_out_state_set(struct zl3073x_dev *zldev, u8 index,37const struct zl3073x_out *out);3839/**40* zl3073x_out_signal_format_get - get output signal format41* @out: pointer to out state42*43* Return: signal format of given output44*/45static inline u8 zl3073x_out_signal_format_get(const struct zl3073x_out *out)46{47return FIELD_GET(ZL_OUTPUT_MODE_SIGNAL_FORMAT, out->mode);48}4950/**51* zl3073x_out_is_diff - check if the given output is differential52* @out: pointer to out state53*54* Return: true if output is differential, false if output is single-ended55*/56static inline bool zl3073x_out_is_diff(const struct zl3073x_out *out)57{58switch (zl3073x_out_signal_format_get(out)) {59case ZL_OUTPUT_MODE_SIGNAL_FORMAT_LVDS:60case ZL_OUTPUT_MODE_SIGNAL_FORMAT_DIFF:61case ZL_OUTPUT_MODE_SIGNAL_FORMAT_LOWVCM:62return true;63default:64break;65}6667return false;68}6970/**71* zl3073x_out_is_enabled - check if the given output is enabled72* @out: pointer to out state73*74* Return: true if output is enabled, false if output is disabled75*/76static inline bool zl3073x_out_is_enabled(const struct zl3073x_out *out)77{78return !!FIELD_GET(ZL_OUTPUT_CTRL_EN, out->ctrl);79}8081/**82* zl3073x_out_synth_get - get synth connected to given output83* @out: pointer to out state84*85* Return: index of synth connected to given output.86*/87static inline u8 zl3073x_out_synth_get(const struct zl3073x_out *out)88{89return FIELD_GET(ZL_OUTPUT_CTRL_SYNTH_SEL, out->ctrl);90}9192#endif /* _ZL3073X_OUT_H */939495