Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp46090pxu; Tue, 5 Jan 2021 04:56:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJzSt4lO2h+s786hwtbHRBYkWnxQU8S9i54MsvJs0gmbU1LuDWShZ9iKFWoHuUFcuFFAbzVm X-Received: by 2002:a50:d604:: with SMTP id x4mr22411034edi.64.1609851364537; Tue, 05 Jan 2021 04:56:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609851364; cv=none; d=google.com; s=arc-20160816; b=nFi8wXMLVuOzH4f7RK2cEhW3pOT5y8I7IBsz5LCzMOSl4LtTIrU7o135oc6BE0a9G7 F0Il2CDLoeIiAJmWrJeKwg89M1CFGQJ6X1kRTOkfen3aFKKDxyEDvvYO472vsiBGy0Fg qF2CoPzkIx0X4unVLibwLT1rB44+S44+67VRIC+vmJXL9hKTB6OpZRJNg9NB+SYyjlk6 SSYDpN8gogoqYzSyg2AE7nCaS9JEifejgEAq1VwoPCqC1ed/dZTs/Icpm+YCoNkzopj1 dzjLwZVJb8RYlQBzlYXbvbs5z5sgsBTCPXsXkUnoz2taSxJwkTDNoTWMgqlkJwSh6il2 Sp2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=L6Y5gGLBliT6tp0pk0j5c4CjnRvwHm3tfXqS+wY8pBY=; b=im7TnyLlLhoom0ZY3prAtadBTRugJWjT/IP1sz5FuVXZRJYuoGAwlN/p0awURhEwJr k4QOtcCKIYf+klkvNuwVdC/9PMkSxITxkwJqo23rpVz3YHreU2j88IBJewXr2LeJTY/Q N4vqQapta2YfUMD2Ov9ci3Ehn9Jb2ahDLsANSyrw3M13AyH8Tc1BF0EpOCMiIILcGCSz AxlujQImcTpRumQORRW00kvcAhqzFf1wTGKanHIbl/N7APN5TjkzAJ4nBuqWPaNHaJT5 /tkhuLIUe4N1NgmehQ6p2SnInT04DXr1YjRXqRMnM2lxsstDgmQODjIeYgJtRMyKP8Ln N6zQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v8si30273323ejj.305.2021.01.05.04.55.41; Tue, 05 Jan 2021 04:56:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726059AbhAELbq (ORCPT + 99 others); Tue, 5 Jan 2021 06:31:46 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:48053 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725769AbhAELbq (ORCPT ); Tue, 5 Jan 2021 06:31:46 -0500 X-UUID: a5ed39f2b3f34cc783d892a047b1ad4f-20210105 X-UUID: a5ed39f2b3f34cc783d892a047b1ad4f-20210105 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1135770502; Tue, 05 Jan 2021 19:31:00 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 5 Jan 2021 19:30:58 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 5 Jan 2021 19:30:58 +0800 From: Shayne Chen To: Felix Fietkau CC: linux-wireless , Lorenzo Bianconi , Ryder Lee , Evelyn Tsai , linux-mediatek , Shayne Chen Subject: [PATCH 2/4] mt76: mt7915: rework set state part in testmode Date: Tue, 5 Jan 2021 19:30:43 +0800 Message-ID: <20210105113045.17815-2-shayne.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210105113045.17815-1-shayne.chen@mediatek.com> References: <20210105113045.17815-1-shayne.chen@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This is a preliminary patch to simplify setting state in mt7915 testmode, for adding the new continuous tx state. Signed-off-by: Shayne Chen --- .../wireless/mediatek/mt76/mt7915/testmode.c | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c b/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c index 6f6e02038c6d..e5af42c70e12 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c @@ -395,9 +395,8 @@ mt7915_tm_reg_backup_restore(struct mt7915_phy *phy) } static void -mt7915_tm_init(struct mt7915_phy *phy) +mt7915_tm_init(struct mt7915_phy *phy, bool en) { - bool en = !(phy->mt76->test.state == MT76_TM_STATE_OFF); struct mt7915_dev *dev = phy->dev; if (!test_bit(MT76_STATE_RUNNING, &phy->mt76->state)) @@ -502,16 +501,15 @@ mt7915_tm_set_state(struct mt76_phy *mphy, enum mt76_testmode_state state) mphy->test.state = state; - if (prev_state == MT76_TM_STATE_TX_FRAMES) - mt7915_tm_set_tx_frames(phy, false); - else if (state == MT76_TM_STATE_TX_FRAMES) - mt7915_tm_set_tx_frames(phy, true); - else if (prev_state == MT76_TM_STATE_RX_FRAMES) - mt7915_tm_set_rx_frames(phy, false); - else if (state == MT76_TM_STATE_RX_FRAMES) - mt7915_tm_set_rx_frames(phy, true); - else if (prev_state == MT76_TM_STATE_OFF || state == MT76_TM_STATE_OFF) - mt7915_tm_init(phy); + if (prev_state == MT76_TM_STATE_TX_FRAMES || + state == MT76_TM_STATE_TX_FRAMES) + mt7915_tm_set_tx_frames(phy, state == MT76_TM_STATE_TX_FRAMES); + else if (prev_state == MT76_TM_STATE_RX_FRAMES || + state == MT76_TM_STATE_RX_FRAMES) + mt7915_tm_set_rx_frames(phy, state == MT76_TM_STATE_RX_FRAMES); + else if (prev_state == MT76_TM_STATE_OFF || + state == MT76_TM_STATE_OFF) + mt7915_tm_init(phy, !(state == MT76_TM_STATE_OFF)); if ((state == MT76_TM_STATE_IDLE && prev_state == MT76_TM_STATE_OFF) || -- 2.29.2