temp revert rk change
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / bcm4329 / dhd_custom_gpio.c
index 8c6ec470b8bd2efb54c5811f3fa90a1fffaeba27..4d32863e29829c855a5f7357cd622c1efe428760 100644 (file)
@@ -20,7 +20,7 @@
 * software in any way with any other Broadcom software provided under a license
 * other than the GPL, without Broadcom's express prior written consent.
 *
-* $Id: dhd_custom_gpio.c,v 1.1.4.8.4.1 2010/09/02 23:13:16 Exp $
+* $Id: dhd_custom_gpio.c,v 1.1.4.8.4.4 2011/01/20 20:23:09 Exp $
 */
 
 
@@ -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)
@@ -177,3 +178,95 @@ dhd_custom_get_mac_address(unsigned char *buf)
        return ret;
 }
 #endif /* GET_CUSTOM_MAC_ENABLE */
+
+/* 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
+       {"",   "XY", 4},  /* universal */
+       {"US", "US", 69}, /* input ISO "US" to : US regrev 69 */
+       {"CA", "US", 69}, /* input ISO "CA" to : US regrev 69 */
+       {"EU", "EU", 5},  /* European union countries */
+       {"AT", "EU", 5},
+       {"BE", "EU", 5},
+       {"BG", "EU", 5},
+       {"CY", "EU", 5},
+       {"CZ", "EU", 5},
+       {"DK", "EU", 5},
+       {"EE", "EU", 5},
+       {"FI", "EU", 5},
+       {"FR", "EU", 5},
+       {"DE", "EU", 5},
+       {"GR", "EU", 5},
+       {"HU", "EU", 5},
+       {"IE", "EU", 5},
+       {"IT", "EU", 5},
+       {"LV", "EU", 5},
+       {"LI", "EU", 5},
+       {"LT", "EU", 5},
+       {"LU", "EU", 5},
+       {"MT", "EU", 5},
+       {"NL", "EU", 5},
+       {"PL", "EU", 5},
+       {"PT", "EU", 5},
+       {"RO", "EU", 5},
+       {"SK", "EU", 5},
+       {"SI", "EU", 5},
+       {"ES", "EU", 5},
+       {"SE", "EU", 5},
+       {"GB", "EU", 5},  /* input ISO "GB" to : EU regrev 05 */
+       {"IL", "IL", 0},
+       {"CH", "CH", 0},
+       {"TR", "TR", 0},
+       {"NO", "NO", 0},
+       {"KR", "XY", 3},
+       {"AU", "XY", 3},
+       {"CN", "XY", 3},  /* input ISO "CN" to : XY regrev 03 */
+       {"TW", "XY", 3},
+       {"AR", "XY", 3},
+       {"MX", "XY", 3}
+#endif /* EXAMPLE_TABLE */
+};
+
+
+/* Customized Locale convertor
+*  input : ISO 3166-1 country abbreviation
+*  output: customized cspec
+*/
+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);
+
+       if (cspec == 0)
+               return;
+
+       if (size == 0)
+               return;
+
+       for (i = 0; i < size; i++) {
+               if (strcmp(country_iso_code, translate_custom_table[i].iso_abbrev) == 0) {
+                       memcpy(cspec->ccode, translate_custom_table[i].custom_locale, WLC_CNTRY_BUF_SZ);
+                       cspec->rev = translate_custom_table[i].custom_locale_rev;
+                       return;
+               }
+       }
+       memcpy(cspec->ccode, translate_custom_table[0].custom_locale, WLC_CNTRY_BUF_SZ);
+       cspec->rev = translate_custom_table[0].custom_locale_rev;
+       return;
+#endif
+}