Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2131329rwi; Sat, 15 Oct 2022 08:24:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM71ePWPSbVDRWqVSi5TsS2wcm3SydWr+v3m+MwBehb93k6dinR0ivZP1CfvBhrBwbjxKrLV X-Received: by 2002:a05:6a00:2185:b0:520:7276:6570 with SMTP id h5-20020a056a00218500b0052072766570mr3367767pfi.84.1665847440390; Sat, 15 Oct 2022 08:24:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665847440; cv=none; d=google.com; s=arc-20160816; b=m7XKXyaV7iFTwR2WvxdzQW1D4dYCbh7huxpM9mROD7jbtkKRpbzvW34l9pt0tiajzp wmn9J5kY9EGjeCQSyB1lDC9SVskkD/vriVFKyMDBZJmLYAw8AO3xWZwHFhao4VDy7ifC 0cYuAylL8PmTdb29Ytx6Sr0fIks+WufC0RRknmq/vUJJRoDQduOywrQ6ZmVj2t1rcL2G pr8PimjbKQN+3qxXRrqPsN8w+M+Di4gld5Q/fR8lYt5wCNexCVKxMeOTCgvi6iQ3/GjL Gsv3TZHtsSfsz9yd0NTR6qOchpeUnt/C4NTwmYTNhN0BA6W1BMVO79ZBUisAezhX2jFc ZTDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=vuJA+TZ3HNUdjNK5IhfSOrstxbZmkOZqERVEnOtXl2M=; b=DdMQ6FzCL/k5Y6eexoemhDM50Dhlo+el1JhWX8CJG96DV81N0lEe1jsCtHtP6Ligog h7F4tTHfmaM5N03qnER7rm4yLK9fB3LvvmB7p0++9587JKvwknRit+ojyaOdZHbDLxi7 UwgWW7XLilvWOdrqxGKWwBj6IjQkX7qT+1p82z19ereM/Mc1xnE0zjPAgQ3p1kqbyK+P UBbJOG6c0V7yu1u8haQhJzD8FAdN5gSDndPDSGZ1lEdiiMY3vPdV//+SYQ5hEovBqWnh EspI9JDzE3ZNwNoIdNpdrt47XfXIhO5eXV2ow52wFpCKDvDXxL6Y+99i7o4QHP5DKL9o UMsg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 19-20020a630413000000b00439d071c11fsi5632462pge.118.2022.10.15.08.23.48; Sat, 15 Oct 2022 08:24:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229766AbiJOPLj (ORCPT + 99 others); Sat, 15 Oct 2022 11:11:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229764AbiJOPLg (ORCPT ); Sat, 15 Oct 2022 11:11:36 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A517422E1 for ; Sat, 15 Oct 2022 08:11:35 -0700 (PDT) Received: from ipservice-092-217-066-135.092.217.pools.vodafone-ip.de ([92.217.66.135] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1ojip1-0006sp-Er; Sat, 15 Oct 2022 17:11:31 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser , stable@vger.kernel.org Subject: [PATCH 01/10] staging: r8188eu: fix led register settings Date: Sat, 15 Oct 2022 17:11:06 +0200 Message-Id: <20221015151115.232095-2-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221015151115.232095-1-martin@kaiser.cx> References: <20221015151115.232095-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Using an InterTech DMG-02 dongle, the led remains on when the system goes into standby mode. After wakeup, it's no longer possible to control the led. It turned out that the register settings to enable or disable the led were not correct. They worked for some dongles like the Edimax V2 but not for others like the InterTech DMG-02. This patch fixes the register settings. Bit 3 in the led_cfg2 register controls the led status, bit 5 must always be set to be able to control the led, bit 6 has no influence on the led. Setting the mac_pinmux_cfg register is not necessary. These settings were tested with Edimax V2 and InterTech DMG-02. Cc: stable@vger.kernel.org Fixes: 8cd574e6af54 ("staging: r8188eu: introduce new hal dir for RTL8188eu driver") Suggested-by: Michael Straube Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_led.c | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188eu/core/rtw_led.c index 2527c252c3e9..5b214488571b 100644 --- a/drivers/staging/r8188eu/core/rtw_led.c +++ b/drivers/staging/r8188eu/core/rtw_led.c @@ -31,40 +31,19 @@ static void ResetLedStatus(struct led_priv *pLed) static void SwLedOn(struct adapter *padapter, struct led_priv *pLed) { - u8 LedCfg; - int res; - if (padapter->bDriverStopped) return; - res = rtw_read8(padapter, REG_LEDCFG2, &LedCfg); - if (res) - return; - - rtw_write8(padapter, REG_LEDCFG2, (LedCfg & 0xf0) | BIT(5) | BIT(6)); /* SW control led0 on. */ + rtw_write8(padapter, REG_LEDCFG2, BIT(5)); /* SW control led0 on. */ pLed->bLedOn = true; } static void SwLedOff(struct adapter *padapter, struct led_priv *pLed) { - u8 LedCfg; - int res; - if (padapter->bDriverStopped) goto exit; - res = rtw_read8(padapter, REG_LEDCFG2, &LedCfg);/* 0x4E */ - if (res) - goto exit; - - LedCfg &= 0x90; /* Set to software control. */ - rtw_write8(padapter, REG_LEDCFG2, (LedCfg | BIT(3))); - res = rtw_read8(padapter, REG_MAC_PINMUX_CFG, &LedCfg); - if (res) - goto exit; - - LedCfg &= 0xFE; - rtw_write8(padapter, REG_MAC_PINMUX_CFG, LedCfg); + rtw_write8(padapter, REG_LEDCFG2, BIT(5) | BIT(3)); exit: pLed->bLedOn = false; } -- 2.30.2