iPXE
Functions
ath5k_rfkill.c File Reference
#include "base.h"

Go to the source code of this file.

Functions

 FILE_LICENCE (MIT)
 
static void ath5k_rfkill_disable (struct ath5k_softc *sc)
 
static void ath5k_rfkill_enable (struct ath5k_softc *sc)
 
static void ath5k_rfkill_set_intr (struct ath5k_softc *sc, int enable)
 
static int __unused ath5k_is_rfkill_set (struct ath5k_softc *sc)
 
void ath5k_rfkill_hw_start (struct ath5k_hw *ah)
 
void ath5k_rfkill_hw_stop (struct ath5k_hw *ah)
 

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( MIT  )

◆ ath5k_rfkill_disable()

static void ath5k_rfkill_disable ( struct ath5k_softc sc)
inlinestatic

Definition at line 42 of file ath5k_rfkill.c.

43 {
44  DBG("ath5k: rfkill disable (gpio:%d polarity:%d)\n",
45  sc->rf_kill.gpio, sc->rf_kill.polarity);
48 }
int ath5k_hw_set_gpio_output(struct ath5k_hw *ah, u32 gpio)
Definition: ath5k_gpio.c:49
struct ath5k_softc::@15 rf_kill
unsigned polarity
Definition: base.h:128
int ath5k_hw_set_gpio(struct ath5k_hw *ah, u32 gpio, u32 val)
Definition: ath5k_gpio.c:77
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
struct ath5k_hw * ah
Definition: base.h:92
u16 gpio
Definition: base.h:127

References ath5k_softc::ah, ath5k_hw_set_gpio(), ath5k_hw_set_gpio_output(), DBG, ath5k_softc::gpio, ath5k_softc::polarity, and ath5k_softc::rf_kill.

Referenced by ath5k_rfkill_hw_start().

◆ ath5k_rfkill_enable()

static void ath5k_rfkill_enable ( struct ath5k_softc sc)
inlinestatic

Definition at line 51 of file ath5k_rfkill.c.

52 {
53  DBG("ath5k: rfkill enable (gpio:%d polarity:%d)\n",
54  sc->rf_kill.gpio, sc->rf_kill.polarity);
57 }
int ath5k_hw_set_gpio_output(struct ath5k_hw *ah, u32 gpio)
Definition: ath5k_gpio.c:49
struct ath5k_softc::@15 rf_kill
unsigned polarity
Definition: base.h:128
int ath5k_hw_set_gpio(struct ath5k_hw *ah, u32 gpio, u32 val)
Definition: ath5k_gpio.c:77
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
struct ath5k_hw * ah
Definition: base.h:92
u16 gpio
Definition: base.h:127

References ath5k_softc::ah, ath5k_hw_set_gpio(), ath5k_hw_set_gpio_output(), DBG, ath5k_softc::gpio, ath5k_softc::polarity, and ath5k_softc::rf_kill.

Referenced by ath5k_rfkill_hw_stop().

◆ ath5k_rfkill_set_intr()

static void ath5k_rfkill_set_intr ( struct ath5k_softc sc,
int  enable 
)
inlinestatic

Definition at line 59 of file ath5k_rfkill.c.

60 {
61  struct ath5k_hw *ah = sc->ah;
62  u32 curval;
63 
65  curval = ath5k_hw_get_gpio(ah, sc->rf_kill.gpio);
66  ath5k_hw_set_gpio_intr(ah, sc->rf_kill.gpio, enable ?
67  !!curval : !curval);
68 }
struct ath5k_softc::@15 rf_kill
void ath5k_hw_set_gpio_intr(struct ath5k_hw *ah, unsigned int gpio, u32 interrupt_level)
Definition: ath5k_gpio.c:98
ath5k_hw_get_isr - Get interrupt status
Definition: ath5k.h:953
int ath5k_hw_set_gpio_input(struct ath5k_hw *ah, u32 gpio)
Definition: ath5k_gpio.c:34
uint8_t ah
Definition: registers.h:85
struct ath5k_hw * ah
Definition: base.h:92
u32 ath5k_hw_get_gpio(struct ath5k_hw *ah, u32 gpio)
Definition: ath5k_gpio.c:64
uint32_t u32
Definition: stdint.h:23
u16 gpio
Definition: base.h:127

References ah, ath5k_softc::ah, ath5k_hw_get_gpio(), ath5k_hw_set_gpio_input(), ath5k_hw_set_gpio_intr(), ath5k_softc::gpio, and ath5k_softc::rf_kill.

Referenced by ath5k_rfkill_hw_start(), and ath5k_rfkill_hw_stop().

◆ ath5k_is_rfkill_set()

static int __unused ath5k_is_rfkill_set ( struct ath5k_softc sc)
static

Definition at line 71 of file ath5k_rfkill.c.

72 {
73  /* configuring GPIO for input for some reason disables rfkill */
74  /*ath5k_hw_set_gpio_input(sc->ah, sc->rf_kill.gpio);*/
75  return (ath5k_hw_get_gpio(sc->ah, sc->rf_kill.gpio) ==
76  sc->rf_kill.polarity);
77 }
struct ath5k_softc::@15 rf_kill
unsigned polarity
Definition: base.h:128
struct ath5k_hw * ah
Definition: base.h:92
u32 ath5k_hw_get_gpio(struct ath5k_hw *ah, u32 gpio)
Definition: ath5k_gpio.c:64
u16 gpio
Definition: base.h:127

References ath5k_softc::ah, ath5k_hw_get_gpio(), ath5k_softc::gpio, ath5k_softc::polarity, and ath5k_softc::rf_kill.

◆ ath5k_rfkill_hw_start()

void ath5k_rfkill_hw_start ( struct ath5k_hw ah)

Definition at line 80 of file ath5k_rfkill.c.

81 {
82  struct ath5k_softc *sc = ah->ah_sc;
83 
84  /* read rfkill GPIO configuration from EEPROM header */
85  sc->rf_kill.gpio = ah->ah_capabilities.cap_eeprom.ee_rfkill_pin;
86  sc->rf_kill.polarity = ah->ah_capabilities.cap_eeprom.ee_rfkill_pol;
87 
89 
90  /* enable interrupt for rfkill switch */
91  if (AR5K_EEPROM_HDR_RFKILL(ah->ah_capabilities.cap_eeprom.ee_header))
92  ath5k_rfkill_set_intr(sc, 1);
93 }
struct ath5k_softc::@15 rf_kill
static void ath5k_rfkill_disable(struct ath5k_softc *sc)
Definition: ath5k_rfkill.c:42
unsigned polarity
Definition: base.h:128
#define AR5K_EEPROM_HDR_RFKILL(_v)
Definition: eeprom.h:73
static void ath5k_rfkill_set_intr(struct ath5k_softc *sc, int enable)
Definition: ath5k_rfkill.c:59
uint8_t ah
Definition: registers.h:85
u16 gpio
Definition: base.h:127

References ah, AR5K_EEPROM_HDR_RFKILL, ath5k_rfkill_disable(), ath5k_rfkill_set_intr(), ath5k_softc::gpio, ath5k_softc::polarity, and ath5k_softc::rf_kill.

Referenced by ath5k_init().

◆ ath5k_rfkill_hw_stop()

void ath5k_rfkill_hw_stop ( struct ath5k_hw ah)

Definition at line 97 of file ath5k_rfkill.c.

98 {
99  struct ath5k_softc *sc = ah->ah_sc;
100 
101  /* disable interrupt for rfkill switch */
102  if (AR5K_EEPROM_HDR_RFKILL(ah->ah_capabilities.cap_eeprom.ee_header))
103  ath5k_rfkill_set_intr(sc, 0);
104 
105  /* enable RFKILL when stopping HW so Wifi LED is turned off */
107 }
#define AR5K_EEPROM_HDR_RFKILL(_v)
Definition: eeprom.h:73
static void ath5k_rfkill_set_intr(struct ath5k_softc *sc, int enable)
Definition: ath5k_rfkill.c:59
static void ath5k_rfkill_enable(struct ath5k_softc *sc)
Definition: ath5k_rfkill.c:51
uint8_t ah
Definition: registers.h:85

References ah, AR5K_EEPROM_HDR_RFKILL, ath5k_rfkill_enable(), and ath5k_rfkill_set_intr().

Referenced by ath5k_stop_hw().