wifi: rtl8xxxu: Add LED control code for RTL8723AU

By default the LED will blink when there is some activity.

This is only compile tested.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/73323811-aa58-a1be-7867-a5d45b7ae3d6@gmail.com
This commit is contained in:
Bitterblue Smith 2023-01-20 17:55:09 +02:00 committed by Kalle Valo
parent ae0a6df673
commit 2cef0aeebf

View File

@ -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),