From: Arsenii Pashchenko <ulijg308@gmail.com>
To: pkshih@realtek.com
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
Arsenii Pashchenko <ulijg308@gmail.com>
Subject: [PATCH rtw-next v6 0/3] wifi: rtw88: rtw8822c: refactor DAC IQ calibration to s32
Date: Sat, 15 Aug 2026 16:39:21 +0700 [thread overview]
Message-ID: <cover.1786784750.git.ulijg308@gmail.com> (raw)
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:
- Note: The author does not possess the actual rtw8822c hardware. Actual
throughput and runtime performance verification is left to the vendor
or community testers.
- 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 v6:
- Noted lack of physical hardware for throughput testing in the cover letter.
- Fixed a typo in the subject prefix of patch 2 ("fi:" -> "wifi:").
- Optimized the min/max search loop in rtw8822c_dac_cal_iq_search() by
starting from index 1 since index 0 is used for initialization.
- Reverted an accidental change that broke the compilation.
Changes in v5:
- Fixed a typo in the subject prefix of patch 2 ("fi:" -> "wifi:").
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
wifi: 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 | 155 ++++++------------
drivers/net/wireless/realtek/rtw88/rtw8822c.h | 3 +
2 files changed, 49 insertions(+), 109 deletions(-)
--
2.55.0
next reply other threads:[~2026-08-15 9:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-15 9:39 Arsenii Pashchenko [this message]
2026-08-15 9:39 ` [PATCH rtw-next v6 1/3] wifi: rtw88: rtw8822c: Use bitfield macros for DAC IQ sampling Arsenii Pashchenko
2026-08-15 9:39 ` [PATCH rtw-next v6 2/3] wifi: rtw88: rtw8822c: Convert DAC IQ calibration path to signed math Arsenii Pashchenko
2026-08-15 9:39 ` [PATCH rtw-next v6 3/3] wifi: rtw88: rtw8822c: Replace custom DAC IQ sorting with kernel sort Arsenii Pashchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1786784750.git.ulijg308@gmail.com \
--to=ulijg308@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=pkshih@realtek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.