linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Malcolm Priestley <tvboxspy@gmail.com>
To: gregkh@linuxfoundation.org
Cc: linux-wireless@vger.kernel.org, forest@alittletooquiet.net,
	Malcolm Priestley <tvboxspy@gmail.com>
Subject: [PATCH v2 09/34] staging: vt6655: mac80211 conversion add channel bands
Date: Wed, 29 Oct 2014 17:43:44 +0000	[thread overview]
Message-ID: <1414604649-9105-10-git-send-email-tvboxspy@gmail.com> (raw)
In-Reply-To: <1414604649-9105-1-git-send-email-tvboxspy@gmail.com>

Add rates and channels according to rf type for vnt_init_bands which is a
mac80211 replacement for init_channel_table.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
---
 drivers/staging/vt6655/channel.c     | 140 +++++++++++++++++++++++++++++++++++
 drivers/staging/vt6655/channel.h     |   2 +
 drivers/staging/vt6655/device_main.c |   2 +
 3 files changed, 144 insertions(+)

diff --git a/drivers/staging/vt6655/channel.c b/drivers/staging/vt6655/channel.c
index a19965f..4b3c798 100644
--- a/drivers/staging/vt6655/channel.c
+++ b/drivers/staging/vt6655/channel.c
@@ -352,6 +352,146 @@ static struct
 
 /*---------------------  Export Functions  --------------------------*/
 
+static struct ieee80211_rate vnt_rates_bg[] = {
+	{ .bitrate = 10,  .hw_value = RATE_1M },
+	{ .bitrate = 20,  .hw_value = RATE_2M },
+	{ .bitrate = 55,  .hw_value = RATE_5M },
+	{ .bitrate = 110, .hw_value = RATE_11M },
+	{ .bitrate = 60,  .hw_value = RATE_6M },
+	{ .bitrate = 90,  .hw_value = RATE_9M },
+	{ .bitrate = 120, .hw_value = RATE_12M },
+	{ .bitrate = 180, .hw_value = RATE_18M },
+	{ .bitrate = 240, .hw_value = RATE_24M },
+	{ .bitrate = 360, .hw_value = RATE_36M },
+	{ .bitrate = 480, .hw_value = RATE_48M },
+	{ .bitrate = 540, .hw_value = RATE_54M },
+};
+
+static struct ieee80211_rate vnt_rates_a[] = {
+	{ .bitrate = 60,  .hw_value = RATE_6M },
+	{ .bitrate = 90,  .hw_value = RATE_9M },
+	{ .bitrate = 120, .hw_value = RATE_12M },
+	{ .bitrate = 180, .hw_value = RATE_18M },
+	{ .bitrate = 240, .hw_value = RATE_24M },
+	{ .bitrate = 360, .hw_value = RATE_36M },
+	{ .bitrate = 480, .hw_value = RATE_48M },
+	{ .bitrate = 540, .hw_value = RATE_54M },
+};
+
+static struct ieee80211_channel vnt_channels_2ghz[] = {
+	{ .center_freq = 2412, .hw_value = 1 },
+	{ .center_freq = 2417, .hw_value = 2 },
+	{ .center_freq = 2422, .hw_value = 3 },
+	{ .center_freq = 2427, .hw_value = 4 },
+	{ .center_freq = 2432, .hw_value = 5 },
+	{ .center_freq = 2437, .hw_value = 6 },
+	{ .center_freq = 2442, .hw_value = 7 },
+	{ .center_freq = 2447, .hw_value = 8 },
+	{ .center_freq = 2452, .hw_value = 9 },
+	{ .center_freq = 2457, .hw_value = 10 },
+	{ .center_freq = 2462, .hw_value = 11 },
+	{ .center_freq = 2467, .hw_value = 12 },
+	{ .center_freq = 2472, .hw_value = 13 },
+	{ .center_freq = 2484, .hw_value = 14 }
+};
+
+static struct ieee80211_channel vnt_channels_5ghz[] = {
+	{ .center_freq = 4915, .hw_value = 15 },
+	{ .center_freq = 4920, .hw_value = 16 },
+	{ .center_freq = 4925, .hw_value = 17 },
+	{ .center_freq = 4935, .hw_value = 18 },
+	{ .center_freq = 4940, .hw_value = 19 },
+	{ .center_freq = 4945, .hw_value = 20 },
+	{ .center_freq = 4960, .hw_value = 21 },
+	{ .center_freq = 4980, .hw_value = 22 },
+	{ .center_freq = 5035, .hw_value = 23 },
+	{ .center_freq = 5040, .hw_value = 24 },
+	{ .center_freq = 5045, .hw_value = 25 },
+	{ .center_freq = 5055, .hw_value = 26 },
+	{ .center_freq = 5060, .hw_value = 27 },
+	{ .center_freq = 5080, .hw_value = 28 },
+	{ .center_freq = 5170, .hw_value = 29 },
+	{ .center_freq = 5180, .hw_value = 30 },
+	{ .center_freq = 5190, .hw_value = 31 },
+	{ .center_freq = 5200, .hw_value = 32 },
+	{ .center_freq = 5210, .hw_value = 33 },
+	{ .center_freq = 5220, .hw_value = 34 },
+	{ .center_freq = 5230, .hw_value = 35 },
+	{ .center_freq = 5240, .hw_value = 36 },
+	{ .center_freq = 5260, .hw_value = 37 },
+	{ .center_freq = 5280, .hw_value = 38 },
+	{ .center_freq = 5300, .hw_value = 39 },
+	{ .center_freq = 5320, .hw_value = 40 },
+	{ .center_freq = 5500, .hw_value = 41 },
+	{ .center_freq = 5520, .hw_value = 42 },
+	{ .center_freq = 5540, .hw_value = 43 },
+	{ .center_freq = 5560, .hw_value = 44 },
+	{ .center_freq = 5580, .hw_value = 45 },
+	{ .center_freq = 5600, .hw_value = 46 },
+	{ .center_freq = 5620, .hw_value = 47 },
+	{ .center_freq = 5640, .hw_value = 48 },
+	{ .center_freq = 5660, .hw_value = 49 },
+	{ .center_freq = 5680, .hw_value = 50 },
+	{ .center_freq = 5700, .hw_value = 51 },
+	{ .center_freq = 5745, .hw_value = 52 },
+	{ .center_freq = 5765, .hw_value = 53 },
+	{ .center_freq = 5785, .hw_value = 54 },
+	{ .center_freq = 5805, .hw_value = 55 },
+	{ .center_freq = 5825, .hw_value = 56 }
+};
+
+static struct ieee80211_supported_band vnt_supported_2ghz_band = {
+	.channels = vnt_channels_2ghz,
+	.n_channels = ARRAY_SIZE(vnt_channels_2ghz),
+	.bitrates = vnt_rates_bg,
+	.n_bitrates = ARRAY_SIZE(vnt_rates_bg),
+};
+
+static struct ieee80211_supported_band vnt_supported_5ghz_band = {
+	.channels = vnt_channels_5ghz,
+	.n_channels = ARRAY_SIZE(vnt_channels_5ghz),
+	.bitrates = vnt_rates_a,
+	.n_bitrates = ARRAY_SIZE(vnt_rates_a),
+};
+
+void vnt_init_bands(struct vnt_private *priv)
+{
+	struct ieee80211_channel *ch;
+	int i;
+
+	switch (priv->byRFType) {
+	case RF_AIROHA7230:
+	case RF_UW2452:
+	case RF_NOTHING:
+	default:
+		ch = vnt_channels_5ghz;
+
+		for (i = 0; i < ARRAY_SIZE(vnt_channels_5ghz); i++) {
+			ch[i].max_power = 0x3f;
+			ch[i].flags = IEEE80211_CHAN_NO_HT40;
+		}
+
+		priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
+						&vnt_supported_5ghz_band;
+	/* fallthrough */
+	case RF_RFMD2959:
+	case RF_AIROHA:
+	case RF_AL2230S:
+	case RF_UW2451:
+	case RF_VT3226:
+		ch = vnt_channels_2ghz;
+
+		for (i = 0; i < ARRAY_SIZE(vnt_channels_2ghz); i++) {
+			ch[i].max_power = 0x3f;
+			ch[i].flags = IEEE80211_CHAN_NO_HT40;
+		}
+
+		priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
+						&vnt_supported_2ghz_band;
+		break;
+	}
+}
+
 /**
  * is_channel_valid() - Is Country Channel Valid
  *  @ChanneIndex: defined as VT3253 MAC channel:
diff --git a/drivers/staging/vt6655/channel.h b/drivers/staging/vt6655/channel.h
index 4f44c8a..0d3e1f1 100644
--- a/drivers/staging/vt6655/channel.h
+++ b/drivers/staging/vt6655/channel.h
@@ -33,6 +33,8 @@ typedef struct tagSChannelTblElement {
 	unsigned char byMAP;
 } SChannelTblElement, *PSChannelTblElement;
 
+void vnt_init_bands(struct vnt_private *);
+
 bool is_channel_valid(unsigned int CountryCode);
 void init_channel_table(void *pDeviceHandler);
 unsigned char get_channel_mapping(void *pDeviceHandler, unsigned char byChannelNumber, CARD_PHY_TYPE ePhyType);
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 23d9344..054841b 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -3320,6 +3320,8 @@ int vnt_init(struct vnt_private *priv)
 {
 	SET_IEEE80211_PERM_ADDR(priv->hw, priv->abyCurrentNetAddr);
 
+	vnt_init_bands(priv);
+
 	if (ieee80211_register_hw(priv->hw))
 		return -ENODEV;
 
-- 
2.1.0


  parent reply	other threads:[~2014-10-29 17:45 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-29 17:43 [PATCH v2 00/34] staging: vt6655: Conversion to mac80211 Malcolm Priestley
2014-10-29 17:43 ` [PATCH v2 01/34] staging: vt6655: mac80211 conversion: add new rx functions Malcolm Priestley
2014-10-29 17:43 ` [PATCH v2 02/34] staging: vt6655: mac80211 conversion: add new key functions Malcolm Priestley
2014-10-29 17:43 ` [PATCH v2 03/34] staging: vt6655: mac8021 conversion: add new tx functions Malcolm Priestley
2014-10-29 17:43 ` [PATCH v2 04/34] staging: vt6655: mac80211 conversion: s_cbFillTxBufHead Malcolm Priestley
2014-10-29 17:43 ` [PATCH v2 05/34] staging: vt6655: dead code remove s_vFillFragParameter Malcolm Priestley
2014-10-29 17:43 ` [PATCH v2 06/34] staging: vt6655: mac80211 conversion: s_vFillRTSHead convert to using struct ieee80211_hdr Malcolm Priestley
2014-10-29 17:43 ` [PATCH v2 07/34] staging: vt6655: mac80211 conversion: s_uFillDataHead add power saving poll Malcolm Priestley
2014-10-29 17:43 ` [PATCH v2 08/34] staging: vt6655: mac80211 conversion add main mac80211 functions Malcolm Priestley
2014-10-29 17:43 ` Malcolm Priestley [this message]
2014-10-29 17:43 ` [PATCH v2 10/34] staging: vt6655: mac80211 conversion replace suspend resume functions Malcolm Priestley
2014-10-29 17:43 ` [PATCH v2 11/34] staging: vt6655: mac80211 conversion: device_print_info remove netdevice Malcolm Priestley
2014-10-29 17:43 ` [PATCH v2 12/34] staging: vt6655: mac80211 conversion: changes to device_intr Malcolm Priestley
2014-10-29 17:43 ` [PATCH v2 13/34] staging: vt6655: mac80211 conversion: device_tx_srv tx and add report rates Malcolm Priestley
2014-10-29 17:43 ` [PATCH v2 14/34] staging: vt6655: mac80211 conversion: changes to set channel Malcolm Priestley
2014-10-29 17:43 ` [PATCH v2 15/34] staging: vt6655: mac80211 conversion: enable power saving Malcolm Priestley
2014-10-29 17:43 ` [PATCH v2 16/34] staging: vt6655: mac80211 conversion: changes to CARDbSetPhyParameter Malcolm Priestley
2014-10-29 17:43 ` [PATCH v2 17/34] staging: vt6655: mac80211 conversion: card.c use basic_rates Malcolm Priestley
2014-10-29 17:43 ` [PATCH v2 18/34] staging: vt6655: CARDbSetPhyParameter replace s_vSetRSPINF with CARDvSetRSPINF Malcolm Priestley
2014-10-29 17:43 ` [PATCH v2 19/34] staging: vt6655: mac80211 conversion: device_init_registers remove legacy code Malcolm Priestley
2014-10-29 17:43 ` [PATCH v2 20/34] staging: vt6655: mac80211 conversion: device_free_info Malcolm Priestley
2014-10-29 17:43 ` [PATCH v2 21/34] staging: vt6655: switch driver over to mac80211 Malcolm Priestley
2014-10-29 17:43 ` [PATCH v2 22/34] staging: vt6655: phy type same as bb type Malcolm Priestley
2014-10-29 17:43 ` [PATCH v2 23/34] staging: vt6655: mac80211 conversion: device_error remove legacy functions Malcolm Priestley
2014-10-29 17:43 ` [PATCH v2 24/34] staging: vt6655: vt6655_probe remove management pointers Malcolm Priestley
2014-10-29 17:44 ` [PATCH v2 25/34] staging: vt6655: mac80211 conversion: PSbIsNextTBTTWakeUp convert to mac80211 Malcolm Priestley
2014-10-29 17:44 ` [PATCH v2 26/34] staging: vt6655: MACvSetDefaultKeyEntry replace WLAN_WEP104_KEYLEN Malcolm Priestley
2014-10-29 17:44 ` [PATCH v2 27/34] staging: vt6655: baseband.c replace BIT0 with BIT(0) Malcolm Priestley
2014-10-29 17:44 ` [PATCH v2 28/34] staging: vt6655: s_vGenerateTxParameter remove unused cbMACHdLen Malcolm Priestley
2014-10-29 17:44 ` [PATCH v2 29/34] staging: vt6655: device_init_registers replace spin lock Malcolm Priestley
2014-10-29 17:44 ` [PATCH v2 30/34] staging: vt6655: baseband.c timers " Malcolm Priestley
2014-10-29 17:44 ` [PATCH v2 31/34] staging: vt6655: fifo & frag control remove big endian values Malcolm Priestley
2014-10-29 17:44 ` [PATCH v2 32/34] staging: vt6655: vnt_rx_data: uCurrRSSI should have the value of *rssi Malcolm Priestley
2014-10-29 17:44 ` [PATCH v2 33/34] staging: vt6655: don't update bUpdateBBVGA when off channel Malcolm Priestley
2014-10-29 17:44 ` [PATCH v2 34/34] staging: vt6655: reset tsf on dissociation Malcolm Priestley
2014-10-29 20:32 ` [PATCH v2 00/34] staging: vt6655: Conversion to mac80211 Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1414604649-9105-10-git-send-email-tvboxspy@gmail.com \
    --to=tvboxspy@gmail.com \
    --cc=forest@alittletooquiet.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).