From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 688274248BB for ; Thu, 13 Aug 2026 06:52:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786603972; cv=none; b=YFZUr+3BqxMPU2Ql20V8L7gHLALwalXMSyw5Sw7QXZoSrHj52yXJ+hmdMiIZS7P4FWwrq7C00VGPwolryfslQqGYp4Rh+cuDMUv+/F9P8Huf9t32otmwoxbHGGhljREsOh2BlTxdJa00i88hGigXO48Ls+v3Tkw7gL3DiN8PtXA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786603972; c=relaxed/simple; bh=Sk99J0H/Z9nrU3stku+BhkRc1rZCLnM0D8arqBxdvM4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=fIJLiNQ+YyhYQFO7b0UyRJZGD6am0HLNp7wdE/CbYkzf3cHW4t2hucWLevXSJe7OWVD7I1iJWrGn4G2NM5WRIsVFr9MA0s/3xB25C93HHJzNZBwIkiwQY7fErRLsi1nizuIcAV/YmbdX3igDWf3nH7LxD7NYkLxHXYt3tDcqe2E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=E0pZG601; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="E0pZG601" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-5b01146b205so318112e87.2 for ; Wed, 12 Aug 2026 23:52:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786603968; x=1787208768; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=w5MJXBWLUZITB4uTg9L/4D9nTZBNcUiWYYsAhymg8X8=; b=E0pZG601oSSliLe0CElLEND+lC5+puUIFIwTn0hpwyKwsHVWRUYWw2zcjRv9JQNosH n//bJRy65ClTMP1QztoR9TJpwd8gaDjs6J7WL98G1TAVvzeHDWxjH8GChn+9LLuIKpII YgKW4IEend8lGYqQOdxdKMfsPZ3vffDsoS/J54MaKjZmK6JN8yknvQpKnTnG1f0g0tfY ZSv+iIgUL0OZbeRgL5NHHi4tC+CuMEbYQXQ2iSqL5nwO7iDzyViN/fX7tHyG8LbtJrfO SyuuXg4rnZMLEYHV8nYa/ZWv3qQdYos7F04P1oPt7IgmioD3WCleWPYukkTsRcc3LBBM vx+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786603968; x=1787208768; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=w5MJXBWLUZITB4uTg9L/4D9nTZBNcUiWYYsAhymg8X8=; b=O29WUVEWXzheIuOY5dSAcw2txN68Qsrb7qlRgg8O7f/NMluMN0DgDTTDh/un9UVp6C ekqYls+yTORmAonpjmWAzfCJRfGwa8RMIGzCn79BFP3+m3L3L/aJ6i+xr+wQ9pj4aM1p b73MJIsA5DCmtzv7c7qxAl6eXt6IScay56RK/wdzee90rfdzw6A4MMQeu030IY62knam dvYCzka268LQahjclSadjUirAMvGUSFBaZjOJ4S0gyvRrtO7qsWi2WBR5IS5QdFWWdNo NeSf0TPBrb46btlFyZLAF6PomxZQNAyDgLe17V/ufVMVf5I1qjfw27b4IUjbSqjxbXaL QerA== X-Forwarded-Encrypted: i=1; AHgh+RpjVFp9zJ1bMxG6paj+vwvy5OiDQxGWpd4F9aDWfDmZNhb7iO95NTG1oXtb5LiwqAd9YzrS1sM8Jissn24=@vger.kernel.org X-Gm-Message-State: AOJu0YyfcKlj0/yaDkQ1Pq6ALCh5D69B6bbcSTKnTembDbV6m9IYKACx kb7HBbJBT+OORnpwl7VgaubNPvWZHmeMELJH7VWzsjIIVGGA+RwHH0Df X-Gm-Gg: AR+sD12GIwpYWb08y1OeZe/xvmhJUhsTh3SWnNi9x+RPwcguWc2F84LWqy6J+gzOfl6 DSF4G2F/FMEu5UTOZmzaDiltk4g0h8acq3wm1fzDtt3EJRlGZcNLYwmxcnttq14OLlKkimMe9VV K2x+YHal1w4G8warw2ydEDf+mJfVYZDyr6Tx2MTQe1bMw87TVMOF4EtfrIN/PMHbT7W+w/3b7k8 Iz62rfP7spufVBxUZBASg/0d7mT/Ue1x9q9yNfngN2KOsj6cfB4QLC1+mGZIyL6ziTdEMhPqi9Y CXYu/QncVuVx7ha8c5BmuT8HrN98VfclUQ7+piLqTekMi5+wP5+qK5kXpR4iW6Vqn49odzDYvUS 6LStznwHWWF5H5E4oXGxj8n5kCPUMCmozq/WVkrZAKYx/uDmjBHmkNCKN5MXgiFMANjntyl+ufG GU07wTMJVVnDxhEAYW8u+ODwa81ZwOu3kfxAkjmslZToqN4TfngE5JSBDs9aOm6cR8uKMHFfHSy 0ZMVdNttYjW5Lb6voxJRDV7FYSgaq3Xr2GMGAf+3tqUs6BGUvvY0GrPHsKKqg== X-Received: by 2002:a05:6512:1096:b0:5b0:22a6:6b13 with SMTP id 2adb3069b0e04-5b453cfb311mr484198e87.0.1786603968024; Wed, 12 Aug 2026 23:52:48 -0700 (PDT) Received: from archlinux ([94.180.96.85]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5b453a54adasm270076e87.38.2026.08.12.23.52.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2026 23:52:47 -0700 (PDT) From: Arsenii Pashchenko To: pkshih@realtek.com Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Arsenii Pashchenko Subject: [PATCH rtw-next v3 0/4] wifi: rtw88: rtw8822c: refactor DAC IQ calibration to s32 Date: Thu, 13 Aug 2026 13:52:31 +0700 Message-ID: X-Mailer: git-send-email 2.55.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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. --- 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 (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