From patchwork Mon May 27 17:34:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marcin_=C5=9Alusarz?= X-Patchwork-Id: 13675666 X-Patchwork-Delegate: pkshih@realtek.com Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (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 C1BD915ECD3 for ; Mon, 27 May 2024 17:35:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716831324; cv=none; b=sFbL2SzG30kiFvwOdrRaeoY+271G9bcIgF/5OhlybfK38gFlNfxxn6+fmQdBsMUFq3G38p+QcRU7XPPW19hDKt2iq/fw8QzLM3Z4HDeC+0VpGVGzbt7t1wdj4zwkjDC7svNniN02wSe/EVR5yrN3zehgwzJjkO6hpTz1dcmWOcI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716831324; c=relaxed/simple; bh=vmkBx41QPRyI/Cv9jjYcdOjxzmIMb4pAj4PBcs0mQ+U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=TSWEMP9K4r5JL1AEkN/z82tRF7uS7pMIZVBNUSALbIMkIxdU/v3ia2bR/kj8XvDJIBlSVoiBgOnuRj84FLQqBMrNqdRIJB5SiAB3VgRK5LQh4BJ4uO3DGH1158IW/4xYrbdmmtDf1wtgmEgYWSs0itYJjUyiRqfxRSh83d2PRhw= 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=VpGDTjTQ; arc=none smtp.client-ip=209.85.218.46 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="VpGDTjTQ" Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-a62769075adso2299566b.3 for ; Mon, 27 May 2024 10:35:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716831321; x=1717436121; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=251TBfsIxkSVquIpcr4ttLdo5hooDJoQtJnRIIO3trE=; b=VpGDTjTQUVl8Bxm3DDDdqWUs2sU7b0MK7guOy30ClkOIqq2BboZWQzocFrG3QlPKd+ SNX8HsEOT1V74gfmuCei4Ptv3WQzM56OJhzx0Ie/NAI9RAf9zxhCjhEJnHsZSjmVKZ7+ /g6a+B3MZaR+8d/++2+/Yxb1Mf4g2wVzEuDX4OMAoT8HvNgelaGu9zq15FUU90lNurSx e1hNQAMvoJIwcfWP9hDHajAKLUUomijTfBr6sWTKwD9hkdO1teXysPNVq16WYPOVPVGQ nZhr+hACDJe7k0SvC4q9my1vFaalzb9Hmp33xn45VwF7GKabJvQfsoP0EKt4CmXHfnAR 3eyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716831321; x=1717436121; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=251TBfsIxkSVquIpcr4ttLdo5hooDJoQtJnRIIO3trE=; b=NxGsAdwMZN8lH7TjfnFgGcwSrptCyhCHLVcX6hx91gtlp0aT0MK5OOHh4uMTJewnsv TrZCg/pwHBiyjQQ4VY0AmiDc4QtYE1Avq1VqeYP+39qDyhnc47TQ/kJ8drIoJtk+mT2O pp2hD+7FVG76JXb61LN2x4HeGyXkYtfJXb5L1q82Cx1xS3+PImdBT36Tjpwkj3YPMSt7 FyE4l5NtpKJvBy52yP61RVitaz5HKshfeIrJqt7OhHOzcZgLnGu3QytRSv9uh5eqRDDI vASBo9DVhP+u4tLGMt8G0W8Kqzdt3/JpBKRbZjZ0m1p/TKzYkTzGnqlXeTiBiZbaFvJz H08w== X-Gm-Message-State: AOJu0YwDMml2CwUUdMms0jo/obuMV+nb7abDYD7SRh9k89bIm2AL7os5 HIQOCrB3qFtdH5D9ALP/hNKmR8p98hCnJvRX6AOQaiUPuEwEe+JzZlZ+WGLb X-Google-Smtp-Source: AGHT+IHa/gWs7IG7jWDDpeGmExw92YC/mYxKIW9YifPdkbuEzvfTDZvIfiLC/NeOxznFiwinqSYt3Q== X-Received: by 2002:a17:906:640a:b0:a59:bae0:b12f with SMTP id a640c23a62f3a-a6264f162b5mr645830566b.57.1716831320787; Mon, 27 May 2024 10:35:20 -0700 (PDT) Received: from mslusarz-hyperv.mshome.net (1779df417e104.rev.snt.net.pl. [213.192.104.90]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc500a1sm512070466b.125.2024.05.27.10.35.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 10:35:20 -0700 (PDT) From: =?utf-8?q?Marcin_=C5=9Alusarz?= To: linux-wireless@vger.kernel.org Cc: =?utf-8?q?Marcin_=C5=9Alusarz?= , Ping-Ke Shih , Larry Finger , Kalle Valo Subject: [PATCH 1/2] wifi: rtw88: use RTW_FLAG_RUNNING for deciding whether to enter/leave IPS Date: Mon, 27 May 2024 19:34:53 +0200 Message-Id: <20240527173454.459264-2-marcin.slusarz@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240527173454.459264-1-marcin.slusarz@gmail.com> References: <20240527173454.459264-1-marcin.slusarz@gmail.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Marcin Ślusarz Needed by the next patch that disables power off operation for one chip. Signed-off-by: Marcin Ślusarz Cc: Ping-Ke Shih Cc: Larry Finger Cc: Kalle Valo Cc: linux-wireless@vger.kernel.org --- drivers/net/wireless/realtek/rtw88/ps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/ps.c b/drivers/net/wireless/realtek/rtw88/ps.c index add5a20b8432..f9fbc9b3174b 100644 --- a/drivers/net/wireless/realtek/rtw88/ps.c +++ b/drivers/net/wireless/realtek/rtw88/ps.c @@ -26,7 +26,7 @@ static int rtw_ips_pwr_up(struct rtw_dev *rtwdev) int rtw_enter_ips(struct rtw_dev *rtwdev) { - if (!test_bit(RTW_FLAG_POWERON, rtwdev->flags)) + if (!test_bit(RTW_FLAG_RUNNING, rtwdev->flags)) return 0; rtw_coex_ips_notify(rtwdev, COEX_IPS_ENTER); @@ -50,7 +50,7 @@ int rtw_leave_ips(struct rtw_dev *rtwdev) { int ret; - if (test_bit(RTW_FLAG_POWERON, rtwdev->flags)) + if (test_bit(RTW_FLAG_RUNNING, rtwdev->flags)) return 0; rtw_hci_link_ps(rtwdev, false); From patchwork Mon May 27 17:34:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marcin_=C5=9Alusarz?= X-Patchwork-Id: 13675667 X-Patchwork-Delegate: pkshih@realtek.com Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (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 D910E15ECD3 for ; Mon, 27 May 2024 17:35:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716831328; cv=none; b=O+OoWz3nhguvFzRpJk5p9m12mzKNNRnntLn3mb171AU9/TcvWsULgM+lo9EmeLFpkWNJpmU3dV19/ImK8uklAj9nf+fdTMlef/yFkpQiHqZMukIRH/jipu2Qv4UvTIKmE/2ZsPwXsRics/fI0AdTVvoR4yZ793B7Fh/50jrq7tg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716831328; c=relaxed/simple; bh=68yIhEvb9FjH6f0sGFez019la9iLBE+u0nLfuW0IJOI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=lsGQmYKHVpcIdguOaSOvvrI5tYsfDcXmtTWu0ThyKqYyytEtmG1q7UWeqYaz2/LHII4WabnmDHBObmgsIgiokcDBVLtz49bymq72/Op71YTjczhDBVU8tcWNxmamMOU2AonJe/ft6HLQwXHcn3o+2GAnP1Ey5Asx+K9/5bPa3ys= 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=BKn7GVh3; arc=none smtp.client-ip=209.85.167.46 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="BKn7GVh3" Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-529614b8c29so5329945e87.2 for ; Mon, 27 May 2024 10:35:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716831324; x=1717436124; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ebfJZ8PwhlH8q5JiE5pvjuHAQWR0IKg+SwzFXyu6Wqc=; b=BKn7GVh3KHvuFsiq6dR3IsYU54VhZIq34ld1Tex4jHvfL3M/7q2JZlyRpJ5Npx1h2I yEh3Ef/rQsqQ4h7SzwW0YyO3I5ekbKDUaDfRLpmD7DARcKMGmIoC128Vm/QcIyD+fQFa do6DgYGQmWwzZ48PIWZkcaJPMgKCPGlxvh4AvFJWEZRS6HtOA96xnN9qzoIur2r8Hp4F wBAYiC69we9b5xsIB9nlVh9GSKLwJ9a+zK1+AIy/6aKtOYqxxULQmaun+a//TOo614dD WQMagbr9LEZYIiTLjsbCAXZrzteCy/UMVgm1nAlGGJgy4hpv/iFJeILYhZNUx5OgfBXV Su1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716831324; x=1717436124; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ebfJZ8PwhlH8q5JiE5pvjuHAQWR0IKg+SwzFXyu6Wqc=; b=K0Jh+NFKVchyW/ppYquRuQVU6MYL3Ei3TrF4IUUm+I5Z0NNhMaSTiA4WBSewDuRNBx q/j+BRsoA/Ov9iolrflwit0TR4IbheZCBviDGv9hbgr63gL8EJ03AiMOMTVbQ6cnnR8i uBPAlxFY3KuPIwh4pt7CT5hfHbhgairgXonyFoVsB8cCEm8mzDmP8t6HAE3IZurQTqdo NsZ3tsIlBabk8x9EDpFywdgKxEePJH6S4SiYkeXaUS62d34xHp1s2MfSe5cLrzkjsdcS c5hHqOq+6Rwarrwr9CZSIUcN003uI1ExmSscOdfwM6BUBzRiIgrpd5+63xnVjTXgkiqa xOLg== X-Gm-Message-State: AOJu0YzafGwP+ZzVAuTW6SfZm8QfB9O9SqbwB7qDJC0eavBwXFMDZDu5 o9esNrMDWL8Pho9ag2ilCk9IOU3x7DbEcVcKUOF8wopPYEsp3DTdJ20bba7z X-Google-Smtp-Source: AGHT+IErFSVUj4tVBJWqlaEVajfGy3grjY5JvnwAUd1RQtw49FABpAdVH/MhPYi8NPDvGoWFqCh+ZQ== X-Received: by 2002:ac2:561c:0:b0:51f:5d1a:b320 with SMTP id 2adb3069b0e04-52967f06cd4mr7572562e87.68.1716831323517; Mon, 27 May 2024 10:35:23 -0700 (PDT) Received: from mslusarz-hyperv.mshome.net (1779df417e104.rev.snt.net.pl. [213.192.104.90]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc500a1sm512070466b.125.2024.05.27.10.35.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 10:35:23 -0700 (PDT) From: =?utf-8?q?Marcin_=C5=9Alusarz?= To: linux-wireless@vger.kernel.org Cc: =?utf-8?q?Marcin_=C5=9Alusarz?= , Ping-Ke Shih , Larry Finger , Kalle Valo Subject: [PATCH 2/2] wifi: rtw88: disable power offs for 8821C Date: Mon, 27 May 2024 19:34:54 +0200 Message-Id: <20240527173454.459264-3-marcin.slusarz@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240527173454.459264-1-marcin.slusarz@gmail.com> References: <20240527173454.459264-1-marcin.slusarz@gmail.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Marcin Ślusarz This chip fails to reliably wake up from power off. After some number of power off+on cycles, it stops with endless spamming of: rtw_8821cu 1-1:1.2: rtw_usb_reg_sec: reg 0x4e0, usb write 1 fail, status: -71 killing both Wifi and Bluetooth part of the device. On arm, just leaving the wifi device unconfigured kills it in up to 20 minutes. If I keep restarting wpa_supplicant I can trigger it within a minute. Looping "ifconfig wlan0 down; ifconfig wlan0 up" also triggers it within a minute. On x86_64 system the only way I could trigger this was via ifconfig loop, but it took 3 hours and 20 minutes to do it. The only thing that "fixes" the device is replugging it. Signed-off-by: Marcin Ślusarz Cc: Ping-Ke Shih Cc: Larry Finger Cc: Kalle Valo Cc: linux-wireless@vger.kernel.org --- drivers/net/wireless/realtek/rtw88/main.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c index 7ab7a988b123..e8bfa683d7bb 100644 --- a/drivers/net/wireless/realtek/rtw88/main.c +++ b/drivers/net/wireless/realtek/rtw88/main.c @@ -1482,11 +1482,11 @@ void rtw_core_scan_complete(struct rtw_dev *rtwdev, struct ieee80211_vif *vif, int rtw_core_start(struct rtw_dev *rtwdev) { - int ret; - - ret = rtw_power_on(rtwdev); - if (ret) - return ret; + if (!test_bit(RTW_FLAG_POWERON, rtwdev->flags)) { + int ret = rtw_power_on(rtwdev); + if (ret) + return ret; + } rtw_sec_enable_sec_engine(rtwdev); @@ -1534,7 +1534,9 @@ void rtw_core_stop(struct rtw_dev *rtwdev) mutex_lock(&rtwdev->mutex); - rtw_power_off(rtwdev); + /* FIXME: 8821C doesn't wake up from this state from time to time */ + if (rtwdev->chip->id != RTW_CHIP_TYPE_8821C) + rtw_power_off(rtwdev); } static void rtw_init_ht_cap(struct rtw_dev *rtwdev,