Message ID | 20221015151115.232095-2-martin@kaiser.cx |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp679259wrs; Sat, 15 Oct 2022 08:13:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4LnNQ7MjTMhS9pAypX4ktqEoZOhVtekPpb6LjJOqQw77sUElQIpyJmI30wIn5giXdOV3W9 X-Received: by 2002:a17:907:9491:b0:78d:337e:580f with SMTP id dm17-20020a170907949100b0078d337e580fmr2369685ejc.464.1665846784410; Sat, 15 Oct 2022 08:13:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665846784; cv=none; d=google.com; s=arc-20160816; b=JzHN/q4Pt4X3s02NpHkTkIjGNi/fRqexwlF715Iiur//peF91rcR6u65tg/8yShk/0 40LutAEtO3Py7EME26vZx9BB+QVDmt0yKtk4yen5ME4N8hgdVQBM8zt5IES9W36TIXIK c+5sV9ou+ZU1mYkoW0WMy6VnSGPDDh/Xn1vLD4+keIsxK0j3f6OUWj8SSXVLBRs8+wsY XJROGjuof+LKnPrMp0J1jlc6U98zlFf2D49iJQLY1iT1jm59YktIX69ePugiK6Has4w2 ZKsLGtJBliO7eLusLSYOsu2RQ6Avxf9RcNkKXPrIrpdUvvvoo9F61/mKiaB2aI1wB2RN 6bjQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w5-20020a170906d20500b0078d2784552fsi4623929ejz.684.2022.10.15.08.12.38; Sat, 15 Oct 2022 08:13:04 -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 <rfc822;rhyswoolcott@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <linux-kernel@vger.kernel.org>; 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 <martin@kaiser.cx>) id 1ojip1-0006sp-Er; Sat, 15 Oct 2022 17:11:31 +0200 From: Martin Kaiser <martin@kaiser.cx> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Larry Finger <Larry.Finger@lwfinger.net>, Phillip Potter <phil@philpotter.co.uk>, Michael Straube <straube.linux@gmail.com>, Pavel Skripkin <paskripkin@gmail.com>, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser <martin@kaiser.cx>, 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746766957768398911?= X-GMAIL-MSGID: =?utf-8?q?1746766957768398911?= |
Series |
staging: r8188eu: led layer fix and cleanups
|
|
Commit Message
Martin Kaiser
Oct. 15, 2022, 3:11 p.m. UTC
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 <straube.linux@gmail.com>
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
drivers/staging/r8188eu/core/rtw_led.c | 25 ++-----------------------
1 file changed, 2 insertions(+), 23 deletions(-)
Comments
On 10/15/22 17:11, Martin Kaiser wrote: > 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 <straube.linux@gmail.com> > Signed-off-by: Martin Kaiser <martin@kaiser.cx> > --- > 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; > } I tested this also with a TP-Link TL-WN725N now and it works fine. Tested-by: Michael Straube <straube.linux@gmail.com> # InterTech DMG-02, TP-Link TL-WN725N
Hi Michael, Thus wrote Michael Straube (straube.linux@gmail.com): > On 10/15/22 17:11, Martin Kaiser wrote: > > 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 <straube.linux@gmail.com> > > Signed-off-by: Martin Kaiser <martin@kaiser.cx> > > --- > > 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; > > } > I tested this also with a TP-Link TL-WN725N now and it works fine. > Tested-by: Michael Straube <straube.linux@gmail.com> # InterTech DMG-02, > TP-Link TL-WN725N thanks for testing with yet another device! Good to hear that the settings work there as well. Best regards, Martin
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; }