/** * struct zl3073x_ref - input reference invariant info * @enabled: input reference is enabled or disabled * @diff: true if input reference is differential * @ffo: current fractional frequency offset
*/ struct zl3073x_ref { bool enabled; bool diff;
s64 ffo;
};
/** * struct zl3073x_out - output invariant info * @enabled: out is enabled or disabled * @synth: synthesizer the out is connected to * @signal_format: out signal format
*/ struct zl3073x_out { bool enabled;
u8 synth;
u8 signal_format;
};
/** * struct zl3073x_synth - synthesizer invariant info * @freq: synthesizer frequency * @dpll: ID of DPLL the synthesizer is driven by * @enabled: synth is enabled or disabled
*/ struct zl3073x_synth {
u32 freq;
u8 dpll; bool enabled;
};
/** * struct zl3073x_dev - zl3073x device * @dev: pointer to device * @regmap: regmap to access device registers * @multiop_lock: to serialize multiple register operations * @clock_id: clock id of the device * @ref: array of input references' invariants * @out: array of outs' invariants * @synth: array of synths' invariants * @dplls: list of DPLLs * @kworker: thread for periodic work * @work: periodic work
*/ struct zl3073x_dev { struct device *dev; struct regmap *regmap; struct mutex multiop_lock;
u64 clock_id;
/** * zl3073x_input_pin_ref_get - get reference for given input pin * @id: input pin id * * Return: reference id for the given input pin
*/ staticinline u8
zl3073x_input_pin_ref_get(u8 id)
{ return id;
}
/** * zl3073x_output_pin_out_get - get output for the given output pin * @id: output pin id * * Return: output id for the given output pin
*/ staticinline u8
zl3073x_output_pin_out_get(u8 id)
{ /* Output pin pair shares the single output */ return id / 2;
}
/** * zl3073x_ref_ffo_get - get current fractional frequency offset * @zldev: pointer to zl3073x device * @index: input reference index * * Return: the latest measured fractional frequency offset
*/ staticinline s64
zl3073x_ref_ffo_get(struct zl3073x_dev *zldev, u8 index)
{ return zldev->ref[index].ffo;
}
/** * zl3073x_ref_is_diff - check if the given input reference is differential * @zldev: pointer to zl3073x device * @index: input reference index * * Return: true if reference is differential, false if reference is single-ended
*/ staticinlinebool
zl3073x_ref_is_diff(struct zl3073x_dev *zldev, u8 index)
{ return zldev->ref[index].diff;
}
/** * zl3073x_ref_is_enabled - check if the given input reference is enabled * @zldev: pointer to zl3073x device * @index: input reference index * * Return: true if input refernce is enabled, false otherwise
*/ staticinlinebool
zl3073x_ref_is_enabled(struct zl3073x_dev *zldev, u8 index)
{ return zldev->ref[index].enabled;
}
/** * zl3073x_synth_dpll_get - get DPLL ID the synth is driven by * @zldev: pointer to zl3073x device * @index: synth index * * Return: ID of DPLL the given synthetizer is driven by
*/ staticinline u8
zl3073x_synth_dpll_get(struct zl3073x_dev *zldev, u8 index)
{ return zldev->synth[index].dpll;
}
/** * zl3073x_synth_freq_get - get synth current freq * @zldev: pointer to zl3073x device * @index: synth index * * Return: frequency of given synthetizer
*/ staticinline u32
zl3073x_synth_freq_get(struct zl3073x_dev *zldev, u8 index)
{ return zldev->synth[index].freq;
}
/** * zl3073x_synth_is_enabled - check if the given synth is enabled * @zldev: pointer to zl3073x device * @index: synth index * * Return: true if synth is enabled, false otherwise
*/ staticinlinebool
zl3073x_synth_is_enabled(struct zl3073x_dev *zldev, u8 index)
{ return zldev->synth[index].enabled;
}
/** * zl3073x_out_synth_get - get synth connected to given output * @zldev: pointer to zl3073x device * @index: output index * * Return: index of synth connected to given output.
*/ staticinline u8
zl3073x_out_synth_get(struct zl3073x_dev *zldev, u8 index)
{ return zldev->out[index].synth;
}
/** * zl3073x_out_is_enabled - check if the given output is enabled * @zldev: pointer to zl3073x device * @index: output index * * Return: true if the output is enabled, false otherwise
*/ staticinlinebool
zl3073x_out_is_enabled(struct zl3073x_dev *zldev, u8 index)
{
u8 synth;
/* Output is enabled only if associated synth is enabled */
synth = zl3073x_out_synth_get(zldev, index); if (zl3073x_synth_is_enabled(zldev, synth)) return zldev->out[index].enabled;
returnfalse;
}
/** * zl3073x_out_signal_format_get - get output signal format * @zldev: pointer to zl3073x device * @index: output index * * Return: signal format of given output
*/ staticinline u8
zl3073x_out_signal_format_get(struct zl3073x_dev *zldev, u8 index)
{ return zldev->out[index].signal_format;
}
/** * zl3073x_out_dpll_get - get DPLL ID the output is driven by * @zldev: pointer to zl3073x device * @index: output index * * Return: ID of DPLL the given output is driven by
*/ staticinline
u8 zl3073x_out_dpll_get(struct zl3073x_dev *zldev, u8 index)
{
u8 synth;
/* Get synthesizer connected to given output */
synth = zl3073x_out_synth_get(zldev, index);
/* Return DPLL that drives the synth */ return zl3073x_synth_dpll_get(zldev, synth);
}
/** * zl3073x_out_is_diff - check if the given output is differential * @zldev: pointer to zl3073x device * @index: output index * * Return: true if output is differential, false if output is single-ended
*/ staticinlinebool
zl3073x_out_is_diff(struct zl3073x_dev *zldev, u8 index)
{ switch (zl3073x_out_signal_format_get(zldev, index)) { case ZL_OUTPUT_MODE_SIGNAL_FORMAT_LVDS: case ZL_OUTPUT_MODE_SIGNAL_FORMAT_DIFF: case ZL_OUTPUT_MODE_SIGNAL_FORMAT_LOWVCM: returntrue; default: break;
}
returnfalse;
}
/** * zl3073x_output_pin_is_enabled - check if the given output pin is enabled * @zldev: pointer to zl3073x device * @id: output pin id * * Checks if the output of the given output pin is enabled and also that * its signal format also enables the given pin. * * Return: true if output pin is enabled, false if output pin is disabled
*/ staticinlinebool
zl3073x_output_pin_is_enabled(struct zl3073x_dev *zldev, u8 id)
{
u8 output = zl3073x_output_pin_out_get(id);
/* Check if the whole output is enabled */ if (!zl3073x_out_is_enabled(zldev, output)) returnfalse;
/* Check signal format */ switch (zl3073x_out_signal_format_get(zldev, output)) { case ZL_OUTPUT_MODE_SIGNAL_FORMAT_DISABLED: /* Both output pins are disabled by signal format */ returnfalse;
case ZL_OUTPUT_MODE_SIGNAL_FORMAT_1P: /* Output is one single ended P-pin output */ if (zl3073x_is_n_pin(id)) returnfalse; break; case ZL_OUTPUT_MODE_SIGNAL_FORMAT_1N: /* Output is one single ended N-pin output */ if (zl3073x_is_p_pin(id)) returnfalse; break; default: /* For other format both pins are enabled */ break;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.