Esempio n. 1
0
/**
 * @brief Host Enable Function
 * @param [IN] host_id : host id.
 * @param [IN] en : enable.
 * @return  None
 * @see
 */
void gpHalUsbHostEn(
	unsigned int host_id,
	int en
)
{
	usbhReg_t *usbh = (usbhReg_t *) SetUSBHBase(host_id); 
    char * name = (host_id == 0) ? "USB_HOST0" : "USB_HOST1";
	static int usbHostUsage[2] = {0};
	if(en == 0)
	{
		usbHostUsage[host_id]--;
		if(usbHostUsage[host_id] <= 0)
		{
            usbHostUsage[host_id] = 0;
			gp_enable_clock( (int*)name, 0 );
		}
	}
	else
	{
		if(usbHostUsage[host_id] <= 0)
		{
			usbHostUsage[host_id] = 0;
			gp_enable_clock( (int*)name, 1 );;
			usbh->ctrl = 0x01;
			msleep(1);
		}
		usbHostUsage[host_id]++;
	}
}
Esempio n. 2
0
/**
 * @brief   Ceva clock enable/disable
 * @param   enable [in] 0:disable, 1:enable
 * @return  None
 * @see
 */
static void aes_clock_enable(int enable)
{
#ifdef CONFIG_PM
    if( enable ) {
        gp_enable_clock((int*)"SYS_A", 1);
        gpHalScuClkEnable( SCU_A_PERI_AES, SCU_A, enable);
        gpHalAesModuleReset(1);
    }
    else {
        gpHalScuClkEnable( SCU_A_PERI_AES, SCU_A, enable);
        gp_enable_clock((int*)"SYS_A", 0);
    }
#else
    gpHalScuClkEnable( SCU_A_PERI_AES, SCU_A, enable);
    gpHalAesModuleReset(1);
#endif
}
void scu_lcd_clk_on(void)
{
#ifdef CONFIG_PM
	gp_enable_clock((int*)"PPU_TFT", 1);	
	gpHalScuClkEnable(SCU_A_PERI_PPU_TFT, SCU_A2, 1);	
	/*Line buffer clock was opened by self module*/
#else
	uint32_t val = 0;
	val = SCUA_A_PERI_CLKEN;
	val |= (SCU_A_PERI_LCD_CTRL |SCU_A_PERI_LINEBUFFER |SCU_A_PERI_REALTIME_ABT);
	SCUA_A_PERI_CLKEN = val;
#endif
}
Esempio n. 4
0
static int32_t
tv_suspend(
	void
)
{
	gpHalLcdClkEnable(0);
#ifdef CONFIG_PM
	gp_enable_clock((int*)"READLTIME_ABT", 0);
#endif
	scu_tvout_vdec_down();

	return 0;
}
Esempio n. 5
0
static void
gp_scalar_module_clk_en (
	int en
)
{
#ifdef CONFIG_PM
	if( en ) {
		//gpHalScuClkEnable( SCU_C_PERI_SCALING | SCU_C_PERI_2DSCALEABT, SCU_C, 1);
		gp_enable_clock((int*)"2DSCAABT", 1);
		gpHalScuClkEnable( SCU_C_PERI_SCALING, SCU_C, 1);
	}
	else{
		gpHalScuClkEnable( SCU_C_PERI_SCALING, SCU_C, 0);
		gp_enable_clock((int*)"2DSCAABT", 0);
	}
#else
	if( en ) {
		gpHalScuClkEnable( SCU_C_PERI_SCALING | SCU_C_PERI_2DSCALEABT, SCU_C, 1);
	}
	else{
		gpHalScuClkEnable( SCU_C_PERI_SCALING, SCU_C, 0);
	}
#endif
}
static int32_t
lcd_suspend(
    void
)
{
    printk("[%s:%d]\n", __FUNCTION__, __LINE__);
    gpHalLcdClkEnable(0);
#ifdef CONFIG_PM
    gp_enable_clock((int*)"READLTIME_ABT", 0);
#endif

    /* board config : release pin function */
    gp_board_pin_func_release(g_pin_func_handle);

    return 0;
}
/**************************************************************************
 *               F U N C T I O N    D E C L A R A T I O N S               *
 **************************************************************************/
static int32_t
tpo_td070wgcb2_init(
    void
)
{
    int32_t real_freq = 0;

    printk("[%s:%d]\n", __FUNCTION__, __LINE__);

    g_pin_func_handle = gp_board_pin_func_request(GP_PIN_DISP0_LCD, GP_BOARD_WAIT_FOREVER);
    if (g_pin_func_handle < 0) {
        printk("[%s:%d] Error!\n", __FUNCTION__, __LINE__);
        return -1;
    }

    /* initial panel parameter */
    gpHalDispSetDevType(HAL_DISP_DEV_LCD);

    // config lcd clock 33 MHz
    // set lcd source : SPLL
    gpHalClkLcdSetSrc(HAL_LCD_CLK_SPLL);
    // Set lcd clock rate, must enable before lcd clk on
    gp_clk_set_rate("clk_lcd", gPanelInfo.workFreq, &real_freq, NULL);	// must enable before lcd clk on
    printk("[%s][%d] LCD CLOCK=%d Hz\n",__FUNCTION__, __LINE__, real_freq);

    gpHalDispSetClkType(gPanelInfo.clkType);

    // enable lcd clock
#ifdef CONFIG_PM
    gp_enable_clock((int*)"READLTIME_ABT", 1);
#endif
    gpHalLcdClkEnable(1);

    gpHalDispSetRes(gPanelInfo.width, gPanelInfo.height);
    gpHalDispSetLcdVsync(gPanelInfo.vsync);
    gpHalDispSetLcdHsync(gPanelInfo.hsync);
    gpHalDispSetPanelFormat(gPanelInfo.format, gPanelInfo.type, gPanelInfo.dataSeqEven, gPanelInfo.dataSeqOdd);
    gpHalDispSetClkPolarity(gPanelInfo.clkPolatiry);

    gpHalDispSetPriDmaType(gPanelInfo.dmaType);
    gpHalDispSetOsdDmaType(0, gPanelInfo.dmaType);
    gpHalDispSetOsdDmaType(1, gPanelInfo.dmaType);

    return 0;
}
Esempio n. 8
0
static int32_t
tv_common_init(
	void
)
{
	int32_t real_freq=0;

	printk("[%s:%d]\n", __FUNCTION__, __LINE__);

	gpHalDispSetDevType(HAL_DISP_DEV_TV);

	// set lcd source : XTAL(27MHZ)
	gpHalClkLcdSetSrc(HAL_LCD_CLK_XTAL);
	// Set lcd clock rate, must enable before lcd clk on
	gp_clk_set_rate("clk_lcd", gPanelInfo.workFreq, &real_freq, NULL);	// must enable before lcd clk on

#ifdef CONFIG_PM
	gp_enable_clock((int*)"READLTIME_ABT", 1);
#endif
	gpHalLcdClkEnable(1);
	scu_tvout_vdec_enable();

	gpHalDispSetRes(gPanelInfo.width, gPanelInfo.height);
	gpHalDispSetTvType(gPanelInfo.tvType);
	gpHalDispSetTvPulse(gPanelInfo.pulse6);
	gpHalDispSetTvScan(gPanelInfo.scanSel);
	gpHalDispSetTvFscType(gPanelInfo.fscType);
	gpHalDispSetTvFix625(gPanelInfo.fix625);
	gpHalDispSetTvLine(gPanelInfo.lineSel);
	gpHalDispSetTvColorBurstWidth(gPanelInfo.cbWidth);
	gpHalDispSetTvColorBurstSel(gPanelInfo.cbSel);
	gpHalDispSetTvCftType(gPanelInfo.cftType);
	gpHalDispSetTvCupType(gPanelInfo.cupType);
	gpHalDispSetTvYupType(gPanelInfo.yupType);
	gpHalDispSetTvAmpAdj(gPanelInfo.ampAdj);
	gpHalDispSetTvPosAdj(gPanelInfo.posAdj);

	gpHalDispSetPriDmaType(gPanelInfo.dmaType);
	gpHalDispSetOsdDmaType(0, gPanelInfo.dmaType);
	gpHalDispSetOsdDmaType(1, gPanelInfo.dmaType);

	return 0;
}
static int32_t
lcd_suspend(
	void
)
{
	printk("[%s:%d]\n", __FUNCTION__, __LINE__);
	
	gpHalLcdClkEnable(0);
#ifdef CONFIG_PM
	gp_enable_clock((int*)"READLTIME_ABT", 0);
#endif
	
	if (R_TFT1_CTRL & 0x1) {
    	R_SCUA_SYS_SEL |= 0x2;
    }
    else {
    	/* board config : release pin function */
		gp_board_pin_func_release(g_pin_func_handle);	
	}
	return 0;
}
static int32_t
auo_a043fl01_resume_init(
	void
)
{
	int32_t real_freq = 0;
	
	/* initial panel parameter */
	gpHalDispSetDevType(HAL_DISP_DEV_LCD);

	// set lcd source : XTAL(27MHZ)
	gpHalClkLcdSetSrc(HAL_LCD_CLK_XTAL);
	// Set lcd clock rate to 9 MHz, must enable before lcd clk on
	gp_clk_set_rate("clk_lcd", gPanelInfo.workFreq, &real_freq, NULL);
	printk("[%s][%d] LCD CLOCK=%d Hz\n",__FUNCTION__, __LINE__, real_freq);

	gpHalDispSetClkType(gPanelInfo.clkType);

	// enable lcd clock
#ifdef CONFIG_PM
	gp_enable_clock((int*)"READLTIME_ABT", 1);
#endif
	gpHalLcdClkEnable(1);

	gpHalDispSetRes(gPanelInfo.width, gPanelInfo.height);
	gpHalDispSetLcdVsync(gPanelInfo.vsync);
	gpHalDispSetLcdHsync(gPanelInfo.hsync);
	gpHalDispSetPanelFormat(gPanelInfo.format, gPanelInfo.type, gPanelInfo.dataSeqEven, gPanelInfo.dataSeqOdd);
	gpHalDispSetClkPolarity(gPanelInfo.clkPolatiry);

	gpHalDispSetPriDmaType(gPanelInfo.dmaType);
	gpHalDispSetOsdDmaType(0, gPanelInfo.dmaType);
	gpHalDispSetOsdDmaType(1, gPanelInfo.dmaType);

	return 0;
}
Esempio n. 11
0
/**
 * @brief   Aes clock enable/disable
 * @param   enable [in] 0:disable, 1:enable
 * @return  None
 * @see
 */
static void aes_clock_enable(int enable)
{
	gp_enable_clock( (int*)"AES", enable );
}
Esempio n. 12
0
/**
 * @brief   Adc clock enable/disable
 * @param   enable [in] 0:disable, 1:enable
 * @return  None
 * @see
 */
static void adc_clock_enable(int enable)
{
	gp_enable_clock( (int*)"SAACC", enable );
}
static int32_t
lcd_resume(
	void
)
{
	int32_t real_freq = 0;
	gp_board_panel_t *lcd_power;
	int handle;
	gpio_content_t ctx;

	printk("[%s:%d]\n", __FUNCTION__, __LINE__);

	lcd_power = gp_board_get_config("panel", gp_board_panel_t);

	gpHalDispSetDevType(HAL_DISP_DEV_LCD);

	// set lcd source : XTAL(27MHZ)
	gpHalClkLcdSetSrc(HAL_LCD_CLK_XTAL);
	// Set lcd clock rate, must enable before lcd clk on
	gp_clk_set_rate("clk_lcd", gPanelInfo.workFreq, &real_freq, NULL);	

	gpHalDispSetClkType(gPanelInfo.clkType);

#ifdef CONFIG_PM
	gp_enable_clock((int*)"READLTIME_ABT", 1);
#endif
	gpHalLcdClkEnable(1);		

	gpHalDispSetRes(gPanelInfo.width, gPanelInfo.height);
	gpHalDispSetLcdVsync(gPanelInfo.vsync);
	gpHalDispSetLcdHsync(gPanelInfo.hsync);
	gpHalDispSetPanelFormat(gPanelInfo.format, gPanelInfo.type, gPanelInfo.dataSeqEven, gPanelInfo.dataSeqOdd);
	gpHalDispSetClkPolarity(gPanelInfo.clkPolatiry);

	lcd_power->set_panelpowerOn0(1);		/* Power on VCC, VGL, AVDD, VGH */

	ctx.pin_index = MK_GPIO_INDEX( PCLK_channel, PCLK_func, PCLK_gid, PCLK_pin );
	handle = gp_gpio_request( ctx.pin_index, NULL );
	gp_gpio_set_function( handle, PCLK_func );	
	gp_gpio_release( handle );

	ctx.pin_index = MK_GPIO_INDEX( B_DATA_channel, B_DATA_func, B_DATA_gid, B_DATA_pin );
	handle = gp_gpio_request( ctx.pin_index, NULL );
	gp_gpio_set_function( handle, B_DATA_func );	
	gp_gpio_release( handle );

	ctx.pin_index = MK_GPIO_INDEX( G_DATA_channel, G_DATA_func, G_DATA_gid, G_DATA_pin );
	handle = gp_gpio_request( ctx.pin_index, NULL );
	gp_gpio_set_function( handle, G_DATA_func );	
	gp_gpio_release( handle );
	
	ctx.pin_index = MK_GPIO_INDEX( R_DATA_channel, R_DATA_func, R_DATA_gid, R_DATA_pin );
	handle = gp_gpio_request( ctx.pin_index, NULL );
	gp_gpio_set_function( handle, R_DATA_func );	
	gp_gpio_release( handle );

	lcd_power->set_panelpowerOn1(1);		/* Set LCD RESET to high */

	/* Set dither */
	disp_set_dither_type(gPanelInfo.ditherType);
	disp_set_dither_param(gPanelInfo.pDitherParam);
	disp_set_dither_enable(1);

	/* Set color matrix */
	disp_set_color_matrix(gPanelInfo.pColorMatrix);

	/* Set gamma table */
	disp_set_gamma_enable(0);
	disp_set_gamma_table(SP_DISP_GAMMA_R, (uint8_t*) gPanelInfo.pGammaTable[SP_DISP_GAMMA_R]);
	disp_set_gamma_table(SP_DISP_GAMMA_G, (uint8_t*) gPanelInfo.pGammaTable[SP_DISP_GAMMA_G]);
	disp_set_gamma_table(SP_DISP_GAMMA_B, (uint8_t*) gPanelInfo.pGammaTable[SP_DISP_GAMMA_B]);
	disp_set_gamma_enable(1);

	gpHalDispSetPriDmaType(gPanelInfo.dmaType);
	gpHalDispSetOsdDmaType(0, gPanelInfo.dmaType);
	gpHalDispSetOsdDmaType(1, gPanelInfo.dmaType);

	return 0;
}
static int32_t
lcd_suspend(
	void
)
{
	uint8_t	white_gamma[256];
	uint16_t	i;
	gp_board_panel_t *lcd_power;
	int handle;
	gpio_content_t ctx;

	printk("[%s:%d]\n", __FUNCTION__, __LINE__);

	lcd_power = gp_board_get_config("panel", gp_board_panel_t);

	/* Set dither */
	//disp_set_dither_type(gPanelInfo.ditherType);
	//disp_set_dither_param(gPanelInfo.pDitherParam);
	//disp_set_dither_enable(1);

	/* Set color matrix */
	//disp_set_color_matrix(gPanelInfo.pColorMatrix);

	/* Set white gamma table */
	for ( i = 0 ; i < 256 ; i++ ) {
		white_gamma[i] = 0xff;
	}
	disp_set_gamma_enable(0);
	disp_set_gamma_table(SP_DISP_GAMMA_R, (uint8_t*) white_gamma);
	disp_set_gamma_table(SP_DISP_GAMMA_G, (uint8_t*) white_gamma);
	disp_set_gamma_table(SP_DISP_GAMMA_B, (uint8_t*) white_gamma);
	disp_set_gamma_enable(1);

	//msleep(60);
	disp_wait_frame_end();
	disp_wait_frame_end();
	//LCD_RST to Low
	lcd_power->set_panelpowerOn1(0);

// Disable LCD bus
	ctx.pin_index = MK_GPIO_INDEX( PCLK_channel, PCLK_GPIO, PCLK_gid, PCLK_pin );
	handle = gp_gpio_request( ctx.pin_index, NULL );
	gp_gpio_set_function( handle, PCLK_GPIO );	
	gp_gpio_release( handle );

	for ( i = 0 ; i <= 10 ; i++ ) {
		ctx.pin_index = MK_GPIO_INDEX( PCLK_channel, PCLK_GPIO, PCLK_gid, i );
		handle = gp_gpio_request( ctx.pin_index, NULL );
		gp_gpio_set_output( handle, 0, 0 );
		gp_gpio_release( handle );	
	}

	ctx.pin_index = MK_GPIO_INDEX( B_DATA_channel, B_DATA_GPIO, B_DATA_gid, B_DATA_pin );
	handle = gp_gpio_request( ctx.pin_index, NULL );
	gp_gpio_set_function( handle, B_DATA_GPIO );	
	gp_gpio_release( handle );

	for ( i = 0 ; i <= 7 ; i++ ) {
		ctx.pin_index = MK_GPIO_INDEX( B_DATA_channel, B_DATA_GPIO, B_DATA_gid, i );
		handle = gp_gpio_request( ctx.pin_index, NULL );
		gp_gpio_set_output( handle, 0, 0 );
		gp_gpio_release( handle );	
	}

	ctx.pin_index = MK_GPIO_INDEX( G_DATA_channel, G_DATA_GPIO, G_DATA_gid, G_DATA_pin );
	handle = gp_gpio_request( ctx.pin_index, NULL );
	gp_gpio_set_function( handle, G_DATA_GPIO );	
	gp_gpio_release( handle );

	for ( i = 8 ; i <= 11 ; i++ ) {
		ctx.pin_index = MK_GPIO_INDEX( G_DATA_channel, G_DATA_GPIO, G_DATA_gid, i );
		handle = gp_gpio_request( ctx.pin_index, NULL );
		gp_gpio_set_output( handle, 0, 0 );
		gp_gpio_release( handle );
	}
	
	ctx.pin_index = MK_GPIO_INDEX( R_DATA_channel, R_DATA_GPIO, R_DATA_gid, R_DATA_pin );
	handle = gp_gpio_request( ctx.pin_index, NULL );
	gp_gpio_set_function( handle, R_DATA_GPIO );	
	gp_gpio_release( handle );
	
	for ( i = 12 ; i <= 15 ; i++ ) {
		ctx.pin_index = MK_GPIO_INDEX( R_DATA_channel, R_DATA_GPIO, R_DATA_gid, i );
		handle = gp_gpio_request( ctx.pin_index, NULL );
		gp_gpio_set_output( handle, 0, 0 );
		gp_gpio_release( handle );
	}

	//VGH, AVDD, VGL, VCC to low
	lcd_power->set_panelpowerOn0(0);

	/* Disable lcd clock */
	gpHalLcdClkEnable(0);	
#ifdef CONFIG_PM
	gp_enable_clock((int*)"READLTIME_ABT", 0);
#endif

	return 0;
}
Esempio n. 15
0
/**
 * @brief   Gpio clock enable/disable
 * @param   enable [in] 0:disable, 1:enable
 * @return  None
 * @see
 */
static void gpio_clock_enable(int enable)
{
	 gp_enable_clock( (int*)"GPIO", enable );
}
/**
 * @brief   I2c clock enable/disable
 * @param   enable [in] 0:disable, 1:enable
 * @return  None
 * @see
 */
static void i2c_clock_enable(int enable)
{
	gp_enable_clock( (int*)"ARM_I2C", enable );
}