[tools] firmware-utils: link statically
[openwrt.git] / package / madwifi / patches / 456-rfsilent.patch
1 --- a/ath/if_ath.c
2 +++ b/ath/if_ath.c
3 @@ -2996,6 +2996,19 @@ ath_fetch_idle_time(struct ath_softc *sc
4  #undef AR5K_RXCLEAR
5  #undef AR5K_CYCLES
6  
7 +static void
8 +ath_set_silent(struct ath_softc *sc)
9 +{
10 +       struct ath_hal *ah = sc->sc_ah;
11 +
12 +       if (!sc->sc_silent)
13 +               return;
14 +
15 +       del_timer_sync(&sc->sc_bcntimer);
16 +       ath_hal_intrset(ah, 0);
17 +       OS_REG_WRITE(ah, 0x8048, 0x60); /* set tx loopback and rx disable */
18 +}
19 +
20  /*
21   * Reset the hardware w/o losing operational state.  This is
22   * basically a more efficient way of doing ath_stop, ath_init,
23 @@ -3073,6 +3086,7 @@ ath_reset(struct net_device *dev)
24                 ath_grppoll_start(vap, sc->sc_xrpollcount);
25         }
26  #endif
27 +       ath_set_silent(sc);
28         return 0;
29  }
30  
31 @@ -10972,6 +10986,7 @@ enum {
32   * mirrored in /proc/sys.
33   */
34  enum {
35 +       ATH_SILENT,
36         ATH_SLOTTIME,
37         ATH_ACKTIMEOUT,
38         ATH_CTSTIMEOUT,
39 @@ -11294,6 +11309,13 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
40                                         sc->sc_ctstimeconf = 0;
41                                 ath_set_timing(sc);
42                                 break;
43 +                       case ATH_SILENT:
44 +                               sc->sc_silent = !!val;
45 +                               if (val)
46 +                                       ath_set_silent(sc);
47 +                               else
48 +                                       ath_reset(sc->sc_dev);
49 +                               break;
50                         case ATH_DISTANCE:
51                                 if (val > 0) {
52                                         sc->sc_coverage = ((val - 1) / 300) + 1;
53 @@ -11477,6 +11499,9 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
54                 case ATH_CTSTIMEOUT:
55                         val = ath_hal_getctstimeout(ah);
56                         break;
57 +               case ATH_SILENT:
58 +                       val = sc->sc_silent;
59 +                       break;
60                 case ATH_SOFTLED:
61                         val = sc->sc_softled;
62                         break;
63 @@ -11598,6 +11623,12 @@ static const ctl_table ath_sysctl_templa
64           .extra2       = (void *)ATH_DISTANCE,
65         },
66         { .ctl_name     = CTL_AUTO,
67 +         .procname     = "silent",
68 +         .mode         = 0644,
69 +         .proc_handler = ath_sysctl_halparam,
70 +         .extra2       = (void *)ATH_SILENT,
71 +       },
72 +       { .ctl_name     = CTL_AUTO,
73           .procname     = "softled",
74           .mode         = 0644,
75           .proc_handler = ath_sysctl_halparam,
76 --- a/ath/if_athvar.h
77 +++ b/ath/if_athvar.h
78 @@ -737,6 +737,7 @@ struct ath_softc {
79                                                  * 'channel availability check' indefinately,
80                                                  * reporting radar and interference detections.
81                                                  */
82 +       unsigned int    sc_silent:1;    /* Turn RF silent */
83         unsigned int sc_txcont_power; /* Continuous transmit power in 0.5dBm units */
84         unsigned int sc_txcont_rate;  /* Continuous transmit rate in Mbps */
85