Lines Matching +full:rfkill +full:- +full:gpio

1 /*-
2 * SPDX-License-Identifier: ISC
4 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
5 * Copyright (c) 2002-2006 Atheros Communications, Inc.
30 #define AR_NUM_GPIO 6 /* 6 GPIO bits */
31 #define AR_GPIOD_MASK 0x2f /* 6-bit mask */
38 OS_MEMCPY(mac, ahp->ah_macaddr, IEEE80211_ADDR_LEN); in ar5211GetMacAddress()
46 OS_MEMCPY(ahp->ah_macaddr, mac, IEEE80211_ADDR_LEN); in ar5211SetMacAddress()
104 if (AH_PRIVATE(ah)->ah_currentRD == regDomain) { in ar5211SetRegulatoryDomain()
111 * permit re-writing that segment of the EEPROM. in ar5211SetRegulatoryDomain()
122 AH_PRIVATE(ah)->ah_currentRD = regDomain; in ar5211SetRegulatoryDomain()
159 return (AH5211(ah)->ah_turboDisable != 0);
164 * Called if RfKill is supported (according to EEPROM). Set the interrupt and
165 * GPIO values so the ISR and can disable RF on a switch signal
170 uint16_t rfsilent = AH_PRIVATE(ah)->ah_rfsilent; in ar5211EnableRfKill()
175 * Configure the desired GPIO port for input in ar5211EnableRfKill()
181 * If radio disable switch connection to GPIO bit x is enabled in ar5211EnableRfKill()
182 * program GPIO interrupt. in ar5211EnableRfKill()
183 * If rfkill bit on eeprom is 1, setupeeprommap routine has already in ar5211EnableRfKill()
185 * rfkill bit and it is set to 1, indicating that GPIO bit x hardware in ar5211EnableRfKill()
192 * Configure GPIO Output lines
195 ar5211GpioCfgOutput(struct ath_hal *ah, uint32_t gpio, HAL_GPIO_MUX_TYPE type) in ar5211GpioCfgOutput() argument
199 HALASSERT(gpio < AR_NUM_GPIO); in ar5211GpioCfgOutput()
202 reg &= ~(AR_GPIOCR_0_CR_A << (gpio * AR_GPIOCR_CR_SHIFT)); in ar5211GpioCfgOutput()
203 reg |= AR_GPIOCR_0_CR_A << (gpio * AR_GPIOCR_CR_SHIFT); in ar5211GpioCfgOutput()
210 * Configure GPIO Input lines
213 ar5211GpioCfgInput(struct ath_hal *ah, uint32_t gpio) in ar5211GpioCfgInput() argument
217 HALASSERT(gpio < AR_NUM_GPIO); in ar5211GpioCfgInput()
220 reg &= ~(AR_GPIOCR_0_CR_A << (gpio * AR_GPIOCR_CR_SHIFT)); in ar5211GpioCfgInput()
221 reg |= AR_GPIOCR_0_CR_N << (gpio * AR_GPIOCR_CR_SHIFT); in ar5211GpioCfgInput()
228 * Once configured for I/O - set output lines
231 ar5211GpioSet(struct ath_hal *ah, uint32_t gpio, uint32_t val) in ar5211GpioSet() argument
235 HALASSERT(gpio < AR_NUM_GPIO); in ar5211GpioSet()
238 reg &= ~(1 << gpio); in ar5211GpioSet()
239 reg |= (val&1) << gpio; in ar5211GpioSet()
246 * Once configured for I/O - get input lines
249 ar5211GpioGet(struct ath_hal *ah, uint32_t gpio) in ar5211GpioGet() argument
251 if (gpio < AR_NUM_GPIO) { in ar5211GpioGet()
253 val = ((val & AR_GPIOD_MASK) >> gpio) & 0x1; in ar5211GpioGet()
261 * Set the GPIO 0 Interrupt (gpio is ignored)
264 ar5211GpioSetIntr(struct ath_hal *ah, u_int gpio, uint32_t ilevel) in ar5211GpioSetIntr() argument
280 ar5211SetInterrupts(ah, AH5211(ah)->ah_maskReg | HAL_INT_GPIO); in ar5211GpioSetIntr()
317 /* XXX save bssid for possible re-use on reset */ in ar5211WriteAssocid()
318 OS_MEMCPY(ahp->ah_bssid, bssid, IEEE80211_ADDR_LEN); in ar5211WriteAssocid()
319 OS_REG_WRITE(ah, AR_BSS_ID0, LE_READ_4(ahp->ah_bssid)); in ar5211WriteAssocid()
320 OS_REG_WRITE(ah, AR_BSS_ID1, LE_READ_2(ahp->ah_bssid+4) | in ar5211WriteAssocid()
332 /* sync multi-word read */ in ar5211GetTsf64()
339 * then we re-reading AR_TSF_U32 does no good as the in ar5211GetTsf64()
342 * to check for rollover doesn't help if preempted--so in ar5211GetTsf64()
373 * Grab a semi-random value from hardware registers - may not
383 nf = 0 - ((nf ^ 0x1ff) + 1); in ar5211GetRandomSeed()
405 return (AH_PRIVATE(ah)->ah_macVersion == macVersion && in ar5211DetectCardPresent()
406 AH_PRIVATE(ah)->ah_macRev == macRev); in ar5211DetectCardPresent()
415 stats->ackrcv_bad += OS_REG_READ(ah, AR_ACK_FAIL); in ar5211UpdateMibCounters()
416 stats->rts_bad += OS_REG_READ(ah, AR_RTS_FAIL); in ar5211UpdateMibCounters()
417 stats->fcs_bad += OS_REG_READ(ah, AR_FCS_FAIL); in ar5211UpdateMibCounters()
418 stats->rts_good += OS_REG_READ(ah, AR_RTS_OK); in ar5211UpdateMibCounters()
419 stats->beacons += OS_REG_READ(ah, AR_BEACON_CNT); in ar5211UpdateMibCounters()
430 ahp->ah_sifstime = (u_int) -1; /* restore default handling */ in ar5211SetSifsTime()
435 ahp->ah_slottime = us; in ar5211SetSifsTime()
455 ahp->ah_slottime = us; /* restore default handling */ in ar5211SetSlotTime()
460 ahp->ah_slottime = us; in ar5211SetSlotTime()
480 ahp->ah_acktimeout = (u_int) -1; /* restore default handling */ in ar5211SetAckTimeout()
486 ahp->ah_acktimeout = us; in ar5211SetAckTimeout()
501 return ((AH5211(ah)->ah_staId1Defaults & AR_STA_ID1_ACKCTS_6MB) == 0); in ar5211GetAckCTSRate()
511 ahp->ah_staId1Defaults &= ~AR_STA_ID1_ACKCTS_6MB; in ar5211SetAckCTSRate()
514 ahp->ah_staId1Defaults |= AR_STA_ID1_ACKCTS_6MB; in ar5211SetAckCTSRate()
527 ahp->ah_ctstimeout = (u_int) -1; /* restore default handling */ in ar5211SetCTSTimeout()
533 ahp->ah_ctstimeout = us; in ar5211SetCTSTimeout()
613 return AH5211(ah)->ah_diversityControl; in ar5211GetAntennaSwitch()
619 const struct ieee80211_channel *chan = AH_PRIVATE(ah)->ah_curchan; in ar5211SetAntennaSwitch()
622 AH5211(ah)->ah_diversityControl = settings; in ar5211SetAntennaSwitch()
660 AH_PRIVATE(ah)->ah_diagreg = setting; in ar5211SetCapability()
662 AH_PRIVATE(ah)->ah_diagreg = setting & 0x6; /* ACK+CTS */ in ar5211SetCapability()
664 OS_REG_WRITE(ah, AR_DIAG_SW, AH_PRIVATE(ah)->ah_diagreg); in ar5211SetCapability()
687 *result = &ahp->ah_gainValues; in ar5211GetDiagState()
691 *result = __DECONST(void *, ahp->ah_gainValues.currStep); in ar5211GetDiagState()