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

Commit 48331963 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mhi: core: calculate times based on given timer frequencies"

parents f94903bb 140a8294
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -234,8 +234,11 @@ extern struct bus_type mhi_bus_type;
#define SOC_HW_VERSION_MINOR_VER_BMSK (0x000000FF)
#define SOC_HW_VERSION_MINOR_VER_SHFT (0)

/* convert ticks to micro seconds by dividing by 19.2 */
#define TIME_TICKS_TO_US(x) (div_u64((x) * 10, 192))
/* timesync time calculations */
#define LOCAL_TICKS_TO_US(x) (div_u64((x) * 100ULL, \
				div_u64(mhi_cntrl->local_timer_freq, 10000ULL)))
#define REMOTE_TICKS_TO_US(x) (div_u64((x) * 100ULL, \
			       div_u64(mhi_cntrl->remote_timer_freq, 10000ULL)))

struct mhi_event_ctxt {
	u32 reserved : 8;
+2 −1
Original line number Diff line number Diff line
@@ -717,7 +717,8 @@ static ssize_t time_us_show(struct device *dev,
	}

	return scnprintf(buf, PAGE_SIZE, "local: %llu remote: %llu (us)\n",
			 TIME_TICKS_TO_US(t_host), TIME_TICKS_TO_US(t_device));
			 LOCAL_TICKS_TO_US(t_host),
			 REMOTE_TICKS_TO_US(t_device));
}
static DEVICE_ATTR_RO(time_us);

+2 −0
Original line number Diff line number Diff line
@@ -312,6 +312,8 @@ struct mhi_controller {
	/* supports time sync feature */
	struct mhi_timesync *mhi_tsync;
	struct mhi_device *tsync_dev;
	u64 local_timer_freq;
	u64 remote_timer_freq;

	/* kernel log level */
	enum MHI_DEBUG_LEVEL klog_lvl;