[PATCH 0/4] wifi: rtw88: rtw8822c: refactor DAC IQ calibration to s32

From: Arsenii Pashchenko

Date: Wed Aug 12 2026 - 10:46:21 EST


This series refactors the Digital-to-Analog Converter (DAC) IQ
calibration routines in the rtw8822c driver.

The original code heavily relies on unsigned 32-bit math mapped over
a 10-bit circular hardware register scale centered around 0x200. This
introduces complex nested boundary checks, custom bubble sort rules,
and custom min/max tracking helpers.

By migrating the temporary stack arrays and signatures to signed s32
and utilizing the kernel's sign_extend32() API, the coordination system
is linearized. This allows the removal of internal custom helpers and
collapses unsigned wrap-around logic into standard linear operations.

The series is broken down as follows:
Patch 1: Prepares signatures and stack buffers, converting types to s32.
Patch 2: Introduces sign_extend32() and simplifies the validation window.
Patch 3: Replaces custom bubble sort with the kernel's native sort().
Patch 4: Eliminates minmax_cmp, streamlining search and offset loops.

AI Disclosure:
An AI assistant was used for source code analysis and conceptual
consultation regarding the signed math transformation. All code
modifications, final implementations, and refactoring steps were
written, reviewed, and verified manually by the author.

Testing:
- Every patch in the series was verified with scripts/checkpatch.pl
and yielded 0 errors and 0 warnings.
- Each patch was sequentially built (bisected and compiled) to ensure
there are no compiler warnings, pointer type mismatches, or broken
builds at any intermediate step.

Arsenii Pashchenko (4):
wifi: rtw88: rtw8822c: convert DAC IQ buffers and signatures to s32
wifi: rtw88: rtw8822c: use sign_extend32 for DAC IQ validation
wifi: rtw88: rtw8822c: switch to the kernel's sort() library
wifi: rtw88: rtw8822c: simplify amplitude search and offset via s32

drivers/net/wireless/realtek/rtw88/rtw8822c.c | 146 ++++++------------
1 file changed, 43 insertions(+), 103 deletions(-)

--
2.55.0