]> git.ipfire.org Git - thirdparty/openwrt.git/commit
realtek: pcs: rtl930x: simplify DCVS/VTH/TAP calibration helpers 23983/head
authorJonas Jelonek <jelonek.jonas@gmail.com>
Sun, 28 Jun 2026 09:55:18 +0000 (09:55 +0000)
committerJonas Jelonek <jelonek.jonas@gmail.com>
Sun, 28 Jun 2026 21:38:37 +0000 (23:38 +0200)
commit8b0ce8e4e33f7ff53a244fb11aa06d39f22586be
tree14908c721baf14db4389ef87a27d7f01d577e914
parent393d5b01fba4dbefcaed95c1938cc2b6c47e2dfb
realtek: pcs: rtl930x: simplify DCVS/VTH/TAP calibration helpers

Reduce repetition in dcvs_manual, dcvs_get, vth_manual and tap_manual
by hoisting the per-channel enable bit write out of per-case branches
and encoding per-channel register/bit mappings as lookup tables where
the pattern is uniform across channels.

This also fixes two bugs in dcvs_get that were hidden in the switch:

- DCVS1 read never populated dcvs_sign_out; it wrote the sign bit read
  (0x14[4:4]) into dcvs_coef_bin and then immediately overwrote it with
  the coefficient read, leaving the sign always zero for that channel.

- DCVS3 assigned the manual bit read directly to a bool without the !!
  normalisation applied to all other cases.

Link: https://github.com/openwrt/openwrt/pull/23983
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
target/linux/realtek/files-6.18/drivers/net/pcs/pcs-rtl-otto.c