From df269342ffe886dfe7e4755a62f052488a58bbe9 Mon Sep 17 00:00:00 2001 From: Dmitry Shmidt Date: Mon, 14 Feb 2011 17:48:56 -0800 Subject: [PATCH] net: wireless: bcm4329: Get country translation from platform data Signed-off-by: Dmitry Shmidt --- drivers/net/wireless/bcm4329/dhd_custom_gpio.c | 36 ++++++++++++++++++-------- drivers/net/wireless/bcm4329/dhd_linux.c | 11 ++++++++ 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/bcm4329/dhd_custom_gpio.c b/drivers/net/wireless/bcm4329/dhd_custom_gpio.c index 4739b97..aaca56c 100644 --- a/drivers/net/wireless/bcm4329/dhd_custom_gpio.c +++ b/drivers/net/wireless/bcm4329/dhd_custom_gpio.c @@ -47,6 +47,7 @@ int wifi_set_carddetect(int on); int wifi_set_power(int on, unsigned long msec); int wifi_get_irq_number(unsigned long *irq_flags_ptr); int wifi_get_mac_addr(unsigned char *buf); +void *wifi_get_country_code(char *ccode); #endif #if defined(OOB_INTR_ONLY) @@ -178,23 +179,22 @@ dhd_custom_get_mac_address(unsigned char *buf) } #endif /* GET_CUSTOM_MAC_ENABLE */ -#define EXAMPLE_TABLE /* Customized Locale table : OPTIONAL feature */ const struct cntry_locales_custom translate_custom_table[] = { /* Table should be filled out based on custom platform regulatory requirement */ #ifdef EXAMPLE_TABLE {"US", "US", 69}, /* input ISO "US" to : US regrev 69 */ {"CA", "US", 69}, /* input ISO "CA" to : US regrev 69 */ - {"EU", "EU", 05}, /* input ISO "EU" to : EU regrev 05 */ - {"FR", "EU", 05}, - {"DE", "EU", 05}, - {"IR", "EU", 05}, - {"UK", "EU", 05}, /* input ISO "UK" to : EU regrev 05 */ - {"KR", "XY", 03}, - {"AU", "XY", 03}, - {"CN", "XY", 03}, /* input ISO "CN" to : XY regrev 03 */ - {"TW", "XY", 03}, - {"AR", "XY", 03} + {"EU", "EU", 5}, /* input ISO "EU" to : EU regrev 05 */ + {"FR", "EU", 5}, + {"DE", "EU", 5}, + {"IR", "EU", 5}, + {"UK", "EU", 5}, /* input ISO "UK" to : EU regrev 05 */ + {"KR", "XY", 3}, + {"AU", "XY", 3}, + {"CN", "XY", 3}, /* input ISO "CN" to : XY regrev 03 */ + {"TW", "XY", 3}, + {"AR", "XY", 3} #endif /* EXAMPLE_TABLE */ }; @@ -205,6 +205,19 @@ const struct cntry_locales_custom translate_custom_table[] = { */ void get_customized_country_code(char *country_iso_code, wl_country_t *cspec) { +#ifdef CUSTOMER_HW2 + struct cntry_locales_custom *cloc_ptr; + + if (!cspec) + return; + + cloc_ptr = wifi_get_country_code(country_iso_code); + if (cloc_ptr) { + strlcpy(cspec->ccode, cloc_ptr->custom_locale, WLC_CNTRY_BUF_SZ); + cspec->rev = cloc_ptr->custom_locale_rev; + } + return; +#else int size, i; size = ARRAYSIZE(translate_custom_table); @@ -223,4 +236,5 @@ void get_customized_country_code(char *country_iso_code, wl_country_t *cspec) } } return; +#endif } diff --git a/drivers/net/wireless/bcm4329/dhd_linux.c b/drivers/net/wireless/bcm4329/dhd_linux.c index 26cf90c..4d0f3be 100644 --- a/drivers/net/wireless/bcm4329/dhd_linux.c +++ b/drivers/net/wireless/bcm4329/dhd_linux.c @@ -127,6 +127,17 @@ int wifi_get_mac_addr(unsigned char *buf) return -EOPNOTSUPP; } +void *wifi_get_country_code(char *ccode) +{ + DHD_TRACE(("%s\n", __FUNCTION__)); + if (!ccode) + return NULL; + if (wifi_control_data && wifi_control_data->get_country_code) { + return wifi_control_data->get_country_code(ccode); + } + return NULL; +} + static int wifi_probe(struct platform_device *pdev) { struct wifi_platform_data *wifi_ctrl = -- 2.7.4