Lines Matching +full:led +full:- +full:mode
1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved.
17 #include "iwl-io.h"
18 #include "iwl-trans.h"
19 #include "iwl-modparams.h"
38 { .throughput = 1 * 1024 - 1, .blink_time = 260 },
39 { .throughput = 5 * 1024 - 1, .blink_time = 220 },
40 { .throughput = 10 * 1024 - 1, .blink_time = 190 },
41 { .throughput = 20 * 1024 - 1, .blink_time = 170 },
42 { .throughput = 50 * 1024 - 1, .blink_time = 150 },
43 { .throughput = 70 * 1024 - 1, .blink_time = 130 },
44 { .throughput = 100 * 1024 - 1, .blink_time = 110 },
45 { .throughput = 200 * 1024 - 1, .blink_time = 80 },
46 { .throughput = 300 * 1024 - 1, .blink_time = 50 },
49 /* Set led register off */
52 iwl_write32(priv->trans, CSR_LED_REG, CSR_LED_REG_TURN_ON); in iwlagn_led_enable()
56 * Adjust led blink rate to compensate on a MAC Clock difference on every HW
57 * Led blink rate analysis showed an average deviation of 20% on 5000 series
59 * Need to compensate on the led on/off time per HW according to the deviation
60 * to achieve the desired led frequency
61 * The calculation is: (100-averageDeviation)/100 * blinkTime
63 * compensation = (100 - averageDeviation) * 64 / 100
71 "use pre-defined blinking time\n"); in iwl_blink_compensation()
88 reg = iwl_read32(priv->trans, CSR_LED_REG); in iwl_send_led_cmd()
90 iwl_write32(priv->trans, CSR_LED_REG, in iwl_send_led_cmd()
96 /* Set led pattern command */
107 if (!test_bit(STATUS_READY, &priv->status)) in iwl_led_cmd()
108 return -EBUSY; in iwl_led_cmd()
110 if (priv->blink_on == on && priv->blink_off == off) in iwl_led_cmd()
114 /* led is SOLID_ON */ in iwl_led_cmd()
119 priv->trans->trans_cfg->base_params->led_compensation); in iwl_led_cmd()
121 priv->trans->trans_cfg->base_params->led_compensation); in iwl_led_cmd()
125 priv->blink_on = on; in iwl_led_cmd()
126 priv->blink_off = off; in iwl_led_cmd()
134 struct iwl_priv *priv = container_of(led_cdev, struct iwl_priv, led); in iwl_led_brightness_set()
150 struct iwl_priv *priv = container_of(led_cdev, struct iwl_priv, led); in iwl_led_blink_set()
157 int mode = iwlwifi_mod_params.led_mode; in iwl_leds_init() local
160 if (mode == IWL_LED_DISABLE) { in iwl_leds_init()
161 IWL_INFO(priv, "Led disabled\n"); in iwl_leds_init()
164 if (mode == IWL_LED_DEFAULT) in iwl_leds_init()
165 mode = priv->cfg->led_mode; in iwl_leds_init()
167 priv->led.name = kasprintf(GFP_KERNEL, "%s-led", in iwl_leds_init()
168 wiphy_name(priv->hw->wiphy)); in iwl_leds_init()
169 if (!priv->led.name) in iwl_leds_init()
172 priv->led.brightness_set = iwl_led_brightness_set; in iwl_leds_init()
173 priv->led.blink_set = iwl_led_blink_set; in iwl_leds_init()
174 priv->led.max_brightness = 1; in iwl_leds_init()
176 switch (mode) { in iwl_leds_init()
181 priv->led.default_trigger = in iwl_leds_init()
182 ieee80211_create_tpt_led_trigger(priv->hw, in iwl_leds_init()
187 priv->led.default_trigger = in iwl_leds_init()
188 ieee80211_get_radio_led_name(priv->hw); in iwl_leds_init()
192 ret = led_classdev_register(priv->trans->dev, &priv->led); in iwl_leds_init()
194 kfree(priv->led.name); in iwl_leds_init()
198 priv->led_registered = true; in iwl_leds_init()
203 if (!priv->led_registered) in iwl_leds_exit()
206 led_classdev_unregister(&priv->led); in iwl_leds_exit()
207 kfree(priv->led.name); in iwl_leds_exit()