Lines Matching +full:rfkill +full:- +full:gpio
2 * Copyright (c) 2004-2008 Reyk Floeter <reyk@openbsd.org>
3 * Copyright (c) 2006-2008 Nick Kossifidis <mickflemm@gmail.com>
20 GPIO Functions
29 * DOC: GPIO/LED functions
31 * Here we control the 6 bidirectional GPIO pins provided by the hw.
32 * We can set a GPIO pin to be an input or an output pin on GPIO control
33 * register and then read or set its status from GPIO data input/output
39 * GPIO pins, we handle them through the LED subsystem on led.c
44 * ath5k_hw_set_ledstate() - Set led state
50 * not the GPIO based.
60 if (ah->ah_version != AR5K_AR5210) in ath5k_hw_set_ledstate()
94 if (ah->ah_version != AR5K_AR5210) in ath5k_hw_set_ledstate()
101 * ath5k_hw_set_gpio_input() - Set GPIO inputs
103 * @gpio: GPIO pin to set as input
106 ath5k_hw_set_gpio_input(struct ath5k_hw *ah, u32 gpio) in ath5k_hw_set_gpio_input() argument
108 if (gpio >= AR5K_NUM_GPIO) in ath5k_hw_set_gpio_input()
109 return -EINVAL; in ath5k_hw_set_gpio_input()
112 (ath5k_hw_reg_read(ah, AR5K_GPIOCR) & ~AR5K_GPIOCR_OUT(gpio)) in ath5k_hw_set_gpio_input()
113 | AR5K_GPIOCR_IN(gpio), AR5K_GPIOCR); in ath5k_hw_set_gpio_input()
119 * ath5k_hw_set_gpio_output() - Set GPIO outputs
121 * @gpio: The GPIO pin to set as output
124 ath5k_hw_set_gpio_output(struct ath5k_hw *ah, u32 gpio) in ath5k_hw_set_gpio_output() argument
126 if (gpio >= AR5K_NUM_GPIO) in ath5k_hw_set_gpio_output()
127 return -EINVAL; in ath5k_hw_set_gpio_output()
130 (ath5k_hw_reg_read(ah, AR5K_GPIOCR) & ~AR5K_GPIOCR_OUT(gpio)) in ath5k_hw_set_gpio_output()
131 | AR5K_GPIOCR_OUT(gpio), AR5K_GPIOCR); in ath5k_hw_set_gpio_output()
137 * ath5k_hw_get_gpio() - Get GPIO state
139 * @gpio: The GPIO pin to read
142 ath5k_hw_get_gpio(struct ath5k_hw *ah, u32 gpio) in ath5k_hw_get_gpio() argument
144 if (gpio >= AR5K_NUM_GPIO) in ath5k_hw_get_gpio()
147 /* GPIO input magic */ in ath5k_hw_get_gpio()
148 return ((ath5k_hw_reg_read(ah, AR5K_GPIODI) & AR5K_GPIODI_M) >> gpio) & in ath5k_hw_get_gpio()
153 * ath5k_hw_set_gpio() - Set GPIO state
155 * @gpio: The GPIO pin to set
159 ath5k_hw_set_gpio(struct ath5k_hw *ah, u32 gpio, u32 val) in ath5k_hw_set_gpio() argument
163 if (gpio >= AR5K_NUM_GPIO) in ath5k_hw_set_gpio()
164 return -EINVAL; in ath5k_hw_set_gpio()
166 /* GPIO output magic */ in ath5k_hw_set_gpio()
169 data &= ~(1 << gpio); in ath5k_hw_set_gpio()
170 data |= (val & 1) << gpio; in ath5k_hw_set_gpio()
178 * ath5k_hw_set_gpio_intr() - Initialize the GPIO interrupt (RFKill switch)
180 * @gpio: The GPIO pin to use
183 * This function is used to set up the GPIO interrupt for the hw RFKill switch.
184 * That switch is connected to a GPIO pin and it's number is stored on EEPROM.
189 ath5k_hw_set_gpio_intr(struct ath5k_hw *ah, unsigned int gpio, in ath5k_hw_set_gpio_intr() argument
194 if (gpio >= AR5K_NUM_GPIO) in ath5k_hw_set_gpio_intr()
198 * Set the GPIO interrupt in ath5k_hw_set_gpio_intr()
201 ~(AR5K_GPIOCR_INT_SEL(gpio) | AR5K_GPIOCR_INT_SELH | in ath5k_hw_set_gpio_intr()
202 AR5K_GPIOCR_INT_ENA | AR5K_GPIOCR_OUT(gpio))) | in ath5k_hw_set_gpio_intr()
203 (AR5K_GPIOCR_INT_SEL(gpio) | AR5K_GPIOCR_INT_ENA); in ath5k_hw_set_gpio_intr()
208 ah->ah_imr |= AR5K_IMR_GPIO; in ath5k_hw_set_gpio_intr()
210 /* Enable GPIO interrupts */ in ath5k_hw_set_gpio_intr()