ath9k_htc: Change credit limit for UB94/95
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / ath / ath9k / htc_drv_init.c
index 06e043bffaf45c72376e965257aa13002bf1d887..8657d26c126537cc26b0b70f80095bec87c2a8f1 100644 (file)
@@ -117,6 +117,21 @@ static struct ieee80211_rate ath9k_legacy_rates[] = {
        RATE(540, 0x0c, 0),
 };
 
+#ifdef CONFIG_MAC80211_LEDS
+static const struct ieee80211_tpt_blink ath9k_htc_tpt_blink[] = {
+       { .throughput = 0 * 1024, .blink_time = 334 },
+       { .throughput = 1 * 1024, .blink_time = 260 },
+       { .throughput = 5 * 1024, .blink_time = 220 },
+       { .throughput = 10 * 1024, .blink_time = 190 },
+       { .throughput = 20 * 1024, .blink_time = 170 },
+       { .throughput = 50 * 1024, .blink_time = 150 },
+       { .throughput = 70 * 1024, .blink_time = 130 },
+       { .throughput = 100 * 1024, .blink_time = 110 },
+       { .throughput = 200 * 1024, .blink_time = 80 },
+       { .throughput = 300 * 1024, .blink_time = 50 },
+};
+#endif
+
 static int ath9k_htc_wait_for_target(struct ath9k_htc_priv *priv)
 {
        int time_left;
@@ -753,6 +768,7 @@ static void ath9k_set_hw_capab(struct ath9k_htc_priv *priv,
        hw->queues = 4;
        hw->channel_change_time = 5000;
        hw->max_listen_interval = 10;
+
        hw->vif_data_size = sizeof(struct ath9k_htc_vif);
        hw->sta_data_size = sizeof(struct ath9k_htc_sta);
 
@@ -802,6 +818,17 @@ static int ath9k_init_firmware_version(struct ath9k_htc_priv *priv)
                 priv->fw_version_major,
                 priv->fw_version_minor);
 
+       /*
+        * Check if the available FW matches the driver's
+        * required version.
+        */
+       if (priv->fw_version_major != MAJOR_VERSION_REQ ||
+           priv->fw_version_minor != MINOR_VERSION_REQ) {
+               dev_err(priv->dev, "ath9k_htc: Please upgrade to FW version %d.%d\n",
+                       MAJOR_VERSION_REQ, MINOR_VERSION_REQ);
+               return -EINVAL;
+       }
+
        return 0;
 }
 
@@ -846,6 +873,13 @@ static int ath9k_init_device(struct ath9k_htc_priv *priv,
        if (error != 0)
                goto err_rx;
 
+#ifdef CONFIG_MAC80211_LEDS
+       /* must be initialized before ieee80211_register_hw */
+       priv->led_cdev.default_trigger = ieee80211_create_tpt_led_trigger(priv->hw,
+               IEEE80211_TPT_LEDTRIG_FL_RADIO, ath9k_htc_tpt_blink,
+               ARRAY_SIZE(ath9k_htc_tpt_blink));
+#endif
+
        /* Register with mac80211 */
        error = ieee80211_register_hw(hw);
        if (error)