static void tcc_dxb_ctrl_power_reset(int deviceIdx) { if(machine_is_m801_88()) { switch(deviceIdx) { case 0: tcc_gpio_config(GPIO_DXB0_RST, GPIO_FN(0)); gpio_request(GPIO_DXB0_RST, NULL); gpio_direction_output(GPIO_DXB0_RST, 0); msleep(20); gpio_set_value(GPIO_DXB0_RST, 1); break; case 1: tcc_gpio_config(GPIO_DXB2_RST, GPIO_FN(0)); gpio_request(GPIO_DXB2_RST, NULL); gpio_direction_output(GPIO_DXB2_RST, 0); msleep(20); gpio_set_value(GPIO_DXB2_RST, 1); break; default: break; } } }
// ************************************************************ // // Device Release : // // // ************************************************************ // static int gps_gpio_release (struct inode *inode, struct file *filp) { gps_k_flag = 0; #if defined(CONFIG_MACH_TCC9300)||defined(CONFIG_MACH_TCC8800) || defined(CONFIG_MACH_TCC8920) if(machine_is_m801_88() || machine_is_m803()) // GPIOG[4] { gpio_set_value(TCC_GPG(4), 0); } else if(machine_is_tcc8800() || machine_is_tcc8920()) { gpio_set_value(TCC_GPEXT1(6), 0); } #elif defined(CONFIG_MACH_TCC8900) if(machine_is_tcc8900()) { gpio_set_value(TCC_GPD(25), 0); } #elif defined(CONFIG_MACH_M805_892X) if(machine_is_m805_892x()) { if (system_rev == 0x2002 || system_rev == 0x2003 || system_rev == 0x2004 || system_rev == 0x2005) gpio_set_value(TCC_GPC(14), 0); else gpio_set_value(TCC_GPC(6), 0); } #endif gps_dbg("tcc92xx : gps_gpio_close\n"); return 0; }
int init_module(void) { int ret; printk("[## BT ##] init_module\n"); ret = register_chrdev(BT_DEV_MAJOR_NUM, DEV_NAME, &tcc_bt_dev_ops); bt_dev_class = class_create(THIS_MODULE, DEV_NAME); device_create(bt_dev_class, NULL, MKDEV(BT_DEV_MAJOR_NUM, BT_DEV_MINOR_NUM), NULL, DEV_NAME); #if 0 // moved to arch/arm/mach-tcc8920/board-tcc-bluetooth.c if(machine_is_tcc8900()){ gpio_request(TCC_GPB(25), "bt_power"); gpio_request(TCC_GPEXT2(9), "bt_reset"); gpio_direction_output(TCC_GPB(25), 0); // output gpio_direction_output(TCC_GPEXT2(9), 0); }else if(machine_is_tcc9300() || machine_is_tcc8800()|| machine_is_tcc8920()) { // #elif defined (CONFIG_MACH_TCC9300) //gpio_set_value(TCC_GPEXT1(7), 0); /* BT-ON Disable */ gpio_request(TCC_GPEXT3(2), "bt_wake"); gpio_request(TCC_GPEXT2(4), "bt_reset"); gpio_direction_output(TCC_GPEXT3(2), 0); // output gpio_direction_output(TCC_GPEXT2(4), 0); #if defined(CONFIG_TCC_CSR_BC0406_MODULE_SUPPORT) && defined(CONFIG_TCC_CSR_HOST_WAKE_UP) tcc_gpio_config(TCC_GPB(31), GPIO_FN(0)); gpio_request(TCC_GPEXT3(3), "bt_hwake"); gpio_direction_input(TCC_GPEXT3(3)); #endif // for CSR Bluetooth host wake up } else if(machine_is_m801_88() || machine_is_m803()) { #if defined(CONFIG_TCC_RDA_587X_MODULE_SUPPORT) gpio_request(TCC_GPA(13), "LDO_ON"); tcc_gpio_config(TCC_GPA(13), GPIO_FN(0)); gpio_direction_output(TCC_GPA(13), 0); #else gpio_request(TCC_GPA(13), "bt_reset"); gpio_request(TCC_GPB(22), "BT WAKE"); gpio_direction_output(TCC_GPA(13), 0); // output gpio_direction_output(TCC_GPB(22), 0); // output #endif } else if(machine_is_tcc8800st()) { gpio_request(TCC_GPC(31), "bt_power"); gpio_request(TCC_GPD(12), "bt_reset"); gpio_direction_output(TCC_GPC(31), 0); // output gpio_direction_output(TCC_GPD(12), 0); // output } #endif if(ret < 0){ printk("[## BT ##] [%d]fail to register the character device\n", ret); return ret; } return 0; }
void __init m801_88_init_gpio(void) { if (!machine_is_m801_88()) return; board_gpio_irqs = m801_88_gpio_irqs; printk(KERN_INFO "M801_88 GPIO initialized\n"); return; }
static int __init tcc8920_init_tcc_dxb_ctrl(void) { if(!machine_is_tcc8920() || machine_is_m801_88()) return 0; printk("%s (built %s %s)\n", __func__, __DATE__, __TIME__); platform_device_register(&tcc_dxb_device); return 0; }
void RDA_bt_Power_Off(void) { volatile PGPIO pGPIO = (volatile PGPIO)tcc_p2v(HwGPIO_BASE); if (machine_is_tcc8800()|| machine_is_tcc8920()) { // #elif defined (CONFIG_MACH_TCC9300) //gpio_set_value(TCC_GPEXT1(7), 0); /* BT-ON Disable */ gpio_set_value(TCC_GPEXT3(2), 0); /* BT_WAKE Disable */ gpio_set_value(TCC_GPEXT2(4), 0); /* reset */ } else if (machine_is_m801_88() || machine_is_m803()) { gpio_set_value(TCC_GPA(13),0); //msleep(1); } }
static void hp_un_mute(void) { #if defined(CONFIG_ARCH_TCC88XX) if(machine_is_m801_88()) gpio_set_value(TCC_GPD(11), 1); #elif defined(CONFIG_ARCH_TCC892X) if(machine_is_m805_892x()) { if(system_rev == 0x2002 || system_rev == 0x2003 || system_rev == 0x2004 || system_rev == 0x2005) gpio_set_value(TCC_GPE(17), 1); else gpio_set_value(TCC_GPG(5), 1); } #endif }
static void spk_un_mute(void) { #if defined(CONFIG_ARCH_TCC88XX) if(machine_is_m801_88()) gpio_set_value(TCC_GPG(6), 1); #elif defined(CONFIG_ARCH_TCC892X) if(machine_is_m805_892x()) { if(system_rev == 0x2002 || system_rev == 0x2003 || system_rev == 0x2004 || system_rev == 0x2005) { gpio_set_value(TCC_GPE(18), 1); } else { #if defined(CONFIG_M805S_8923_0XA) gpio_set_value(TCC_GPG(11), 1); #else gpio_set_value(TCC_GPF(27), 1); #endif } } #endif }
int tcc_hp_is_valid(void) { #if defined(CONFIG_ARCH_TCC88XX) if(machine_is_m801_88()) { // gpio_get_value is ==> 0: disconnect, 1: connect return gpio_get_value(TCC_GPD(10)); } #elif defined(CONFIG_ARCH_TCC892X) if(machine_is_m805_892x()) { // gpio_get_value is ==> 0: disconnect, 1: connect if(system_rev == 0x2002 || system_rev == 0x2003 || system_rev == 0x2004 || system_rev == 0x2005) return gpio_get_value(TCC_GPE(16)); else return gpio_get_value(TCC_GPE(5)); } #endif return 0; }
// ************************************************************ // // Device Exit : // // // ************************************************************ // static void __exit gps_gpio_exit(void) { gps_dbg("gps_gpio_exit"); device_destroy(gps_class, MKDEV(gps_major, 0)); class_destroy(gps_class); cdev_del(&gps_cdev); unregister_chrdev_region(dev, 1); #if defined(CONFIG_MACH_TCC9300) || defined(CONFIG_MACH_TCC8800) || defined(CONFIG_MACH_TCC8920) // GPS Power off gps_dbg("GPS_PWREN off"); if(machine_is_m801_88() || machine_is_m803()) // demo set { gpio_set_value(TCC_GPG(4), 0); } else if(machine_is_tcc8800() || machine_is_tcc8920()) { gpio_direction_output(TCC_GPEXT1(6), 0); } #elif defined(CONFIG_MACH_TCC8900) if(machine_is_tcc8900()) { gps_dbg("GPS_8900_PWREN off"); gpio_set_value(TCC_GPD(25), 0); } #elif defined(CONFIG_MACH_M805_892X) // GPS Power off gps_dbg("GPS_PWREN off"); if(machine_is_m805_892x()) { if (system_rev == 0x2002 || system_rev == 0x2003 || system_rev == 0x2004 || system_rev == 0x2005) gpio_set_value(TCC_GPE(14), 0); else gpio_set_value(TCC_GPC(6), 0); } #endif gps_dbg("GPS driver unloaded"); }
// ************************************************************ // // Device Open : // when open, yet not ativity UART port // GPS device is yet disable status. // ************************************************************ // static int gps_gpio_open (struct inode *inode, struct file *filp) { gps_k_flag = 0; // Set the Port Configure for the UART5 // GPIO SETTING gps_dbg("gps_gpio_open\n"); #if defined(CONFIG_MACH_TCC9300) || defined(CONFIG_MACH_TCC8800) || defined(CONFIG_MACH_TCC8920) if(machine_is_m801_88() || machine_is_m803()) // GPIOG[4] { gpio_set_value(TCC_GPG(4), 0); } else if(machine_is_tcc8800() || machine_is_tcc8920()) { gps_dbg("gps_gpio_open -> set_velue"); gpio_set_value(TCC_GPEXT1(6), 0); } #elif defined(CONFIG_MACH_TCC8900) if(machine_is_tcc8900()) { gps_dbg("machine_is_tcc8900 : gps_gpio_open\n\n"); gpio_set_value(TCC_GPD(25), 0); } #elif defined(CONFIG_MACH_M805_892X) if(machine_is_m805_892x()) { if (system_rev == 0x2002 || system_rev == 0x2003 || system_rev == 0x2004 || system_rev == 0x2005) gpio_set_value(TCC_GPE(14), 0); else gpio_set_value(TCC_GPC(6), 0); } #else #endif gps_dbg("tcc92xx : gps_gpio_open\n\n"); return 0; }
static int tcc_msensor_open(struct inode *inode, struct file *filp) { int ret; unsigned char old_ctrl; // int num = MINOR(inode->i_rdev); msensor_dbg("tcc_msensor_open\n"); // msensor_dbg(KERN_INFO "%s -> minor : %d, (cnt:%d) \n", __FUNCTION__, num, msensor_used_count+1); if (msensor_used_count == 0) { if(machine_is_m801_88()) { // M801_88 board gpio_request(TCC_GPF(8), NULL); tcc_gpio_config(TCC_GPF(8), GPIO_FN(0)); gpio_direction_input(TCC_GPF(8)); } #ifdef CONFIG_I2C // Initialize I2C driver for AK8975C ret = i2c_add_driver(&msensor_i2c_driver); if(ret < 0) { msensor_dbg("%s() [Error] failed i2c_add_driver() = %d\n", __func__, ret); return ret; } ret = ak8975c_i2c_register(); if(ret < 0) { msensor_dbg("%s() [Error] Failed register i2c client driver for ak8975c, return is %d\n", __func__, ret); return ret; } #endif old_ctrl = MSENSOR_READ_DAT(0x00); if (old_ctrl == 0xFF) { msensor_dbg("%s: No such device or address\n", __func__); #ifdef CONFIG_I2C i2c_unregister_device(msensor_i2c_client); i2c_del_driver(&msensor_i2c_driver); msensor_i2c_client = NULL; #endif return -ENXIO; } msensor_dbg("%s: identification : %x\n", __func__, old_ctrl); old_ctrl = MSENSOR_READ_DAT(0x01); msensor_dbg("%s: ASIC revition ID : %x\n", __func__, old_ctrl); msensor_timer= kmalloc( sizeof( struct timer_list ), GFP_KERNEL ); if (msensor_timer == NULL) { msensor_dbg("%s: mem alloc fail\n", __func__); #ifdef CONFIG_I2C i2c_unregister_device(msensor_i2c_client); i2c_del_driver(&msensor_i2c_driver); msensor_i2c_client = NULL; #endif return -ENOMEM; } memset(msensor_timer, 0, sizeof(struct timer_list)); msensor_dbg("%s: msensor_duration = %d\n", __func__, msensor_duration); msensor_timer_registertimer( msensor_timer, msensor_duration ); } msensor_used_count++; return 0; }
// ************************************************************ // // Device Init : // // // // ************************************************************ // static int __init gps_gpio_init(void) { int result; gps_dbg("gps_gpio_init\n"); if (0 == gps_major) { /* auto select a major */ result = alloc_chrdev_region(&dev, 0, 1, GPS_GPIO_DEV_NAME); gps_major = MAJOR(dev); } else { /* use load time defined major number */ dev = MKDEV(gps_major, 0); result = register_chrdev_region(dev, 1, GPS_GPIO_DEV_NAME); } memset(&gps_cdev, 0, sizeof(gps_cdev)); /* initialize our char dev data */ cdev_init(&gps_cdev, &gps_gpio_fops); /* register char dev with the kernel */ result = cdev_add(&gps_cdev, dev, 1); if (0 != result) { unregister_chrdev_region(dev, 1); gps_dbg("Error registrating mali device object with the kernel\n"); } gps_class = class_create(THIS_MODULE, GPS_GPIO_DEV_NAME); device_create(gps_class, NULL, MKDEV(gps_major, MINOR(dev)), NULL, GPS_GPIO_DEV_NAME); if (result < 0) return result; #if defined(CONFIG_MACH_TCC9300) || defined(CONFIG_MACH_TCC8800) || defined(CONFIG_MACH_TCC8920) if(machine_is_m801_88() || machine_is_m803()) // GPIOG[4] { gps_dbg("GPS_PWREN on\n"); tcc_gpio_config(TCC_GPG(4), GPIO_FN(0)); gpio_request(TCC_GPG(4), "GPIO_PWREN"); gpio_direction_output(TCC_GPG(4), 0); } else if(machine_is_tcc8800() || machine_is_tcc8920()) { gps_dbg("gpio_direction_output__gps\n"); gpio_direction_output(TCC_GPEXT1(6), 0); // GPS Power On } #elif defined(CONFIG_MACH_TCC8900) if(machine_is_tcc8900()) { gps_dbg("GPS_8900_PWREN on\n"); tcc_gpio_config(TCC_GPD(25), GPIO_FN(0)); gpio_request(TCC_GPD(25), "GPIO_PWREN"); gpio_set_value(TCC_GPD(25), 0); } #elif defined(CONFIG_MACH_M805_892X) if(machine_is_m805_892x()) { gps_dbg("GPS_PWREN on\n"); if (system_rev == 0x2002 || system_rev == 0x2003 || system_rev == 0x2004 || system_rev == 0x2005) { tcc_gpio_config(TCC_GPE(14), GPIO_FN(0)); gpio_request(TCC_GPE(14), "GPIO_PWREN"); gpio_direction_output(TCC_GPE(14), 0); } else { tcc_gpio_config(TCC_GPC(6), GPIO_FN(0)); gpio_request(TCC_GPC(6), "GPIO_PWREN"); gpio_direction_output(TCC_GPC(6), 0); } } #endif gps_dbg("GPS driver loaded\n"); return 0; }
// ************************************************************ // // Device Release : // // // ************************************************************ // //static int gps_gpio_ioctl (struct inode *inode, struct file *filp, // unsigned int cmd, unsigned long arg) static long gps_gpio_ioctl (struct file *filp, unsigned int cmd, void *arg) { gps_dbg("gps_gpio_ioctl\n"); switch( cmd ) { #if defined(CONFIG_MACH_TCC9300)||defined(CONFIG_MACH_TCC8800) || defined(CONFIG_MACH_TCC8920) case 0 : // GPS_On gps_k_flag = 1; if(machine_is_m801_88() || machine_is_m803()) // GPIOG[4] { gpio_set_value(TCC_GPG(4), 1); } else if(machine_is_tcc8800() || machine_is_tcc8920()) { gpio_set_value(TCC_GPEXT1(6), 1); } gps_dbg("tccxxxx : gps_gpio_on\n"); break; case 1 : // GPS_Off gps_k_flag = 0; if(machine_is_m801_88() || machine_is_m803()) // GPIOG[4] { gpio_set_value(TCC_GPG(4), 0); } else if(machine_is_tcc8800() || machine_is_tcc8920()) { gpio_set_value(TCC_GPEXT1(6), 0); } gps_dbg("tccxxxx : gps_gpio_off\n"); break; #elif defined(CONFIG_MACH_TCC8900) case 0 : // GPS_On gps_k_flag = 1; if(machine_is_tcc8900()) { gpio_set_value(TCC_GPD(25), 1); } break; case 1 : // GPS_Off gps_k_flag = 0; if(machine_is_tcc8900()) { gpio_set_value(TCC_GPD(25), 0); } break; #elif defined(CONFIG_MACH_M805_892X) case 0 : // GPS_On gps_k_flag = 1; if(machine_is_m805_892x()) { if (system_rev == 0x2002 || system_rev == 0x2003 || system_rev == 0x2004 || system_rev == 0x2005) gpio_set_value(TCC_GPE(14), 1); else gpio_set_value(TCC_GPC(6), 1); } gps_dbg("tccxxxx : gps_gpio_on\n"); break; case 1 : // GPS_Off gps_k_flag = 0; if(machine_is_m805_892x()) { if (system_rev == 0x2002 || system_rev == 0x2003 || system_rev == 0x2004 || system_rev == 0x2005) gpio_set_value(TCC_GPE(14), 0); else gpio_set_value(TCC_GPC(6), 0); } gps_dbg("tccxxxx : gps_gpio_off\n"); break; #else case 0 : // GPS_On gps_k_flag = 1; break; case 1 : // GPS_Off gps_k_flag = 0; break; #endif // #if defined(CONFIG_MACH_TCC9300) default : break; }; return 0; }
static int tcc_bt_get_info(tcc_bt_info_t* arg) { tcc_bt_info_t *info_t; int module_t; info_t = (tcc_bt_info_t *)arg; copy_from_user(info_t, (tcc_bt_info_t *)arg, sizeof(tcc_bt_info_t)); module_t = 0; if (machine_is_tcc8900() || machine_is_tcc9201() || machine_is_tcc9300()|| machine_is_tcc8800()|| machine_is_m801_88()|| machine_is_m803()|| machine_is_tcc8920()) { // CSR Only #if defined (CONFIG_TCC_CSR_BC0406_MODULE_SUPPORT) module_t = 0x12; #elif defined (CONFIG_TCC_RDA_587X_MODULE_SUPPORT) module_t = 0x56; #elif defined (CONFIG_TCC_BRCM_BCM4330_MODULE_SUPPORT) module_t = 0x34; #elif defined (CONFIG_TCC_ATHEROS_AR3002_MODULE_SUPPORT) module_t = 0x78; #endif }else if(machine_is_tcc9200s()){ //#elif defined (CONFIG_MACH_TCC9200S) #if defined (CONFIG_TCC_BRCM_BCM4325D0_MODULE_SUPPORT) module_t = 0x34; #elif defined (CONFIG_TCC_CSR_BC0406_MODULE_SUPPORT) module_t = 0x12; #endif } //#endif printk("[## BT ##] module[0x%x]\n", module_t); info_t->module = module_t; copy_to_user((tcc_bt_info_t *)arg, info_t, sizeof(tcc_bt_info_t)); return 0; }
static int tcc_bluetooth_probe(struct platform_device *pdev) { int rc = 0; int ret = 0; printk("[## BT ##] tcc_bluetooth_probe\n"); if( machine_is_tcc8800()|| machine_is_tcc8920()) { // #elif defined (CONFIG_MACH_TCC9300) //gpio_set_value(TCC_GPEXT1(7), 0); /* BT-ON Disable */ gpio_request(TCC_GPEXT3(2), "bt_wake"); gpio_request(TCC_GPEXT2(4), "bt_reset"); gpio_direction_output(TCC_GPEXT3(2), 0); // output gpio_direction_output(TCC_GPEXT2(4), 0); #if defined(CONFIG_TCC_CSR_BC0406_MODULE_SUPPORT) && defined(CONFIG_TCC_CSR_HOST_WAKE_UP) tcc_gpio_config(TCC_GPB(31), GPIO_FN(0)); gpio_request(TCC_GPEXT3(3), "bt_hwake"); gpio_direction_input(TCC_GPEXT3(3)); #endif // for CSR Bluetooth host wake up } else if(machine_is_m801_88() || machine_is_m803()) { #if defined(CONFIG_TCC_RDA_587X_MODULE_SUPPORT) gpio_request(TCC_GPA(13), "LDO_ON"); tcc_gpio_config(TCC_GPA(13), GPIO_FN(0)); gpio_direction_output(TCC_GPA(13), 0); #else gpio_request(TCC_GPA(13), "bt_reset"); gpio_request(TCC_GPB(22), "BT WAKE"); gpio_direction_output(TCC_GPA(13), 0); // output gpio_direction_output(TCC_GPB(22), 0); // output #endif } else if(machine_is_tcc8800st()) { gpio_request(TCC_GPC(31), "bt_power"); gpio_request(TCC_GPD(12), "bt_reset"); gpio_direction_output(TCC_GPC(31), 0); // output gpio_direction_output(TCC_GPD(12), 0); // output } /* rc = gpio_request(BT_RESET_GPIO, "bcm4330_nreset_gpip"); if (unlikely(rc)) { return rc; } rc = gpio_request(BT_REG_GPIO, "bcm4330_nshutdown_gpio"); if (unlikely(rc)) { gpio_free(BT_RESET_GPIO); return rc; } */ bt_rfkill = rfkill_alloc("Telechips Bluetooth", &pdev->dev, RFKILL_TYPE_BLUETOOTH, &tcc_bt_rfkill_ops, NULL); if (unlikely(!bt_rfkill)) { //gpio_free(BT_RESET_GPIO); //gpio_free(BT_REG_GPIO); printk("[## BT ##] rfkill_alloc failed \n"); return -ENOMEM; } rc = rfkill_register(bt_rfkill); if (unlikely(rc)) { printk("[## BT ##] rfkill_register failed \n"); rfkill_destroy(bt_rfkill); //gpio_free(BT_RESET_GPIO); //gpio_free(BT_REG_GPIO); return -1; } printk("[## BT ##] rfkill_register Telechips Bluetooth \n"); rfkill_set_states(bt_rfkill, true, false); tcc_bt_rfkill_set_power(NULL, true); #if defined (CONFIG_TCC_BRCM_BCM4330_MODULE_SUPPORT) ret = bcm_bt_lpm_init(pdev); if (ret) { rfkill_unregister(bt_rfkill); rfkill_destroy(bt_rfkill); //gpio_free(BT_RESET_GPIO); //gpio_free(BT_REG_GPIO); } #endif return ret; }
static int tcc_bt_rfkill_set_power(void *data, bool blocked) { // rfkill_ops callback. Turn transmitter on when blocked is false printk("[## BT ##] tcc_bt_rfkill_set_power [%d]\n", blocked); if (!blocked && (bt_enable_flag == 0)) { bt_enable_flag = 1; if (machine_is_tcc8800() || machine_is_tcc8920()) { // #elif defined (CONFIG_MACH_TCC9300) #if defined (CONFIG_TCC_CSR_BC0406_MODULE_SUPPORT)|| defined(CONFIG_TCC_ATHEROS_AR3002_MODULE_SUPPORT) //gpio_set_value(TCC_GPEXT1(7), 1); /* BT-ON Enable */ gpio_set_value(TCC_GPEXT3(2), 1); /* BT_WAKE Enable , pwr_ctrl*/ gpio_set_value(TCC_GPEXT2(4), 0); /* reset */ msleep(500); gpio_set_value(TCC_GPEXT2(4), 1); /* reset */ #elif defined (CONFIG_TCC_RDA_587X_MODULE_SUPPORT) RDA_bt_Power_On(); #endif } else if (machine_is_m801_88() || machine_is_m803()) { #if defined (CONFIG_TCC_CSR_BC0406_MODULE_SUPPORT) gpio_set_value(TCC_GPB(22),1); // BT WAKE gpio_set_value(TCC_GPA(13),0); // reset msleep(500); gpio_set_value(TCC_GPA(13),1); // reset #elif defined (CONFIG_TCC_RDA_587X_MODULE_SUPPORT) RDA_bt_Power_On(); #endif } else if(machine_is_tcc8800st()) { gpio_set_value(TCC_GPC(31), 1); // BT pwr enable gpio_set_value(TCC_GPD(12), 0); // BT rst 0 msleep(500); gpio_set_value(TCC_GPD(12), 1); } } else if(blocked && (bt_enable_flag == 1)) { bt_enable_flag = 0; if (machine_is_tcc8800() || machine_is_tcc8920()) { // #elif defined (CONFIG_MACH_TCC9300) #if defined (CONFIG_TCC_CSR_BC0406_MODULE_SUPPORT)|| defined(CONFIG_TCC_ATHEROS_AR3002_MODULE_SUPPORT) //gpio_set_value(TCC_GPEXT1(7), 0); /* BT-ON Disable */ gpio_set_value(TCC_GPEXT3(2), 0); /* BT_WAKE Disable */ gpio_set_value(TCC_GPEXT2(4), 0); /* reset */ #elif defined (CONFIG_TCC_RDA_587X_MODULE_SUPPORT) RDA_bt_Power_Off(); #endif } else if (machine_is_m801_88() || machine_is_m803()) { #if defined (CONFIG_TCC_CSR_BC0406_MODULE_SUPPORT) gpio_set_value(TCC_GPB(22), 0); // BT WAKE gpio_set_value(TCC_GPA(13), 0); // reset #elif defined (CONFIG_TCC_RDA_587X_MODULE_SUPPORT) RDA_bt_Power_Off(); #endif } else if(machine_is_tcc8800st()) { gpio_set_value(TCC_GPC(31), 0); // BT pwr enable gpio_set_value(TCC_GPD(12), 0); // BT rst 0 } } bt_enabled = !blocked; return 0; }
int tcc_bt_power_control(int on_off) { volatile PGPIO pGPIO = (volatile PGPIO)tcc_p2v(HwGPIO_BASE); printk("[## BT ##] tcc_bt_power_control input[%d]\n", on_off); if(on_off == BT_DEV_ON) { if (machine_is_tcc8900()) { // power on gpio_set_value(TCC_GPB(25), 1); /* bt_power, mapped on BT_WAKE */ msleep(500); // reset gpio_set_value(TCC_GPEXT2(9), 0); /* /reset, mapped on BT_HWAKE */ msleep(500); gpio_set_value(TCC_GPEXT2(9), 1); msleep(300); } else if (machine_is_tcc9300() || machine_is_tcc8800() || machine_is_tcc8920()) { // #elif defined (CONFIG_MACH_TCC9300) #if defined (CONFIG_TCC_CSR_BC0406_MODULE_SUPPORT)|| defined(CONFIG_TCC_ATHEROS_AR3002_MODULE_SUPPORT) //gpio_set_value(TCC_GPEXT1(7), 1); /* BT-ON Enable */ gpio_set_value(TCC_GPEXT3(2), 1); /* BT_WAKE Enable , pwr_ctrl*/ gpio_set_value(TCC_GPEXT2(4), 0); /* reset */ msleep(500); gpio_set_value(TCC_GPEXT2(4), 1); /* reset */ #elif defined (CONFIG_TCC_RDA_587X_MODULE_SUPPORT) RDA_bt_Power_On(); #endif } else if (machine_is_m801_88() || machine_is_m803()) { #if defined (CONFIG_TCC_CSR_BC0406_MODULE_SUPPORT) gpio_set_value(TCC_GPB(22),1); // BT WAKE gpio_set_value(TCC_GPA(13),0); // reset msleep(500); gpio_set_value(TCC_GPA(13),1); // reset #elif defined (CONFIG_TCC_RDA_587X_MODULE_SUPPORT) RDA_bt_Power_On(); #endif } else if(machine_is_tcc8800st()) { gpio_set_value(TCC_GPC(31), 1); // BT pwr enable gpio_set_value(TCC_GPD(12), 0); // BT rst 0 msleep(500); gpio_set_value(TCC_GPD(12), 1); } else if (0/*machine_is_tcc9300ST()*/) {//#elif defined (CONFIG_MACH_TCC9300ST) #if 0 pGPIO->GPFEN |= Hw1|Hw0; pGPIO->GPFDAT |= Hw0; /* BT-On Enbale */ pGPIO->GPFDAT &= ~Hw1; /* BT_HWAKE Enable, reset */ msleep(500); pGPIO->GPFDAT |= Hw1; /* BT_HWAKE Enable, reset */ #endif } } else if(on_off == BT_DEV_OFF) { if (machine_is_tcc8900()) { // power off gpio_set_value(TCC_GPB(25), 0); /* bt_power, mapped on BT_WAKE */ msleep(500); // reset //gpio_direction_output(TCC_GPEXT2(9), 0); }else if (machine_is_tcc9300() || machine_is_tcc8800() || machine_is_tcc8920()) { // #elif defined (CONFIG_MACH_TCC9300) #if defined (CONFIG_TCC_CSR_BC0406_MODULE_SUPPORT)|| defined(CONFIG_TCC_ATHEROS_AR3002_MODULE_SUPPORT) //gpio_set_value(TCC_GPEXT1(7), 0); /* BT-ON Disable */ gpio_set_value(TCC_GPEXT3(2), 0); /* BT_WAKE Disable */ gpio_set_value(TCC_GPEXT2(4), 0); /* reset */ #elif defined (CONFIG_TCC_RDA_587X_MODULE_SUPPORT) RDA_bt_Power_Off(); #endif } else if (machine_is_m801_88() || machine_is_m803()) { #if defined (CONFIG_TCC_CSR_BC0406_MODULE_SUPPORT) gpio_set_value(TCC_GPB(22), 0); // BT WAKE gpio_set_value(TCC_GPA(13), 0); // reset #elif defined (CONFIG_TCC_RDA_587X_MODULE_SUPPORT) RDA_bt_Power_Off(); #endif } else if(machine_is_tcc8800st()) { gpio_set_value(TCC_GPC(31), 0); // BT pwr enable gpio_set_value(TCC_GPD(12), 0); // BT rst 0 } else if (0/*machine_is_tcc9300ST()*/) { // #elif defined (CONFIG_MACH_TCC9300ST) #if 0 pGPIO->GPFEN |= Hw1|Hw0; pGPIO->GPFDAT &= ~Hw0; /* BT-On Enbale */ pGPIO->GPFDAT &= ~Hw1; /* BT_HWAKE Enable, reset */ #endif } } else { printk("[## BT_ERR ##] input_error On[%d] Off[%d]\n", BT_DEV_ON, BT_DEV_OFF); } return 0; }
static int __init tcc_init_es8388(void) { int ret; printk("%s() \n", __func__); if( !(machine_is_m801_88() || machine_is_m805_892x() || machine_is_tcc8920()) ) { alsa_dbg("\n\n\n\n%s() do not execution....\n\n", __func__); return 0; } #if defined(CONFIG_ARCH_TCC88XX) alsa_dbg("TCC Board probe [%s]\n", __FUNCTION__); /* h/w mute control */ if(machine_is_m801_88()) { tcc_gpio_config(TCC_GPG(6), GPIO_FN(0)); tcc_gpio_config(TCC_GPD(11), GPIO_FN(0)); gpio_request(TCC_GPG(6), "SPK_MUTE_CTL"); gpio_request(TCC_GPD(11), "HP_MUTE_CTL"); gpio_direction_output(TCC_GPG(6), 0); // Speaker mute gpio_direction_output(TCC_GPD(11), 1); // HeadPhone mute tcc_hp_hw_mute(false); tcc_spk_hw_mute(false); tcc_soc_card.name = "M801"; } #elif defined(CONFIG_ARCH_TCC892X) alsa_dbg("TCC Board probe [%s]\n", __FUNCTION__); /* h/w mute control */ if(machine_is_m805_892x()) { if(system_rev == 0x2002 || system_rev == 0x2003 || system_rev == 0x2004 || system_rev == 0x2005) { tcc_gpio_config(TCC_GPE(18), GPIO_FN(0)); gpio_request(TCC_GPE(18), "SPK_MUTE_CTL"); gpio_direction_output(TCC_GPE(18), 0); // Speaker mute tcc_gpio_config(TCC_GPE(17), GPIO_FN(0)); gpio_request(TCC_GPE(17), "HP_MUTE_CTL"); gpio_direction_output(TCC_GPE(17), 1); // HeadPhone mute } else { #if defined(CONFIG_M805S_8923_0XA) tcc_gpio_config(TCC_GPG(11), GPIO_FN(0)); gpio_request(TCC_GPG(11), "SPK_MUTE_CTL"); gpio_direction_output(TCC_GPG(11), 0); // Speaker mute #else tcc_gpio_config(TCC_GPF(27), GPIO_FN(0)); gpio_request(TCC_GPF(27), "SPK_MUTE_CTL"); gpio_direction_output(TCC_GPF(27), 0); // Speaker mute #endif tcc_gpio_config(TCC_GPG(5), GPIO_FN(0)); gpio_request(TCC_GPG(5), "HP_MUTE_CTL"); gpio_direction_output(TCC_GPG(5), 1); // HeadPhone mute } tcc_hp_hw_mute(false); tcc_spk_hw_mute(false); tcc_soc_card.name = "M805"; } #else alsa_dbg("TCC Board probe [%s]\n [Error] Don't support architecture..\n", __FUNCTION__); return 0; #endif tcc_hp_hw_mute(true); tcc_spk_hw_mute(true); tca_tcc_initport(); ret = es8388_i2c_register(); tcc_snd_device = platform_device_alloc("soc-audio", -1); if (!tcc_snd_device) return -ENOMEM; platform_set_drvdata(tcc_snd_device, &tcc_soc_card); ret = platform_device_add(tcc_snd_device); if (ret) { printk(KERN_ERR "Unable to add platform device\n");\ platform_device_put(tcc_snd_device); } return ret; }