Ejemplo n.º 1
0
static int s3c_jpeg_open(struct inode *inode, struct file *file)
{
	sspc100_jpg_ctx *jpg_reg_ctx;
	DWORD	ret;

	ret = s5pv210_pd_enable("jpeg_pd");
	if (ret < 0) {
		jpg_err("failed to enable jpeg power domain\n");
		return FALSE;
	}

	/* clock enable */
	clk_enable(s3c_jpeg_clk);
	
	jpg_dbg("JPG_open \r\n");

	jpg_reg_ctx = (sspc100_jpg_ctx *)mem_alloc(sizeof(sspc100_jpg_ctx));
	memset(jpg_reg_ctx, 0x00, sizeof(sspc100_jpg_ctx));

	ret = lock_jpg_mutex();

	if (!ret) {
		jpg_err("JPG Mutex Lock Fail\r\n");
		unlock_jpg_mutex();
		kfree(jpg_reg_ctx);
		return FALSE;
	}

	if (instanceNo > MAX_INSTANCE_NUM) {
		jpg_err("Instance Number error-JPEG is running, \
				instance number is %d\n", instanceNo);
		unlock_jpg_mutex();
		kfree(jpg_reg_ctx);
		return FALSE;
	}
static int s3c_jpeg_open(struct inode *inode, struct file *file)
{
	struct s5pc110_jpg_ctx *jpg_reg_ctx;
	unsigned long	ret;

	jpg_dbg("JPG_open \r\n");

	jpg_reg_ctx = (struct s5pc110_jpg_ctx *)
		       mem_alloc(sizeof(struct s5pc110_jpg_ctx));
	memset(jpg_reg_ctx, 0x00, sizeof(struct s5pc110_jpg_ctx));

	ret = lock_jpg_mutex();

	if (!ret) {
		jpg_err("JPG Mutex Lock Fail\r\n");
		unlock_jpg_mutex();
		kfree(jpg_reg_ctx);
		return FALSE;
	}

	if (instanceNo > MAX_INSTANCE_NUM) {
		jpg_err("Instance Number error-JPEG is running, \
				instance number is %d\n", instanceNo);
		unlock_jpg_mutex();
		kfree(jpg_reg_ctx);
		return FALSE;
	}
Ejemplo n.º 3
0
irqreturn_t s3c_jpeg_irq(int irq, void *dev_id, struct pt_regs *regs)
{
	unsigned int	int_status;
	unsigned int	status;

	jpg_dbg("=====enter s3c_jpeg_irq===== \r\n");

	int_status = readl(s3c_jpeg_base + S3C_JPEG_INTST_REG);

	do {
		status = readl(s3c_jpeg_base + S3C_JPEG_OPR_REG);
	} while (status);

	writel(S3C_JPEG_COM_INT_RELEASE, s3c_jpeg_base + S3C_JPEG_COM_REG);
	jpg_dbg("int_status : 0x%08x status : 0x%08x\n", int_status, status);

	if (int_status) {
		switch (int_status) {
		case 0x40:
			jpg_irq_reason = OK_ENC_OR_DEC;
			break;
		case 0x20:
			jpg_irq_reason = ERR_ENC_OR_DEC;
			break;
		default:
			jpg_irq_reason = ERR_UNKNOWN;
		}

		wake_up_interruptible(&wait_queue_jpeg);
	} else {
		jpg_irq_reason = ERR_UNKNOWN;
		wake_up_interruptible(&wait_queue_jpeg);
	}

	return IRQ_HANDLED;
}