aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/p54
diff options
context:
space:
mode:
authorChristian Lamparter <chunkeey@web.de>2008-12-26 15:50:33 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-01-29 15:59:40 -0500
commit98a8d1a8f22237e2aa7db5453df0f68935a5ede0 (patch)
tree6cb4cf681d24d6228f34a6ab3f4e789e5ca2bc20 /drivers/net/wireless/p54
parente365f16046b72977ec22364215b57af840f0907e (diff)
p54: regulatory domain hints
This patch adds a sub-routine that parses the default country eeprom entry and forwards the obtained Alpha2 identifier to the regulatory sub-system. Note: I dropped the p54 specific regdomain<->alpha2 conversion code for now. But it will be added as soon as there's the common library function is ready. Signed-off-by: Christian Lamparter <chunkeey@web.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/p54')
-rw-r--r--drivers/net/wireless/p54/p54common.c34
-rw-r--r--drivers/net/wireless/p54/p54common.h6
2 files changed, 39 insertions, 1 deletions
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
index 28d98338957..8d2df5b6ecb 100644
--- a/drivers/net/wireless/p54/p54common.c
+++ b/drivers/net/wireless/p54/p54common.c
@@ -376,6 +376,36 @@ static void p54_parse_rssical(struct ieee80211_hw *dev, void *data, int len,
376 } 376 }
377} 377}
378 378
379static void p54_parse_default_country(struct ieee80211_hw *dev,
380 void *data, int len)
381{
382 struct pda_country *country;
383
384 if (len != sizeof(*country)) {
385 printk(KERN_ERR "%s: found possible invalid default country "
386 "eeprom entry. (entry size: %d)\n",
387 wiphy_name(dev->wiphy), len);
388
389 print_hex_dump_bytes("country:", DUMP_PREFIX_NONE,
390 data, len);
391
392 printk(KERN_ERR "%s: please report this issue.\n",
393 wiphy_name(dev->wiphy));
394 return;
395 }
396
397 country = (struct pda_country *) data;
398 if (country->flags == PDR_COUNTRY_CERT_CODE_PSEUDO)
399 regulatory_hint(dev->wiphy, country->alpha2);
400 else {
401 /* TODO:
402 * write a shared/common function that converts
403 * "Regulatory domain codes" (802.11-2007 14.8.2.2)
404 * into ISO/IEC 3166-1 alpha2 for regulatory_hint.
405 */
406 }
407}
408
379static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len) 409static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
380{ 410{
381 struct p54_common *priv = dev->priv; 411 struct p54_common *priv = dev->priv;
@@ -463,6 +493,9 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
463 memcpy(priv->iq_autocal, entry->data, data_len); 493 memcpy(priv->iq_autocal, entry->data, data_len);
464 priv->iq_autocal_len = data_len / sizeof(struct pda_iq_autocal_entry); 494 priv->iq_autocal_len = data_len / sizeof(struct pda_iq_autocal_entry);
465 break; 495 break;
496 case PDR_DEFAULT_COUNTRY:
497 p54_parse_default_country(dev, entry->data, data_len);
498 break;
466 case PDR_INTERFACE_LIST: 499 case PDR_INTERFACE_LIST:
467 tmp = entry->data; 500 tmp = entry->data;
468 while ((u8 *)tmp < entry->data + data_len) { 501 while ((u8 *)tmp < entry->data + data_len) {
@@ -497,7 +530,6 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
497 case PDR_UTF8_OEM_NAME: 530 case PDR_UTF8_OEM_NAME:
498 case PDR_UTF8_PRODUCT_NAME: 531 case PDR_UTF8_PRODUCT_NAME:
499 case PDR_COUNTRY_LIST: 532 case PDR_COUNTRY_LIST:
500 case PDR_DEFAULT_COUNTRY:
501 case PDR_ANTENNA_GAIN: 533 case PDR_ANTENNA_GAIN:
502 case PDR_PRISM_INDIGO_PA_CALIBRATION_DATA: 534 case PDR_PRISM_INDIGO_PA_CALIBRATION_DATA:
503 case PDR_REGULATORY_POWER_LIMITS: 535 case PDR_REGULATORY_POWER_LIMITS:
diff --git a/drivers/net/wireless/p54/p54common.h b/drivers/net/wireless/p54/p54common.h
index 514f660d0be..163e3adba42 100644
--- a/drivers/net/wireless/p54/p54common.h
+++ b/drivers/net/wireless/p54/p54common.h
@@ -180,6 +180,12 @@ struct pda_rssi_cal_entry {
180 __le16 add; 180 __le16 add;
181} __attribute__ ((packed)); 181} __attribute__ ((packed));
182 182
183struct pda_country {
184 u8 regdomain;
185 u8 alpha2[2];
186 u8 flags;
187} __attribute__ ((packed));
188
183/* 189/*
184 * this defines the PDR codes used to build PDAs as defined in document 190 * this defines the PDR codes used to build PDAs as defined in document
185 * number 553155. The current implementation mirrors version 1.1 of the 191 * number 553155. The current implementation mirrors version 1.1 of the