static void Tcc353xWrapperSafeClose (void) { /* close driver & power ctrl*/ OnAir = 0; currentSelectedChannel = -1; currentBroadCast = TMM_13SEG; TcpalIrqDisable(); Tcc353xApiClose(0); Tcc353xStreamBufferClose(0); Tcc353xTccspiClose(0); broadcast_drv_if_power_off(); }
int broadcast_drv_if_close(void) { int rc = ERROR; int ret = 0; TcpalSemaphoreLock(&Tcc353xDrvSem); OnAir = 0; currentSelectedChannel = -1; currentBroadCast = TMM_13SEG; TcpalIrqDisable(); ret = Tcc353xApiClose(0); Tcc353xStreamBufferClose(0); Tcc353xTccspiClose(0); if(ret == TCC353X_RETURN_SUCCESS) rc = OK; TcpalSemaphoreUnLock(&Tcc353xDrvSem); return rc; }
static int broadcast_Isdb_spi_probe(struct spi_device *spi_dev) { int rc = 0; xo_handle_tcc = msm_xo_get(MSM_XO_TCXO_A0, id); if(IS_ERR(xo_handle_tcc)) { pr_err("Failed to get MSM_XO_TCXO_A2 handle for TDMB (%ld)\n", PTR_ERR(xo_handle_tcc)); return FALSE; } TcpalCreateSemaphore(&Tcc353xDrvSem, (I08S *) "Tcc353xDriverControlSemaphore", 1); TcpalCreateSemaphore(&Tcc353xStreamSema, (I08S *) "StreamSemaphore", 1); TcpalCreateSemaphore(&Tcc353xLnaControlSema, (I08S *) "LnaControlSemaphore", 1); spi_dev->mode = SPI_MODE_0; spi_dev->bits_per_word = 8; spi_dev->max_speed_hz = 32*1000*1000; /* */ rc = spi_setup(spi_dev); IsdbCtrlInfo.spi_dev = spi_dev; IsdbCtrlInfo.pwr_state = 0; TcpalPrintStatus((I08S *)"spi : %p\n", spi_dev); TchalInit(); TcpalRegisterIrqHandler(); TcpalIrqDisable(); #ifndef _NOT_USE_WAKE_LOCK_ wake_lock_init(&IsdbCtrlInfo.wake_lock, WAKE_LOCK_SUSPEND, dev_name(&spi_dev->dev)); #endif /* */ tcc353x_lnaControl_start(); return rc; }
static int broadcast_Isdb_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { int rc = 0; int addr; TcpalPrintLog("broadcast_Isdb_i2c_probe client:0x%X\n", (unsigned int)client); if(!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { TcpalPrintErr("need I2C_FUNC_I2C\n"); return -ENODEV; } /* */ addr = client->addr; // pr_err("[1seg] i2c Slaveaddr [%x] \n", addr); /* */ TcpalCreateSemaphore(&Tcc353xDrvSem, (I08S *) "Tcc353xDriverControlSemaphore", 1); TcpalCreateSemaphore(&Tcc353xStreamSema, (I08S *) "StreamSemaphore", 1); TcpalCreateSemaphore(&Tcc353xLnaControlSema, (I08S *) "LnaControlSemaphore", 1); IsdbCtrlInfo.pclient = client; // TchalInit(); TcpalRegisterIrqHandler(); TcpalIrqDisable(); #ifndef _NOT_USE_WAKE_LOCK_ wake_lock_init(&IsdbCtrlInfo.wake_lock, WAKE_LOCK_SUSPEND, dev_name(&client->dev)); #endif /* */ tcc353x_lnaControl_start(); return rc; }
int broadcast_drv_if_set_channel(struct broadcast_dmb_set_ch_info *udata) { Tcc353xTuneOptions tuneOption; signed long frequency = 214714; /*tmm*/ int ret; int needLockCheck = 0; TcpalSemaphoreLock(&Tcc353xDrvSem); if(OnAir == 0 || udata == NULL) { TcpalPrintErr((I08S *)"[1seg] broadcast_drv_if_set_channel error [!OnAir]\n"); TcpalSemaphoreUnLock(&Tcc353xDrvSem); return ERROR; } TcpalMemset (&tuneOption, 0x00, sizeof(tuneOption)); if(udata->subchannel == 22 && udata->rf_band==0) { /* uhf 1segment */ currentBroadCast = UHF_1SEG; currentSelectedChannel = udata->channel; tuneOption.rfIfType = TCC353X_LOW_IF; tuneOption.segmentType = TCC353X_ISDBT_1_OF_13SEG; tuneOption.userFifothr = _1_SEG_FIFO_THR_; needLockCheck = 1; if(udata->channel<13 || udata->channel>62) { TcpalPrintErr((I08S *)"[1seg] channel information error\n"); TcpalSemaphoreUnLock(&Tcc353xDrvSem); return ERROR; } frequency = frequencyTable[udata->channel-13]; } else if (udata->subchannel == 22) { /* tmm 13seg */ if(udata->channel==0 || udata->channel>33) { TcpalPrintErr((I08S *)"[1seg] channel information error [%d]\n", udata->channel); TcpalSemaphoreUnLock(&Tcc353xDrvSem); return ERROR; } currentBroadCast = TMM_13SEG; currentSelectedChannel = udata->channel; tuneOption.rfIfType = TCC353X_ZERO_IF; tuneOption.segmentType = TCC353X_ISDBTMM; tuneOption.userFifothr = _13_SEG_FIFO_THR_; if(udata->channel == 7) tuneOption.tmmSet = C_1st_13Seg; else if(udata->channel == 20) tuneOption.tmmSet = C_2nd_13Seg; else if(udata->channel == 27) tuneOption.tmmSet = B_2nd_13Seg; else if(udata->channel == 14) tuneOption.tmmSet = A_1st_13Seg; else { tuneOption.tmmSet = UserDefine_Tmm13Seg; frequency = MMBI_FREQ_TABLE[udata->channel-1]; } } else { /* tmm 1seg */ if(udata->channel==0 || udata->channel>33) { TcpalPrintErr((I08S *)"[1seg] channel information error [%d]\n", udata->channel); TcpalSemaphoreUnLock(&Tcc353xDrvSem); return ERROR; } currentBroadCast = TMM_1SEG; currentSelectedChannel = udata->channel; tuneOption.rfIfType = TCC353X_LOW_IF; tuneOption.segmentType = TCC353X_ISDBTMM; tuneOption.userFifothr = _1_SEG_FIFO_THR_; if(udata->channel < 8 && udata->channel > 0) tuneOption.tmmSet = A_1st_1Seg+udata->channel-1; else if(udata->channel < 21 && udata->channel > 13) tuneOption.tmmSet = B_1st_1Seg+udata->channel-14; else if(udata->channel < 34 && udata->channel > 26) tuneOption.tmmSet = C_1st_1Seg+udata->channel-27; else { tuneOption.tmmSet = UserDefine_Tmm1Seg; frequency = MMBI_FREQ_TABLE[udata->channel-1]; } } TcpalIrqDisable(); gOverflowcnt = 0; if(needLockCheck && udata->mode == 1) /* Scan mode & need lock check */ ret = Tcc353xApiChannelSearch(0, frequency, &tuneOption); else /* normal mode */ ret = Tcc353xApiChannelSelect(0, frequency, &tuneOption); Tcc353xStreamBufferReset(0); Tcc353xMonitoringApiInit(0, 0); TcpalIrqEnable(); if(ret!=TCC353X_RETURN_SUCCESS) { TcpalSemaphoreUnLock(&Tcc353xDrvSem); return ERROR; } TcpalSemaphoreUnLock(&Tcc353xDrvSem); return OK; }