Lines Matching defs:gpio
23 #include <linux/gpio.h>
2700 static void ath9k_hw_gpio_cfg_output_mux(struct ath_hw *ah, u32 gpio, u32 type)
2705 if (gpio > 11)
2707 else if (gpio > 5)
2712 gpio_shift = (gpio % 6) * 5;
2729 static void ath9k_hw_gpio_cfg_soc(struct ath_hw *ah, u32 gpio, bool out,
2734 if (ah->caps.gpio_requested & BIT(gpio))
2737 err = gpio_request_one(gpio, out ? GPIOF_OUT_INIT_LOW : GPIOF_IN, label);
2740 gpio, err);
2744 ah->caps.gpio_requested |= BIT(gpio);
2747 static void ath9k_hw_gpio_cfg_wmac(struct ath_hw *ah, u32 gpio, bool out,
2750 u32 gpio_set, gpio_shift = gpio;
2762 gpio_shift = gpio << 1;
2769 ath9k_hw_gpio_cfg_output_mux(ah, gpio, ah_signal_type);
2773 static void ath9k_hw_gpio_request(struct ath_hw *ah, u32 gpio, bool out,
2776 WARN_ON(gpio >= ah->caps.num_gpio_pins);
2778 if (BIT(gpio) & ah->caps.gpio_mask)
2779 ath9k_hw_gpio_cfg_wmac(ah, gpio, out, ah_signal_type);
2781 ath9k_hw_gpio_cfg_soc(ah, gpio, out, label);
2786 void ath9k_hw_gpio_request_in(struct ath_hw *ah, u32 gpio, const char *label)
2788 ath9k_hw_gpio_request(ah, gpio, false, label, 0);
2792 void ath9k_hw_gpio_request_out(struct ath_hw *ah, u32 gpio, const char *label,
2795 ath9k_hw_gpio_request(ah, gpio, true, label, ah_signal_type);
2799 void ath9k_hw_gpio_free(struct ath_hw *ah, u32 gpio)
2804 WARN_ON(gpio >= ah->caps.num_gpio_pins);
2806 if (ah->caps.gpio_requested & BIT(gpio)) {
2807 gpio_free(gpio);
2808 ah->caps.gpio_requested &= ~BIT(gpio);
2813 u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio)
2820 WARN_ON(gpio >= ah->caps.num_gpio_pins);
2822 if (BIT(gpio) & ah->caps.gpio_mask) {
2824 val = MS_REG_READ(AR9271, gpio);
2826 val = MS_REG_READ(AR9287, gpio);
2828 val = MS_REG_READ(AR9285, gpio);
2830 val = MS_REG_READ(AR928X, gpio);
2832 val = REG_READ(ah, AR7010_GPIO_IN) & BIT(gpio);
2834 val = REG_READ(ah, AR_GPIO_IN) & BIT(gpio);
2836 val = MS_REG_READ(AR, gpio);
2837 } else if (BIT(gpio) & ah->caps.gpio_requested) {
2838 val = gpio_get_value(gpio) & BIT(gpio);
2847 void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val)
2849 WARN_ON(gpio >= ah->caps.num_gpio_pins);
2856 if (BIT(gpio) & ah->caps.gpio_mask) {
2860 REG_RMW(ah, out_addr, val << gpio, BIT(gpio));
2861 } else if (BIT(gpio) & ah->caps.gpio_requested) {
2862 gpio_set_value(gpio, val);