Exemple #1
0
static int jpeg_drv_dec_init(void)
{


    int retValue;
    spin_lock(&jpeg_dec_lock);
    if(dec_status != 0)
    {
        JPEG_WRN("JPEG Decoder is busy\n");
        retValue = -EBUSY;
    }
    else
    {
        dec_status = 1;
        retValue = 0;
    }
    spin_unlock(&jpeg_dec_lock);

    if(retValue == 0)
    {
        jpeg_drv_dec_power_on();

        jpeg_drv_dec_reset();

    }

    return retValue;

}
/* workaround for jpeg odd read operation at cg gating state */
void jpeg_drv_dec_verify_state_and_reset(void)
{
	unsigned int temp, value;

	IMG_REG_WRITE(0x00, REG_ADDR_JPGDEC_RESET);
	IMG_REG_WRITE(0x00, REG_ADDR_JPGDEC_RESET);
	IMG_REG_WRITE(0x10, REG_ADDR_JPGDEC_RESET);
	IMG_REG_WRITE(0x10, REG_ADDR_JPGDEC_RESET);

	IMG_REG_READ(temp, REG_ADDR_JPGDEC_ULTRA_THRES);
	IMG_REG_READ(value, REG_ADDR_JPGDEC_FILE_ADDR);

	/* issue happen, need to do 1 read at cg gating state */
	if (value == 0xFFFFFFFF) {
		JPEG_MSG("JPGDEC APB R/W issue found, start to do recovery!\n");
		jpeg_drv_dec_power_off();
		IMG_REG_READ(value, REG_ADDR_JPGDEC_ULTRA_THRES);
		jpeg_drv_dec_power_on();
	}

	_jpeg_dec_int_status = 0;
	_jpeg_dec_mode = 0;
}