Lines Matching defs:gpio

23 #include <linux/gpio.h>
2698 static void ath9k_hw_gpio_cfg_output_mux(struct ath_hw *ah, u32 gpio, u32 type)
2703 if (gpio > 11)
2705 else if (gpio > 5)
2710 gpio_shift = (gpio % 6) * 5;
2727 static void ath9k_hw_gpio_cfg_soc(struct ath_hw *ah, u32 gpio, bool out,
2732 if (ah->caps.gpio_requested & BIT(gpio))
2735 err = gpio_request_one(gpio, out ? GPIOF_OUT_INIT_LOW : GPIOF_IN, label);
2738 gpio, err);
2742 ah->caps.gpio_requested |= BIT(gpio);
2745 static void ath9k_hw_gpio_cfg_wmac(struct ath_hw *ah, u32 gpio, bool out,
2748 u32 gpio_set, gpio_shift = gpio;
2760 gpio_shift = gpio << 1;
2767 ath9k_hw_gpio_cfg_output_mux(ah, gpio, ah_signal_type);
2771 static void ath9k_hw_gpio_request(struct ath_hw *ah, u32 gpio, bool out,
2774 WARN_ON(gpio >= ah->caps.num_gpio_pins);
2776 if (BIT(gpio) & ah->caps.gpio_mask)
2777 ath9k_hw_gpio_cfg_wmac(ah, gpio, out, ah_signal_type);
2779 ath9k_hw_gpio_cfg_soc(ah, gpio, out, label);
2784 void ath9k_hw_gpio_request_in(struct ath_hw *ah, u32 gpio, const char *label)
2786 ath9k_hw_gpio_request(ah, gpio, false, label, 0);
2790 void ath9k_hw_gpio_request_out(struct ath_hw *ah, u32 gpio, const char *label,
2793 ath9k_hw_gpio_request(ah, gpio, true, label, ah_signal_type);
2797 void ath9k_hw_gpio_free(struct ath_hw *ah, u32 gpio)
2802 WARN_ON(gpio >= ah->caps.num_gpio_pins);
2804 if (ah->caps.gpio_requested & BIT(gpio)) {
2805 gpio_free(gpio);
2806 ah->caps.gpio_requested &= ~BIT(gpio);
2811 u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio)
2818 WARN_ON(gpio >= ah->caps.num_gpio_pins);
2820 if (BIT(gpio) & ah->caps.gpio_mask) {
2822 val = MS_REG_READ(AR9271, gpio);
2824 val = MS_REG_READ(AR9287, gpio);
2826 val = MS_REG_READ(AR9285, gpio);
2828 val = MS_REG_READ(AR928X, gpio);
2830 val = REG_READ(ah, AR7010_GPIO_IN) & BIT(gpio);
2832 val = REG_READ(ah, AR_GPIO_IN(ah)) & BIT(gpio);
2834 val = MS_REG_READ(AR, gpio);
2835 } else if (BIT(gpio) & ah->caps.gpio_requested) {
2836 val = gpio_get_value(gpio) & BIT(gpio);
2845 void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val)
2847 WARN_ON(gpio >= ah->caps.num_gpio_pins);
2854 if (BIT(gpio) & ah->caps.gpio_mask) {
2858 REG_RMW(ah, out_addr, val << gpio, BIT(gpio));
2859 } else if (BIT(gpio) & ah->caps.gpio_requested) {
2860 gpio_set_value(gpio, val);