Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2841258rwb; Fri, 20 Jan 2023 08:02:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXv6bWMLva7RaDhdEn+xSQomm52LY7l3uEXYuGeMnnmJ9MAdjtlDd8yut2Dg82a1kLqCb8Ae X-Received: by 2002:a05:6402:3909:b0:499:bcd7:a968 with SMTP id fe9-20020a056402390900b00499bcd7a968mr16730352edb.22.1674230546974; Fri, 20 Jan 2023 08:02:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674230546; cv=none; d=google.com; s=arc-20160816; b=YztaDltACNOU9wMT6nQHA9YUR++JTZgyiYpsp3XMKcoeayJpmMYXJLXB1MBnZD/Ojp R9bzat8vIFs3Z4S94gfU5hDZALJr6S6u2ywynrdZDasw5K2UOwAGhJDiKqNcNdm4iozZ Lw77OxEGH4UAW3TKrb5CiujQl8hOcD6KSCdcYvzibEdP1hvQ+Is5ZBaG3SCQ/LJpgK0l D+5SmynSPWVmw74kMQEnQnNZHsqyccY/yi/XPaWqjyetUHwYbDTfGl4B7nLQGCHUQAey kRD8+eglGD72s1GucE0SsKTRNUnmMnhGqkpA7U8HT0m6handR2NuEYA4zyU9rPs4fhfr bSkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=OPgudPCXIBy6FiAHmJXsCq9ARHh8PWxYE16rm8TRgaU=; b=RgwhPBJRrjWvYL18gT02h6El/HSUHCQYFUw/59XkXRcHjyNGXN2sHvRmXDph709sJx Qayb9ozMiFUpLL5vDyzFcidMgaeCiYtt0mRARHUVoXodKCIiVeicsMC2pwdDK0yKpYQU KYEElhLWyTFlvxl8vqmL2ElILqNMN3RTp9T6VKQsnAdZp7TyUBtqMQX5+5VtxDOJ+tpB FJ2DDYNVPpJ4uO+4DJGw635+rDK45reetJo5j33AqJRttz1vi45t1Ar0G34rsp3WoBnx XOltN64hgsI5o7aY3JObC603PKVL+pNsCk4J9JybGABO+BXism5QNe8SbsZ209SapK4V vW2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=n9TwHVB2; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr7-20020a170907720700b008775c01f763si10509753ejc.539.2023.01.20.08.02.10; Fri, 20 Jan 2023 08:02:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=n9TwHVB2; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230313AbjATPzr (ORCPT + 63 others); Fri, 20 Jan 2023 10:55:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229875AbjATPzp (ORCPT ); Fri, 20 Jan 2023 10:55:45 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF080707D7 for ; Fri, 20 Jan 2023 07:55:18 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id q5so588712wrv.0 for ; Fri, 20 Jan 2023 07:55:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=OPgudPCXIBy6FiAHmJXsCq9ARHh8PWxYE16rm8TRgaU=; b=n9TwHVB2us0yshwEPLc1rxmtTj1QaYPkrmblQhezOKREF2v1gtxJ7QqpNLI4h4/9+D wnBMtRXMoaMxHHu69rDqtoUCmbons9NqnVsGBjNcwAWGG3wpLc9euO6YD1IZLTszidnO oQMzoXnyXvBDtcKy98QxCC52P4S/htSZowyq0ZiYGHnfnPPAyNfKkMeDdNRxA9m5KIn0 OdoIgnDc0l7JearCgGFWahKUWHFNLeEGn/FWBHjolTns8afanVQxd19/N5cLuimpoLOd 4rmbYtgD3HaecxCE1XJ9LYUvYMB5w3qgkejcVNOFV81KXlYRJTXqjbMg4IOmE1z+hOIY teGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OPgudPCXIBy6FiAHmJXsCq9ARHh8PWxYE16rm8TRgaU=; b=dlD3GIicbrILT0CZ5z/tZgI8C8N12HLU/SBceAbM9XYJUusXZLWWvUSUN5mhG7ZLSW 76AitC0CPOB/S9+SmWFbJlk3Fz7Rs29hrkc4K+F2nAhHKzvGuXiHm3K/RTjQhtIdn0O6 wLZmHbklH513MRLUlIUwbiEGJ39WSJba5II+id8mVZ3QOgKh6SsxmYddIuKUCUeG5Ig5 76clFYhoE9pWgYQTAb5GZByTnGdEPEge8tUcUAhN4DlrQRq8yUUnFrDig9vMqOq6POES i1atUadRMvEL5ELaNDpU99XgYLAM0iL44w2TqV8/Lnr+HA8axqlVu2DgQyEgqkAU2OOK 0WNw== X-Gm-Message-State: AFqh2koILfLP5ovficYGt+H4ERhzrTdwmrLxHYzhUvtO+xEmMQ2zbdkZ umo6OTyQpSP0/0HNQ4Z5aAbuuTBWHC0= X-Received: by 2002:a05:6000:3c2:b0:2bd:beff:9c47 with SMTP id b2-20020a05600003c200b002bdbeff9c47mr15405043wrg.67.1674230114086; Fri, 20 Jan 2023 07:55:14 -0800 (PST) Received: from [192.168.1.50] ([79.119.240.25]) by smtp.gmail.com with ESMTPSA id q23-20020adfb197000000b002be5bdbe40csm1874302wra.27.2023.01.20.07.55.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 20 Jan 2023 07:55:13 -0800 (PST) Message-ID: <73323811-aa58-a1be-7867-a5d45b7ae3d6@gmail.com> Date: Fri, 20 Jan 2023 17:55:09 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: [PATCH v2 4/4] wifi: rtl8xxxu: Add LED control code for RTL8723AU Content-Language: en-US From: Bitterblue Smith To: "linux-wireless@vger.kernel.org" Cc: Jes Sorensen , Ping-Ke Shih References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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-wireless@vger.kernel.org By default the LED will blink when there is some activity. This is only compile tested. Signed-off-by: Bitterblue Smith --- v2: - No change. --- .../realtek/rtl8xxxu/rtl8xxxu_8723a.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c index 5ed523db2d87..5e7b58d395ba 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c @@ -457,6 +457,30 @@ s8 rtl8723a_cck_rssi(struct rtl8xxxu_priv *priv, u8 cck_agc_rpt) return rx_pwr_all; } +static int rtl8723au_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); + + if (brightness == LED_OFF) { + ledcfg &= ~LEDCFG2_HW_LED_CONTROL; + ledcfg |= LEDCFG2_SW_LED_CONTROL | LEDCFG2_SW_LED_DISABLE; + } else if (brightness == LED_ON) { + ledcfg &= ~(LEDCFG2_HW_LED_CONTROL | LEDCFG2_SW_LED_DISABLE); + ledcfg |= LEDCFG2_SW_LED_CONTROL; + } else if (brightness == RTL8XXXU_HW_LED_CONTROL) { + ledcfg &= ~LEDCFG2_SW_LED_DISABLE; + ledcfg |= LEDCFG2_HW_LED_CONTROL | LEDCFG2_HW_LED_ENABLE; + } + + rtl8xxxu_write8(priv, REG_LEDCFG2, ledcfg); + + return 0; +} + struct rtl8xxxu_fileops rtl8723au_fops = { .identify_chip = rtl8723au_identify_chip, .parse_efuse = rtl8723au_parse_efuse, @@ -482,6 +506,7 @@ struct rtl8xxxu_fileops rtl8723au_fops = { .fill_txdesc = rtl8xxxu_fill_txdesc_v1, .set_crystal_cap = rtl8723a_set_crystal_cap, .cck_rssi = rtl8723a_cck_rssi, + .led_classdev_brightness_set = rtl8723au_led_brightness_set, .writeN_block_size = 1024, .rx_agg_buf_size = 16000, .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), -- 2.39.1