mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michael Straube <straube.linux@gmail.com>
To: Martin Kaiser <martin@kaiser.cx>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
	Phillip Potter <phil@philpotter.co.uk>,
	Pavel Skripkin <paskripkin@gmail.com>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, straube.linux@gmail.com
Subject: Re: [PATCH 01/10] staging: r8188eu: fix led register settings
Date: Sun, 16 Oct 2022 11:13:22 +0200	[thread overview]
Message-ID: <c8c03bd1-9fa4-fc79-d4fe-727753e1df2c@gmail.com> (raw)
In-Reply-To: <20221015151115.232095-2-martin@kaiser.cx>

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

  reply	other threads:[~2022-10-16  9:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-15 15:11 [PATCH 00/10] staging: r8188eu: led layer fix and cleanups Martin Kaiser
2022-10-15 15:11 ` [PATCH 01/10] staging: r8188eu: fix led register settings Martin Kaiser
2022-10-16  9:13   ` Michael Straube [this message]
2022-10-16 16:22     ` Martin Kaiser
2022-10-15 15:11 ` [PATCH 02/10] staging: r8188eu: handle rtw_write8 errors in SwLedOn Martin Kaiser
2022-10-15 15:11 ` [PATCH 03/10] staging: r8188eu: fix status updates in SwLedOff Martin Kaiser
2022-10-15 15:42   ` Pavel Skripkin
2022-10-16 16:21     ` Martin Kaiser
2022-10-15 15:11 ` [PATCH 04/10] staging: r8188eu: SwLedOn needs no padapter parameter Martin Kaiser
2022-10-15 15:11 ` [PATCH 05/10] staging: r8188eu: SwLedOff " Martin Kaiser
2022-10-15 15:11 ` [PATCH 06/10] staging: r8188eu: remove two unused defines Martin Kaiser
2022-10-15 15:11 ` [PATCH 07/10] staging: r8188eu: don't include rtw_led.h from rtw_cmd.h Martin Kaiser
2022-10-15 15:11 ` [PATCH 08/10] staging: r8188eu: remove padapter from struct led_priv Martin Kaiser
2022-10-15 15:11 ` [PATCH 09/10] staging: r8188eu: set two more state variables Martin Kaiser
2022-10-15 15:11 ` [PATCH 10/10] staging: r8188eu: summarize tx/rx and scan blinking Martin Kaiser
2022-10-15 20:22   ` Philipp Hortmann
2022-10-16 16:07     ` Martin Kaiser
2022-10-16 18:45 ` [PATCH 00/10] staging: r8188eu: led layer fix and cleanups Philipp Hortmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c8c03bd1-9fa4-fc79-d4fe-727753e1df2c@gmail.com \
    --to=straube.linux@gmail.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=martin@kaiser.cx \
    --cc=paskripkin@gmail.com \
    --cc=phil@philpotter.co.uk \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®