All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH rtw-next v4 0/3] wifi: rtw88: rtw8822c: refactor DAC IQ calibration to s32
@ 2026-08-15  5:46 ` Arsenii Pashchenko
  0 siblings, 0 replies; 8+ messages in thread
From: Arsenii Pashchenko @ 2026-08-15  5:35 UTC (permalink / raw)
  To: pkshih; +Cc: linux-wireless, linux-kernel, Arsenii Pashchenko

This series refactors the Digital-to-Analog Converter (DAC) IQ
calibration routines in the rtw8822c driver, eliminating legacy
unsigned workarounds in favor of native signed math.

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 FIELD_GET_SIGNED() API, the coordination
system is linearized. This allows the removal of internal custom
helpers, collapses unsigned wrap-around logic into standard linear
operations, and enables the drop-in integration of the kernel's
native heapsort library.

The series is broken down as follows:
Patch 1: Introduces GENMASK constants for register fields and replaces
         manual bit shifts with standard FIELD_GET() macros.
Patch 2: Converts stack buffers and function signatures to signed s32,
         switches sampling to FIELD_GET_SIGNED(), and straightens out
         the validation windows and hardware offset mapping.
Patch 3: Replaces custom bubble sort logic and unused helpers with a direct
         call to the kernel's native sort() library using a safe,
         overflow-proof relational comparator.

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.
---
Changes in v4:
 - Flattened the series from 4 to 3 patches to avoid intermediate broken
   states where sign-extended variables interacted with unsigned check
   logic, ensuring 100% clean bisectability.
 - Leveraged FIELD_GET_SIGNED() for modern, native handling of 10-bit
   signed hardware entries as suggested during review.
 - Shifted definition of register field masks from the .c file into the
   shared rtw8822c.h header file according to subsystem design patterns.
 - Stripped out custom rtw8822c_dac_iq_sort() wrapper, invoking the
   kernel sort() library directly inside the main calibration search loop.

Changes in v3:
 - Corrected the subject prefix target tree from wireless-next to rtw-next 
   as requested by the maintainer.
   
Changes in v2:
 - Fixed missing target tree name in the subject prefix (switched to wireless-next).

Arsenii Pashchenko (3):
  wifi: rtw88: rtw8822c: Use bitfield macros for DAC IQ sampling
  fi: rtw88: rtw8822c: Convert DAC IQ calibration path to signed math
  wifi: rtw88: rtw8822c: Replace custom DAC IQ sorting with kernel sort

 drivers/net/wireless/realtek/rtw88/rtw8822c.c | 151 +++++-------------
 drivers/net/wireless/realtek/rtw88/rtw8822c.h |   3 +
 2 files changed, 47 insertions(+), 107 deletions(-)

-- 
2.55.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-08-15  5:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-15  5:35 [PATCH rtw-next v4 0/3] wifi: rtw88: rtw8822c: refactor DAC IQ calibration to s32 Arsenii Pashchenko
2026-08-15  5:46 ` [PATCH rtw-next v5 " Arsenii Pashchenko
2026-08-15  5:35 ` [PATCH rtw-next v4 1/3] wifi: rtw88: rtw8822c: Use bitfield macros for DAC IQ sampling Arsenii Pashchenko
2026-08-15  5:46   ` [PATCH rtw-next v5 " Arsenii Pashchenko
2026-08-15  5:35 ` [PATCH rtw-next v4 2/3] fi: rtw88: rtw8822c: Convert DAC IQ calibration path to signed math Arsenii Pashchenko
2026-08-15  5:46   ` [PATCH rtw-next v5 2/3] wifi: rtw88: rtw8822c: Convert DAC IQ calibration path to signed mat Arsenii Pashchenko
2026-08-15  5:35 ` [PATCH rtw-next v4 3/3] wifi: rtw88: rtw8822c: Replace custom DAC IQ sorting with kernel sort Arsenii Pashchenko
2026-08-15  5:46   ` [PATCH rtw-next v5 " Arsenii Pashchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.