int tcc353x_power_off(void)
{
	if(IsdbCtrlInfo.pwr_state == 0)
	{
		TcpalPrintStatus((I08S *)"Isdb_tcc3530_power is immediately off\n");
		return OK;
	}
	else
	{
		#if defined (_MODEL_F9J_)
		if(xo_handle_tcc != NULL) {
		    msm_xo_mode_vote(xo_handle_tcc, MSM_XO_MODE_OFF);
		}
		#endif
		TcpalPrintStatus((I08S *)"Isdb_tcc3530_power_off\n");
		TchalPowerDownDevice();
	}

#ifndef _NOT_USE_WAKE_LOCK_
	wake_unlock(&IsdbCtrlInfo.wake_lock);
#endif
	IsdbCtrlInfo.pwr_state = 0;

	return OK;
}
Ejemplo n.º 2
0
int	broadcast_drv_if_power_off(void)
{
	int rc = ERROR;
	TcpalPrintStatus((I08S *)"[1seg]broadcast_drv_if_power_off\n");
	if (tcc353x_is_power_on())
		rc = tcc353x_power_off();
	else
		TcpalPrintStatus((I08S *)"[1seg] warning-already power off\n");
	return rc;
}
Ejemplo n.º 3
0
int __devinit broadcast_dmb_drv_init(void)
{
    int rc;
    TcpalPrintStatus((I08S *)"[%s]\n", __func__);
    rc = broadcast_dmb_drv_start(&device_tcc353x);
    if (rc)
    {
        TcpalPrintErr((I08S *)"failed to load\n");
        return rc;
    }
    TcpalPrintStatus((I08S *)"[%s add i2c driver]\n", __func__);
    rc = i2c_add_driver(&broadcast_Isdb_driver);
    TcpalPrintStatus((I08S *)"broadcast_add_driver rc = (%d)\n", rc);
    return rc;
}
/* Body of Internel function */
int	broadcast_drv_start(void)
{
	int rc;
	rc = OK;
	TcpalPrintStatus((I08S *)"[1seg]broadcast_drv_start\n");
	return rc;
}
void TchalPowerDownDevice(void)
{
    gpio_set_value(ISDB_RESET_N, 0);		/* low ISDB_RESET_N */
    TcpalmSleep(5);
    gpio_set_value(ISDB_EN, 0);			/* low ISDB_EN */
    TcpalPrintStatus((I08S *)"[%s:%d]\n", __func__, __LINE__);
}
void TchalPowerOnDevice(void)
{

#ifdef INCLUDE_LGE_SRC_EAR_ANT_SEL
	/* Internel antenna:ON, Ear antenna: OFF, GPIO11: HIGH (Default: Use Internel Antenna )*/
	gpio_set_value_cansleep(ONESEG_EAR_ANT_SEL_P, 1); /* PMIC Extended GPIO */
#endif
	#ifndef _MODEL_F9J_
	gpio_direction_output(ISDB_EN, false); 		/* output low */
	#endif
	gpio_direction_output(ISDB_RESET_N, false); 	/* output low */

	#ifdef _MODEL_F9J_
	power_set_for_pm8921_s4(1);
	power_set_for_pm8921_l10(1);
	power_set_for_pm8921_l29(1);
	#else
	gpio_set_value(ISDB_EN, 1);			/* high ISDB_EN */
	#endif
	TcpalmSleep(10);
	TchalResetDevice();
	TchalIrqSetup();

	TcpalPrintStatus((I08S *)"[%s:%d]\n", __func__, __LINE__);
}
void TchalInit(void)
{
	gpio_request(ISDB_RESET_N, "ISDB_RESET");
	#ifdef _MODEL_F9J_
	
	#else
	gpio_request(ISDB_EN, "ISDB_EN");
	#endif
	gpio_request(ISDB_INT_N, "ISDB_INT");

#ifdef INCLUDE_LGE_SRC_EAR_ANT_SEL
	/* Internel antenna:OFF, Ear antenna: ON, GPIO11:LOW (Saving power)*/
	gpio_set_value_cansleep(ONESEG_EAR_ANT_SEL_P, 0); /* PMIC Extended GPIO */
#endif

	gpio_direction_output(ISDB_RESET_N, false); 	/* output low */
	#ifdef _MODEL_F9J_
	power_set_for_pm8921_s4(0);
	power_set_for_pm8921_l10(0);
	power_set_for_pm8921_l29(0);
	#else
	gpio_direction_output(ISDB_EN, false); 		/* output low */
	#endif
	gpio_direction_input(ISDB_INT_N); 		/* input */

	TcpalPrintStatus((I08S *)"[%s:%d]\n", __func__, __LINE__);
}
int tcc353x_power_on(void)
{
#if defined (_MODEL_F9J_)
	int rc;
#endif	
	if(IsdbCtrlInfo.pwr_state != 1)
	{
#ifndef _NOT_USE_WAKE_LOCK_
		wake_lock(&IsdbCtrlInfo.wake_lock);
#endif
		TchalPowerOnDevice();
#if defined (_MODEL_F9J_)

		rc = msm_xo_mode_vote(xo_handle_tcc, MSM_XO_MODE_ON);
		if(rc < 0) {
			pr_err("Configuring MSM_XO_MODE_ON failed (%d)\n", rc);
			msm_xo_put(xo_handle_tcc);
			return FALSE;
		}
#endif		
	}
	else
	{
		TcpalPrintStatus((I08S *)"aready on!! \n");
	}

	IsdbCtrlInfo.pwr_state = 1;
	return OK;

}
int	broadcast_get_stop_mode(void)
{
	int rc;
	rc = OK;
	TcpalPrintStatus((I08S *)"[1seg]broadcast_get_stop_mode\n");
	return rc;
}
Ejemplo n.º 10
0
I32U Tcc353xInterruptProcess(void)
{
	I32U ret = 0;
	I08U irqStatus = 0;
	I32S moduleIndex = 0;
	I32U totalSize = 0;
	I08U data = 0x00;

	/* Read BB Interrupt Status */
	Tcc353xApiGetIrqStatus(moduleIndex, &irqStatus);

#if defined (_I2C_STS_)
	totalSize = 0;
	data = 0x00;

	/* Tcc353x IRQ Clear */
	Tcc353xApiIrqClear(moduleIndex, irqStatus);
	ret = 0; /* return no data */
#else
	/* Stream Interrupt */
	if (irqStatus&0x01) {
		TcpalPrintErr((I08S *)
			      "[TCC353X] FIFO overflow[0x%02X] flush!!!\n",
			      irqStatus);

		/* IRQ Disable - Prevent additional interrupt signal */
		data = 0x00;
		Tcc353xApiRegisterWrite(0,0, 0x03, &data, 1);

		/* Tcc353x IRQ Clear */
		Tcc353xApiIrqClear(moduleIndex, irqStatus);
		Tcc353xApiInterruptBuffClr(moduleIndex);
		gOverflowcnt ++;
		ret = 0;
	} else {
		/* Tcc353x IRQ Clear */
		Tcc353xApiIrqClear(moduleIndex, irqStatus);
		Tcc353xApiGetFifoStatus(moduleIndex, &totalSize);
		ret = totalSize;
		if(ret>=150*188)
			TcpalPrintErr((I08S *)
			      "[TCC353X] FIFO stat size[%d]\n",
			      ret);
	}

	gDbgIsrCnt++;

	if(gDbgIsrCnt>100) {
		gDbgIsrCnt = 0;
#ifdef _DBG_CHK_OVERFLOW_CNT_
		TcpalPrintStatus((I08S *)
				  "[TCC353X] CurrOverflow Cnt %d\n",
				  gOverflowcnt);
#endif
	}
#endif

	return ret;
}
Ejemplo n.º 11
0
int	broadcast_drv_if_power_on(void)
{
	int rc = ERROR;
	
	TcpalPrintStatus((I08S *)"[1seg]broadcast_drv_if_power_on\n");
	if (!tcc353x_is_power_on())
		rc = tcc353x_power_on();
	return rc;
}
Ejemplo n.º 12
0
int	broadcast_drv_if_open(void)
{
	int rc = ERROR;
	
	Tcc353xStreamFormat_t streamFormat;
	int ret = 0;

	TcpalSemaphoreLock(&Tcc353xDrvSem);

#if defined (_USE_SEND_GOOD_SIGNAL_INFO_CHANGING_)
	Time_channel_tune = 0;
	Need_send_good_signal = 0;
#endif

	Tcc353xI2cOpen(0);
	ret = Tcc353xApiOpen(0, &Tcc353xOptionSingle, sizeof(Tcc353xOption_t));
	if (ret != TCC353X_RETURN_SUCCESS) {
		/* driver re-open routine */
		TcpalPrintErr((I08S *) "[1seg] TCC3530 Re-init (close & open)...\n");
		Tcc353xWrapperSafeClose ();

		/* re-open driver & power ctrl*/
		broadcast_drv_if_power_on();
		Tcc353xI2cOpen(0);
		ret = Tcc353xApiOpen(0, &Tcc353xOptionSingle, sizeof(Tcc353xOption_t));
		if (ret != TCC353X_RETURN_SUCCESS) {
			TcpalPrintErr((I08S *) "[1seg] TCC3530 Init Fail!!!\n");
			Tcc353xWrapperSafeClose ();
			TcpalSemaphoreUnLock(&Tcc353xDrvSem);
			return ERROR;
		}
	}

	streamFormat.pidFilterEnable = 0;
	streamFormat.syncByteFilterEnable = 1;
	streamFormat.tsErrorFilterEnable = 1;
	streamFormat.tsErrorInsertEnable = 1;
#if defined (_MODEL_TCC3535_) && defined (_TCC3535_ROM_MASK_VER_)
	ret = Tcc353xApiInit(0, NULL, 0, &streamFormat);
#else
	ret = Tcc353xApiInit(0, (I08U *)TCC353X_BOOT_DATA_ISDBT13SEG,
			     TCC353X_BOOT_SIZE_ISDBT13SEG, &streamFormat);
#endif
	if (ret != TCC353X_RETURN_SUCCESS) {
		TcpalPrintErr((I08S *) "[1seg] TCC3530 Init Fail!!!\n");
		Tcc353xWrapperSafeClose ();
		rc = ERROR;
	} else {
		TcpalPrintStatus((I08S *) "[1seg] TCC3530 Init Success!!!\n");
		rc = OK;
	}

	OnAir = 1;
	TcpalSemaphoreUnLock(&Tcc353xDrvSem);
	return rc;
}
Ejemplo n.º 13
0
void TchalInit(void)
{
    gpio_request(ISDB_RESET_N, "ISDB_RESET");
    gpio_request(ISDB_EN, "ISDB_EN");
    gpio_request(ISDB_INT_N, "ISDB_INT");
    gpio_direction_output(ISDB_RESET_N, false); 	/* output low */
    gpio_direction_output(ISDB_EN, false); 		/* output low */
    gpio_direction_input(ISDB_INT_N); 		/* input */
    TcpalPrintStatus((I08S *)"[%s:%d]\n", __func__, __LINE__);
}
Ejemplo n.º 14
0
void TchalResetDevice(void)
{
    gpio_set_value(ISDB_RESET_N, 1);		/* high ISDB_RESET_N */
    TcpalmSleep(5);
    gpio_set_value(ISDB_RESET_N, 0);		/* low ISDB_RESET_N */
    TcpalmSleep(5);
    gpio_set_value(ISDB_RESET_N, 1);		/* high ISDB_RESET_N */
    TcpalmSleep(5);
    TcpalPrintStatus((I08S *)"[%s:%d]\n", __func__, __LINE__);
}
Ejemplo n.º 15
0
void Tcc353xStreamBufferFlush(I32S _moduleIndex)
{
	TcpalPrintStatus((I08S *) "[TCC353X] StreamBufferFlushing\n");
	TcpalSemaphoreLock(&Tcc353xStreamSema);
	Tcc353xStreamRp[_moduleIndex] = 0;
	Tcc353xStreamWp[_moduleIndex] = 0;
	Tcc353xStreamBufferedSize[_moduleIndex] = 0;
	Tcc353xStreamFlushFlag[_moduleIndex] = 1;
	TcpalSemaphoreUnLock(&Tcc353xStreamSema);
}
Ejemplo n.º 16
0
void TchalPowerOnDevice(void)
{
    gpio_direction_output(ISDB_EN, false); 		/* output low */
    gpio_direction_output(ISDB_RESET_N, false); 	/* output low */
    gpio_set_value(ISDB_EN, 1);			/* high ISDB_EN */
    TcpalmSleep(10);
    TchalResetDevice();
    TchalIrqSetup();
    TcpalPrintStatus((I08S *)"[%s:%d]\n", __func__, __LINE__);
}
Ejemplo n.º 17
0
static int broadcast_Isdb_i2c_remove(struct i2c_client* client)
{
    int rc = 0;

    TcpalPrintStatus((I08S *)"[%s]\n", __func__);
#ifndef _NOT_USE_WAKE_LOCK_
    wake_lock_destroy(&IsdbCtrlInfo.wake_lock);
#endif
    memset((unsigned char*)&IsdbCtrlInfo, 0x0, sizeof(struct broadcast_tcc3530_ctrl_data));
    TcpalDeleteSemaphore(&Tcc353xDrvSem);
    return rc;
}
int __devinit broadcast_dmb_drv_init(void)
{
	int rc;

	TcpalPrintStatus((I08S *)"[%s]\n", __func__);
	rc = broadcast_dmb_drv_start();	
	if (rc) 
	{
		TcpalPrintErr((I08S *)"failed to load\n");
		return rc;
	}

#if defined(_I2C_STS_)
	TcpalPrintStatus((I08S *)"[%s add i2c driver]\n", __func__);
	rc = i2c_add_driver(&broadcast_Isdb_driver);
#else
	TcpalPrintStatus((I08S *)"[%s add spi driver]\n", __func__);
	rc =  spi_register_driver(&broadcast_Isdb_driver);
#endif

	TcpalPrintStatus((I08S *)"broadcast_add_driver rc = (%d)\n", rc);
	return rc;
}
Ejemplo n.º 19
0
int	broadcast_drv_if_open(void)
{
	int rc = ERROR;
	
	Tcc353xStreamFormat_t streamFormat;
	int ret = 0;

	TcpalSemaphoreLock(&Tcc353xDrvSem);

	Tcc353xTccspiOpen(0);
	ret = Tcc353xApiOpen(0, &Tcc353xOptionSingle, sizeof(Tcc353xOption_t));
	if (ret != TCC353X_RETURN_SUCCESS) {
		/* driver re-open routine */
		TcpalPrintErr((I08S *) "[1seg] TCC3530 Re-init (close & open)...\n");
		Tcc353xWrapperSafeClose ();

		/* re-open driver & power ctrl*/
		broadcast_drv_if_power_on();
		Tcc353xTccspiOpen(0);
		ret = Tcc353xApiOpen(0, &Tcc353xOptionSingle, sizeof(Tcc353xOption_t));
		if (ret != TCC353X_RETURN_SUCCESS) {
			TcpalPrintErr((I08S *) "[1seg] TCC3530 Init Fail!!!\n");
			Tcc353xWrapperSafeClose ();
			TcpalSemaphoreUnLock(&Tcc353xDrvSem);
			return ERROR;
		}
	}

	streamFormat.pidFilterEnable = 0;
	streamFormat.syncByteFilterEnable = 1;
	streamFormat.tsErrorFilterEnable = 1;
	streamFormat.tsErrorInsertEnable = 1;
	ret = Tcc353xApiInit(0, (I08U *)TCC353X_BOOT_DATA_ISDBT13SEG,
			     TCC353X_BOOT_SIZE_ISDBT13SEG, &streamFormat);
	if (ret != TCC353X_RETURN_SUCCESS) {
		TcpalPrintErr((I08S *) "[1seg] TCC3530 Init Fail!!!\n");
		Tcc353xWrapperSafeClose ();
		rc = ERROR;
	} else {
		Tcc353xStreamBufferInit(0);
		TcpalIrqEnable();
		TcpalPrintStatus((I08S *) "[1seg] TCC3530 Init Success!!!\n");
		rc = OK;
	}

	OnAir = 1;
	TcpalSemaphoreUnLock(&Tcc353xDrvSem);
	return rc;
}
Ejemplo n.º 20
0
I32S Tcc353xTccspiClose(I32S _moduleIndex)
{
	struct TcpalTcspiData_t *spiData = &TcpalTcspiData;

	if (_moduleIndex == 0)
		gTccSpiHanleInit0 = 0;
	else
		gTccSpiHanleInit1 = 0;

	if (gTccSpiHanleInit0 == 0 && gTccSpiHanleInit1 == 0) {
		gTccSpiHanleInited = 0;
		TcpalPrintStatus((I08S *)"spi_dev :0x%p\n", spiData->spi_dev);
	}
	return TCC353X_RETURN_SUCCESS;
}
static int broadcast_Isdb_spi_remove(struct spi_device *spi)
{
	int rc = 0;

	/*                       */
	tcc353x_lnaControl_stop();

	TcpalPrintStatus((I08S *)"[%s]\n", __func__);
	TcpalUnRegisterIrqHandler();
#ifndef _NOT_USE_WAKE_LOCK_
	wake_lock_destroy(&IsdbCtrlInfo.wake_lock);
#endif
	memset((unsigned char*)&IsdbCtrlInfo, 0x0, sizeof(struct broadcast_tcc3530_ctrl_data));
	TcpalDeleteSemaphore(&Tcc353xDrvSem);
	TcpalDeleteSemaphore(&Tcc353xStreamSema);
	TcpalDeleteSemaphore(&Tcc353xLnaControlSema);
	return rc;
}
void TchalPowerDownDevice(void)
{
	gpio_set_value(ISDB_RESET_N, 0);		/* low ISDB_RESET_N */
	TcpalmSleep(5);
	#ifdef _MODEL_F9J_
	power_set_for_pm8921_s4(0);
	power_set_for_pm8921_l10(0);
	power_set_for_pm8921_l29(0);
	#else
	gpio_set_value(ISDB_EN, 0);			/* low ISDB_EN */
	#endif

#ifdef INCLUDE_LGE_SRC_EAR_ANT_SEL
	/* Internel antenna:OFF, Ear antenna: ON, GPIO11:LOW (Saving power)*/
	gpio_set_value_cansleep(ONESEG_EAR_ANT_SEL_P, 0); /* PMIC Extended GPIO */
#endif

	TcpalPrintStatus((I08S *)"[%s:%d]\n", __func__, __LINE__);
}
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;
}
Ejemplo n.º 24
0
I32U Tcc353xInterruptProcess(void)
{
	I32U ret = 0;
	I08U irqStatus = 0;
	I32S moduleIndex = 0;
	I32U totalSize = 0;

	/* Read BB Interrupt Status */
	Tcc353xApiGetIrqStatus(moduleIndex, &irqStatus);

	/* Stream Interrupt */
	if (irqStatus&0x01) {
		TcpalPrintErr((I08S *)
			      "[TCC353X] FIFO overflow[0x%02X] flush!!!\n",
			      irqStatus);
		/* Tcc353x IRQ Clear */
		Tcc353xApiIrqClear(moduleIndex, irqStatus);
		Tcc353xApiInterruptBuffClr(moduleIndex);
		gOverflowcnt ++;
		ret = 0;
	} else {
		/* Tcc353x IRQ Clear */
		Tcc353xApiIrqClear(moduleIndex, irqStatus);
		Tcc353xApiGetFifoStatus(moduleIndex, &totalSize);
		ret = totalSize;
	}

	gDbgIsrCnt++;

	if(gDbgIsrCnt>40) {
		gDbgIsrCnt = 0;
#ifdef _DBG_CHK_OVERFLOW_CNT_
		TcpalPrintStatus((I08S *)
				  "[TCC353X] CurrOverflow Cnt %d\n",
				  gOverflowcnt);
#endif
	}
	
	return ret;
}
static int broadcast_Isdb_spi_resume(struct spi_device *spi)
{
	int rc = 0;
	TcpalPrintStatus((I08S *)"[%s]\n", __func__);
	return rc;
}
static int broadcast_Isdb_spi_suspend(struct spi_device *spi, pm_message_t mesg)
{
	int rc = 0;
	TcpalPrintStatus((I08S *)"[%s]\n", __func__);
	return rc;
}
static int broadcast_Isdb_i2c_resume(struct i2c_client* client)
{
	int rc = 0;
	TcpalPrintStatus((I08S *)"[%s]\n", __func__);
	return rc;
}
static int broadcast_Isdb_i2c_suspend(struct i2c_client* client, pm_message_t mesg)
{
	int rc = 0;
	TcpalPrintStatus((I08S *)"[%s]\n", __func__);
	return rc;
}