mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-08-30 21:52:21 +00:00

Implement phase offset monitor feature to allow a user to monitor phase offsets across all available inputs. The device firmware periodically performs phase offsets measurements for all available DPLL channels and input references. The driver can ask the firmware to fill appropriate latch registers with measured values. There are 2 sets of latch registers for phase offsets reporting: 1) DPLL-to-connected-ref: up to 5 registers that contain values for phase offset between particular DPLL channel and its connected input reference. 2) selected-DPLL-to-ref: 10 registers that contain values for phase offsets between selected DPLL channel and all available input references. Both are filled with single read request so the driver can read DPLL-to-connected-ref phase offset for all DPLL channels at once. This was implemented in the previous patch. To read selected-DPLL-to-ref registers for all DPLLs a separate read request has to be sent to device firmware for each DPLL channel. To implement phase offset monitor feature: * Extend zl3073x_ref_phase_offsets_update() to select given DPLL channel in phase offset read request. The caller can set channel==-1 if it will not read Type2 registers. * Use this extended function to update phase offset latch registers during zl3073x_dpll_changes_check() call if phase monitor is enabled * Extend zl3073x_dpll_pin_phase_offset_check() to check phase offset changes for all available input references * Extend zl3073x_dpll_input_pin_phase_offset_get() to report phase offset values for all available input references * Implement phase offset monitor callbacks to enable/disable this feature Reviewed-by: Jiri Pirko <jiri@nvidia.com> Tested-by: Prathosh Satish <prathosh.satish@microchip.com> Co-developed-by: Prathosh Satish <Prathosh.Satish@microchip.com> Signed-off-by: Prathosh Satish <Prathosh.Satish@microchip.com> Signed-off-by: Ivan Vecera <ivecera@redhat.com> Link: https://patch.msgid.link/20250715144633.149156-4-ivecera@redhat.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
47 lines
1.3 KiB
C
47 lines
1.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
|
|
#ifndef _ZL3073X_DPLL_H
|
|
#define _ZL3073X_DPLL_H
|
|
|
|
#include <linux/dpll.h>
|
|
#include <linux/list.h>
|
|
|
|
#include "core.h"
|
|
|
|
/**
|
|
* struct zl3073x_dpll - ZL3073x DPLL sub-device structure
|
|
* @list: this DPLL list entry
|
|
* @dev: pointer to multi-function parent device
|
|
* @id: DPLL index
|
|
* @refsel_mode: reference selection mode
|
|
* @forced_ref: selected reference in forced reference lock mode
|
|
* @check_count: periodic check counter
|
|
* @phase_monitor: is phase offset monitor enabled
|
|
* @dpll_dev: pointer to registered DPLL device
|
|
* @lock_status: last saved DPLL lock status
|
|
* @pins: list of pins
|
|
*/
|
|
struct zl3073x_dpll {
|
|
struct list_head list;
|
|
struct zl3073x_dev *dev;
|
|
u8 id;
|
|
u8 refsel_mode;
|
|
u8 forced_ref;
|
|
u8 check_count;
|
|
bool phase_monitor;
|
|
struct dpll_device *dpll_dev;
|
|
enum dpll_lock_status lock_status;
|
|
struct list_head pins;
|
|
};
|
|
|
|
struct zl3073x_dpll *zl3073x_dpll_alloc(struct zl3073x_dev *zldev, u8 ch);
|
|
void zl3073x_dpll_free(struct zl3073x_dpll *zldpll);
|
|
|
|
int zl3073x_dpll_register(struct zl3073x_dpll *zldpll);
|
|
void zl3073x_dpll_unregister(struct zl3073x_dpll *zldpll);
|
|
|
|
int zl3073x_dpll_init_fine_phase_adjust(struct zl3073x_dev *zldev);
|
|
void zl3073x_dpll_changes_check(struct zl3073x_dpll *zldpll);
|
|
|
|
#endif /* _ZL3073X_DPLL_H */
|