htcleo: fixed Bluetooth MAC address to board device dependend one. (i.e. unique Bluetooth address)

Use IEEE Standards 00:23:76:YY:YY:YY for HTC. -- http://standards.ieee.org/cgi-bin/ouisearch?00-23-76
This commit is contained in:
tytung 2011-04-09 01:56:44 +08:00
parent 028bb98fc1
commit 8f470e6b2d
2 changed files with 38 additions and 32 deletions

View File

@ -23,18 +23,9 @@
#include "board-htcleo.h"
#define MAX_BT_SIZE 0x6U
static struct rfkill *bt_rfk;
static const char bt_name[] = "bcm4329";
/* Fix BT address for Leo */
static unsigned char bt_bd_ram[MAX_BT_SIZE] = {0x50,0xC3,0x00,0x00,0x00,0x00};
unsigned char *get_bt_bd_ram(void)
{
return (bt_bd_ram);
}
static int bluetooth_set_power(void *data, bool blocked)
{
if (!blocked) {

View File

@ -15,6 +15,7 @@
*
*/
#include <linux/crc32.h>
#include <linux/delay.h>
#include <linux/gpio.h>
#include <linux/i2c.h>
@ -531,10 +532,35 @@ int is_valid_mac_address(char *mac)
///////////////////////////////////////////////////////////////////////
// bluetooth
///////////////////////////////////////////////////////////////////////
/* AOSP style interface */
#define BDADDR_STR_SIZE 18
static char bdaddr[BDADDR_STR_SIZE];
module_param_string(bdaddr, bdaddr, sizeof(bdaddr), 0400);
MODULE_PARM_DESC(bdaddr, "bluetooth address");
static int parse_tag_bdaddr(void)
{
uint32_t id1, id2, id3, sid1, sid2, sid3;
uint32_t id_base = 0xef260;
id1 = readl(MSM_SHARED_RAM_BASE + id_base + 0x0);
id2 = readl(MSM_SHARED_RAM_BASE + id_base + 0x4);
id3 = readl(MSM_SHARED_RAM_BASE + id_base + 0x8);
sid1 = crc32(~0, &id1, 4);
sid2 = crc32(~0, &id2, 4);
sid3 = crc32(~0, &id3, 4);
sprintf(bdaddr, "00:23:76:%2X:%2X:%2X", sid3 % 0xff, sid2 % 0xff, sid1 % 0xff);
pr_info("Device Bluetooth Mac Address: %s\n", bdaddr);
return 0;
}
/* end AOSP style interface */
/* for (sense roms) */
#define MAC_ADDRESS_SIZE_C 17
static char bdaddress[MAC_ADDRESS_SIZE_C+1] = "";
static void bt_export_bd_address(void)
{
{
unsigned char cTemp[6];
if (!is_valid_mac_address(bdaddress)){
memcpy(cTemp, get_bt_bd_ram(), 6);
@ -545,7 +571,14 @@ static void bt_export_bd_address(void)
module_param_string(bdaddress, bdaddress, sizeof(bdaddress), S_IWUSR | S_IRUGO);
MODULE_PARM_DESC(bdaddress, "BT MAC ADDRESS");
#
#define MAX_BT_SIZE 0x6U
static unsigned char bt_bd_ram[MAX_BT_SIZE] = {0x50,0xC3,0x00,0x00,0x00,0x00};
unsigned char *get_bt_bd_ram(void)
{
return (bt_bd_ram);
}
//-----added alias for bt mac address parameter--------
static int __init htcleo_bt_macaddress_setup(char *bootconfig)
{
@ -555,8 +588,7 @@ static int __init htcleo_bt_macaddress_setup(char *bootconfig)
}
__setup("bt.mac=", htcleo_bt_macaddress_setup);
//-----------------------------------------------------
//-----------------------------------------------------
/* end (sense) */
#ifdef CONFIG_SERIAL_MSM_HS
static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = {
@ -604,25 +636,6 @@ static uint32_t bt_gpio_table[] = {
GPIO_PULL_DOWN, GPIO_4MA),
};
static uint32_t bt_gpio_table_rev_CX[] = {
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_UART1_RTS, 2, GPIO_OUTPUT,
GPIO_PULL_UP, GPIO_8MA),
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_UART1_CTS, 2, GPIO_INPUT,
GPIO_PULL_UP, GPIO_8MA),
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_UART1_RX, 2, GPIO_INPUT,
GPIO_PULL_UP, GPIO_8MA),
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_UART1_TX, 2, GPIO_OUTPUT,
GPIO_PULL_UP, GPIO_8MA),
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_RESET_N, 0, GPIO_OUTPUT,
GPIO_PULL_DOWN, GPIO_4MA),
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_SHUTDOWN_N, 0, GPIO_OUTPUT,
GPIO_PULL_DOWN, GPIO_4MA),
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_CHIP_WAKE, 0, GPIO_OUTPUT,
GPIO_PULL_DOWN, GPIO_4MA),
PCOM_GPIO_CFG(HTCLEO_GPIO_BT_HOST_WAKE, 0, GPIO_INPUT,
GPIO_PULL_DOWN, GPIO_4MA),
};
static struct platform_device htcleo_rfkill =
{
.name = "htcleo_rfkill",
@ -1049,6 +1062,8 @@ static void __init htcleo_init(void)
config_gpio_table(bt_gpio_table, ARRAY_SIZE(bt_gpio_table));
parse_tag_bdaddr();
bt_export_bd_address();
htcleo_audio_init();