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

Commit c295fa8b authored by Abdul Muqtadeer Ahmed's avatar Abdul Muqtadeer Ahmed
Browse files

prima: Update driver timer APIs according to kernel 4.19

There are some changes to timer APIs in latest kernel,
update driver APIs accordingly to invoke correct kernel
APIs for timer functionalities.

Change-Id: I59dbe063e6c3c94ccad24b2074c0442f0828533f
CRs-fixed: 2878591
parent 91a33bed
Loading
Loading
Loading
Loading
+31 −8
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2018, 2021 The Linux Foundation. All rights reserved.
 *
 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
 *
@@ -2146,17 +2146,20 @@ void hdd_set_wlan_suspend_mode(bool suspend)
    vos_ssr_unprotect(__func__);
}

static void hdd_ssr_timer_init(void)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))
static void hdd_ssr_timer_cb(struct timer_list *data)
{
    init_timer(&ssr_timer);
}
	hddLog(VOS_TRACE_LEVEL_FATAL, "%s: HDD SSR timer expired", __func__);

static void hdd_ssr_timer_del(void)
{
    del_timer(&ssr_timer);
    ssr_timer_started = false;
#ifdef WCN_PRONTO
	if (wcnss_hardware_type() == WCNSS_PRONTO_HW)
		wcnss_pronto_log_debug_regs();
#endif

	VOS_BUG(0);
}

#else
static void hdd_ssr_timer_cb(unsigned long data)
{
    hddLog(VOS_TRACE_LEVEL_FATAL, "%s: HDD SSR timer expired", __func__);
@@ -2168,6 +2171,26 @@ static void hdd_ssr_timer_cb(unsigned long data)

    VOS_BUG(0);
}
#endif

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))
static void hdd_ssr_timer_init(void)
{
	timer_setup(&ssr_timer, hdd_ssr_timer_cb, 0);
}

#else
static void hdd_ssr_timer_init(void)
{
	init_timer(&ssr_timer);
}
#endif

static void hdd_ssr_timer_del(void)
{
    del_timer(&ssr_timer);
    ssr_timer_started = false;
}

static void hdd_ssr_timer_start(int msec)
{
+45 −15
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-2013, 2015-2017 The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2013, 2015-2021 The Linux Foundation. All rights reserved.
 *
 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
 *
@@ -110,9 +110,8 @@ static void tryAllowingSleep( VOS_TIMER_TYPE type )

  --------------------------------------------------------------------------*/

static void vos_linux_timer_callback (unsigned long data)
static void vos_linux_timer_callback(vos_timer_t *timer)
{
   vos_timer_t *timer = ( vos_timer_t *)data; 
   vos_msg_t msg;
   VOS_STATUS vStatus;
   unsigned long flags;
@@ -375,6 +374,47 @@ void vos_timer_exit()
}
#endif
  
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))
static void vos_timer_shim(struct timer_list *vos_timer)
{
	vos_timer_platform_t *platformInfo_ptr = container_of(vos_timer,
							vos_timer_platform_t,
							Timer);

	vos_timer_t *timer = container_of(platformInfo_ptr, vos_timer_t,
						platformInfo);

	vos_linux_timer_callback(timer);
}

static void vos_timer_setup(vos_timer_t *timer, bool deferrable)
{
	uint32_t flags = 0;

	if (deferrable)
		flags |= TIMER_DEFERRABLE;
	timer_setup(&(timer->platformInfo.Timer), vos_timer_shim,
		    flags);
}
#else
static void vos_timer_shim(unsigned long data)
{
	vos_timer_t *timer = (vos_timer_t *)data;

	vos_linux_timer_callback(timer);
}

static void vos_timer_setup(vos_timer_t *timer, bool deferrable)
{
	if (deferrable)
		init_timer_deferrable(&timer->platformInfo.Timer);
	else
		init_timer(&timer->platformInfo.Timer);
	timer->platformInfo.Timer.function = vos_timer_shim;
	timer->platformInfo.Timer.data = (unsigned long)timer;
}
#endif

/*--------------------------------------------------------------------------
  
  \brief vos_timer_init() - Initialize a vOSS timer.
@@ -484,12 +524,7 @@ static inline VOS_STATUS __vos_timer_init_debug(vos_timer_t *timer,
    * with arguments passed or with default values
    */
   spin_lock_init(&timer->platformInfo.spinlock);
   if(deferrable)
     init_timer_deferrable(&(timer->platformInfo.Timer));
   else
     init_timer(&(timer->platformInfo.Timer));
   timer->platformInfo.Timer.function = vos_linux_timer_callback;
   timer->platformInfo.Timer.data = (unsigned long)timer;
   vos_timer_setup(timer, deferrable);
   timer->callback = callback;
   timer->userData = userData;
   timer->type = timerType;
@@ -541,12 +576,7 @@ static inline VOS_STATUS __vos_timer_init(vos_timer_t *timer,
    * with arguments passed or with default values
    */
   spin_lock_init(&timer->platformInfo.spinlock);
   if(deferrable)
     init_timer_deferrable(&(timer->platformInfo.Timer));
   else
     init_timer(&(timer->platformInfo.Timer));
   timer->platformInfo.Timer.function = vos_linux_timer_callback;
   timer->platformInfo.Timer.data = (unsigned long)timer;
   vos_timer_setup(timer, deferrable);
   timer->callback = callback;
   timer->userData = userData;
   timer->type = timerType;