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

Commit db3d3302 authored by Ghanim Fodi's avatar Ghanim Fodi Committed by Bojun Pan
Browse files

msm: ipa: update ipa driver APIs for recent wakeup_source and dma



This change will ensure the APIs are updated correctly to the
latest for wakeup_source and dma functions.

Change-Id: Iaaffe6f876dab3824f7a8b72f9d71be686033a6b
Acked-by: default avatarPriyadarshini Rajagopal <prajagop@qti.qualcomm.com>
Signed-off-by: default avatarBojun Pan <bojunp@codeaurora.org>
Signed-off-by: default avatarGhanim Fodi <gfodi@codeaurora.org>
parent e2130b20
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -10,7 +10,10 @@

# include "gsi.h"
# include "gsi_reg.h"

#if defined(CONFIG_IPA_EMULATION)
# include "gsi_emulation_stubs.h"
#endif

# define gsi_emu_readl(c)     (readl_relaxed(c))
# define gsi_emu_writel(v, c) ({ __iowmb(); writel_relaxed((v), (c)); })
+12 −12
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ struct ipa_rm_it_private {
	bool reschedule_work;
	bool work_in_progress;
	unsigned long jiffies;
	struct wakeup_source w_lock;
	struct wakeup_source *w_lock;
	char w_lock_name[MAX_WS_NAME];
};

@@ -83,7 +83,7 @@ static void ipa_rm_inactivity_timer_func(struct work_struct *work)
	} else {
		IPA_RM_DBG_LOW("calling release_resource on resource %d\n",
			me->resource_name);
		__pm_relax(&ipa_rm_it_handles[me->resource_name].w_lock);
		__pm_relax(ipa_rm_it_handles[me->resource_name].w_lock);
		ipa_rm_release_resource(me->resource_name);
		ipa_rm_it_handles[me->resource_name].work_in_progress = false;
	}
@@ -107,7 +107,6 @@ static void ipa_rm_inactivity_timer_func(struct work_struct *work)
int ipa_rm_inactivity_timer_init(enum ipa_rm_resource_name resource_name,
				 unsigned long msecs)
{
	struct wakeup_source *pwlock;
	char *name;

	IPA_RM_DBG_LOW("resource %d\n", resource_name);
@@ -129,10 +128,16 @@ int ipa_rm_inactivity_timer_init(enum ipa_rm_resource_name resource_name,
	ipa_rm_it_handles[resource_name].resource_requested = false;
	ipa_rm_it_handles[resource_name].reschedule_work = false;
	ipa_rm_it_handles[resource_name].work_in_progress = false;
	pwlock = &(ipa_rm_it_handles[resource_name].w_lock);
	name = ipa_rm_it_handles[resource_name].w_lock_name;
	snprintf(name, MAX_WS_NAME, "IPA_RM%d\n", resource_name);
	wakeup_source_init(pwlock, name);
	ipa_rm_it_handles[resource_name].w_lock =
		wakeup_source_register(NULL, name);
	if (!ipa_rm_it_handles[resource_name].w_lock) {
		IPA_RM_ERR("IPA wakeup source register failed %s\n",
			name);
		return -ENOMEM;
	}

	INIT_DELAYED_WORK(&ipa_rm_it_handles[resource_name].work,
			  ipa_rm_inactivity_timer_func);
	ipa_rm_it_handles[resource_name].initied = true;
@@ -151,8 +156,6 @@ EXPORT_SYMBOL(ipa_rm_inactivity_timer_init);
 */
int ipa_rm_inactivity_timer_destroy(enum ipa_rm_resource_name resource_name)
{
	struct wakeup_source *pwlock;

	IPA_RM_DBG_LOW("resource %d\n", resource_name);

	if (resource_name < 0 ||
@@ -168,10 +171,7 @@ int ipa_rm_inactivity_timer_destroy(enum ipa_rm_resource_name resource_name)
	}

	cancel_delayed_work_sync(&ipa_rm_it_handles[resource_name].work);
	pwlock = &(ipa_rm_it_handles[resource_name].w_lock);
	/* wakeup_source_trash(pwlock); */
	wakeup_source_remove(pwlock);
	__pm_relax(pwlock);
	wakeup_source_unregister(ipa_rm_it_handles[resource_name].w_lock);

	memset(&ipa_rm_it_handles[resource_name], 0,
	       sizeof(struct ipa_rm_it_private));
@@ -266,7 +266,7 @@ int ipa_rm_inactivity_timer_release_resource(
	}
	ipa_rm_it_handles[resource_name].work_in_progress = true;
	ipa_rm_it_handles[resource_name].reschedule_work = false;
	__pm_stay_awake(&ipa_rm_it_handles[resource_name].w_lock);
	__pm_stay_awake(ipa_rm_it_handles[resource_name].w_lock);
	IPA_RM_DBG_LOW("setting delayed work\n");
	queue_delayed_work(system_unbound_wq,
			      &ipa_rm_it_handles[resource_name].work,
+14 −5
Original line number Diff line number Diff line
@@ -5118,7 +5118,7 @@ void ipa3_inc_acquire_wakelock(void)
	spin_lock_irqsave(&ipa3_ctx->wakelock_ref_cnt.spinlock, flags);
	ipa3_ctx->wakelock_ref_cnt.cnt++;
	if (ipa3_ctx->wakelock_ref_cnt.cnt == 1)
		__pm_stay_awake(&ipa3_ctx->w_lock);
		__pm_stay_awake(ipa3_ctx->w_lock);
	IPADBG_LOW("active wakelock ref cnt = %d\n",
		ipa3_ctx->wakelock_ref_cnt.cnt);
	spin_unlock_irqrestore(&ipa3_ctx->wakelock_ref_cnt.spinlock, flags);
@@ -5141,7 +5141,7 @@ void ipa3_dec_release_wakelock(void)
	IPADBG_LOW("active wakelock ref cnt = %d\n",
		ipa3_ctx->wakelock_ref_cnt.cnt);
	if (ipa3_ctx->wakelock_ref_cnt.cnt == 0)
		__pm_relax(&ipa3_ctx->w_lock);
		__pm_relax(ipa3_ctx->w_lock);
	spin_unlock_irqrestore(&ipa3_ctx->wakelock_ref_cnt.spinlock, flags);
}

@@ -6811,8 +6811,14 @@ static int ipa3_pre_init(const struct ipa3_plat_drv_res *resource_p,
		goto fail_device_create;
	}

	/* Create a wakeup source. */
	wakeup_source_init(&ipa3_ctx->w_lock, "IPA_WS");
	/* Register a wakeup source. */
	ipa3_ctx->w_lock =
		wakeup_source_register(&ipa_pdev->dev, "IPA_WS");
	if (!ipa3_ctx->w_lock) {
		IPAERR("IPA wakeup source register failed\n");
		result = -ENOMEM;
		goto fail_w_source_register;
	}
	spin_lock_init(&ipa3_ctx->wakelock_ref_cnt.spinlock);

	/* Initialize Power Management framework */
@@ -6897,8 +6903,11 @@ static int ipa3_pre_init(const struct ipa3_plat_drv_res *resource_p,
	ipa3_dma_shutdown();
fail_ipa_dma_setup:
	ipa_pm_destroy();
fail_ipa_pm_init:
fail_w_source_register:
	device_destroy(ipa3_ctx->cdev.class, ipa3_ctx->cdev.dev_num);
fail_ipa_pm_init:
	wakeup_source_unregister(ipa3_ctx->w_lock);
	ipa3_ctx->w_lock = NULL;
fail_device_create:
	unregister_chrdev_region(ipa3_ctx->cdev.dev_num, 1);
fail_alloc_chrdev_region:
+1 −1
Original line number Diff line number Diff line
@@ -1889,7 +1889,7 @@ struct ipa3_context {
	bool gsi_ch20_wa;
	bool s1_bypass_arr[IPA_SMMU_CB_MAX];
	u32 wdi_map_cnt;
	struct wakeup_source w_lock;
	struct wakeup_source *w_lock;
	struct ipa3_wakelock_ref_cnt wakelock_ref_cnt;
	/* RMNET_IOCTL_INGRESS_FORMAT_AGG_DATA */
	bool ipa_client_apps_wan_cons_agg_gro;
+3 −1
Original line number Diff line number Diff line
@@ -9,10 +9,12 @@
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/uaccess.h>
#include <linux/dma-noncoherent.h>
#include "ipa_i.h"
#include "ipahal/ipahal.h"
#include "ipahal/ipahal_nat.h"


/*
 * The following for adding code (ie. for EMULATION) not found on x86.
 */
@@ -114,7 +116,7 @@ static int ipa3_nat_ipv6ct_mmap(struct file *filp, struct vm_area_struct *vma)
	}
	/* check if smmu enable & dma_coherent mode */
	if (!cb->valid ||
		!is_device_dma_coherent(cb->dev)) {
		!dev_is_dma_coherent(cb->dev)) {
		vma->vm_page_prot =
		pgprot_noncached(vma->vm_page_prot);
		IPADBG("App smmu enable in DMA mode\n");
Loading