// SPDX-License-Identifier: GPL-2.0-only /****************************************************************************** * * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. * Copyright (C) 2019 Intel Corporation *****************************************************************************/ #include <linux/kernel.h> #include <linux/module.h> #include <linux/delay.h> #include <linux/skbuff.h> #include <linux/netdevice.h> #include <net/mac80211.h> #include <linux/etherdevice.h> #include <asm/unaligned.h> #include "iwl-io.h" #include "iwl-trans.h" #include "iwl-modparams.h" #include "dev.h" #include "agn.h" /* Throughput OFF time(ms) ON time (ms) * >300 25 25 * >200 to 300 40 40 * >100 to 200 55 55 * >70 to 100 65 65 * >50 to 70 75 75 * >20 to 50 85 85 * >10 to 20 95 95 * >5 to 10 110 110 * >1 to 5 130 130 * >0 to 1 167 167 * <=0 SOLID ON */ static const struct ieee80211_tpt_blink iwl_blink[] = …; /* Set led register off */ void iwlagn_led_enable(struct iwl_priv *priv) { … } /* * Adjust led blink rate to compensate on a MAC Clock difference on every HW * Led blink rate analysis showed an average deviation of 20% on 5000 series * and up. * Need to compensate on the led on/off time per HW according to the deviation * to achieve the desired led frequency * The calculation is: (100-averageDeviation)/100 * blinkTime * For code efficiency the calculation will be: * compensation = (100 - averageDeviation) * 64 / 100 * NewBlinkTime = (compensation * BlinkTime) / 64 */ static inline u8 iwl_blink_compensation(struct iwl_priv *priv, u8 time, u16 compensation) { … } static int iwl_send_led_cmd(struct iwl_priv *priv, struct iwl_led_cmd *led_cmd) { … } /* Set led pattern command */ static int iwl_led_cmd(struct iwl_priv *priv, unsigned long on, unsigned long off) { … } static void iwl_led_brightness_set(struct led_classdev *led_cdev, enum led_brightness brightness) { … } static int iwl_led_blink_set(struct led_classdev *led_cdev, unsigned long *delay_on, unsigned long *delay_off) { … } void iwl_leds_init(struct iwl_priv *priv) { … } void iwl_leds_exit(struct iwl_priv *priv) { … }