2007-11-19 23:20:12 +07:00
|
|
|
/* ZD1211 USB-WLAN driver for Linux
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005-2007 Ulrich Kunitz <kune@deine-taler.de>
|
|
|
|
* Copyright (C) 2006-2007 Daniel Drake <dsd@gentoo.org>
|
[PATCH] ZyDAS ZD1211 USB-WLAN driver
There are 60+ USB wifi adapters available on the market based on the ZyDAS
ZD1211 chip.
Unlike the predecessor (ZD1201), ZD1211 does not have a hardware MAC, so most
data operations are coordinated by the device driver. The ZD1211 chip sits
alongside an RF transceiver which is also controlled by the driver. Our driver
currently supports 2 RF types, we know of one other available in a few marketed
products which we will be supporting soon.
Our driver also supports the newer revision of ZD1211, called ZD1211B. The
initialization and RF operations are slightly different for the new revision,
but the main difference is 802.11e support. Our driver does not support the
QoS features yet, but we think we know how to use them.
This driver is based on ZyDAS's own GPL driver available from www.zydas.com.tw.
ZyDAS engineers have been responsive and supportive of our efforts, so thumbs
up to them. Additionally, the firmware is redistributable and they have
provided device specs.
This driver has been written primarily by Ulrich Kunitz and myself. Graham
Gower, Greg KH, Remco and Bryan Rittmeyer have also contributed. The
developers of ieee80211 and softmac have made our lives so much easier- thanks!
We maintain a small info-page: http://zd1211.ath.cx/wiki/DriverRewrite
If there is enough time for review, we would like to aim for inclusion in
2.6.18. The driver works nicely as a STA, and can connect to both open and
encrypted networks (we are using software-based encryption for now). We will
work towards supporting more advanced features in the future (ad-hoc, master
mode, 802.11a, ...).
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2006-06-02 23:11:32 +07:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2013-12-06 18:32:10 +07:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
[PATCH] ZyDAS ZD1211 USB-WLAN driver
There are 60+ USB wifi adapters available on the market based on the ZyDAS
ZD1211 chip.
Unlike the predecessor (ZD1201), ZD1211 does not have a hardware MAC, so most
data operations are coordinated by the device driver. The ZD1211 chip sits
alongside an RF transceiver which is also controlled by the driver. Our driver
currently supports 2 RF types, we know of one other available in a few marketed
products which we will be supporting soon.
Our driver also supports the newer revision of ZD1211, called ZD1211B. The
initialization and RF operations are slightly different for the new revision,
but the main difference is 802.11e support. Our driver does not support the
QoS features yet, but we think we know how to use them.
This driver is based on ZyDAS's own GPL driver available from www.zydas.com.tw.
ZyDAS engineers have been responsive and supportive of our efforts, so thumbs
up to them. Additionally, the firmware is redistributable and they have
provided device specs.
This driver has been written primarily by Ulrich Kunitz and myself. Graham
Gower, Greg KH, Remco and Bryan Rittmeyer have also contributed. The
developers of ieee80211 and softmac have made our lives so much easier- thanks!
We maintain a small info-page: http://zd1211.ath.cx/wiki/DriverRewrite
If there is enough time for review, we would like to aim for inclusion in
2.6.18. The driver works nicely as a STA, and can connect to both open and
encrypted networks (we are using software-based encryption for now). We will
work towards supporting more advanced features in the future (ad-hoc, master
mode, 802.11a, ...).
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2006-06-02 23:11:32 +07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/string.h>
|
|
|
|
|
|
|
|
#include "zd_def.h"
|
|
|
|
#include "zd_rf.h"
|
2008-09-10 13:19:49 +07:00
|
|
|
#include "zd_mac.h"
|
[PATCH] ZyDAS ZD1211 USB-WLAN driver
There are 60+ USB wifi adapters available on the market based on the ZyDAS
ZD1211 chip.
Unlike the predecessor (ZD1201), ZD1211 does not have a hardware MAC, so most
data operations are coordinated by the device driver. The ZD1211 chip sits
alongside an RF transceiver which is also controlled by the driver. Our driver
currently supports 2 RF types, we know of one other available in a few marketed
products which we will be supporting soon.
Our driver also supports the newer revision of ZD1211, called ZD1211B. The
initialization and RF operations are slightly different for the new revision,
but the main difference is 802.11e support. Our driver does not support the
QoS features yet, but we think we know how to use them.
This driver is based on ZyDAS's own GPL driver available from www.zydas.com.tw.
ZyDAS engineers have been responsive and supportive of our efforts, so thumbs
up to them. Additionally, the firmware is redistributable and they have
provided device specs.
This driver has been written primarily by Ulrich Kunitz and myself. Graham
Gower, Greg KH, Remco and Bryan Rittmeyer have also contributed. The
developers of ieee80211 and softmac have made our lives so much easier- thanks!
We maintain a small info-page: http://zd1211.ath.cx/wiki/DriverRewrite
If there is enough time for review, we would like to aim for inclusion in
2.6.18. The driver works nicely as a STA, and can connect to both open and
encrypted networks (we are using software-based encryption for now). We will
work towards supporting more advanced features in the future (ad-hoc, master
mode, 802.11a, ...).
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2006-06-02 23:11:32 +07:00
|
|
|
#include "zd_chip.h"
|
|
|
|
|
2007-03-26 06:59:18 +07:00
|
|
|
static const char * const rfs[] = {
|
[PATCH] ZyDAS ZD1211 USB-WLAN driver
There are 60+ USB wifi adapters available on the market based on the ZyDAS
ZD1211 chip.
Unlike the predecessor (ZD1201), ZD1211 does not have a hardware MAC, so most
data operations are coordinated by the device driver. The ZD1211 chip sits
alongside an RF transceiver which is also controlled by the driver. Our driver
currently supports 2 RF types, we know of one other available in a few marketed
products which we will be supporting soon.
Our driver also supports the newer revision of ZD1211, called ZD1211B. The
initialization and RF operations are slightly different for the new revision,
but the main difference is 802.11e support. Our driver does not support the
QoS features yet, but we think we know how to use them.
This driver is based on ZyDAS's own GPL driver available from www.zydas.com.tw.
ZyDAS engineers have been responsive and supportive of our efforts, so thumbs
up to them. Additionally, the firmware is redistributable and they have
provided device specs.
This driver has been written primarily by Ulrich Kunitz and myself. Graham
Gower, Greg KH, Remco and Bryan Rittmeyer have also contributed. The
developers of ieee80211 and softmac have made our lives so much easier- thanks!
We maintain a small info-page: http://zd1211.ath.cx/wiki/DriverRewrite
If there is enough time for review, we would like to aim for inclusion in
2.6.18. The driver works nicely as a STA, and can connect to both open and
encrypted networks (we are using software-based encryption for now). We will
work towards supporting more advanced features in the future (ad-hoc, master
mode, 802.11a, ...).
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2006-06-02 23:11:32 +07:00
|
|
|
[0] = "unknown RF0",
|
|
|
|
[1] = "unknown RF1",
|
|
|
|
[UW2451_RF] = "UW2451_RF",
|
|
|
|
[UCHIP_RF] = "UCHIP_RF",
|
|
|
|
[AL2230_RF] = "AL2230_RF",
|
|
|
|
[AL7230B_RF] = "AL7230B_RF",
|
|
|
|
[THETA_RF] = "THETA_RF",
|
|
|
|
[AL2210_RF] = "AL2210_RF",
|
|
|
|
[MAXIM_NEW_RF] = "MAXIM_NEW_RF",
|
|
|
|
[UW2453_RF] = "UW2453_RF",
|
2007-07-02 00:22:04 +07:00
|
|
|
[AL2230S_RF] = "AL2230S_RF",
|
[PATCH] ZyDAS ZD1211 USB-WLAN driver
There are 60+ USB wifi adapters available on the market based on the ZyDAS
ZD1211 chip.
Unlike the predecessor (ZD1201), ZD1211 does not have a hardware MAC, so most
data operations are coordinated by the device driver. The ZD1211 chip sits
alongside an RF transceiver which is also controlled by the driver. Our driver
currently supports 2 RF types, we know of one other available in a few marketed
products which we will be supporting soon.
Our driver also supports the newer revision of ZD1211, called ZD1211B. The
initialization and RF operations are slightly different for the new revision,
but the main difference is 802.11e support. Our driver does not support the
QoS features yet, but we think we know how to use them.
This driver is based on ZyDAS's own GPL driver available from www.zydas.com.tw.
ZyDAS engineers have been responsive and supportive of our efforts, so thumbs
up to them. Additionally, the firmware is redistributable and they have
provided device specs.
This driver has been written primarily by Ulrich Kunitz and myself. Graham
Gower, Greg KH, Remco and Bryan Rittmeyer have also contributed. The
developers of ieee80211 and softmac have made our lives so much easier- thanks!
We maintain a small info-page: http://zd1211.ath.cx/wiki/DriverRewrite
If there is enough time for review, we would like to aim for inclusion in
2.6.18. The driver works nicely as a STA, and can connect to both open and
encrypted networks (we are using software-based encryption for now). We will
work towards supporting more advanced features in the future (ad-hoc, master
mode, 802.11a, ...).
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2006-06-02 23:11:32 +07:00
|
|
|
[RALINK_RF] = "RALINK_RF",
|
|
|
|
[INTERSIL_RF] = "INTERSIL_RF",
|
|
|
|
[RF2959_RF] = "RF2959_RF",
|
|
|
|
[MAXIM_NEW2_RF] = "MAXIM_NEW2_RF",
|
|
|
|
[PHILIPS_RF] = "PHILIPS_RF",
|
|
|
|
};
|
|
|
|
|
|
|
|
const char *zd_rf_name(u8 type)
|
|
|
|
{
|
|
|
|
if (type & 0xf0)
|
|
|
|
type = 0;
|
|
|
|
return rfs[type];
|
|
|
|
}
|
|
|
|
|
|
|
|
void zd_rf_init(struct zd_rf *rf)
|
|
|
|
{
|
|
|
|
memset(rf, 0, sizeof(*rf));
|
2007-05-24 07:06:41 +07:00
|
|
|
|
|
|
|
/* default to update channel integration, as almost all RF's do want
|
|
|
|
* this */
|
|
|
|
rf->update_channel_int = 1;
|
[PATCH] ZyDAS ZD1211 USB-WLAN driver
There are 60+ USB wifi adapters available on the market based on the ZyDAS
ZD1211 chip.
Unlike the predecessor (ZD1201), ZD1211 does not have a hardware MAC, so most
data operations are coordinated by the device driver. The ZD1211 chip sits
alongside an RF transceiver which is also controlled by the driver. Our driver
currently supports 2 RF types, we know of one other available in a few marketed
products which we will be supporting soon.
Our driver also supports the newer revision of ZD1211, called ZD1211B. The
initialization and RF operations are slightly different for the new revision,
but the main difference is 802.11e support. Our driver does not support the
QoS features yet, but we think we know how to use them.
This driver is based on ZyDAS's own GPL driver available from www.zydas.com.tw.
ZyDAS engineers have been responsive and supportive of our efforts, so thumbs
up to them. Additionally, the firmware is redistributable and they have
provided device specs.
This driver has been written primarily by Ulrich Kunitz and myself. Graham
Gower, Greg KH, Remco and Bryan Rittmeyer have also contributed. The
developers of ieee80211 and softmac have made our lives so much easier- thanks!
We maintain a small info-page: http://zd1211.ath.cx/wiki/DriverRewrite
If there is enough time for review, we would like to aim for inclusion in
2.6.18. The driver works nicely as a STA, and can connect to both open and
encrypted networks (we are using software-based encryption for now). We will
work towards supporting more advanced features in the future (ad-hoc, master
mode, 802.11a, ...).
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2006-06-02 23:11:32 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
void zd_rf_clear(struct zd_rf *rf)
|
|
|
|
{
|
2007-05-24 07:06:41 +07:00
|
|
|
if (rf->clear)
|
|
|
|
rf->clear(rf);
|
2006-08-13 00:00:17 +07:00
|
|
|
ZD_MEMCLEAR(rf, sizeof(*rf));
|
[PATCH] ZyDAS ZD1211 USB-WLAN driver
There are 60+ USB wifi adapters available on the market based on the ZyDAS
ZD1211 chip.
Unlike the predecessor (ZD1201), ZD1211 does not have a hardware MAC, so most
data operations are coordinated by the device driver. The ZD1211 chip sits
alongside an RF transceiver which is also controlled by the driver. Our driver
currently supports 2 RF types, we know of one other available in a few marketed
products which we will be supporting soon.
Our driver also supports the newer revision of ZD1211, called ZD1211B. The
initialization and RF operations are slightly different for the new revision,
but the main difference is 802.11e support. Our driver does not support the
QoS features yet, but we think we know how to use them.
This driver is based on ZyDAS's own GPL driver available from www.zydas.com.tw.
ZyDAS engineers have been responsive and supportive of our efforts, so thumbs
up to them. Additionally, the firmware is redistributable and they have
provided device specs.
This driver has been written primarily by Ulrich Kunitz and myself. Graham
Gower, Greg KH, Remco and Bryan Rittmeyer have also contributed. The
developers of ieee80211 and softmac have made our lives so much easier- thanks!
We maintain a small info-page: http://zd1211.ath.cx/wiki/DriverRewrite
If there is enough time for review, we would like to aim for inclusion in
2.6.18. The driver works nicely as a STA, and can connect to both open and
encrypted networks (we are using software-based encryption for now). We will
work towards supporting more advanced features in the future (ad-hoc, master
mode, 802.11a, ...).
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2006-06-02 23:11:32 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
int zd_rf_init_hw(struct zd_rf *rf, u8 type)
|
|
|
|
{
|
2007-05-24 07:06:53 +07:00
|
|
|
int r = 0;
|
|
|
|
int t;
|
[PATCH] ZyDAS ZD1211 USB-WLAN driver
There are 60+ USB wifi adapters available on the market based on the ZyDAS
ZD1211 chip.
Unlike the predecessor (ZD1201), ZD1211 does not have a hardware MAC, so most
data operations are coordinated by the device driver. The ZD1211 chip sits
alongside an RF transceiver which is also controlled by the driver. Our driver
currently supports 2 RF types, we know of one other available in a few marketed
products which we will be supporting soon.
Our driver also supports the newer revision of ZD1211, called ZD1211B. The
initialization and RF operations are slightly different for the new revision,
but the main difference is 802.11e support. Our driver does not support the
QoS features yet, but we think we know how to use them.
This driver is based on ZyDAS's own GPL driver available from www.zydas.com.tw.
ZyDAS engineers have been responsive and supportive of our efforts, so thumbs
up to them. Additionally, the firmware is redistributable and they have
provided device specs.
This driver has been written primarily by Ulrich Kunitz and myself. Graham
Gower, Greg KH, Remco and Bryan Rittmeyer have also contributed. The
developers of ieee80211 and softmac have made our lives so much easier- thanks!
We maintain a small info-page: http://zd1211.ath.cx/wiki/DriverRewrite
If there is enough time for review, we would like to aim for inclusion in
2.6.18. The driver works nicely as a STA, and can connect to both open and
encrypted networks (we are using software-based encryption for now). We will
work towards supporting more advanced features in the future (ad-hoc, master
mode, 802.11a, ...).
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2006-06-02 23:11:32 +07:00
|
|
|
struct zd_chip *chip = zd_rf_to_chip(rf);
|
|
|
|
|
|
|
|
ZD_ASSERT(mutex_is_locked(&chip->mutex));
|
|
|
|
switch (type) {
|
|
|
|
case RF2959_RF:
|
|
|
|
r = zd_rf_init_rf2959(rf);
|
|
|
|
break;
|
|
|
|
case AL2230_RF:
|
2007-07-02 00:22:04 +07:00
|
|
|
case AL2230S_RF:
|
[PATCH] ZyDAS ZD1211 USB-WLAN driver
There are 60+ USB wifi adapters available on the market based on the ZyDAS
ZD1211 chip.
Unlike the predecessor (ZD1201), ZD1211 does not have a hardware MAC, so most
data operations are coordinated by the device driver. The ZD1211 chip sits
alongside an RF transceiver which is also controlled by the driver. Our driver
currently supports 2 RF types, we know of one other available in a few marketed
products which we will be supporting soon.
Our driver also supports the newer revision of ZD1211, called ZD1211B. The
initialization and RF operations are slightly different for the new revision,
but the main difference is 802.11e support. Our driver does not support the
QoS features yet, but we think we know how to use them.
This driver is based on ZyDAS's own GPL driver available from www.zydas.com.tw.
ZyDAS engineers have been responsive and supportive of our efforts, so thumbs
up to them. Additionally, the firmware is redistributable and they have
provided device specs.
This driver has been written primarily by Ulrich Kunitz and myself. Graham
Gower, Greg KH, Remco and Bryan Rittmeyer have also contributed. The
developers of ieee80211 and softmac have made our lives so much easier- thanks!
We maintain a small info-page: http://zd1211.ath.cx/wiki/DriverRewrite
If there is enough time for review, we would like to aim for inclusion in
2.6.18. The driver works nicely as a STA, and can connect to both open and
encrypted networks (we are using software-based encryption for now). We will
work towards supporting more advanced features in the future (ad-hoc, master
mode, 802.11a, ...).
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2006-06-02 23:11:32 +07:00
|
|
|
r = zd_rf_init_al2230(rf);
|
|
|
|
break;
|
2006-08-12 23:59:46 +07:00
|
|
|
case AL7230B_RF:
|
|
|
|
r = zd_rf_init_al7230b(rf);
|
2007-05-24 07:06:53 +07:00
|
|
|
break;
|
2009-02-05 06:40:43 +07:00
|
|
|
case MAXIM_NEW_RF:
|
2007-05-24 07:06:53 +07:00
|
|
|
case UW2453_RF:
|
|
|
|
r = zd_rf_init_uw2453(rf);
|
2006-08-12 23:59:46 +07:00
|
|
|
break;
|
[PATCH] ZyDAS ZD1211 USB-WLAN driver
There are 60+ USB wifi adapters available on the market based on the ZyDAS
ZD1211 chip.
Unlike the predecessor (ZD1201), ZD1211 does not have a hardware MAC, so most
data operations are coordinated by the device driver. The ZD1211 chip sits
alongside an RF transceiver which is also controlled by the driver. Our driver
currently supports 2 RF types, we know of one other available in a few marketed
products which we will be supporting soon.
Our driver also supports the newer revision of ZD1211, called ZD1211B. The
initialization and RF operations are slightly different for the new revision,
but the main difference is 802.11e support. Our driver does not support the
QoS features yet, but we think we know how to use them.
This driver is based on ZyDAS's own GPL driver available from www.zydas.com.tw.
ZyDAS engineers have been responsive and supportive of our efforts, so thumbs
up to them. Additionally, the firmware is redistributable and they have
provided device specs.
This driver has been written primarily by Ulrich Kunitz and myself. Graham
Gower, Greg KH, Remco and Bryan Rittmeyer have also contributed. The
developers of ieee80211 and softmac have made our lives so much easier- thanks!
We maintain a small info-page: http://zd1211.ath.cx/wiki/DriverRewrite
If there is enough time for review, we would like to aim for inclusion in
2.6.18. The driver works nicely as a STA, and can connect to both open and
encrypted networks (we are using software-based encryption for now). We will
work towards supporting more advanced features in the future (ad-hoc, master
mode, 802.11a, ...).
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2006-06-02 23:11:32 +07:00
|
|
|
default:
|
|
|
|
dev_err(zd_chip_dev(chip),
|
|
|
|
"RF %s %#x is not supported\n", zd_rf_name(type), type);
|
|
|
|
rf->type = 0;
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
2007-05-24 07:06:53 +07:00
|
|
|
if (r)
|
|
|
|
return r;
|
|
|
|
|
[PATCH] ZyDAS ZD1211 USB-WLAN driver
There are 60+ USB wifi adapters available on the market based on the ZyDAS
ZD1211 chip.
Unlike the predecessor (ZD1201), ZD1211 does not have a hardware MAC, so most
data operations are coordinated by the device driver. The ZD1211 chip sits
alongside an RF transceiver which is also controlled by the driver. Our driver
currently supports 2 RF types, we know of one other available in a few marketed
products which we will be supporting soon.
Our driver also supports the newer revision of ZD1211, called ZD1211B. The
initialization and RF operations are slightly different for the new revision,
but the main difference is 802.11e support. Our driver does not support the
QoS features yet, but we think we know how to use them.
This driver is based on ZyDAS's own GPL driver available from www.zydas.com.tw.
ZyDAS engineers have been responsive and supportive of our efforts, so thumbs
up to them. Additionally, the firmware is redistributable and they have
provided device specs.
This driver has been written primarily by Ulrich Kunitz and myself. Graham
Gower, Greg KH, Remco and Bryan Rittmeyer have also contributed. The
developers of ieee80211 and softmac have made our lives so much easier- thanks!
We maintain a small info-page: http://zd1211.ath.cx/wiki/DriverRewrite
If there is enough time for review, we would like to aim for inclusion in
2.6.18. The driver works nicely as a STA, and can connect to both open and
encrypted networks (we are using software-based encryption for now). We will
work towards supporting more advanced features in the future (ad-hoc, master
mode, 802.11a, ...).
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2006-06-02 23:11:32 +07:00
|
|
|
rf->type = type;
|
|
|
|
|
|
|
|
r = zd_chip_lock_phy_regs(chip);
|
|
|
|
if (r)
|
|
|
|
return r;
|
|
|
|
t = rf->init_hw(rf);
|
|
|
|
r = zd_chip_unlock_phy_regs(chip);
|
|
|
|
if (t)
|
|
|
|
r = t;
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
int zd_rf_scnprint_id(struct zd_rf *rf, char *buffer, size_t size)
|
|
|
|
{
|
|
|
|
return scnprintf(buffer, size, "%s", zd_rf_name(rf->type));
|
|
|
|
}
|
|
|
|
|
|
|
|
int zd_rf_set_channel(struct zd_rf *rf, u8 channel)
|
|
|
|
{
|
|
|
|
int r;
|
|
|
|
|
|
|
|
ZD_ASSERT(mutex_is_locked(&zd_rf_to_chip(rf)->mutex));
|
|
|
|
if (channel < MIN_CHANNEL24)
|
|
|
|
return -EINVAL;
|
|
|
|
if (channel > MAX_CHANNEL24)
|
|
|
|
return -EINVAL;
|
|
|
|
dev_dbg_f(zd_chip_dev(zd_rf_to_chip(rf)), "channel: %d\n", channel);
|
|
|
|
|
|
|
|
r = rf->set_channel(rf, channel);
|
|
|
|
if (r >= 0)
|
|
|
|
rf->channel = channel;
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
int zd_switch_radio_on(struct zd_rf *rf)
|
|
|
|
{
|
|
|
|
int r, t;
|
|
|
|
struct zd_chip *chip = zd_rf_to_chip(rf);
|
|
|
|
|
|
|
|
ZD_ASSERT(mutex_is_locked(&chip->mutex));
|
|
|
|
r = zd_chip_lock_phy_regs(chip);
|
|
|
|
if (r)
|
|
|
|
return r;
|
|
|
|
t = rf->switch_radio_on(rf);
|
|
|
|
r = zd_chip_unlock_phy_regs(chip);
|
|
|
|
if (t)
|
|
|
|
r = t;
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
int zd_switch_radio_off(struct zd_rf *rf)
|
|
|
|
{
|
|
|
|
int r, t;
|
|
|
|
struct zd_chip *chip = zd_rf_to_chip(rf);
|
|
|
|
|
|
|
|
/* TODO: move phy regs handling to zd_chip */
|
|
|
|
ZD_ASSERT(mutex_is_locked(&chip->mutex));
|
|
|
|
r = zd_chip_lock_phy_regs(chip);
|
|
|
|
if (r)
|
|
|
|
return r;
|
|
|
|
t = rf->switch_radio_off(rf);
|
|
|
|
r = zd_chip_unlock_phy_regs(chip);
|
|
|
|
if (t)
|
|
|
|
r = t;
|
|
|
|
return r;
|
|
|
|
}
|
2007-04-07 22:00:15 +07:00
|
|
|
|
|
|
|
int zd_rf_patch_6m_band_edge(struct zd_rf *rf, u8 channel)
|
|
|
|
{
|
|
|
|
if (!rf->patch_6m_band_edge)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return rf->patch_6m_band_edge(rf, channel);
|
|
|
|
}
|
|
|
|
|
|
|
|
int zd_rf_generic_patch_6m(struct zd_rf *rf, u8 channel)
|
|
|
|
{
|
|
|
|
return zd_chip_generic_patch_6m_band(zd_rf_to_chip(rf), channel);
|
|
|
|
}
|
|
|
|
|