Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 201700d3 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab
Browse files

V4L/DVB (5865): Remove usage of HZ on ivtv driver, replacing by msecs_to_jiffies

parent fe06fe0a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -275,9 +275,10 @@ int ivtv_waitq(wait_queue_head_t *waitq)
}

/* Generic utility functions */
int ivtv_sleep_timeout(int timeout, int intr)
int ivtv_msleep_timeout(unsigned int msecs, int intr)
{
	int ret;
	int timeout = msecs_to_jiffies(msecs);

	do {
		set_current_state(intr ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);
+1 −1
Original line number Diff line number Diff line
@@ -848,7 +848,7 @@ int ivtv_set_output_mode(struct ivtv *itv, int mode);
struct ivtv_stream *ivtv_get_output_stream(struct ivtv *itv);

/* Return non-zero if a signal is pending */
int ivtv_sleep_timeout(int timeout, int intr);
int ivtv_msleep_timeout(unsigned int msecs, int intr);

/* Wait on queue, returns -EINTR if interrupted */
int ivtv_waitq(wait_queue_head_t *waitq);
+2 −2
Original line number Diff line number Diff line
@@ -218,7 +218,7 @@ static struct ivtv_buffer *ivtv_get_buffer(struct ivtv_stream *s, int non_block,
			/* Process pending program info updates and pending VBI data */
			ivtv_update_pgm_info(itv);

			if (jiffies - itv->dualwatch_jiffies > HZ) {
			if (jiffies - itv->dualwatch_jiffies > msecs_to_jiffies(1000)) {
				itv->dualwatch_jiffies = jiffies;
				ivtv_dualwatch(itv);
			}
@@ -924,7 +924,7 @@ void ivtv_unmute(struct ivtv *itv)
	if (atomic_read(&itv->capturing) == 0)
		ivtv_vapi(itv, CX2341X_ENC_INITIALIZE_INPUT, 0);

	ivtv_sleep_timeout(HZ / 10, 0);
	ivtv_msleep_timeout(100, 0);

	if (atomic_read(&itv->capturing)) {
		ivtv_vapi(itv, CX2341X_ENC_MISC, 1, 12);
+8 −9
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@
#define IVTV_CMD_SPU_STOP 		0x00000001
#define IVTV_CMD_SDRAM_PRECHARGE_INIT 	0x0000001A
#define IVTV_CMD_SDRAM_REFRESH_INIT 	0x80000640
#define IVTV_SDRAM_SLEEPTIME 		(60 * HZ / 100)	/* 600 ms */
#define IVTV_SDRAM_SLEEPTIME 		600

#define IVTV_DECODE_INIT_MPEG_FILENAME 	"v4l-cx2341x-init.mpg"
#define IVTV_DECODE_INIT_MPEG_SIZE 	(152*1024)
@@ -89,7 +89,7 @@ void ivtv_halt_firmware(struct ivtv *itv)
	if (itv->enc_mbox.mbox)
		ivtv_vapi(itv, CX2341X_ENC_HALT_FW, 0);

	ivtv_sleep_timeout(HZ / 100, 0);
	ivtv_msleep_timeout(10, 0);
	itv->enc_mbox.mbox = itv->dec_mbox.mbox = NULL;

	IVTV_DEBUG_INFO("Stopping VDM\n");
@@ -113,7 +113,7 @@ void ivtv_halt_firmware(struct ivtv *itv)
	IVTV_DEBUG_INFO("Stopping SPU\n");
	write_reg(IVTV_CMD_SPU_STOP, IVTV_REG_SPU);

	ivtv_sleep_timeout(HZ / 100, 0);
	ivtv_msleep_timeout(10, 0);

	IVTV_DEBUG_INFO("init Encoder SDRAM pre-charge\n");
	write_reg(IVTV_CMD_SDRAM_PRECHARGE_INIT, IVTV_REG_ENC_SDRAM_PRECHARGE);
@@ -129,9 +129,8 @@ void ivtv_halt_firmware(struct ivtv *itv)
		write_reg(IVTV_CMD_SDRAM_REFRESH_INIT, IVTV_REG_DEC_SDRAM_REFRESH);
	}

	IVTV_DEBUG_INFO("Sleeping for %dms (600 recommended)\n",
		   (int)(IVTV_SDRAM_SLEEPTIME * 1000 / HZ));
	ivtv_sleep_timeout(IVTV_SDRAM_SLEEPTIME, 0);
	IVTV_DEBUG_INFO("Sleeping for %dms\n", IVTV_SDRAM_SLEEPTIME);
	ivtv_msleep_timeout(IVTV_SDRAM_SLEEPTIME, 0);
}

void ivtv_firmware_versions(struct ivtv *itv)
@@ -204,12 +203,12 @@ int ivtv_firmware_init(struct ivtv *itv)

	/* start firmware */
	write_reg(read_reg(IVTV_REG_SPU) & IVTV_MASK_SPU_ENABLE, IVTV_REG_SPU);
	ivtv_sleep_timeout(HZ / 10, 0);
	ivtv_msleep_timeout(100, 0);
	if (itv->has_cx23415)
		write_reg(read_reg(IVTV_REG_VPU) & IVTV_MASK_VPU_ENABLE15, IVTV_REG_VPU);
	else
		write_reg(read_reg(IVTV_REG_VPU) & IVTV_MASK_VPU_ENABLE16, IVTV_REG_VPU);
	ivtv_sleep_timeout(HZ / 10, 0);
	ivtv_msleep_timeout(100, 0);

	/* find mailboxes and ping firmware */
	itv->enc_mbox.mbox = ivtv_search_mailbox(itv->enc_mem, IVTV_ENCODER_SIZE);
@@ -264,7 +263,7 @@ void ivtv_init_mpeg_decoder(struct ivtv *itv)
				IVTV_DECODE_INIT_MPEG_FILENAME);
	} else {
		ivtv_vapi(itv, CX2341X_DEC_SCHED_DMA_FROM_HOST, 3, 0, readbytes, 0);
		ivtv_sleep_timeout(HZ / 10, 0);
		ivtv_msleep_timeout(100, 0);
	}
	ivtv_vapi(itv, CX2341X_DEC_STOP_PLAYBACK, 4, 0, 0, 0, 1);
}
+2 −2
Original line number Diff line number Diff line
@@ -420,7 +420,7 @@ static void ivtv_dma_enc_start(struct ivtv_stream *s)
		write_reg_sync(read_reg(IVTV_REG_DMAXFER) | 0x02, IVTV_REG_DMAXFER);
		set_bit(IVTV_F_I_DMA, &itv->i_flags);
		itv->cur_dma_stream = s->type;
		itv->dma_timer.expires = jiffies + HZ / 10;
		itv->dma_timer.expires = jiffies + msecs_to_jiffies(100);
		add_timer(&itv->dma_timer);
	}
}
@@ -437,7 +437,7 @@ static void ivtv_dma_dec_start(struct ivtv_stream *s)
	write_reg_sync(read_reg(IVTV_REG_DMAXFER) | 0x01, IVTV_REG_DMAXFER);
	set_bit(IVTV_F_I_DMA, &itv->i_flags);
	itv->cur_dma_stream = s->type;
	itv->dma_timer.expires = jiffies + HZ / 10;
	itv->dma_timer.expires = jiffies + msecs_to_jiffies(100);
	add_timer(&itv->dma_timer);
}

Loading