Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp583531lqt; Fri, 19 Apr 2024 05:02:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWsQXjuOkzY5JNw1ySIula0ceNDkkwdt3yEZctkIA2/nRv7+QChD02bhFQa6w+dkWwstJhM89z/uYlTEgD50yJXawLNR8jjaNTjZNhZqA== X-Google-Smtp-Source: AGHT+IFua8sS7iue9OiQMA/9hmEXmeAftejleAPYj9zMtKXCANUtc9mcH6V16CuY1bR346IzycKY X-Received: by 2002:a05:622a:19a3:b0:437:1f7:e9e9 with SMTP id u35-20020a05622a19a300b0043701f7e9e9mr2141901qtc.24.1713528130082; Fri, 19 Apr 2024 05:02:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713528130; cv=pass; d=google.com; s=arc-20160816; b=mrr7PR34LvjV7243G+HP7P8mvEaG7u2vqzuP3v9wtovIXW4ziE4Zc9zDbb/fz1HSrc rz8Wi/xTD66Sc0Jt3ven/aGKNyrrkLnTLO7KNMP24PqgdZ9rrttqURDZUdUuJeAN1Kty C6Jq/Pz9G4tb3KJSRtHzt8M5XO2jcygpY5CDe8ZyHpEQ+jdyq2+CZB+4cRv5ABBGvwBF nx92uNz3IfYFqNnzCl6aiOKkPKTH5GL7u46QIdIXoHjs+A4qg90qywQsr1rzdc7U4bc8 gaAOUmZ6KGIMqj+EAMbyjfa4NMqc/ZIshQxtnGjqDC06wQKtn4LDEwF49SGsY9Q5Co2n pTOQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:cc:to:subject:from :user-agent:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:date:message-id:dkim-signature; bh=/VnJJkejOTaCErEeemJEUgt5nOCBUvxwcNGMkliGyXA=; fh=SnuNAHeD2CDeWEwrWsbpHM1muWDT7gSAURXCbGYnCtk=; b=rpdgikb5A45/SSaHfykO4y/DGEtjivhPXDqIgeYmVYv/aCxkXyULjkC5uj8ogmDC1S 0yzoYNiKQ7cwLvxGHOO/vXlmJwn8ZATJWGwGS4wFzKCWhk9r9Ju4U4p82iZ+D8USeuPs RXiMIrlPBhc3Y9YohMHkrTmgrClU6L4HEU1ivZ9bJMPxAYMM6nffWudE/ojWAWFMyA0i yjh62oyGJyVTvRbha+cYnxOBGiqq34vCEcr72GPg/X6u9ha0dgdehTnZAup/jQuES42g krlf99wLq//CMmd+bkbKV/WVgs1pVWZw5SzBNEwxGSq2vMeG0wbzEJ74veGXrasxG2Lz H9Bw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BOUWztyH; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-wireless+bounces-6567-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6567-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id hf25-20020a05622a609900b004366340b380si3743048qtb.270.2024.04.19.05.02.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 05:02:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-6567-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BOUWztyH; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-wireless+bounces-6567-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6567-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6D1F71C2040E for ; Fri, 19 Apr 2024 12:02:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B723983A09; Fri, 19 Apr 2024 12:02:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BOUWztyH" X-Original-To: linux-wireless@vger.kernel.org Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (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 15FC68121F for ; Fri, 19 Apr 2024 12:02:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713528125; cv=none; b=TyHj3XypwcUJw8CRc2XbLN5p5h3ETIErWv9vSZzllYg5OgIAdhGAkN2SRj89GUU7JxvDeioh9wzySm0rZaRDrs0ICT8aN4MzlqWRQXlfVpQUKZmaij+VI/EW/srjL58qnE35omDiURx42Su9xHoTy+Cjl6OBP6XrtIf4oOLMdnY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713528125; c=relaxed/simple; bh=dy4psp5CrOuKFTsF+lf42ngogDtUf1sVitk5/D2tRqo=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:Content-Type; b=loPPen0U6SzJaeXLO3lRCVF2TjIjXSRATD++tOpUYTyRHp42r/GVsx/BNKS0GRLcWmeyueLSelXPFYRWA8zaIk2DKCNE33gK7CxNXtg9FZXTEWb1R1wIDFEESf8ITGwuIfbifXpGll/IcqnZ1GPOIC9M2e4BIqJ0YOvTDoEuz18= 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=BOUWztyH; arc=none smtp.client-ip=209.85.218.49 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 Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a51a1c8d931so206796066b.0 for ; Fri, 19 Apr 2024 05:02:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713528122; x=1714132922; darn=vger.kernel.org; h=content-transfer-encoding:content-language:cc:to:subject:from :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=/VnJJkejOTaCErEeemJEUgt5nOCBUvxwcNGMkliGyXA=; b=BOUWztyHSfDGkKHNiONJsXgiulozXGSfA/jDhGOWub4dzc08wjvIikc6uk4JEcYnzv xHu0HyONM82DOPIYufaSRSYuu4E8yxzA4NQ9SAbMrOBDOBRPDy//lmUYzU0ZosGpMO3S 0/UhGg38IZ4/p+XX9IWmxI/MobTZ7dGChspvclOunyp0Df7lLWKayPE5lrKj8f26Lwwe ptJNvIb4TgrUGRCaTRVsSLEWMmW8FdUHRpBK0ka7UrIbrfUZQL3PgptWY4LaiptKntK2 bIqLujhcGy1/iueT2lfMNE+18G6LpTQP4/AhVkFPnrwJmEMzXfBUpuLZ8FQMpcji9AOx aGjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713528122; x=1714132922; h=content-transfer-encoding:content-language:cc:to:subject:from :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=/VnJJkejOTaCErEeemJEUgt5nOCBUvxwcNGMkliGyXA=; b=WHIfFmLl7OvCEgREMla93NXBDNS6UOzxewZ/jZDHFD27II59M4uv1GikHQkiz45Ic/ 3tpYvWVGyCEuTK2qTxxootVyOOKBopg4KJ1l1bOunEmxQPbABBWnJ6g9nfPWbMtGfCVx q6wicmX2BqPM1XD8t1yaQ4plOTH9WUFIQ5ALYEH2UhYTv0JF56lF6OLTNiy05bi/gkAn XwyAoaD5OArJBgLU9kRroCxGH62BjsMa0MGGeqrh3TKb9KNZlwrvJqFwrvkmlBiaLNTq L6x9gtCNLTlg2Fx/cowBBLGXguZU5ahXNIqheFA2H+El1j1vXszVJvfCirewmqOuAV4Y 6aTQ== X-Gm-Message-State: AOJu0Yy4TTVkgh5/uzXfTWPOnK7Ue1pfPIu9l5YlxdJa8J1kQiebLbJD JMFNVrkUC58i5C5geQGRtazvBlQnb3/BQzpeLleYdGbqNygy4gGAisa9T2ZL X-Received: by 2002:a17:906:6549:b0:a52:645a:8ebd with SMTP id u9-20020a170906654900b00a52645a8ebdmr1349529ejn.14.1713528122066; Fri, 19 Apr 2024 05:02:02 -0700 (PDT) Received: from [192.168.1.50] ([79.113.154.240]) by smtp.gmail.com with ESMTPSA id g2-20020a170906348200b00a51da296f66sm2098126ejb.41.2024.04.19.05.02.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 19 Apr 2024 05:02:01 -0700 (PDT) Message-ID: <2e3b0b74-8bfc-4ff3-8a0c-ba1bbfa4d535@gmail.com> Date: Fri, 19 Apr 2024 15:02:00 +0300 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Bitterblue Smith Subject: [PATCH v3] wifi: rtl8xxxu: Add LED control code for RTL8723BU To: "linux-wireless@vger.kernel.org" Cc: Jes Sorensen , Ping-Ke Shih Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Software control (on/off) and hardware control (automatic blinking) tested with EDUP EP-N8568. Signed-off-by: Bitterblue Smith --- v3: - Remove unnecessary braces to silence checkpatch v2: - More information in the commit message. --- .../realtek/rtl8xxxu/rtl8xxxu_8723b.c | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c index 9640c841d20a..de01e21589c5 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c @@ -1701,6 +1701,27 @@ static s8 rtl8723b_cck_rssi(struct rtl8xxxu_priv *priv, struct rtl8723au_phy_sta return rx_pwr_all; } +static int rtl8723bu_led_brightness_set(struct led_classdev *led_cdev, + enum led_brightness brightness) +{ + struct rtl8xxxu_priv *priv = container_of(led_cdev, + struct rtl8xxxu_priv, + led_cdev); + u8 ledcfg = rtl8xxxu_read8(priv, REG_LEDCFG2); + ledcfg &= LEDCFG2_DPDT_SELECT; + + if (brightness == LED_OFF) + ledcfg |= LEDCFG2_SW_LED_CONTROL | LEDCFG2_SW_LED_DISABLE; + else if (brightness == LED_ON) + ledcfg |= LEDCFG2_SW_LED_CONTROL; + else if (brightness == RTL8XXXU_HW_LED_CONTROL) + ledcfg |= LEDCFG2_HW_LED_CONTROL | LEDCFG2_HW_LED_ENABLE; + + rtl8xxxu_write8(priv, REG_LEDCFG2, ledcfg); + + return 0; +} + struct rtl8xxxu_fileops rtl8723bu_fops = { .identify_chip = rtl8723bu_identify_chip, .parse_efuse = rtl8723bu_parse_efuse, @@ -1731,6 +1752,7 @@ struct rtl8xxxu_fileops rtl8723bu_fops = { .fill_txdesc = rtl8xxxu_fill_txdesc_v2, .set_crystal_cap = rtl8723a_set_crystal_cap, .cck_rssi = rtl8723b_cck_rssi, + .led_classdev_brightness_set = rtl8723bu_led_brightness_set, .writeN_block_size = 1024, .tx_desc_size = sizeof(struct rtl8xxxu_txdesc40), .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc24), -- 2.44.0