Skip to content
/ linux Public

Commit b2acd29

Browse files
iveceraSasha Levin
authored andcommitted
dpll: zl3073x: Cache all reference properties in zl3073x_ref
[ Upstream commit 5bc02b1 ] Expand the zl3073x_ref structure to cache all reference-related hardware registers, including frequency components, embedded-sync settings and phase compensation. Previously, these registers were read on-demand from various functions in dpll.c leading to frequent mailbox operations. Modify zl3073x_ref_state_fetch() to read and populate all these new fields at once. Refactor all "getter" functions in dpll.c to read from this new cached state instead of performing direct register access. Remove the standalone zl3073x_dpll_input_ref_frequency_get() helper, as its functionality is now replaced by zl3073x_ref_freq_get() which operates on the cached state and add a corresponding zl3073x_dev_... wrapper. Introduce a new function, zl3073x_ref_state_set(), to handle writing changes back to the hardware. This function compares the provided state with the current cached state and writes *only* the modified register values to the device via a single mailbox sequence before updating the local cache. Refactor all dpll "setter" functions to modify a local copy of the ref state and then call zl3073x_ref_state_set() to commit the changes. As a cleanup, update callers in dpll.c that already have a struct zl3073x_ref * to use the direct helpers instead of the zl3073x_dev_... wrappers. This change centralizes all reference-related register I/O into ref.c, significantly reduces bus traffic, and simplifies the logic in dpll.c. Reviewed-by: Petr Oros <poros@redhat.com> Tested-by: Prathosh Satish <Prathosh.Satish@microchip.com> Signed-off-by: Ivan Vecera <ivecera@redhat.com> Link: https://patch.msgid.link/20251113074105.141379-5-ivecera@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Stable-dep-of: 4cfe066 ("dpll: zl3073x: fix REF_PHASE_OFFSET_COMP register width for some chip IDs") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent a4b086c commit b2acd29

File tree

4 files changed

+239
-232
lines changed

4 files changed

+239
-232
lines changed

drivers/dpll/zl3073x/core.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,21 @@ zl3073x_dev_ref_ffo_get(struct zl3073x_dev *zldev, u8 index)
197197
return zl3073x_ref_ffo_get(ref);
198198
}
199199

200+
/**
201+
* zl3073x_dev_ref_freq_get - get input reference frequency
202+
* @zldev: pointer to zl3073x device
203+
* @index: input reference index
204+
*
205+
* Return: frequency of given input reference
206+
*/
207+
static inline u32
208+
zl3073x_dev_ref_freq_get(struct zl3073x_dev *zldev, u8 index)
209+
{
210+
const struct zl3073x_ref *ref = zl3073x_ref_state_get(zldev, index);
211+
212+
return zl3073x_ref_freq_get(ref);
213+
}
214+
200215
/**
201216
* zl3073x_dev_ref_is_diff - check if the given input reference is differential
202217
* @zldev: pointer to zl3073x device

0 commit comments

Comments
 (0)