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

Commit 6b3f9998 authored by Abhilash Jindal's avatar Abhilash Jindal Committed by Mauro Carvalho Chehab
Browse files

[media] dvb-frontend: Use boottime



Wall time obtained from ktime_get_real is susceptible to sudden jumps due to
user setting the time or due to NTP.  Boot time is constantly increasing time
better suited for comparing two timestamps.

[mchehab@osg.samsung.com: fix trivial merge conflicts]
Signed-off-by: default avatarAbhilash Jindal <klock.android@gmail.com>

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 3801bc7d
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -899,10 +899,10 @@ void dvb_frontend_sleep_until(ktime_t *waketime, u32 add_usec)
	s32 delta;

	*waketime = ktime_add_us(*waketime, add_usec);
	delta = ktime_us_delta(ktime_get_real(), *waketime);
	delta = ktime_us_delta(ktime_get_boottime(), *waketime);
	if (delta > 2500) {
		msleep((delta - 1500) / 1000);
		delta = ktime_us_delta(ktime_get_real(), *waketime);
		delta = ktime_us_delta(ktime_get_boottime(), *waketime);
	}
	if (delta > 0)
		udelay(delta);
@@ -2451,7 +2451,7 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
			u8 last = 1;
			if (dvb_frontend_debug)
				printk("%s switch command: 0x%04lx\n", __func__, swcmd);
			nexttime = ktime_get_real();
			nexttime = ktime_get_boottime();
			if (dvb_frontend_debug)
				tv[0] = nexttime;
			/* before sending a command, initialize by sending
@@ -2462,7 +2462,7 @@ static int dvb_frontend_ioctl_legacy(struct file *file,

			for (i = 0; i < 9; i++) {
				if (dvb_frontend_debug)
					tv[i+1] = ktime_get_real();
					tv[i+1] = ktime_get_boottime();
				if ((swcmd & 0x01) != last) {
					/* set voltage to (last ? 13V : 18V) */
					fe->ops.set_voltage(fe, (last) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18);
+2 −2
Original line number Diff line number Diff line
@@ -422,7 +422,7 @@ static int stv0299_send_legacy_dish_cmd (struct dvb_frontend* fe, unsigned long
	if (debug_legacy_dish_switch)
		printk ("%s switch command: 0x%04lx\n",__func__, cmd);

	nexttime = ktime_get_real();
	nexttime = ktime_get_boottime();
	if (debug_legacy_dish_switch)
		tv[0] = nexttime;
	stv0299_writeregI (state, 0x0c, reg0x0c | 0x50); /* set LNB to 18V */
@@ -431,7 +431,7 @@ static int stv0299_send_legacy_dish_cmd (struct dvb_frontend* fe, unsigned long

	for (i=0; i<9; i++) {
		if (debug_legacy_dish_switch)
			tv[i+1] = ktime_get_real();
			tv[i+1] = ktime_get_boottime();
		if((cmd & 0x01) != last) {
			/* set voltage to (last ? 13V : 18V) */
			stv0299_writeregI (state, 0x0c, reg0x0c | (last ? lv_mask : 0x50));